query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
springmanaged object created to allow app to access whitelist filter
@Bean public Whitelist whitelist() { return new Whitelist(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void attachFilter(ConfigContext ctx, Entity entity) {\n\t}", "public PreOauth2SSOGatewayFilter() {\n super(Config.class);\n }", "@Override\r\n protected Filter[] getServletFilters() {\r\n return new Filter[]{\r\n //new DelegatingFilterProxy(\"springSecurityFilterChain\")\r\n new OpenEntityManagerInViewFilter()\r\n };\r\n }", "@Bean\n\tpublic MetadataGeneratorFilter metadataGeneratorFilter() {\n\t\treturn new MetadataGeneratorFilter(metadataGenerator());\n\t}", "public ObjectFilter()\n\t{\n\t}", "PropertiedObjectFilter<O> getFilter();", "@Bean\n public MetadataGeneratorFilter metadataGeneratorFilter() {\n return new MetadataGeneratorFilter(metadataGenerator());\n }", "public interface SharedWorkAreaFilter extends Filter {\n\n /**\n * @param userName\n */\n public void setUserName(String userName);\n \n /**\n * @return userName\n */\n public String getUserName();\n \n /**\n * @param firstName\n */\n public void setFirstName(String firstName);\n \n /**\n * @return First Name\n */\n public String getFirstName();\n \n /**\n * @param lastName\n */\n public void setLastName(String lastName);\n \n /**\n * @return Last Name\n */\n public String getLastName();\n \n /**\n * @param primaryDispatchCenter\n */\n public void setPrimaryDispatchCenter(String primaryDispatchCenter);\n \n /**\n * @return Primary Dispatch Center\n */\n public String getPrimaryDispatchCenter();\n \n /**\n * @param primaryOrganization\n */\n public void setPrimaryOrganization(String primaryOrganization);\n \n /**\n * @return Primary Organization\n */\n public String getPrimaryOrganization();\n \n /**\n * @return the {@link Collection} of roleVoIds\n */\n public Collection<Integer> getRoleVoIds();\n\n /**\n * @param roleVoIds the {@link Collection} of roleVoIds to set\n */\n public void setRoleVoIds(Collection<Integer> roleVoIds);\n \n public Collection<Long> getRoleVoIdsFromIntegers() throws Exception;\n \n /**\n\t * @param sharedUsers the sharedUsers to set\n\t */\n\tpublic void setSharedUsers(Boolean sharedUsers);\n\t\n\t/**\n\t * @return the sharedUsers\n\t */\n\tpublic Boolean getSharedUsers();\n}", "public ValidatorFilter() {\n\n\t}", "public interface EntityBasedFilterGenerator extends RuleListComponent {\r\n\r\n /**\r\n * Generates restriction base on supplied entity instance.\r\n * \r\n * @param entityInstReader\r\n * entity instance reader\r\n * @param rule\r\n * the process rule to use (optional)\r\n * @throws UnifyException\r\n * if an error occurs\r\n */\r\n Restriction generate(ValueStoreReader entityInstReader, String rule) throws UnifyException;\r\n}", "@PreAuthorize(\"hasRole('ADMIN')\")\n public ProductDto retrieveAuthorizedProducts() { \n return new ProductDto(\"1\", \"iPhone\", 999.99f);\n }", "private SpringBoHelper() {\n\n\t}", "public void setWhitelistEnabled(Boolean whitelistEnabled) {\n this.whitelistEnabled = whitelistEnabled;\n }", "Collection<T> doFilter(RepositoryFilterContext context);", "protected Spring() {}", "@Override\n public void filter(ContainerRequestContext requestContext) throws IOException {\n String authorizationHeader =\n requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);\n\n // Validate the Authorization header\n if (!isTokenBasedAuthentication(authorizationHeader)) {\n abortWithUnauthorized(requestContext);\n return;\n }\n\n // Extract the token from the Authorization header\n String token = authorizationHeader\n .substring(AUTHENTICATION_SCHEME.length()).trim();\n\n try {\n // Check if the token is valid\n validateToken(token);\n\n //extract the data you need\n String username = Jwts.parser().setSigningKey(keyGenerator.getKey()).parseClaimsJws(token).getBody().getIssuer();\n if (username!=null) {\n final SecurityContext securityContext = requestContext.getSecurityContext();\n requestContext.setSecurityContext(new SecurityContext() {\n @Override\n public Principal getUserPrincipal() {\n return new Principal() {\n @Override\n public String getName() {\n return username;\n }\n };\n }\n @Override\n public boolean isUserInRole(String permission) {\n\n List<RoleEntity> roleEntities = userDao.getUserByUsername(username).getRoleEntityList();\n List<PermissionEntity> permissionEntities = new ArrayList<>();\n\n //creating the list containg all the permissionsAllowed\n for (RoleEntity r : roleEntities) {\n for (PermissionEntity p : r.getPermissionEntityList()) {\n if (!permissionEntities.contains(p)) {\n permissionEntities.add(p);\n }\n }\n\n }\n\n List<String> permissionStrings = new ArrayList<>();\n\n //getting all the types (description and id are not important)\n for (PermissionEntity p : permissionEntities) {\n permissionStrings.add(p.getType());\n }\n\n //returns true if the list contains the permission given as parameter\n for (String p : permissionStrings) {\n if (p.equals(permission)) {\n return true;\n }\n }\n return false;\n }\n @Override\n public boolean isSecure() {\n return true;\n }\n @Override\n public String getAuthenticationScheme() {\n return AUTHENTICATION_SCHEME;\n }\n });\n }\n //getting value from annotation\n Method resourceMethod = resourceInfo.getResourceMethod();\n Secured secured = resourceMethod.getAnnotation(Secured.class);\n if (secured != null){\n List<String> permissionStrings = new ArrayList<>();\n for (SecurityPermission s : secured.permissionsAllowed()) {\n permissionStrings.add(s.getText());\n }\n\n //performing authorization\n if (permissionStrings.size() > 0 && !isAuthenticated(requestContext)) {\n refuseRequest();\n }\n\n for (String role : permissionStrings) {\n if (requestContext.getSecurityContext().isUserInRole(role)) {\n return;\n }\n else {\n throw new AuthentificationException(ExceptionMessageCatalog.NOT_ALLOWED);\n }\n }\n\n refuseRequest();\n }\n } catch (AuthentificationException e) {\n abortWithUnauthorized(requestContext);\n }\n }", "@Override\n\tpublic void init(FilterConfig filterConfig) {\n\n\t}", "public void addBusinessFilterToCreator(ViewerFilter filter);", "void setFilter(final PropertiedObjectFilter<O> filter);", "@Override\n public boolean shouldFilter() {\n return true;\n }", "public void addBusinessFilterToPolicyEntries(ViewerFilter filter);", "public void init(FilterConfig config) {}", "@Override\n public void init(FilterConfig config) {\n }", "public interface FilterService {\n\n /**Method that will getFilteredItems the filter and return the result as a JSONArray\n * @return the filtered result as a JSONArray*/\n List<JSONObject> getFilteredItems();\n\n /**Method that returns the name of the class\n * @return class simple name*/\n String getFilterName();\n\n /**Method that prints all items on the list*/\n void printFilteredItems();\n\n /**Method that prints the number of the items on the list*/\n void printNumberOfFilteredItems();\n\n // TODO IMPLEMENTED WITH OSGI Method that will return the number of the selected number, used for managing the filters\n //int getFilterNumber();\n}", "@Override\n public void testCreateRequestListAllFilteredBySourceSystem(){\n }", "private ProductFilterUtils(){}", "@Override\n public void testCreateRequestListSomeFilteredBySourceSystem(){\n }", "public DefaultPolicyFilter()\n\t{\n\t\tthis.compiler = new StackMachineCompiler();\n\t\tthis.executionEngine = new StackMachine();\n\t}", "@JsonIgnoreProperties({\"ezdUmg\"})\npublic interface BigretUsersFilter {\n}", "static ObjectInputFilter createFilter(String param2String, boolean param2Boolean) {\n/* 446 */ Global global = new Global(param2String, param2Boolean);\n/* 447 */ return global.isEmpty() ? null : global;\n/* */ }", "private Filter ssoFilter() {\n\t\tCompositeFilter filter = new CompositeFilter();\n\t\tList<Filter> filters = new ArrayList<>();\n\t\tfilters.add(ssoFilter(facebook(), \"/login/facebook\"));\n\t\tfilters.add(ssoFilter(github(), \"/login/github\"));\n//\t\tfilters.add(ssoFilter(twitter(), \"/login/twitter\"));\n\t\tfilters.add(ssoFilter(linkedin(), \"/login/linkedin\"));\n\t\tfilter.setFilters(filters);\n\t\treturn filter;\n\t}", "static ObjectInputFilter createFilter(String param2String, boolean param2Boolean) {\n/* 448 */ Global global = new Global(param2String, param2Boolean);\n/* 449 */ return global.isEmpty() ? null : global;\n/* */ }", "protected List<Object> getPreFilters(List<Object> list, Class<T> entityClass, Pageable filter)\r\n {\r\n if (preFilterAccessor != null) {\r\n list.addAll(preFilterAccessor.getPreFilters(entityClass, filter));\r\n }\r\n return list;\r\n }", "public RegisterFilter() {\n\t\tqueryList = new ArrayList<QueryPart>();\n\t\torderList = new ArrayList<OrderPart>();\n\t}", "@Bean\n @Order(-100)\n @ConditionalOnProperty(name = \"soul.cross.enabled\", havingValue = \"true\")\n public WebFilter crossFilter() {\n return new CrossFilter();\n }", "public GroupsOnlySenseFilter() {\n \n }", "@SuppressWarnings(\"unused\")\n\tprivate Filter() {\n\n\t}", "public BlobFilterDetails() {\n }", "@Override\n public void init(FilterConfig filterConfig) throws ServletException {\n }", "@Override\n\tpublic List<PropertyFilter> buildPropertyFilter(CcNoticereceive entity) {\n\t\treturn null;\n\t}", "public HttpFilter() { }", "public void addBusinessFilterToAttributes(ViewerFilter filter);", "public CustomApplication() \n {\n packages(\"com.SApp.Ticket.tools\");\n// register(LoggingFilter.class);\n \n //Register Auth Filter here\n register(AuthenticationFilter.class);\n }", "@Override\n\tpublic boolean shouldFilter() {\n\t\treturn true;\n\t}", "@Override\n public void init(FilterConfig filterConfig) throws ServletException {\n\n }", "void handleManualFilterRequest();", "public interface DemoService {\n @RolesAllowed(\"ROLE_ADMIN\")\n List<UserEntity> findByUsername(String name);\n}", "@Override\n public List<ResourceFilter> create(AbstractMethod am) {\n if (am.isAnnotationPresent(DenyAll.class)) {\n// return Collections.<ResourceFilter>singletonList(new RestAuthenticationFilter());\n return new ArrayList<ResourceFilter>(Arrays.asList(new RestAuthenticationFilter(AuthType.DENNY_ALL_METHOD)));\n }\n\n // RolesAllowed on the method takes precedence over PermitAll\n RolesAllowed ra = am.getAnnotation(RolesAllowed.class);\n if (ra != null) {\n// return Collections.<ResourceFilter>singletonList(new RestAuthenticationFilter(ra.value()));\n return new ArrayList<ResourceFilter>(Arrays.asList(new RestAuthenticationFilter(AuthType.ROLES_ALLOWED_METHOD, ra.value())));\n }\n\n // PermitAll takes precedence over RolesAllowed on the class\n if (am.getResource().isAnnotationPresent(PermitAll.class)) {\n if (am.getResource().isAnnotationPresent(Authenticated.class)) {\n// return Collections.<ResourceFilter>singletonList(new RestAuthenticationFilter(true));\n return new ArrayList<ResourceFilter>(Arrays.asList(new RestAuthenticationFilter(AuthType.PERMIT_ALL_CLASS)));\n }\n return new ArrayList<ResourceFilter>(Arrays.asList(new RestAuthenticationFilter(AuthType.UNAUTHENTICATED)));\n }\n\n // RolesAllowed on the class takes precedence over PermitAll\n ra = am.getResource().getAnnotation(RolesAllowed.class);\n if (ra != null) {\n// return Collections.<ResourceFilter>singletonList(new RestAuthenticationFilter(ra.value()));\n return new ArrayList<ResourceFilter>(Arrays.asList(new RestAuthenticationFilter(AuthType.ROLES_ALLOWED_CLASS, ra.value())));\n }\n\n if (am.getResource().isAnnotationPresent(Authenticated.class)\n && !am.isAnnotationPresent(DenyAll.class)\n && !am.isAnnotationPresent(RolesAllowed.class)) {\n// return Collections.<ResourceFilter>singletonList(new RestAuthenticationFilter(ra.value()));\n return new ArrayList<ResourceFilter>(Arrays.asList(new RestAuthenticationFilter(AuthType.PERMIT_ALL_METHOD)));\n }\n\n // No need to check whether PermitAll is present.\n return null;\n }", "public void setFilter(EntityFilter filter);", "public Filters() {\n }", "public FilterProductsByCategoryManagedBean() {\n }", "@PostConstruct\n @SuppressWarnings(\"unchecked\")\n protected void initialize() {\n checkRequiredFields();\n try {\n // Create new instance of ConfigurationFileManager:\n ConfigurationFileManager cfm = new ConfigurationFileManager(\n configFileName);\n // Get ConfigurationObject with key configNamespace and extract\n // properties as per CS 3.2.3.\n ConfigurationObject config = cfm.getConfiguration(configNamespace);\n if (config == null) {\n throw new DAOConfigurationException(\n \"Cannot found ConfigurationObject with namespace:\"\n + configNamespace);\n }\n ConfigurationObject configObject = config.getChild(configNamespace);\n if (configObject == null) {\n throw new DAOConfigurationException(\n \"Cannot found ConfigurationObject with name:\"\n + configNamespace);\n }\n String tokenKey = \"search_by_filter_utility_token\";\n String token = null;\n try {\n token = (String) configObject.getPropertyValue(tokenKey);\n } catch (ClassCastException e) {\n throw new DAOConfigurationException(\"The '\" + tokenKey\n + \"' should be String.\", e);\n }\n if (token == null || token.trim().length() == 0) {\n throw new DAOConfigurationException(\n \"The 'search_by_filter_utility_token' property should\"\n + \" be configed and not be empty string.\");\n }\n // Create a new SearchByFilterUtility instance through Object\n // Factory get ConfigurationObjectSpecificationFactory\n ConfigurationObjectSpecificationFactory configurationObjectSpecificationFactory =\n new ConfigurationObjectSpecificationFactory(\n configObject);\n // get ObjectFactory\n ObjectFactory objectFactory = new ObjectFactory(\n configurationObjectSpecificationFactory);\n String searchBundleName = \"HibernateSearchBundle_\"\n + entityBeanType.getSimpleName();\n Object obj = objectFactory.createObject(token, null,\n (ClassLoader) null, new String[] {\n searchBundleManagerNamespace, searchBundleName },\n new Class[] { String.class, String.class },\n ObjectFactory.BOTH);\n if (!(obj instanceof SearchByFilterUtility)) {\n throw new DAOConfigurationException(\n \"The object configed use key:\"\n + token\n + \"should be instance of SearchByFilterUtility.\");\n }\n // Initialize the searchByFilterUtility field.\n this.searchByFilterUtility = (SearchByFilterUtility<T, Id>) obj;\n } catch (Exception e) {\n if (!(e instanceof DAOConfigurationException)) {\n throw new DAOConfigurationException(\n \"Failed to initialize searchByFilterUtility fields of DAO.\",\n e);\n }\n throw (DAOConfigurationException) e;\n }\n }", "public interface Filter {\n\n}", "public BlacklistedValueObject() {\n super();\n }", "@RepositoryRestResource\n@PreAuthorize(\"hasRole('ADMIN')\")\npublic interface ServiceRepository extends JpaRepository<Service,String>{\n}", "public void addBusinessFilterToImplements_(ViewerFilter filter);", "public QuoteFilter(){\n this.sentenceTagger = new SentenceTagger();\n }", "@Override\n protected Filter[] getServletFilters() {\n return new Filter[]{ new DelegatingFilterProxy(\"springSecurityFilterChain\") };\n }", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "@Override\n public GatewayFilter apply(Config config) {\n return (exchange, chain) -> {\n // 获取请求参数\n String ip = exchange.getRequest().getRemoteAddress().getAddress().getHostAddress();\n System.out.println(\"ip地址:\" + ip);\n if(config.getForbidIp().equals(ip)){\n // 放行\n return chain.filter(exchange);\n }\n // 不放行\n exchange.getResponse().setStatusCode(HttpStatus.FORBIDDEN);\n return exchange.getResponse().setComplete();\n };\n }", "public void addBusinessFilterToIncomingLinks(ViewerFilter filter);", "public void addBusinessFilterToMethods(ViewerFilter filter);", "@Override\n public void filter(ContainerRequestContext requestContext)\n throws IOException\n {\n Object listenAddressName = requestContext.getProperty(LISTEN_ADDRESS_NAME_ATTRIBUTE);\n if (listenAddressName == null || !listenAddressName.equals(ServerConfig.ADMIN_ADDRESS)) {\n throw new NotFoundException();\n }\n\n // Only allow admin users\n final AuthenticatedUser user = (AuthenticatedUser) request.getAttribute(\"authenticatedUser\");\n if (user == null || !user.isAdmin()) {\n throw new ForbiddenException();\n }\n }", "public interface ContentModelFilter {\n\n\n boolean isAttributeDatastream(String dsid, List<String> types);\n\n\n boolean isChildRel(String predicate, List<String> types);\n}", "private SpringProfile() {}", "@PostConstruct\r\n\tpublic void init() {\n\t\tzeroLeggedOAuthProviderProcessingFilter = new ZeroLeggedOAuthProviderProcessingFilter(\r\n\t\t\t\toauthConsumerDetailsService, oauthNonceServices, oauthProcessingFilterEntryPoint,\r\n\t\t\t\toauthAuthenticationHandler, oauthProviderTokenServices, true);\r\n\t}", "@GetMapping(\"/filtering-list\")\r\n\tpublic MappingJacksonValue retrieveListBean() {\n\t\tList<SomeBean> list = Arrays.asList(new SomeBean(\"value1\",\"value2\",\"value3\"),\r\n\t\t\t\tnew SomeBean(\"value10\",\"value20\",\"value30\")\r\n\t\t\t\t);\r\n\t\tMappingJacksonValue mapping = new MappingJacksonValue(list);\r\n\t\tSimpleBeanPropertyFilter filter = SimpleBeanPropertyFilter.filterOutAllExcept(\"field3\", \"field2\");\r\n\t\tFilterProvider filters = new SimpleFilterProvider().addFilter(\"SomeBeanFilter\", filter);\r\n\t\tmapping.setFilters(filters);\r\n\t\treturn mapping;\r\n\t}", "public void addBusinessFilterToReader(ViewerFilter filter);", "@Repository\npublic interface IDealRepository extends CrudRepository<Deal, UUID> {\n\n @AllowFiltering\n Optional<Deal> findById(@NotNull final UUID id);\n\n /**\n * Find by menu id list.\n *\n * @param menuId the menu id\n *\n * @return the list\n */\n @AllowFiltering\n List<Deal> findByMenuId(final UUID menuId);\n}", "public void addBusinessFilterToMethodArguments(ViewerFilter filter);", "public Filter() {\n }", "@Override\n public void init(FilterConfig filterConfig) throws ServletException {\n }", "@Override\n public void init(FilterConfig filterConfig) throws ServletException {\n }", "@PreAuthorize(\"hasRole('ADMIN')\")\npublic interface BindUserRepository extends JpaRepository<BindUser, Long> {\n\n Page<BindUser> findAllByAdminUid(@Param(\"adminUid\") Long uid, Pageable pageable);\n}", "@Test\n @DisplayName(\"Test Filtering of the properties field with no admin privileges\")\n void testFilterPrivilegedFields() throws Exception {\n logger.info(\"Testing filtering of properties field with no admin privileges\");\n\n replaceConfiguration(RESOURCE_DIR\n + \"/exporter/rest_filter_jdbc_privileged.yaml\",\n \"wls_datasource_state%7Bname%3D%22TestDataSource%22%7D%5B15s%5D\",\n \"Running, Suspended, Shutdown, Overloaded, Unknown\", \"TestDataSource\");\n }", "@PreAuthorize(\"checkPermission('Legal Entity', 'Manage Legal Entities', {'view','create'})\")\n @GetMapping(\n produces = {\"application/json\"})\n @ResponseStatus(HttpStatus.OK)\n public void sampleEndpointThatRequiresUserToHavePermissionsToViewCreateLegalEnitites() {\n LOGGER.info(\"Preauthorize annotation have checked that user has permissions to view/create legal entities\");\n // continue custom implementation ...\n }", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\n\t}", "void filterCreate(ServerContext context, CreateRequest request,\n ResultHandler<Resource> handler, RequestHandler next);", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "@Pointcut(\"within(@org.springframework.web.bind.annotation.RestController *)\")\n public void springBeanPointcut() {\n // Method is empty as this is just a Pointcut, the implementations are in the advices.\n }", "@Override\r\n\tprotected void preFilter(Procedure procedure) {\r\n\t\tsuper.preFilter(procedure);\r\n\t}", "public SecurityHandler customObject(Object object) {\n return builder(this).customObject(object).build();\n }", "private FilterChain loadFilters() {\n\t\ttry {\n\t\t\tAnnotation.scan(\"src/main/java/com/qa/app\");\n\t\t} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException\n\t\t\t\t| InvocationTargetException | NoSuchMethodException | SecurityException | IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}", "@Bean\n public FilterRegistrationBean registration(StatelessAuthenticationFilter filter) {\n FilterRegistrationBean<StatelessAuthenticationFilter> registration = new FilterRegistrationBean<>(filter);\n registration.setEnabled(false);\n return registration;\n }", "@Override\r\n public void init(FilterConfig filterConfig) throws ServletException {\n }", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\r\n\t}", "@Override\n public Filter getFilter() {\n return scenarioListFilter;\n }", "protected void onInit() {\n super.onInit();\n securityManager = (com.sustain.security.SustainSecurityManager) getBean(\"securityManager\");\n }", "List<BizUserWhiteList> selectByExample(BizUserWhiteListExample example);", "public void addBusinessFilterToParentModule(ViewerFilter filter);", "TokenFilter(TokenProvider provider) {\n this.provider = provider;\n }", "CompiledFilter() {\n }", "public void addFilterToPolicyEntries(ViewerFilter filter);", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}" ]
[ "0.60698116", "0.59961605", "0.5714515", "0.5664489", "0.5659719", "0.56261146", "0.5581398", "0.55599207", "0.5552693", "0.5400993", "0.53644836", "0.53641516", "0.53402126", "0.5338669", "0.5321059", "0.5320064", "0.5318569", "0.5297592", "0.5296393", "0.5283286", "0.5263193", "0.5255987", "0.5252003", "0.52328056", "0.52217764", "0.52211154", "0.5189334", "0.5182108", "0.5180904", "0.51797557", "0.51659226", "0.51607037", "0.5158632", "0.5156023", "0.51362216", "0.5115091", "0.5113848", "0.5106066", "0.510402", "0.50925106", "0.5087469", "0.508634", "0.50794435", "0.5076201", "0.5071281", "0.50677896", "0.50648737", "0.5061979", "0.5036921", "0.50288665", "0.5025011", "0.5016599", "0.5015536", "0.50076586", "0.5005701", "0.49800068", "0.49729818", "0.4969715", "0.49663812", "0.49647972", "0.49633235", "0.4959861", "0.49464273", "0.49422643", "0.49353632", "0.49336594", "0.4930729", "0.49244246", "0.49239117", "0.49177912", "0.49101898", "0.4908793", "0.4908793", "0.49002972", "0.4899858", "0.48978972", "0.48919046", "0.48919046", "0.48918578", "0.4889672", "0.4889672", "0.4889672", "0.4889672", "0.48886454", "0.48791057", "0.48752284", "0.48712066", "0.48653248", "0.48647255", "0.48626468", "0.48626468", "0.4860395", "0.48595172", "0.48522905", "0.48503917", "0.48475897", "0.48422745", "0.48374218", "0.48360643", "0.48360643" ]
0.6848885
0
register filter with spring container
@Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor( whitelist() ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void register(ExtendedHttpService service, FilterProxy<? extends Filter> filter)\n throws ServletException, NamespaceException {\n service.registerFilter(\"/\", filter, null, null);\n }", "public void onStartup(ServletContext arg0) throws ServletException {\n\n Dynamic cros = arg0.addFilter(\"WebContextFilter\",com.example.arcface.config.WebContextFilter.class );\n cros.addMappingForUrlPatterns(null, false, \"/*\");\n\n }", "@Override\n public void init(FilterConfig filterConfig) throws ServletException {\n }", "public CustomApplication() \n {\n packages(\"com.SApp.Ticket.tools\");\n// register(LoggingFilter.class);\n \n //Register Auth Filter here\n register(AuthenticationFilter.class);\n }", "@Override\n public void init(FilterConfig filterConfig) throws ServletException {\n\n }", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Override\n public void init(FilterConfig filterConfig) throws ServletException {\n }", "@Override\n public void init(FilterConfig filterConfig) throws ServletException {\n }", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\n\t}", "public void init(FilterConfig config) {}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\tSystem.out.print(\"过滤器初始化\");\n\t\t\n\t}", "@Override\r\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\r\n\t}", "@Override\n\tpublic void filter(ContainerRequestContext context) throws IOException {\n\t}", "@Override\r\n public void init(FilterConfig filterConfig) throws ServletException {\n }", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\tSystem.out.println(\"系统启动时初始化filter\");\n\t}", "@Override\n\tpublic void init(FilterConfig config) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\tSystem.out.print(\"过滤初始\");\n\t}", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException\n\t{\n\t\t\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\r\n\t}", "@Override\n public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, Filter filter) {\n return null;\n }", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "void registerFilterListener(FilterListener listener);", "@Override\r\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\t\r\n\t}", "public void init(FilterConfig filterConfig) throws ServletException {\r\n }", "public void init(FilterConfig arg0) throws ServletException {\n\n\t}", "public void init(FilterConfig arg0) throws ServletException {\n\t}", "public void init(FilterConfig arg0) throws ServletException {\n\t\t\n }", "public void init(FilterConfig config) throws ServletException {\n }", "@Override\n public void init(FilterConfig config) {\n }", "@Override\n\t\t\tpublic void onStartup(ServletContext servletContext) throws ServletException {\n\t\t\t\tservletContext.addListener(new InitListener());\n\n\t\t\t\t// ValidatorFilter\n\t\t\t\tFilterRegistration.Dynamic registration = servletContext.addFilter(\"validatorFilter\",\n\t\t\t\t\t\tnew ValidatorFilter());\n\t\t\t\tEnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST);\n\t\t\t\t// isMatchAfter false to put it before existing filters\n\t\t\t\tregistration.addMappingForUrlPatterns(dispatcherTypes, false, \"/*\");\n\t\t\t}", "public void init(FilterConfig arg0) throws ServletException {\n\t\tSystem.out.println(\"---------------------拦截器加载---------------------\");\n\t}", "public void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "public void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "public void init(FilterConfig arg0) throws ServletException {\n\t\t\n\t}", "@Bean\n public FilterRegistrationBean registration(HiddenHttpMethodFilter filter) {\n FilterRegistrationBean registration = new FilterRegistrationBean(filter);\n registration.setEnabled(false);\n return registration;\n }", "public void init(FilterConfig arg0) throws ServletException {\n }", "public void init(FilterConfig arg0) throws ServletException {\n\r\n\t}", "public void init(FilterConfig arg0) throws ServletException {\n\r\n\t}", "@Override\r\n\tpublic void init(FilterConfig arg0) throws ServletException {\r\n\t\tSystem.out.println(\"[\" + Calendar.getInstance().getTime() + \"] Iniciando filter\");\r\n\t}", "@Override\n\tpublic void init(FilterConfig fConfig) throws ServletException {\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\tthis.config = filterConfig;\n\t}", "@Bean\n\tpublic MetadataGeneratorFilter metadataGeneratorFilter() {\n\t\treturn new MetadataGeneratorFilter(metadataGenerator());\n\t}", "@Override\n\tpublic void init(FilterConfig filterConfig) throws ServletException {\n\t\tint corePoolSize=3; //最小线程数目\n\t\tint maximumPoolSize=10; //最大线程数\n\t\t//loggerThreadPool=new ThreadPoolExecutor(corePoolSize, maximumPoolSize, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1000));\n\t\tif(logService==null){\n\t\t\t WebApplicationContext webApplicationContext =ContextLoader.getCurrentWebApplicationContext(); \n\t\t\t logService= (UserOperationLogService) webApplicationContext.getBean(UserOperationLogService.class);\n\t\t}\n\t\t\n\t\t\n\t\t//初始化一些不用拦截的url\n\t\tif(noInterceptUrlRegxList==null){\n\t\t\tnoInterceptUrlRegxList=new ArrayList<Pattern>();\n\t\t\tString noInterceptUrl=filterConfig.getInitParameter(\"noInterceptUrlRegx\");\n\t\t\tString[] noInterceptUrlArr=noInterceptUrl.split(\",\");\n\t\t\tfor (String patternStr: noInterceptUrlArr) {\n\t\t\t\tPattern pattern=Pattern.compile(patternStr);\n\t\t\t\tnoInterceptUrlRegxList.add(pattern);\n\t\t\t}\n\t\t}\n\n\t}", "public void init(FilterConfig arg0) throws ServletException {\n\t\t\r\n\t}", "@Bean\n public FilterRegistrationBean registration(StatelessAuthenticationFilter filter) {\n FilterRegistrationBean<StatelessAuthenticationFilter> registration = new FilterRegistrationBean<>(filter);\n registration.setEnabled(false);\n return registration;\n }", "@Override\n\tpublic void init(FilterConfig filterConfig) {\n\n\t}", "@Override\n public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, String className) {\n return null;\n }", "public void init(FilterConfig filterConfig) throws ServletException {\n\r\n\t}", "public void init(FilterConfig filterConfig) throws ServletException {\n\r\n\t}", "@Override\n public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass) {\n return null;\n }", "@Override\n\tpublic void doFilter(ServletRequest request, ServletResponse response,\n\t\t\tFilterChain chain) throws IOException, ServletException {\n\t\t\n\t}", "@Bean\n public MetadataGeneratorFilter metadataGeneratorFilter() {\n return new MetadataGeneratorFilter(metadataGenerator());\n }", "@Override\n\tpublic void init(FilterConfig arg0) throws ServletException {\n\t\t\tSystem.out.println(\"╔˙│╔filter\");\n\t}", "@Override\n protected Filter[] getServletFilters() {\n return new Filter[]{ new DelegatingFilterProxy(\"springSecurityFilterChain\") };\n }", "@Override\n\tpublic void init(FilterConfig config) throws ServletException {\n\t\tthis.filterConfig=config;\n\t}", "public void init(FilterConfig arg0) throws ServletException {\n\t\tSystem.out.println(\"UserFilter Initialized\");\r\n\t\t\r\n\t}", "@Override\r\n protected Filter[] getServletFilters() {\r\n return new Filter[]{\r\n //new DelegatingFilterProxy(\"springSecurityFilterChain\")\r\n new OpenEntityManagerInViewFilter()\r\n };\r\n }", "@Bean\r\n public FilterRegistrationBean loginFilter() {\r\n FilterRegistrationBean reg = new FilterRegistrationBean();\r\n reg.setFilter(new SessionExpiredFilter());\r\n reg.addUrlPatterns(\"*.xhtml\");\r\n return reg;\r\n }", "public RegisterFilter() {\n\t\tqueryList = new ArrayList<QueryPart>();\n\t\torderList = new ArrayList<OrderPart>();\n\t}", "@Bean\n\tpublic FilterRegistrationBean<CorsFilter> corsFilter(){\n\t\tFilterRegistrationBean<CorsFilter> beanFilter = \n\t\t\t\tnew FilterRegistrationBean<CorsFilter>\n\t\t(new CorsFilter(corsConfigurationSource()));\n\t\t\n\t\tbeanFilter.setOrder(Ordered.HIGHEST_PRECEDENCE);\n\t\treturn beanFilter;\n\t}", "@Override\n public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {\n ServletEventListenerManager listenerManager = servletContext.getServletEventListenerManager();\n\n if(pos == 0){\n ServletHttpServletRequest httpServletRequest = ServletUtil.unWrapper(request);\n httpServletRequest.setMultipartConfigElement(servletRegistration.getMultipartConfigElement());\n httpServletRequest.setServletSecurityElement(servletRegistration.getServletSecurityElement());\n\n //Initialization Servlet\n if(servletRegistration.isInitServletCas(false,true)){\n servletRegistration.getServlet().init(servletRegistration.getServletConfig());\n }\n if(listenerManager.hasServletRequestListener()) {\n listenerManager.onServletRequestInitialized(new ServletRequestEvent(servletContext,request));\n }\n }\n\n if(pos < filterRegistrationList.size()){\n ServletFilterRegistration filterRegistration = filterRegistrationList.get(pos);\n pos++;\n Filter filter = filterRegistration.getFilter();\n filter.doFilter(request, response, this);\n\n FILTER_SET.add(filter);\n }else {\n try {\n long filterEndTime = System.currentTimeMillis();\n FILTER_TIME.addAndGet(filterEndTime - beginTime);\n\n servletRegistration.getServlet().service(request, response);\n\n SERVLET_TIME.addAndGet(System.currentTimeMillis() - filterEndTime);\n }finally {\n if(listenerManager.hasServletRequestListener()) {\n listenerManager.onServletRequestDestroyed(new ServletRequestEvent(servletContext,request));\n }\n\n //Reclaim asynchronous requests\n if(request instanceof ServletHttpAsyncRequest){\n ((ServletHttpAsyncRequest)request).getAsyncContext().recycle();\n }\n\n //Recycling itself\n recycle();\n }\n }\n }", "@Override\n protected javax.servlet.Filter[] getServletFilters() {\n DelegatingFilterProxy delegateFilterProxy = new DelegatingFilterProxy();\n delegateFilterProxy.setTargetBeanName(\"springSecurityFilterChain\");\n return new Filter[] { delegateFilterProxy };\n }", "public PreOauth2SSOGatewayFilter() {\n super(Config.class);\n }", "@Override\n\tpublic void init(FilterConfig filterConfig)\n\t\tthrows ServletException\n\t{\n\t\tServletContext ctx = filterConfig.getServletContext();\n\t\tInjector injector = (Injector) ctx.getAttribute(Injector.class.getName());\n\n\t\t// Create the real implementation\n\t\tStage stage = injector.getInstance(Stage.class);\n\t\tClass<? extends Production> type = stage == Stage.PRODUCTION ? Production.class : Development.class;\n\t\timpl = injector.getInstance(type);\n\n\t\t// Initialize all filters and servlets\n\t\timpl.doInit();\n\t}" ]
[ "0.6716157", "0.6618821", "0.6578957", "0.65747595", "0.6562385", "0.6557104", "0.6505315", "0.6505315", "0.6505315", "0.6505315", "0.6505315", "0.6505315", "0.6505315", "0.6505315", "0.6505315", "0.6495693", "0.6495693", "0.6494361", "0.6494361", "0.6494361", "0.6494361", "0.6494361", "0.6494361", "0.6494361", "0.6494361", "0.6494361", "0.6493032", "0.6482436", "0.64404315", "0.64404315", "0.64404315", "0.64366364", "0.6432192", "0.64235383", "0.6420778", "0.6407596", "0.6387927", "0.63849235", "0.6367505", "0.6367505", "0.6357043", "0.6357043", "0.6357043", "0.6357043", "0.6357043", "0.6357043", "0.6357043", "0.6357043", "0.6357043", "0.6350395", "0.63380104", "0.6328878", "0.6328878", "0.6316629", "0.6316024", "0.6316024", "0.6316024", "0.6316024", "0.629395", "0.6283174", "0.6254533", "0.62476194", "0.6236605", "0.62297845", "0.6224552", "0.62148046", "0.6207986", "0.62010735", "0.61872214", "0.61872214", "0.61872214", "0.6171824", "0.6170637", "0.6158941", "0.6158941", "0.61574966", "0.6154689", "0.6127385", "0.61056745", "0.609583", "0.60883635", "0.6078966", "0.6070555", "0.60615844", "0.6060803", "0.6060803", "0.60459673", "0.6038827", "0.603736", "0.6007422", "0.59990543", "0.5980981", "0.59652746", "0.5946565", "0.5938519", "0.5906847", "0.5879664", "0.586549", "0.58195424", "0.5803269", "0.58030677" ]
0.0
-1
synchronized getters and setters here Gets the balance of the account
public double getBalance() { return balance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getBalance()\n \n {\n \n return balance;\n \n }", "public double getBalance()\n {\n return balance;\n }", "public double getBalance() {\n return balance;\n }", "public int getBalance()\n {\n return balance;\n }", "public double getBalance(){\r\n\t\treturn balance;\r\n\t}", "public Double getBalance() {\r\n return balance;\r\n }", "public double getBalance()\r\n\t{\r\n\t\treturn balance;\t\t\r\n\t}", "public long getBalance() {\n\t\n\treturn balance;\n}", "public double getBalance(){\n return balance;\n }", "public int getBalance() {\n return balance;\n }", "public int getBalance() {\n return balance;\n }", "double getBalance() {\n\t\treturn balance;\n\t}", "private double getBalance() { return balance; }", "public double getBal() {\n\t\t return balance;\r\n\t }", "public double getBalance(){\n\t\treturn balance;\n\t}", "public double getBalance(){\n return balance.getBalance();\n }", "public float getBalance() {\n return balance;\n }", "public double getBalance(){\n return this.balance;\r\n }", "public BigDecimal getBalance() {\n return balance;\n }", "public BigDecimal getBalance() {\n return balance;\n }", "public long getBalance() {\n return this.balance;\n }", "public double getBalance(){\n return balance;\n }", "public double getBalance() \n\t{\n\t\treturn balance;\n\t\t\n\t}", "public double getBalance(){\n return balance;\r\n }", "public Integer getBalance() {\n return balance;\n }", "public Integer getBalance() {\n return balance;\n }", "public double getBalance(){\n return balance;\n }", "public double getBalance() {\r\n\t\t\r\n\t\treturn balance;\r\n\t\t\r\n\t}", "public double getBalance() {\n return this.balance;\n }", "public final float getBalance() {\n return balance;\n }", "public int getBalance() {\n return this.balance;\n\n }", "public int getBalance() {\n return total_bal;\n }", "public java.math.BigDecimal getBalance() {\n return balance;\n }", "public double getBalance()\t{\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "double getBalance();", "double getBalance();", "protected double getTotalBalance()\r\n {\r\n return totalBalance;\r\n }", "public void getBalance() {\n\t\tSystem.out.println(\"Balance in Savings account is\" + balance);\n\t\t//return balance;\n\t}", "public Money getTotalBalance();", "public int getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\n double balance = 0;\n balance = overDraftLimit;\n return balance;\n\n }", "public String getBalance() {\n return balance;\n }", "public String getBalance() {\n return this.balance;\n }", "@Override\r\n\tpublic double getBalance() {\n\t\treturn (super.getBalance()+cashcredit);\r\n\t}", "public double getBalance()\n {\n return startingBalance;\n }", "public AmountOfMoney getCashRegisterBalance(){\n return cashRegister.getBalance();\n }", "public double getBankAccountBalance() {\r\n\t\t\r\n\t\tdouble balance = 0.0;\r\n\t\t\r\n\t\t\t\tif( customerBankAccountList.contains(this.getCustomer() ) ) \r\n\t\t\t\t{\t\r\n\t\t\t\t\tbalance = this.getCustomer().getBalance();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\treturn balance;\r\n\t\t}", "public String balance() {\n\t\treturn this.apiCall(\"balance\", \"\", \"\", true);\n\t}", "public Double getBalance(){\n Double sum = 0.0;\n // Mencari balance dompet dari transaksi dengan cara menghitung total transaksi\n for (Transaction transaction : transactions) {\n sum += transaction.getAmount().doubleValue();\n }\n return sum;\n }", "public float getAmount() {\n System.out.println(\"Account Balance:\" + amount);\n return amount;\n }", "@java.lang.Override\n public java.lang.String getBalance() {\n java.lang.Object ref = balance_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n balance_ = s;\n return s;\n }\n }", "public double getCurrentBalance(){\n if(!checkAccountOpen()){\n System.out.println(\"This transaction could not be processed. Please check your account status.\");\n }\n System.out.println(\"Your current balance is: $\"+currentBalance);\n return currentBalance;\n }", "@java.lang.Override\n public com.google.protobuf.ByteString\n getBalanceBytes() {\n java.lang.Object ref = balance_;\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n balance_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public static double totalBalance() {\n return totalBalance;\n }", "@Override\npublic Currency getCurrency() {\n\treturn balance.getCurrency();\n}", "@Override\npublic Money getBalance(Enterprise enterprise, Clerk clerk)\n\t\tthrows PermissionsException {\n\treturn balance;\n}", "public Double getBalance() {\n return null;\n }", "public void getBalance( Integer account_id ){\r\n\r\n Map<String, String> params = new HashMap<>();\r\n params.put(\"account_id\", String.valueOf(account_id));\r\n String url = API_DOMAIN + ACCOUNT_EXT + GET_BALANCE;\r\n this.makeVolleyRequest( url, params );\r\n }", "public float getBalance()\r\n\t{\n\t\ttry\r\n\t\t{\r\n\t\t\tDBConnection ToDB = new DBConnection(); //Have a connection to the DB\r\n\t\t\tConnection DBConn = ToDB.openConn();\r\n\t\t\tStatement Stmt = DBConn.createStatement();\r\n\t\t\tString SQL_Command = \"SELECT Balance FROM SavingsAccount WHERE SavingsAccountNumber ='\"+SavingsAccountNumber+\"'\"; //SQL query command for Balance\r\n\t\t\tResultSet Rslt = Stmt.executeQuery(SQL_Command);\r\n\t\t\twhile (Rslt.next())\r\n\t\t\t{\r\n\t\t\t\tBalance = Rslt.getFloat(1);\r\n\t\t\t}\r\n\t\t\tStmt.close();\r\n\t\t\tToDB.closeConn();\r\n\t\t}\r\n\t\tcatch(SQLException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"SQLException: \" + e);\r\n\t\t\twhile (e != null)\r\n\t\t\t{ System.out.println(\"SQLState: \" + e.getSQLState());\r\n\t\t\t\tSystem.out.println(\"Message: \" + e.getMessage());\r\n\t\t\t\tSystem.out.println(\"Vendor: \" + e.getErrorCode());\r\n\t\t\t\te = e.getNextException();\r\n\t\t\t\tSystem.out.println(\"\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Exception: \" + e);\r\n\t\t\te.printStackTrace ();\r\n\t\t}\r\n\t\treturn Balance;\r\n\t}", "@Override\r\n\tpublic double showbalanceDao() {\n\t\t\r\n\t\treturn temp.getCustBal();\r\n\t}", "public java.lang.String getBalance() {\n java.lang.Object ref = balance_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n balance_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "@Override\n public BigDecimal getCurrentBalance(Account account) {\n return null;\n }", "public int getBankAccount() {\n return bankAccount;\n }", "public static Double getCurrentBalance() {\n\t\treturn BankAccount.currentBalance;\n\t}", "public float getAccBalance() {\n\t\treturn accBalance;\n\t}", "public com.google.protobuf.ByteString\n getBalanceBytes() {\n java.lang.Object ref = balance_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n balance_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public double getAmountBank() {\n return this.amountBank;\n }", "public static void extract_money(){\n TOTALCMONEY = TOTALCMONEY - BALANCERETRIEVE; //the total cashier money equals the total cashier money minus the retrieve request\r\n BALANCE = BALANCE - BALANCERETRIEVE; //the user balance equals the account minus the retrieve request\r\n }", "public BigDecimal getBasicAccount() {\r\n return basicAccount;\r\n }", "public com.token.vl.service.MoneyWs getCurrent_balance() {\n return current_balance;\n }", "public int getPropertyBalance();", "public java.lang.String getTotalbalance() {\n return totalbalance;\n }", "@Override\n public long totalBalances() {\n long total = 0;\n for(Account account : accounts.values()){\n total += account.balance();\n }\n return total;\n }", "public String myAfterBalanceAmount() {\r\n\t\tint count=0;\r\n\t\tList<SavingAccount> acc = null;\r\n\t\ttry {\r\n\t\t\tSystem.out.println(\"Before Repeat\");\r\n\t\t\tacc = getSavingAccountList();\r\n\r\n\t\t\tfor (SavingAccount savingAcc : acc) {\r\n\t\t\t\tif (!(\"0\".equals(savingAcc.getState()))) {\r\n\t\t\t\t\tif (savingAcc.getState().equals(\"active\")) {\r\n\t\t\t\t\t\tint maxRepeat = Integer.parseInt(savingAcc\r\n\t\t\t\t\t\t\t\t.getRepeatable());\r\n\r\n\t\t\t\t\t\tDate date = new Date();\r\n\t\t\t\t\t\tDate systemDate = savingAccSer\r\n\t\t\t\t\t\t\t\t.convertStringToDateDDmmYYYY(savingAccSer\r\n\t\t\t\t\t\t\t\t\t\t.convertDateToStringDDmmYYYY(date));\r\n\r\n\t\t\t\t\t\tDate dateEnd = savingAccSer\r\n\t\t\t\t\t\t\t\t.convertStringToDateDDmmYYYY(savingAcc\r\n\t\t\t\t\t\t\t\t\t\t.getDateEnd());\r\n\r\n\t\t\t\t\t\tif (systemDate.getTime() == dateEnd.getTime()) {\r\n\t\t\t\t\t\t\tDate newEndDate = DateUtils.addMonths(systemDate,\r\n\t\t\t\t\t\t\t\t\tsavingAcc.getInterestRateId().getMonth());\r\n\r\n\t\t\t\t\t\t\tfloat balance = savingAcc.getBalanceAmount();\r\n\t\t\t\t\t\t\tfloat interest = savingAcc.getInterestRateId()\r\n\t\t\t\t\t\t\t\t\t.getInterestRate();\r\n\r\n\t\t\t\t\t\t\tint month = savingAcc.getInterestRateId()\r\n\t\t\t\t\t\t\t\t\t.getMonth();\r\n\t\t\t\t\t\t\tint days = Days\r\n\t\t\t\t\t\t\t\t\t.daysBetween(\r\n\t\t\t\t\t\t\t\t\t\t\tnew DateTime(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsavingAccSer\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.convertStringToDate(savingAcc\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getDateStart())),\r\n\t\t\t\t\t\t\t\t\t\t\tnew DateTime(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsavingAccSer\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.convertStringToDate(savingAcc\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getDateEnd())))\r\n\t\t\t\t\t\t\t\t\t.getDays();\r\n\t\t\t\t\t\t\tfloat amountAll = balance\r\n\t\t\t\t\t\t\t\t\t+ (balance * ((interest / (100)) / 360) * days);\r\n\t\t\t\t\t\t\tsavingAcc.setDateStart(savingAccSer\r\n\t\t\t\t\t\t\t\t\t.convertDateToString(systemDate));\r\n\t\t\t\t\t\t\tsavingAcc.setDateEnd(savingAccSer\r\n\t\t\t\t\t\t\t\t\t.convertDateToString(newEndDate));\r\n\t\t\t\t\t\t\tsavingAcc.setBalanceAmount(amountAll);\r\n\t\t\t\t\t\t\tsavingAcc.setRepeatable(\"\" + (maxRepeat + 1));\r\n\t\t\t\t\t\t\tupdateSavingAccount(savingAcc);\r\n\t\t\t\t\t\t\tcount+=1;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(\"Successfully!! \"+ count +\" Saving Account has been updated. Minh Map!!!\");\r\n\t\t\t\r\n\t\t\treturn \"success\";\r\n\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\tSystem.out.println(\"Exception\");\r\n\r\n\t\t}\r\n\t\treturn \"Fail\";\r\n\t}", "@Override\n public long getTotalBalances() {\n return accounts.values().stream().map(Account::getBalance).mapToLong(Long::longValue).sum();\n }", "public float showBalance() {\n\t\treturn dao.showBalance();\r\n\t}", "public Long getAvailableBalance() {\n return availableBalance;\n }", "public Integer getAccountBalance(int account_id){\n Account a = cache.get(account_id);\n if(a != null) return a.getBalance();\n\n try (\n Statement s = rawDataSource.getConnection().createStatement();\n ResultSet res = s.executeQuery(\n \"SELECT BALANCE FROM ACCOUNTS WHERE ACCOUNT_ID = \" + account_id)) {\n\n if (res.next())\n return res.getInt(\"BALANCE\");\n } catch (SQLException ex) {\n return null;\n }\n\n return null;\n }", "public BigDecimal getBalance()\n\t{\n\t\tBigDecimal retValue = Env.ZERO;\n\t//\tlog.config( toString() + \" Balance=\" + retValue);\n\t\treturn retValue;\n\t}", "public void showAccountBalance(){\n balance();\n\n }", "public DoubleProperty balanceProperty() {\n return balance;\n }", "public com.token.vl.service.MoneyWs getAvailable_Balance() {\n return available_Balance;\n }", "public double getPendingBalance() {\n return pendingBalance;\n }", "double getBalance(UUID name);", "@Override\n\tpublic Account getBalance(String username) {\n\t\treturn account.findByUsername(username);\n\t}", "public void updateAccount() {\r\n\t\t\r\n\t\t//update all totals\r\n\t\ttotalYouOwe = 0.0;\r\n\t\ttotalOwedToYou = 0.0;\r\n\t\tbalance = 0.0;\r\n\t\tnetBalance = 0.0;\r\n\t\t\r\n\t\t//totalYouOwe and totalOwedToYou\r\n\t\tfor (Event e : events) {\r\n\t\t\tif (e.isParticipantByGID(GID)) {\r\n\t\t\t\tif (e.getParticipantByGID(GID).getBalance() > 0) {\r\n\t\t\t\t\ttotalOwedToYou = totalOwedToYou + e.getParticipantByGID(GID).getBalance(); \r\n\t\t\t\t} else {\r\n\t\t\t\t\ttotalYouOwe = totalYouOwe + (-e.getParticipantByGID(GID).getBalance());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//netBalance/balance - the same in current implementation\r\n\t\tnetBalance = totalOwedToYou - totalYouOwe;\r\n\t\tbalance = totalOwedToYou - totalYouOwe;\r\n\t\t\r\n\t\tupdatePastRelations();\r\n\t}", "public BaseJson<BigDecimal> wallet_balance() throws Exception {\n String s = main(\"wallet_balance\",\"[]\");\n return JsonHelper.jsonStr2Obj(s, BaseJson.class);\n }", "public double getFinalBalance() {\n return finalBalance;\n }", "public AccountDto getBalanceFor(UUID accountId) {\n Account account = repository.getAccount(accountId);\n return getAccountDtoFor(account);\n }", "public void checkBalance()\n\t{\n\t\tList<Account> accounts = Main.aDao.getAllAccounts(this.loggedIn.getUserId());\n\t\tdouble accountsTotal = 0;\n\t\t\n\t\tfor(Account a : accounts)\n\t\t{\n\t\t\taccountsTotal += a.getBalance();\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Total funds available across all accounts:\\n\" + accountsTotal);\n\t}", "public int getCurBalance() {\n\t\treturn curBalance;\n\t}", "BigDecimal getOpeningDebitBalance();" ]
[ "0.82202697", "0.81223446", "0.8110213", "0.8107666", "0.8101775", "0.8079735", "0.8070787", "0.8067294", "0.80517554", "0.80504715", "0.80504715", "0.80501443", "0.8043045", "0.8026363", "0.8025243", "0.8022944", "0.80133146", "0.80061895", "0.7989951", "0.7989951", "0.79688394", "0.796401", "0.7960029", "0.79522216", "0.79515547", "0.79515547", "0.794152", "0.793736", "0.79253066", "0.79205215", "0.79086715", "0.7900158", "0.78762084", "0.7871615", "0.786521", "0.786521", "0.786521", "0.786521", "0.786521", "0.78564656", "0.78564656", "0.78312147", "0.78236353", "0.78035897", "0.7729443", "0.77193165", "0.7696021", "0.76912", "0.7630946", "0.7581664", "0.7517873", "0.7462453", "0.7388079", "0.7343197", "0.7267856", "0.7265346", "0.72617006", "0.72423995", "0.7198084", "0.7188744", "0.71737134", "0.71669835", "0.70929694", "0.70643073", "0.7043922", "0.7042232", "0.7039192", "0.7030923", "0.7024392", "0.7003208", "0.7001588", "0.69759655", "0.6969377", "0.69551796", "0.6948581", "0.6939532", "0.6917705", "0.6912253", "0.69068396", "0.6905898", "0.6901505", "0.68967974", "0.6863338", "0.6853878", "0.6853609", "0.681652", "0.68151766", "0.6813764", "0.6807586", "0.6806965", "0.67703325", "0.67437536", "0.67248803", "0.6721211", "0.6718456", "0.6714817", "0.6714211" ]
0.80546385
11
Sets the balance of the account
public synchronized void setBalance(double balance) { this.balance = balance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setBalance(double bal){\n balance = bal;\r\n }", "public void setBalance( Integer account_id, double balance ){\r\n\r\n Map<String, String> params = new HashMap<>();\r\n params.put(\"account_id\", String.valueOf(account_id));\r\n params.put(\"balance\", String.valueOf(balance));\r\n String url = API_DOMAIN + ACCOUNT_EXT + SET_BALANCE;\r\n this.makeVolleyRequest( url, params );\r\n }", "public void setBalance(){\n balance.setBalance();\n }", "private void setBalance(double balance) {\n this.balance = balance;\n }", "void setManageTransactionBalance(String balance);", "public void setBalance(double balance)\n {\n startingBalance = balance;\n }", "void setBalance(double value);", "public void setBalance(final int balance)\n {\n this.balance = balance;\n }", "public void setBalance(java.math.BigDecimal balance) {\n this.balance = balance;\n }", "public void setBalance(double balance){\n\t\tthis.balance = balance;\n\t}", "public void setBalance(BigDecimal balance) {\n this.balance = balance;\n }", "public void setBalance(BigDecimal balance) {\n this.balance = balance;\n }", "public void setBalance(float balance) {\n this.balance = balance;\n }", "public void setBalance(Integer balance) {\n this.balance = balance;\n }", "public void setBalance(Integer balance) {\n this.balance = balance;\n }", "public void setBalance(double balance) {\n\t\tthis.balance = balance;\n\t}", "public void setBalance(Double balance) {\r\n this.balance = balance;\r\n }", "public void setBalance( long balance ) {\r\n this.balance = balance;\r\n }", "protected void setTotalBalance(double balance)\r\n {\r\n totalBalance = balance;\r\n }", "public void setBalance(int balance) {\r\n\t\tif(0<=balance&&balance<=1000000) {\r\n\t\tthis.balance = balance;\r\n\t}else{\r\n\t\t System.out.println(\"잘못 입력하셨습니다. 현재 잔고는 \"+this.balance+\"입니다\");\r\n\t}\r\n \r\n}", "public void setBalance(T balance) {\n transactions = new ArrayList<Transaction>();\n\t\ttransactions.add(new Transaction<T>('+', balance));\n }", "Account(int balance) {\n if(balance <0) this.balance=0;\n this.balance = balance;\n }", "void updateBalance(int amount){ \n\t\tbalance = amount;\n\t}", "public void setNewBalance() {\n\t\tacc.setBankBalance(acc.getBalance() - keyboard.getAmt());\r\n\t}", "public void setBalance() {\n System.out.print(\"Set the balance of your credit card: \");\n this.balance = Double.parseDouble(scanner.nextLine());\n }", "public void changeBalance (int amount){\n balance += amount;\n }", "public void updateBalance(UUID accountId, double amount) {\n Account account = repository.getAccount(accountId);\n account.updateBalance(amount);\n repository.save(account);\n }", "public void setBalance(float value)\n {\n balanceCtrl.setValue(value);\n }", "private void updateDatabaseAccountBalance() {\n\t\tString sql = \"UPDATE account SET balance = \" + this.balance + \" \";\n\t\tsql += \"WHERE accountID = '\" + this.accountID + \"';\";\n\n\t\tDbUtilities db = new MySqlUtilities();\n\t\tdb.executeQuery(sql);\n\t}", "public Account(double balance) {\n\t\tthis.balance = balance;\n\t}", "public void setBalance(double newBalance) {\n\t\tbalance = newBalance;\n\t\tbalance = Math.round(balance * 100.0) / 100.0;\n\t}", "public void updateBalance(int account_id, int final_amount){\n dbUpdate(\"update ACCOUNTS set BALANCE = \"+ final_amount + \" where ACCOUNT_ID = \" + account_id);\n cache.add(new Account(account_id, final_amount));\n }", "private void updateBalance(int balance) throws SQLException {\n\t\tupdateBalanceStatement.clearParameters();\n\t\tupdateBalanceStatement.setInt(1, balance);\n\t\tupdateBalanceStatement.setString(2, this.username);\n\t\tupdateBalanceStatement.executeUpdate();\n\t}", "public void setCurrent_balance(com.token.vl.service.MoneyWs current_balance) {\n this.current_balance = current_balance;\n }", "public void setBalance(final double newBalance) {\n this.balance = newBalance;\n }", "public synchronized double setBalanceForAccId(int AccId, double bal) {\n\t\tConnection dbAccess = DataAccess.getDbAccess();\n\t\tPreparedStatement psttmnt;\n\t\tString querySting;\n\t\tdouble balance = -1.0;\n\t\ttry {\n\t\t\tquerySting = \"UPDATE accounts SET acc_balance = \" + bal + \" WHERE acc_id = \" + AccId;\n\t\t\tpsttmnt = dbAccess.prepareStatement(querySting);\n\t\t\tint result = psttmnt.executeUpdate();\n\t\t\tif (result != 0) {\n\t\t\t\t balance = getBalanceForAccId(AccId);\n\t\t\t}\n\t\t\tdbAccess.close();\n\t\t} catch (SQLException se) {\n\t\t\tse.printStackTrace();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t} \n\t\treturn balance;\n\t}", "public BankAccount(int balance) {\n\n this.balance = balance;\n\n }", "public void increaseBalance(final double balance) {\n this.balance += balance;\n }", "void deposit(int value)//To deposit money from the account\n {\n balance += value;\n }", "void setAccount(final Account account);", "public void setBankAccount(final int newBAccount) {\n this.bankAccount = newBAccount;\n }", "public void addBalance(long balance) {\r\n this.balance += balance;\r\n }", "public void deposit(int amount)\n {\n setBalance(getBalance()+amount);\n }", "public void deposit(double amount) {\n balance += amount;\n \n try {\n \n Class.forName(\"net.ucanaccess.jdbc.UcanaccessDriver\");\n \n // Load Driver\n String connURL=\"jdbc:ucanaccess://c:/Users/Ellen/Documents/CIST2373/ChattBankMDB.mdb\";\n \n // Get Connection\n Connection con = DriverManager.getConnection(connURL);\n \n // Create Statement\n Statement stmt = con.createStatement();\n \n // Create sql string \n String sql = \"Update Accounts set Balance = \"+getBalance()+ \n \" where AcctNo='\"+getAcctNo()+\"'\";\n \n // Check for properly formed sql\n System.out.println(sql);\n \n // Execute Statement\n int n = stmt.executeUpdate(sql);\n if (n == 1)\n System.out.println(\"Update was successful!\");\n else\n System.out.println(\"Update failed!\"); \n \n // Close Connection\n con.close(); \n } //end try\n \n catch (Exception err) {\n System.out.println(\"Error: \" + err);\n } //end catch\n }", "public boolean setBalance(float balance) {\r\n\t\tif(isValidBalance(balance)){\r\n\t\t\tthis.balance = balance;\r\n\t\t\treturn true;\r\n\t\t}else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public void InitializeBalance(BigDecimal valor){\n \r\n ChekingAccount chekAc=pRepository.GetChekingAccount();\r\n chekAc.setSaldoInicial(valor);\r\n pRepository.SaveChekingAccount(chekAc);\r\n \r\n }", "public BankAccount(double initialBalance) {\r\n\t\tbalance=initialBalance;\r\n\t}", "@Transactional(isolation = Isolation.SERIALIZABLE)\n public void updateAccountBalance(Long accountId, Double newBalance) {\n Account account =accountRepository.findById(accountId)\n .orElseThrow(() -> new AccountNotFoundException(\"Account not found\"));\n account.setBalance(newBalance);\n accountRepository.save(account);\n }", "public void credit(double amount) {\n this.balance += amount;\n }", "public SavingsAccount(double balance)\n {\n startingBalance = balance;\n }", "protected void enableActionSetBalance()\n {\n Action action = new Action(\"SetBalance\");\n action.addInputParameter(new ParameterRelated(\"Value\", iPropertyBalance));\n iDelegateSetBalance = new DoSetBalance();\n enableAction(action, iDelegateSetBalance);\n }", "Account(int id, double balance){\r\n\t\t//sets the default values and than the specified values of the id and balance\r\n\t\tsetId(id);\r\n\t\tsetBalance(balance);\t\t \r\n\t\tsetAnnualInterestRate(0);\r\n\t\tthis.dateCreated = new Date(System.currentTimeMillis());\r\n\t }", "public void editBalance() {\n\t\tAccount account = getAccountForEditBalance();\n\n\t\tif (adminDao.editBalance(account))\n\t\t\tSystem.out.println(\"Balance edited!\");\n\t\telse\n\t\t\tSystem.out.println(\"Something went wrong!\");\n\n\t\tAdminMenu.getAdminMenu();\n\t}", "@Test\n public void testSetBalance() {\n System.out.println(\"setBalance\");\n double balance = 9.0;\n Account instance = new Account(\"Piper\", 10.0);\n instance.setBalance(balance);\n double expResult = 9.0;\n double result = instance.getBalance();\n assertEquals(expResult, result, 0.0);\n // TODO review the generated test code and remove the default call to fail.\n //fail(\"The test case is a prototype.\");\n }", "@Override\n\tvoid deposit(double amount) {\n\t\tsuper.balance += amount - 20;\n\t}", "public int balup(double newbalance, Long accountno, Long broaccno, Double bramt) throws Exception{\n\tint j=DbConnect.getStatement().executeUpdate(\"update account set balance=\"+newbalance+\" where accno=\"+accountno+\"\");\r\n\tint i=DbConnect.getStatement().executeUpdate(\"update account set balance=balance+\"+bramt+\" where accno=\"+broaccno+\"\");\r\n\treturn i;\r\n}", "public int baldown(double newbalance, Long accountno, Long broaccno, Double bramt) throws Exception{\n\tint j=DbConnect.getStatement().executeUpdate(\"update account set balance=\"+newbalance+\" where accno=\"+accountno+\"\");\r\n\tint i=DbConnect.getStatement().executeUpdate(\"update account set balance=balance+\"+bramt+\" where accno=\"+broaccno+\"\");\r\n\treturn i;\r\n}", "public void deposit(BigDecimal deposit){\n balance = balance.add(deposit);\n }", "void deposit(double Cash){\r\n\t\tbalance=balance+Cash;\r\n\t}", "public void transferTo(double dollarAmount) {\r\n\t\tthis.accountBalance = this.accountBalance + dollarAmount;\r\n\t}", "public void deposit(double amount) {\n balance = balance + amount + 10;\n }", "@Override\n public void changeBalance (ChangeBalanceDto changeBalanceDto) {\n new AccountDaoImpl(new StatementsRunnerImpl()).changeBalance(changeBalanceDto);\n }", "private void updateMoney() {\n balance = mysql.getMoney(customerNumber);\n balanceConverted = (float) balance / 100.00;\n }", "public abstract void updateBalance(Balance balance, LedgerEntry.Subtype subtype, long amount) throws TransactionException;", "public void balance(){\n\t\tnamesTree.balance();\n\t\taccountNumbersTree.balance();\n\t}", "private void updateBalance(){\n Intent toUpdateBal = new Intent(this, UpdateAccount.class);\n startActivity(toUpdateBal);\n }", "public BankAccount(String accountName, int balance) {\n this.accountName = accountName;\n this.balance = balance;\n this.valueDeposits = balance;\n this.valueWithdrawals = 0;\n this.maximumBalance = balance;\n this.minimumBalance = balance;\n }", "public void deposit(double amount) {\n this.balance += amount;\n }", "void updateAccount(int id, double accountBalance, String account) {\n // Update only the required keys\n sql = \"UPDATE CashiiDB2 \" + \"SET \" + account + \" ='\" + accountBalance + \"' WHERE AccountNum in ('\" + id + \"')\";\n try {\n st.executeUpdate(sql);\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }", "public void addToBalance(double depositBalanceAmount) \n\t{\n\t\taccountBalance += depositBalanceAmount;\n\t}", "@Override\r\n\tpublic void updateBalance( Integer userid, double amount) {\n\t\tif ( getBalance( userid) < amount) {\r\n\t\t\tthrow new RuntimeException( \"用户余额不足!\");\r\n\t\t}\r\n\t\tString sql = \"UPDATE buyers SET balance = balance - ? WHERE id = ?;\";\r\n\t\tjdbcTemplate.update( sql, amount, userid);\r\n\t}", "public void withdraw(double amount) throws InsufficientFundsException {\n if (amount <= balance) {\n balance -= amount;\n \n try {\n \n Class.forName(\"net.ucanaccess.jdbc.UcanaccessDriver\");\n \n // Load Driver\n String connURL=\"jdbc:ucanaccess://c:/Users/Ellen/Documents/CIST2373/ChattBankMDB.mdb\";\n \n // Get Connection\n Connection con = DriverManager.getConnection(connURL);\n \n // Create Statement\n Statement stmt = con.createStatement();\n \n // Create sql string \n String sql = \"Update Accounts set Balance = \"+getBalance()+ \n \" where AcctNo= '\"+getAcctNo()+\"'\";\n \n // Check for properly formed sql\n System.out.println(sql);\n \n // Execute Statement\n int n = stmt.executeUpdate(sql);\n if (n == 1)\n System.out.println(\"Update was successful!\");\n else\n System.out.println(\"Update failed!\"); \n \n // Close Connection\n con.close(); \n } //end try\n \n catch (Exception err) {\n System.out.println(\"Error: \" + err);\n } //end catch\n } //end if\n else {\n throw new InsufficientFundsException(amount);\n } //end else\n }", "public void updateBal(int value) {\r\n bal = bal + value;\r\n }", "public Builder setBalance(\n java.lang.String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n balance_ = value;\n onChanged();\n return this;\n }", "public void deposit(double amount)\n {\n balance = balance + amount;\n }", "public saccoAccount (int account_num, double initial_balance) \r\n {\r\n\r\n account = account_num;\r\n balance = initial_balance;\r\n\r\n }", "Account(String name, double balance)\r\n\t{\r\n\t\t\r\n\t\tthis.name = name; //assign name to the instance variable name \r\n\t\t\r\n\t\t// validate that the balance is greater that 0.0; if it is not,\r\n\t\t// instance variable balance keeps its default value 0.0\r\n\t\tif(balance > 0.0) // if balance is valid\r\n\t\t\tthis.balance = balance; // assign balance to the instance variable balance\t\t\t\t\t\r\n\t}", "public void sendBankBalance(int amount) {\n sendMessage(Prefix.BANKBALANCE, amount + \"\");\n }", "public void setAccount(String bank, String account)\n\t{\n\t\tbank = bank.trim().replaceAll(\" +\",\" \");\n\t\t\n\t\tif(account.length() == 19) //length of digits including hyphen(-)\n\t\t{\n\t\t this.account = MaskDigits.mask(account, \"xxxx-xxxx-xxxx-####\");\n\t\t}\n\t\tif(bank.equals(\"HSBC Canada\"))\n\t\t{\n\t\t\t\n\t\t\tthis.account = MaskDigits.mask(account, \"##xx-xxxx-xxxx-xxxx\");\n\t\t}\n\t\t\n\t\tif(bank.equals(\"Royal Bank of Canada\"))\n\t\t{\n\t\t\tthis.account = MaskDigits.mask(account, \"####-xxxx-xxxx-xxxx\");\n\t\t}\n\t\t\n\t\tif(bank.equals(\"American Express\"))\n\t\t{\n\t\t\tthis.account = MaskDigits.mask(account, \"xxxx-xxxx-xxxx-###\");\n\t\t}\n\t}", "public void deposit(BigDecimal amount) {\n this.setBalance(this.getBalance().add(amount));\n }", "@Test\n public void testSetBalance() {\n System.out.println(\"setBalance\");\n Member instance = member;\n \n double balance = 100.00;\n instance.setBalance(balance);\n \n double expResult = balance;\n double result = instance.getBalance();\n \n assertEquals(expResult,result, 100.00);\n }", "public BankAccount() {\r\n\t\tbalance=0;\r\n\t\t\r\n\t}", "public static void deposit(){\n TOTALCMONEY = TOTALCMONEY + BALANCEDEPOSIT; //the cashier money equals the cashier money plus the amount that is being deposited\r\n BALANCE = BALANCE + BALANCEDEPOSIT; //the user balance equals the user balance plus the amount that is being deposited\r\n }", "public\n void\n setAccount(Account account)\n {\n itsAccount = account;\n }", "public void addBalance(float deposit) {\r\n\t\tthis.balance += deposit;\r\n\t}", "public void setInitialBalance(double value) {\n this.initialBalance = value;\n }", "public void updateBalance(String mobileNo,int balance)\n\t{\n\t\tContext ctx;\n\t\ttry {\n\t\t\tctx = new InitialContext();\n\t\t\n\t\t\n\t\t DataSource ds=(DataSource)ctx.lookup(\"java:OracleDS\");\n\t\t\tConnection con=ds.getConnection();\n\t\t\tStatement stmt=con.createStatement();\n\t\t\t\n\t\t\tstmt.executeUpdate(\"update mobile set balance=\"+balance+\" where mobileno=\"+mobileNo);\n\t\t\tcon.close();\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"Error in connection with Database :\"+e.getMessage());\n\t\t\t\n\t\t}\n\t\t\n\t}", "public Builder setBalanceBytes(\n com.google.protobuf.ByteString value) {\n if (value == null) {\n throw new NullPointerException();\n }\n checkByteStringIsUtf8(value);\n \n balance_ = value;\n onChanged();\n return this;\n }", "public BankAccount(int accountNo, String name, double balance) {\n this.accountNo = accountNo;\n this.name = name;\n if(balance > 0.0)\n this.balance = balance;\n }", "public void deposit(double value){\r\n balance += value;\r\n}", "public void deposit(double amount)\n {\n startingBalance += amount;\n }", "public Balance(final BigDecimal value) {\r\n this.value = value;\r\n }", "public void deposit(String accountNumber, int amount) {\n\t\tConnection conn;\n\t\tPreparedStatement ps, pp, ll;\n\t\tString url = \"jdbc:mysql://localhost:3306/mars\";\n\t\tString username = \"root\";\n\t\tString password = \"1113\";\n\t\tint lastBalance;\n\t\ttry {\n\t\t\tClass.forName(\"com.mysql.jdbc.Driver\");\n\t\t} catch (ClassNotFoundException e1) {\n\t\t\te1.printStackTrace();\n\t\t}\n\t\ttry{\n\t\tconn=DriverManager.getConnection(url, username, password);\n\t\tString sql = \"select balance,userId from \"+this.name+\" where accountNumber=?\";\n\t\tps= (PreparedStatement) conn.prepareStatement(sql);\n\t\tps.setString(1, accountNumber.toString());\n\t\tResultSet rs = ps.executeQuery();\n\t\tint nowBalance = 0;\n\t\tString id = \"\";\n\t\twhile(rs.next()) { \n\t\t\tnowBalance=rs.getInt(\"balance\");\n\t\t\tid = rs.getString(\"userId\");\n\t\t}\n\t\tlastBalance = nowBalance + amount;\n\t\t//System.out.println(lastBalance);\n\t\t\n\t\tString sql1 = \"UPDATE \"+this.name+\" SET balance=? where accountNumber=?\";\n\t\tpp = (PreparedStatement) conn.prepareStatement(sql1);\n\t\tpp.setInt(1, lastBalance);\n\t\tpp.setString(2, accountNumber.toString());\n\t\tpp.executeUpdate();\n\t\t\n\t\tString logs = \"deposit : \"+ amount+\" / balance: \"+String.valueOf(lastBalance);\n\t\tString sql11 = \"insert into \"+id+\" (log) values (?)\";\n\t\tll = (PreparedStatement) conn.prepareStatement(sql11);\n\t\tll.setString(1, logs);\n\t\tll.executeUpdate();\n\t\t\n\t\t}catch (SQLException e) {\n\t\t throw new IllegalStateException(\"Cannot connect the database!\", e);\n\t\t}\n\t}", "public boolean updateBalance(int account_id, int final_amount, Connection con){\n try {\n tryDbUpdate(\"update ACCOUNTS set BALANCE = \"+ final_amount + \" where ACCOUNT_ID = \" + account_id, con);\n cache.add(new Account(account_id, final_amount));\n } catch (SQLException e) {\n try {\n con.rollback();\n return false;\n } catch (SQLException e1) {\n e1.printStackTrace();\n return false;\n }\n }\n return true;\n }", "public void withdraw(int amount)\n {\n setBalance(getBalance()-amount);\n }", "public void setUserAccount(final UserAccount.Immutable userAccount) {\n this.userAccount = userAccount;\n }", "@Override\n\tpublic void updateAccountBalance(double newBalance, int id) throws SQLException {\n\t\tConnection connect = db.getConnection();\n\t\tString updateQuery = \"update accounts set balance=? where id=?\";\n\t\tPreparedStatement prepStmt = connect.prepareStatement(updateQuery);\n\t\t\tprepStmt.setDouble(1, newBalance);\n\t\t\tprepStmt.setInt(2, id);\n\t\t\tprepStmt.executeUpdate();\n\t}", "public Account(Holder holder, int balance) {\n this.holder = holder;\n this.balance = balance;\n }", "@Override\n\tpublic void calculateAndUpdateBalance() {\n\n\t\tbalance -= fee;\n\n\t}", "public void setSaldoBank(double saldoBank) {\n this.saldoBank = saldoBank;\n }" ]
[ "0.7934461", "0.78938913", "0.78023833", "0.7776525", "0.7710409", "0.76446044", "0.7579406", "0.7558338", "0.7544201", "0.75430006", "0.75035566", "0.75035566", "0.74997973", "0.744487", "0.744487", "0.7383514", "0.73834324", "0.73734397", "0.7365012", "0.72299886", "0.72203714", "0.709791", "0.7095379", "0.7076165", "0.7064479", "0.7052667", "0.70406485", "0.70237905", "0.68517584", "0.6831359", "0.6830229", "0.6740472", "0.6727946", "0.6706092", "0.66414034", "0.6621391", "0.6617845", "0.65595424", "0.6543938", "0.65228164", "0.6521257", "0.6514353", "0.65015113", "0.6501443", "0.65011036", "0.6483998", "0.6420548", "0.6413107", "0.6412223", "0.6403467", "0.6312558", "0.6299279", "0.62832856", "0.6271432", "0.6259093", "0.62461454", "0.6231322", "0.622368", "0.6202046", "0.61965114", "0.61963105", "0.61952174", "0.6185376", "0.61780787", "0.6172978", "0.61720234", "0.6171333", "0.616832", "0.61644095", "0.6147222", "0.61469793", "0.6145763", "0.6144246", "0.61352473", "0.6126364", "0.6109995", "0.61069214", "0.61062205", "0.61036235", "0.6092675", "0.6085084", "0.608017", "0.6076621", "0.6074405", "0.6072606", "0.6052288", "0.60365397", "0.6034275", "0.603217", "0.6029929", "0.6027242", "0.6024253", "0.6014145", "0.6013754", "0.60091615", "0.6003481", "0.60027933", "0.5997331", "0.5995006", "0.5990192" ]
0.7799992
3
Gets the pending balance of the account
public double getPendingBalance() { return pendingBalance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String balance() {\n\t\treturn this.apiCall(\"balance\", \"\", \"\", true);\n\t}", "public int getBalance() {\n return total_bal;\n }", "public double getBalance() {\n\n double balance = 0;\n balance = overDraftLimit;\n return balance;\n\n }", "public java.math.BigDecimal getBalance() {\n return balance;\n }", "BigDecimal getClosingDebitBalance();", "public BigDecimal getBalance() {\n return balance;\n }", "public BigDecimal getBalance() {\n return balance;\n }", "public double getBal() {\n\t\t return balance;\r\n\t }", "public double getCurrentBalance(){\n if(!checkAccountOpen()){\n System.out.println(\"This transaction could not be processed. Please check your account status.\");\n }\n System.out.println(\"Your current balance is: $\"+currentBalance);\n return currentBalance;\n }", "public Integer getBalance() {\n return balance;\n }", "public Integer getBalance() {\n return balance;\n }", "BigDecimal getOpeningDebitBalance();", "BigDecimal getOpeningDebitBalance();", "public long getBalance() {\n return this.balance;\n }", "public long getBalance() {\n\t\n\treturn balance;\n}", "public Money getTotalBalance();", "public int getBalance() {\n return balance;\n }", "public int getBalance() {\n return balance;\n }", "public int getBalance()\n {\n return balance;\n }", "public com.token.vl.service.MoneyWs getCurrent_balance() {\n return current_balance;\n }", "public int getBalance() {\n\t\treturn balance;\n\t}", "public Long getAvailableBalance() {\n return availableBalance;\n }", "public static Double getCurrentBalance() {\n\t\treturn BankAccount.currentBalance;\n\t}", "public void getBalance() {\n\t\tSystem.out.println(\"Balance in Savings account is\" + balance);\n\t\t//return balance;\n\t}", "public com.google.protobuf.ByteString\n getBalanceBytes() {\n java.lang.Object ref = balance_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n balance_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "@java.lang.Override\n public com.google.protobuf.ByteString\n getBalanceBytes() {\n java.lang.Object ref = balance_;\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n balance_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public BigDecimal getBalance()\n\t{\n\t\tBigDecimal retValue = Env.ZERO;\n\t//\tlog.config( toString() + \" Balance=\" + retValue);\n\t\treturn retValue;\n\t}", "public final float getBalance() {\n return balance;\n }", "BigDecimal getClosingCreditBalance();", "public String getBalance() {\n return balance;\n }", "public com.token.vl.service.MoneyWs getAvailable_Balance() {\n return available_Balance;\n }", "public java.lang.String getBalance() {\n java.lang.Object ref = balance_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n balance_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public int getBalance() {\n return this.balance;\n\n }", "public double getBalance(){\n return balance.getBalance();\n }", "public double getBalance() \n\t{\n\t\treturn balance;\n\t\t\n\t}", "public double getBalance()\n \n {\n \n return balance;\n \n }", "public double getBalance() {\n return balance;\n }", "double getBalance();", "double getBalance();", "@java.lang.Override\n public java.lang.String getBalance() {\n java.lang.Object ref = balance_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n balance_ = s;\n return s;\n }\n }", "public String getBalance() {\n return this.balance;\n }", "public double getUnpaidBalance() \r\n\t{\r\n\t\t\r\n\t\treturn unpaidBalance;\r\n\t\t\r\n\t}", "public double getBalance() {\r\n\t\t\r\n\t\treturn balance;\r\n\t\t\r\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n\t\treturn balance;\n\t}", "public double getBalance() {\n return balance;\n }", "public double getBalance() {\n return balance;\n }", "public double getBalance() {\n return balance;\n }", "public double getBalance() {\n return balance;\n }", "public double getBalance()\r\n\t{\r\n\t\treturn balance;\t\t\r\n\t}", "public float getBalance() {\n return balance;\n }", "public Double getBalance() {\r\n return balance;\r\n }", "public double getBalance()\n {\n return balance;\n }", "public double getBalance() {\n return this.balance;\n }", "BigDecimal getOpeningCreditBalance();", "BigDecimal getOpeningCreditBalance();", "public double getBalance(){\r\n\t\treturn balance;\r\n\t}", "public Integer getAccountBalance(int account_id){\n Account a = cache.get(account_id);\n if(a != null) return a.getBalance();\n\n try (\n Statement s = rawDataSource.getConnection().createStatement();\n ResultSet res = s.executeQuery(\n \"SELECT BALANCE FROM ACCOUNTS WHERE ACCOUNT_ID = \" + account_id)) {\n\n if (res.next())\n return res.getInt(\"BALANCE\");\n } catch (SQLException ex) {\n return null;\n }\n\n return null;\n }", "public double getBalance()\t{\n\t\treturn balance;\n\t}", "@Override\n public BigDecimal getCurrentBalance(Account account) {\n return null;\n }", "public double getBalance(){\n\t\treturn balance;\n\t}", "public double getBankAccountBalance() {\r\n\t\t\r\n\t\tdouble balance = 0.0;\r\n\t\t\r\n\t\t\t\tif( customerBankAccountList.contains(this.getCustomer() ) ) \r\n\t\t\t\t{\t\r\n\t\t\t\t\tbalance = this.getCustomer().getBalance();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\treturn balance;\r\n\t\t}", "public BigDecimal getWithdrawMoney() {\n return withdrawMoney;\n }", "double getBalance() {\n\t\treturn balance;\n\t}", "public BaseJson<BigDecimal> wallet_balance() throws Exception {\n String s = main(\"wallet_balance\",\"[]\");\n return JsonHelper.jsonStr2Obj(s, BaseJson.class);\n }", "public java.lang.String getTotalbalance() {\n return totalbalance;\n }", "public Account getUpdatedAccount(Player p) {\n\n\t\tAccount a = getAccount(p);\n\t\tif (a != null) {\n\n\t\t\t// update Account with pending interest\n\n\t\t\tDate today = new Date();\n\t\t\tlong now = today.getTime() / 86400000 ;\n\t\t\t/* 'now' is an integral number of days since epoch.\n\t\t\t * There are 86,400 seconds in a day, and 1000 'ticks' in a getTime() value.\n\t\t\t * Interest is considered to compound at midnight\n\t\t\t */\n\t\t\t\n\t\t\t// Update account with accumulated interest, if applicable\n\t\t\t\n\t\t\tif (a.lastUpdate > 0 && rate > 1.0) {\n\t\t\t\tlong periods = now - a.lastUpdate;\n\t\t\t\tif (periods > 0) {\n\t\t\t\t\tBigDecimal oldamt = a.money;\n\t\t\t\t\tdouble newamt = oldamt.doubleValue() * Math.pow(rate, periods);\n\t\t\t\t\ta.money = new BigDecimal(newamt, context);\n\t\t\t\t\ta.money = a.money.setScale(Currency.getDecimals(), RoundingMode.HALF_UP);\n\t\t\t\t\tif (a.money.compareTo(maxMoney) > 0)\n\t\t\t\t\t\ta.money = maxMoney;\n\t\t\t\t\tBigDecimal interest = a.money.subtract(oldamt);\n\t\t\t\t\t\n\t\t\t\t\tp.sendMessage(ChatColor.YELLOW + \"Interest applied: \" + interest);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\ta.lastUpdate = now;\n\t\t\t\n\t\t}\n\t\treturn a;\n\t}", "public Double getBalance(){\n Double sum = 0.0;\n // Mencari balance dompet dari transaksi dengan cara menghitung total transaksi\n for (Transaction transaction : transactions) {\n sum += transaction.getAmount().doubleValue();\n }\n return sum;\n }", "public void getBalance( Integer account_id ){\r\n\r\n Map<String, String> params = new HashMap<>();\r\n params.put(\"account_id\", String.valueOf(account_id));\r\n String url = API_DOMAIN + ACCOUNT_EXT + GET_BALANCE;\r\n this.makeVolleyRequest( url, params );\r\n }", "public double getBalance()\n {\n return startingBalance;\n }", "public AmountOfMoney getCashRegisterBalance(){\n return cashRegister.getBalance();\n }", "public static double totalBalance() {\n return totalBalance;\n }", "public float getBalance()\r\n\t{\n\t\ttry\r\n\t\t{\r\n\t\t\tDBConnection ToDB = new DBConnection(); //Have a connection to the DB\r\n\t\t\tConnection DBConn = ToDB.openConn();\r\n\t\t\tStatement Stmt = DBConn.createStatement();\r\n\t\t\tString SQL_Command = \"SELECT Balance FROM SavingsAccount WHERE SavingsAccountNumber ='\"+SavingsAccountNumber+\"'\"; //SQL query command for Balance\r\n\t\t\tResultSet Rslt = Stmt.executeQuery(SQL_Command);\r\n\t\t\twhile (Rslt.next())\r\n\t\t\t{\r\n\t\t\t\tBalance = Rslt.getFloat(1);\r\n\t\t\t}\r\n\t\t\tStmt.close();\r\n\t\t\tToDB.closeConn();\r\n\t\t}\r\n\t\tcatch(SQLException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"SQLException: \" + e);\r\n\t\t\twhile (e != null)\r\n\t\t\t{ System.out.println(\"SQLState: \" + e.getSQLState());\r\n\t\t\t\tSystem.out.println(\"Message: \" + e.getMessage());\r\n\t\t\t\tSystem.out.println(\"Vendor: \" + e.getErrorCode());\r\n\t\t\t\te = e.getNextException();\r\n\t\t\t\tSystem.out.println(\"\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Exception: \" + e);\r\n\t\t\te.printStackTrace ();\r\n\t\t}\r\n\t\treturn Balance;\r\n\t}", "public double getBalance(){\n return this.balance;\r\n }", "public double getBalance(){\n return balance;\n }", "public String myAfterBalanceAmount() {\r\n\t\tint count=0;\r\n\t\tList<SavingAccount> acc = null;\r\n\t\ttry {\r\n\t\t\tSystem.out.println(\"Before Repeat\");\r\n\t\t\tacc = getSavingAccountList();\r\n\r\n\t\t\tfor (SavingAccount savingAcc : acc) {\r\n\t\t\t\tif (!(\"0\".equals(savingAcc.getState()))) {\r\n\t\t\t\t\tif (savingAcc.getState().equals(\"active\")) {\r\n\t\t\t\t\t\tint maxRepeat = Integer.parseInt(savingAcc\r\n\t\t\t\t\t\t\t\t.getRepeatable());\r\n\r\n\t\t\t\t\t\tDate date = new Date();\r\n\t\t\t\t\t\tDate systemDate = savingAccSer\r\n\t\t\t\t\t\t\t\t.convertStringToDateDDmmYYYY(savingAccSer\r\n\t\t\t\t\t\t\t\t\t\t.convertDateToStringDDmmYYYY(date));\r\n\r\n\t\t\t\t\t\tDate dateEnd = savingAccSer\r\n\t\t\t\t\t\t\t\t.convertStringToDateDDmmYYYY(savingAcc\r\n\t\t\t\t\t\t\t\t\t\t.getDateEnd());\r\n\r\n\t\t\t\t\t\tif (systemDate.getTime() == dateEnd.getTime()) {\r\n\t\t\t\t\t\t\tDate newEndDate = DateUtils.addMonths(systemDate,\r\n\t\t\t\t\t\t\t\t\tsavingAcc.getInterestRateId().getMonth());\r\n\r\n\t\t\t\t\t\t\tfloat balance = savingAcc.getBalanceAmount();\r\n\t\t\t\t\t\t\tfloat interest = savingAcc.getInterestRateId()\r\n\t\t\t\t\t\t\t\t\t.getInterestRate();\r\n\r\n\t\t\t\t\t\t\tint month = savingAcc.getInterestRateId()\r\n\t\t\t\t\t\t\t\t\t.getMonth();\r\n\t\t\t\t\t\t\tint days = Days\r\n\t\t\t\t\t\t\t\t\t.daysBetween(\r\n\t\t\t\t\t\t\t\t\t\t\tnew DateTime(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsavingAccSer\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.convertStringToDate(savingAcc\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getDateStart())),\r\n\t\t\t\t\t\t\t\t\t\t\tnew DateTime(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsavingAccSer\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.convertStringToDate(savingAcc\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getDateEnd())))\r\n\t\t\t\t\t\t\t\t\t.getDays();\r\n\t\t\t\t\t\t\tfloat amountAll = balance\r\n\t\t\t\t\t\t\t\t\t+ (balance * ((interest / (100)) / 360) * days);\r\n\t\t\t\t\t\t\tsavingAcc.setDateStart(savingAccSer\r\n\t\t\t\t\t\t\t\t\t.convertDateToString(systemDate));\r\n\t\t\t\t\t\t\tsavingAcc.setDateEnd(savingAccSer\r\n\t\t\t\t\t\t\t\t\t.convertDateToString(newEndDate));\r\n\t\t\t\t\t\t\tsavingAcc.setBalanceAmount(amountAll);\r\n\t\t\t\t\t\t\tsavingAcc.setRepeatable(\"\" + (maxRepeat + 1));\r\n\t\t\t\t\t\t\tupdateSavingAccount(savingAcc);\r\n\t\t\t\t\t\t\tcount+=1;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(\"Successfully!! \"+ count +\" Saving Account has been updated. Minh Map!!!\");\r\n\t\t\t\r\n\t\t\treturn \"success\";\r\n\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\tSystem.out.println(\"Exception\");\r\n\r\n\t\t}\r\n\t\treturn \"Fail\";\r\n\t}", "@Override\n\tpublic BigDecimal getBackAccMoney(String bidId, String period) {\n\t\treturn dao.getBackAccMoney(bidId,period);\n\t}", "public Double getBalance() {\n return null;\n }", "public BigDecimal getWithdrawFee() {\n return withdrawFee;\n }", "public BigDecimal getBalanceBonus() {\n return balanceBonus;\n }", "@Override\n\tpublic BigDecimal getBackMoney(String bidId, String peridId) {\n\t\treturn dao.getBackMoney(bidId, peridId);\n\t}", "public String getCurrentAmount() {\n\t\twaitForControl(driver, LiveGuru99.WithdrawallPage.GET_CURRENT_AMOUNT, timeWait);\n\t\tString currentAmount = getText(driver, LiveGuru99.WithdrawallPage.GET_CURRENT_AMOUNT);\n\t\treturn currentAmount;\n\t}", "protected double getTotalBalance()\r\n {\r\n return totalBalance;\r\n }", "com.google.ads.googleads.v6.resources.AccountBudget getAccountBudget();", "public int getCurBalance() {\n\t\treturn curBalance;\n\t}", "public BigDecimal getPbackPaid() {\n return pbackPaid;\n }", "public float getAmount() {\n System.out.println(\"Account Balance:\" + amount);\n return amount;\n }", "public double getBalance(){\n return balance;\n }", "public java.math.BigDecimal getTotalInvoiceBalance() {\n return totalInvoiceBalance;\n }", "public double getBalance(){\n return balance;\n }", "public float showBalance() {\n\t\treturn dao.showBalance();\r\n\t}", "public BigDecimal getBackPaid() {\n return backPaid;\n }", "public int getBankAccount() {\n return bankAccount;\n }", "public String getWaiting_account() {\n return waiting_account;\n }", "public double getBalance(){\n return balance;\r\n }", "public static BigDecimal getBalance(int accountId) throws SQLException {\n boolean cdt1 = Checker.checkValidUserAccountAccountId(accountId);\n // if it is a valid account id, establish a connection\n if (cdt1) {\n Connection connection = DatabaseDriverHelper.connectOrCreateDataBase();\n BigDecimal balance = DatabaseSelector.getBalance(accountId, connection);\n connection.close();\n return balance;\n }\n return null;\n }", "public BigDecimal getBALLOON_PAYMENT() {\r\n return BALLOON_PAYMENT;\r\n }" ]
[ "0.7199373", "0.7044418", "0.6973423", "0.69332826", "0.6927114", "0.6910341", "0.6910341", "0.6891365", "0.68528414", "0.68422025", "0.68422025", "0.68181854", "0.68181854", "0.680768", "0.67872787", "0.6767901", "0.67489517", "0.67489517", "0.67125607", "0.6702194", "0.66739035", "0.66540104", "0.6652194", "0.6637836", "0.66357744", "0.6628302", "0.6606591", "0.65875536", "0.6548986", "0.65461993", "0.6532386", "0.65136284", "0.65110594", "0.6507158", "0.64979976", "0.64957374", "0.6490095", "0.6482934", "0.6482934", "0.6473937", "0.6465385", "0.6456769", "0.6453606", "0.64428854", "0.64428854", "0.64428854", "0.64428854", "0.64428854", "0.6435845", "0.6435845", "0.6435845", "0.6435845", "0.64340794", "0.6433633", "0.64163715", "0.64151984", "0.64003307", "0.6399901", "0.6399901", "0.6397876", "0.63927597", "0.6386339", "0.63828975", "0.634621", "0.6333463", "0.63168323", "0.62998503", "0.6288297", "0.6259395", "0.6243645", "0.62354314", "0.6232582", "0.6188326", "0.6177515", "0.6177486", "0.6124076", "0.61193216", "0.61128354", "0.6110539", "0.61055154", "0.6079123", "0.607024", "0.6058434", "0.6049692", "0.60349596", "0.6014561", "0.60143137", "0.60138154", "0.6010166", "0.5993558", "0.59857833", "0.5977586", "0.5974123", "0.5949554", "0.59405816", "0.59404194", "0.59242797", "0.59236485", "0.5917418", "0.5916112" ]
0.7936195
0
Sets the pending balance of the account
public synchronized void setPendingBalance(double pendingBalance) { this.pendingBalance = pendingBalance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void setManageTransactionBalance(String balance);", "public void setBalance(){\n balance.setBalance();\n }", "public void setBalance(double bal){\n balance = bal;\r\n }", "public void setNewBalance() {\n\t\tacc.setBankBalance(acc.getBalance() - keyboard.getAmt());\r\n\t}", "public void setBalance(BigDecimal balance) {\n this.balance = balance;\n }", "public void setBalance(BigDecimal balance) {\n this.balance = balance;\n }", "public void setBalance(double balance)\n {\n startingBalance = balance;\n }", "public void setBalance(java.math.BigDecimal balance) {\n this.balance = balance;\n }", "public double getPendingBalance() {\n return pendingBalance;\n }", "public void setCurrent_balance(com.token.vl.service.MoneyWs current_balance) {\n this.current_balance = current_balance;\n }", "public void setBalance( long balance ) {\r\n this.balance = balance;\r\n }", "void setBalance(double value);", "private void setBalance(double balance) {\n this.balance = balance;\n }", "public synchronized void setBalance(double balance) {\n this.balance = balance;\n }", "public void setBalance(int balance) {\r\n\t\tif(0<=balance&&balance<=1000000) {\r\n\t\tthis.balance = balance;\r\n\t}else{\r\n\t\t System.out.println(\"잘못 입력하셨습니다. 현재 잔고는 \"+this.balance+\"입니다\");\r\n\t}\r\n \r\n}", "protected void setTotalBalance(double balance)\r\n {\r\n totalBalance = balance;\r\n }", "public void setBalance(T balance) {\n transactions = new ArrayList<Transaction>();\n\t\ttransactions.add(new Transaction<T>('+', balance));\n }", "public void setBalance(final int balance)\n {\n this.balance = balance;\n }", "public void setBalance( Integer account_id, double balance ){\r\n\r\n Map<String, String> params = new HashMap<>();\r\n params.put(\"account_id\", String.valueOf(account_id));\r\n params.put(\"balance\", String.valueOf(balance));\r\n String url = API_DOMAIN + ACCOUNT_EXT + SET_BALANCE;\r\n this.makeVolleyRequest( url, params );\r\n }", "void updateBalance(int amount){ \n\t\tbalance = amount;\n\t}", "public void setBalance(Integer balance) {\n this.balance = balance;\n }", "public void setBalance(Integer balance) {\n this.balance = balance;\n }", "public void setBalance(double balance){\n\t\tthis.balance = balance;\n\t}", "public final void payBills() {\n if (this.isBankrupt) {\n return;\n }\n Formulas formulas = new Formulas();\n if ((getInitialBudget() - formulas.monthlySpendings(this)) < 0) {\n setBankrupt(true);\n }\n setInitialBudget(getInitialBudget() - formulas.monthlySpendings(this));\n }", "public void setBankAccount(final int newBAccount) {\n this.bankAccount = newBAccount;\n }", "public void setBalance(float balance) {\n this.balance = balance;\n }", "public static String payCurrentBill(String account){\n return \"update current_bills set cb_paid = 1 where cb_account = '\"+account+\"'\";\n }", "Account(int balance) {\n if(balance <0) this.balance=0;\n this.balance = balance;\n }", "@Override\n\tpublic void calculateAndUpdateBalance() {\n\n\t\tbalance -= fee;\n\n\t}", "private void updateDatabaseAccountBalance() {\n\t\tString sql = \"UPDATE account SET balance = \" + this.balance + \" \";\n\t\tsql += \"WHERE accountID = '\" + this.accountID + \"';\";\n\n\t\tDbUtilities db = new MySqlUtilities();\n\t\tdb.executeQuery(sql);\n\t}", "public void changeBalance (int amount){\n balance += amount;\n }", "public void spendAllMoney() {\n\t\tcurrentBalance = 0;\n\t}", "public void setBalance(double balance) {\n\t\tthis.balance = balance;\n\t}", "void deposit(int value)//To deposit money from the account\n {\n balance += value;\n }", "public void setBalance(Double balance) {\r\n this.balance = balance;\r\n }", "@Override\n\tpublic void setTotalPending(Double pending, Integer employeeID) {\n\t\t\n\t}", "public void sendBankBalance(int amount) {\n sendMessage(Prefix.BANKBALANCE, amount + \"\");\n }", "public void updateBalance(int account_id, int final_amount){\n dbUpdate(\"update ACCOUNTS set BALANCE = \"+ final_amount + \" where ACCOUNT_ID = \" + account_id);\n cache.add(new Account(account_id, final_amount));\n }", "public void setBalance(float value)\n {\n balanceCtrl.setValue(value);\n }", "public void setWithdrawMoney(BigDecimal withdrawMoney) {\n this.withdrawMoney = withdrawMoney;\n }", "public void updateBal(int value) {\r\n bal = bal + value;\r\n }", "public Builder setBalanceBytes(\n com.google.protobuf.ByteString value) {\n if (value == null) {\n throw new NullPointerException();\n }\n checkByteStringIsUtf8(value);\n \n balance_ = value;\n onChanged();\n return this;\n }", "public void InitializeBalance(BigDecimal valor){\n \r\n ChekingAccount chekAc=pRepository.GetChekingAccount();\r\n chekAc.setSaldoInicial(valor);\r\n pRepository.SaveChekingAccount(chekAc);\r\n \r\n }", "public void setBalance(double newBalance) {\n\t\tbalance = newBalance;\n\t\tbalance = Math.round(balance * 100.0) / 100.0;\n\t}", "public void deposit(BigDecimal deposit){\n balance = balance.add(deposit);\n }", "public void setPbackPaid(BigDecimal pbackPaid) {\n this.pbackPaid = pbackPaid;\n }", "public void deposit(int amount)\n {\n setBalance(getBalance()+amount);\n }", "public synchronized void applyFee() {\r\n balance -= FEE;\r\n }", "@Override\r\n public void setPostpaidLimit(BigDecimal postpaidLimit) {\n }", "public void setBalance() {\n System.out.print(\"Set the balance of your credit card: \");\n this.balance = Double.parseDouble(scanner.nextLine());\n }", "protected void resetTotalBalance()\r\n {\r\n totalBalance = 0.00;\r\n }", "public void setWithdrawFee(BigDecimal withdrawFee) {\n this.withdrawFee = withdrawFee;\n }", "protected void enableActionSetBalance()\n {\n Action action = new Action(\"SetBalance\");\n action.addInputParameter(new ParameterRelated(\"Value\", iPropertyBalance));\n iDelegateSetBalance = new DoSetBalance();\n enableAction(action, iDelegateSetBalance);\n }", "public int baldown(double newbalance, Long accountno, Long broaccno, Double bramt) throws Exception{\n\tint j=DbConnect.getStatement().executeUpdate(\"update account set balance=\"+newbalance+\" where accno=\"+accountno+\"\");\r\n\tint i=DbConnect.getStatement().executeUpdate(\"update account set balance=balance+\"+bramt+\" where accno=\"+broaccno+\"\");\r\n\treturn i;\r\n}", "public BankAccount(int balance) {\n\n this.balance = balance;\n\n }", "@Override\n protected void withdraw(int request, boolean isOverdraft){\n if(request>0){\n request += SERVICE_FEE;\n }\n //need to change both balances just in case there was a LARGE_DEPOSIT \n //making it so that the 2 balance values differ\n setBalance(getBalance() - request);\n setBalanceAvailable(getBalanceAvailable() - request);\n }", "public void pending()\n\t{\n\t\tdriver.findElementByName(OR.getProperty(\"Pending\")).click();\n\t}", "public int balup(double newbalance, Long accountno, Long broaccno, Double bramt) throws Exception{\n\tint j=DbConnect.getStatement().executeUpdate(\"update account set balance=\"+newbalance+\" where accno=\"+accountno+\"\");\r\n\tint i=DbConnect.getStatement().executeUpdate(\"update account set balance=balance+\"+bramt+\" where accno=\"+broaccno+\"\");\r\n\treturn i;\r\n}", "public void setFreeMoney(BigDecimal freeMoney) {\r\n this.freeMoney = freeMoney;\r\n }", "private void updateBalance(){\n Intent toUpdateBal = new Intent(this, UpdateAccount.class);\n startActivity(toUpdateBal);\n }", "public void withdraw(BigDecimal amount) {\n this.setBalance(this.getBalance().subtract(amount));\n }", "public void updateBalance(UUID accountId, double amount) {\n Account account = repository.getAccount(accountId);\n account.updateBalance(amount);\n repository.save(account);\n }", "public void setBackPaid(BigDecimal backPaid) {\n this.backPaid = backPaid;\n }", "public BankAccount() {\r\n\t\tbalance=0;\r\n\t\t\r\n\t}", "public void setACC_BR(BigDecimal ACC_BR) {\r\n this.ACC_BR = ACC_BR;\r\n }", "public BankAccount() {\n\t\tthis.money = 0;\n\t}", "private void updateBalance(int balance) throws SQLException {\n\t\tupdateBalanceStatement.clearParameters();\n\t\tupdateBalanceStatement.setInt(1, balance);\n\t\tupdateBalanceStatement.setString(2, this.username);\n\t\tupdateBalanceStatement.executeUpdate();\n\t}", "public Wallet() {\n total_bal = 10;\n }", "public void setBankaccount(java.lang.String param) {\r\n localBankaccountTracker = param != null;\r\n\r\n this.localBankaccount = param;\r\n }", "public void deposit(BigDecimal amount) {\n this.setBalance(this.getBalance().add(amount));\n }", "public static void deposit(){\n TOTALCMONEY = TOTALCMONEY + BALANCEDEPOSIT; //the cashier money equals the cashier money plus the amount that is being deposited\r\n BALANCE = BALANCE + BALANCEDEPOSIT; //the user balance equals the user balance plus the amount that is being deposited\r\n }", "public void setBalance(final double newBalance) {\n this.balance = newBalance;\n }", "public void setBLOCKED_AMOUNT(BigDecimal BLOCKED_AMOUNT) {\r\n this.BLOCKED_AMOUNT = BLOCKED_AMOUNT;\r\n }", "public void changeBanksForPayment(){\n\t\t\tgetLocalBankListforIndicator();\n\t\t\tsetPaymentmodeId(null);\n\t\t\tif(getPaymentCode()!=null && getPaymentCode().equalsIgnoreCase(\"B\"))\n\t\t\t{\n\t\t\t\t\n\t\t\t\tsetBooChequePanel(true);\n\t\t\t\tsetBooCardPanel(false);\n\t\t\t\tsetRemitamount(null);\n\t\t\t\tBigDecimal PaymentId=placeOrderPendingTransctionService.toFetchPaymentId(getPaymentCode());\n\t\t\t\tsetPaymentmodeId(PaymentId);\n\t\t\t\t//clearKnetDetails();\n\t\t\t}else\n\t\t\t{\n\t\t\t\tsetBooChequePanel(false);\n\t\t\t\tsetBooCardPanel(true);\n\t\t\t\tsetRemitamount(null);\n\t\t\t\tBigDecimal PaymentId=placeOrderPendingTransctionService.toFetchPaymentId(getPaymentCode());\n\t\t\t\tsetPaymentmodeId(PaymentId);\n\t\t\t}\n\t\t\tsetBooRenderSaveOrExit(true);\n\t\t}", "public CheckBalanceUpcoming() {\n this.upcomingPayment = -1;\n }", "public BankAccount(double initialBalance) {\r\n\t\tbalance=initialBalance;\r\n\t}", "public void addBalance(long balance) {\r\n this.balance += balance;\r\n }", "public void setAvailable_Balance(com.token.vl.service.MoneyWs available_Balance) {\n this.available_Balance = available_Balance;\n }", "public void withdraw(int amount)\n {\n setBalance(getBalance()-amount);\n }", "@Override\n\tvoid deposit(double amount) {\n\t\tsuper.balance += amount - 20;\n\t}", "public synchronized double setBalanceForAccId(int AccId, double bal) {\n\t\tConnection dbAccess = DataAccess.getDbAccess();\n\t\tPreparedStatement psttmnt;\n\t\tString querySting;\n\t\tdouble balance = -1.0;\n\t\ttry {\n\t\t\tquerySting = \"UPDATE accounts SET acc_balance = \" + bal + \" WHERE acc_id = \" + AccId;\n\t\t\tpsttmnt = dbAccess.prepareStatement(querySting);\n\t\t\tint result = psttmnt.executeUpdate();\n\t\t\tif (result != 0) {\n\t\t\t\t balance = getBalanceForAccId(AccId);\n\t\t\t}\n\t\t\tdbAccess.close();\n\t\t} catch (SQLException se) {\n\t\t\tse.printStackTrace();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t} \n\t\treturn balance;\n\t}", "public void balance(){\n\t\tnamesTree.balance();\n\t\taccountNumbersTree.balance();\n\t}", "public void setBALLOON_PAYMENT(BigDecimal BALLOON_PAYMENT) {\r\n this.BALLOON_PAYMENT = BALLOON_PAYMENT;\r\n }", "protected void imposeTransactionFee ()\n {\n if (getBalance () < minimumBalance)\n super.withdraw (transactionFee);\n }", "public void editBalance() {\n\t\tAccount account = getAccountForEditBalance();\n\n\t\tif (adminDao.editBalance(account))\n\t\t\tSystem.out.println(\"Balance edited!\");\n\t\telse\n\t\t\tSystem.out.println(\"Something went wrong!\");\n\n\t\tAdminMenu.getAdminMenu();\n\t}", "@Override\n\tpublic void transferBalnace() {\n\t\tSystem.out.println(\"balance is transferd\");\n\t}", "public void setPending()\n\t{\n\t\tprogressBar.setString(XSTR.getString(\"progressBarWaiting\"));\n\t\tprogressBar.setIndeterminate(true);\n\t\tprogressBar.setValue(0);\n\t\t\n\t\tstoplightPanel.setPending();\n\t}", "public void deposit(double amount) {\n balance += amount;\n \n try {\n \n Class.forName(\"net.ucanaccess.jdbc.UcanaccessDriver\");\n \n // Load Driver\n String connURL=\"jdbc:ucanaccess://c:/Users/Ellen/Documents/CIST2373/ChattBankMDB.mdb\";\n \n // Get Connection\n Connection con = DriverManager.getConnection(connURL);\n \n // Create Statement\n Statement stmt = con.createStatement();\n \n // Create sql string \n String sql = \"Update Accounts set Balance = \"+getBalance()+ \n \" where AcctNo='\"+getAcctNo()+\"'\";\n \n // Check for properly formed sql\n System.out.println(sql);\n \n // Execute Statement\n int n = stmt.executeUpdate(sql);\n if (n == 1)\n System.out.println(\"Update was successful!\");\n else\n System.out.println(\"Update failed!\"); \n \n // Close Connection\n con.close(); \n } //end try\n \n catch (Exception err) {\n System.out.println(\"Error: \" + err);\n } //end catch\n }", "public void setTotalDebit(java.math.BigDecimal totalDebit)\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.SimpleValue target = null;\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(TOTALDEBIT$0, 0);\n if (target == null)\n {\n target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(TOTALDEBIT$0);\n }\n target.setBigDecimalValue(totalDebit);\n }\n }", "public void setPayAmt (BigDecimal PayAmt);", "void setOverdraftLimit(double overdraftLimit) {\n\t\tSystem.out.println(\"Your account is not current account.\");\n\t}", "public BankAccount() {\t\n\t\tthis.accountNumber = UUID.randomUUID().toString().substring(0, 6);\n\t\tthis.balance = 0;\n\t\tthis.accountType = \"Bank account\";\n\t}", "public void setAvailableCash(Money initialAmount){\n\t\tavailableCash = initialAmount;\n\t}", "public Balance() {\r\n value = BigDecimal.ZERO;\r\n }", "public Account()\n {\n balance = 0;\n balanceChangeLock = new ReentrantLock();\n sufficientFundsCondition = balanceChangeLock.newCondition();\n }", "public void withdrawMoney(double amount) {\n\t\tbalance = balance - amount;\n\t}", "public void addSavingsBalance(BigDecimal toAdd) {\r\n setSavingsBalance(savingsBalance.add(toAdd));\r\n }", "public double getBal() {\n\t\t return balance;\r\n\t }", "public void setBalanceBonus(BigDecimal balanceBonus) {\n this.balanceBonus = balanceBonus;\n }", "void modifyMaximumBudget(TotalBudget totalBudget) throws NoUserSelectedException;" ]
[ "0.6834969", "0.67514235", "0.6601438", "0.64962983", "0.635104", "0.635104", "0.6288475", "0.62242174", "0.62184256", "0.62179416", "0.6131297", "0.6129946", "0.611889", "0.6118115", "0.60950005", "0.6090225", "0.60885704", "0.6071411", "0.60617584", "0.60490316", "0.60000306", "0.60000306", "0.59796447", "0.59561795", "0.5941424", "0.59278554", "0.5913215", "0.58821386", "0.5867946", "0.5845782", "0.5827575", "0.5815689", "0.5799586", "0.5790928", "0.5774156", "0.5771557", "0.5750434", "0.57250816", "0.56966996", "0.56929296", "0.56884265", "0.5683908", "0.56830287", "0.5663193", "0.5652193", "0.562935", "0.56264174", "0.5608664", "0.5593901", "0.55917627", "0.55911815", "0.55768025", "0.55696154", "0.5551324", "0.55471015", "0.5539306", "0.5530314", "0.5528346", "0.5524112", "0.5519034", "0.5497096", "0.5486058", "0.5484454", "0.5481335", "0.5478889", "0.5463999", "0.5458357", "0.5449169", "0.5447813", "0.5432758", "0.54183817", "0.54095715", "0.5397372", "0.5376532", "0.53741646", "0.536584", "0.5365509", "0.53637683", "0.5355832", "0.5345174", "0.5343642", "0.533761", "0.5336813", "0.53357416", "0.53332853", "0.5328869", "0.5328197", "0.53225243", "0.532042", "0.5318616", "0.53175545", "0.53010476", "0.5298654", "0.5295024", "0.529219", "0.5286076", "0.5279062", "0.52730227", "0.5272262", "0.5270255" ]
0.7924192
0
Gets the account number
public Integer getAccountNumber() { return accountNumber; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "java.lang.String getAccountNumber();", "public String getAccountNumber() {\n\t\tthis.setAccountNumber(this.account);\n\t\treturn this.account;\n\t}", "public static String getAccountNumber() {\n\t\treturn accountNumber;\n\t}", "public int getAccountNumber() {\n\t\treturn accNum;\n\t}", "public int getAccountNo()\r\n\t{\r\n\t\t\r\n\t\treturn accountNo;\r\n\t\t\r\n\t}", "public int getAccountNumber() {\n return accountNumber;\n }", "public String getAccountNo();", "public String getAccountNumber() {\n return accountNumber;\n }", "public String getAccountNumber() {\n return accountNumber;\n }", "public String getAccountNumber() {\n return accountNumber;\n }", "public int getAccountNo() {\n\t\treturn this.accountNo;\r\n\t}", "public java.lang.String getAccount_number() {\n return account_number;\n }", "public java.lang.String getAccountNumberString()\r\n\t{\r\n\t\t\r\n\t}", "public java.lang.String getAccountNumber() {\n return accountNumber;\n }", "public java.lang.String getAccountNumber() {\r\n return accountNumber;\r\n }", "public String getAccountNo() {\n return accountNo;\n }", "public int getAccountNo() {\n return accountNo;\n }", "public String getAccountNumber() {\n\t\treturn accountNumber;\n\t}", "public String getAccountNumber() {\n\t\treturn accountNumber;\n\t}", "public String getAccountNr() {\r\n\t\treturn accountNr;\r\n\t}", "String getAccountID();", "String getAccountID();", "private int getCurrentAccountId() {\n accountLock.lock();\n int nmr = 1;\n try (\n Statement s = rawDataSource.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);\n ResultSet res = s.executeQuery(\n \"SELECT ACCOUNT_ID FROM APP.ACCOUNTS ORDER BY ACCOUNT_ID ASC\")) {\n\n if (res.last()) {\n nmr = Integer.parseInt(res.getString(\"ACCOUNT_ID\")) + 1;\n }\n } catch (SQLException ex) {\n return nmr;\n }\n\n accountLock.unlock();\n return nmr;\n }", "Account getAccount(Integer accountNumber);", "public String getAcctNo(){\n\t\treturn acctNo;\n\t}", "public String getCardNumber() {\n return this.account;\n }", "public long getAccNumber() {\n\t\treturn accNumber;\n\t}", "java.lang.String getAccount();", "AccountDetail getAccount(String number) throws Exception;", "public String getAccountID() {\n return (tozAdAccountID);\n }", "public int getAccountID() {\n return accountID;\n }", "public static String getAccountNumber(String user){\n return \"select u_accountnum from users where u_name = '\" + user + \"'\";\n }", "public java.lang.String getLocalAccountNr()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.SimpleValue target = null;\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(LOCALACCOUNTNR$4, 0);\n if (target == null)\n {\n return null;\n }\n return target.getStringValue();\n }\n }", "public int getAccNum()\n\t{\n\t\treturn accNum;\n\t}", "public Long getAccountID() {\n return accountID;\n }", "public Long getAccountID() {\n return accountID;\n }", "public Long getAccountID() {\n return accountID;\n }", "public Long getAccountID() {\n return accountID;\n }", "public java.lang.String getAccount_Id() {\n return account_Id;\n }", "public String getAccount() {\r\n return account;\r\n }", "public int getTransactorAccountNumber() {\r\n return transactorAccountNumber;\r\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\n return account;\n }", "public String getAccount() {\r\n\t\treturn account;\r\n\t}", "public String getAccountCode() {\n return accountCode;\n }", "org.apache.xmlbeans.XmlString xgetAccountNumber();", "public String getAccount(){\n\t\treturn account;\n\t}", "Long getAccountId();", "public java.lang.Object getAccountID() {\n return accountID;\n }", "java.lang.String getAccountId();", "java.lang.String getAccountId();", "java.lang.String getAccountId();", "public long getAccountId() {\n return accountId;\n }", "public long getAccountId()\r\n/* 115: */ {\r\n/* 116:121 */ return this.accountId;\r\n/* 117: */ }", "public int getAccountId() {\n return accountId;\n }", "public Integer getAcctId() {\n return acctId;\n }", "public int getAccountID(Account account)\n\t {\n\t\t int id = -1;\n\t\t String columns[] = new String[] {DatabaseContract.AccountContract._ID};\n\t\t \n\t\t String where = DatabaseContract.AccountContract.COLUMN_NAME_USERNAME + \" = ? \";\n\t\t \n\t\t Cursor cursor = db.query(DatabaseContract.AccountContract.TABLE_NAME,\n\t\t\t\t columns,\n\t\t\t\t where,\n\t\t\t\t new String[] {account.getUsername()},\n\t\t\t\t null, null, null);\n\t\t\n\t\t if(cursor.getCount() > 0)\n\t\t {\n\t\t\t cursor.moveToFirst();\n\t\t\t \n\t\t\t int idCol = cursor.getColumnIndex(DatabaseContract.AccountContract._ID);\n\t\t\t id = cursor.getInt(idCol);\n\t\t }\n\t\t \n\t\t cursor.close();\n\t\t return id;\n\t }", "public long getAccountId() {\n\t\treturn accountId;\n\t}", "public org.apache.xmlbeans.XmlString xgetLocalAccountNr()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.XmlString target = null;\n target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(LOCALACCOUNTNR$4, 0);\n return target;\n }\n }", "public int getBankAccountNumber() {\n return bankAccountNumber;\n }", "public String generateAccountNumber() {\n // Set First part of AccountNumber\n String accountNumberFirst = \"1398\";\n\n // To Make Second, Third part Get each date and time\n String currentTime = getCurrentTime();\n\n // Get year, month, day\n String date = currentTime.split(\" \")[0];\n int year, month, day;\n year = Integer.parseInt(date.split(\"-\")[0]);\n month = Integer.parseInt(date.split(\"-\")[1]);\n day = Integer.parseInt(date.split(\"-\")[2]);\n\n // Get hour, minute, second\n String time = currentTime.split(\" \")[1];\n int hour, minute, second;\n hour = Integer.parseInt(time.split(\":\")[0]);\n minute = Integer.parseInt(time.split(\":\")[1]);\n second = Integer.parseInt(time.split(\":\")[2]);\n\n // Set Second part of AccountNumber\n String accountNumberSecond;\n accountNumberSecond = Integer.toString((year % 10)) + Integer.toString((month * second) % 10) + Integer.toString((day * minute + hour) % 10);\n\n // Set Third part of AccountNumber\n String accountNumberThird;\n accountNumberThird = Integer.toString((second * hour + minute) % 10) + Integer.toString((second * day + hour) % 10) + Integer.toString((day * month + second) % 10) + Integer.toString((second * minute + day) % 10);\n\n // Set Forth part of AccountNumber\n String accountNumberForth;\n int count = (int)accountDataRepository.count();\n if(count % 100 < 10) {\n accountNumberForth = \"0\" + Integer.toString(count % 100);\n }\n else {\n accountNumberForth = Integer.toString(count % 100);\n }\n\n // Generate AccountNumber\n String accountNumber = accountNumberFirst + \"-\" + accountNumberSecond + \"-\" + accountNumberThird + \"-\" + accountNumberForth;\n\n return accountNumber;\n }", "public Integer getAccountId() {\n return accountId;\n }", "public Integer getAccountId() {\n return accountId;\n }", "public AccountInfo getAccount()\n {\n if(accountInfo == null)\n {\n System.out.println(\"You need to generate an account before getting the details.\");\n return null;\n }\n return accountInfo;\n }", "public Integer getAccountId() {\n return this.accountId;\n }", "java.lang.String getLoginAccount();", "java.lang.String getLoginAccount();", "String getTradingAccount();", "public String getTypeAccountInNumber() {\n return typeAccountInNumber;\n }", "public java.lang.String getAccount() {\n java.lang.Object ref = account_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n account_ = s;\n return s;\n }\n }", "public int getBankAccount() {\n return bankAccount;\n }", "public java.lang.String getAccount() {\n java.lang.Object ref = account_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n account_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getAccount() {\n java.lang.Object ref = account_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n account_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public String getUsernumber() {\n return usernumber;\n }", "public String getCurrentUserAccount();", "private String getLoadAccountNumber(String loadAccNumber) {\n String loadNumber = \"\";\n if (null != loadAccNumber) {\n loadNumber = loadAccNumber;\n }\n return loadNumber;\n }", "public java.lang.String getAccount() {\n java.lang.Object ref = account_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n account_ = s;\n }\n return s;\n }\n }", "private int getUniqueAccountNumber () {\n\n int minInt = 100000;\n int maxInt = 999999;\n int candidateNumber = -1;\n Set<Integer> listOfCurrentAccountNumbers =\n hashMapOfAllAccts.keySet();\n boolean numberIsUnique = false;\n while ( !numberIsUnique ) {\n\n candidateNumber = rng.nextInt(maxInt+1);\n // assume unique for a moment\n numberIsUnique = true;\n // verify uniqueness assumption\n for ( int acctNum : listOfCurrentAccountNumbers) {\n if (candidateNumber == acctNum) {\n numberIsUnique = false;\n break;\n }\n } // end for() loop\n\n } // end while() loop\n\n return candidateNumber;\n }", "public void setAccountNo(int number){\n\t\taccountNo = number;\n\t}", "private Account getAccount( int accountNumber )\n {\n for( Account currentAccount : accounts )\n {\n if( currentAccount.getAccountNumber() == accountNumber )\n {\n return currentAccount;\n }\n \n }\n return null;\n }", "public Long getRaAccount() {\n\t\treturn raAccount;\n\t}", "public int getC_BankAccount_ID() {\n\t\tInteger ii = (Integer) get_Value(\"C_BankAccount_ID\");\n\t\tif (ii == null)\n\t\t\treturn 0;\n\t\treturn ii.intValue();\n\t}", "@Override\n\tpublic String getTelFeeAccount() {\n\t\tTelFee_Account = Util.getMaiYuanConfig(\"TelFee_Account\");\n\t\treturn TelFee_Account;\n\t}", "public Long getAccountId() {\n\t\treturn accountId;\n\t}", "public Long getAccountId() {\n return accountId;\n }", "public int getAccountType() {\r\n return accountType;\r\n }", "long getAccountLinkId();", "public String getAccountId() {\r\n return (String) getAttributeInternal(ACCOUNTID);\r\n }", "@Override\n\tpublic String toString() {\n\t\treturn accountID;\n\t}", "public String getAccountId() {\n return accountId;\n }", "public String getAccountId() {\n return accountId;\n }" ]
[ "0.89875984", "0.83101714", "0.82991606", "0.8201452", "0.8140186", "0.81178606", "0.8014264", "0.7934047", "0.7934047", "0.7934047", "0.79270905", "0.79233754", "0.7917163", "0.7861226", "0.7855223", "0.78369737", "0.7791793", "0.77814066", "0.77814066", "0.7556412", "0.75225675", "0.75225675", "0.7330431", "0.7209954", "0.7207958", "0.7197659", "0.7166968", "0.7150135", "0.71213055", "0.7108384", "0.70728236", "0.70661086", "0.6986618", "0.688889", "0.68857265", "0.68857265", "0.68798995", "0.68798995", "0.68752784", "0.6850649", "0.6833887", "0.6829431", "0.6829431", "0.6829431", "0.6829431", "0.6829431", "0.6829431", "0.6829431", "0.6829431", "0.6829431", "0.6829431", "0.6819251", "0.6817122", "0.6810018", "0.67709893", "0.6737121", "0.67309844", "0.6709774", "0.6709774", "0.6709774", "0.66851765", "0.6681863", "0.6677251", "0.6642917", "0.6638835", "0.6620434", "0.6608327", "0.66045797", "0.66029835", "0.6597077", "0.6597077", "0.6570272", "0.6556115", "0.65473694", "0.65473694", "0.65340334", "0.6504654", "0.64791536", "0.6476898", "0.6474892", "0.6474723", "0.6466308", "0.64568967", "0.644999", "0.64453", "0.64173424", "0.6411346", "0.6409822", "0.638448", "0.6374566", "0.6372993", "0.6355968", "0.63531923", "0.63300705", "0.62988687", "0.6286882", "0.6284371", "0.6277953", "0.6277953" ]
0.80555296
7
Sets the account number
public synchronized void setAccountNumber(int number) { this.accountNumber = number; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void setAccountNumber(java.lang.String accountNumber);", "public void setAccountNo(int number){\n\t\taccountNo = number;\n\t}", "public void setAccountNumer(int accountNumber) {\n\t\tif (this.accountNumber == 0) {\n\t\t\tthis.accountNumber = accountNumber;\n\t\t} else {\n\t\t\tSystem.out.println(\"The account number is already assigned to this Customer.\");\n\t\t}\n\t}", "public boolean setAccountNumber(int account) {\n\t\tif (account > 0)\n\t\t\tthis.account = String.valueOf(account);\n\t\telse\n\t\t\treturn false;\n\t\treturn true;\n\t}", "public void setAccountNumber(int accountNumberIn)\r\n\t{\r\n\t\t\r\n\t\tif (accountNumberIn >= ACCOUNT_NUM_MIN && accountNumberIn <= ACCOUNT_NUM_MAX)\r\n\t\t\r\n\t\t\taccountNumber = accountNumberIn;\r\n\t\t\r\n\t\telse\r\n\t\t\taccountNumber = -1;\r\n\t\t\r\n\t}", "public void setAccountNumber(int accountNumber) {\n this.accountNumber = accountNumber;\n }", "public void setAccountNo (String AccountNo);", "public void setAccountNumber(String newAccountNumber) \n\t{\n\t\taccountNumber = newAccountNumber;\n\t}", "public boolean setAccountNumber(String account) {\n\t\tif (account == null)\n\t\t\taccount = \"\";\n\t\ttry {\n\t\t\treturn this.setAccountNumber(Integer.parseInt(account));\n\t\t} catch (NumberFormatException e) {\n\t\t\treturn false;\n\t\t}\n\t}", "private void setAccountNumber() // setare numar de cont\n {\n int random = ThreadLocalRandom.current().nextInt(1, 100 + 1);\n accountNumber = ID + \"\" + random + SSN.substring(0,2);\n System.out.println(\"Your account number is: \" + accountNumber);\n }", "public void setAccountNumber(java.lang.String accountNumber) {\r\n this.accountNumber = accountNumber;\r\n }", "public void setAccountNo(String AccountNo) {\n super.setAccountNo(MPaymentValidate.checkNumeric(AccountNo));\n }", "public void setAccountNumber(String accountNumber) {\n this.accountNumber = accountNumber;\n }", "public void setAccount_number(java.lang.String account_number) {\n this.account_number = account_number;\n }", "public void setAccountNumber(java.lang.String accountNumber) {\n this.accountNumber = accountNumber;\n }", "void setAccount(final Account account);", "public void setAccount(Account account) {\n this.account = account;\n }", "public void setAccountNumber(String accountNumber) {\n this.accountNumber = accountNumber == null ? null : accountNumber.trim();\n }", "public void setAccountNo( String accountNo ) {\r\n this.accountNo = accountNo;\r\n }", "protected void setAccountName(final String account) {\n this.account = account;\n }", "public Builder setAccountID(long value) {\n validate(fields()[2], value);\n this.accountID = value;\n fieldSetFlags()[2] = true;\n return this; \n }", "public Builder setAccountID(long value) {\n validate(fields()[0], value);\n this.accountID = value;\n fieldSetFlags()[0] = true;\n return this; \n }", "public void enterAccountNumber(String accountNumber) {\n\t\twaitForControl(driver, LiveGuru99.WithdrawallPage.ACCOUNT_NUMBER_TEXTBOX, timeWait);\n\t\ttype(driver, LiveGuru99.WithdrawallPage.ACCOUNT_NUMBER_TEXTBOX, accountNumber);\n\t\tsleep(1);\n\t}", "public void setAccountID(Long value) {\n this.accountID = value;\n }", "public void setAccountID(Long value) {\n this.accountID = value;\n }", "public Saving accountNumber(String accountNumber) {\n this.accountNumber = accountNumber;\n return this;\n }", "public void setAccountNo(String accountNo) {\n this.accountNo = accountNo;\n }", "public void setAccount(String bank, String account)\n\t{\n\t\tbank = bank.trim().replaceAll(\" +\",\" \");\n\t\t\n\t\tif(account.length() == 19) //length of digits including hyphen(-)\n\t\t{\n\t\t this.account = MaskDigits.mask(account, \"xxxx-xxxx-xxxx-####\");\n\t\t}\n\t\tif(bank.equals(\"HSBC Canada\"))\n\t\t{\n\t\t\t\n\t\t\tthis.account = MaskDigits.mask(account, \"##xx-xxxx-xxxx-xxxx\");\n\t\t}\n\t\t\n\t\tif(bank.equals(\"Royal Bank of Canada\"))\n\t\t{\n\t\t\tthis.account = MaskDigits.mask(account, \"####-xxxx-xxxx-xxxx\");\n\t\t}\n\t\t\n\t\tif(bank.equals(\"American Express\"))\n\t\t{\n\t\t\tthis.account = MaskDigits.mask(account, \"xxxx-xxxx-xxxx-###\");\n\t\t}\n\t}", "public\n void\n setAccount(Account account)\n {\n itsAccount = account;\n }", "public void setAccountId(Integer value) {\n this.accountId = value;\n }", "public void setAccount(String account) {\n this.account = account;\n }", "public void setAccount(String account) {\n this.account = account;\n }", "public void setAccount(String account) {\n this.account = account;\n }", "public void setAccount(String account) {\n this.account = account;\n }", "public String getAccountNumber() {\n\t\treturn accountNumber;\n\t}", "public String getAccountNumber() {\n\t\treturn accountNumber;\n\t}", "public void setAccountId(long value) {\n this.accountId = value;\n }", "void setAccountId(Long accountId);", "public synchronized void setAmendmentNumber(final InternationalString newValue) {\n checkWritePermission();\n amendmentNumber = newValue;\n }", "public int getAccountNumber() {\n return accountNumber;\n }", "public String getAccountNumber() {\n return accountNumber;\n }", "public String getAccountNumber() {\n return accountNumber;\n }", "public String getAccountNumber() {\n return accountNumber;\n }", "public void setAccount(String account) {\r\n\t\tthis.account = account;\r\n\t}", "public void setAccount(String accountID) {\n this.account = accountID;\n }", "public void setAccountId(int accountId) {\n this.accountId = accountId;\n }", "public int getAccountNumber() {\n\t\treturn accNum;\n\t}", "public void setAccNo(int accNo) {\r\n\t\tthis.accNo = accNo+1;\r\n\t}", "void unsetAccountNumber();", "public void setAccountId(Integer accountId) {\n this.accountId = accountId;\n }", "public Builder setAccount(\n java.lang.String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n bitField0_ |= 0x00000002;\n account_ = value;\n onChanged();\n return this;\n }", "public Integer getAccountNumber() {\n return accountNumber;\n }", "public Integer getAccountNumber() {\n return accountNumber;\n }", "public void setAccountId(String s) { accountId = s;}", "public void setAccount(com.huawei.www.bme.cbsinterface.cbs.businessmgr.Account account) {\r\n this.account = account;\r\n }", "public void setBankAccount(final int newBAccount) {\n this.bankAccount = newBAccount;\n }", "public void setAccountName(String accountName){\n if(checkAccountClosed()){\n System.out.println(\"This transaction could not be processed. Please check your account status.\");\n }\n this.accountName = accountName;\n }", "void setPassportNumber(String passportNumber);", "public void setAccountType(int value) {\r\n this.accountType = value;\r\n }", "void xsetAccountNumber(org.apache.xmlbeans.XmlString accountNumber);", "public void setAcctNo(String acctNo){\n\t\tthis.acctNo = acctNo;\n\t}", "public void setAccount(String account) {\r\n this.account = account == null ? null : account.trim();\r\n }", "public void setAccount(String account) {\n this.account = account == null ? null : account.trim();\n }", "public void setAccount(String account) {\n this.account = account == null ? null : account.trim();\n }", "public void setAccount(String account) {\n this.account = account == null ? null : account.trim();\n }", "public void setAccount(String account) {\n this.account = account == null ? null : account.trim();\n }", "public void setAccount(String account) {\n this.account = account == null ? null : account.trim();\n }", "public BankAccount() {\n numberOfAccounts++;\n this.accountNumber = accountNumberGenerator(); \n }", "public static String getAccountNumber() {\n\t\treturn accountNumber;\n\t}", "void setNumber(int num) {\r\n\t\tnumber = num;\r\n\t}", "public void setCardNo(int cardNumber);", "public void setUsernumber(String usernumber) {\n this.usernumber = usernumber;\n }", "public void setTypeAccountInNumber(String typeAccountInNumber) {\n if (NUM_CTA_AHORROS.equalsIgnoreCase(typeAccountInNumber) || NUM_CTA_CORRIENTE.equalsIgnoreCase(typeAccountInNumber)) {\n this.typeAccountInNumber = typeAccountInNumber;\n } else {\n this.typeAccountInNumber = AdministradorUtilidades.formatoTipoCuentaNumero(typeAccountInNumber);\n }\n\n }", "java.lang.String getAccountNumber();", "public Builder setAccount(\n java.lang.String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n account_ = value;\n onChanged();\n return this;\n }", "public void setC_BankAccount_ID (int C_BankAccount_ID);", "public void setLocalAccountNr(java.lang.String localAccountNr)\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.SimpleValue target = null;\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(LOCALACCOUNTNR$4, 0);\n if (target == null)\n {\n target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(LOCALACCOUNTNR$4);\n }\n target.setStringValue(localAccountNr);\n }\n }", "public void setAccountId(String value) {\r\n setAttributeInternal(ACCOUNTID, value);\r\n }", "private void setAccount(SessionData sessionData, Account account) {\n \ttry {\n\t sessionData.set(\"account\", account);\n \t} catch (Exception e) {\n \t throw new RuntimeException(e.toString());\n \t}\n }", "public synchronized void setTbApWtEntryNumber(Integer value){\n\t\t// Fill up with necessary processing\n\n\t\ttbApWtEntryNumber = value;\n\t}", "public String getAccountNumber() {\n\t\tthis.setAccountNumber(this.account);\n\t\treturn this.account;\n\t}", "public void setNumber(int number) {\r\n\t\tthis.num = number;\r\n\t}", "public void setTransactorAccountNumber(int transactorAccountNumber) {\r\n this.transactorAccountNumber = transactorAccountNumber;\r\n }", "public java.lang.String getAccountNumber() {\r\n return accountNumber;\r\n }", "public java.lang.String getAccountNumber() {\n return accountNumber;\n }", "void setIdNumber(String idNumber);", "public void setAccountId(UUID accountId) {\n this.accountId = accountId;\n }", "void accountSet(boolean admin, String username, String password, String fName, String lName, int accountId);", "public java.lang.String getAccount_number() {\n return account_number;\n }", "public void setNumber(int number) {\r\n\t\tthis.number = number;\r\n\t}", "public void setCurrentUserAccount(String currentUserAccount);", "public static void setCurrentAccount(Account currentAccount) {\r\n\t\tAccount.currentAccount = currentAccount;\r\n\t}", "@Override\n protected void setBankNum(int bankNum) {\n }", "public void setNumber(int number)\n {\n this.number = number;\n }", "public void setNumber(int number) {\n this.number = number;\n }", "@Override\n public void setAccount(DataServices.Account account) {\n setTitle(R.string.account);\n getSupportFragmentManager().beginTransaction()\n .replace(R.id.containerView, AccountFragment.newInstance(account))\n .commit();\n\n }", "public void setBankAccountNumber(int bankAccountNumber) {\n this.bankAccountNumber = bankAccountNumber;\n }", "public void setNumber(int number)\n {\n Number = number;\n }", "public void setNumber(int number) {\n\t\tthis.number = number;\n\t}", "public void setNumber(int number) {\n\t\tthis.number = number;\n\t}" ]
[ "0.84377563", "0.82164717", "0.78231126", "0.7744408", "0.769918", "0.7607604", "0.74539864", "0.7384063", "0.72128004", "0.7178684", "0.7117843", "0.7097472", "0.70503455", "0.69957787", "0.6964519", "0.69273126", "0.66349494", "0.66342443", "0.6623039", "0.6616416", "0.6609283", "0.66090345", "0.6598437", "0.6571231", "0.6571231", "0.6566962", "0.6542512", "0.6536162", "0.6524967", "0.65164757", "0.65007573", "0.65007573", "0.65007573", "0.65007573", "0.6488207", "0.6488207", "0.6486759", "0.6482805", "0.64799285", "0.64431554", "0.6438968", "0.6438968", "0.6438968", "0.64330816", "0.64140236", "0.63914996", "0.6387561", "0.6341102", "0.63364786", "0.6309981", "0.63024616", "0.63011503", "0.63011503", "0.63006747", "0.62928224", "0.62888503", "0.6276796", "0.62739784", "0.6264961", "0.62229234", "0.6218891", "0.6214227", "0.6205077", "0.6205077", "0.6205077", "0.6205077", "0.6205077", "0.6203439", "0.6199313", "0.6167913", "0.6165103", "0.61580884", "0.6157302", "0.6126049", "0.612028", "0.61193705", "0.6115695", "0.610464", "0.60815215", "0.6075598", "0.6067153", "0.60620666", "0.6055455", "0.60361314", "0.6013643", "0.59980834", "0.5990906", "0.5985402", "0.5978277", "0.5960946", "0.5952906", "0.5950674", "0.59387153", "0.59376925", "0.5916091", "0.5909539", "0.59042346", "0.59021455", "0.58890736", "0.58890736" ]
0.86665803
0
Gets the name of the account owner
public String getName() { return name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getAccountOwner() {\n return accountOwner;\n }", "public String getOwnerName() {\r\n return this.ownerName;\r\n }", "public String getOwner() {\r\n if (mOwner==null) {\r\n return \"n/a\";\r\n }\r\n return mOwner;\r\n }", "public String getownerName() {\n\t return this.ownerName;\n\t}", "public String getOwnerName() {\n\n return ownerName;\n }", "public String getOwnerName() {\r\n\t\treturn ownerName;\r\n\t}", "public String getOwnerName() {\n\t\treturn ownerName;\n\t}", "java.lang.String getOwner();", "java.lang.String getOwner();", "public String getOwnerString() {\n return String.valueOf(enteredBy);\n }", "public String getOwnerAccountId() {\n return this.ownerAccountId;\n }", "public java.lang.String getOwnername() {\n\treturn ownername;\n}", "public AccountEntity getOwner() {\n\t\treturn owner;\n\t}", "String getOwner();", "String getOwner();", "public String ownerName() {\n\t\t\treturn null;\n\t\t}", "public String getOwner(){\n\t\treturn new SmartAPIModel().getCpOwner(cp.getLocalName());\n\t}", "public String getOwner(){\r\n \ttry{\r\n \t\t_lockObject.lock();\r\n \t\treturn _owner;\r\n \t}finally{\r\n \t\t_lockObject.unlock();\r\n \t}\r\n }", "User getOwner();", "public java.lang.String getOwner() {\n java.lang.Object ref = owner_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n owner_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getOwner() {\n java.lang.Object ref = owner_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n owner_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public String getOwner() {\r\n\t\treturn owner;\r\n\t}", "public String getOwner() {\n return owner;\n }", "public String getOwner() {\n return owner;\n }", "public String getOwner() {\n return owner;\n }", "public String getOwner() {\n return owner;\n }", "public String getOwner() {\n return owner;\n }", "public String getOwner() {\n return owner;\n }", "public String getOwner() {\r\n return owner;\r\n }", "public java.lang.String getOwnerId() {\r\n return ownerId;\r\n }", "public String getOwner() {\n return mOwner;\n }", "public String getOwner() {\n\n return Owner;\n }", "public com.google.protobuf.ByteString\n getOwnerBytes() {\n java.lang.Object ref = owner_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n owner_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public com.google.protobuf.ByteString\n getOwnerBytes() {\n java.lang.Object ref = owner_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n owner_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public String getOwner() {\n\n return owner;\n\n }", "public synchronized static String getOwner() {\n return owner;\n }", "public String getOwner();", "@Column(name=\"owner\")\n\tpublic String getOwner() {\n\t\treturn owner;\n\t}", "public String owner() {\n return this.owner;\n }", "@java.lang.Override\n public java.lang.String getOwner() {\n java.lang.Object ref = owner_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n owner_ = s;\n return s;\n }\n }", "@java.lang.Override\n public java.lang.String getOwner() {\n java.lang.Object ref = owner_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n owner_ = s;\n return s;\n }\n }", "com.google.protobuf.ByteString\n getOwnerBytes();", "com.google.protobuf.ByteString\n getOwnerBytes();", "@Override\n\tpublic UUID getOwnerId() {\n\t\treturn this.dataManager.get(OWNER_UUID).orNull();\n\t}", "public String getAccountHolderName() {\n return mAccountHolderName;\n }", "public User getOwner() {\n return owner;\n }", "public Account getOrganizationOwnerAccount() {\n return organizationOwnerAccount;\n }", "@java.lang.Override\n public com.google.protobuf.ByteString\n getOwnerBytes() {\n java.lang.Object ref = owner_;\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n owner_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "@java.lang.Override\n public com.google.protobuf.ByteString\n getOwnerBytes() {\n java.lang.Object ref = owner_;\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n owner_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public String getOrganizationOwnerAccountNumber() {\n return organizationOwnerAccountNumber;\n }", "public String getOwner() { return owner; }", "@Column (name=\"OWNER\", insertable = true, updatable = false)\r\n\tpublic String getOwner() {\r\n\t\treturn owner;\r\n\t}", "@Override\n\t\tpublic String ownerName() {\n\t\t\treturn \"Cat Owner\";\n\t\t}", "default String getOwnerId()\n {\n return Long.toUnsignedString(getOwnerIdLong());\n }", "@Override\n\t\tpublic String ownerName() {\n\t\t\treturn \"Tiger Owner\";\n\t\t}", "@objid (\"d7af9849-7951-4020-8339-9057fcec6b89\")\n Profile getOwnerProfile();", "public String getName() {\n return (String) getObject(\"username\");\n }", "public String getAccountName() {\r\n return accountName;\r\n }", "public String getAccountName() {\n return accountName;\n }", "public String getAccountName() {\n return accountName;\n }", "public String getAccountName() {\n return accountName;\n }", "com.google.protobuf.ByteString getOwner();", "com.google.protobuf.ByteString getOwner();", "public String getAccount() {\n\t\treturn getUsername() + \":\" + getPassword() + \"@\" + getUsername();\n\t}", "Optional<String> getOwner();", "public UUID getOwner() {\n return owner;\n }", "public UUID getOwner() {\n return owner;\n }", "public String getName() {\n return user.getName();\n }", "public String getAccountName() {\n return this.accountName;\n }", "public String getOwnerId() {\n return ownerId;\n }", "@Override\n public String getDeviceOwnerName() {\n if (!mHasFeature) {\n return null;\n }\n Preconditions.checkCallAuthorization(canManageUsers(getCallerIdentity())\n || hasCallingOrSelfPermission(permission.MANAGE_PROFILE_AND_DEVICE_OWNERS));\n\n synchronized (getLockObject()) {\n if (!mOwners.hasDeviceOwner()) {\n return null;\n }\n // TODO This totally ignores the name passed to setDeviceOwner (change for b/20679292)\n // Should setDeviceOwner/ProfileOwner still take a name?\n String deviceOwnerPackage = mOwners.getDeviceOwnerPackageName();\n return getApplicationLabel(deviceOwnerPackage, UserHandle.USER_SYSTEM);\n }\n }", "public com.hps.july.persistence.OrganizationAccessBean getOwner() {\n\treturn owner;\n}", "public String getOwner(){\n return owner;\r\n }", "public static String getUserDisplayName() {\r\n return getUsername();\r\n }", "@DISPID(33)\r\n\t// = 0x21. The runtime will prefer the VTID if present\r\n\t@VTID(38)\r\n\tjava.lang.String owner();", "public com.google.protobuf.ByteString getOwner() {\n return owner_;\n }", "public com.google.protobuf.ByteString getOwner() {\n return owner_;\n }", "@DISPID(75)\r\n\t// = 0x4b. The runtime will prefer the VTID if present\r\n\t@VTID(73)\r\n\tjava.lang.String owner();", "public long getOwner() {\n\t\treturn owner;\n\t}", "public static String getCurrentUserFullName() {\n DirectoryManager directoryManager = (DirectoryManager) appContext.getBean(\"directoryManager\");\n String username = getCurrentUsername();\n User user = directoryManager.getUserByUsername(username);\n if (user != null && user.getFirstName() != null && user.getFirstName().trim().length() > 0) {\n return user.getFirstName() + \" \" + user.getLastName();\n } else {\n return username;\n }\n }", "@Override\n\t\tpublic String ownerName() {\n\t\t\treturn \"Dog Owner\";\n\t\t}", "public com.google.protobuf.ByteString getOwner() {\n return owner_;\n }", "public com.google.protobuf.ByteString getOwner() {\n return owner_;\n }", "public int getOwner() {\n validify();\n return Client.INSTANCE.pieceGetOwner(ptr);\n }", "public final String getOwnerName() {\n return ElementUtils.getDeclaringClassName(node);\n }", "public String getName() {\n\t\tSharedPreferences settings = parentContext.getSharedPreferences(PREFERENCE_FILE,\n\t\t\t\tContext.MODE_PRIVATE);\n\t\treturn settings.getString(USERNAME_KEY, null);\n\t}", "public String getUserAccount() {\n return sessionData.getUserAccount();\n }", "public String getAccountNameNav() {\n\t\treturn keypad.AccountNameNavDrawer.getText();\n\t}", "public Long getOwnerUserId() {\n return ownerUserId;\n }", "public java.lang.String getGroupOwnerName() {\n return groupOwnerName;\n }", "public String getOwner() {\n return lockOwner;\n }", "public String getName() {\r\n\t\treturn username;\r\n\t}", "public String toString() {\n return (\"Principal's username: \" + name);\n }", "public Organisation getOwner() {\n for (final DeviceAuthorization authorization : this.authorizations) {\n if (authorization.getFunctionGroup().equals(DeviceFunctionGroup.OWNER)) {\n return authorization.getOrganisation();\n }\n }\n\n return null;\n }", "public Player getOwner() {\n\t\tif (owner == null && possibleOwners.size() == 1)\n\t\t\towner = possibleOwners.get(0);\n\t\t\n\t\treturn owner;\n\t}", "@Override\r\n\tpublic Principal getOwner() {\n\t\treturn null;\r\n\t}", "public String getName() {\n\t\treturn this.username;\n\t}", "@Override\n public CharSequence getDeviceOwnerOrganizationName() {\n if (!mHasFeature) {\n return null;\n }\n final CallerIdentity caller = getCallerIdentity();\n Preconditions.checkCallAuthorization(isDefaultDeviceOwner(caller)\n || canManageUsers(caller) || isFinancedDeviceOwner(caller));\n synchronized (getLockObject()) {\n final ActiveAdmin deviceOwnerAdmin = getDeviceOwnerAdminLocked();\n return deviceOwnerAdmin == null ? null : deviceOwnerAdmin.organizationName;\n }\n }", "public String getOwnerUsername(long shareableSchemaID)\n\t{\n\t\tString ownerUsername = null;\n\t\t\n\t\t//Connecting to data base\n \t\tconnect();\n \t\t\n\t\tif (dbConnection == null)\t\t\t\t\t\t\t//failed connection\n \t\t{\n \t\t\treturn null;\n \t\t}\n \t\t\n \t\t//Proceeding, if database connection is successful\n \t\tResultSet rsOwnerUser = null; \t\t\n \t\ttry\n \t\t{\n \t\t\t//Fetching owner username of shareable schema from the user schema database\n \t\t\tString ownerQuery = \"SELECT owner_username FROM shareable_schema WHERE schema_id = ? ;\";\n \t\t\tPreparedStatement prepStmt = dbConnection.prepareStatement(ownerQuery);\n \t\t\tprepStmt.setLong(1, shareableSchemaID);\n \t\t\t\n \t\t\trsOwnerUser = prepStmt.executeQuery();\n \t\t\tif (rsOwnerUser.next())\n \t\t\t\townerUsername = rsOwnerUser.getString(1);\n \t\t\t\n \t\t\trsOwnerUser.close();\n \t\t\tprepStmt.close();\n \t\t}\n \t\tcatch (SQLException sqle)\n \t\t{\n \t\t\trsOwnerUser = null;\n \t\t\tlog.error(\"SQLException occurred while fetching owner username from user schema database... \" + sqle.getMessage());\n \t\t}\n \t\tfinally\n \t\t{\n \t\t\tdisconnect();\n \t\t}\n \t\t \t\t\n \t\treturn ownerUsername;\n\t}", "java.lang.String getAccount();", "public String getUserName() {\n return order.getUser().getUsername();\n }" ]
[ "0.8232877", "0.78484315", "0.78019935", "0.7777841", "0.77505475", "0.7714646", "0.7687522", "0.7682898", "0.7682898", "0.7514326", "0.74563354", "0.7412126", "0.74093074", "0.7362259", "0.7362259", "0.7360789", "0.7336235", "0.7257684", "0.7252834", "0.7209076", "0.72086775", "0.71926045", "0.717088", "0.717088", "0.717088", "0.717088", "0.717088", "0.717088", "0.7148099", "0.7112168", "0.71003073", "0.7089254", "0.7075703", "0.7075703", "0.70666504", "0.70588243", "0.7038448", "0.7032618", "0.7024488", "0.69826585", "0.69824284", "0.691871", "0.6916967", "0.6907803", "0.6880835", "0.687804", "0.6877877", "0.68605137", "0.68605137", "0.685357", "0.68506825", "0.6839064", "0.68254447", "0.68217885", "0.68206984", "0.6808774", "0.6798005", "0.67931724", "0.6784782", "0.6784782", "0.6784782", "0.676747", "0.676747", "0.67420846", "0.67348796", "0.67314535", "0.67314535", "0.6727947", "0.6710445", "0.67094517", "0.6701205", "0.66826665", "0.66824204", "0.6671878", "0.6666321", "0.6664092", "0.6664092", "0.6643052", "0.6638863", "0.6636", "0.66317135", "0.66225433", "0.66225433", "0.6611115", "0.66089785", "0.66071177", "0.6602783", "0.6602324", "0.6596803", "0.65628636", "0.656148", "0.65454", "0.6542174", "0.65195036", "0.65134454", "0.65030295", "0.6501277", "0.6479871", "0.6477836", "0.6475107", "0.6466346" ]
0.0
-1
An overridden toString method for debugging and display purposes.
@Override public String toString() { return "accountNumber=" + accountNumber + ", name='" + name + '\'' + ", balance=" + balance + ", pendingBalance=" + pendingBalance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override String toString();", "@Override public String toString();", "@Override\r\n String toString();", "@Override\r\n\tpublic String toString();", "@Override\n String toString();", "@Override\n String toString();", "@Override\r\n public String toString();", "@Override\r\n\t\tpublic String toString() {\n\t\t\treturn super.toString();\r\n\t\t}", "@Override\n\tString toString();", "@Override\n\tpublic String toString();", "@Override\n\t\tpublic String toString() {\n\t\t\treturn super.toString();\n\t\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn super.toString();\r\n\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn super.toString();\r\n\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn super.toString();\r\n\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn super.toString();\r\n\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn super.toString();\r\n\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn super.toString();\r\n\t}", "@Override\n public String toString();", "@Override\n public String toString();", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn super.toString();\n\t}", "@Override\r\n public String toString() {\n return super.toString();\r\n }", "@Override\n String toString();", "@Override\r\n public String toString() {\r\n return super.toString();\r\n }", "@Override\r\n public String toString() {\r\n return super.toString();\r\n }", "@Override\r\n public String toString() {\n return super.toString();\r\n }", "@Override\n public final String toString() {\n return asString(0, 4);\n }", "@Override\n\tpublic abstract String toString();", "@Override\n\tpublic String toString() {\n\t\treturn toText();\n\t}", "public String toString() {\r\n\t\t\r\n\t\treturn super.toString();\r\n\t\t\r\n\t}", "public String toString() {\t\t\t\t\t\r\n\t\treturn super.toString();\r\n\t}", "public String toString() {\n \t\treturn super.toString();\n \t}", "@Override\n public String toString() {\n return toString(false, true, true, null);\n }", "@Override\n public abstract String toString();", "@Override\n public abstract String toString();", "@Override\n public abstract String toString();", "@Override\n public abstract String toString();", "@Override\n public abstract String toString();", "@Override\n public abstract String toString();", "@Override\n public abstract String toString();", "@Override\n public String toString() {\n return super.toString();\n }", "@Override\n public String toString() {\n return super.toString();\n }", "@Override\n public String toString() {\n return super.toString();\n }", "@Override\n public String toString() {\n return super.toString();\n }", "@Override\n\tpublic abstract String toString ();", "public String toString() ;", "@Override\n public synchronized String toString() {\n return super.toString();\n }", "@Override\n\tpublic String toString() {\n\t\treturn toStringBuilder(new StringBuilder()).toString();\n\t}", "@Override\n\tpublic String toString(){\n\n\t}", "@Override\n public String toString() {\n // TODO: Using Serializer\n return Serializer.toByteArray(this).toString();\n }", "@Override\n public String toString () {\n return super.toString();\n }", "public String toString() {\n\t\treturn super.toString();\n\t}", "public String toString() {\n\t\treturn super.toString();\n\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn \"\";\r\n\t}", "@Override\n public String toString()\n {\n return this.toLsString();\n }", "@Override()\n public String toString()\n {\n final StringBuilder buffer = new StringBuilder();\n toString(buffer);\n return buffer.toString();\n }", "public String toString() {\n\t}", "@Override\n public String toString() {\n return new Gson().toJson(this);\n }", "@Override\n\tpublic String toString() {\n\t\treturn \"\";\n\t}", "public String toString() { return stringify(this, true); }", "@Override\n public String toString() {\n return (super.toString());\n\n }", "public String toString() {\n return super.toString();\n }", "@Override\n public abstract String toString();", "public String toString() {\n return toDisplayString();\n }", "@Override\n public String toString(){\n return toString(false);\n }", "@Override\n public String toString() {\n String str = \"\";\n\n //TODO: Complete Method\n\n return str;\n }", "@Override\r\n\tpublic String toString() {\n\t\tString str = \"\";\r\n\t\treturn str;\r\n\t}", "public String toString(){\r\n\t\tString output=\"\";\r\n\t\toutput+=super.toString();\r\n\t\treturn output;\r\n\t}", "@Override\n public String toString()\n {\n return Arrays.toString(this.toArray());\n }", "public String toString() {\n\t\treturn toString(this);\n\t}", "@Override\n public String toString() {\n return value();\n }", "public String toString() {\n\t\treturn super.toString();\n\t\t// This gives stack overflows:\n\t\t// return ToStringBuilder.reflectionToString(this);\n\t}", "public String toString()\n\t{\n\t\treturn Printer.stringify(this, false);\n\t}", "public String toString()\n {\n return super.toString();\n }", "public String toString()\n {\n return super.toString();\n }", "@Override\npublic String toString() {\n\treturn super.toString();\n}", "@Override\n public String toString() {\n return super.toString(); //To change body of generated methods, choose Tools | Templates.\n }", "@Override\n public String toString() {\n return new JSONSerializer().serialize(this);\n }", "@Override\n public String toString() {\n return (this.str);\n }", "@Override\n public String toString() {\n return string;\n }", "@Override\n \tpublic String toString() {\n \t\treturn toStringHelper(1, \"\");\n \t}", "@Override\n public String toString() {\n return info();\n }", "public String toString() { return \"\"; }", "public String toString() { return \"\"; }" ]
[ "0.90583146", "0.90140206", "0.8998247", "0.89026994", "0.8898972", "0.8898972", "0.88565075", "0.88130075", "0.8792282", "0.8790001", "0.87568897", "0.87312573", "0.87312573", "0.87312573", "0.87312573", "0.87312573", "0.87312573", "0.86940116", "0.86940116", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.8689376", "0.86396676", "0.86364114", "0.86166483", "0.86166483", "0.86061937", "0.86004174", "0.85794115", "0.85772824", "0.85680926", "0.8557306", "0.8554744", "0.8535933", "0.8522924", "0.8522924", "0.8522924", "0.8522924", "0.8522924", "0.8522924", "0.8522924", "0.8515992", "0.8515992", "0.8515992", "0.8515992", "0.8494088", "0.8480552", "0.84714246", "0.84641904", "0.84437096", "0.8438456", "0.8425026", "0.84181726", "0.84181726", "0.8402819", "0.8386284", "0.83654726", "0.8344549", "0.8338255", "0.8334735", "0.8333476", "0.8328609", "0.832571", "0.8293607", "0.825713", "0.8252033", "0.8249017", "0.82450634", "0.82330614", "0.8208551", "0.82037944", "0.82030123", "0.81960016", "0.818287", "0.81822073", "0.81822073", "0.8149642", "0.8123813", "0.810956", "0.81029063", "0.81001973", "0.8095275", "0.80921084", "0.80647904", "0.80647904" ]
0.0
-1
TODO: Warning this method won't work in the case the id fields are not set
@Override public boolean equals(Object object) { if (!(object instanceof GrlesschildP)) { return false; } GrlesschildP other = (GrlesschildP) object; if ((this.grlesschildpId == null && other.grlesschildpId != null) || (this.grlesschildpId != null && !this.grlesschildpId.equals(other.grlesschildpId))) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setId(Integer id) { this.id = id; }", "private Integer getId() { return this.id; }", "public void setId(int id){ this.id = id; }", "public void setId(Long id) {this.id = id;}", "public void setId(Long id) {this.id = id;}", "public void setID(String idIn) {this.id = idIn;}", "public void setId(int id) { this.id = id; }", "public void setId(int id) { this.id = id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public void setId(long id) { this.id = id; }", "public void setId(long id) { this.id = id; }", "public int getId(){ return id; }", "public int getId() {return id;}", "public int getId() {return Id;}", "public int getId(){return id;}", "public void setId(long id) {\n id_ = id;\n }", "private int getId() {\r\n\t\treturn id;\r\n\t}", "public Integer getId(){return id;}", "public int id() {return id;}", "public long getId(){return this.id;}", "public int getId(){\r\n return this.id;\r\n }", "@Override public String getID() { return id;}", "public Long id() { return this.id; }", "public Integer getId() { return id; }", "@Override\n\tpublic Integer getId() {\n return id;\n }", "@Override\n public Long getId () {\n return id;\n }", "@Override\n public long getId() {\n return id;\n }", "public Long getId() {return id;}", "public Long getId() {return id;}", "public String getId(){return id;}", "@Override\r\n\tpublic Long getId() {\n\t\treturn null;\r\n\t}", "public Integer getId() { return this.id; }", "@Override\r\n public int getId() {\n return id;\r\n }", "@Override\n\t\tpublic long getId() {\n\t\t\treturn 0;\n\t\t}", "public int getId() {\n return id;\n }", "public long getId() { return _id; }", "public int getId() {\n/* 35 */ return this.id;\n/* */ }", "public long getId() { return id; }", "public long getId() { return id; }", "public void setId(Long id) \n {\n this.id = id;\n }", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "public void setId(String id) {\n this.id = id;\n }", "@Override\n\tpublic void setId(Long id) {\n\t}", "public Long getId() {\n return id;\n }", "public long getId() { return this.id; }", "public int getId()\n {\n return id;\n }", "public void setId(int id){\r\n this.id = id;\r\n }", "protected abstract String getId();", "@Test\r\n\tpublic void testSetId() {\r\n\t\tbreaku1.setId(5);\r\n\t\texternu1.setId(6);\r\n\t\tmeetingu1.setId(7);\r\n\t\tteachu1.setId(8);\r\n\r\n\t\tassertEquals(5, breaku1.getId());\r\n\t\tassertEquals(6, externu1.getId());\r\n\t\tassertEquals(7, meetingu1.getId());\r\n\t\tassertEquals(8, teachu1.getId());\r\n\t}", "@Override\n\tpublic int getId(){\n\t\treturn id;\n\t}", "public int getID() {return id;}", "public int getID() {return id;}", "public String getId() { return id; }", "public String getId() { return id; }", "public String getId() { return id; }", "@Override\n public int getField(int id) {\n return 0;\n }", "public int getId ()\r\n {\r\n return id;\r\n }", "public void setId(Long id)\n/* */ {\n/* 66 */ this.id = id;\n/* */ }", "public int getId(){\r\n return localId;\r\n }", "void setId(int id) {\n this.id = id;\n }", "@Override\n public Integer getId() {\n return id;\n }", "@Override\n\tpublic Object selectById(Object id) {\n\t\treturn null;\n\t}", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "@Override\n public int getId() {\n return id;\n }", "@Override\n public int getId() {\n return id;\n }", "public void setId(int id)\n {\n this.id=id;\n }", "@Override\r\n public int getID()\r\n {\r\n\treturn id;\r\n }", "@Override\n\tpublic Integer getId() {\n\t\treturn null;\n\t}", "public int getId()\r\n {\r\n return id;\r\n }", "public void setId(Long id){\n this.id = id;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "final protected int getId() {\n\t\treturn id;\n\t}", "private void clearId() {\n \n id_ = 0;\n }", "public abstract Long getId();", "public void setId(Long id) \r\n {\r\n this.id = id;\r\n }", "@Override\n public long getId() {\n return this.id;\n }", "public String getId(){ return id.get(); }", "public void setId(long id){\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "@SuppressWarnings ( \"unused\" )\n private void setId ( final Long id ) {\n this.id = id;\n }", "public void setId(Integer id)\r\n/* */ {\r\n/* 122 */ this.id = id;\r\n/* */ }", "public Long getId() \n {\n return id;\n }", "@Override\n\tpublic void setId(int id) {\n\n\t}", "public void test_getId() {\n assertEquals(\"'id' value should be properly retrieved.\", id, instance.getId());\n }", "@Override\r\n\tpublic Object getId() {\n\t\treturn null;\r\n\t}", "public int getID(){\n return id;\n }", "public int getId()\n {\n return id;\n }", "public String getID(){\n return Id;\n }" ]
[ "0.6893787", "0.68366045", "0.67026585", "0.66388494", "0.66388494", "0.6589572", "0.65758747", "0.65758747", "0.6572052", "0.6572052", "0.6572052", "0.6572052", "0.6572052", "0.6572052", "0.6559372", "0.6559372", "0.65421206", "0.65220076", "0.65133774", "0.64854103", "0.64749634", "0.64241725", "0.64168566", "0.64142627", "0.6399827", "0.63643193", "0.6352449", "0.63488746", "0.6345266", "0.6321806", "0.63165253", "0.62988985", "0.6291085", "0.6291085", "0.62805444", "0.62686265", "0.6264033", "0.62625295", "0.62595963", "0.6256943", "0.62536603", "0.6249114", "0.6245025", "0.6245025", "0.6242035", "0.62364405", "0.62364405", "0.62288916", "0.62212294", "0.62180007", "0.62172735", "0.62092906", "0.6206283", "0.6199069", "0.61987513", "0.6189847", "0.61871225", "0.61871225", "0.6186348", "0.6186348", "0.6186348", "0.6182737", "0.61816216", "0.6173104", "0.6171653", "0.61645716", "0.61633086", "0.61591727", "0.61544365", "0.61544365", "0.61544365", "0.61544365", "0.61544365", "0.61544365", "0.61544365", "0.61528987", "0.61528987", "0.61394805", "0.613151", "0.61258125", "0.612514", "0.6102972", "0.6101492", "0.6101492", "0.61005366", "0.6100385", "0.61003613", "0.60977095", "0.60967696", "0.6092432", "0.6090152", "0.6090152", "0.6090105", "0.60887915", "0.608704", "0.6073338", "0.60700667", "0.60683453", "0.6068084", "0.6067373", "0.6066998" ]
0.0
-1
/ String sql = "SELECT dateDiffWorkingDays(:dateFrom, :dateTo)"; Query query = entityManager.createNativeQuery(sql); query.setParameter("dateFrom", dateFrom); query.setParameter("dateTo", dateTo); return (Integer)Utils.first(query.getResultList()); /
@SuppressWarnings("unchecked") @Override public Integer getDateDiffWorkingDays(Date dateFrom, Date dateTo) { String sql = dateFrom.after(dateTo) ? "select count(*) * -1 from calendar where id_date >= :dateTo and id_date < :dateFrom and holiday = 0" : "select count(*) from calendar where id_date > :dateFrom and id_date <= :dateTo and holiday = 0"; Query query = entityManager.createNativeQuery(sql); query.setParameter("dateFrom", dateFrom); query.setParameter("dateTo", dateTo); return Utils.isNull(Utils.first(query.getResultList()), (Integer) null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public long days(Date date2) {\n\t\tlong getDaysDiff =0;\n\t\t DateFormat simpleDateFormat = new SimpleDateFormat(\"dd-MM-yyyy\");\n\n\t\t Date currentDate = new Date();\n\t\t Date date1 = null;\n\t\t Date date3 = null;\n\n\t\t\n\n\t\t try {\n\t\t String startDate = simpleDateFormat.format(date2);\n\t\t String endDate = simpleDateFormat.format(currentDate);\n\n\t\t date1 = simpleDateFormat.parse(startDate);\n\t\t date3 = simpleDateFormat.parse(endDate);\n\n\t\t long getDiff = date3.getTime() - date1.getTime();\n\n\t\t getDaysDiff = getDiff / (24 * 60 * 60 * 1000);\n\t\t \n\t\t \n\t\t \n\t\t } catch (Exception e) {\n\t\t e.printStackTrace();\n\t\t }\n\t\t return getDaysDiff;\n\n}", "@Test\n @ExcludeIn({ DB2, HSQLDB, SQLITE, TERADATA })\n public void date_diff2() {\n SQLQuery<?> query = query().from(Constants.employee).orderBy(Constants.employee.id.asc());\n LocalDate localDate = new LocalDate(1970, 1, 10);\n java.sql.Date date = new java.sql.Date(localDate.toDateMidnight().getMillis());\n int years = query.select(SQLExpressions.datediff(year, date, Constants.employee.datefield)).fetchFirst();\n int months = query.select(SQLExpressions.datediff(month, date, Constants.employee.datefield)).fetchFirst();\n // weeks\n int days = query.select(SQLExpressions.datediff(day, date, Constants.employee.datefield)).fetchFirst();\n int hours = query.select(SQLExpressions.datediff(hour, date, Constants.employee.datefield)).fetchFirst();\n int minutes = query.select(SQLExpressions.datediff(minute, date, Constants.employee.datefield)).fetchFirst();\n int seconds = query.select(SQLExpressions.datediff(second, date, Constants.employee.datefield)).fetchFirst();\n Assert.assertEquals(949363200, seconds);\n Assert.assertEquals(15822720, minutes);\n Assert.assertEquals(263712, hours);\n Assert.assertEquals(10988, days);\n Assert.assertEquals(361, months);\n Assert.assertEquals(30, years);\n }", "private long getDaysBetween(LocalDateTime d1, LocalDateTime d2) {\n return d1.until(d2,DAYS);\n }", "public static long getDiffDays(Date date1,Date date2) {\n Calendar calendar1= Calendar.getInstance();\n Calendar calendar2 = Calendar.getInstance();\n\n calendar1.setTime(date1);\n calendar2.setTime(date2);\n\n long msDiff = calendar1.getTimeInMillis()-calendar2.getTimeInMillis();\n long daysDiff = TimeUnit.MILLISECONDS.toDays(msDiff);\n Log.e(\"Amarneh\",\"diffDays>>\"+daysDiff);\n return daysDiff;\n }", "@Query(value =\"select teaching_hours_left from teacher_hours where user_id = :teacherId \", nativeQuery = true)\n int getHoursLeft(@Param(\"teacherId\") Integer teacherId);", "public long dayDiffCalculator(String a, String b){\n\n long dateDiff = 0;\n\n Date d1 = null;\n Date d2 = null;\n\n try{\n d1 = sdf.parse(a);\n d2 = sdf.parse(b);\n\n long diff = d2.getTime() - d1.getTime();\n\n long diffSeconds = diff / 1000 % 60;\n long diffMinutes = diff / (60 * 1000) % 60;\n long diffHours = diff / (60 * 60 * 1000) % 24;\n long diffDays = diff / (24 * 60 * 60 * 1000);\n\n dateDiff = diffDays;\n\n } catch (Exception e){}\n\n return dateDiff;\n }", "private long dateDiffInNumberOfDays(LocalDate startDate, LocalDate endDate) {\n\n return ChronoUnit.DAYS.between(startDate, endDate);\n }", "private int getDifferenceDays(Date d1, Date d2) {\n int daysdiff = 0;\n long diff = d2.getTime() - d1.getTime();\n long diffDays = diff / (24 * 60 * 60 * 1000) + 1;\n daysdiff = (int) diffDays;\n return daysdiff;\n }", "@Query(value =\"select teaching_hours_used from teacher_hours where user_id = :teacherId \", nativeQuery = true)\n int getHoursUsed(@Param(\"teacherId\") Integer teacherId);", "@Query(value=\"SELECT round(sum( vendasDia.qtd)/:daysProductExistence ) \"\r\n\t\t\t+ \"\t FROM ( \"\r\n\t\t\t+ \"\t\t\t SELECT count(i.ID_ITEM_VENDA ) as qtd \"\r\n\t\t\t+ \"\t\t\t FROM ITEM_VENDA as i \"\r\n\t\t\t+ \"\t\t\t\t join VENDA as v on i.ID_VENDA = v.ID_VENDA \"\r\n\t\t\t+ \"\t\t\t WHERE i.ID_PRODUTO = :productId \"\r\n\t\t\t+ \"\t\t ) as vendasDia \", nativeQuery = true)\t\r\n\tLong findSalesPerDaysExistenceProduct(@Param(\"productId\") Long idProduto, @Param(\"daysProductExistence\") Integer dias);", "private long getWorkingDayOfEmployeeByStartDateAndEndDate(final Date startDate, final Date endDate,\n final int emp_code) {\n Long result = this.dailyRepo.getWorkingDaysOfEmployeeByStartDateAndEndDate(emp_code, startDate, endDate)\n .getAnyResult();\n return (null != result) ? result : 0;\n }", "public Long getFailuresByDate(Long imsi, Date startDate, Date endDate) {\n\t\tQuery query = em.createQuery(\"select count (c) from BaseData c where c.imsi = :imsi AND c.date_time >= :sDate AND c.date_time <= :eDate\");\n\t\tquery.setParameter(\"imsi\", imsi);\n\t\tquery.setParameter(\"sDate\",startDate);\n\t\tquery.setParameter(\"eDate\", endDate);\n\t\tSystem.out.println(\"DAO\");\n\t\treturn (Long)query.getSingleResult();\n\t}", "public static int getNoOfDaysBetweenDates(Date fromDate, Date toDate) {\n\t\tint noOfDays = 0;\n\t\tif(fromDate.compareTo(toDate)>0){\n\t\tnoOfDays = fromDate.subtract(toDate);\n\t\tnoOfDays = -(noOfDays + 1);\n\t\t}else if(fromDate.compareTo(toDate)==0){\n\t\t\tnoOfDays = fromDate.subtract(toDate);\n\t\t\tnoOfDays = noOfDays + 1;\n\t\t}else{\n\t\t\tnoOfDays = toDate.subtract(fromDate);\n\t\t\tnoOfDays = noOfDays + 1;\n\t\t}\n\t\treturn noOfDays;\n\t}", "@Override\r\n\tpublic int getDayCount(Date date) {\n\t\tString hql = \"select cc.count from cinema_condition cc where cc.date = ?\";\r\n\t\tQuery query = this.getCurrentSession().createQuery(hql);\r\n\t\tquery.setParameter(0, date);\r\n\t\tif(query.uniqueResult()==null){\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tint resutl = (Integer) query.uniqueResult();\r\n\t\treturn resutl;\r\n\t}", "@Repository\npublic interface CounterRepository extends JpaRepository<Counter, Long>, JpaSpecificationExecutor<Counter> {\n\n\t@Query(value = \"SELECT \"\n\t \t\t+ \" new com.zenhomes.counter.service.dto.CounterDto(-1L, SUM(amount), counterId)\"\n\t \t\t+ \" FROM Counter \"\n\t \t\t+ \" WHERE createdAt >= :from \"\n\t \t\t+ \" AND createdAt <= :to \"\n\t \t\t+ \" GROUP BY counterId\"\n\t \t\t, nativeQuery = false)\n\t List<CounterDto> getConsumptionReport(@Param(\"from\") Instant from, @Param(\"to\") Instant to);\n\t \n}", "public int getDifference(DaysBetween dt1, DaysBetween dt2)\n {\n // COUNT TOTAL NUMBER OF DAYS BEFORE FIRST DATE 'dt1'\n \n // initialize count using years and day\n int n1 = dt1.y * 365 + dt1.d;\n \n // Add days for months in given date\n for (int i = 0; i < dt1.m - 1; i++) \n {\n n1 += monthDays[i];\n }\n \n // Since every leap year is of 366 days,\n // Add a day for every leap year\n n1 += countLeapYears(dt1);\n \n // SIMILARLY, COUNT TOTAL NUMBER OF DAYS BEFORE 'dt2'\n int n2 = dt2.y * 365 + dt2.d;\n for (int i = 0; i < dt2.m - 1; i++)\n {\n n2 += monthDays[i];\n }\n n2 += countLeapYears(dt2);\n \n // return difference between two counts\n return (n2 - n1);\n }", "public static int diff(Date date1, Date date2) {\n Calendar c1 = Calendar.getInstance();\n Calendar c2 = Calendar.getInstance();\n\n c1.setTime(date1);\n c2.setTime(date2);\n int diffDay = 0;\n\n if (c1.before(c2)) {\n diffDay = countDiffDay(c1, c2);\n } else {\n diffDay = countDiffDay(c2, c1);\n }\n\n return diffDay;\n }", "@RequiresApi(api = Build.VERSION_CODES.O)\n public int daysBetweenDates(LocalDate date1, LocalDate date2) {\n Period period = Period.between(date1, date2);\n int diff = period.getDays();\n return diff;\n }", "public long difference() {\n long differenceBetweenDate = ChronoUnit.DAYS.between(startDate.toInstant(), endDate.toInstant());\n\n return differenceBetweenDate;\n\n }", "@Override\r\n\tpublic int getCount(Date dateStart, Date dateEnd) {\n\t\tString hql = \"select sum(cc.count) from cinema_condition cc where cc.date >= ? and cc.date <= ?\";\r\n\t\tQuery query = this.getCurrentSession().createQuery(hql);\r\n\t\tquery.setParameter(0, dateStart);\r\n\t\tquery.setParameter(1, dateEnd);\r\n\t\tif(query.uniqueResult()==null){\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tint result = ((Long) query.uniqueResult()).intValue();\r\n\t\treturn result;\r\n\t}", "int getNumberDays();", "@Query(value = \"SELECT DATE(created_on),value FROM lost_products WHERE created_on >= ? AND created_on<= ?\", nativeQuery = true)\n List<Object[]> getLostsBetweenDates(LocalDate startDate, LocalDate endDate);", "@Transactional(readOnly = true)\n\t@Query(value = \"SELECT s FROM StockPrice s where stockCd=:stockCd and curTime in (select lastDay from BFWeekDay bfw where date(lastDay) between :fromDate and :toDate) order by s.curTime\")\n\tpublic List<StockPrice> findWeekByStockCd(@Param(\"stockCd\") String stockCd, @Param(\"fromDate\") Date fromDate,\n\t\t\t@Param(\"toDate\") Date toDate);", "private long daysBetween() throws ParseException {\n Scanner input = new Scanner(System.in);\n System.out.println(\"Enter the date of when you rented the game dd/MM/yyyy:\");\n String dateReturn = input.nextLine();\n Date date = new SimpleDateFormat(\"dd/MM/yyyy\").parse(dateReturn);\n long interval = new Date().getTime() - date.getTime();\n return TimeUnit.DAYS.convert(interval, TimeUnit.MILLISECONDS);\n }", "public int getLBR_ProtestDays();", "public void calculateVacationDays(){\n }", "private static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) {\n long diffInMillies = date2.getTime() - date1.getTime();\n return timeUnit.convert(diffInMillies, TimeUnit.MILLISECONDS);\n }", "public double getIncome(LocalDate from, LocalDate to) throws SQLException {\n\t\ttry (PreparedStatement statement = conn.prepareStatement(\"select sum(Amount) from transaction where date between ? and ? and type=\\\"Income\\\"\")) {\n\t\t\tstatement.setDate(1, Date.valueOf(from));\n\t\t\tstatement.setDate(2, Date.valueOf(to));\n\t\t\ttry (ResultSet resultSet = statement.executeQuery()) {\n\t\t\t\tif (resultSet.next()) {\n\t\t\t\t\treturn resultSet.getDouble(1);\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}", "public Integer getTotalDays()\r\n/* 68: */ {\r\n/* 69:67 */ return this.totalDays;\r\n/* 70: */ }", "@Query(\"select dailyReservation from DailyReservation dailyReservation where dailyReservation.date between :startDate and :endDate\")\n List<DailyReservation> findAllDailyReservation(@Param(\"startDate\") LocalDate startDate, @Param(\"endDate\") LocalDate endDate );", "@Transactional(readOnly = true)\n\t@Query(value = \"select avg(price) as price, date_format(curTime,'%Y-%m-%d') as cur_date from StockPrice sp \"\n\t\t\t+ \"where curTime in (select lastDay from BFWeekDay bfw where date(lastDay) between :fromDate and :toDate) and \"\n\t\t\t+ \"stockCd in (select stockCd from Stock s where sectorCd=:sectorCd) group by curTime order by curTime\")\n\tpublic List<Object[]> findWeekBySectorCd(@Param(\"sectorCd\") String sectorCd, @Param(\"fromDate\") Date fromDate,\n\t\t\t@Param(\"toDate\") Date toDate);", "@Query(value = \"SELECT sum(total_lkr) FROM receipt WHERE rec_date BETWEEN :Date1 and :Date2\", nativeQuery = true)\n\tBigDecimal TotalrevanuelastYear(@Param(\"Date1\") LocalDate Date1, @Param(\"Date2\") LocalDate Date2);", "@Query(\"SELECT id, measured_at FROM measurements WHERE measured_at >= :startDate AND measured_at < :endDate\")\n @TypeConverters({DateConverter.class})\n List<MeasurementEvent> findForPeriodTest(Date startDate, Date endDate);", "public static void dateDifference(){\r\n\t\t\r\n\t\tLocalDate firstDate = LocalDate.of(2013, 3, 20);\r\n\t\tLocalDate secondDate = LocalDate.of(2015, 8, 12);\r\n\t\t\r\n\t\tPeriod diff = Period.between(firstDate, secondDate);\r\n\t\tSystem.out.println(\"The Difference is ::\"+diff.getDays());\r\n\t}", "public int getLBR_CollectionReturnDays();", "public static int getDaysFromNow(Date date) throws Exception{\n\n if(date != null) {\n Days daysbetween = Days.daysBetween(new DateTime(date.getTime()), new DateTime().now());\n return daysbetween.getDays();\n }\n else\n throw new Exception();\n }", "public static long daysTillNow(Date from) { \n \tDateFormat df = new SimpleDateFormat(\"dd/MM/yyyy\");\n \tDateTimeFormatter formatter = DateTimeFormatter.ofPattern(\"dd/MM/yyyy\");\n \tLocalDate dateBefore = LocalDate.parse(df.format(from), formatter);\n \treturn ChronoUnit.DAYS.between( dateBefore , LocalDate.now()); \t\n }", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface DailyReservationRepository extends JpaRepository<DailyReservation, Long> {\n\n @Query(\"select dailyReservation from DailyReservation dailyReservation where dailyReservation.user.login = ?#{principal.username}\")\n List<DailyReservation> findByUserIsCurrentUser();\n\n List<DailyReservation> findAllByDateIsBetween(LocalDate startDate, LocalDate endDate);\n // findAllByDateGreaterThanEqualStartDateAndDateLessThanEqualEndDate(LocalDate startDate, LocalDate endDate);\n //findAllByStartDateGreaterThanEqualAndEndDateLessThanEqual\n\n @Query(\"select dailyReservation from DailyReservation dailyReservation where dailyReservation.date between :startDate and :endDate\")\n List<DailyReservation> findAllDailyReservation(@Param(\"startDate\") LocalDate startDate, @Param(\"endDate\") LocalDate endDate );\n\n}", "private int getDays() {\n\t\tlong arrival = arrivalDate.toEpochDay();\n\t\tlong departure = departureDate.toEpochDay();\n\t\tint days = (int) Math.abs(arrival - departure);\n\n\t\treturn days;\n\t}", "public static long getDateDiff(java.util.Date date1, java.util.Date date2, TimeUnit timeUnit) {\n\t long diffInMillies = date2.getTime() - date1.getTime();\n\t return timeUnit.convert(diffInMillies, timeUnit);\n\t}", "public static long getDateDiffer(Calendar cal1, Calendar cal2){\n long millis1 = cal1.getTimeInMillis();\n long millis2 = cal2.getTimeInMillis();\n\n // Calculate difference in milliseconds\n long diff = millis2 - millis1;\n\n // Calculate difference in seconds\n long diffSeconds = diff / 1000;\n\n // Calculate difference in minutes\n long diffMinutes = diff / (60 * 1000);\n\n // Calculate difference in hours\n long diffHours = diff / (60 * 60 * 1000);\n\n // Calculate difference in days\n long diffDays = diff / (24 * 60 * 60 * 1000);\n\n System.out.println(\"In milliseconds: \" + diff + \" milliseconds.\");\n System.out.println(\"In seconds: \" + diffSeconds + \" seconds.\");\n System.out.println(\"In minutes: \" + diffMinutes + \" minutes.\");\n System.out.println(\"In hours: \" + diffHours + \" hours.\");\n System.out.println(\"In days: \" + diffDays + \" days.\");\n\n return diffDays;\n }", "Integer getDaysSpanned();", "public static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) {\n\t\t long diffInMillies = date2.getTime() - date1.getTime();\n\t\t return timeUnit.convert(diffInMillies,TimeUnit.MILLISECONDS);\n\t\t}", "public static int CalcularDiferenciaDiasFechas(Date fecha1, Date fecha2){\n Calendar cal1 = Calendar.getInstance();\r\n Calendar cal2 = Calendar.getInstance();\r\n cal1.setTime(fecha1);\r\n cal2.setTime(fecha2);\r\n // conseguir la representacion de la fecha en milisegundos\r\n long milis1 = cal1.getTimeInMillis();\r\n long milis2 = cal2.getTimeInMillis();\r\n // calcular la diferencia en milisengundos\r\n long diff = milis2 - milis1;\r\n // calcular la diferencia en horas\r\n Long diffHours = diff / (24 * 60 * 60 * 1000);\r\n return diffHours.intValue();\r\n }", "@Override\n public long minutosOcupados(Integer idEstacion, Date inicio, Date fin) {\n long minutos = 0;\n String sql = \"SELECT eje FROM Recurso rec, Ejecucion eje WHERE rec.idestacion = :idEstacion AND eje.idrecurso = rec.idrecurso AND eje.fechafin >= :inicio AND eje.fechainicio < :fin\";\n List<Ejecucion> ejecuciones = getCurrentSession().createQuery(sql).setParameter(\"idEstacion\", idEstacion).setParameter(\"inicio\", inicio).setParameter(\"fin\", fin).list();\n for (Ejecucion next : ejecuciones) {\n Date inicioEjecucion = next.getFechainicio();\n Date finEjecucion = next.getFechafin();\n if (inicioEjecucion.before(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio y finaliza en el fin de la ejecucion\n minutos = minutos + Math.abs(finEjecucion.getTime() - inicio.getTime())/60000;\n \n } else if (inicioEjecucion.after(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio de la ejecucion y finaliza en el fin de la ejecucion\n minutos = minutos + Math.abs(fin.getTime() - inicioEjecucion.getTime())/60000;\n \n }else if (inicioEjecucion.after(inicio) && finEjecucion.after(fin)){\n //Comienza en inicio de la ejecucion y finaliza en el fin\n minutos = minutos + Math.abs(fin.getTime() - inicioEjecucion.getTime())/60000;\n \n } else if (inicioEjecucion.before(inicio) && finEjecucion.after(fin)) {\n //Comienza en inicio y finaliza en el fin\n minutos = minutos + Math.abs(fin.getTime() - inicio.getTime())/60000;\n }\n }\n return minutos;\n }", "private ResultSet getResultSetSalaryReport(String departmentId, LocalDate dateFrom, LocalDate dateTo){\n PreparedStatement ps;\n try {\n ps = connection.prepareStatement(SQL_SELECT);\n ps.setString(0, departmentId);\n ps.setDate(1, new java.sql.Date(dateFrom.toEpochDay()));\n ps.setDate(2, new java.sql.Date(dateTo.toEpochDay()));\n return ps.executeQuery();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n return null;\n }", "@Override\n public final long daysInEffect(final LocalDate comparison) {\n return ChronoUnit.DAYS.between(this.getStartDate(), comparison);\n }", "public static String calcualte_timeDifference(String datetobeFormatted) {\n\n int days = 0,hours = 0,minutes = 0,seconds = 0,weeks=0;\n try {\n Calendar c = Calendar.getInstance();\n SimpleDateFormat df_current = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n String formattedDate = df_current.format(c.getTime());\n Date date_current = df_current.parse(formattedDate);\n\n SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n Date date = df.parse(datetobeFormatted);\n\n\n DateTime dt1 = new DateTime(date);\n DateTime dt2 = new DateTime(date_current);\n\n days = Days.daysBetween(dt1, dt2).getDays();\n hours = Hours.hoursBetween(dt1, dt2).getHours() % 24;\n minutes = Minutes.minutesBetween(dt1, dt2).getMinutes() % 60;\n seconds = Seconds.secondsBetween(dt1, dt2).getSeconds() % 60;\n weeks = Weeks.weeksBetween(dt1, dt2).getWeeks();\n\n\n Log.i(\"Date \",datetobeFormatted);\n Log.i(\"Days \",(Days.daysBetween(dt1, dt2).getDays() + \" days, \"));\n //Log.i(\"Days \",Hours.hoursBetween(dt1, dt2).getHours() % 24 + \" hours, \");\n //Log.i(\"Days \",Minutes.minutesBetween(dt1, dt2).getMinutes() % 60 + \" minutes, \");\n\n\n\n } catch (ParseException e) {\n e.printStackTrace();\n }\n if(weeks>1)\n {\n return weeks+\"w\";\n }else\n {\n return days+\"d\";\n }\n /* else if(hours>1 && days<1)\n {\n return hours+\"h\";\n }\n else if(minutes>1 && hours<1)\n {\n return minutes+\"m\";\n }else\n {\n return seconds+\"s\";\n }*/\n }", "public Integer get_count_of_days(String Created_date_String, String Expire_date_String) {\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yy\", Locale.getDefault());\n\n Date Created_convertedDate = null, Expire_CovertedDate = null, todayWithZeroTime = null;\n try {\n Created_convertedDate = dateFormat.parse(Created_date_String);\n Expire_CovertedDate = dateFormat.parse(Expire_date_String);\n\n Date today = new Date();\n\n todayWithZeroTime = dateFormat.parse(dateFormat.format(today));\n } catch (ParseException e) {\n e.printStackTrace();\n }\n\n Calendar c_cal = Calendar.getInstance();\n c_cal.setTime(todayWithZeroTime);\n int c_year = c_cal.get(Calendar.YEAR);\n int c_month = c_cal.get(Calendar.MONTH);\n int c_day = c_cal.get(Calendar.DAY_OF_MONTH);\n\n\n Calendar e_cal = Calendar.getInstance();\n e_cal.setTime(Expire_CovertedDate);\n int e_year = e_cal.get(Calendar.YEAR);\n int e_month = e_cal.get(Calendar.MONTH);\n int e_day = e_cal.get(Calendar.DAY_OF_MONTH);\n\n Calendar date1 = Calendar.getInstance();\n Calendar date2 = Calendar.getInstance();\n\n date1.clear();\n date1.set(c_year, c_month, c_day);\n date2.clear();\n date2.set(e_year, e_month, e_day);\n\n long diff = date2.getTimeInMillis() - date1.getTimeInMillis();\n\n long dayCount = diff / (24 * 60 * 60 * 1000);\n\n return (int) dayCount;\n }", "public int getTotalNumberOfWorkingDays(List<LocalDate> dateList) {\n\n int cont = 0;\n for (LocalDate date : dateList) {\n\n if (dateDiffOfWeekend(date)) {\n\n cont++;\n }\n }\n\n return cont;\n }", "public List<String> getAccountBetweenDate(String first_date, String second_date) throws Exception{\n Session session= sessionFactory.getCurrentSession();\n List<String> accountList= session.createQuery(\"select account_no from Account where date(opening_date) BETWEEN '\"+first_date+\"' AND '\"+second_date+\"'\",String.class).list();\n return AccountDto.AccountBtwDate(accountList);\n }", "public long getDifference(Date startDate, Date endDate){\n\n //milliseconds\n long different = endDate.getTime() - startDate.getTime();\n\n System.out.println(\"startDate : \" + startDate);\n System.out.println(\"endDate : \"+ endDate);\n System.out.println(\"different : \" + different);\n\n long secondsInMilli = 1000;\n long minutesInMilli = secondsInMilli * 60;\n long hoursInMilli = minutesInMilli * 60;\n long daysInMilli = hoursInMilli * 24;\n\n long elapsedDays = different / daysInMilli;\n different = different % daysInMilli;\n\n long elapsedHours = different / hoursInMilli;\n different = different % hoursInMilli;\n\n long elapsedMinutes = different / minutesInMilli;\n different = different % minutesInMilli;\n\n long elapsedSeconds = different / secondsInMilli;\n\n System.out.printf(\n \"%d days, %d hours, %d minutes, %d seconds%n\",\n elapsedDays,\n elapsedHours, elapsedMinutes, elapsedSeconds);\n\n return elapsedMinutes;\n }", "public static long daysBetween(Date startDate, Date endDate) {\r\n\t Calendar sDate = getDatePart(startDate);\r\n\t Calendar eDate = getDatePart(endDate);\r\n\r\n\t long daysBetween = 0;\r\n\t while (sDate.before(eDate)) {\r\n\t sDate.add(Calendar.DAY_OF_MONTH, 1);\r\n\t daysBetween++;\r\n\t }\r\n\t return daysBetween;\r\n\t}", "private static int hoursDifference(Date date1, Date date2,TypeDate typeDate) {\n\n\t\tfinal int MILLI_TO_HOUR = 1000 * 60 * 60;\n\t\tfinal int MILLI_TO_DAY = MILLI_TO_HOUR*24;\n\t\tfinal int MILLI_TO_WEEK = MILLI_TO_DAY*7;\n\n\t\tint result=0;\n\t\tswitch (typeDate) {\n\n\t\tcase HOUR:\n\t\t\tresult= (int) (date2.getTime() - date1.getTime()) / MILLI_TO_HOUR;\n\t\t\tbreak;\n\n\t\tcase DAY:\n\t\t\tresult= (int) (date2.getTime() - date1.getTime()) / MILLI_TO_DAY;\n\t\t\tbreak;\n\n\t\tcase WEEK:\n\t\t\tresult= (int) (date2.getTime() - date1.getTime()) / MILLI_TO_WEEK;\n\t\t\tbreak;\n\n\t\t}\n\t\treturn result;\n\t}", "@Query(\"SELECT d FROM Day d WHERE date = ?1\")\n List<Day> getByDate(Date date);", "public Vector<Event> getEventsInDay(Date par){\n Connection con = null;\n PreparedStatement st = null;\n ResultSet rs = null;\n Vector<Event> result = new Vector<Event>();\n try {\n //obtain the database connection by calling getConn()\n con = getConn();\n \n SimpleDateFormat format1 = new SimpleDateFormat(\"dd-MM-YY\");\n \n //build the sql statement\n String sql = \"select * from event where to_date('\" + format1.format(par) + \"','DD-MM-YY') \";\n sql+= \"between to_date(start_time,'DD-MM-YY') and to_date(end_time,'DD-MM-YY')\";\n \n \n //System.out.println(sql);\n //create the PreparedStatement from the Connection object by calling prepareCall\n //method, passing it the sql that is constructed using the supplied parameters\n st = con.prepareCall(sql);\n \n \n //Calls executeQuery and the resulting data is returned in the resultset\n rs = st.executeQuery();\n \n //loop through the result set and save the data in the datamodel objects\n while (rs.next()){\n \n Event e = new Event(rs.getLong(\"id\"),rs.getString(\"id\") + \",\" + rs.getString(\"name\"),rs.getDate(\"start_time\"),rs.getDate(\"end_time\"));\n ;\n result.add(e);\n \n }\n \n }\n catch (SQLException e){\n e.printStackTrace();\n }\n //close the resultset,preparedstatement and connection to relase resources \n if (rs != null){\n try{\n rs.close();\n rs = null;\n }\n catch (SQLException e){\n \n }\n }\n if (st != null){\n try{\n st.close();\n st = null;\n }\n catch (SQLException e){\n \n }\n }\n \n \n \n if (con != null){\n try{\n con.close();\n con = null;\n }\n catch (SQLException e){\n \n }\n }\n return result;\n \n \n }", "Salaries selectByPrimaryKey(@Param(\"empNo\") Integer empNo, @Param(\"fromDate\") Date fromDate);", "public long printDifferenceDay(Date startDate, Date endDate){\n\n //milliseconds\n long different = endDate.getTime() - startDate.getTime();\n\n long secondsInMilli = 1000;\n long minutesInMilli = secondsInMilli * 60;\n long hoursInMilli = minutesInMilli * 60;\n long daysInMilli = hoursInMilli * 24;\n\n double elapsedDays = (double) Math.ceil((different / daysInMilli) + 0.5);\n different = different % daysInMilli;\n\n long elapsedHours = different / hoursInMilli;\n different = different % hoursInMilli;\n\n long elapsedMinutes = different / minutesInMilli;\n different = different % minutesInMilli;\n\n long elapsedSeconds = different / secondsInMilli;\n\n return (long) elapsedDays;\n //System.out.printf(\"%d days, %d hours, %d minutes, %d seconds%n\",elapsedDays,elapsedHours, elapsedMinutes, elapsedSeconds);\n\n }", "public static long CountDaysBetween(String D1, String D2) {\n\t\tfinal DateTimeFormatter formatter = DateTimeFormatter.ofPattern(\"yyyy/MM/dd\");\n\t\tfinal LocalDate firstDate = LocalDate.parse(D1, formatter);\n\t\tfinal LocalDate secondDate = LocalDate.parse(D2, formatter);\n\t\tfinal long days = ChronoUnit.DAYS.between(firstDate, secondDate);\n\t\t// System.out.println(\"Days between: \" + days);\n\t\treturn days;\n\t}", "public int findTotalDenovo() throws DAOException;", "public List<Object[]> getNumFailuresAndDurationByDate(Date startDate, Date endDate) {\n\t\tQuery query = em.createQuery(\"select imsi, count(c), sum(duration) from BaseData c where c.date_time >= :sDate AND c.date_time <= :eDate group by imsi\");\n\t\tquery.setParameter(\"sDate\",startDate);\n\t\tquery.setParameter(\"eDate\", endDate);\n\t\treturn (List<Object[]>)query.getResultList();\n\t}", "public int countByTodoDateTime(Date todoDateTime);", "private static List<Date> getTradeDays(Date startDate, Date expiration) {\r\n\t\t\r\n\t\tEntityManagerFactory emf = Persistence.createEntityManagerFactory(\"JPAOptionsTrader\");\r\n\t\tEntityManager em = emf.createEntityManager();\r\n\t\t\r\n\t\t// Note: table name refers to the Entity Class and is case sensitive\r\n\t\t// field names are property names in the Entity Class\r\n\t\tQuery query = em.createQuery(\"select distinct(opt.trade_date) from \" + TradeProperties.SYMBOL_FOR_QUERY + \" opt where \"\r\n\t\t\t\t+ \"opt.trade_date >= :tradeDate \" \r\n\t\t\t\t+ \"and opt.expiration=:expiration \"\t\r\n\t\t\t\t+ \" order by opt.trade_date\");\r\n\t\t\r\n\t\tquery.setParameter(\"tradeDate\", startDate);\r\n\t\tquery.setParameter(\"expiration\", expiration);\r\n\r\n\t\tquery.setHint(\"odb.read-only\", \"true\");\r\n\r\n\t\t@SuppressWarnings(\"unchecked\")\r\n\t\tList<Date> tradeDates = query.getResultList();\r\n\t\t\r\n\t\tem.close();\r\n\t\t\r\n\t\treturn tradeDates;\r\n\t}", "public Double getTotalOliDOdeEnvasadoresEntreDates(Long temporadaId, Date dataInici, Date dataFi, Integer idAutorizada) throws InfrastructureException {\r\n\t\tlogger.debug(\"getTotalOliDOdeEnvasadoresEntreDates ini\");\r\n//\t\tCollection listaTrasllat = getEntradaTrasladosEntreDiasoTemporadas(temporadaId, dataInici, dataFi);\r\n\t\tCollection listaTrasllat = null;\r\n\t\tSimpleDateFormat df = new SimpleDateFormat(\"dd/MM/yyyy\");\r\n\t\tdouble litros = 0;\r\n\t\t\r\n\t\ttry {\r\n\t\t\tString q = \"from Trasllat tdi where tdi.retornatEstablimentOrigen = true \";\r\n\t\t\tif(dataInici != null){\r\n\t\t\t\tString fi = df.format(dataInici);\r\n\t\t\t\tq = q+ \" and tdi.data >= '\"+fi+\"' \";\r\n\t\t\t}\r\n\t\t\tif(dataFi != null){\r\n\t\t\t\tString ff = df.format(dataFi);\r\n\t\t\t\tq = q+ \" and tdi.data <= '\"+ff+\"' \";\r\n\t\t\t}\r\n\t\t\tlistaTrasllat = getHibernateTemplate().find(q);\t\r\n\t\t} catch (HibernateException ex) {\r\n\t\t\tlogger.error(\"getTotalOliDOdeEnvasadoresEntreDates failed\", ex);\r\n\t\t\tthrow new InfrastructureException(ex);\r\n\t\t}\r\n\t\t\r\n\t\t//Para cada uno de lor registro Trasllat separamos los depositos y devolvemos un objeto rasllatDipositCommand\r\n\t\tif (listaTrasllat != null){\r\n\t\t\tfor(Iterator it=listaTrasllat.iterator();it.hasNext();){\r\n\t\t\t\tTrasllat trasllat = (Trasllat)it.next();\r\n\t\t\t\tif(trasllat.getDiposits()!= null){\r\n\t\t\t\t\tfor(Iterator itDip=trasllat.getDiposits().iterator();itDip.hasNext();){\r\n\t\t\t\t\t\tDiposit diposit = (Diposit)itDip.next();\r\n\t\t\t\t\t\tif(idAutorizada!= null && diposit.getPartidaOli() != null && diposit.getPartidaOli().getCategoriaOli() !=null && diposit.getPartidaOli().getCategoriaOli()!= null){\r\n\t\t\t\t\t\t\tif(diposit.getPartidaOli().getCategoriaOli().getId().intValue() == idAutorizada.intValue() && diposit.getVolumActual()!= null){\r\n\t\t\t\t\t\t\t\tlitros+= diposit.getVolumActual().doubleValue();\r\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tlogger.debug(\"getTotalOliDOdeEnvasadoresEntreDates fin\");\r\n\t\treturn Double.valueOf(String.valueOf(litros));\r\n\t}", "private static int dateDiff(final Date startDate, final Date endDate, final int field) {\n if (startDate == null) {\n throw new NullPointerException(\"start\");\n }\n\n if (endDate == null) {\n throw new NullPointerException(\"end\");\n }\n\n final Calendar start = Dates.toUTCCalendarWithoutTime(startDate);\n final Calendar end = Dates.toUTCCalendarWithoutTime(endDate);\n int elapsed = 0;\n\n if (start.before(end)) {\n while (start.before(end)) {\n start.add(field, 1);\n elapsed++;\n }\n } else if (start.after(end)) {\n while (start.after(end)) {\n start.add(field, -1);\n elapsed--;\n }\n }\n\n return elapsed;\n }", "@Override\n public long minutosLibres(Integer idEstacion, Date inicio, Date fin) {\n long minutos = Math.abs(fin.getTime() - inicio.getTime())/60000;\n List<Ejecucion> ejecuciones = null;\n String sql = \"SELECT eje FROM Recurso rec, Ejecucion eje WHERE rec.estacion.idestaciones = :idEstacion AND eje.recurso.idrecurso = rec.idrecurso AND eje.fechafin >= :inicio AND eje.fechainicio < :fin\";\n ejecuciones = getCurrentSession().createQuery(sql).setParameter(\"idEstacion\", idEstacion).setParameter(\"inicio\", inicio).setParameter(\"fin\", fin).list();\n \n if (ejecuciones != null) {\n for (Ejecucion next : ejecuciones) {\n Date inicioEjecucion = next.getFechainicio();\n Date finEjecucion = next.getFechafin();\n if (inicioEjecucion.before(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio y finaliza en el fin de la ejecucion\n minutos = minutos - Math.abs(finEjecucion.getTime() - inicio.getTime())/60000;\n\n } else if (inicioEjecucion.after(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio de la ejecucion y finaliza en el fin de la ejecucion\n minutos = minutos - Math.abs(fin.getTime() - inicioEjecucion.getTime())/60000;\n\n }else if (inicioEjecucion.after(inicio) && finEjecucion.after(fin)){\n //Comienza en inicio de la ejecucion y finaliza en el fin\n minutos = minutos - Math.abs(fin.getTime() - inicioEjecucion.getTime())/60000;\n\n } else if (inicioEjecucion.before(inicio) && finEjecucion.after(fin)) {\n //Comienza en inicio y finaliza en el fin\n minutos = minutos - Math.abs(fin.getTime() - inicio.getTime())/60000;\n }\n /*if (inicioEjecucion.before(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio y finaliza en el fin de la ejecucion\n minutos = minutos + (fin.getTime() - inicio.getTime())/60000;\n\n } else if (inicioEjecucion.after(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio de la ejecucion y finaliza en el fin de la ejecucion\n minutos = minutos + ((fin.getTime() - inicio.getTime()) + (inicioEjecucion.getTime() - inicio.getTime()))/60000;\n\n }else if (inicioEjecucion.after(inicio) && finEjecucion.after(fin)){\n //Comienza en inicio de la ejecucion y finaliza en el fin\n minutos = minutos + Math.abs(inicioEjecucion.getTime() - inicio.getTime())/60000;\n\n }*/\n }\n }\n return minutos;\n }", "public static void main(String[] args) {\n DateMidnight start = new DateMidnight(\"2019-07-01\");\n DateMidnight end = new DateMidnight(\"2019-07-22\");\n\n // Get days between the start date and end date.\n int days = Days.daysBetween(start, end).getDays();\n\n // Print the result.\n System.out.println(\"Days between \" +\n start.toString(\"yyyy-MM-dd\") + \" and \" +\n end.toString(\"yyyy-MM-dd\") + \" = \" +\n days + \" day(s)\");\n\n // Using LocalDate object.\n LocalDate date1 = LocalDate.parse(\"2019-07-01\");\n LocalDate date2 = LocalDate.now();\n days = Days.daysBetween(date1, date2).getDays();\n\n // Print the result.\n System.out.println(\"Days between \" +\n date1.toString(\"yyyy-MM-dd\") + \" and \" +\n date2.toString(\"yyyy-MM-dd\") + \" = \" +\n days + \" day(s)\");\n }", "public double getExpense(LocalDate from, LocalDate to) throws SQLException {\n\t\ttry (PreparedStatement statement = conn.prepareStatement(\"select sum(Amount) from transaction where date between ? and ? and type=\\\"Expense\\\"\")) {\n\t\t\tstatement.setDate(1, Date.valueOf(from));\n\t\t\tstatement.setDate(2, Date.valueOf(to));\n\t\t\ttry (ResultSet resultSet = statement.executeQuery()) {\n\t\t\t\tif (resultSet.next()) {\n\t\t\t\t\treturn resultSet.getDouble(1);\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args){\n\n\n DateTimeFormatter formatter1 = DateTimeFormat.forPattern(\"yyyy-MM-dd\");\n DateTime d1 = DateTime.parse(\"2018-05-02\",formatter1);\n DateTime d2 = DateTime.parse(\"2018-05-01\",formatter1);\n System.out.println(Days.daysIn(new Interval(d2,d1)).getDays());\n }", "@SuppressWarnings(\"rawtypes\")\r\n\tpublic Double getTotalOliDOaEnvasadoresEntreDates(Date dataInici, Date dataFi, Integer idAutorizada) throws InfrastructureException {\r\n\t\tlogger.debug(\"getTotalOliDOaEnvasadoresEntreDates ini\");\r\n\t\tSimpleDateFormat df = new SimpleDateFormat(\"dd/MM/yyyy\");\r\n\t\tdouble litros = 0;\r\n\t\ttry {\r\n\t\t\tString fi = null;\r\n\t\t\tString ff = null;\r\n\t\t\tif (dataInici != null) fi = df.format(dataInici);\r\n\t\t\tif (dataFi != null) ff = df.format(dataFi);\r\n\t\t\tString q =\" from Trasllat tdi where \" +\r\n\t\t\t\t\t\"\t (tdi.dataAcceptarEnviament is not null \" +\r\n\t\t\t\t\t\"\t\tand tdi.quantitatEnviament is not null \";\r\n\t\t\tif (fi != null) \r\n\t\t\t\tq +=\"\t\tand tdi.dataAcceptarEnviament >= '\"+fi+\"' \";\r\n\t\t\tif (ff != null)\r\n\t\t\t\tq +=\"\t\tand tdi.dataAcceptarEnviament <= '\"+ff+\"' \";\r\n\t\t\tq +=\t\"\t\tand tdi.quantitatEnviament > 0 ) or \" +\r\n\t\t\t\t\t\"\t (tdi.dataAcceptarRetorn is not null \" +\r\n\t\t\t\t\t\"\t\tand tdi.quantitatRetorn is not null \";\r\n\t\t\tif (fi != null)\r\n\t\t\t\tq +=\"\t\tand tdi.dataAcceptarRetorn >= '\"+fi+\"' \";\r\n\t\t\tif (ff != null)\r\n\t\t\t\tq +=\"\t\tand tdi.dataAcceptarRetorn <= '\"+ff+\"' \";\r\n\t\t\tq +=\t\"\t\tand tdi.quantitatRetorn > 0) \" +\r\n\t\t\t\t\t\"and tdi.valid = true \" +\r\n\t\t\t\t\t\"order by tdi.data desc\";\r\n\t\t\t\r\n\t\t\tCollection listaTrasllat = getHibernateTemplate().find(q);\r\n\t\t\t//Para cada uno de lor registro Trasllat separamos los depositos y devolvemos un objeto trasllatDipositCommand\r\n\t\t\t\r\n\t\t\tfor(Iterator it=listaTrasllat.iterator();it.hasNext();){\r\n\t\t\t\tTrasllat trasllat = (Trasllat)it.next();\r\n\t\t\t\tfor(Iterator itTra=trasllat.getTraza().getTrazasForTtrCodtrafill().iterator();itTra.hasNext();){\r\n\t\t\t\t\t\tTraza traza = (Traza)itTra.next();\r\n\t\t\t\t\t\tif (traza.getTipus().intValue() == Constants.CODI_TRAZA_TIPUS_ENTRADA_DIPOSIT){\r\n\t\t\t\t\t\t\tString query = \"select distinct edi from EntradaDiposit as edi where edi.traza.id=\" + traza.getId() + \" and edi.valid = true \";\r\n\t\t\t\t\t\t\tList entDip = getHibernateTemplate().find(query);\r\n\t\t\t\t\t\t\tif(entDip.size()>0){\r\n\t\t\t\t\t\t\t\tEntradaDiposit edi = (EntradaDiposit)entDip.get(0);\r\n\t\t\t\t\t\t\t\t//EntradaDiposit edi = this.entradaDipositAmbTraza(traza.getId());\r\n\t\t\t\t\t\t\t\tif(idAutorizada!= null && edi.getCategoriaOli()!= null && edi.getCategoriaOli().getId().intValue() == idAutorizada.intValue()){\r\n\t\t\t\t\t\t\t\t\tlitros += edi.getLitres();\r\n\t\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\t}\r\n\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (HibernateException ex) {\r\n\t\t\tlogger.error(\"getTotalOliDOaEnvasadoresEntreDates failed\", ex);\r\n\t\t\tthrow new InfrastructureException(ex);\r\n\t\t}\t\r\n\t\tlogger.debug(\"getTotalOliDOaEnvasadoresEntreDates fin\");\r\n\t\treturn Double.valueOf(String.valueOf(litros)); \r\n\t}", "int getEtoId(DataDate date) throws SQLException;", "private int backDays(Calendar startDate, int delta) {\n Calendar newDate = (Calendar) startDate.clone();\n newDate.add(Calendar.DAY_OF_MONTH, -delta);\n return DateUtil.convertCalToInt(newDate);\n }", "public static int getWorkingHrs(int DayHr , int workHrs){\n\tworkHrs=DayHr+workHrs;\n\treturn workHrs;\n}", "public static int[] getElapsedTime(Date first, Date second) {\n if (first.compareTo(second) == 1 ) {\n return null;\n }\n int difDays = 0;\n int difHours = 0;\n int difMinutes = 0;\n\n Calendar c = Calendar.getInstance();\n c.setTime(first);\n int h1 = c.get(Calendar.HOUR_OF_DAY);\n int m1 = c.get(Calendar.MINUTE);\n\n c.setTime(second);\n int h2 = c.get(Calendar.HOUR_OF_DAY);\n int m2 = c.get(Calendar.MINUTE);\n\n if (sameDay(first, second)) {\n difHours = h2 - h1;\n } else {\n difDays = getNumberOfDays(first, second)-1;\n if (h1 >= h2) {\n difDays--;\n difHours = (24 - h1) + h2;\n } else {\n difHours = h2 - h1;\n }\n }\n\n if (m1 >= m2) {\n difHours--;\n difMinutes = (60 - m1) + m2;\n } else {\n difMinutes = m2 - m1;\n }\n\n int[] result = new int[3];\n result[0] = difDays;\n result[1] = difHours;\n result[2] = difMinutes;\n return result;\n }", "public static int countDiffDay(Calendar c1, Calendar c2) {\n int returnInt = 0;\n while (!c1.after(c2)) {\n c1.add(Calendar.DAY_OF_MONTH, 1);\n returnInt++;\n }\n\n if (returnInt > 0) {\n returnInt = returnInt - 1;\n }\n\n return (returnInt);\n }", "Date computeDays(Date d, int days){\n d.setTime(d.getTime() + days*1000*60*60*24);\n return d;\n }", "Map<Date, Integer> getFullConversions(Step step) throws SQLException;", "public int daysBetween(Day day)\n\t{\n\t\tlong millisBetween = Math.abs(this.getDayStart(TimeZoneEx.GMT).getTime() - day.getDayStart(TimeZoneEx.GMT).getTime());\n\t\treturn (int) Math.round((float) millisBetween / (1000F * 60F * 60F * 24F));\n\t}", "@Query(nativeQuery = true, value = \"select * from vamus.eventos where \" +\n \"ini_evento>=:inicio and fim_evento<=:fim\")\n List<EventoEntity> findByDate(@Param(\"inicio\") LocalDateTime ini,\n @Param(\"fim\") LocalDateTime fim);", "public static int numOfWorkingDays(PublicHolidayRepository phRep, LocalDate start, LocalDate end) {\r\n\t\t\r\n\t\tint count = 0;\r\n\t\tArrayList<Date> phDates1 = phRep.findAllPublicHolidayDates();\r\n\t\tArrayList<LocalDate> phDates=new ArrayList<LocalDate>();\r\n\t\tfor(Date d:phDates1)\r\n\t\t{\r\n\t\t\tphDates.add(d.toLocalDate());\r\n\t\t}\r\n\t\tfor(LocalDate date = start; date.isBefore(end.plusDays(1)); date = date.plusDays(1)) {\r\n\t\t\tSystem.out.println(date.getDayOfWeek());\r\n\t\t\tif(date.getDayOfWeek() == DayOfWeek.SATURDAY)\r\n\t\t\t\tcontinue;\r\n\t\t\tif(date.getDayOfWeek() == DayOfWeek.SUNDAY)\r\n\t\t\t\tcontinue;\r\n\t\t\tif(phDates.contains(date))\r\n\t\t\t\tcontinue;\r\n\t\t\tcount++;\r\n\t\t}\r\n\t\treturn count;\r\n\t}", "public final DBResult getDateCodes(Calendar day) throws SQLException {\n PreparedStatement statement = connection.prepareStatement(\"SELECT DISTINCT SERVICE_ID \" + \"FROM \"\n + config.getDaymarkerTable() + \" WHERE \" + getWeekDay(day) + \" ='1'\"\n + \" AND START_DATE<=? AND END_DATE>=? ORDER BY SERVICE_ID\");\n Date date = new Date(day.getTimeInMillis());\n statement.setDate(1, date);\n statement.setDate(2, date);\n return new DBResult(statement, statement.executeQuery());\n }", "@LogExceptions\n public int getNumberOfEvents(String date) throws SQLException {\n Connection conn = DatabaseConnection.getConnection();\n int i = 0;\n try(PreparedStatement stmt = \n conn.prepareStatement(SELECT_EVENT_DATE)) \n {\n stmt.setString(1, date);\n try(ResultSet rs = stmt.executeQuery()) {\n while(rs.next()) {\n i++;\n }\n }\n }\n return i;\n }", "public static long daysBetween(long start, long end) {\r\n long result = 1l;\r\n if (end > start) {\r\n Long diff = end - start;\r\n Double days = diff / DTConstants.MILLSECS_PER_DAY;\r\n Integer wholeDays = days.intValue();\r\n if (0 == wholeDays) {\r\n wholeDays = 1;\r\n } else {\r\n if (0 != (days - wholeDays)) {\r\n wholeDays++;\r\n }\r\n }\r\n result = wholeDays.longValue();\r\n }\r\n return result;\r\n }", "public int daysBetweenDates(String date1, String date2) {\n\n return 0;\n }", "private ArrayList<DateData> getDaysBetweenDates(Date startDate, Date endDate) {\n\n String language = UserDTO.getUserDTO().getLanguage();\n ArrayList<DateData> dataArrayList = new ArrayList<>();\n Calendar calendar = new GregorianCalendar();\n calendar.setTime(startDate);\n\n while (calendar.getTime().before(endDate)) {\n Date result = calendar.getTime();\n try {\n int day = Integer.parseInt((String) android.text.format.DateFormat.format(\"dd\", result));\n int month = Integer.parseInt((String) android.text.format.DateFormat.format(\"MM\", result));\n int year = Integer.parseInt((String) android.text.format.DateFormat.format(\"yyyy\", result));\n dataArrayList.add(new DateData(day, month, year, \"middle\"));\n calendar.add(Calendar.DATE, 1);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n int day = Integer.parseInt((String) android.text.format.DateFormat.format(\"dd\", endDate));\n int month = Integer.parseInt((String) android.text.format.DateFormat.format(\"MM\", endDate));\n int year = Integer.parseInt((String) android.text.format.DateFormat.format(\"yyyy\", endDate));\n if (language.equalsIgnoreCase(Constant.ENGLISH_LANGUAGE_CODE)) {\n dataArrayList.add(new DateData(day, month, year, \"right\"));\n } else {\n dataArrayList.add(new DateData(day, month, year, \"left\"));\n }\n\n DateData dateData = dataArrayList.get(0);\n if (language.equalsIgnoreCase(Constant.ENGLISH_LANGUAGE_CODE)) {\n dateData.setBackground(\"left\");\n\n } else {\n dateData.setBackground(\"right\");\n }\n dataArrayList.set(0, dateData);\n return dataArrayList;\n }", "@ApiOperation(\n value = \"Calculate the work days for a certain period and person\",\n notes = \"The calculation depends on the working time of the person.\"\n )\n @GetMapping(\"/workdays\")\n @PreAuthorize(SecurityRules.IS_OFFICE)\n public ResponseWrapper<WorkDayResponse> workDays(\n @ApiParam(value = \"Start date with pattern yyyy-MM-dd\", defaultValue = RestApiDateFormat.EXAMPLE_YEAR + \"-01-01\")\n @RequestParam(\"from\")\n String from,\n @ApiParam(value = \"End date with pattern yyyy-MM-dd\", defaultValue = RestApiDateFormat.EXAMPLE_YEAR + \"-01-08\")\n @RequestParam(\"to\")\n String to,\n @ApiParam(value = \"Day Length\", defaultValue = \"FULL\", allowableValues = \"FULL, MORNING, NOON\")\n @RequestParam(\"length\")\n String length,\n @ApiParam(value = \"ID of the person\")\n @RequestParam(\"person\")\n Integer personId) {\n\n final LocalDate startDate;\n final LocalDate endDate;\n try{\n DateTimeFormatter fmt = DateTimeFormatter.ofPattern(RestApiDateFormat.DATE_PATTERN);\n startDate = LocalDate.parse(from, fmt);\n endDate = LocalDate.parse(to, fmt);\n } catch (DateTimeParseException exception) {\n throw new IllegalArgumentException(exception.getMessage());\n }\n\n if (startDate.isAfter(endDate)) {\n throw new IllegalArgumentException(\"Parameter 'from' must be before or equals to 'to' parameter\");\n }\n\n final Optional<Person> person = personService.getPersonByID(personId);\n\n if (!person.isPresent()) {\n throw new IllegalArgumentException(\"No person found for ID=\" + personId);\n }\n\n final DayLength howLong = DayLength.valueOf(length);\n final BigDecimal days = workDaysService.getWorkDays(howLong, startDate, endDate, person.get());\n\n return new ResponseWrapper<>(new WorkDayResponse(days.toString()));\n }", "@Generated\n @Selector(\"daysSinceOnsetOfSymptoms\")\n @NInt\n public native long daysSinceOnsetOfSymptoms();", "public ResultSet reviewDate(String datee, Long idd) throws Exception{\n\trs=DbConnect.getStatement().executeQuery(\"select * from share_details where comp_id=\"+idd+\" and DATEOFTRANS='\"+datee+\"'\");\r\n\treturn rs;\r\n}", "public int getNumDaysForComponent(Record record);", "public static String getTeamTaskDue(Integer pmid) {\n Session session = ConnectionFactory.getInstance().getSession();\n String result = \"\";\n\n DateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd \");\n Date date = new Date();\n String ndt = dateFormat.format(date);\n try {\n PreparedStatement st = session.connection().prepareStatement(\"SELECT p.number,l.taskname,s.language as sLang,t.language as tLang,l.dueDatedate, r.firstName,r.lastName,r.companyname,c.company_code FROM project p INNER JOIN sourcedoc s ON p.id_project=s.id_project \"\n + \"INNER JOIN targetdoc t ON s.id_sourcedoc=t.id_sourcedoc \"\n + \"INNER JOIN lintask l ON l.ID_TargetDoc=t.ID_TargetDoc \"\n + \"INNER JOIN resource r ON l.personname=r.id_resource \"\n + \"INNER JOIN client_information c ON p.id_client=c.id_client \"\n + \"WHERE DATEDIFF ('\" + ndt + \"', l.dueDatedate)<0 AND l.receiveddatedate IS NULL AND p.pm_id=\" + pmid + \" AND p.status='active' \"\n + \"UNION \"\n + \"SELECT p.number,l.taskname,s.language as sLang,t.language as tLang,l.dueDatedate, r.firstName,r.lastName,r.companyname,c.company_code FROM project p INNER JOIN sourcedoc s ON p.id_project=s.id_project \"\n + \"INNER JOIN targetdoc t ON s.id_sourcedoc=t.id_sourcedoc \"\n + \"INNER JOIN dtptask l ON l.ID_TargetDoc=t.ID_TargetDoc \"\n + \"INNER JOIN resource r ON l.personname=r.id_resource \"\n + \"INNER JOIN client_information c ON p.id_client=c.id_client \"\n + \"WHERE DATEDIFF ('\" + ndt + \"', l.dueDatedate)<0 AND l.receiveddatedate IS NULL AND p.pm_id=\" + pmid + \" AND p.status='active' \"\n + \"UNION \"\n + \"SELECT p.number,l.taskname,s.language as sLang,t.language as tLang,l.dueDatedate, r.firstName,r.lastName,r.companyname,c.company_code FROM project p INNER JOIN sourcedoc s ON p.id_project=s.id_project \"\n + \"INNER JOIN targetdoc t ON s.id_sourcedoc=t.id_sourcedoc \"\n + \"INNER JOIN engtask l ON l.ID_TargetDoc=t.ID_TargetDoc \"\n + \"INNER JOIN resource r ON l.personname=r.id_resource \"\n + \"INNER JOIN client_information c ON p.id_client=c.id_client \"\n + \"WHERE DATEDIFF ('\" + ndt + \"', l.dueDatedate)<0 AND l.receiveddatedate IS NULL AND p.pm_id=\" + pmid + \" AND p.status='active' \"\n + \"UNION \"\n + \"SELECT p.number,l.taskname,s.language as sLang,t.language as tLang,l.dueDatedate, r.firstName,r.lastName,r.companyname,c.company_code FROM project p INNER JOIN sourcedoc s ON p.id_project=s.id_project \"\n + \"INNER JOIN targetdoc t ON s.id_sourcedoc=t.id_sourcedoc \"\n + \"INNER JOIN othtask l ON l.ID_TargetDoc=t.ID_TargetDoc \"\n + \"INNER JOIN resource r ON l.personname=r.id_resource \"\n + \"INNER JOIN client_information c ON p.id_client=c.id_client \"\n + \"WHERE DATEDIFF ('\" + ndt + \"', l.dueDatedate)<0 AND l.receiveddatedate IS NULL AND p.pm_id=\" + pmid + \" AND p.status='active'\");\n\n ResultSet rs = st.executeQuery();\n \n Integer count=1;\n while (rs.next()) {\n if(count==1) result = \"<fieldset><legend>Due Tasks</legend><div align='center'><table class='tableHighlight' width='90%' align='center' ><tr><td>&nbsp;</td></tr>\";\n// //System.out.println(\"AAAAAANNNNNAAAAAA\" + rs.getString(\"sLang\"));\n// //System.out.println(\"ddddddddddddddddd\" + rs.getString(\"taskname\"));\n// //System.out.println(\"qqqqqqqqqqqqqqqqq\" + rs.getString(\"tLang\"));\n String resource = \"\";\n if (rs.getString(\"firstName\").equals(\"\")) {\n resource = rs.getString(\"companyname\");\n } else {\n resource = rs.getString(\"firstName\") + \" \" + rs.getString(\"lastName\");\n }\n result += \"<tr>\";\n result += \"<td class=tableHeadingData><center>\"+count++ +\": \" + rs.getString(\"taskname\") + \" ( \" + rs.getString(\"sLang\") + \" - \" + rs.getString(\"tLang\") + \") of Project Number -<b><u>\" + rs.getInt(\"number\") +rs.getString(\"company_code\")+ \"</u></b>, <br> is due for <b>\" + resource + \"</b></center></td>\";\n\n result += \"</tr><tr><td>&nbsp;</td></tr>\";\n\n }\n if (count > 1) {\n result += \"</table></div></fieldset>\";\n }\n st.close();\n } catch (Exception e) {\n //System.out.println(\"errrrrrrrrrrrrrror\" + e.getMessage());\n } finally {\n if (session != null) {\n try {\n session.close();\n } catch (HibernateException e) {\n //System.out.println(\"Hibernate Exception:\" + e);\n throw new RuntimeException(e);\n }\n\n }\n }\n return result;\n\n }", "public void GetFileDates (long in_start_date, long in_end_date) {\n\n\n\n\n}", "public static int getDays(Date t, Date baseDate) {\n Calendar cal = Calendar.getInstance();\n cal.setTime(baseDate);\n long sl = cal.getTimeInMillis();\n long el, delta;\n cal.setTime(t);\n el = cal.getTimeInMillis();\n delta = el - sl;\n int value = (int) (delta / (24 * 60 * 60 * 1000));\n\n return value;\n }", "@Override\n\tpublic int datecount() throws Exception {\n\t\treturn dao.datecount();\n\t}", "public Integer getPresentDays()\r\n/* 48: */ {\r\n/* 49:51 */ return this.presentDays;\r\n/* 50: */ }", "public int findTotalLof() throws DAOException;", "@Query(\"SELECT d FROM Day d WHERE date = ?1 and user_id = ?2\")\n Optional<Day> getByUserIDAndDate(LocalDate date, Integer id);", "public static void main(String[] args) {\n\t\tString start_date = \"10-01-2018 01:10:20\"; \r\n\r\n\t\tString end_date = \"10-06-2020 06:30:50\"; \r\n\r\n\tfindDifference(start_date, end_date);\r\n\r\n\t}", "public int daysOverdue(int today);", "public static void DateDiff(Date date1, Date date2) {\n int diffDay = diff(date1, date2);\n System.out.println(\"Different Day : \" + diffDay);\n }", "public int getDateRmain() throws ParseException {\n String[] dateParts = description.split(\"<br />\");\n\n\n SimpleDateFormat sdf = new SimpleDateFormat(\"E, dd MMMMM yyyy - HH:mm\");\n String start = dateParts[0];\n Date st = sdf.parse(start.split(\": \")[1]);\n String end = dateParts[1];\n Date ed = sdf.parse(end.split(\": \")[1]);\n Date now = Calendar.getInstance().getTime();\n\n //long daysRemain1=(e.getTime()-s.getTime()+1000000)/(3600*24*1000);\n long diffInMillies = Math.abs(ed.getTime() - st.getTime());\n long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS);\n\n dateRmain = (int)diff;\n return dateRmain;\n }" ]
[ "0.6508315", "0.6175499", "0.60607874", "0.60096115", "0.5976499", "0.59062725", "0.582968", "0.5763733", "0.5724348", "0.5723278", "0.5695864", "0.56847405", "0.55417573", "0.5540264", "0.55021787", "0.5477702", "0.54520786", "0.54480994", "0.54444116", "0.544048", "0.5409139", "0.5396607", "0.5395669", "0.53881437", "0.53398484", "0.5318152", "0.5316513", "0.5297748", "0.5297203", "0.52914757", "0.528488", "0.5279868", "0.52778035", "0.5272568", "0.5242052", "0.5237133", "0.5230865", "0.52109605", "0.52073985", "0.520591", "0.52049655", "0.5199741", "0.5196875", "0.51961803", "0.5184606", "0.5183414", "0.51729214", "0.51692677", "0.51641303", "0.51630557", "0.5158099", "0.515622", "0.5127268", "0.5119607", "0.51189625", "0.5117396", "0.50965035", "0.5078843", "0.5064004", "0.5063073", "0.5062557", "0.50587505", "0.50566757", "0.5056342", "0.5056203", "0.50542396", "0.5048718", "0.50351214", "0.5021757", "0.50141126", "0.5006489", "0.49879947", "0.49815568", "0.4979662", "0.49752784", "0.49718717", "0.49654827", "0.4960349", "0.49541795", "0.49518648", "0.4937628", "0.49358004", "0.49321717", "0.49218658", "0.49137923", "0.4911543", "0.4911444", "0.49017033", "0.489893", "0.4892168", "0.4891108", "0.4882851", "0.48609048", "0.48598358", "0.48589733", "0.48520187", "0.48468265", "0.48462424", "0.4833346", "0.48330414" ]
0.7682141
0
Request to start are service when the alarm date is upon us We don't start an activity as we just want to pop up a notification into the system bar not a full activity
@Override public void run() { Intent intent = new Intent(context, NotifyService.class); intent.putExtra(NotifyService.INTENT_NOTIFY, true); intent.putExtra("REMINDER", showInfo); PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0); boolean alarmUp = (PendingIntent.getBroadcast(context, 0, new Intent("is.activites.scheduleActivites.INTENT_NOTIFY"), PendingIntent.FLAG_NO_CREATE) != null); // Sets an alarm - note this alarm will be lost if the phone is turned off and on again if(!alarmUp) am.set(AlarmManager.RTC_WAKEUP, date.getTimeInMillis(), pendingIntent); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void startAlarm(Context context){\n Intent intent = new Intent(this,MonthlyReminderService.class);\n int received = intent.getIntExtra(\"recieved\", 0);\n intent.putExtra(\"received\", received);\n //int type = intent.getIntExtra(\"type\", 0);\n //Log.e(\"SurveyType\", Integer.toString(type));\n //intent.putExtra(\"type\", type);\n //intent.putExtra(\"date\", surveyDate);\n //intent.putExtra(\"type\", \"Health Literacy\");\n //Calendar now = Calendar.getInstance();\n //intent.putExtra(\"dayofYear\",now.get(Calendar.DAY_OF_YEAR));\n startService(intent);\n }", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n\n AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n Intent notificationIntent = new Intent(\"android.media.action.DISPLAY_NOTIFICATION\");\n notificationIntent.addCategory(\"android.intent.category.DEFAULT\");\n\n PendingIntent broadcast = PendingIntent.getBroadcast(this, 100, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n Calendar cal = Calendar.getInstance();\n cal.add(Calendar.HOUR, 18);\n\n\n// alarmManager.setExact(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), broadcast);\n alarmManager.setRepeating(AlarmManager.RTC, cal.getTimeInMillis(), alarmManager.INTERVAL_DAY, broadcast);\n\n\n// alarmManager.setExact(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), broadcast);\n return START_STICKY;\n }", "public void startAlarm(Context context) {\n\n System.out.println(\"startAlarm\");\n\n\n\n //creates Object of AlarmManager\n AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n\n //passing the Alarm to AlertReceiver Class\n Intent intent = new Intent(context, AlertReceiver.class);\n final int id = (int) System.currentTimeMillis();\n PendingIntent pendingIntent = PendingIntent.getBroadcast(context, id, intent, 0);\n\n //Compares the chosen time with the real time\n if (c.before(Calendar.getInstance())) {\n c.add(Calendar.DATE, 1);\n }\n\n alarmManager.setExact(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pendingIntent);\n\n\n }", "public void startAlarm() {\n AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n\n Calendar calendar = Calendar.getInstance();\n\n // Set alarm only if the remained time is over 10 minutes\n if (time >10 ) {\n //TODO: Change to ((time * 60000) - 600000) for 10 minutes before\n calendar.setTimeInMillis((System.currentTimeMillis() + ((time * 1000)) - 10000)); // Alarm set to 10 sec before the booking\n\n Log.d(TAG, \"current time = \" + new Date().toLocaleString());\n// Log.d(TAG, \"current time = \" + System.currentTimeMillis());\n Log.d(TAG, \"Alarm set at = \" + calendar.getTime());\n\n /* no Repeat */\n manager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),\n 0, pendingIntent);\n }\n\n }", "public void SetAlarm(Context context)\n {\n Calendar calendar = Calendar.getInstance();\n calendar.setTimeInMillis(System.currentTimeMillis());\n calendar.set(Calendar.HOUR_OF_DAY, 7);\n calendar.set(Calendar.MINUTE,20);\n Log.i(\"Set calendar\", \"for time: \" + calendar.toString());\n\n //Intent i = new Intent(context, AlarmService.class);\n Intent i = new Intent(context, Alarm.class);\n boolean alarmRunning = (PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_NO_CREATE) !=null);\n if (!alarmRunning) {\n //PendingIntent pi = PendingIntent.getService(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);\n PendingIntent pi = PendingIntent.getService(context, 0, i, 0);\n\n\n\n PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, i, 0);\n AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);\n am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);\n //am.cancel(pi);\n }\n\n //PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0 );\n\n\n //am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),AlarmManager.INTERVAL_DAY, pi);\n\n }", "private void handleStart(Intent intent) {\n if (intent != null && intent.hasExtra(COMMAND_EXTRA)) {\n Bundle extras = intent.getExtras();\n int command = extras.getInt(COMMAND_EXTRA, COMMAND_UNKNOWN);\n try {\n long alarmId = currentAlarmId(); // get the current alarm\n switch (command) {\n case COMMAND_DISMISS_ALARM:\n Log.d(TAG, \"action button: dismiss is clicked\");\n acknowledgeCurrentNotification(0);\n break;\n case COMMAND_SNOOZE_ALARM:\n Log.d(TAG, \"action button: snooze is clicked\");\n int snoozeMinutes = db.readAlarmSettings(alarmId).getSnoozeMinutes(); // get snooze minutes time from the database\n acknowledgeCurrentNotification(snoozeMinutes);\n break;\n }\n\n // finish the notification activity because it may be already exists. Send a local broadcast that will be received by the activity\n LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(NotificationService.this);\n localBroadcastManager.sendBroadcast(new Intent(\"com.kiss.alarm.action.close\"));\n\n // To refresh the alarm's \"next time\" if the main activity was already opened\n if(ActivityAlarmClock.isActive){\n Intent i =new Intent(NotificationService.this, ActivityAlarmClock.class);\n i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\n startActivity(i);\n }\n\n } catch (NoAlarmsException e) {\n e.printStackTrace();\n }\n\n\n return; // Don't start the alarm sound, return because this intent is started by a user clicked on dismiss or snooze action button\n }\n\n // startService called from alarm receiver with an alarm id url. onStartCommand is not starting by an action button\n if (intent != null && intent.getData() != null) {\n long alarmId = AlarmUtil.alarmUriToId(intent.getData());\n try {\n WakeLock.assertHeld(alarmId);\n } catch (WakeLock.WakeLockException e) {\n if (AppSettings.isDebugMode(NotificationService.this)) {\n throw new IllegalStateException(e.getMessage());\n }\n }\n // We starts the notification activity by the notification now, so that the system Ui can choose to show\n // heads up notification instead of the activity if the user is busy using the device right now\n /*Intent notifyActivity = new Intent(NotificationService.this, ActivityAlarmNotification.class);\n notifyActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n startActivity(notifyActivity);*/\n\n boolean firstAlarm = firingAlarms.size() == 0;\n if (!firingAlarms.contains(alarmId)) {\n firingAlarms.add(alarmId);\n }\n\n if (firstAlarm) {\n soundAlarm(alarmId);\n }\n }\n }", "@Override\n\tprotected void onStart() {\n\t\tsuper.onStart();\n\t\t\n\t\tfromAlarm = false;\n\t}", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n\n String messageSender = intent.getExtras().getString(\n AppConstants.SMS_SERVICE_SENDER_PHONE_NUMBER);\n String messageContent = intent.getExtras().getString(AppConstants.SMS_SERVICE_SMS_TEXT);\n\n if (RegExUtils.isAnyIndicatorsPresentInText(messageContent,\n getResources().getStringArray(R.array.indicators))\n && (RegExUtils.isDatePresentInText(messageContent))) {\n requestToMakeCalendarEntryNotificationBuilder(messageSender, messageContent);\n }\n\n return Service.START_NOT_STICKY;\n }", "public void setAlarm(Context context, Alarm alarm) {\n // instantiate the system alarm service manager\n alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n // instantiate an intent for the AlarmReciever\n Intent intent = new Intent(context, AlarmReceiver.class);\n // pass the alarm id as an extra to be extracted in the receivier\n intent.putExtra(\"alarmID\", alarm.getId());\n // check if the alarm is on\n if (alarm.isOn()) {\n // if so check if it is recurring\n if (alarm.isRecurring()) {\n // for each day stipulated in the alarm, schedule an new alarm, each alarm id will\n // be multiplied with 10 and then an integer representation of each day will be\n // added i.e. alarm id = 10 and days a Sun = 1, Mon = 2... Sat = 7 therefore\n // sun alarm id = 101, Mon alarm id = 102... Sat alarm id = 107.\n for (Integer day : alarm.getDays()) {\n //multiply by 10 to uniquely identify the intent for each day or ends with 0 if not recurring\n alarmIntent = PendingIntent.getBroadcast(context, new BigDecimal(alarm.getId() * 10).intValueExact() + day, intent, 0);\n // instantiate a calander object\n Calendar calendar = Calendar.getInstance();\n // set to the current system time\n calendar.setTimeInMillis(System.currentTimeMillis());\n // set the calender day to day i.e. sun = 1, mon = 2 etc...\n calendar.set(Calendar.DAY_OF_WEEK, day);\n // set the calendar hour to alarm hour\n calendar.set(Calendar.HOUR_OF_DAY, alarm.getHour());\n // as per hour, set to alarm minutes\n calendar.set(Calendar.MINUTE, new Integer(alarm.getMin()));\n // set seconds to 0 alarm activates close to 0th second of minute\n calendar.set(Calendar.SECOND, 0);\n // as alarm is recurring schedule the alarm to repeat every 7 day from set time\n // specified by alarm set calendar object\n alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),\n AlarmManager.INTERVAL_DAY * 7, alarmIntent);\n }\n } else {\n // if the alarm is not recurring\n // uniquely identify the intent for each day and ends with 0 if not recurring\n alarmIntent = PendingIntent.getBroadcast(context, new BigDecimal(alarm.getId() * 10).intValueExact(), intent, 0);\n // get a calendar object\n Calendar calNow = Calendar.getInstance();\n // set the time to current system time\n calNow.setTimeInMillis(System.currentTimeMillis());\n // get a second instance of calendar\n Calendar calSet = (Calendar) calNow.clone();\n // set the time of the calendar object to the alarm specified time\n calSet.set(Calendar.HOUR_OF_DAY, alarm.getHour());\n calSet.set(Calendar.MINUTE, new Integer(alarm.getMin()));\n calSet.set(Calendar.SECOND, 0);\n // check if the alarm specified time is set to before the current time\n if (calSet.compareTo(calNow) <= 0) {\n //Today Set time passed, count to tomorrow\n calSet.add(Calendar.DATE, 1);\n }\n // set the alarm to activate at once at the calendar specified time\n alarmMgr.setExact(AlarmManager.RTC_WAKEUP,\n calSet.getTimeInMillis(), alarmIntent);\n }\n }\n }", "public int onStartCommand(Intent intent, int flags, int startId) {\n\n\n // IMPLEMENT SHAREDPREFERENCES\n preferences = getSharedPreferences(MyShared, Context.MODE_PRIVATE);\n\n //--------------------------------------\n // CALL METHOD START OR NOT START ALARM\n //--------------------------------------\n this.myHTTPAlarm();\n\n Log.e(\"mynews\",\"je lance la methode\");\n\n\n //-------------------\n // GET SHARED YES_NO\n //-------------------\n String yes_no = preferences.getString(YES_NO, \"\");\n\n //------------------------------\n // IF YES START THE NOTIFICATION\n //------------------------------\n\n if(yes_no.equals(\"\")) {\n\n // clear YES_NO\n preferences.edit().putString(YES_NO,\"\");\n\n // put the shared for get the number of pager adapter\n preferences.edit().putString(NOTIF,\"pager4\").commit();\n //TEST DU SHARED\n String page4 = preferences.getString(NOTIF,\"\");\n Log.e(\"mynews\",\"sauvegarde de la page4\" + page4);\n\n\n // using NotificationManager for get Alarm\n NotificationManager notify_manager = (NotificationManager)\n getSystemService(NOTIFICATION_SERVICE);\n // create intent\n Intent intent_main_activity = new Intent(this.getApplicationContext(), ViewNotificationArticles.class);\n // create pendingIntent\n PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,\n intent_main_activity, 0);\n\n Log.e(\"mynews\",\"je lance le yes\");\n\n // create notification poupup\n Notification notification_poupup = new Notification.Builder(this)\n //add title\n .setContentTitle(\"NYT\")\n //add text\n .setContentText(\"Il y a de nouveux articles\")\n //add icon\n .setSmallIcon(R.mipmap.ic_launcher)\n //use pendingIntent\n .setContentIntent(pendingIntent)\n .setAutoCancel(true)\n .build();\n\n // use notify\n notify_manager.notify(0, notification_poupup);\n\n }\n\n return START_NOT_STICKY;\n }", "protected void startBroadcastLocation() {\n AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n int interval = 5000;\n\n manager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), interval, pendingIntent);\n Toast.makeText(this, \"Alarm Set\", Toast.LENGTH_SHORT).show();\n }", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);\n boolean serviceOn = sharedPrefs.getBoolean(\"turn_app_on_off\", true);\n\n if(!serviceOn) {\n // Then we want to cancel the sms service:\n Intent i = new Intent(this, MyService.class);\n PendingIntent pIntent = PendingIntent.getService(this, 0, i, 0);\n AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n alarm.cancel(pIntent);\n return super.onStartCommand(intent, flags, startId);\n }\n\n // Get time for sending sms (set in Settings):\n String time = sharedPrefs.getString(\"change_time\", \"\");\n String[] parts = time.split(\":\");\n int chosenHour = Integer.parseInt(parts[0]);\n int chosenMinute = Integer.parseInt(parts[1]);\n\n Calendar cal = Calendar.getInstance();\n cal.set(Calendar.HOUR_OF_DAY, chosenHour);\n cal.set(Calendar.MINUTE, chosenMinute);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n\n // Intent to the class/code that will run periodically:\n Intent i = new Intent(this, MyService.class);\n PendingIntent pIntent = PendingIntent.getService(this, 0, i, 0);\n\n // Run code in MyService once each day from the time set by the user:\n AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pIntent);\n\n return super.onStartCommand(intent, flags, startId);\n }", "@Override\n public void onClick(View view) {\n Intent intent = new Intent(getApplicationContext(), ReminderBroadcastReceiver.class);\n intent.putExtra(\"notificationText\", reminderData.getNotificationText());\n\n // Create pending intent with time given\n PendingIntent alarmIntent = PendingIntent.getBroadcast(getApplicationContext(), notificationId,\n intent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n // Create AlarmManager which is sent with pending intent\n AlarmManager alarm = (AlarmManager) getSystemService(ALARM_SERVICE);\n // Create time when notification will fire\n Calendar startTime = Calendar.getInstance();\n startTime.set(Calendar.DAY_OF_WEEK, startTime.get(Calendar.DAY_OF_WEEK));\n startTime.set(Calendar.HOUR_OF_DAY, timePicker.getHour());\n startTime.set(Calendar.MINUTE, timePicker.getMinute());\n startTime.set(Calendar.SECOND, 0);\n\n long alarmStartTime = startTime.getTimeInMillis();\n\n\n /* If reminder time is smaller than current time, start notification on next day, still in progress */\n\n /*\n if (startTime.getTimeInMillis() < System.currentTimeMillis()) {\n startTime.set(Calendar.DAY_OF_WEEK, startTime.get(Calendar.DAY_OF_WEEK + 1));\n alarmStartTime = startTime.getTimeInMillis();\n }\n else\n {\n alarmStartTime = startTime.getTimeInMillis();\n }\n */\n\n\n // Set alarm with (type, milliseconds, intent)\n // With RTC_WAKEUP we wake the device up and deliver the pending intent\n alarm.set(AlarmManager.RTC_WAKEUP, alarmStartTime, alarmIntent);\n saveData();\n\n }", "private void StartNotifyActivity()\r\n\t{\n \tIntent intent = new Intent();\r\n\t\tintent.setClass(this, NotifyDateActivity.class);\r\n\t\t// Set time\r\n\t\tBundle Parameters = new Bundle();\r\n\t\tParameters.putString(OneNote.KEY_NOTIFYTIME, HelperFunctions.Calendar2String(AddOneNote.NotifyTime));\r\n\t\tParameters.putInt(OneNote.KEY_NOTIFYDURA, AddOneNote.NotifyDura);\r\n\t\tParameters.putString(OneNote.KEY_RINGMUSIC, AddOneNote.RingMusic);\r\n\t\tParameters.putInt(OneNote.KEY_NOTIFYMETHOD, AddOneNote.NotifyMethod);\r\n // Pass it to next activity \r\n\t\tintent.putExtras(Parameters);\r\n\t\t// Go to next activity(set note's notify time activity)\r\n\t\tstartActivityForResult(intent, ProjectConst.ACTIVITY_SET_NOTIFYTIME);\t\t\r\n\t}", "@Override\n public void onCreate() {\n \tToast.makeText(this, \"MyAlarmService.onCreate()\", Toast.LENGTH_LONG).show();\n \n \t \n \n \tLog.d(\"this is daya\",\"daya alaram\");\n \t\n }", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n\n sleepTime = intent.getIntExtra(KEY_SLEEP_TIME,60000);\n\n if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){\n NotificationChannel notificationChannel = new NotificationChannel(Service_Channel,\n \"NotificationService\", NotificationManager.IMPORTANCE_LOW);\n NotificationManager notificationManager = (NotificationManager) getSystemService(\n Context.NOTIFICATION_SERVICE);\n notificationManager.createNotificationChannel(notificationChannel);\n }\n\n Notification notification = new NotificationCompat.Builder(this, Service_Channel)\n .setContentTitle(\"Notification Service information\")\n .setContentText(\"Country: \")\n .build();\n startForeground(Notification_Id, notification);\n\n\n CallApi();\n return START_STICKY;\n }", "@Test\n public void testAlarmActive() {\n AlarmManager alarm = (AlarmManager) context.getSystemService(ALARM_SERVICE);\n Intent alarmIntent = new Intent(context, MyNotification.class);\n PendingIntent sendBroadcast = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_NO_CREATE);\n alarm.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+60*1000, sendBroadcast);\n boolean active = (PendingIntent.getBroadcast(context,0,alarmIntent,PendingIntent.FLAG_NO_CREATE))!=null;\n assertFalse(\"failed, \",active);\n }", "private void showNotification() {\n Intent intent = new Intent(this, MainActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);\n Notification notification = new NotificationCompat.Builder(getApplicationContext())\n .setContentIntent(PendingIntent.getActivity(this, 0, intent, 0))\n .setSmallIcon(R.drawable.ic_launcher)\n .setContentText(getText(R.string.local_service_running))\n .setContentTitle(getText(R.string.local_service_notification)).build();\n notificationManager.notify(NOTIFICATION, notification);\n }", "public static void startAlarmPendingIntent(Context context, boolean skipCancel) {\n // zrusime vsechny budiky v dtb kdyz je treba\n if (!skipCancel)\n {\n cancelAlarmPendingIntents(context);\n }\n // nacteme budiky z dtb\n List<Alarm> alarms = Alarm.getAlarms();\n AlarmManager alarmManager = (AlarmManager) context.getSystemService(context.ALARM_SERVICE);\n\n if (alarms == null) {\n return;\n }\n\n // naplanujeme vsechny budiky\n // kazdej aktivni budik je naplanovanej vzdy na datum nejblizsi zvoneni, budiky navic\n // planujeme jen jeden tyden dopredu od doby planovani\n // pro zazvoneni se pouzivaji pending intenty, ty jsou intenty ktery se spusti po nejake\n // dobe, navic v AlarmManageru(sluzba OS) jsou tyhle pending intenty kodovany podle nejakyho\n // klice, jako klic jsem pouzil id budiku v databazi\n\n ALARM_LOOP:\n for (Alarm alarm : alarms) {\n\n if (!alarm.isActive()) {\n continue;\n }\n\n Calendar cal = Calendar.getInstance();\n int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);\n\n DayRecorder days = alarm.getDays();\n\n final int curHour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);\n final int curMin = Calendar.getInstance().get(Calendar.MINUTE);\n\n // nastavime v calendari cas zazvoneni budiku\n cal.set(Calendar.HOUR_OF_DAY, alarm.getHour());\n cal.set(Calendar.MINUTE, alarm.getMinute());\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n\n // nejdriv zkontrolujeme jestli budik bude zvonit do konce dne\n if (alarm.getHour() >= curHour &&\n alarm.getMinute() > curMin &&\n days.isDaySet(currentDay - 1)) {\n\n cal.set(Calendar.DAY_OF_WEEK, currentDay);\n PendingIntent sender = createPendingIntent(context, alarm);\n // naplanuje budik na spravnej cas\n alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), sender);\n // budik naplanovan pokracujem dalsim budikem\n continue ALARM_LOOP;\n }\n\n if (cal.getFirstDayOfWeek() == Calendar.SUNDAY) {\n Log.v(TAG, \"US\");\n\n } else {\n Log.v(TAG, \"EU:\" + cal.getFirstDayOfWeek());\n cal.setFirstDayOfWeek(Calendar.SUNDAY);\n }\n\n // to same akorat ted kontrolujeme jestli budik byl naplanovan do konce tydne(soboty)\n // to je furt ten samy tyden jako ma Calender.getInstance();\n for (int i = currentDay + 1; i <= Calendar.SATURDAY; i++) {\n if (days.isDaySet(i - 1)) {\n\n cal.set(Calendar.DAY_OF_WEEK, i);\n PendingIntent sender = createPendingIntent(context, alarm);\n // naplanuje budik na spravnej cas\n Log.v(TAG, \"cal time millis \" + cal.get(Calendar.DAY_OF_WEEK) + \" \"\n + cal.get(Calendar.HOUR_OF_DAY) + \":\" + cal.get(Calendar.MINUTE));\n alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), sender);\n\n continue ALARM_LOOP;\n }\n }\n\n // budik nebyl naplanovan do soboty, tedy musi se prelit do dalsiho tydne\n // Calender.getInstance ma tyden o 1 mensi\n for (int i = Calendar.SUNDAY; i <= currentDay; ++i) {\n if (days.isDaySet(i-1)) {\n cal.set(Calendar.DAY_OF_WEEK, i);\n // incrementujeme polozku tyden\n cal.add(Calendar.WEEK_OF_YEAR, 1);\n PendingIntent sender = createPendingIntent(context, alarm);\n // naplanuje budik na spravnej cas\n alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), sender);\n continue ALARM_LOOP;\n }\n }\n }\n }", "public void setReminderApp(Context context) {\n AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n Intent intent = new Intent(context, DailyReminderApp.class);\n\n // setting waktu, kapan notifikasi akan di keluarkan\n Calendar calendar = Calendar.getInstance();\n calendar.set(Calendar.HOUR_OF_DAY, 7); // waktu yang di set adalah pukul 7 pagi\n calendar.set(Calendar.MINUTE, 0);\n calendar.set(Calendar.SECOND, 0);\n\n // pending intent ini akan menjalankan fungsi onReceive\n PendingIntent pendingIntent = PendingIntent.getBroadcast(context, ID_APP, intent, 0);\n if (alarmManager != null) {\n // statement ini berfungsi untuk mengatur jeda waktu notifikasi muncul\n // jeda waktu yang digunakan adalah sehari\n alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),\n AlarmManager.INTERVAL_DAY, pendingIntent);\n }\n\n\n }", "@SuppressWarnings({ \"static-access\", \"deprecation\" })\n\t@Override\n\tpublic void onStart(Intent intent, int startId) {\n\t\tsuper.onStart(intent, startId);\n\n\t\tLog.d(\"MAD\", \"Service Started\");\n\t\t\n\t\t\n\t\t// create intent, set a flag\n\t\tIntent alertIntent = new Intent(MyAlarmService.this,\n\t\t\t\tMyAlarmResponse.class);\n\t\talertIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n\t\t\n\n\t\t//Make a notification sound\n\t\ttry {\n\t\t Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n\t\t Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);\n\t\t \n\t\t //play sound\n\t\t r.play();\n\t\t} catch (Exception e) {\n\t\t e.printStackTrace();\n\t\t}\n\t\t\n\t\t// start intent\n\t\tstartActivity(alertIntent);\n\n\t}", "@Override\n public void onClick(View v) {\n if(v.getId() == R.id.alarmCheck){\n // Put extras for RingtoneService\n myIntent.putExtra(\"extra\", \"no\");\n myIntent.putExtra(\"extra1\", \"main\");\n cal = Calendar.getInstance();\n // Get the time for the alarm at the index\n String tempTime = App.getTimes().get(indexofIntent);\n String[] times = tempTime.split(\":\");\n // Get the hour and minute from the string and set them to int\n int hour = Integer.parseInt(times[0]);\n int minute = Integer.parseInt(times[1]);\n // Set the alarm time\n cal.setTimeInMillis(System.currentTimeMillis());\n cal.set(Calendar.HOUR_OF_DAY, hour);\n cal.set(Calendar.MINUTE, minute);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n // State pattern used here\n state = new CreateState();\n manager = (AlarmManager) getSystemService(ALARM_SERVICE);\n // add 24 hours\n cal.setTimeInMillis(cal.getTimeInMillis() + 86400000);\n // set the reciever\n Intent intent = new Intent(this.getApplicationContext(), AlarmReceiver.class);\n intent.putExtra(\"extra\", \"yes\");\n intent.putExtra(\"index\", indexofIntent);\n // Create a new intent\n PendingIntent pending = PendingIntent.getBroadcast(this.getApplicationContext(), App.getIds(), intent, PendingIntent.FLAG_UPDATE_CURRENT);\n // Overwrite the correct intent at the index\n App.setIntentAtIndex(indexofIntent, pending);\n App.setIds(App.getIds() + 1);\n // Handle the alarm\n // State pattern used here\n state.handle(manager, pending, cal, false);\n // Turn off ringtone\n sendBroadcast(myIntent);\n\n }\n // If snoozed then stop the media player and set the timer/calendar to 10 minutes\n else if(v.getId() == R.id.snooze){\n // Put extras for RingtoneService\n myIntent.putExtra(\"extra\", \"no\");\n myIntent.putExtra(\"extra1\", \"main\");\n // initialize AlarmManager\n manager = (AlarmManager) getSystemService(ALARM_SERVICE);\n // set the state\n // State pattern used here\n state = new SnoozeState();\n cal = Calendar.getInstance();\n // Get the time the alarm was set\n String tempTime = App.getTimes().get(indexofIntent);\n String[] times = tempTime.split(\":\");\n int hour = Integer.parseInt(times[0]);\n int minute = Integer.parseInt(times[1]);\n // Set calendar to time initially set\n cal.setTimeInMillis(System.currentTimeMillis());\n cal.set(Calendar.HOUR_OF_DAY, hour);\n cal.set(Calendar.MINUTE, minute);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n // Create a new intent for alarm receiver\n Intent intent = new Intent(this.getApplicationContext(), AlarmReceiver.class);\n // Add extras for RingtoneService\n intent.putExtra(\"extra\", \"yes\");\n intent.putExtra(\"index\", indexofIntent);\n // Create a new intent wiht the BroadcastReceiver\n PendingIntent pending = PendingIntent.getBroadcast(this.getApplicationContext(), App.getIds(), intent, PendingIntent.FLAG_UPDATE_CURRENT);\n // Set the new intent in the list\n App.setIntentAtIndex(indexofIntent, pending);\n App.setIds(App.getIds() + 1);\n // handle the snooze state\n // State pattern used here\n state.handle(manager, pending, cal, false);\n //send a toast to the user letting them know it will snooze for 10 minutes\n Toast t = Toast.makeText(getApplicationContext(), \"Alarm Snoozed for 10 minutes\",\n Toast.LENGTH_SHORT);\n t.setGravity(Gravity.FILL_HORIZONTAL, 10, 1500);\n t.show();\n // Stop the current ringtone\n sendBroadcast(myIntent);\n }\n }", "public void startAlarm() {\n Log.d(TAG, \"Starting alarm\");\n\n // Initializes the media player to play sounds and starts it\n\n mediaPlayer.start();\n alertOverlay.setVisibility(View.VISIBLE);\n sleepAlert.setVisibility(View.VISIBLE);\n\n // In main thread, starts the timer to turn the alarm off after ALARM_DURATION_MILLISECONDS seconds\n new Handler(Looper.getMainLooper()).post(new Runnable() {\n @Override\n public void run() {\n alarmTimer = new CountDownTimer(ALARM_DURATION_MILLISECONDS, ALARM_INTERVAL_MILLISECONDS) {\n @Override\n public void onTick(long millisUntilFinished) {\n }\n\n @Override\n public void onFinish() {\n stopAlarm();\n }\n }.start();\n }\n });\n }", "public void scheduleAlarm() {\n\n Calendar cal = Calendar.getInstance();\n Intent alarmIntent = new Intent(context, PeriodicTransactionService.class);\n alarmIntent.setAction(PeriodicTransactionService.ACTION);\n Bundle bundle = new Bundle();\n bundle.putInt(PeriodicTransactionService.USER_ID_PARAM, userId);\n alarmIntent.putExtras(bundle);\n PendingIntent pintent = PendingIntent.getService(context,\n MyAlarmManager.REQUEST_CODE,\n alarmIntent,\n PendingIntent.FLAG_UPDATE_CURRENT);\n AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 4 * 1000, pintent);\n }", "public Alarm_Msg(Context context, Bundle extras){\n /*AlarmManager alarmMgr =\n (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);\n Intent intent = new Intent(context, Alarm_Msg.class);\n intent.putExtra(REMINDER_BUNDLE, extras);\n PendingIntent pendingIntent =\n PendingIntent.getBroadcast(context, 0, intent,\n PendingIntent.FLAG_UPDATE_CURRENT);\n Calendar time = Calendar.getInstance();\n time.setTimeInMillis(System.currentTimeMillis());\n time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(extras.getString(\"time_h\")));\n time.set(Calendar.MINUTE, Integer.parseInt(extras.getString(\"time_m\")));\n\n alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, time.getTimeInMillis(),\n AlarmManager.INTERVAL_DAY, pendingIntent);*/\n\n\n AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);\n Intent intent = new Intent(context, Alarm_Msg.class);\n intent.putExtra(REMINDER_BUNDLE, extras);\n Bundle getBundle = intent.getBundleExtra(REMINDER_BUNDLE);\n NOTIFY_ID = NOTIFY_ID + getBundle.getInt(\"id\");\n //Toast.makeText(context, Integer.toString(NOTIFY_ID), Toast.LENGTH_LONG).show();\n PendingIntent pendingIntent =\n PendingIntent.getBroadcast(context, NOTIFY_ID, intent,\n PendingIntent.FLAG_UPDATE_CURRENT);\n\n alarmMgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,\n SystemClock.elapsedRealtime() +\n 60 * 1000, pendingIntent);\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n\n long when = System.currentTimeMillis();\n NotificationManager notificationManager = (NotificationManager) context\n .getSystemService(Context.NOTIFICATION_SERVICE);\n\n Intent notificationIntent = new Intent(context, MainActivity.class);\n notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n\n PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,\n notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n\n Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n\n NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(\n context).setSmallIcon(R.drawable.ic_file_download)\n .setContentTitle(\"App of the Day\")\n .setContentText(\"Get today's App of the Day...\").setSound(alarmSound)\n .setAutoCancel(true).setWhen(when)\n .setContentIntent(pendingIntent)\n .setVibrate(new long[]{1000, 1000, 1000, 1000, 1000});\n notificationManager.notify(MID, mNotifyBuilder.build());\n MID++;\n\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n\n boolean isAlarmOn = Utils.isAlarmOn();\n PollService.setServiceAlarm(MyApplication.getContext(), isAlarmOn);\n }", "public void OnToggleClicked(View view)\n {\n\n long time;\n if (((ToggleButton) view).isChecked())\n {\n //startActivity(Intent)\n Toast.makeText(MainActivity.this, \"ALARM ON\", Toast.LENGTH_SHORT).show();\n Calendar calendar=Calendar.getInstance();\n\n int currentApiVersion = android.os.Build.VERSION.SDK_INT;\n if (currentApiVersion > android.os.Build.VERSION_CODES.LOLLIPOP_MR1)\n {\n calendar.set(Calendar.HOUR_OF_DAY,alarmTimePicker.getHour());\n calendar.set(Calendar.MINUTE, alarmTimePicker.getMinute());\n }\n else {\n calendar.set(Calendar.HOUR_OF_DAY,alarmTimePicker.getCurrentHour());\n calendar.set(Calendar.MINUTE, alarmTimePicker.getCurrentMinute());\n }\n\n Intent intent = new Intent(this, AlarmReceiver.class);\n pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);\n\n time=(calendar.getTimeInMillis()-(calendar.getTimeInMillis()%60000));\n if(System.currentTimeMillis()>time)\n {\n if (Calendar.AM_PM == 0)\n time = time + (1000*60*60*12);\n else\n time = time + (1000*60*60*24);\n }\n alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, time, 10000, pendingIntent);\n }\n else\n {\n alarmManager.cancel(pendingIntent);\n Toast.makeText(MainActivity.this, \"ALARM OFF\", Toast.LENGTH_SHORT).show();\n }\n //public class DeezerConnect.Builder();\n }", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n showLocalNotification();\n return START_STICKY;\n }", "public void onClickStart(View v) {\n\t\tstartService(new Intent(this, MyService.class).putExtra(\"time\", 7));\n\t\tstartService(new Intent(this, MyService.class).putExtra(\"time\", 2));\n\t\t//startService(new Intent(this, MyService.class).putExtra(\"time\", 4));\n\t\tIntent intent = new Intent(this, MyService.class);\n\t\tintent.putExtra(\"time\", 4);\n\t\tstartService(intent);\n\t}", "public void addNotificationAlarm() {\n // get hour and minute from time preference\n SharedPreferences settingsPrefs = PreferenceManager.getDefaultSharedPreferences(this);\n String time = settingsPrefs.getString(SettingsActivity.KEY_NOTIFICATION_TIME, TimePreference.DEFAULT_TIME);\n final int notificationHour = TimePreference.getHourFromString(time);\n final int notificationMinute = TimePreference.getMinuteFromString(time);\n\n // build DateTime for next alarm\n ZonedDateTime notificationTime = ZonedDateTime.now()\n .truncatedTo(ChronoUnit.DAYS)\n .plusHours(notificationHour)\n .plusMinutes(notificationMinute);\n\n if (notificationTime.isBefore(ZonedDateTime.now())) {\n notificationTime = notificationTime.plusDays(1);\n }\n\n // create alarm\n AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);\n am.setInexactRepeating(AlarmManager.RTC_WAKEUP,\n notificationTime.toInstant().toEpochMilli(),\n AlarmManager.INTERVAL_DAY,\n buildAlarmPendingIntent());\n\n // too ensure alarm is recreated if device is restarted\n setBootReceiverEnabled(true);\n }", "@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t setContentView(R.layout.main);\n\t \n\t AlarmManager alarm = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);\n\t Intent intent = new Intent(\"android.intent.action.TIME_SET\");\n\t\tPendingIntent pender = PendingIntent.getBroadcast(\n\t\t\t\tthis, 0, intent, 0);\n\t\t\n\t\t//현재 날짜 가져오기 시간 분 까지 가능 \n\t\t Calendar rightNow = Calendar.getInstance();// 날짜 불러오는 함수\n\t\t int year = rightNow.get(Calendar.YEAR);// 100을 나눠서 년도표시를 2009->9지만\n\t\t // decimal포멧으로 09로 표현\n\t\t int month = rightNow.get(Calendar.MONTH);// 달\n\t\t int date = rightNow.get(Calendar.DATE);// 일\n \n\t\t //String result = decimalFormat.format(year)\n\t\t // + decimalFormat.format(month) + decimalFormat.format(date);\n\t\t //Toast.makeText(this, Integer.toString(year)+Integer.toString(month)+Integer.toString(date), Toast.LENGTH_SHORT).show();\n\t\t\n\t\t Calendar calendar = Calendar.getInstance();\n\t calendar.set(year, month, date, 16, 30, 1);\n\t \n\t alarm.cancel(pender); \n\t alarm.set(AlarmManager.RTC, calendar.getTimeInMillis(), pender);\n\t \n \n //Intent intentt = new Intent(this, Myservice.class);\n //ComponentName cpn = this.startService(intentt);\n\t \n\t Intent intent3 = new Intent(\"com.hardrock.service.test\");\n\t startService(intent3);\n\n\t\t\n\t //Intent intent2 = new Intent(this,\n\t\t//\t\tScreenReceiver.class);\n\t\t//PendingIntent pender = PendingIntent.getBroadcast(\n\t\t//\t\tthis, 0, intent2, 0);\n\n\t\tButton btn1 = (Button)this.findViewById(R.id.but1);\n\t\tbtn1.setOnClickListener(this);\n\t\tButton btn2 = (Button)this.findViewById(R.id.but2);\n\t\tbtn2.setOnClickListener(this);\n\t\tButton btn3 = (Button)this.findViewById(R.id.but3);\n\t\tbtn3.setOnClickListener(this);\n\t\tButton btn4 = (Button)this.findViewById(R.id.but4);\n\t\tbtn4.setOnClickListener(this);\n\t\t\n//\t\tTabHost tabhost = getTabHost();\n//\t\ttabhost.addTab(tabhost.newTabSpec(\"tag\").setIndicator(\"알림\")\n//\t\t\t\t.setContent(new Intent(this, Alim.class)));\n//\t\t//tabhost.addTab(tabhost.newTabSpec(\"tag1\").setIndicator(\"질병\")\n//\t\t//\t\t.setContent(new Intent(this, exit.class)));\n//\t\ttabhost.addTab(tabhost.newTabSpec(\"tag1\").setIndicator(\"설정\")\n//\t\t\t\t.setContent(new Intent(this, Setting.class)));\n\n\t\t\n // NotificationManager 객체를 생성한다. NotificationManager는 시스템 서비스이므로,\n // getSystemService() 메서드를 이용해 객체를 얻는다.\n NotificationManager notifier =\n (NotificationManager) getSystemService(\n \t\tContext.NOTIFICATION_SERVICE);\n\n // Notification 객체를 생성하고,\n // 알림 발생시 상태 바에 표시할 아이콘, ticker-text, 알림 발생 시각을 지정한다.\n notify =\n new Notification(R.drawable.allsbu, \"올스\", System.currentTimeMillis());\n \n notify.flags = Notification.FLAG_ONGOING_EVENT; // flag에서 속성 바꿈 .\n\n // 알림 메세지의 확장 텍스트를 클릭한 경우, 실행할 액티비티를 인텐트로 지정한다.\n Intent intent2 = new Intent(this, SiProjectActivity.class);\n PendingIntent launchIntent =\n PendingIntent.getActivity(this, 0, intent2, 0);\n\n // setLatestEventInfo() 메서드를 사용해 알림 메세지에 대한 제목과 내용을 표시하고,\n // 알림 메세지의 확장 텍스트를 클릭한 경우 인텐트를 넘겨 지정된 액티비티를 실행한다.\n notify.setLatestEventInfo(this,\n \"올스\", \"올바른 스마트생활\", launchIntent);\n\n // 알림 횟수를 지정한다.\n // notify.number = 4;\n\n // notify() 메서드로, NotificationManager에 Notification 객체를 넘겨\n // 알림 메세지를 표시한다.\n notifier.notify(NOTIFY_1, notify);\n //Intent intent2=new Intent(this,exit.class);\n\t}", "@RequiresApi(api = Build.VERSION_CODES.O)\n @Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n Intent notificationIntent = new Intent(this, MainActivity.class);\n\n PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,\n notificationIntent, 0);\n\n Notification notification = new Notification.Builder(this, CHANNEL_ID)\n .setContentTitle(\"New mail from \" )\n .setContentText(\"acacsc\")\n .setSmallIcon(R.drawable.exo_controls_pause)\n //.setLargeIcon(aBitmap)\n .setContentIntent(pendingIntent)\n .build();\n\n\n startForeground(1, notification);\n\n return START_NOT_STICKY; //or return START_REDELIVER_INTENT;\n }", "public void startAlarm() {\n\n vibri.vibrate(pattern, 0);\n ringring.play();\n timer.cancel();\n }", "public void scheduleAlarm()\n {\n hour = timePicker.getCurrentHour(); //get hour\n minute = timePicker.getCurrentMinute(); //get minutes\n alarmMgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n Intent intent = new Intent(getApplicationContext(), AlarmReceiver.class);\n alarmIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0);\n\n Calendar calendar = Calendar.getInstance();\n calendar.setTimeInMillis(System.currentTimeMillis());\n calendar.set(Calendar.HOUR_OF_DAY, hour);\n calendar.set(Calendar.MINUTE, minute);\n\n alarmMgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),\n AlarmManager.INTERVAL_DAY, alarmIntent);\n Toast.makeText(this, \"Alarm scheduled for \" + hour + \":\" + minute, Toast.LENGTH_SHORT).show();\n\n }", "public static void createDailyReminderAlarm(Context context) {\n String prefWeekendDayStart = PreferenceUtils.readString(PreferenceUtils.SNOOZE_WEEKEND_DAY_START, context);\n int weekendDayStartHour = TimePreference.getHour(prefWeekendDayStart);\n int weekendDayStartMinute = TimePreference.getMinute(prefWeekendDayStart);\n\n // Create reminders intent.\n PendingIntent alarmIntent = getRemindersIntent(context, Intents.DAILY_REMINDER);\n\n // Trigger the alarm.\n triggerDailyAlarm(context, weekendDayStartHour, weekendDayStartMinute, alarmIntent);\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n context.startService(new Intent(context, OnBootUpAlarmScheduler.class));\n }", "private void showNotification() {\n\n Intent intent = new Intent(this, DashboardActivity.class);\n TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);\n stackBuilder.addParentStack(DashboardActivity.class);\n stackBuilder.addNextIntent(intent);\n\n final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);\n\n builder.setSmallIcon(R.drawable.ic_gps);\n builder.setContentText(getText(R.string.local_service_started));\n builder.setContentTitle(getText(R.string.local_service_label));\n builder.setOngoing(true);\n builder.setContentIntent(stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT));\n\n final Notification notification = builder.build();\n\n // Send the notification.\n mNotificationManager.notify(NOTIFICATION, notification);\n }", "Alarm createAlarm();", "private void scheduleNotification(Notification notification) {\n\n Intent notificationIntent2 = new Intent(MainActivity.this, NotificationPublisher.class);\n notificationIntent2.putExtra(NotificationPublisher.NOTIFICATION_ID, 1);\n notificationIntent2.putExtra(NotificationPublisher.NOTIFICATION, notification);\n PendingIntent pendingIntent2 = PendingIntent.getBroadcast(MainActivity.this, 0, notificationIntent2, PendingIntent.FLAG_UPDATE_CURRENT);\n Date date = new Date();\n\n Calendar calnoti = Calendar.getInstance();\n calnoti.setTime(date);\n\n calnoti.set(Calendar.HOUR_OF_DAY, mHour-1);\n calnoti.set(Calendar.MINUTE, mMin);\n calnoti.set(Calendar.SECOND, 0);\n calnoti.set(Calendar.YEAR,mYear);\n calnoti.set(Calendar.MONTH,mMonth);\n calnoti.set(Calendar.DAY_OF_MONTH,mDay);\n //long futureInMillis2 = SystemClock.elapsedRealtime() + delay;\n AlarmManager alarmManager2 = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n alarmManager2.set(AlarmManager.RTC_WAKEUP, calnoti.getTimeInMillis(), pendingIntent2);\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n AppUtils.setMorningAlarm(context);\n }", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n Intent notificationIntent = new Intent(this, MainActivity.class);\n PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);\n\n Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.psych_green_2);\n Palette palette = Palette.from(icon).generate();\n\n Notification notification = new Notification.Builder(this)\n .setSmallIcon(R.mipmap.ic_launcher)\n .setContentTitle(\"Headliner\")\n .setContentText(\"This is a headliner notification.\")\n .setLargeIcon(icon)\n .setContentIntent(pendingIntent)\n .setTicker(\"This is the ticker.\")\n .setOngoing(true)\n .setColorized(true)\n .setColor(palette.getLightVibrantColor(Color.BLACK))\n .setStyle(new Notification.MediaStyle())\n .setChannel(\"emergency\")\n .build();\n startForeground(HEADLINER_NOTIFICATION_ID, notification);\n\n return START_STICKY;\n }", "public void scheduleAlarm() {\n Intent intent = new Intent(getApplicationContext(), MyAlarmReceiver.class);\n\n // Create a PendingIntent to be triggered when the alarm goes off\n final PendingIntent pendingIntent = PendingIntent.getBroadcast(this, MyAlarmReceiver.REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n long firstMillis = System.currentTimeMillis(); // alarm is set right away\n\n AlarmManager alarm = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);\n\n // First parameter is the type: ELAPSED_REAL_TIME, ELAPSED_REAL_TIME_WAKEUP, RTC_WAKEUP\n // Interval can be INTERVAL_FIFTEEN_MINUTES, INTERVAL_HALF_HOUR, INTERVAL_HOUR, INTERVAL_DAY\n try {\n alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, firstMillis, 5000L, pendingIntent);\n } catch (NullPointerException e) {\n e.printStackTrace();\n }\n\n }", "public void configureAlarmManager() {\n Boolean enable = sharedPreferences.getBoolean(EXTRA_ENABLE_NOTIF,false);\n\n if(enable){\n AlarmManager alarmMgr = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);\n Intent intent = new Intent(getApplicationContext(), AlarmReceiver.class);\n intent.putExtra(EXTRA_USER_ID, mCurrentUser.getUid()); // attach the userId to the intent\n PendingIntent alarmIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n // Set the alarm to start at 12:00.\n Calendar calendar = Calendar.getInstance();\n calendar.setTimeInMillis(System.currentTimeMillis());\n calendar.set(Calendar.HOUR_OF_DAY, 12);\n calendar.set(Calendar.MINUTE, 0);\n\n // setRepeating() lets you specify a precise custom interval\n if (alarmMgr != null)\n alarmMgr.setRepeating(AlarmManager.RTC, calendar.getTimeInMillis(),\n AlarmManager.INTERVAL_DAY, alarmIntent);\n }\n }", "public static void startAlarms(Context context) {\n\t\t\t\n\t\t\t// Start the alarm for communication with the TDS\n\t\t\tif(PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.prefTDSCommunication), \n\t\t\t\t\tConstants.TDS_DEFAULT_ON)==true){\n\t\t\t\t\n\t\t\t\tnew TDSAlarm(context, Constants.TDS_UPDATE_INTERVAL);\n\t\t\t}\t\t\n\t\t\t\n\t\t\tif(PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.prefDisasterMode), \n\t\t\t\t\tConstants.DISASTER_DEFAULT_ON)==true){\n\t\t\t\t\n\t\t\t\tnew ScanningAlarm(context,false);\n\t\t\t}\t\t\n\t\t\t\n\t\t\t//start the twitter update alarm\n\t\t\tif(PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.prefRunAtBoot), \n\t\t\t\t\tConstants.TWEET_DEFAULT_RUN_AT_BOOT)==true){\n\t\t\t\t\n\t\t\t\tnew TwitterAlarm(context,true);\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t}", "@Override\r\n public void onClick(View v) {\n Intent intent = new Intent(Intent.ACTION_VIEW);\r\n intent.addCategory(Intent.CATEGORY_DEFAULT);\r\n intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK /*| Intent.FLAG_ACTIVITY_CLEAR_TASK*/\r\n /* | Intent.FLAG_ACTIVITY_TASK_ON_HOME*/);\r\n intent.setDataAndType(Uri.parse(\"content://com.android.calendar/\"), \"time/epoch\");\r\n mContext.startActivity(intent);\r\n// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){\r\n// mContext.startActivity(new Intent(AlarmClock.ACTION_SHOW_ALARMS));\r\n// }else {\r\n// mContext.startActivity(new Intent(AlarmClock.ACTION_SET_ALARM));\r\n// }\r\n }", "private void showNotification() {\r\n\t\t// In this sample, we'll use the same text for the ticker and the\r\n\t\t// expanded notification\r\n\t\tCharSequence text = getText(R.string.local_service_started);\r\n\r\n\t\t// Set the icon, scrolling text and timestamp\r\n\t\tNotification notification = new Notification(R.drawable.service_icon,\r\n\t\t\t\ttext, System.currentTimeMillis());\r\n\r\n\t\t// The PendingIntent to launch our activity if the user selects this\r\n\t\t// notification\r\n\t\tPendingIntent contentIntent = PendingIntent.getActivity(this, 0,\r\n\t\t\t\tnew Intent(this, stopServiceJ.class), 0);\r\n\r\n\t\t// Set the info for the views that show in the notification panel.\r\n\t\tnotification.setLatestEventInfo(this, getText(R.string.service_name),\r\n\t\t\t\ttext, contentIntent);\r\n\r\n\t\t// Send the notification.\r\n\t\t// We use a layout id because it is a unique number. We use it later to\r\n\t\t// cancel.\r\n\t\tmNM.notify(R.string.local_service_started, notification);\r\n\t}", "public void sendMessage(View v) {\n /*\n\n Intent intent = new Intent(this, DisplayMessageActivity.class);\n EditText editText = (EditText) findViewById(R.id.edit_message);\n String message = editText.getText().toString();\n intent.putExtra(EXTRA_MESSAGE, message);\n startActivity(intent);\n\n */\n long time = currentTimeMillis();\n Date d1 = new Date();\n Date d2;\n // d2 = new Date(d1.getYear(),d1.getMonth(),d1.getDate(),d1.getHours(),d1.getMinutes(),d1.getSeconds());\n Toast.makeText(this, \"ALARM ON\", Toast.LENGTH_SHORT).show();\n // Calendar calendar = Calendar.getInstance();\n // calendar.set(Calendar.HOUR_OF_DAY, alarmTimePicker.getCurrentHour());\n // calendar.set(Calendar.MINUTE, alarmTimePicker.getCurrentMinute());\n alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n Intent intent = new Intent(MainActivity.this, AlarmReceiver.class);\n pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);\n Calendar calendar = Calendar.getInstance();\n calendar.setTimeInMillis(System.currentTimeMillis());\n // Set the alarm's trigger time to 8:30 a.m.\n calendar.set(Calendar.HOUR_OF_DAY, 14);\n calendar.set(Calendar.MINUTE, 58);\n Toast.makeText(MainActivity.this, \"bjr\", Toast.LENGTH_SHORT).show();\n // alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, time + 5, 10000, pendingIntent);\n alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), pendingIntent);\n // Bon manque de prevenir le receiver....!!\n\n }", "@Override\r\n\tpublic int onStartCommand(Intent intent, int flags, int startId) {\n\t\tBundle b = intent.getExtras();\r\n\t\tint id = 0;\r\n\r\n\t\tif ((id = b.getInt(AlarmFactory.ARG_NEWS_ID, -1)) >= 0) {\r\n\t\t\t// Toast.makeText(this, \"\"+id, Toast.LENGTH_SHORT).show();\r\n\t\t\tnew UpdateSourceTask(this, handler).execute(id, UpdateSourceTask.ALARM_TRIGER);\r\n\r\n\t\t}\r\n\t\treturn mStartMode;\r\n\t}", "public void setAlarms()\n\t{\n\t\tSharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());\n\t\tAlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n\t\t\n\t\tSet<String> set;\n\t\tset=sp.getStringSet(\"lowattnotifs\", null);\n\t\tif(set!=null)\n\t\t{\n\t\t\tCalendar cal = Calendar.getInstance();\n\t\t\tcal.set(Calendar.HOUR_OF_DAY, 19);\n\t\t\tcal.set(Calendar.MINUTE, 0);\n\t\t\tcal.set(Calendar.SECOND, 0);\n\t\t\t\n\t\t\tIntent attintent = new Intent(this, Monitor.class);\n\t\t\tattintent.putExtra(\"attordate\", 0);\n\t\t\tPendingIntent attpintent = PendingIntent.getService(this, 0, attintent, 0);\n\t\t\t\n\t\t\talarm.cancel(attpintent);\t\t//cancel all alarms for attendance reminders\n\t\t\t\n\t\t\t//check if set contains these days\n\t\t\tfor(int i=0; i<7; i++)\n\t\t\t{\n\t\t\t\tif(set.contains(String.valueOf(i)))\n\t\t\t\t{\n\t\t\t\t\tcal.set(Calendar.DAY_OF_WEEK, i);\n\t\t\t\t\talarm.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), attpintent);\n\t\t\t\t\tToast.makeText(getApplicationContext(), \"Set for day: \"+i, Toast.LENGTH_SHORT).show();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\n protected void onHandleIntent(Intent intent) {\n\t Log.i(TAG,\"Alarm Service has started.\");\n Context context = this.getApplicationContext();\n notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);\n Intent mIntent = new Intent(this, MainActivity.class);\n Bundle bundle = new Bundle(); \n bundle.putString(\"test\", \"test\");\n mIntent.putExtras(bundle);\n\t\tpendingIntent = PendingIntent.getActivity(context, 0, mIntent, PendingIntent.FLAG_UPDATE_CURRENT); \n\t\t\n\t\tResources res = this.getResources();\n\t\tNotificationCompat.Builder builder = new NotificationCompat.Builder(this);\n\n\t\tbuilder.setContentIntent(pendingIntent)\n\t\t .setSmallIcon(R.drawable.ic_launcher)\n\t\t .setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.ic_launcher))\n\t\t .setTicker(res.getString(R.string.notification_title))\n\t\t .setAutoCancel(true)\n\t\t .setContentTitle(res.getString(R.string.notification_title))\n\t\t .setContentText(res.getString(R.string.notification_subject));\n\n\t\tnotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);\n\t\tnotificationManager.notify(NOTIFICATION_ID, builder.build());\n\t\tLog.i(TAG,\"Notifications sent.\");\n\t\tMyAlarm app = (MyAlarm)getApplicationContext();\n\t\tapp.incrementCount();\n\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == 1) {\n if (resultCode == RESULT_CANCELED) { // if the user decided to disable notification, whereas it was enabled when opening settings\n AlarmManager alarm = (AlarmManager) getApplicationContext().getSystemService(ALARM_SERVICE);\n PendingIntent pending = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(getApplicationContext(), AlarmReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);\n\n if (alarm != null) {\n alarm.cancel(pending);\n pending.cancel();\n }\n }\n } else {\n if (resultCode == RESULT_FIRST_USER) { // if the user has enabled notif, whereas it was disabled when opening settings\n configureAlarmManager();\n }\n }\n recreate_fragments();\n }", "public static void scheduleRepeatingElapsedNotification15(Context context) {\n\n\n // Setting intent to class where notification will be handled\n Intent intent = new Intent(context, AlarmReceiver.class);\n\n // Setting pending intent to respond to broadcast sent by AlarmManager everyday at 8am\n alarmIntentElapsed = PendingIntent.getBroadcast(context, ALARM_TYPE_ELAPSED, intent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n // Getting instance of AlarmManager service\n alarmManagerElapsed = (AlarmManager)context.getSystemService(ALARM_SERVICE);\n\n // Daily inexact alarm from phone boot - current set to test for 10 seconds\n alarmManagerElapsed.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), 60000 * 15, alarmIntentElapsed);\n }", "public NotificationCompat.Builder getChannel1Notification(String message){\n\n Intent confirmIntent = new Intent(this, Alarm2Activity.class); //can create an activity here that simply says \"Take med\"\n confirmIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n confirmIntent.setAction(YES_ACTION);\n\n Intent openAppIntent = new Intent(this, MedicineActivity.class); //can create an activity here that simply says \"Take med\"\n openAppIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n\n //processIntentAction(getIntent()); //where to put this???\n\n NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext(), Channel1_ID)\n .setContentTitle(getString(R.string.med_notif_title))\n .setContentText(message)\n .setContentIntent(PendingIntent.getActivity(this, REQUEST_CODE, openAppIntent, PendingIntent.FLAG_UPDATE_CURRENT))\n .setSmallIcon(R.drawable.ic_blur_circular_black_24dp) //setLargeIcon as a picture of a pill\n .addAction(new NotificationCompat.Action(\n R.drawable.ic_blur_circular_black_24dp,\n getString(R.string.confirm_med_taken),\n PendingIntent.getActivity(this, REQUEST_CODE, confirmIntent, PendingIntent.FLAG_UPDATE_CURRENT)))\n .setCategory(NotificationCompat.CATEGORY_REMINDER)\n .setAutoCancel(true);\n //.setTimeOutAfter()\n //.setStyle(new NotificationCompat.BigTextStyle().bigText(context.getString(message)))\n //.setColor(ContextCompat.getColor(context, R.color.colorPrimary))\n //.setTimeOutAfter();\n\n if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.O){\n notificationBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);\n }\n\n return notificationBuilder;\n }", "private void showNotification() {\r\n\t\t// In this sample, we'll use the same text for the ticker and the\r\n\t\t// expanded notification\r\n\t\tCharSequence text = getText(R.string.local_service_started);\r\n\r\n\t\t// Set the icon, scrolling text and timestamp\r\n\t\tNotification notification = new Notification(R.drawable.compass25,\r\n\t\t\t\ttext, System.currentTimeMillis());\r\n\t\tnotification.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\r\n\t\t// The PendingIntent to launch our activity if the user selects this\r\n\t\t// notification\r\n\t\tIntent intent = new Intent(this, TaskOverViewActivity.class);\r\n\t\t//intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);\r\n\t\tPendingIntent contentIntent = PendingIntent.getActivity(this, 0,\r\n\t\t\t\tintent, PendingIntent.FLAG_UPDATE_CURRENT);\r\n\r\n\t\t// Set the info for the views that show in the notification panel.\r\n\t\tnotification.setLatestEventInfo(this, getText(R.string.service_name),\r\n\t\t\t\ttext, contentIntent);\r\n\r\n\t\t// Send the notification.\r\n\t\t// We use a layout id because it is a unique number. We use it later to\r\n\t\t// cancel.\r\n\t\tmNM.notify(R.string.local_service_started, notification);\r\n\t}", "private void setAlarm(Alarm alarm, int flags) {\n // this set alarm based on TimePicker so we need to set Calendar like the\n // trigger time\n // get instant of Calendar\n Calendar myCalendar = Calendar.getInstance();\n Calendar calendar = (Calendar) myCalendar.clone();\n // set current hour for calendar\n calendar.set(Calendar.HOUR_OF_DAY, alarm.getHour_x());\n // set current minute\n calendar.set(Calendar.MINUTE, alarm.getMinute_x());\n // set current second for calendar\n calendar.set(Calendar.SECOND, 0);\n // plus one day if the time set less than the the Calendar current time\n if (calendar.compareTo(myCalendar) <= 0) {\n calendar.add(Calendar.DATE, 1);\n }\n // get id of alarm and set for PendingIntent to multiply multiple PendingIntent for cancel\n // time, this also put into PendingIntent to compare with the cancel Alarm's id=\n int alarmId = (int) alarm.getId();\n // make intent to broadCast\n Intent intent = new Intent(AlarmsetActivity.this, AlarmReceiver.class);\n // put intent type to check which intent trigger add or cancel\n intent.putExtra(\"intentType\", Constants.ADD_INTENT);\n // put id to intent\n intent.putExtra(\"PendingId\", alarmId);\n // this pendingIntent include alarm id to manage\n PendingIntent alarmIntent = PendingIntent.getBroadcast(AlarmsetActivity.this, alarmId,\n intent, flags);\n // create alarm manager ALARM_SERVICE\n AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);\n // Set alarm, at the trigger time \"calandar.getTimeInMillis\" this pendingIntent will be\n // sent to AlarmReceiver and then sent to alarm service to play music\n // this \"AlarmManager.INTERVAL_DAY\" mean this will set one new alarm at the trigger time\n // setInExactRepeating this may set alarm again and again also this may be not\n // trigger at the right time( at the first second start) but this will save the battery.\n // \"AlarmManager.RTC_WAKEUP\" allow this app wake device from idle time and the time\n // based on device time\n\n alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,\n calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, alarmIntent);\n\n }", "@Override\n public void onClick(View v) {\n\n if(wake!=null && sleep!=null){\n int id= db.insertSleepReminder(\"\"+sleep.getTimeInMillis(),\"\"+wake.getTimeInMillis());\n Intent intent = new Intent(AddSleep.this, UnlockReceiver.class);\n intent.putExtra(\"wake_up\",\"\"+wake.getTimeInMillis());\n intent.putExtra(\"sleep\",\"\"+sleep.getTimeInMillis());\n intent.putExtra(\"id\",\"\"+id );\n\n PendingIntent intent1 = PendingIntent.getBroadcast(AddSleep.this,id,intent,PendingIntent.FLAG_UPDATE_CURRENT);\n AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);\n alarmManager.setExact(AlarmManager.RTC, sleep.getTimeInMillis(),intent1);\n\n intent = new Intent(AddSleep.this, WakeUpReceiver.class);\n intent.putExtra(\"wake_up\",\"\"+wake.getTimeInMillis());\n intent.putExtra(\"sleep\",\"\"+sleep.getTimeInMillis());\n intent.putExtra(\"id\",\"\"+id);\n\n intent1 = PendingIntent.getBroadcast(AddSleep.this,id,intent,PendingIntent.FLAG_UPDATE_CURRENT);\n\n alarmManager.setExact(AlarmManager.RTC, wake.getTimeInMillis(),intent1);\n\n Intent intent2 = new Intent(AddSleep.this,Reminder.class);\n startActivity(intent2);\n finish();} else\n {\n Toast.makeText(AddSleep.this,\"Please,Enter Sleep and Wake Up Time!\",Toast.LENGTH_SHORT).show();\n\n }\n\n\n }", "private void sendHeadlinerNotification() {\n startService(new Intent(this, ForegroundNotificationService.class));\n }", "public static void startActionNotification(Context context, int interval) {\n Intent intent = new Intent(context, NotificationIntentService.class);\n intent.setAction(ACTION_NOTIFICATION);\n context.startService(intent);\n alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);\n alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(),\n TimeUnit.MINUTES.toMillis(interval), PendingIntent.getService(context,0,intent, 0));\n }", "public static void scheduleRestartOfService(Context context)\n\t{\n\t\tCalendar cal = Calendar.getInstance();\n\t\t// add frequency hours to the calendar object\n\t\tcal.add(Calendar.HOUR, 24);\n\t\t//cal.add(Calendar.MINUTE, 5);\n\n\t\tPendingIntent pendingIntent = PendingIntent.getService(context, 0, \n\t\t\t\tnew Intent(\"org.bewellapp.ServiceControllers.BestSleepLib.BestSleepComputationService\"), PendingIntent.FLAG_CANCEL_CURRENT);\n\n\t\t// Get the AlarmManager service\n\t\tAlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n\t\tam.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);\n\t}", "@Override\n public void onClick(View arg0) {\n Intent intent = new Intent(Main2Activity.this, com.sha.location.NotifyService.class);\n Main2Activity.this.startService(intent);\n }", "protected void recurringAlert() {\n\n AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(DeviceTrackerApplication.getContext());\n alertDialogBuilder.setTitle(getString(R.string.app_name));\n alertDialogBuilder\n .setMessage(R.string.user_not_logged_in)\n .setCancelable(false)\n .setPositiveButton(R.string.ok_msg, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n if (!Utils.isAppInForeground(LoggedInCheckService.this)) {\n Intent intent = new Intent(LoggedInCheckService.this, SplashActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\n startActivity(intent);\n }\n }\n });\n alertDialog = alertDialogBuilder.create();\n alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);\n\n if (timer2 != null) {\n timer2.cancel();\n }\n\n timer2 = new Timer();\n long alertInterval = getSharedPreferences(Utility.SETTINGS_SHARED_PREFERENCE, Context.MODE_PRIVATE).getInt(Utility.ALERT_INTERVAL, 2) * 60 * 1000;\n timer2.scheduleAtFixedRate(new TimerTask() {\n @Override\n public void run() {\n Handler handler = new Handler(Looper.getMainLooper()) {\n @Override\n public void handleMessage(Message msg) {\n alertDialog.show();\n }\n };\n Message message = handler.obtainMessage();\n message.sendToTarget();\n }\n }, alertInterval , alertInterval);\n\n }", "@Override\n public void onStart(Intent intent, int startId) {\n \tsuper.onStart(intent, startId);\n \t\n \t//Notification(intent.getStringExtra(\"text\"));\n \tspokenText = \"\";\n \tspokenText += intent.getStringExtra(\"text\")+\"\";\n \n \t\n \tmTts = new TextToSpeech(this, this);\n \tToast.makeText(this, \"MyAlarmService.onStart()\"+spokenText, Toast.LENGTH_LONG).show();\n \t\n \n }", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n super.onStartCommand(intent, flags, startId);\n // Tapping the notification will open the specified Activity.\n// Intent activityIntent = new Intent(this, MainActivity.class);\n if (intent == null)\n intent = new Intent(this, RNTrafficStatsModule.class);\n\n pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0,\n intent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n // This always shows up in the notifications area when this Service is running.\n not = new Notification.Builder(this).\n setContentTitle(\"TrueService\").\n setContentText(\"Running Speed Tests\")\n .setSmallIcon(R.drawable.random_pic).\n setContentIntent(pendingIntent).\n// addAction(action).\n build();\n startForeground(1, not);\n\n // Other code goes here...\n\n return START_REDELIVER_INTENT;//super.onStartCommand(intent, flags, startId);\n }", "private void setAlarmManager() {\n\t\tLog.d(CommonUtilities.TAG, \"Set alarm manager\");\n\n\t\tIntent i = new Intent(this, MatchimiAlarmReceiver.class);\n\t\tPendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);\n\n\t\tCalendar calendar = Calendar.getInstance();\n\t\tcalendar.setTimeInMillis(System.currentTimeMillis());\n\t\tcalendar.add(Calendar.MINUTE, 1);\n\n\t\tAlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);\n\t\tam.cancel(pi); // cancel any existing alarms\n\t\tam.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),\n\t\t\t\t1000 * 60 * 60, pi);\n\n\t\t// am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,\n\t\t// SystemClock.elapsedRealtime() +\n\t\t// AlarmManager.INTERVAL_FIFTEEN_MINUTES,\n\t\t// AlarmManager.INTERVAL_DAY, pi);\n\t}", "private void showNotification() {\n // In this sample, we'll use the same text for the ticker and the expanded notification\n CharSequence text = \"Siguiendo el trayecto\";\n\n // The PendingIntent to launch our activity if the user selects this notification\n PendingIntent contentIntent = PendingIntent.getActivity(this, 0,\n new Intent(this, InformacionServicio.class), 0);\n\n // Set the info for the views that show in the notification panel.\n Notification notification = new Notification.Builder(this)\n .setSmallIcon(R.drawable.estrella_full) // the status icon\n .setTicker(text) // the status text\n .setWhen(System.currentTimeMillis()) // the time stamp\n .setContentTitle(\"Conductor Serv\") // the label of the entry\n .setContentText(text) // the contents of the entry\n .setContentIntent(contentIntent) // The intent to send when the entry is clicked\n .build();\n\n // Send the notification.\n //mNM.notify(55, notification);\n //startForeground(56,notification);\n\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)\n startMyOwnForeground();\n else\n startForeground(1, notification);\n\n }", "private void showReminderNotification(Context context) {\n // inisialisasi channel id, channel name, judul notifikasi, pesan notifikasi, intent, dan id request\n String CHANNEL_ID = \"Channel_1\";\n String CHANNEL_NAME = \"Reminder Channel App\";\n String title = context.getString(R.string.reminder_app_title);\n String message = context.getString(R.string.reminder_app_message);\n Intent intent = new Intent(context, MainActivity.class);\n int REQUST_CODE_APP = 110;\n\n PendingIntent pendingIntent = TaskStackBuilder.create(context)\n .addNextIntent(intent)\n .getPendingIntent(REQUST_CODE_APP, PendingIntent.FLAG_UPDATE_CURRENT);\n\n // statement ini berfungsi untuk membuat notifikasi kita dapat berkerja dengan sistem android\n NotificationManager notificationManager\n = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);\n\n // mengset bunyi notifikasi, disini menggunakan bunyi default notifikasi pada sistem android\n Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n\n // method ini berfungsi untuk mengatur isi notifikasi\n NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID)\n .setSmallIcon(R.drawable.ic_notifications_black_24dp) // set icon kecil notifikasi\n .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), // set icon besar notifikasi\n R.drawable.baseline_notification_important_white_48dp))\n .setContentTitle(title) // set judul notifikasi\n .setContentText(message) // set pesan notifikasi\n .setContentIntent(pendingIntent) // set aksi notifikasi\n .setVibrate(new long[]{1000, 1000, 1000, 1000, 1000}) // set pola getar saat notifikasi\n .setSound(alarmSound); // set bunyi notifikasi yang akan digunakan\n\n // statement ini berfungsi supaya notifikasi yang telah dibuat dapat berjalan di android\n // dengan OS Oreo ke atas\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n\n NotificationChannel channel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME,\n NotificationManager.IMPORTANCE_DEFAULT);\n\n channel.enableVibration(true);\n channel.setVibrationPattern(new long[]{1000, 1000, 1000, 1000, 1000});\n\n builder.setChannelId(CHANNEL_ID);\n if (notificationManager != null) {\n notificationManager.createNotificationChannel(channel);\n }\n }\n\n // statement ini berfungsi supaya notifikasi yang telah dibuat dapat berjalan di bawah\n // android dengan OS Oreo ke bawah\n Notification notification = builder.build();\n if (notificationManager != null) {\n notificationManager.notify(ID_APP, notification);\n }\n }", "private void showNotification() {\n // In this sample, we'll use the same text for the ticker and the expanded notification\n CharSequence text = getText(R.string.local_service_started);\n\n // Set the icon, scrolling text and timestamp\n Notification notification = new Notification(R.drawable.icon, text,\n System.currentTimeMillis());\n\n // The PendingIntent to launch our activity if the user selects this notification\n PendingIntent contentIntent = PendingIntent.getActivity(this, 0,\n new Intent(this, ServiceActivity.class), 0);\n\n // Set the info for the views that show in the notification panel.\n notification.setLatestEventInfo(this, getText(R.string.local_service_label),\n text, contentIntent);\n\n // Send the notification.\n mNM.notify(NOTIFICATION, notification);\n }", "public void startAlarm(){\r\n\t\tAlarm alarm = new Alarm(\"magAanvallen\", 1 / aanvallenPerSeconden);\r\n\t\talarm.addTarget(this);\r\n\t\talarm.start();\r\n\t}", "private void forceRestart() {\n\n/*\t\tAlarmManager alarmMgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);\n\t\tlong timeMillis = SystemClock.elapsedRealtime() + 1000; //1 second\n\t\tIntent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());\n\t\tintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\n\t\talarmMgr.set(AlarmManager.ELAPSED_REALTIME, timeMillis, PendingIntent.getActivity(this, 0, intent, 0));*/\n\t\tnew Thread(new Runnable() {\n\t\t\tpublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\tThread.sleep(200);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t}).start();\n\t}", "@Override\n public void onReceive(Context context, Intent intent) {\n Intent ringtoneIntent = new Intent(context, AlarmService.class);\n\n //1. get EXTRA VALUE from \"alarm_intent\"\n String AlarmStatus = intent.getExtras().getString(EXTRA);\n Remind chosenRemind = (Remind) intent.getExtras().get(NEW_REMIND);\n\n Log.d(\"SAMN\", \"test: Alarm Status:: \" + AlarmStatus);\n\n if(AlarmStatus.equals(ALARM_OFF)){\n /*set up Diable receiver*/\n //to \"enable the receiver\": override the manifest\n ComponentName receiver = new ComponentName(context, AlarmReceiver.class);\n PackageManager pm = context.getPackageManager();\n ///--- ///\n\n pm.setComponentEnabledSetting(receiver,\n PackageManager.COMPONENT_ENABLED_STATE_DISABLED,\n PackageManager.DONT_KILL_APP);\n\n Log.d(\"COMPONENT SETTING: \", String.valueOf(pm.getComponentEnabledSetting(receiver)));\n }\n /*else {\n Intent alarmIntent = new Intent(context, AlarmActivity.class);\n alarmIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n context.startActivity(alarmIntent);\n }*/\n\n // 2. pass it to ringtoneIntent to send to RingtonePlayingService\n ringtoneIntent.putExtra(EXTRA, AlarmStatus);\n ringtoneIntent.putExtra(NEW_REMIND, chosenRemind);\n\n //start service ringtone\n context.startService(ringtoneIntent);\n //explain: ringtoneIntent will be sent to RingtonePlayingService => out Extra Value to notice if ALARM IS ON OR OFF?\n }", "private void createScheduledNotification(List<SessionModel> values, int test)\n\t{\n\n\t\t// Get new calendar object and set the date to now\n\t\tCalendar calendar = Calendar.getInstance();\n\t\tcalendar.setTimeInMillis(System.currentTimeMillis());\n\t\t// Add defined amount of days to the date\n\n\t\tgetBaseContext();\n\t\t// Retrieve alarm manager from the system\n\t\tAlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);\n\n\t\tfor (SessionModel element : values) {\n\n\t\t\tString[] ymd = element.getStartDateSplit();\n\t\t\tint month = Integer.parseInt(ymd[0]);\n\t\t\tint date = Integer.parseInt(ymd[1]);\n\t\t\tint year = Integer.parseInt(ymd[2]);\n\n\t\t\tString[] hm = element.getStartTimeSplit();\n\t\t\tint hour = Integer.parseInt(hm[0]);\n\t\t\tint min = Integer.parseInt(hm[1]);\n\n\t\t\tcalendar.set(Calendar.YEAR, year);\n\t\t\tcalendar.set(Calendar.MONTH, month);\n\t\t\tcalendar.set(Calendar.DATE, date);\n\t\t\tcalendar.set(Calendar.HOUR, hour);\n\t\t\tcalendar.set(Calendar.MINUTE, min);\n\n\t\t\tlong secs = calendar.getTimeInMillis();\n\t\t\tsecs -= 600000;\n\t\t\tcalendar.setTimeInMillis(secs);\n\t\t\tLog.w(\"AlarmManager-TDC2014 \", \"Setting Alarm Time : \" + calendar.toString());\n\t\t\tint id = (int) System.currentTimeMillis();\n\t\t\tIntent intent = new Intent(\"net.redirectme.apps.SESSION_NOTIFY\");\n\t\t\tintent.putExtra(android.content.Intent.EXTRA_TEXT, element.getId());\n\t\t\tintent.putExtra(android.content.Intent.EXTRA_TITLE, element.getName());;\n\t\t\tintent.putExtra(android.content.Intent.EXTRA_SUBJECT, element.getAuthor());\n\n\t\t\tint trackIcon = element.getTrackIcon();\n\t\t\tintent.putExtra(android.content.Intent.EXTRA_SHORTCUT_ICON, trackIcon);\n\n\n\t\t\tPendingIntent pendingIntent = PendingIntent.getBroadcast(this, id, intent, PendingIntent.FLAG_ONE_SHOT);\n\t\t\talarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);\n\n\t\t}\n\t\tif(test==1)\n\t\t{\n\t\t\t// 5secs from now\n\t\t\tcalendar.setTimeInMillis(System.currentTimeMillis() + 10000);\n\t\t\tLog.w(\"AlarmManager-TEST \", \"Setting Alarm Time : \" + calendar.getTime());\n\t\t\tint id = (int) System.currentTimeMillis();\n\t\t\tIntent intent = new Intent(\"net.redirectme.apps.SESSION_NOTIFY\");\n\t\t\tlong value = 1;\n\t\t\tintent.putExtra(android.content.Intent.EXTRA_TEXT, value);\n\t\t\tintent.putExtra(android.content.Intent.EXTRA_TITLE, \"Test Session\");;\n\t\t\tintent.putExtra(android.content.Intent.EXTRA_SUBJECT, \"Sanjeev BA\");\n\t\t\tintent.putExtra(android.content.Intent.EXTRA_SHORTCUT_ICON, R.drawable.track_43_general);\n\n\t\t\tPendingIntent pendingIntent = PendingIntent.getBroadcast(this, id, intent, 0);\n\t\t\talarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);\n\t\t}\n\n\t}", "public void setOneTime(View view) {\n Intent intent = new Intent(this, CreateOneTimeAlarm.class);\n startActivity(intent);\n }", "@Override\n public void run() {\n Calendar calendar = Calendar.getInstance();\n SimpleDateFormat simpleDateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");\n String dateTime = simpleDateFormat.format(calendar.getTime());\n\n //Find the current time\n SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat(\"hh:mm:ss a\");\n String currentTime = simpleDateFormat1.format(calendar.getTime());\n\n //Find duration of current date and first day\n Date date1,date2;\n String dateStr1 = data.getDate();\n String dateStr2 = dateTime;\n SimpleDateFormat sdf = new SimpleDateFormat(\"dd/MM/yyyy\");\n try{\n date1 = sdf.parse(dateStr1);\n date2 = sdf.parse(dateStr2);\n long diff = date2.getTime() - date1.getTime();\n long totalDay = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n NotificationChannel channel = new NotificationChannel(\"My Notification\", \"My Notification\", NotificationManager.IMPORTANCE_DEFAULT);\n NotificationManager manager = getSystemService(NotificationManager.class);\n manager.createNotificationChannel(channel);\n }\n\n //Exercise Time\n if(totalDay==0 || totalDay==1 || (totalDay>4+dayInSpace && totalDay<=10+dayInSpace)){\n if (currentTime.equals(\"05:00:00 PM\")) {\n NotificationExercise();\n }\n }\n\n if(totalDay==2){\n if (currentTime.equals(\"08:00:00 PM\")) {\n NotificationExercise();\n }\n }\n\n if(totalDay==3){\n if (currentTime.equals(\"10:00:00 PM\")) {\n NotificationExercise();\n }\n }\n\n if(totalDay>=5 && totalDay<=4+dayInSpace){\n if (currentTime.equals(\"03:00:00 AM\")) {\n NotificationExercise();\n }\n }\n\n //Eating time (After half hour wake up-breakfast, After five hours wake up-lunch, Before four hours sleep-dinner)\n if(totalDay==0 || totalDay==1){\n if (currentTime.equals(\"07:30:00 AM\") || currentTime.equals(\"12:00:00 PM\") || currentTime.equals(\"07:00:00 PM\")) {\n NotificationMeal();\n }\n }\n\n if(totalDay==2){\n if (currentTime.equals(\"08:30:00 AM\") || currentTime.equals(\"01:00:00 PM\") || currentTime.equals(\"10:00:00 PM\")) {\n NotificationMeal();\n }\n }\n\n if(totalDay==3){\n if (currentTime.equals(\"10:30:00 AM\") || currentTime.equals(\"03:00:00 PM\")) {\n NotificationMeal();\n }\n }\n\n if(totalDay==4){\n if (currentTime.equals(\"12:00:00 AM\") || currentTime.equals(\"12:30:00 PM\") || currentTime.equals(\"05:00:00 PM\")) {\n NotificationMeal();\n }\n }\n\n if(totalDay>=5 && totalDay<=4+dayInSpace){\n if (currentTime.equals(\"05:00:00 AM\") || currentTime.equals(\"03:30:00 PM\") || currentTime.equals(\"08:00:00 PM\")) {\n NotificationMeal();\n }\n }\n\n if(totalDay>4+dayInSpace && totalDay<=10+dayInSpace){\n if (currentTime.equals(\"08:30:00 AM\") || currentTime.equals(\"01:00:00 PM\") || currentTime.equals(\"7:00:00 PM\")) {\n NotificationMeal();\n }\n }\n\n //Take Melatonin time\n if(totalDay>=5 && totalDay<5+dayInSpace){\n if (currentTime.equals(\"09:00:00 AM\")) {\n NotificationTakeMelatonin();\n }\n }\n\n if(totalDay>=4+dayInSpace && totalDay<=6+dayInSpace){\n if (currentTime.equals(\"11:00:00 PM\")) {\n NotificationTakeMelatonin();\n }\n }\n\n //Nap time\n if(totalDay>=4 && totalDay<4+dayInSpace){\n if (currentTime.equals(\"06:00:00 PM\")) {\n NotificationNap();\n }\n }\n\n if(totalDay>=4 && totalDay<4+dayInSpace){\n if (currentTime.equals(\"08:00:00 PM\")) {\n NotificationNap();\n }\n }\n\n //Sleep Time\n if(totalDay==0){\n if (currentTime.equals(\"12:00:00 AM\")) {\n NotificationSleep();\n }\n }\n\n if(totalDay==0 || totalDay==1){\n if (currentTime.equals(\"11:00:00 PM\")) {\n NotificationSleep();\n }\n }\n\n if(totalDay==3){\n if (currentTime.equals(\"02:00:00 AM\")) {\n NotificationSleep();\n }\n }\n\n if(totalDay==4){\n if (currentTime.equals(\"04:00:00 AM\")) {\n NotificationSleep();\n }\n }\n\n if(totalDay>=5 && totalDay<5+dayInSpace){\n if (currentTime.equals(\"09:00:00 AM\")) {\n NotificationSleep();\n }\n }\n\n if(totalDay>=4+dayInSpace && totalDay<=10+dayInSpace){\n if (currentTime.equals(\"11:00:00 PM\")) {\n NotificationSleep();\n }\n }\n\n //Wake Up Time\n if(totalDay==0 || totalDay==1){\n if (currentTime.equals(\"07:00:00 AM\")) {\n NotificationWakeUp();\n }\n }\n\n if(totalDay==2){\n if (currentTime.equals(\"08:00:00 AM\")) {\n NotificationWakeUp();\n }\n }\n\n if(totalDay==3){\n if (currentTime.equals(\"10:00:00 AM\")) {\n NotificationWakeUp();\n }\n }\n\n if(totalDay==4){\n if (currentTime.equals(\"12:00:00 PM\")) {\n NotificationWakeUp();\n }\n }\n\n if(totalDay>=5 && totalDay<5+dayInSpace){\n if (currentTime.equals(\"03:00:00 PM\")) {\n NotificationWakeUp();\n }\n }\n\n if(totalDay>=5+dayInSpace && totalDay<=10+dayInSpace){\n if (currentTime.equals(\"08:00:00 AM\")) {\n NotificationWakeUp();\n }\n }\n\n }catch(ParseException e){\n Log.d(\"error\",\"error\");\n }\n }", "public void setRepeatingAlarm(Context context, int type) {\n\n\n Intent intent = new Intent(context, AlarmReceiver.class);\n intent.putExtra(EXTRA_TYPE, type);\n\n String time = \"00:00\";\n if (type == Const.REQUEST_RELEASE_REMINDER) {\n time = Const.TIME_RELEASE_REMINDER;\n } else {\n time = Const.TIME_DAILY_REMINDER;\n }\n String[] timeArray = time.split(\":\");\n\n Calendar calendar = Calendar.getInstance();\n calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(timeArray[0]));\n calendar.set(Calendar.MINUTE, Integer.parseInt(timeArray[1]));\n calendar.set(Calendar.SECOND, 0);\n\n PendingIntent pendingIntent = PendingIntent.getBroadcast(\n context,\n type,\n intent,\n 0);\n\n AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n if (alarmManager != null) {\n alarmManager.setInexactRepeating(\n AlarmManager.RTC_WAKEUP,\n calendar.getTimeInMillis(),\n AlarmManager.INTERVAL_DAY,\n pendingIntent\n );\n\n /*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, 0, pendingIntent);\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n alarmManager.setExact(AlarmManager.RTC_WAKEUP, 0, pendingIntent);\n } else {\n alarmManager.set(AlarmManager.RTC_WAKEUP, 0, pendingIntent);\n }\n */\n\n Log.d(TAG, \"setRepeatingAlarm: Set \" + type + \" = \" + time);\n }\n\n }", "private PendingIntent buildAlarmPendingIntent() {\n Intent intent = new Intent(this, NotificationReceiver.class);\n intent.setAction(NotificationReceiver.ACTION_SEND_NOTIFICATIONS);\n\n return PendingIntent.getBroadcast(this,\n 0,\n intent,\n PendingIntent.FLAG_UPDATE_CURRENT);\n }", "@Override\n public void onClick(View v) {\n SunriseScheduler.rescheduleSunriseAlarm(Main.this, true);\n }", "private void showNotification() {\n\n NotificationCompat.Builder mBuilder =\n new NotificationCompat.Builder(this)\n .setSmallIcon(R.drawable.food_icon2)\n .setContentTitle(\"Let's eat\")\n .setContentText(\"Good morning, It's time to take your Breakfast :)\");\n\n int mNotificationId = 001;\n\n\n Intent contentIntent = new Intent(this, RecommendationActivity.class);\n contentIntent.putExtra(\"dePagi\", \"pagigan\");\n TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);\n stackBuilder.addParentStack(RecommendationActivity.class);\n stackBuilder.addNextIntent(contentIntent);\n\n PendingIntent resultPendingIntent =\n stackBuilder.getPendingIntent(\n 0,\n PendingIntent.FLAG_UPDATE_CURRENT\n );\n mBuilder.setContentIntent(resultPendingIntent);\n\n mBuilder.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });\n mBuilder.setLights(Color.YELLOW, 3000, 3000);\n\n mBuilder.setAutoCancel(true);\n\n mNM =(NotificationManager) getSystemService(NOTIFICATION_SERVICE);\n\n mNM.notify(mNotificationId, mBuilder.build());\n\n stopSelf();\n\n }", "public void onClick(View v) \n\t\t\t{\n\t\t\t\tlong sec = 0,min,hr,ts;\n\t\t\t\tString st;\n\t\t\t\tCalendar cal=Calendar.getInstance();\n\t\t\t\thr=cal.get(cal.HOUR);\n\t\t\t\tmin=cal.get(cal.MINUTE);\n\t\t\t\tsec=cal.get(cal.SECOND);\n\t\t\t\tts=cal.get(cal.AM_PM);\n\t\t\t\tst=ts>0?\"pm\":\"am\";\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\twhile(sec!=40)\n\t\t\t\t{Log.d(\"Toast\",\"\"+sec);\n\t\t\t\t cal=Calendar.getInstance();\n\t\t\t\thr=cal.get(cal.HOUR);\n\t\t\t\tmin=cal.get(cal.MINUTE);\n\t\t\t\tsec=cal.get(cal.SECOND);\n\t\t\t\tts=cal.get(cal.AM_PM);\n\t\t\t\tst=ts>0?\"pm\":\"am\";\n\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\t\n\t\t\t\t{\tNotificationManager nm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);\n\t\t\t\tNotification notify=new Notification(android.R.drawable.stat_notify_chat,\"This isimportant\",System.currentTimeMillis());\n\t\t\t\tIntent in=new Intent(getApplicationContext(),Notifn.class);\n\t\t\t\tPendingIntent pi=PendingIntent.getActivity(getApplicationContext(),0,in,0);\n\t\t\t\tnotify.setLatestEventInfo(getApplicationContext(),\"You have been notified\",\"Continue if you needsbccdcb\",pi);\n\t\t\t\tnotify.sound=Uri.parse(\"android.resource://example.pr1/\"+raw.beep);\n\t\t\t\t\tnm.notify(0,notify);\n\t\t\t\tLog.d(\"Toast\",\"\"+sec+\" Success\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tspeakout(\"Hai hoW ARE YOU\");\n\t\t\t}", "@Override\n\tpublic int onStartCommand(Intent intent, int flags, int startId) {\n\t\tLog.d(\"MyService\", \"onStartCommand() get called\");\n\t\tnew Thread(new Runnable() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t//do the processing logics here\n\t\t\t\tLog.d(\"MyService\", \"executed at \" + new Date().toString());\n\t\t\t\t//stopSelf();\n\t\t\t}\n\t\t}).start();\n\t\t\n\t\tAlarmManager manager = (AlarmManager) getSystemService(ALARM_SERVICE);\n\t\tint anHour = 1000*60*60;// in milliseconds\n\t\tlong triggerTime = SystemClock.elapsedRealtime() + anHour;\n\t\t\n\t\tIntent intent1 = new Intent(this, AlarmReceiver.class);\n\t\tPendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent1, 0);\n\t\tmanager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerTime, pendingIntent);\n\t\t\n\t\treturn super.onStartCommand(intent1, flags, startId);\n\t}", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\tint ind=spinner.getSelectedItemPosition();\n\t\t\t\tString mus=list_uri.get(ind);\n\t\t\t String ic=list_id.get(ind);\n\t\t\t Uri songg=Uri.parse(mus+\"/\"+ic);\n\t\t\t\tIntent ii=new Intent(MainActivity.this,SerTest.class);\n\t\t\t ii.putExtra(\"ringtone-uri\", String.valueOf(songg));\n\t\t\t stopService(ii);\n\t\t\t\tint sid=radio_group.getCheckedRadioButtonId();\n\t\t\t\tradio_button=(RadioButton)findViewById(sid);\n\t\t\t\tString r=radio_button.getText().toString();\n\t\t\t\ttime=System.currentTimeMillis();\n\t\t\t\tcalendar.set(Calendar.HOUR_OF_DAY,alarmTimePicker.getCurrentHour());\n\t\t\t\tcalendar.set(Calendar.MINUTE,alarmTimePicker.getCurrentMinute());\n\t\t\t\tcalendar.set(Calendar.SECOND,0);\n\t\t\t\tlong hl=alarmTimePicker.getCurrentHour();\n\t\t\t\tlong ml=alarmTimePicker.getCurrentMinute();\n\t\t\t\tsong=spinner.getSelectedItemPosition();\n\t\t\t\tString h=String.valueOf(hl);\n\t\t\t\tString m=String.valueOf(ml);\n\t\t\t\tif(h.length()==1)\n\t\t\t\t\th=\"0\"+h;\n\t\t\t\tif(m.length()==1)\n\t\t\t\t\tm=\"0\"+m;\n\n\t\t\t\ti.putExtra(\"Extra\",\"alarm on\");\n\t\t\t\ti.putExtra(\"idd\", String.valueOf(time));\n\t\t\t\ti.putExtra(\"play\", String.valueOf(song));\n\t\t\t\tString vibration=\"no\";\n\t\t\t\tif(checkbok.isChecked()){\n\t\t\t\t\ti.putExtra(\"vib\",\"yes\");\n\t\t\t\t\tvibration=\"yes\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\ti.putExtra(\"vib\",\"no\");\n\t\t\t\tpending_intent=PendingIntent.getBroadcast(MainActivity.this,(int) time,i,PendingIntent.FLAG_UPDATE_CURRENT);\n\t\n\n\t\t\t\tlong time=System.currentTimeMillis();\n\t\t\t\tlong t=calendar.getTimeInMillis();\n\t\t\t\tif(t>=time){\n\n\t\t\t\t\tif(r.equals(\"Once\"))\n\t\t\t\t\t\talarmManager.set(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),pending_intent);\n\t\t\t\t\telse if(r.equals(\"Daily\"))\n\t\t\t\t\t\talarmManager.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),60*1000*24*60,pending_intent);\n\t\t\t\t\telse\n\t\t\t\t\t\talarmManager.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),60*1000*24*60*7,pending_intent);\n\t\t\t\t\tToast.makeText(getApplicationContext(), \"Alarm set at \"+h+\":\"+m+\".\", Toast.LENGTH_LONG).show();\n\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\tif(r.equals(\"Once\"))\n\t\t\t\t\t\t\talarmManager.set(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),pending_intent);\n\t\t\t\t\t\telse if(r.equals(\"Daily\"))\n\t\t\t\t\t\t\talarmManager.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis()+86400000,60*1000*24*60,pending_intent);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\talarmManager.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis()+86400000,60*1000*24*60*7,pending_intent);\n\t\t\t\t\tToast.makeText(getApplicationContext(), \"Alarm set at \"+h+\":\"+m+\" tomorrow.\", Toast.LENGTH_LONG).show();\n\t\t\t\t}\n\t\n\t\t\t\tFirst.db.execSQL(\"INSERT INTO alarm VALUES\"+\"('\"+id+\"','alarm','\"+h+\":\"+m+\"','\"+time+\"','\"+r+\"','\"+vibration+\"','\"+song+\"')\");\n\t\t\t\tIntent back=new Intent(MainActivity.this,First.class);\n\t\t\t\tback.putExtra(\"S\",h+\":\"+m);\n\t\t\t\tstartActivity(back);\n\t\t\t}", "@Override\n public void onStart(Intent intent, int startId) {\n Toast.makeText(this, \" Service Started\", Toast.LENGTH_LONG).show();\n \n }", "@Override\n\n public void onCreate() {\n\n\n Intent notificationIntent = new Intent(this, MainActivity.class);\n\n notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n\n contentIntent = PendingIntent.getActivity(\n\n this, 0, notificationIntent, 0);//gets this activity with permissions and code\n\n\n updateNotification(false);\n\n\n mLocationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);\n //handle the return handle to a system level service\n\n mLocationManager.addGpsStatusListener(this);\n //after handling the system level service then get the gps status\n\n mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 500, 0, this);\n //request location with specific criteria equals to zero, and the provider and this intent\n //and min time\n\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n // setOneTimeAlarm();\n System.out.println(\"inside boot complete\");\n setRepeatingAlarm(context);\n //throw new UnsupportedOperationException(\"Not yet implemented\");\n }", "@Override\n\tpublic void onReceive(Context context, Intent intent) {\n\t\tSharedPreferences mode=PreferenceManager.getDefaultSharedPreferences(context);\n\t\tBundle bundle=intent.getExtras();\n\t\tScheduleProtected schedule=bundle.getParcelable(\"Schedule\");\n\t\tString msg=schedule.getLabel();\n\t\tAudioManager audio=(AudioManager) context.getSystemService(Context.AUDIO_SERVICE);\n\t\t\n\t\tif(mode.getString(\"response\", null)==\"a\")\n\t\t\taudio.setRingerMode(AudioManager.RINGER_MODE_SILENT);\n\t\telse\n\t\t\taudio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);\n\t\t\n\t\tNotificationManager mNotManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);\n\n\t\tString MyText = \"Silent Mode Activated\";\n\t Notification mNotification = new Notification(R.drawable.icon, MyText, System.currentTimeMillis());\n\t \n\t String MyNotifyTitle = \"Diam Leh\";\n String MyNotifiyText = msg+\": Silent Mode Activated\";\n Intent MyIntent = new Intent( context.getApplicationContext(), Main.class);\n \n MyIntent.putExtra(\"extendedTitle\", MyNotifyTitle);\n MyIntent.putExtra(\"extendedText\" , MyNotifiyText);\n PendingIntent StartIntent = PendingIntent.getActivity(context.getApplicationContext(), 0, MyIntent, 0);\n \n mNotification.setLatestEventInfo(context.getApplicationContext(), MyNotifyTitle, MyNotifiyText, StartIntent);\n \n mNotification.ledOnMS = 200; //Set led blink (Off in ms)\n mNotification.ledOffMS = 200; //Set led blink (Off in ms)\n mNotification.ledARGB = 0x9400d3; //Set led color\n \n mNotManager.notify(399940 , mNotification );\n \n\t\tSharedPreferences pref=PreferenceManager.getDefaultSharedPreferences(context);\n\t\tSharedPreferences.Editor editor=pref.edit();\n\t\teditor.putBoolean(\"Mode\", true);\n\t\teditor.putLong(\"RowID\", schedule.getRowId());\n\t\teditor.commit();\n\t}", "@Override\n\tpublic void onReceive(Context context, Intent intent) {\n\t\tfinal AlarmManager alarmManager = (AlarmManager) context\n\t\t\t\t.getSystemService(Context.ALARM_SERVICE);\n\n\t\ttry {\n\t\t\tIntent serviceIntent = new Intent(context, AppTrackingService.class);\n\t\t\tPendingIntent ServiceManagementIntent = PendingIntent.getService(\n\t\t\t\t\tcontext, 111111, serviceIntent, 0);\n\t\t\t/* Alarm Manager her bir saniye de çalışacak */\n\t\t\talarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME,\n\t\t\t\t\tSystemClock.elapsedRealtime(), 1000,\n\t\t\t\t\tServiceManagementIntent);\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t}\n\t}", "private void notifyTaskStarted(int action) {\n Intent intent = new Intent(LocalAction.ACTION_BACKUP_SERVICE_STARTED);\n intent.putExtra(ACTION, action);\n intent.putExtra(CALLER_ID, mCallerId);\n mBroadcastManager.sendBroadcast(intent);\n // update the notification if required\n if (mNotificationBuilder != null) {\n mNotificationBuilder.setContentTitle(getNotificationContentTitle(action, false));\n startForeground(NotificationContract.NOTIFICATION_ID_BACKUP_PROGRESS, mNotificationBuilder.build());\n }\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n\n NotificationChannel notificationChannel = new NotificationChannel(\"CHANNELID\", \"name\", NotificationManager.IMPORTANCE_HIGH );\n NotificationManager notificationManager = context.getSystemService(NotificationManager.class);\n\n notificationManager.createNotificationChannel(notificationChannel);\n\n Intent i = new Intent(context, DisplayMedication.class);\n\n // FIXME - hardcoded values\n i.putExtra(\"MedicationName\",\"Vicodin\" + \"\");\n i.putExtra(\"DoseAmount\",\"1\" + \"\");\n i.putExtra(\"HourlyFrequency\",\"2\" + \"\");\n i.putExtra(\"DaysBetweenDose\",\"7\" + \"\");\n /* <--- above this line ---> */\n\n\n PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);\n\n\n NotificationCompat.Builder builder = new NotificationCompat.Builder(context, \"CHANNELID\")\n .setSmallIcon(R.drawable.icon)\n .setContentTitle(\"Medication Time\")\n .setContentText(\"Time to take a medication\")\n .setPriority(NotificationManager.IMPORTANCE_HIGH)\n .setContentIntent(pendingIntent);\n NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);\n notificationManagerCompat.notify(0, builder.build());\n\n\n }", "private void startPopup(Context context, Long id) {\n\n //Intent emaIntent = new Intent(context, VoiceRecognitionActivity.class); //The activity you want to start.\n //Intent emaIntent = new Intent(context, PopupActivity.class); //The activity you want to start.\n //Log.d(\"Alarm receiver\", \"received intent\");\n Random random = new Random();\n int value = random.nextInt(1);\n Intent emaIntent = new Intent(context, PopupActivity.class);\n emaIntent.putExtra(\"pos\", id);\n\n\n\n// if (value == 1) {\n// emaIntent = new Intent(context, PopupActivity.class); //The activity you want to start.\n// } else {\n// emaIntent = new Intent(context, VoiceRecognitionActivity.class);\n// }\n\n\n\n emaIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n context.startActivity(emaIntent);\n }", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n Notification.Builder builder = new Notification.Builder(getApplicationContext());\n builder.setContentTitle(\"悬浮窗\");\n builder.setContentText(\"悬浮窗正在运行\");\n builder.setSmallIcon(R.mipmap.ic_launcher);\n // builder.setContentIntent(pendingIntent);\n // 设置通知出现时不震动\n builder.setDefaults(NotificationCompat.FLAG_ONLY_ALERT_ONCE);\n builder.setVibrate(new long[]{0});\n builder.setSound(null);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n NotificationChannel channel = new NotificationChannel(\"com.isay.cywu.floatwindow\", \"floatService\",\n NotificationManager.IMPORTANCE_DEFAULT);\n builder.setChannelId(\"com.isay.cywu.floatwindow\");\n // 设置通知出现时震动\n channel.enableVibration(true);\n channel.enableLights(false);\n channel.setVibrationPattern(new long[]{0});\n channel.setSound(null, null);\n //设置channel\n NotificationManager notificationChannel = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\n if (notificationChannel != null) {\n notificationChannel.createNotificationChannel(channel);\n }\n }\n Notification notification = builder.build();\n //如果 id 为 0 ,那么状态栏的 notification 将不会显示。\n startForeground(111, notification);//启动前台服务\n\n return super.onStartCommand(intent, flags, startId);\n }", "@Override\n public void onEnabled(Context context) {\n SetAlarm(context,1,mywidget.class);\n\n }", "public void updateScanFlag() {\n Date when = new Date(System.currentTimeMillis());\n\n try {\n Intent someIntent = new Intent(this, UpdateFlags.class); // intent to be launched\n\n // note this could be getActivity if you want to launch an activity\n PendingIntent pendingIntent = PendingIntent.getBroadcast(\n context,\n 0, // id, optional\n someIntent, // intent to launch\n PendingIntent.FLAG_CANCEL_CURRENT); // PendintIntent flag\n\n AlarmManager alarms = (AlarmManager) context.getSystemService(\n Context.ALARM_SERVICE);\n\n alarms.setRepeating(AlarmManager.RTC_WAKEUP,\n when.getTime(),\n AlarmManager.INTERVAL_FIFTEEN_MINUTES,\n pendingIntent);\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private void startService() {\n\n if (!mAlreadyStartedService ) {\n\n //mMsgView.setText(R.string.msg_location_service_started);\n\n //Start location sharing service to app server.........\n Intent intent = new Intent(this, LocationMonitoringService.class);\n startService(intent);\n\n mAlreadyStartedService = true;\n //Ends................................................\n }\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (IAlarmHelper.FILE_SAVE_SLEEP_ALARM.exists()) {\n\t\t\t\t\tString sleepAlarms = IAlarmHelper.androidFileload(IAlarmOnActivity.this, IAlarmHelper.FILENAME_SAVE_SLEEP_ALARM);\n\t\t\t\t\tsleepAlarms = sleepAlarms + getTime + \"-\";\n\t\t\t\t\tLog.e(\"Save sleeping alarms: \", sleepAlarms);\n\t\t\t\t\tIAlarmHelper.androidFileSave(IAlarmOnActivity.this, IAlarmHelper.FILENAME_SAVE_SLEEP_ALARM, sleepAlarms);\n\t\t\t\t} else {\n\t\t\t\t\tIAlarmHelper.androidFileSave(IAlarmOnActivity.this, IAlarmHelper.FILENAME_SAVE_SLEEP_ALARM, (getTime + \"-\"));\n\t\t\t\t}\n\t\t\t\tstartService(new Intent(IAlarmOnActivity.this, IAlarmSleepService.class));\n\t\t\t\tfinish();\n\t\t\t}", "@Override\n public int onStartCommand(Intent intent, int flags, int startId) {\n Toast.makeText(this, R.string.start_location_updates, Toast.LENGTH_SHORT).show();\n Log.d(Constants.SERVICE_STARTED, Constants.SERVICE_STARTED);\n return START_STICKY;\n }", "public static void scheduleRepeatingElapsedNotification45(Context context) {\n\n\n // Setting intent to class where notification will be handled\n Intent intent = new Intent(context, AlarmReceiver.class);\n\n // Setting pending intent to respond to broadcast sent by AlarmManager everyday at 8am\n alarmIntentElapsed = PendingIntent.getBroadcast(context, ALARM_TYPE_ELAPSED, intent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n // Getting instance of AlarmManager service\n alarmManagerElapsed = (AlarmManager)context.getSystemService(ALARM_SERVICE);\n\n // Daily inexact alarm from phone boot - current set to test for 10 seconds\n alarmManagerElapsed.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), 60000 * 45, alarmIntentElapsed);\n }", "@Override\n public void onReceive(Context context, Intent intent) {\n showReminderNotification(context);\n }", "ConferenceScheduleBuilderService startLunch();", "@Override\n public void onReceive(Context context, Intent intent) {\n setAlarm(context);\n }", "private void showArrivalNotification(String body) {\n\n PendingIntent contentIntent = PendingIntent.getActivity(getBaseContext()\n , 0, new Intent(), PendingIntent.FLAG_ONE_SHOT);\n\n NotificationCompat.Builder builder = new NotificationCompat.Builder(getBaseContext());\n\n builder.setAutoCancel(true).setDefaults(android.app.Notification.DEFAULT_LIGHTS| android.app.Notification.DEFAULT_SOUND)\n .setWhen(System.currentTimeMillis()).setSmallIcon(R.mipmap.ic_launcher)\n .setContentTitle(\"Arrival\").setContentText(body)\n .setContentIntent(contentIntent);\n NotificationManager manager = (NotificationManager)getBaseContext().getSystemService(Context.NOTIFICATION_SERVICE);\n manager.notify(1, builder.build());\n }" ]
[ "0.7934945", "0.7440602", "0.7219896", "0.7058358", "0.70387495", "0.6994804", "0.6904422", "0.69036824", "0.68949753", "0.68466014", "0.6805272", "0.67027146", "0.66863143", "0.66602665", "0.66555625", "0.6651339", "0.6639427", "0.66230667", "0.6618946", "0.6608378", "0.6594523", "0.6593921", "0.6507554", "0.6496097", "0.64883476", "0.64713526", "0.6471041", "0.6440981", "0.6426438", "0.64262617", "0.64002705", "0.63935745", "0.6389436", "0.63693666", "0.63645864", "0.6360563", "0.6360214", "0.63581425", "0.6355659", "0.6335689", "0.6334266", "0.63303655", "0.63253206", "0.631032", "0.63097477", "0.6309372", "0.6295627", "0.629233", "0.62732095", "0.62695134", "0.62676376", "0.6256928", "0.6247666", "0.62465703", "0.6243582", "0.6237769", "0.62356395", "0.62327", "0.62325805", "0.62257755", "0.6220134", "0.62171865", "0.6210113", "0.62083834", "0.61994016", "0.6199068", "0.6197592", "0.6193713", "0.61884665", "0.6182797", "0.61808014", "0.61592126", "0.615022", "0.6148683", "0.6137322", "0.6135663", "0.61312884", "0.6128595", "0.6127111", "0.6126585", "0.61193484", "0.61021674", "0.60872096", "0.6082645", "0.607649", "0.6071153", "0.6068793", "0.60637164", "0.6062148", "0.6060343", "0.60533756", "0.60451186", "0.604098", "0.60394686", "0.60355043", "0.6030394", "0.6029784", "0.6026296", "0.60217845", "0.6018137" ]
0.7379572
2
Writes the provided digital object to the temporary directoy.
private void saveTempFile(DigitalObject object) { String tempFileName = tempDir.getAbsolutePath() + "/" + System.nanoTime(); OutputStream fileStream; try { fileStream = new BufferedOutputStream(new FileOutputStream(tempFileName)); if (object != null) { byte[] data = object.getData().getData(); if (data != null) { fileStream.write(data); } } fileStream.close(); tempFiles.put(object, tempFileName); } catch (FileNotFoundException e) { log.error("Failed to store tempfile", e); } catch (IOException e) { log.error("Failed to store tempfile", e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void writeDigitalObjects(List<Integer> objectIds, String tempDir) throws IOException, StorageException {\n int counter = 0;\n int skip = 0;\n log.info(\"Writing bytestreams of digital objects. Size = \" + objectIds.size());\n for (Integer id : objectIds) {\n if (counter > LOADED_DATA_SIZE_BOUNDARY) { // Call GC if unused data\n // exceeds boundary\n System.gc();\n counter = 0;\n }\n DigitalObject object = em.find(DigitalObject.class, id);\n if (object.isDataExistent()) {\n counter += object.getData().getSize();\n File f = new File(tempDir + object.getId() + \".xml\");\n DigitalObject dataFilledObject = digitalObjectManager.getCopyOfDataFilledDigitalObject(object);\n FileOutputStream out = new FileOutputStream(f);\n try {\n out.write(dataFilledObject.getData().getData());\n } finally {\n out.close();\n }\n dataFilledObject = null;\n } else {\n skip++;\n }\n object = null;\n }\n em.clear();\n System.gc();\n log.info(\"Finished writing bytestreams of digital objects. Skipped empty objects: \" + skip);\n }", "public void writeObject ();", "public void writeObject(Object obj) throws IOException;", "private File writeMoleculeToTemp(IAtomContainer mol, String identifier, int globalCount, String bondEnergy, Integer treeDepth) throws IOException, CDKException\n {\n \tFile temp = File.createTempFile(identifier + \"_\" + globalCount, \".sdf\");\n // Delete temp file when program exits.\n temp.deleteOnExit();\n FileWriter out = new FileWriter(temp);\n SDFWriter mw = new SDFWriter(out);\n IAtomContainer tmp = mol;\n Map<Object, Object> props = mol.getProperties();\n IMolecule test = new Molecule(tmp);\n test.setProperties(props);\n test.setProperty(\"BondEnergy\", bondEnergy);\n test.setProperty(\"TreeDepth\", treeDepth.toString());\n mw.write(test);\n mw.close();\n \n return temp;\n }", "private void writeObject(\n \t\t ObjectOutputStream aOutputStream\n\t\t ) throws IOException {\n\t\t //perform the default serialization for all non-transient, non-static fields\n \t\t aOutputStream.defaultWriteObject();\n \t}", "private void writeToFile(String filename, Object object) {\n try {\n FileOutputStream fileOutputStream = openFileOutput(filename, MODE_PRIVATE);\n ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);\n objectOutputStream.writeObject(object);\n objectOutputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private final FileOutputStream zabz() {\n Serializable serializable = this.zalj;\n if (serializable == null) {\n serializable = new IllegalStateException(\"setTempDir() must be called before writing this object to a parcel\");\n throw serializable;\n }\n Object object = \"teleporter\";\n String string2 = \".tmp\";\n try {\n serializable = File.createTempFile((String)object, string2, (File)serializable);\n }\n catch (IOException iOException) {\n object = new IllegalStateException(\"Could not create temporary file\", iOException);\n throw object;\n }\n try {\n object = new FileOutputStream((File)serializable);\n int n10 = 0x10000000;\n string2 = ParcelFileDescriptor.open((File)serializable, (int)n10);\n this.zalg = string2;\n ((File)serializable).delete();\n return object;\n }\n catch (FileNotFoundException fileNotFoundException) {\n serializable = new IllegalStateException(\"Temporary file is somehow already deleted\");\n throw serializable;\n }\n }", "public void writeTo(Object obj, CodedOutputByteBufferNano codedOutputByteBufferNano) {\n if (this.repeated) {\n writeRepeatedData(obj, codedOutputByteBufferNano);\n } else {\n writeSingularData(obj, codedOutputByteBufferNano);\n }\n }", "private void writeObject(final ObjectOutputStream out) throws IOException {\n try {\n if (location == null) location = IOHelper.serializeData(object);\n IOHelper.writeData(location, new StreamOutputDestination(out));\n } catch (final IOException e) {\n throw e;\n } catch (final Exception e) {\n throw new IOException(e);\n }\n }", "private void writeBinaryObjects(List<Integer> objectIds, String aTempDir)\n throws IOException, StorageException {\n int counter = 0;\n int skip = 0;\n log.info(\"writing XMLs for bytestreams of digital objects. count = \" + objectIds.size());\n for (Integer id : objectIds) {\n if (counter > LOADED_DATA_SIZE_BOUNDARY) { // Call GC if unused data\n // exceeds boundary\n System.gc();\n counter = 0;\n }\n DigitalObject object = em.find(DigitalObject.class, id);\n if (object.isDataExistent()) {\n counter += object.getData().getSize();\n File f = new File(aTempDir + object.getId() + \".xml\");\n DigitalObject dataFilledObject = null;\n dataFilledObject = digitalObjectManager.getCopyOfDataFilledDigitalObject(object);\n writeBinaryData(id, new ByteArrayInputStream(dataFilledObject.getData().getData()), f);\n dataFilledObject = null;\n } else {\n skip++;\n }\n object = null;\n }\n em.clear();\n System.gc();\n log.info(\"Finished writing bytestreams of digital objects. Skipped empty objects: \" + skip);\n }", "String objectWrite();", "public static File writeObjectToTempFile(Serializable o, String filename)\n/* */ throws IOException\n/* */ {\n/* 76 */ File file = File.createTempFile(filename, \".tmp\");\n/* 77 */ file.deleteOnExit();\n/* 78 */ ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file))));\n/* 79 */ oos.writeObject(o);\n/* 80 */ oos.close();\n/* 81 */ return file;\n/* */ }", "public void tempSaveToFile() {\n try {\n ObjectOutputStream outputStream = new ObjectOutputStream(\n this.openFileOutput(MenuActivity2048.TEMP_SAVE_FILENAME, MODE_PRIVATE));\n outputStream.writeObject(boardManager);\n outputStream.close();\n } catch (IOException e) {\n Log.e(\"Exception\", \"File write failed: \" + e.toString());\n }\n }", "private void writeObject(String filePath, Object obj) throws IOException {\n OutputStream file = new FileOutputStream(filePath);\n OutputStream buffer = new BufferedOutputStream(file);\n ObjectOutput output = new ObjectOutputStream(buffer);\n output.writeObject(obj);\n output.close();\n }", "public void writeObject(OutputStream stream, Object object, int format) throws IOException;", "void writeObject(OutputSerializer out) throws java.io.IOException;", "public void writeObject(ZObjectOutputStream out) throws IOException {\n }", "public static File writeObjectToTempFileNoExceptions(Serializable o, String filename)\n/* */ {\n/* */ try\n/* */ {\n/* 93 */ return writeObjectToTempFile(o, filename);\n/* */ } catch (Exception e) {\n/* 95 */ System.err.println(\"Error writing object to file \" + filename);\n/* 96 */ e.printStackTrace(); }\n/* 97 */ return null;\n/* */ }", "void writeReference(Object obj);", "private void writeObject(\n ObjectOutputStream aOutputStream\n ) throws IOException {\n //perform the default serialization for all non-transient, non-static fields\n aOutputStream.defaultWriteObject();\n }", "public void writeObjectToFile(ClickerCounterModel[] temp) {\n\t\ttry {\n\t\t\tGson gson = new Gson();\n\t\t\tString string = gson.toJson(temp);\n\t\t\tFileOutputStream outputStream = openFileOutput(filename,\n\t\t\t\t\tContext.MODE_PRIVATE);\n\t\t\toutputStream.write(string.getBytes());\n\t\t\toutputStream.close();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "void writeCustom(Object custom);", "@Override\n\tprotected void write(ObjectOutput out) throws IOException {\n\t\t\n\t}", "public static void writeObjectToDisk(Object obj, String name) throws IOException {\r\n\t\t// Create file output stream\r\n\t\tFileOutputStream fileOutStr = new FileOutputStream(name);\r\n\t\t// Create object output stream and write object\r\n\t\tObjectOutputStream objOutStr = new ObjectOutputStream(fileOutStr);\r\n\t\tobjOutStr.writeObject(obj);\r\n\t\t// Close all streams\r\n\t\tobjOutStr.close();\r\n\t\tfileOutStr.close();\r\n\t\tSystem.out.printf(\"Serialized data is saved in a file - \" + name); // Printing message and file name which is\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// saved\r\n\t}", "private void writeObject(\n ObjectOutputStream aOutputStream\n ) throws IOException {\n aOutputStream.defaultWriteObject();\n }", "private void writeDVDLibrary() throws DVDLibraryDaoException {\n \n // NOTE FOR APPRENTICES: We are not handling the IOException - but\n // we are translating it to an application specific exception and \n // then simple throwing it (i.e. 'reporting' it) to the code that\n // called us. It is the responsibility of the calling code to \n // handle any errors that occur.\n PrintWriter out;\n\n try {\n out = new PrintWriter(new FileWriter(DVD_LIBRARY_FILE));\n } catch (IOException e) {\n throw new DVDLibraryDaoException(\n \"Could not save DVD data.\", e);\n }\n\n // Write out the DVD objects to the DVDLibrary file.\n // get the Collection of DVDs and iterate over them \n String dvdAsText;\n \n /*\n for (int i = 0; i < dvds.size(); i++) {\n // turn a DVD into a String \n dvdAsText = marshallDVD(dvds.get(i));\n // write the DVD object to the file \n out.println(dvdAsText);\n // force PrintWriter to write line to the file\n out.flush();\n }\n // Clean up\n out.close(); \n }*/\n \n for (DVD currentDVD : dvds) {\n // turn a DVD into a String\n dvdAsText = marshallDVD(currentDVD);\n // write the DVD object to the file\n out.println(dvdAsText);\n // force PrintWriter to write line to the file\n out.flush();\n }\n // Clean up\n out.close();\n }", "@SuppressWarnings(\"PMD.CloseResource\") // PMD does not understand Closer\n protected static void serializeObject(Serializable object, Path outputFile) {\n try {\n try (Closer closer = Closer.create()) {\n OutputStream out = closer.register(Files.newOutputStream(outputFile));\n BufferedOutputStream bout = closer.register(new BufferedOutputStream(out));\n serializeToLz4Data(object, bout);\n }\n } catch (Exception e) {\n throw new BatfishException(\"Failed to serialize object to output file: \" + outputFile, e);\n }\n }", "private void writeObject(java.io.ObjectOutputStream out)\n throws IOException {\n\n // Serialize captcha fields with defaut method\n out.defaultWriteObject();\n\n // If the challenge has not been disposed\n if (this.challenge != null) {\n // use png encoding\n ImageIO.write(this.challenge, \"png\", new MemoryCacheImageOutputStream(out));\n }\n }", "private void writeDeviceIndependentObject(XDIMEContextInternal context)\n throws XDIMEException {\n\n DeviceIndependentTypeProcessor deviceIndependentTypeProcessor =\n new DeviceIndependentTypeProcessor();\n deviceIndependentTypeProcessor.writeObject(context,(ObjectAttribute)protocolAttributes,\n bodyContentBuffer);\n }", "public static void writeObject(Activity activity, Object object, String filename) {\n FileOutputStream fos = null;\n ObjectOutputStream oos = null;\n try {\n fos = activity.openFileOutput(filename, Context.MODE_PRIVATE);\n oos = new ObjectOutputStream(fos);\n oos.writeObject(object);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally {\n closeOutputStream(fos);\n closeOutputStream(oos);\n }\n }", "private void writeObject(ObjectOutputStream _stream)\n/* 428: */ throws IOException\n/* 429: */ {\n/* 430:503 */ _stream.defaultWriteObject();\n/* 431:504 */ writeCustomData(_stream);\n/* 432: */ }", "private void writeObject (java.io.ObjectOutputStream out) throws IOException {\n message(AX_PROGRESS,\"Serialize activeX control\");\n if (clientSite != AX_NO_CLIENT_SITE) {\n String componentFileName = generateComponentFileName(\"x0p\");\n message(AX_PROGRESS,componentFileName); \n OleThreadRequest saveRequest = new OleThreadRequest(SAVE,\n componentFileName);\n messagesWaiting.add(saveRequest);\n \n // busy wait - there must be a better way\n while (!saveRequest.finished) {\n synchronized(saveRequest) {\n try {\n saveRequest.wait(POLL_FOR_RESULT_HEARTBEAT);\n }\n catch (InterruptedException e) {\n\n }\n }\n } \n \n componentFileName = saveRequest.name;\n out.defaultWriteObject();\n if (componentFileName.equals(\"\")) {\n message(AX_PROGRESS,\n \"Cannot serialize activeX control, continuing anyway\");\n out.writeLong(0);\n } else {\n File f = new File(componentFileName);\n FileInputStream fi = new FileInputStream(f);\n long sofar = 0;\n int num = -1;\n int filelen = (int)f.length();\n out.writeLong(filelen);\n message(AX_PROGRESS, \"Writing the size of COM storage: \" + filelen);\n byte[] buffer = new byte[1024];\n\n /* The storage file could be many Megs so work in 1K chunks */\n do {\n num = fi.read(buffer,0,1024);\n if (num >= 0) {\n out.write(buffer,0,num);\n sofar += num;\n }\n }\n while (num == 1024);\n\n message(AX_PROGRESS, \"Read \" + sofar + \" bytes from a storage file\");\n\n fi.close();\n if (! f.delete())\n message(AX_ERROR,\"Failed to delete temporary file: \" + \n componentFileName);\n }\n }\n }", "private void writeObject(java.io.ObjectOutputStream s)\n throws java.lang.ClassNotFoundException,\n\t java.io.IOException\n {\n s.defaultWriteObject();\n }", "public InstrumentedFileOutputStream(FileDescriptor fdObj) {\r\n super(fdObj);\r\n }", "void saveObject(DataObject sdo, XMLStreamWriter writer) throws XMLStreamException;", "private void writeObject(java.io.ObjectOutputStream s)\n throws java.lang.ClassNotFoundException,\n java.io.IOException\n {\n s.defaultWriteObject();\n }", "private void writeDeviceDependentObject(XDIMEContextInternal context)\n throws XDIMEException {\n\n DeviceDependentTypeProcessor deviceDependentTypeProcessor =\n new DeviceDependentTypeProcessor();\n deviceDependentTypeProcessor.writeObject(context,(ObjectAttribute)protocolAttributes,\n bodyContentBuffer);\n }", "void mo6321a(OutputStream outputStream, Object obj);", "public void save(){\n Player temp = Arena.CUR_PLAYER;\n try{\n FileOutputStream outputFile = new FileOutputStream(\"./data.sec\");\n ObjectOutputStream objectOut = new ObjectOutputStream(outputFile);\n objectOut.writeObject(temp);\n objectOut.close();\n outputFile.close();\n }\n catch(FileNotFoundException e){\n System.out.print(\"Cannot create a file at that location\");\n }\n catch(SecurityException e){\n System.out.print(\"Permission Denied!\");\n }\n catch(IOException e){\n System.out.println(\"Error 203\");\n } \n }", "protected abstract void write (Object val);", "private void writeObject(ObjectOutputStream out) throws IOException {\n\tout.defaultWriteObject();\n\tservID.writeBytes(out);\n }", "public void writeObjectRecurse(ZObjectOutputStream out) throws IOException {\n }", "private void saveToDir(String name, Object obj) {\n\t\tFileOutputStream fileOut = null;\n\t\ttry {\n\t\t\tfileOut = new FileOutputStream(this.dir + \"/\" + name);\n\t\t\tObjectOutputStream out = new ObjectOutputStream(fileOut);\n\t\t\tout.writeObject(obj);\n\t\t\tout.close();\n\t\t\tfileOut.close();\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Error occurred while saving the index file: \" + name);\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(1);\n\t\t}\n\t}", "public void writeToRestaurantFile()\r\n {\r\n\ttry(ObjectOutputStream toRestaurantFile = \r\n new ObjectOutputStream(new FileOutputStream(\"listfiles/restaurant.dta\")))\r\n\t{\r\n toRestaurantFile.writeObject(restaurant);\r\n\t}\r\n\tcatch(NotSerializableException nse)\r\n\t{\r\n JOptionPane.showMessageDialog(null, \"Restaurant objektene er ikke \"\r\n + \"serialiserbare.\\nIngen registrering på fil!\"\r\n + nse.getMessage(), \"Feilmelding\", \r\n JOptionPane.ERROR_MESSAGE);\r\n\t}\r\n\tcatch(IOException ioe)\r\n\t{\r\n JOptionPane.showMessageDialog(null, \"Det oppsto en feil ved skriving \"\r\n + \"til fil.\\n\" + ioe.getMessage());\r\n\t}\r\n }", "public void writeObject( Container.ContainerOutputStream cos ) throws SerializationException;", "private void writeObject(ObjectOutputStream out) throws IOException {\n out.defaultWriteObject();\n }", "public void writeObject(Object obj, String path)throws IOException{\n FileOutputStream fos = new FileOutputStream(path);\n ObjectOutputStream oos = new ObjectOutputStream(fos);\n\n oos.writeObject(obj);\n oos.close();\n }", "void serialize(Object obj, OutputStream stream) throws IOException;", "public void writeObject(RandomAccessFile arq) throws IOException{\n byte[] dados = this.getByteArray();\n arq.writeChar(' ');\n arq.writeShort(dados.length);\n arq.write(dados);\n }", "private void writeObject(final ObjectOutputStream out) throws IOException\n\t{\n\t\t// Read the data\n\t\tif (dfos.isInMemory())\n\t\t{\n\t\t\tcachedContent = get();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcachedContent = null;\n\t\t\tdfosFile = dfos.getFile();\n\t\t}\n\n\t\t// write out values\n\t\tout.defaultWriteObject();\n\t}", "private void writeObject(ObjectOutputStream out) throws IOException\r\n\t{\r\n\t\tthis.serialize(out);\r\n\t}", "@Override\n\tpublic void write(Object obj, File file) throws IJunitException {\n\t\t\n\t}", "void writeObj(MyAllTypesSecond aRecord, StrategyI xmlStrat);", "private synchronized Resource write(Object bean, boolean forceDeep) {\r\n\t\ttry {\r\n\t\t\tm.enterCriticalSection(Lock.WRITE);\r\n\t\t\tthis.forceDeep = forceDeep;\r\n\t\t\tcycle = new ArrayList<Object>();\r\n\t\t\treturn _write(bean, false);\r\n\t\t} finally {\r\n\t\t\tm.leaveCriticalSection();\r\n\t\t}\r\n\t}", "public void writeEquipment() {\n try {\n FileOutputStream fileOut = new FileOutputStream(\"temp/equipment.ser\");\n ObjectOutputStream out = new ObjectOutputStream(fileOut);\n out.writeObject(equipment);\n out.close();\n fileOut.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public static void serialize(Object object, String resourceDir, String filename) {\n\t\ttry\r\n\t\t{\r\n\t\t\tFileOutputStream fileOut;\r\n\t\t\tObjectOutputStream objectOut;\r\n\t\r\n\t\t\tfileOut = new FileOutputStream(resourceDir + filename);\r\n\t\t\tobjectOut = new ObjectOutputStream(fileOut);\r\n\t\t\tobjectOut.writeObject(object);\r\n\t\t\tobjectOut.close();\r\n\t\t\tfileOut.close();\r\n\t\t} catch (IOException i) {\r\n\t\t\t//TODO fail test here?\r\n\t\t\tUtil.printInfo(\"IOException occurred while serializing object: \" + i.getMessage());\r\n\t\t\ti.printStackTrace();\r\n\t\t}\r\n\t}", "public void writeExternal(ObjectOutput objectOutput)\n throws IOException\n {\n objectOutput.writeLong(serialVersionUID);\n objectOutput.writeObject(_wrapped);\n objectOutput.writeObject(_label);\n }", "private void method_979(ObjectOutputStream var1) {\n var1.defaultWriteObject();\n var1.writeObject(this.a);\n }", "public void SerialWriteFile() {\r\n\r\n PrintWriter pwrite = null;\r\n File fileObject = new File(getName());\r\n QuizPlayer q = new QuizPlayer(getName(), getNickname(), getTotalScore());\r\n\r\n try {\r\n ObjectOutputStream outputStream =\r\n new ObjectOutputStream(new FileOutputStream(fileObject));\r\n\r\n outputStream.writeObject(q); //Writes the object to the serialized file.\r\n outputStream.close();\r\n\r\n\r\n } catch (IOException e) {\r\n System.out.println(\"Problem with file output.\");\r\n }\r\n\r\n }", "private final void writeObject(ObjectOutputStream out) throws java.io.IOException {\n\t\tthrow new java.io.IOException(\"Object cannot be serialized\");\n\t}", "public void testSetObjTemp() {\n System.out.println(\"setObjTemp\");\n Object objTemp = null;\n int modo= 0;\n ObjectTempSwapWizard instance = new ObjectTempSwapWizard(modo);\n instance.setObjTemp(objTemp);\n }", "private void writeObject ( ObjectOutputStream out ) throws IOException {\n ObjectOutputStream.PutField fields = out.putFields();\n fields.put(\"_user\", _user);\n out.writeFields();\n }", "private void setFile(Serializable object, String path) throws Exception {\t\t\n\t\t\n FileOutputStream fileOut = new FileOutputStream(path);\n ObjectOutputStream objectOut = new ObjectOutputStream(fileOut);\n objectOut.writeObject(object);\n objectOut.close(); \n\t\t\n\t}", "public abstract void debug(RobocodeFileOutputStream output);", "public void serialize() {\n FileOutputStream fileOutput = null;\n ObjectOutputStream outStream = null;\n // attempts to write the object to a file\n try {\n clearFile();\n fileOutput = new FileOutputStream(data);\n outStream = new ObjectOutputStream(fileOutput);\n outStream.writeObject(this);\n } catch (Exception e) {\n } finally {\n try {\n if (outStream != null)\n outStream.close();\n } catch (Exception e) {\n }\n }\n }", "ObjectOutputStream newObjectOutputStream(OutputStream out) throws Exception;", "void writeObj(MyAllTypesFirst myFirst, StrategyI xmlStrat);", "private void writeObject (ObjectOutputStream out) throws IOException {\n\t\tout.writeInt (CURRENT_SERIAL_VERSION);\n\t\tout.writeObject(inputPipe);\n\t\tout.writeObject(outputPipe);\n\t\tout.writeObject(sumLatticeFactory);\n\t\tout.writeObject(maxLatticeFactory);\n\t}", "public void writeToFile(Object obj) throws FileNotFoundException, IOException\n {\n ObjectOutputStream writeToFile = null;\n\n try\n {\n FileOutputStream fileOutStream = new FileOutputStream(FILE_NAME);\n writeToFile = new ObjectOutputStream(fileOutStream);\n\n writeToFile.writeObject(obj);\n }\n finally\n {\n if (writeToFile != null)\n {\n try\n {\n writeToFile.close();\n }\n catch (IOException e)\n {\n displayErrorMessage(\"IO File error on\", FILE_NAME);\n }\n }\n }\n }", "private byte[] serialize(RealDecisionTree object){\n try{\n // Serialize data object to a file\n ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(\"MyObject.ser\"));\n out.writeObject(object);\n out.close();\n\n // Serialize data object to a byte array\n ByteArrayOutputStream bos = new ByteArrayOutputStream() ;\n out = new ObjectOutputStream(bos) ;\n out.writeObject(object);\n out.close();\n\n // Get the bytes of the serialized object\n byte[] buf = bos.toByteArray();\n return buf;\n } catch (IOException e) {\n System.exit(1);\n }\n\n return null;\n }", "@Override\n public void serializeObject(Object o, int hashCode, String destDir) {\n // throw new NotImplementedException();\n }", "public NewDigitalMediaObject(String alias) {\n this(DSL.name(alias), NEW_DIGITAL_MEDIA_OBJECT);\n }", "private void writeObject(ObjectOutputStream out) throws IOException{\n out.defaultWriteObject();\n // writeUTF <--> readUTF, will write length;\n // writeChars <--> readChar, will not write length, you should know the length before read.\n out.writeUTF(company);\n // out.writeChars(company);\n out.writeUTF(encryptor.xor(password));\n }", "public abstract void write(O value) throws IOException;", "public abstract void serialize(OutputStream stream, T object) throws IOException;", "private void sendObject(Object obj){\r\n try {\r\n out.reset();\r\n out.writeObject(obj);\r\n out.flush();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }", "public void writeObject(Object obj) throws IOException\n\t{\n\t\tif (obj == null) {\n\t\t\twriteMark(Ion.NULL);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof IonBinary) {\n\t\t\tfinal IonBinary iObj = (IonBinary) obj;\n\t\t\t\n\t\t\twriteMark(Ion.getMark(obj));\n\t\t\tiObj.save(this);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof IonBundled) {\n\t\t\tfinal IonBundled iObj = (IonBundled) obj;\n\t\t\t\n\t\t\twriteMark(Ion.getMark(obj));\n\t\t\t\n\t\t\tfinal IonDataBundle bundle = new IonDataBundle();\n\t\t\tiObj.save(bundle);\n\t\t\twriteBundle(bundle);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (Ion.isObjectIndirectBundled(obj)) {\n\t\t\tfinal IonizerBundled<?> ionizer = Ion.getIonizerBundledForClass(obj.getClass());\n\t\t\t\n\t\t\twriteMark(Ion.getMark(obj));\n\t\t\t\n\t\t\tfinal IonDataBundle bundle = new IonDataBundle();\n\t\t\tionizer._save(obj, bundle);\n\t\t\twriteBundle(bundle);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (Ion.isObjectIndirectBinary(obj)) {\n\t\t\tfinal IonizerBinary<?> ionizer = Ion.getIonizerBinaryForClass(obj.getClass());\n\t\t\t\n\t\t\twriteMark(Ion.getMark(obj));\n\t\t\t\n\t\t\tionizer._save(obj, this);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Map) {\n\t\t\twriteMark(Ion.MAP);\n\t\t\twriteMap((Map<?, ?>) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Collection) {\n\t\t\twriteMark(Ion.SEQUENCE);\n\t\t\twriteSequence((Collection<?>) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Boolean) {\n\t\t\twriteMark(Ion.BOOLEAN);\n\t\t\twriteBoolean((Boolean) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Byte) {\n\t\t\twriteMark(Ion.BYTE);\n\t\t\twriteByte((Byte) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Character) {\n\t\t\twriteMark(Ion.CHAR);\n\t\t\twriteChar((Character) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Short) {\n\t\t\twriteMark(Ion.SHORT);\n\t\t\twriteShort((Short) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Integer) {\n\t\t\twriteMark(Ion.INT);\n\t\t\twriteInt((Integer) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Long) {\n\t\t\twriteMark(Ion.LONG);\n\t\t\twriteLong((Long) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Float) {\n\t\t\twriteMark(Ion.FLOAT);\n\t\t\twriteFloat((Float) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Double) {\n\t\t\twriteMark(Ion.DOUBLE);\n\t\t\twriteDouble((Double) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof String) {\n\t\t\twriteMark(Ion.STRING);\n\t\t\twriteString((String) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof boolean[]) {\n\t\t\twriteMark(Ion.BOOLEAN_ARRAY);\n\t\t\twriteBooleans((boolean[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof byte[]) {\n\t\t\twriteMark(Ion.BYTE_ARRAY);\n\t\t\twriteBytes((byte[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof char[]) {\n\t\t\twriteMark(Ion.CHAR_ARRAY);\n\t\t\twriteChars((char[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof short[]) {\n\t\t\twriteMark(Ion.SHORT_ARRAY);\n\t\t\twriteShorts((short[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof int[]) {\n\t\t\twriteMark(Ion.INT_ARRAY);\n\t\t\twriteInts((int[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof long[]) {\n\t\t\twriteMark(Ion.LONG_ARRAY);\n\t\t\twriteLongs((long[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof float[]) {\n\t\t\twriteMark(Ion.FLOAT_ARRAY);\n\t\t\twriteFloats((float[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof double[]) {\n\t\t\twriteMark(Ion.DOUBLE_ARRAY);\n\t\t\twriteDoubles((double[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof String[]) {\n\t\t\twriteMark(Ion.STRING_ARRAY);\n\t\t\twriteStrings((String[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Object[]) {\n\t\t\twriteMark(Ion.OBJECT_ARRAY);\n\t\t\twriteObjects((Object[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tthrow new IOException(\"Object \" + obj + \" could not be be written to stream.\");\n\t}", "public static void write (com.stottlerhenke.simbionic.common.xmlConverters.model.SimBionicJava dmObject, PrintWriter writer, int indent) {\n \n Utils.writeField(SimBionicJavaSAXReader.version,dmObject.getVersion(),writer,indent+1);\n \n Utils.writeField(SimBionicJavaSAXReader.ipAddress,dmObject.getIpAddress(),writer,indent+1);\n \n Utils.writeField(SimBionicJavaSAXReader.loopBack,dmObject.isLoopBack(),writer,indent+1);\n \n Utils.writeField(SimBionicJavaSAXReader.main,dmObject.getMain(),writer,indent+1);\n com.stottlerhenke.simbionic.common.xmlConverters.model.ActionFolderGroup actions = (com.stottlerhenke.simbionic.common.xmlConverters.model.ActionFolderGroup)dmObject.getActions();\n if (actions != null) {\n Utils.writeStartTag(SimBionicJavaSAXReader.actions,writer,indent+1);\n ActionFolderGroupSAXWriter.write(actions,writer,indent+2);\n Utils.writeEndTag(SimBionicJavaSAXReader.actions,writer,indent+1);\n }\n com.stottlerhenke.simbionic.common.xmlConverters.model.PredicateFolderGroup predicates = (com.stottlerhenke.simbionic.common.xmlConverters.model.PredicateFolderGroup)dmObject.getPredicates();\n if (predicates != null) {\n Utils.writeStartTag(SimBionicJavaSAXReader.predicates,writer,indent+1);\n PredicateFolderGroupSAXWriter.write(predicates,writer,indent+2);\n Utils.writeEndTag(SimBionicJavaSAXReader.predicates,writer,indent+1);\n }\n com.stottlerhenke.simbionic.common.xmlConverters.model.ConstantFolderGroup constants = (com.stottlerhenke.simbionic.common.xmlConverters.model.ConstantFolderGroup)dmObject.getConstants();\n if (constants != null) {\n Utils.writeStartTag(SimBionicJavaSAXReader.constants,writer,indent+1);\n ConstantFolderGroupSAXWriter.write(constants,writer,indent+2);\n Utils.writeEndTag(SimBionicJavaSAXReader.constants,writer,indent+1);\n }\n List<com.stottlerhenke.simbionic.common.xmlConverters.model.Category> categories = (List<com.stottlerhenke.simbionic.common.xmlConverters.model.Category>)dmObject.getCategories();\n if (categories != null && !categories.isEmpty()) {\n Utils.writeStartTag(SimBionicJavaSAXReader.categories,writer,indent+1);\n CategoryGroupSAXWriter.write(categories, writer,indent+2);\n Utils.writeEndTag(SimBionicJavaSAXReader.categories,writer,indent+1);\n }\n com.stottlerhenke.simbionic.common.xmlConverters.model.BehaviorFolderGroup behaviors = (com.stottlerhenke.simbionic.common.xmlConverters.model.BehaviorFolderGroup)dmObject.getBehaviors();\n if (behaviors != null) {\n Utils.writeStartTag(SimBionicJavaSAXReader.behaviors,writer,indent+1);\n BehaviorFolderGroupSAXWriter.write(behaviors,writer,indent+2);\n Utils.writeEndTag(SimBionicJavaSAXReader.behaviors,writer,indent+1);\n }\n com.stottlerhenke.simbionic.common.xmlConverters.model.GlobalFolderGroup globals = (com.stottlerhenke.simbionic.common.xmlConverters.model.GlobalFolderGroup)dmObject.getGlobals();\n if (globals != null) {\n Utils.writeStartTag(SimBionicJavaSAXReader.globals,writer,indent+1);\n GlobalFolderGroupSAXWriter.write(globals,writer,indent+2);\n Utils.writeEndTag(SimBionicJavaSAXReader.globals,writer,indent+1);\n }\n com.stottlerhenke.simbionic.common.xmlConverters.model.JavaScript javaScript = (com.stottlerhenke.simbionic.common.xmlConverters.model.JavaScript)dmObject.getJavaScript();\n if (javaScript != null) {\n Utils.writeStartTag(SimBionicJavaSAXReader.javaScript,writer,indent+1);\n JavaScriptSAXWriter.write(javaScript,writer,indent+2);\n Utils.writeEndTag(SimBionicJavaSAXReader.javaScript,writer,indent+1);\n }\n com.stottlerhenke.simbionic.common.xmlConverters.model.ProjectProperties projectProperties = (com.stottlerhenke.simbionic.common.xmlConverters.model.ProjectProperties)dmObject.getProjectProperties();\n if (projectProperties != null) {\n Utils.writeStartTag(SimBionicJavaSAXReader.projectProperties,writer,indent+1);\n ProjectPropertiesSAXWriter.write(projectProperties,writer,indent+2);\n Utils.writeEndTag(SimBionicJavaSAXReader.projectProperties,writer,indent+1);\n }\n \n }", "public void writeObject(Obj input){\n\t\tlong newFanSpeedSetpointValue = 0;\n\t\tif(input instanceof FanSpeedActuator){\n\t\t\tFanSpeedActuator in = (FanSpeedActuator) input;\n\t\t\tlog.finer(\"Writing on FanSpeedActuator: \" + in.fanSpeedSetpointValue().get() + \",\" + in.enabled().get());\n\t\t\t\n\t\t\tnewFanSpeedSetpointValue = in.fanSpeedSetpointValue().get();\t\n\t\t\tenabledValue.set(in.enabled().get());\n\t\t\t\n\t\t}\n\t\telse if(input instanceof Int){\n\t\t\tnewFanSpeedSetpointValue = ((Int) input).get();\n\t\t}\n\t\telse if(input instanceof Bool){\n\t\t\tthis.enabledValue.set(((Bool) input).get());\n\t\t}\n\t\tthis.fanSpeedSetpointValue.set(newFanSpeedSetpointValue);\n\t}", "public abstract void writeToStream(java.io.DataOutputStream output) throws java.io.IOException;", "public void saveToFile() {\n FileOutputStream fos = null;\n try {\n //write the object into file\n fos = new FileOutputStream(file);\n ObjectOutputStream oos = new ObjectOutputStream(fos);\n oos.writeObject(travelGUI.getTravelAgent());\n oos.flush();\n oos.close();\n }\n catch (IOException ioe) {\n System.out.println(ioe.getMessage());\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n return;\n }\n finally {\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n }\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n }", "@Override\n protected void doWriteTo(StreamOutput out) throws IOException {\n }", "public interface ObjectOutput extends DataOutput, AutoCloseable {\n /**\n * Write an object to the underlying storage or stream. The class that implements this interface\n * defines how the object is written.\n *\n * @param obj the object to be written\n * @exception IOException Any of the usual Input/Output related exceptions.\n */\n public void writeObject(Object obj) throws IOException;\n\n /**\n * Writes a byte. This method will block until the byte is actually written.\n * \n * @param b the byte\n * @exception IOException If an I/O error has occurred.\n */\n public void write(int b) throws IOException;\n\n /**\n * Writes an array of bytes. This method will block until the bytes are actually written.\n * \n * @param b the data to be written\n * @exception IOException If an I/O error has occurred.\n */\n public void write(byte b[]) throws IOException;\n\n /**\n * Writes a sub array of bytes.\n * \n * @param b the data to be written\n * @param off the start offset in the data\n * @param len the number of bytes that are written\n * @exception IOException If an I/O error has occurred.\n */\n public void write(byte b[], int off, int len) throws IOException;\n\n /**\n * Flushes the stream. This will write any buffered output bytes.\n * \n * @exception IOException If an I/O error has occurred.\n */\n public void flush() throws IOException;\n\n /**\n * Closes the stream. This method must be called to release any resources associated with the\n * stream.\n * \n * @exception IOException If an I/O error has occurred.\n */\n public void close() throws IOException;\n}", "public InstrumentedFileOutputStream(FileDescriptor fdObj, String recId) {\r\n super(fdObj);\r\n this.recId = recId;\r\n }", "public void openForWriting(String datei) throws IOException {\n \n oos = new ObjectOutputStream(new FileOutputStream(datei));\n \n }", "public void toFile() throws IOException {\n toFile(null);\n }", "private void method_277(ObjectOutputStream var1) {\n var1.defaultWriteObject();\n var1.writeObject(this.a);\n }", "public static void saveObjToFile(Object obj, String filePath) throws IOException {\n // create the enclosing folders if it doesn't exist\n createDir(filePath);\n\n FileOutputStream file = new FileOutputStream(filePath);\n ObjectOutputStream out = new ObjectOutputStream(file);\n out.writeObject(obj);\n out.close();\n }", "public static void main(String[] args) throws IOException, ClassNotFoundException {\n ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(\"tempFile\"));\n Serial serial = new Serial();\n serial.setAge(18);\n serial.setName(\"Loumt\");\n serial.setAddress(\"大桥镇中学\");\n oos.writeObject(serial);\n\n //read object from file\n File file = new File(\"tempFile\");\n ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));\n Serial serial1 = (Serial)ois.readObject();\n\n //output\n System.out.println(serial1);\n System.out.println(serial1.getName());\n\n\n }", "public NewDigitalMediaObject(Name alias) {\n this(alias, NEW_DIGITAL_MEDIA_OBJECT);\n }", "@Override\n public void close(){\n outObject = \"close-\";\n try {\n out.writeObject(outObject);\n } catch (IOException ex) {\n }\n }", "public void salvaDati(Object dati){\n\t\ttry{\n\t\t\tFileOutputStream fos = new FileOutputStream(file);\n\t\t\tObjectOutputStream oos = new ObjectOutputStream(fos);\n\t\t\toos.writeObject(dati);\n\t\t\toos.close();\n\t\t\tfos.close();\n\t\t\tSystem.out.println(\"File \" + file + \" salvato\");\n\t\t} catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\t\n\t}", "public void writeTo(OutputStream arg0) throws IOException {\n\t\t\r\n\t}", "public abstract <T> SerializationStream writeObject(T t);", "public void outputToFile(MethodCallExpr original, MethodCallExpr mutant) {\n if (comp_unit == null || currentMethodSignature == null){\n return;\n }\n num++;\n String f_name = getSourceName(\"ARGR\");\n String mutant_dir = getMuantID(\"ARGR\");\n try {\n PrintWriter out = getPrintWriter(f_name);\n ARGR_Writer writer = new ARGR_Writer(mutant_dir, out);\n writer.setMutant(original, mutant);\n writer.setMethodSignature(currentMethodSignature);\n writer.writeFile(comp_unit);\n out.flush();\n out.close();\n }\n catch (IOException e) {\n System.err.println(\"ARGR: Fails to create \" + f_name);\n logger.error(\"Fails to create \" + f_name);\n }\n }", "@Override\r\n public boolean toData(Object o, PdxWriter out) {\r\n //handle PortfolioPdx objects\r\n if (o instanceof PortfolioPdx) {\r\n return portfolioSerializer.toData(o, out);\r\n }\r\n \r\n //handle PositionPdx objects\r\n if (o instanceof PositionPdx) {\r\n return positionSerializer.toData(o, out);\r\n }\r\n \r\n //If the object type is something we don't understand, return false\r\n //to allow the serialization framework to try to serialize the object\r\n //using java serialization\r\n return false;\r\n }", "private static File createTempFile(final byte[] data) throws IOException {\r\n \t// Genera el archivo zip temporal a partir del InputStream de entrada\r\n final File zipFile = File.createTempFile(\"sign\", \".zip\"); //$NON-NLS-1$ //$NON-NLS-2$\r\n final FileOutputStream fos = new FileOutputStream(zipFile);\r\n\r\n fos.write(data);\r\n fos.flush();\r\n fos.close();\r\n\r\n return zipFile;\r\n }", "private void method_157(ObjectOutputStream var1) {\n var1.defaultWriteObject();\n var1.writeObject(this.a());\n }", "private void writeObject(ObjectOutputStream stream) throws IOException {\r\n\t\tstream.defaultWriteObject();\r\n\t\tif (sprite != null) {\r\n\t\t\tstream.writeBoolean(true);\r\n\t\t\tstream.writeObject(sprite.getName());\r\n\t\t\tstream.writeFloat(sprite.getSpritespeed());\r\n\t\t\tstream.writeFloat(sprite.getMovingspeed());\r\n\t\t\tstream.writeInt(sprite.getDirection());\r\n\t\t} else {\r\n\t\t\tstream.writeBoolean(false);\r\n\t\t}\r\n\t}", "public void streamOutput(String type,Object currentObj);" ]
[ "0.609535", "0.58318186", "0.57954675", "0.5564857", "0.55400217", "0.55026144", "0.5495735", "0.54913646", "0.54398584", "0.54041785", "0.53778636", "0.5359306", "0.5357255", "0.53382015", "0.5312956", "0.53052586", "0.5303397", "0.5303351", "0.5290809", "0.52804255", "0.5273879", "0.52384496", "0.5236116", "0.52304405", "0.52194506", "0.5183854", "0.5179135", "0.514241", "0.51302665", "0.512033", "0.51199114", "0.5108373", "0.5107615", "0.5076948", "0.5049111", "0.5029361", "0.50208527", "0.5008936", "0.49933577", "0.49740097", "0.49620053", "0.49457726", "0.49392188", "0.49321982", "0.4922589", "0.4913513", "0.49064815", "0.487179", "0.4871495", "0.4869319", "0.48459402", "0.4843596", "0.48400953", "0.48027825", "0.4774549", "0.4770957", "0.47703254", "0.47665137", "0.47624874", "0.47588655", "0.4746878", "0.47434288", "0.4733803", "0.47263154", "0.47154877", "0.47057295", "0.4689659", "0.4685261", "0.4683617", "0.4674769", "0.4654942", "0.4652506", "0.46462852", "0.46457565", "0.46432856", "0.46413207", "0.46388337", "0.46326995", "0.4623449", "0.46111202", "0.46030012", "0.45967904", "0.4595942", "0.45919275", "0.45899603", "0.4582877", "0.45763254", "0.45749304", "0.45728707", "0.45700407", "0.45678607", "0.45537376", "0.4553547", "0.45510033", "0.45487332", "0.4546485", "0.45286602", "0.45277777", "0.45266047", "0.4526011" ]
0.6858388
0
Set up environment for image comparison.
private void setUp() { if (tempDir != null) { tearDown(); } tempDir = new File(OS.getTmpPath() + "imagecompare" + System.nanoTime()); tempDir.mkdir(); tempDir.deleteOnExit(); tempFiles.clear(); log.debug("using temp directory " + tempDir.getAbsolutePath()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Before\n public void setupEnvironment() {\n TestEnvironment testEnvironment;\n switch (mode) {\n case CLUSTER:\n // This only works because of the quirks we built in the TestEnvironment.\n // We should refactor this in the future!!!\n testEnvironment = MINI_CLUSTER_RESOURCE.getTestEnvironment();\n testEnvironment.getConfig().disableObjectReuse();\n testEnvironment.setAsContext();\n break;\n case CLUSTER_OBJECT_REUSE:\n // This only works because of the quirks we built in the TestEnvironment.\n // We should refactor this in the future!!!\n testEnvironment = MINI_CLUSTER_RESOURCE.getTestEnvironment();\n testEnvironment.getConfig().enableObjectReuse();\n testEnvironment.setAsContext();\n break;\n case COLLECTION:\n new CollectionTestEnvironment().setAsContext();\n break;\n }\n }", "private void setupEnvironment() {\n // Create mocks for configurations\n bgpConfig = createMock(BgpConfig.class);\n participantsConfig = createMock(SdxParticipantsConfig.class);\n\n // Create mocks for services\n coreService = new TestCoreService();\n configService = new TestNetworkConfigService();\n registry = new NetworkConfigRegistryAdapter();\n interfaceService = createMock(InterfaceService.class);\n interfaceService.addListener(anyObject(InterfaceListener.class));\n expectLastCall().anyTimes();\n intentSynchronizer = createMock(IntentSynchronizationService.class);\n }", "@BeforeTest\r\n\tpublic void setupenvi() throws IOException {\r\n\t\tsetup();\r\n\t\tinit();\r\n\t}", "public void setup() {\n\n\t\t// example of loading an image file - edit to suit your project\n\t\ttry {\n\t\t\tbackground = ImageIO.read(new File(\"angrybirds.jpg\"));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t// your code here\n\t\t\n\t\t\n\t}", "File prepareEnvironment();", "@Before\n\tpublic void setup() {\n\t\tinit(rule.getProcessEngine());\n\t}", "public static void setup(String[] args) {\n\t\tif (parametersContains(\"classpath\", args)) {\r\n\t\t\tRESOURCE_TYPE = RessourceType.CLASSPATH;\r\n\t\t\tCobra2DEngine.setupEnvironment(RESOURCE_TYPE);\r\n\t\t\tROOT_PATH_STR = \"./src/main/resources/\";\r\n\t\t} else if (parametersContains(\"currentDir\", args)) {\r\n\t\t\tRESOURCE_TYPE = RessourceType.INSTALL_DIR;\r\n\t\t\tCobra2DEngine.setupEnvironment(RESOURCE_TYPE);\r\n\t\t\tROOT_PATH_STR = \".\";\r\n\t\t} else {\r\n\t\t\tSystem.out\r\n\t\t\t\t\t.println(\"Start this runtime environment with option -classpath to load all resources from your classpath or with -currentDir to load all resources from current directory ./game-resources/.\");\r\n\t\t\tSystem.exit(1);\r\n\t\t}\r\n\r\n\t\tROOT_PATH = new File(ROOT_PATH_STR);\r\n\t\tRESOURCE_PATH = new File(ROOT_PATH_STR + File.separator\r\n\t\t\t\t+ RESOURCE_PATH_STR);\r\n\t\tIMAGE_RESOURCE_PATH = new File(ROOT_PATH_STR + File.separator\r\n\t\t\t\t+ RESOURCE_PATH_STR + File.separator + IMAGE_FOLDER_STR);\r\n\r\n\t\tlog.info(\"Setting up path settings for runtime.\");\r\n\t\tlog.info(\"Resource loading strategy : \" + RESOURCE_TYPE);\r\n\t\tlog.info(\"Root path (path): \" + ROOT_PATH.getPath());\r\n\t\tlog.info(\"Root path (absolute): \"\r\n\t\t\t\t+ ROOT_PATH.getAbsolutePath());\r\n\t\tlog.info(\"Resource path (path): \" + RESOURCE_PATH.getPath());\r\n\t\tlog.info(\"Resource path (absolute): \"\r\n\t\t\t\t+ RESOURCE_PATH.getAbsolutePath());\r\n\t\tlog.info(\"Image resource path (path): \"\r\n\t\t\t\t+ IMAGE_RESOURCE_PATH.getPath());\r\n\t\tlog.info(\"Image resource path (absolute): \"\r\n\t\t\t\t+ IMAGE_RESOURCE_PATH.getAbsolutePath());\r\n\t}", "Environment createEnvironment();", "Environment createEnvironment();", "private void setupEnvironment(Execute exe) {\r\n String[] environment = env.getVariables();\r\n if (environment != null) {\r\n for (int i = 0; i < environment.length; i++) {\r\n log(\"Setting environment variable: \" + environment[i], Project.MSG_VERBOSE);\r\n }\r\n }\r\n exe.setNewenvironment(newEnvironment);\r\n exe.setEnvironment(environment);\r\n }", "public void setup() {\n\t\tthis.image = new BufferedImage(maxXPos, maxYPos, BufferedImage.TYPE_4BYTE_ABGR);\n\t\tthis.graphics = getImage().createGraphics();\n\t}", "protected abstract void setupImages(Context context);", "@BeforeClass\n public static void SetupEnviron() throws FileNotFoundException, UnsupportedEncodingException {\n if (outputDir != null && baseLocalDir != null) {\n // exit early if the environ is already set\n return;\n }\n BasicConfigurator.resetConfiguration();\n BasicConfigurator.configure();\n String container = \"testConfiguration\";\n InputStream templateInputStream = null;\n try {\n File configFile = new File(\"resources/tests_config.xml\");\n templateInputStream = new FileInputStream(configFile);\n Document configDoc = XMLDomUtils.getTemplateDom(templateInputStream);\n // read from the config file\n outputDir = XMLDomUtils.getNodeValue(configDoc, container, \"outputDirectory\");\n outputDir += \"desc_sen/\";\n baseLocalDir = XMLDomUtils.getNodeValue(configDoc, container, \"projectDirectory\");\n exampleOutputDir = XMLDomUtils.getNodeValue(configDoc, container, \"outputDirectory\");\n exampleOutputDir += \"examples/\";\n } finally {\n if (templateInputStream != null) {\n try {\n templateInputStream.close();\n } catch (IOException e) {\n // ignore, closing..\n }\n }\n }\n \n File file = new File(outputDir);\n file.mkdirs();\n \n file = new File(exampleOutputDir);\n file.mkdirs();\n \n baseQuery += URLEncoder.encode(\"text/xml;subtype=\\\"sensorML/1.0.1\\\"\", \"UTF-8\") + \"&\";\n }", "@BeforeClass(alwaysRun = true)\n public void setEnvironment() throws Exception {\n \n esbRequestHeadersMap = new HashMap<String, String>();\n \n apiRequestHeadersMap = new HashMap<String, String>();\n \n init(\"agilezen-connector-1.0.2-SNAPSHOT\");\n \n esbRequestHeadersMap.put(\"Accept\", \"application/json\");\n esbRequestHeadersMap.put(\"Content-Type\", \"application/json\");\n \n apiRequestHeadersMap.putAll(esbRequestHeadersMap);\n \n apiRequestHeadersMap.put(\"X-Zen-ApiKey\", connectorProperties.getProperty(\"apiKey\"));\n apiRequestUrl = connectorProperties.getProperty(\"apiUrl\") + \"/api/v1\";\n \n }", "public void createEnvironment() {\n //create a list of collidable objects and a list of sprite objects\n List<Collidable> collidables = new ArrayList<Collidable>();\n List<Sprite> spriteList = new ArrayList<Sprite>();\n //update the game's environment to be the collidables list.\n this.environment = new GameEnvironment(collidables);\n //update the game's sprites collection to be the list of sprites.\n this.sprites = new SpriteCollection(spriteList);\n }", "@PostConstruct\n\tpublic void init() {\n\t\tEnvironmentUtils.setEnvironment(env);\n\t}", "@Override\n public void init(ProcessingEnvironment env) {\n // Not working at the moment.\n // myEnv = env;\n filer = env.getFiler();\n }", "@BeforeClass\n protected void initialize() {\n try {\n Class<?> testbedClass = Class.forName(\n MainframeEnvironmentVerification.class.getPackage().getName()\n + \".\" + envProperties.getTestbedPropertyById(\"id\"));\n\n if (!MainframeTestbed.class.isAssignableFrom(testbedClass)) {\n fail(\"This test can only be called on a testbed that implements the \"\n + MainframeTestbed.class.getName() + \" interface\");\n }\n MainframeTestbed testbed = (MainframeTestbed)testbedClass.newInstance();\n\n sysviewConfigs = testbed.getSysviewInstances();\n sysvDb2Configs = testbed.getSysvdb2Instances();\n cicsConfigs = testbed.getCicsRegions();\n mqConfigs = testbed.getMqSubsystems();\n imsConfigs = testbed.getImsRegions();\n datacomConfigs = testbed.getDatacomInstances();\n } catch (Exception e) {\n fail(\"Unable to query testbed for environment configuration values\", e);\n }\n\n if (!sysviewConfigs.isEmpty()) {\n // If the testbed has multiple Sysview instances we use the first for generic queries.\n try {\n sysview = new Sysview(sysviewConfigs.iterator().next().getLoadlib());\n } catch (IOException e) {\n fail(\"Unable to initialize Sysview instance used for generic queries\");\n }\n } else {\n logger.warn(\"Some checks will be skipped as the testbed contains no sysview instance\");\n }\n }", "@BeforeClass\n\tpublic static void preparation(){\n\t\tphotoFile = new PhotoFile(new File(\"..\\\\Album\\\\res\\\\malta.jpg\"));\n\t\temptyPhotoFile = new PhotoFile(new File(\"..\\\\Album\\\\res\\\\malta1.jpg\"));\n\t}", "@BeforeClass(alwaysRun = true)\n public void setEnvironment() throws Exception {\n \n init(\"podio-connector-1.0.2-SNAPSHOT\");\n\n esbRequestHeadersMap = new HashMap<String, String>();\n apiRequestHeadersMap = new HashMap<String, String>();\n \n apiUrl = connectorProperties.getProperty(\"apiUrl\");\n timeOut = Long.parseLong(connectorProperties.getProperty(\"timeOut\"));\n \n esbRequestHeadersMap.put(\"Accept-Charset\", \"UTF-8\");\n \n apiRequestHeadersMap.putAll(esbRequestHeadersMap);\n apiRequestHeadersMap.put(\"Authorization\", \"Bearer \" + connectorProperties.getProperty(\"accessToken\"));\n apiRequestHeadersMap.put(\"Content-Type\", \"application/json\");\n }", "private static void loadTestEnv() {\n\n\t\tPropertyReader reader = new PropertyReader(GlobalContext.getAppDir(), Constants.FILENAME_TESTENV);\n\n\t\tTestEnv env = new TestEnv();\n\t\tenv.setDefaultHostName(reader.getProperty(Constants.DEFAULT_HOST_NAME));\n\t\tenv.setDefaultHostOS(reader.getProperty(Constants.DEFAULT_HOST_OS));\n\t\tenv.setDefaultCredentials(reader.getProperty(Constants.DEFAULT_CREDENTIALS));\n\t\tenv.setDefaultBrowser(reader.getProperty(Constants.DEFAULT_BROWSER));\n\t\tenv.setAppServer(reader.getProperty(Constants.APP_SERVER));\n\t\tenv.setDatabaseServer(reader.getProperty(Constants.DATABASE_SERVER));\n\t\tenv.setEmailReceipients(reader.getProperty(Constants.EMAIL_RECEIPIENTS));\n\t\tenv.setEmailSender(reader.getProperty(Constants.EMAIL_SENDER));\n\n\t\t// sets to global context.\n\t\tGlobalContext.setTestEnv(env);\n\t}", "public void intServerEnv() {\n\t\tServerUtils serverUtils = new ServerUtils();\n\t\tTouchstoneParsers parsers = new TouchstoneParsers();\n\n\t\tString CONFIGFILE = psoResourcePkg + \"/configs/server.properties\";\n\t\tString testConfigFile = ServerUtils.class.getResource(CONFIGFILE).getFile();\n\n\t\tHashMap<String, HashMap<String, String>> configPropsMap = parsers.readPropsFile(new File(testConfigFile));\n\t\thostIP = (configPropsMap.get(\"URL_PARAMS\").get(\"LOCAL_ENV\").equalsIgnoreCase(\"yes\") ? \"localhost\" : serverUtils.getHostIp());\n\n\t\t// JDBC driver name and database URL\n\t\tJDBC_DRIVER=\"com.mysql.jdbc.Driver\";\n\t\tDB_URL=\"jdbc:mysql://\" + hostIP + \"/psotest\";\n\n\t\t// Database credentials\n\t\tUSERID = configPropsMap.get(\"SERVER_ENV\").get(\"USERID\");\n\t\tPASSWORD = configPropsMap.get(\"SERVER_ENV\").get(\"PASSWORD\");\n\n\t\t// Database tables:\n\t\tCLICKS_TABLE = configPropsMap.get(\"SERVER_ENV\").get(\"CLICKS_TABLE\");\n\t\tBEACON_TABLE = configPropsMap.get(\"SERVER_ENV\").get(\"BEACON_TABLE\");\n\n\t}", "@Before\n\tpublic void setUp() throws Exception {\n\t\tthis.testProject = new GitTestProject(\"eclipse-fedorapackager\");\n\t\tthis.fpRoot = FedoraPackagerUtils.getProjectRoot((this.testProject\n\t\t\t\t.getProject()));\n\t\tthis.packager = new FedoraPackager(fpRoot);\n\t}", "@BeforeSuite\n\t@Parameters({\"bRunInTestMode\", \"bPrintScreen\",\n\t\t\"CHROME_DRIVER_PATH\",\"IE_DRIVER_PATH\",\"OUTPUT_PATH\",\"IMAGES_PATH\",\n\t\t\"iWaitForElement\",\"iWaitForThread\",\"iWaitForThread1\",\"iWaitForThread2\",\"sBaseURL\"})\n\tpublic void setup(ITestContext ctx, Boolean bRunInTestMode, Boolean bPrintScreen,\n\t\t\tString CHROME_DRIVER_PATH, String IE_DRIVER_PATH, String OUTPUT_PATH, String IMAGES_PATH,\n\t\t\tint iWaitForElement, int iWaitForThread, int iWaitForThread1, int iWaitForThread2, String sBaseURL)\n\t{\n\t\tDOMConfigurator.configure(\"log4j.xml\");\n\t\tlog.info(\"Before suite launch...\");\n\t\tTestRunner runner = (TestRunner) ctx;\n\n\t\tOUTPUT_PATH = (new File(runner.getOutputDirectory())).getParent();\n\t\tIMAGES_PATH = new File(runner.getOutputDirectory()).getParent() + \"_Images\\\\\";\n\n\t\t//Globals variables populated here --- START ---\n\t\tCommonClass.bRunInTestMode \t\t= bRunInTestMode;\n\t\tCommonClass.bPrintScreen \t\t= bPrintScreen;\n\t\tCommonClass.CHROME_DRIVER_PATH\t= CHROME_DRIVER_PATH;\n\t\tCommonClass.IE_DRIVER_PATH \t\t= IE_DRIVER_PATH;\n\t\tCommonClass.OUTPUT_PATH \t\t= OUTPUT_PATH;\n\t\tCommonClass.IMAGES_PATH \t\t= IMAGES_PATH;\n\t\tCommonClass.iWaitForElement \t= iWaitForElement;\n\t\tCommonClass.iWaitForThread \t\t= iWaitForThread;\n\t\tCommonClass.iWaitForThread1 \t= iWaitForThread1;\n\t\tCommonClass.iWaitForThread2 \t= iWaitForThread2;\n\t\tCommonClass.sBaseURL\t\t\t= sBaseURL;\n\t\t//Globals variables populated here --- END ---\n\t\t\n\t\t//Globals variables dumped here --- START ---\n\t\tlog.debug(\"CHROME_DRIVER_PATH:\" + CHROME_DRIVER_PATH);\n\t\tlog.debug(\"IE_DRIVER_PATH:\" + IE_DRIVER_PATH);\n\t\tlog.debug(\"Output Folder:\" + OUTPUT_PATH);\n\t\tlog.debug(\"Images Folder:\" + IMAGES_PATH);\n\t\t//Globals variables dumped here --- END ---\n\t}", "@Override\n public void prepare() {\n applicationDeployer.initialize();\n this.initialize();\n }", "public void initializeImages() {\n\n File dir = new File(\"Images\");\n if (!dir.exists()) {\n boolean success = dir.mkdir();\n System.out.println(\"Images directory created!\");\n }\n }", "public void setup() {\n this.imageStore = new ImageStore(\n createImageColored(TILE_WIDTH, TILE_HEIGHT,\n DEFAULT_IMAGE_COLOR));\n this.world = new WorldModel(WORLD_ROWS, WORLD_COLS,\n createDefaultBackground(imageStore));\n this.view = new WorldView(VIEW_ROWS, VIEW_COLS, this, world, TILE_WIDTH,\n TILE_HEIGHT);\n this.scheduler = new EventScheduler(timeScale);\n\n loadImages(IMAGE_LIST_FILE_NAME, imageStore, this);\n loadWorld(world, LOAD_FILE_NAME, imageStore);\n\n scheduleActions(world, scheduler, imageStore);\n\n nextTime = System.currentTimeMillis() + TIMER_ACTION_PERIOD;\n }", "protected void setup() {\n /**\n * Content manager manages the content languages and ontologies \"known\" by a given agent.\n * We register new languages that is required that our agent knows.\n * SLCodec is the codec class for the FIPA-SLn languages.\n * MobilityOntology is the class that represents the ontology used for JADE mobility.\n */\n getContentManager().registerLanguage(new SLCodec());\n getContentManager().registerOntology(MobilityOntology.getInstance());\n\n /**\n * Create containers. ProfileImpl allows us to set boot-parameters for the new containers.\n */\n homeContainer = getContainerController(); //retrieve the containercontroller that this agent lives in\n createdContainers = new AgentContainer[3]; //we require 3 containers for this scenario\n ProfileImpl curatorContainer1 = new ProfileImpl();\n curatorContainer1.setParameter(ProfileImpl.CONTAINER_NAME, \"Curator-Container-1\");\n ProfileImpl curatorContainer2 = new ProfileImpl();\n curatorContainer2.setParameter(ProfileImpl.CONTAINER_NAME, \"Curator-Container-2\");\n ProfileImpl artistManagerContainer = new ProfileImpl();\n artistManagerContainer.setParameter(ProfileImpl.CONTAINER_NAME, \"Artistmanager-Container\");\n createdContainers[0] = runtime.createAgentContainer(curatorContainer1);\n createdContainers[1] = runtime.createAgentContainer(curatorContainer2);\n createdContainers[2] = runtime.createAgentContainer(artistManagerContainer);\n doWait(2000); //wait while containers initializes\n\n /**\n * Request a list of all containers on the platform from AMS\n */\n getAllContainers();\n\n /**\n * Initialize gui\n */\n\n myGui = new ControllerAgentGUI(this, (String[]) containersOnPlatform.keySet().toArray(new String[containersOnPlatform.keySet().size()]));\n myGui.setVisible(true);\n }", "@Before\n public void setup() {\n endpoint = new Endpoint();\n endpoint.setKey(1);\n endpoint.setUrl(URI.create(\"http://localhost/nmr\"));\n\n // Installation, synchronized against\n installation = new Installation();\n installation.setType(InstallationType.TAPIR_INSTALLATION);\n installation.addEndpoint(endpoint);\n\n // Populated Dataset\n dataset = prepareDataset();\n\n // RegistryUpdater, using mocked web service client implementation\n updater = new RegistryUpdater(datasetService, metasyncHistoryService);\n }", "protected void setUp() throws Exception {\n super.setUp();\n TestHelper.loadConfig(CONFIG); //load config file\n TestHelper.backupConfig(CONFIG); //back config file preventing it from being modified during the test\n\n exporter = new ImageManipulationImageExporter();\n jframe = new PrintFrame(400, 400, \"abcdefghijklmn\", true);\n }", "@BeforeAll\n public static void configInitialization() {\n System.setProperty(\"VSAC_DRC_URL\", \"https://vsac.nlm.nih.gov/vsac\");\n System.setProperty(\"SERVER_TICKET_URL\", \"https://vsac.nlm.nih.gov/vsac/ws/Ticket\");\n System.setProperty(\"SERVER_SINGLE_VALUESET_URL\", \"https://vsac.nlm.nih.gov/vsac/ws/RetrieveValueSet?\");\n System.setProperty(\"SERVER_MULTIPLE_VALUESET_URL_NEW\", \"https://vsac.nlm.nih.gov/vsac/svs/RetrieveMultipleValueSets?\");\n System.setProperty(\"SERVICE_URL\", \"http://umlsks.nlm.nih.gov\");\n System.setProperty(\"PROFILE_SERVICE\", \"https://vsac.nlm.nih.gov/vsac/profiles\");\n System.setProperty(\"VERSION_SERVICE\", \"https://vsac.nlm.nih.gov/vsac/oid/\");\n }", "@BeforeClass(alwaysRun = true)\n\t@Parameters(\"Environment\")\n\tpublic void startEnvironment(String sEnv) {\n\t\ttry {\n\t\t\tcs = null;\n\t\t\tal = new AppLib(cs);\n\t\t\tal.setEnvironmentInfo(sEnv);\n\t\t\tproxy = al.getHttpProxy();\n\t\t\tapi = new API();\n\t\t\tapi.setProxy(proxy);\n\t\t\tmydb = al.getMongoDbConnection();\n\t\t\tma = new MemberAPIs();\n\t\t\tmember = new TC01_FindMemberFromDB();\n\t\t\t} catch (Exception e) {\n\t\t\t\tfail(e.toString());\n\t\t\t\t}\n\t}", "@BeforeClass\n\tpublic void setUp() {\n\t\tapp = app.get(ApplicationSourcesRepo.getFirefoxHerokuApplication());\n\n\t}", "public void create(Environment environment);", "public void setup()\n {\n // we use a separate ArrayList to keep track of each animal. \n // our room is 50 x 50.\n creatures = new ArrayList<Creature>();\n for (int i = 0; i < 55; i++) {\n if (i < 5) {\n creatures.add(new Fox((int)(Math.random()*48)+1, 1, (int)(Math.random()*48)+1)); \n } else {\n creatures.add(new Tux((int)(Math.random()*48)+1, 1, (int)(Math.random()*48)+1));\n }\n }\n \n env.setRoom(new Room());\n \n // Add all the animals into to the environment for display\n for (Creature c : creatures) {\n env.addObject(c);\n }\n \n // Sets up the camera\n env.setCameraXYZ(25, 50, 55);\n env.setCameraPitch(-63);\n \n // Turn off the default controls\n env.setDefaultControl(false);\n env.setShowController(false);\n \n }", "private void randomizeEnvironment() {\n }", "private void setupEnviroment(){\n\t\tLogUtil.i(TestCaseConstants.TAG, \"setupEnviroment start\");\n\t\tBitmap avatar = BitmapFactory.decodeResource(getInstrumentation().getContext().getResources(), TestCaseConstants.resid_avatar_default);\n\t\tfor(int i=0;i<TestCaseConstants.countOfCustomer;i++){\n\t\t\tContactUser user = new ContactUser();\n\t\t\tuser.setunique_id(i+10000L);\n\t\t\tuser.setusername(\"test\"+(10000L+i));\n\t\t\tuser.setusertype(Constants.USER);\n\t\t\tuser.setlastupdate((10000L+i));\n\t\t\tAttachmentStore.saveBitmap(avatar, StorageUtil.getWritePath(\"avatar_\"+(10000L+i), StorageType.TYPE_IMAGE), false);\n\t\t\tuser.setavatar(\"file://\"+StorageUtil.getWritePath(\"avatar_\"+(10000L+i),StorageType.TYPE_IMAGE));\n\t\t\tuser.setavatar_original(\"file://\"+StorageUtil.getWritePath(\"avatar_\"+(10000L+i),StorageType.TYPE_IMAGE));\n\t\t\tuser.setcountrycode(\"1\");\n\t\t\tuser.setcellphone(\"139117\"+(10000L+i));\n\t\t\tSamService.getInstance().getDao().update_ContactUser_db(user);\n\n\t\t\tContact customer = new Contact(i+10000L,\"test\"+(10000L+i),user.getavatar());\n\t\t\tSamService.getInstance().getDao().update_ContactList_db(customer,true);\n\t\t}\n\t\tavatar.recycle();\n\t\tLogUtil.i(TestCaseConstants.TAG, \"setupEnviroment finished\");\n\t}", "@Before\n public void setUp() throws Exception {\n String apiKey = System.getenv(\"OST_KIT_API_KEY\");\n if ( null == apiKey ) {\n throw new Exception(\"Environment Variable OST_KIT_API_KEY is not set.\");\n }\n \n // get the ost kit api secret from environment.\n String apiSecret = System.getenv(\"OST_KIT_API_SECRET\");\n if ( null == apiSecret ) {\n throw new Exception(\"Environment Variable OST_KIT_API_SECRET is not set.\");\n }\n \n // get the ost kit api endpoint from environment.\n String v0Endpoint = System.getenv(\"OST_KIT_API_ENDPOINT\");\n if ( null == v0Endpoint ) {\n throw new Exception(\"Environment Variable OST_KIT_API_ENDPOINT is not set.\");\n }\n \n // get the ost kit api endpoint for v1 version from environment.\n String v1Endpoint = System.getenv(\"OST_KIT_API_V1_ENDPOINT\");\n if ( null == v1Endpoint ) {\n throw new Exception(\"Environment Variable OST_KIT_API_V1_ENDPOINT is not set.\");\n }\n\n apiV0Params = new HashMap<String, Object>();\n apiV0Params.put( \"apiKey\", apiKey);\n apiV0Params.put( \"apiSecret\", apiSecret);\n apiV0Params.put( \"apiEndpoint\", v0Endpoint);\n\n apiV1Params = new HashMap<String, Object>();\n apiV1Params.put( \"apiKey\", apiKey);\n apiV1Params.put( \"apiSecret\", apiSecret);\n apiV1Params.put( \"apiEndpoint\", v1Endpoint);\n }", "@Before\n public void setUp() {\n int[][][] testImage = new int[4][4][3];\n image = new ImageImpl(testImage);\n }", "public void setup()\n {\n this.imageStore = new ImageStore(\n createImageColored(TILE_WIDTH, TILE_HEIGHT, DEFAULT_IMAGE_COLOR));\n this.world = new WorldModel(WORLD_ROWS, WORLD_COLS,\n createDefaultBackground(imageStore));\n this.view = new WorldView(VIEW_ROWS, VIEW_COLS, this, world,\n TILE_WIDTH, TILE_HEIGHT);\n this.scheduler = new EventScheduler(timeScale);\n\n loadImages(IMAGE_LIST_FILE_NAME, imageStore, this);\n loadWorld(world, LOAD_FILE_NAME, imageStore);\n\n scheduleActions(world, scheduler, imageStore);\n\n next_time = System.currentTimeMillis() + TIMER_ACTION_PERIOD;\n click = false;\n }", "protected void setUp() throws Exception {\n TestEnvironnement.forceFakeDriver();\n testEnv = TestEnvironnement.newEnvironment();\n Dependency.setConnectionManager(testEnv.getConnectionManager());\n }", "@BeforeClass\n public static void init() throws Exception {\n System.setProperty(\"instanceUri\", STANDALONE.getClass().getMethod(\"getBaseURI\").invoke(STANDALONE).toString());\n }", "protected void init()\r\n\t{\n\t\tif (ConfigManager.getInstance().getIsCrossClassify() && WekaTool.dataStageOn)\r\n\t\t{\r\n\t\t\t//System.out.println(\"in init for data stage\");\r\n\t\t\tsrcDirUrl = ConfigManager.getInstance().getTrainPath();\r\n\t\t\tdestDirUrl = ConfigManager.getInstance().getTrainPath() +\r\n\t\t\t File.separator + \"output\";\r\n\t\t\t//System.out.println(\"srcDirUrl = \" + srcDirUrl);\r\n\t\t\t//System.out.println(\"destDirUrl = \" + destDirUrl);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//System.out.println(\"here, good\");\r\n\t\t\tsrcDirUrl = getSrcDirUrl();\r\n\t\t\tdestDirUrl = getDestDirUrl();\r\n\t\t}\r\n\t\tdatalibSVMUrl = getLibSVMDirUrl();\r\n\t\ttry {\r\n\t\t\tsrcDir = Utils.getDir(srcDirUrl);\r\n\t\t\tdestDir = Utils.getDir(destDirUrl);\r\n\t\t} catch (Exception e)\r\n\t\t{\r\n\t\t}\r\n\t}", "public void setEnvironment(Map<String, String> environment);", "@BeforeSuite\n\tpublic void configSetup() throws IOException {\n\n\t\t// ****** Creating FileInputStream object to read from\n\t\t// Environment.properties file\n\n\t\tenv = new FileInputStream(\n\t\t\t\t\"C:\\\\Automation\\\\Workspace\\\\UptakeProject\\\\src\\\\configuration\\\\Environment.properties\");\n\t\tenvData = new Properties();\n\t\tenvData.load(env);\n\n\t\t// ****** Creating FileInputStream object to read from\n\t\t// ExpectedResult.properties file\n\n\t\texp = new FileInputStream(\n\t\t\t\t\"C:\\\\Automation\\\\Workspace\\\\UptakeProject\\\\src\\\\configuration\\\\ExpectedResult.properties\");\n\t\texpData = new Properties();\n\t\texpData.load(exp);\n\n\t\t// ****** Initializing driver for the browser type that is mentioned in\n\t\t// Environment.properties file\n\n\t\tif (envData.getProperty(\"Browsertype\").equals(\"Firefox\")) {\n\t\t\tSystem.setProperty(\"webdriver.gecko.driver\",\n\t\t\t\t\t\"C:\\\\Automation\\\\Workspace\\\\UptakeProject\\\\BrowserExecutables\\\\geckodriver.exe\");\n\t\t\tdriver = new FirefoxDriver();\n\t\t} else if (envData.getProperty(\"Browsertype\").equals(\"Chrome\")) {\n\t\t\tSystem.setProperty(\"webdriver.chrome.driver\",\n\t\t\t\t\t\"C:\\\\Automation\\\\Workspace\\\\UptakeProject\\\\BrowserExecutables\\\\chromedriver.exe\");\n\t\t\tdriver = new ChromeDriver();\n\t\t} else if (envData.getProperty(\"Browsertype\").equals(\"IE\")) {\n\t\t\tSystem.setProperty(\"webdriver.ie.driver\",\n\t\t\t\t\t\"C:\\\\Automation\\\\Workspace\\\\UptakeProject\\\\BrowserExecutables\\\\IEDriverServer.exe\");\n\t\t\tdriver = new InternetExplorerDriver();\n\t\t}\n\n\t\t// ****** Launching the URL that is mentioned in Environment.properties\n\t\t// file\n\n\t\tdriver.get(envData.getProperty(\"Website_URL\"));\n\n\t\t// ****** Defining implicit wait for the test\n\n\t\tdriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);\n\n\t\t// ****** Defining explicit wait for the test\n\n\t\twait = new WebDriverWait(driver, 15);\n\t}", "public static void setup() {\n\t\tEseoTest.driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);\n\t\tEseoTest.driver.manage().window().setSize(new Dimension(1024, 768));\n\t}", "@BeforeTest\n public void setupEnv() {\n CLUSTER.start();\n endpoints = CLUSTER.getClientEndpoints();\n Client client = Client.builder()\n .endpoints(endpoints)\n .build();\n\n this.authDisabledKVClient = client.getKVClient();\n this.authDisabledAuthClient = client.getAuthClient();\n }", "private void setup() throws Exception {\n\t}", "void setEnvironment(Properties properties);", "private void setup() {\n\t\tpopulateEntitiesLists();\n\t\t// rayHandler.setCombinedMatrix(batch.getProjectionMatrix());\n\t\tambientColor = Color.CLEAR;\n\t\tsetAmbientAlpha(.3f);\n\t\tfpsLogger = new FPSLogger();\n\t\tdynamicEntities = new ArrayList<DynamicEntity>();\n\t\tfont.getData().setScale(DEBUG_FONT_SCALE);\n\t}", "@BeforeEach\n\tpublic void init() throws NotJpgException {\n\t\t// fixture\n\t\timagePath = \"src/main/resources/skillvssalary.jpeg\";\n\t\timagePath2 = \"src/main/resources/success.jpg\";\n\t\tnotImage = \"src/main/resources/dwa\";\n\t\tphoto = new Photo(imagePath);\n\t}", "public void initialize()\r\n {\r\n ceresImage = new Image(\"Ceres.png\");\r\n erisImage = new Image(\"Eris.png\");\r\n haumeaImage = new Image(\"Haumea.png\");\r\n makemakeImage = new Image(\"MakeMake.png\");\r\n plutoImage = new Image(\"Pluto.png\");\r\n }", "@BeforeClass\r\n\tpublic void setUp() {\n\t\tdriver = BrowserFactory.startApplication(DataProviderFactory.getConfig().getStagingURL(), DataProviderFactory.getConfig().getBrowser());\r\n\t}", "@BeforeAll\n public static void setup() {\n baseExpectedParams = AttributeMap.builder()\n .put(S3ClientContextParams.USE_ARN_REGION, false)\n .put(S3ClientContextParams.DISABLE_MULTI_REGION_ACCESS_POINTS, false)\n .put(S3ClientContextParams.ACCELERATE, false)\n .put(S3ClientContextParams.FORCE_PATH_STYLE, false)\n .build();\n }", "public static void setup() {\n/* 78 */ s_envCurrentJRE = getProperty(\"jnlpx.jpda.env\");\n/* 79 */ o_envCurrentJRE = decodeJpdaEnv(s_envCurrentJRE);\n/* */ \n/* */ \n/* */ \n/* 83 */ if (getProperty(\"jpda.notification\") != null) {\n/* 84 */ showJpdaNotificationWindow(o_envCurrentJRE);\n/* 85 */ Main.systemExit(0);\n/* */ } \n/* */ }", "@Before\r\n\tpublic void setup()\r\n\t{\n\t\tgame = factory.makeHantoGame(HantoGameID.EPSILON_HANTO, BLUE);\r\n\t}", "void setEnvironment(Environment environment) {\n this.environment = environment;\n }", "protected void setupImpl()\n {\n hint(DISABLE_DEPTH_TEST);\n font = loadFont(\"Futura-CondensedExtraBold-200.vlw\");\n textFont(font, 200);\n mode = 0;\n\n // Mode 3\n w = width * 2;\n dx = (TWO_PI / period) * xspacing;\n yvalues = new float[w/xspacing];\n\n // Mode 5\n mod = loadImage(\"mod.png\");\n modSizes = new int[scaledBandLevels.length];\n }", "public void setup() {\r\n smooth();\r\n // TODO: Try other images.\r\n img = loadImage(\"frog.jpg\");\r\n\r\n // Create and initialize the 2D array from individual pixels\r\n // in the image. Note that img.pixels is a 2D array - it contains\r\n // all the rows of the images strung in a long line, one row after an\r\n // other.\r\n pixelArray = new int[img.width][img.height];\r\n for (int i = 0; i < img.width; i++) {\r\n for (int j = 0; j < img.height; j++) {\r\n pixelArray[i][j] = img.pixels[j * img.width + i];\r\n }\r\n }\r\n }", "@BeforeEach\n\tpublic void setup() {\n\t\tif (!initialized) {\n\t\t\tbaseURI = String.format(uri, port);\n\t\t\tinitialized = true;\n\t\t}\n\t}", "public void setUp() throws Exception {\n jvmVersion = System.getProperty(\"java.class.version\");\n System.setProperty(\"java.class.version\", \"47.0\");\n vendor = System.getProperty(\"java.vendor\");\n System.setProperty(\"java.vendor\", \"Sun Microsystems\");\n }", "public void setup() throws Exception {\n setup(new File(\".\"));\n }", "protected void setUp() throws Exception {\n\t\tDesktopLauncher.main(new String[] {});\n\n\t}", "void setEnvironment(CudaEnvironment environment);", "public void setUp()\n\t{\n\t\tif (driver == null){\n\t\t\t\n\t\t\ttry {\n\t\t\t\tSystem.out.println(System.getProperty(\"user.dir\")+ \"\\\\src\\\\test\\\\resources\\\\properties\\\\Config.properties\");\n\t\t\t\tfis = new FileInputStream(System.getProperty(\"user.dir\")+ \"\\\\src\\\\test\\\\resources\\\\properties\\\\Config.properties\");\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t\t\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconfig.load(fis);\n\t\t\t\tSystem.out.println(\"config file loaded\");\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tfis = new FileInputStream(System.getProperty(\"user.dir\")+\"\\\\src\\\\test\\\\resources\\\\properties\\\\OR.properties\");\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tOR.load(fis);\n\t\t\t\t//config.load(fis);\n\t\t\t\tSystem.out.println(\"OR file loaded\");\n\t\t\t\tSystem.out.println(System.getenv(\"browser\"));\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tif (System.getenv(\"browser\")!= null)\n\t\t\t\t{\n\t\t\t\t\tbrowser = System.getenv(\"browser\");\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\telse{\n\t\t\t\t\t\n\t\t\t\t\tbrowser = config.getProperty(\"browser\");\n\t\t\t\t\t\n\t\t\t\t}\n\t\tconfig.setProperty(browser, browser);\n\t\tif (config.getProperty(\"browser\").equals(\"chrome\"))\n\t\t\t\n\t\t{\n\t\t\tSystem.setProperty(\"webdriver.chrome.driver\",System.getProperty(\"user.dir\") + \"\\\\src\\\\test\\\\resources\\\\executables\\\\chromedriver.exe\");\n\t\t\tdriver = new ChromeDriver();\n\t\t\tSystem.out.println(\"Chrome Launched !!!\");\n\t\t}\n\t\t//System.setProperty(\"webdriver.chrome.driver\", \"C:\\\\Program Files (x86)\\\\chromedriver_win32\\\\chromedriver.exe\");\n\t\t//driver = new ChromeDriver();\n\t\tSystem.out.println(System.getProperty(\"TestEnv\"));\n\t\tdriver.get(config.getProperty(\"testsiteurl\").replace(\"{TestEnv}\", System.getProperty(\"TestEnv\")));\n\t\tSystem.out.println(\"Navigated to : \" + config.getProperty(\"testsiteurl\"));\n\t\tdriver.manage().window().maximize();\n\t\t\n\t}", "private void beginSetup() {\n try {\n if (dbType.equals(\"mysql\")) {\n Class.forName(\"gwe.sql.gweMysqlDriver\");\n }\n else if (dbType.equals(\"postgresql\")) {\n Class.forName(\"org.postgresql.Driver\");\n }\n } catch (ClassNotFoundException cnfe) {\n System.out.println(\"setup constructor ClassNotFound: \"+cnfe);\n System.out.println(\"Could not load the mysql driver: please check your classpath\");\n System.exit(-1);\n }\n\n try {\n if (!tableExists(DEFAULT_DB_CONFIG_TABLE)) {\n createConfigTable(DEFAULT_DB_CONFIG_TABLE);\n }\n } catch (SQLException sqle) {\n System.out.println(\"setup beginSetup SQLException: \"+sqle);\n System.out.println(\"Trouble interacting with vizConfig database table\");\n System.exit(-2);\n }\n prepareFrame();\n }", "@Override\n\tprotected void setUp() throws Exception\n\t{\n\t\tTestEnvironment te = TestEnvironment.getTestEnvironment();\n\n\t\tif (EquationCommonContext.getContext().checkIfGPIsInstalled(te.getSessionId()))\n\t\t{\n\t\t\tEquationCommonContext.getContext().loadEquationConfigurationPropertiesBean();\n\t\t\tEquationCommonContext.getContext().runSystemStatusManagerMonitor();\n\t\t}\n\t\tif (session == null)\n\t\t{\n\t\t\tunit = te.getEquationUnit();\n\t\t\tuser = te.getEquationUser();\n\t\t\tsession = user.getSession();\n\t\t}\n\n\t\tsuper.setUp();\n\t}", "@Before\n\tpublic void setUp() throws Exception {\n\t\truntimeConfig = ConfigLoader.load(\n\t\t\t\tnew File(resourcesDir,\n\t\t\t\t\t\t\"benchmark_config_with_ls_specific_settings.conf\").getAbsolutePath());\n\t\t\n\t\tscenario = new Scenario(\"animals\", \"mammal\");\n\t\t\n\t\ttmpDir = Files.createTempDir();\n\t\ttmpDir.mkdirs();\n\t\t\n\t\tfileFinder = new FileFinder(new File(\".\").getAbsolutePath(), scenario);\n\t\t// arbitrarily set to tmpDir\n\t\tfileFinder = fileFinder.updateWorkDir(tmpDir);\n\t\t\n\t\texamples = new PosNegExamples();\n\t\texamples.put(Constants.ExType.POS, Sets.newHashSet(\"one\", \"two\", \"three\"));\n\t\texamples.put(Constants.ExType.NEG, Sets.newHashSet(\"four\", \"five\", \"six\", \"seven\"));\n\t\tlog = new BenchmarkLog();\n\t}", "@BeforeTest\r\n\tpublic void setup()throws InterruptedException, MalformedURLException, IOException {\t\t\r\n\t\ttry {\r\n\t\t\t\r\n\t\t\t// Stream the data from the config properties file and store in the object input\r\n\t\t\tinput = new FileInputStream(\"./config.properties\");\r\n\t\t\tProperties prop = new Properties();\r\n\t\t\t\r\n\t\t\t// Load the data into prop object\r\n\t\t\tprop.load(input);\r\n\t\t\t\r\n\t\t\t//Assign the values into the variables taken from config properties file\r\n\t\t\tstrBrowser = prop.getProperty(\"BROWSER\");\r\n\t\t\tstrBaseUrl = prop.getProperty(\"BASE_URL\");\r\n\t\t\t\r\n\t\t\t//Choose the browser and launch by getting the values from config properties file\r\n\t\t\tif(strBrowser.equalsIgnoreCase(\"chrome\")) {\r\n\t\t\t\t\r\n\t\t\t\t//Sets the property of the chrome driver\r\n\t\t\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"./Drivers/chromedriver.exe\");\r\n\t\t\t\t\r\n\t\t\t\tdriver = new ChromeDriver();\r\n\t\t\t\t\r\n\t\t\t\t// Yet to provide the details for both IE and firefox below\r\n\t\t\t} else if(strBrowser.equalsIgnoreCase(\"ie\")) {\r\n\t\t\t\tSystem.setProperty(\"\", \"\");\r\n\t\t\t\tdriver = new InternetExplorerDriver();\r\n\t\t\t} else if(strBrowser.equalsIgnoreCase(\"firefox\")) {\r\n\t\t\t\tSystem.setProperty(\"\", \"\");\r\n\t\t\t\tdriver = new FirefoxDriver();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tdriver.get(strBaseUrl);\r\n\t\t\tdriver.manage().window().maximize();\r\n\t\t\t\r\n\t\t} catch(Exception e) {\r\n\t\t\tSystem.out.println(\"Provide a valid data for driver\");\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t}", "@BeforeClass\n\t\tpublic static void setup() {\n\t\t\t// Get the browser to use in testing\n\t\t\tSystem.setProperty(\"testBrowser\", \"chrome\");\n\t\t\t\n\t\t\t// Get the browser to use in testing\n\t\t\tString browserToUse = System.getProperty(\"testBrowser\");\n\t\t\t\n\t\t\t// Open the specified browser\n\t\t\topenBrowser(browserToUse);\n\t\t}", "static void setupDefaultEnvironment() throws IOException {\n String rioHomeDirectory = getRioHomeDirectory();\n File logDir = new File(rioHomeDirectory+\"logs\");\n checkAccess(logDir, false);\n }", "public void initVariables() {\n\tif (CL_Initializer.headerTemplateFile == null) {\n\n\t if (ImageHeader.imageExists(CL_Initializer.inputFile)) {\n\t\tCL_Initializer.headerTemplateFile = CL_Initializer.inputFile;\n\t }\n\t else if (imageType == imageType.BEDPOSTX || imageType == imageType.BEDPOSTX_DYAD) {\n\n\t\tString bedpostxRoot = BedpostxTractographyImage.getBedpostxInputRoot(bedpostxDir);\n\t\tString ext = BedpostxTractographyImage.getBedpostxImageExtension(bedpostxRoot);\n\t\t\n\t\tCL_Initializer.headerTemplateFile = bedpostxRoot + \"dyads1\" + ext;\n\t \n\t }\n\t \n\t}\n\n\t\n if (CL_Initializer.headerTemplateFile != null) { \n logger.info(\"Defining input physical space from \" + CL_Initializer.headerTemplateFile);\n CL_Initializer.initInputSpaceAndHeaderOptions();\n }\n else if (CL_Initializer.voxelDims[0] > 0.0) { \n CL_Initializer.initInputSpaceAndHeaderOptions();\n }\n else if (seedFile != null) {\n logger.info(\"Defining input physical space from seed file\");\n CL_Initializer.headerTemplateFile = seedFile;\n CL_Initializer.initInputSpaceAndHeaderOptions();\n }\n \n\n\n xDataDim = CL_Initializer.dataDims[0];\n yDataDim = CL_Initializer.dataDims[1];\n zDataDim = CL_Initializer.dataDims[2];\n \n xVoxelDim = CL_Initializer.voxelDims[0];\n yVoxelDim = CL_Initializer.voxelDims[1];\n zVoxelDim = CL_Initializer.voxelDims[2];\n\n if (xVoxelDim == 0.0) {\n // failed to get a definition of input space from anywhere\n throw new LoggedException(\"Definition of input space required, use -header\");\n }\n\n\n voxelToPhysicalTrans = CL_Initializer.headerTemplate.getVoxelToPhysicalTransform();\n\n\n\tif (anisThresh > 0.0) {\n\t switch(imageType) {\n\t\t\n\t case DT : case MULTITENSOR : case BEDPOSTX : case BEDPOSTX_DYAD :\n\t\t// No problem since these input formats have anisotropy information built in\n\t\tbreak;\n\t\t\n\t default: \n\t\t\n\t\tif (anisMapFile == null) {\n\t\t throw new LoggedException(\"Input data does not contain anisotropy, anisotropy map (-anisfile) must be \" +\n\t\t\t\t\t \"supplied when -anisthresh is used\");\n\t\t}\n\t }\n\t}\n\n\n // no interpolation with FACT, by definition\n if (trackingAlgorithm == TrackingAlgorithm.FACT) {\n\n if (dataInterpolation != DataInterpolation.NEAREST_NEIGHBOUR) { \n logger.warning(\"Interpolation is not compatible with FACT tracking, using Euler tracker with step size \" + stepSize + \" mm\");\n }\n\n trackingAlgorithm = TrackingAlgorithm.EULER;\n }\n\n \n ran = new MTRandom(seed);\n \n \n // get seeds\n if (seedFile != null) {\n \n VoxelROI imageROIs = new VoxelROI(seedFile, CL_Initializer.headerTemplate);\n\n allROIs = imageROIs.getAllRegions();\n \n }\n else if (seedList != null) {\n allROIs = new RegionOfInterest[] {PointListROI.readPoints(seedList, CL_Initializer.headerTemplate)};\n }\n\telse {\n\t throw new LoggedException(\"No seed points specified\");\n\t}\n \n \n }", "@Override\n\tpublic void assertEnvironment(TargetEnvironment environment) {\n\t\tassertEquals(\"i386:x86-64\", environment.getArchitecture());\n\t\tassertEquals(\"GNU/Linux\", environment.getOperatingSystem());\n\t\tassertEquals(\"little\", environment.getEndian());\n\t\tassertTrue(environment.getDebugger().toLowerCase().contains(\"gdb\"));\n\t}", "@BeforeClass\n public static void setUp() throws Exception {\n game = ((StonePits) Gdx.app.getApplicationListener());\n soundMan = game.getSoundManager();\n assetMan = game.getAssetManager();\n }", "@BeforeClass\n\tpublic static void setup() {\n\t\tmatrixAdditionCalculator = new MatrixAdditionCalculator();\n\n\t}", "void init() {\n List<Artifact> artifacts = null;\n final List<RepositoryInfo> infos = RepositoryPreferences.getInstance().getRepositoryInfos();\n for (final RepositoryInfo info : infos) {\n if (info.isLocal()) {\n final File localrepo = new File(info.getRepositoryPath() + File.separator\n + DEFAULT_GID_PREFIX.replace('.', '/'));\n if (localrepo.exists()) {\n artifacts = resolveArtifacts(new File(info.getRepositoryPath()), localrepo);\n }\n }\n }\n\n if (artifacts == null) {\n artifacts = new ArrayList<Artifact>(1);\n }\n\n populateLocalTree(artifacts);\n populateAppPane(model.getApps());\n }", "protected void setupLocal() {}", "@Before\n\tpublic void testEachSetup() {\n\t\ttestGrid = new Grid(50,50);\n\t\tundoRedo_TestStack = new UndoRedo();\n\t\tSystem.out.println(\"Setting up test...\");\n\t}", "protected void setup() {\r\n }", "@SuppressWarnings(\"deprecation\")\n @Before\n public final void setup(final TestContext aContext) {\n final ConfigRetriever configRetriever = ConfigRetriever.create(myRunTestOnContextRule.vertx());\n final Async asyncTask = aContext.async();\n\n configRetriever.getConfig(configuration -> {\n if (configuration.failed()) {\n aContext.fail(configuration.cause());\n } else {\n myConfigs = configuration.result();\n myImageServerURL = myConfigs.getString(Config.IIIF_URL);\n\n if (myAmazonS3 == null) {\n final String s3AccessKey = myConfigs.getString(Config.S3_ACCESS_KEY);\n final String s3SecretKey = myConfigs.getString(Config.S3_SECRET_KEY);\n\n // get myAWSCredentials ready\n myAWSCredentials = new BasicAWSCredentials(s3AccessKey, s3SecretKey);\n\n // instantiate the myAmazonS3 client\n myAmazonS3 = new AmazonS3Client(myAWSCredentials);\n }\n\n s3Bucket = myConfigs.getString(Config.S3_BUCKET);\n TestUtils.complete(asyncTask);\n }\n });\n }", "public void setup()\n {\n this.p = Player.getInstance();\n\n this.imageStore = new ImageStore(\n createImageColored(TILE_WIDTH, TILE_HEIGHT, DEFAULT_IMAGE_COLOR));\n this.world = new WorldModel(WORLD_ROWS, WORLD_COLS,\n createDefaultBackground(imageStore));\n this.view = new WorldView(VIEW_ROWS, VIEW_COLS, this, world,\n TILE_WIDTH, TILE_HEIGHT);\n this.scheduler = new EventScheduler(timeScale);\n\n background = loadImage(\"images\\\\farm2.jpg\");\n background.resize(VIEW_WIDTH, VIEW_HEIGHT);\n\n loadImages(IMAGE_LIST_FILE_NAME, imageStore, this);\n loadWorld(world, LOAD_FILE_NAME, imageStore);\n\n scheduleActions(world, scheduler, imageStore);\n\n next_time = System.currentTimeMillis() + TIMER_ACTION_PERIOD;\n }", "@BeforeTest\n public void setup() {\n\n String browser = Environment.getProperties().browser().toString().toLowerCase();\n\n switch (browser) {\n \n case \"firefox\":\n FirefoxOptions options = new FirefoxOptions(); \n if(Environment.getProperties().headless()){\n options.addArguments(\"--headless\");\n }\n driver = new FirefoxDriver();\n break;\n \n default:\n ChromeOptions optionsChrome = new ChromeOptions();\n if(Environment.getProperties().headless()){\n optionsChrome.addArguments(\"--headless\");\n } \n driver = new ChromeDriver(optionsChrome);\n break;\n } \n\n driver.manage().window().maximize();\n }", "@Before\n public void setup() {\n Assert.assertNotNull(ministerRepository);\n Assert.assertNotNull(territoryRepository);\n }", "@Before\n\n /**\n * An one dimensional array is created and it is used to run the unit test for Histogram's public methods\n */\n public void setUp() throws FitsException, ClassNotFoundException, IOException {\n\n inFits = FileLoader.loadFits(ImageDataTest.class , fileName);\n frArray = FitsRead.createFitsReadArray(inFits);\n rangeValues = FitsRead.getDefaultRangeValues();\n expectedImage = ImageIO.read(new File(FileLoader.getDataPath(ImageDataTest.class)+imageFileName));\n expectedImageWithMask = ImageIO.read(new File(FileLoader.getDataPath(ImageDataTest.class)+imageWithMaskFileName));\n\n imageData = new ImageData(frArray, IMAGE_TYPE,COLROID, rangeValues, 0,0, 100, 100, true );\n }", "@BeforeClass\n public static void setup() throws Exception {\n LOGGER.info(\"Setting up PIP Testing\");\n //\n // Create instance\n //\n pipEngine = new GetOperationOutcomePip();\n //\n // Load our test properties to use\n //\n Properties properties = new Properties();\n try (FileInputStream is = new FileInputStream(\"src/test/resources/test.properties\")) {\n properties.load(is);\n }\n //\n // Configure it using properties\n //\n pipEngine.configure(\"issuer\", properties);\n LOGGER.info(\"PIP configured now creating our entity manager\");\n LOGGER.info(\"properties {}\", properties);\n //\n // Connect to in-mem db\n //\n String persistenceUnit = GetOperationOutcomePip.ISSUER_NAME + \".persistenceunit\";\n LOGGER.info(\"persistenceunit {}\", persistenceUnit);\n em = Persistence.createEntityManagerFactory(properties.getProperty(persistenceUnit), properties)\n .createEntityManager();\n //\n //\n //\n LOGGER.info(\"Configured own entity manager\", em.toString());\n }", "@Before\r\n\tpublic void setup() {\r\n\t}", "@BeforeSuite\n\tpublic void setUp() {\n\t\tlogger.info(\"IN SETUP METHOD: performing pretest configurations\");\n\t\ttry {\n\t\t\tinput = new FileInputStream(\"config.properties\");\n\t\t\tprop.load(input);\n\t\t} catch (IOException e) {\n\t\t\tlogger.error(e);\n\t\t\t\n\t\t}\n\t\t//Set the browser from the cmd line or from config.properties file\n\t\tString browser = System.getProperty(\"browser\", prop.getProperty(\"browser\"));\n\t\tlogger.info(\"Selected browser is: \" + browser);\n\t\tgmailPg.driverSetup(browser, prop.getProperty(\"remote\"));\n\t\tgmailPg.explicitWaitSetup();\n\t\tgmailPg.loadXpathProps();\n\t}", "protected void setEnvironment(Map<String, String> env) {\n\t\tthis.environment = env;\n\t}", "public void setup() {\n }", "void setupBackgrounds() {\n // initialize the background tool\n BackgroundTool bgTool = new BackgroundTool(codeBaseString);\n bgSwitch = bgTool.getSwitch();\n bgChooser = bgTool.getChooser();\n }", "private void initSetUp()\n\t{\n\t\tthis.setActionName(NAME);\n\t\tthis.setDescription(DESCRIPTION);\n\t\tthis.setMagic(IS_MAGIC);\n\t\tthis.setAttack(IS_ATTACK);\n\t\tthis.setTargetSelf(IS_TARGET_SELF);\n\t\tthis.setInternalName(INTERNAL_NAME);\n\t}", "@BeforeClass\n\tpublic static void setup() {\n\n\t}", "private void initialiseByHand() {\n Configuration production = new Configuration(\"api.example.com\", false, 2000);\n Configuration staging = new Configuration(\"api-staging.example.com\", false, 2000);\n Configuration debug = new Configuration(\"api-dev.example.com\", true, 1000);\n Map<String, Configuration> baseVariants = new HashMap<>();\n baseVariants.put(PRODUCTION, production);\n baseVariants.put(STAGING, staging);\n baseVariants.put(DEBUG, debug);\n Neanderthal.initialise(this, baseVariants, PRODUCTION);\n }", "private void prepareTestEnv() throws InterruptedException {\n\n createGroup(numDataNodes);\n\n for (int i=0; i < numDataNodes; i++) {\n final ReplicatedEnvironment env = repEnvInfo[i].getEnv();\n final int targetGroupSize = groupSize;\n\n ReplicationGroup group = null;\n for (int j=0; j < 100; j++) {\n group = env.getGroup();\n if (group.getNodes().size() == targetGroupSize) {\n break;\n }\n /* Wait for the replica to catch up. */\n Thread.sleep(1000);\n }\n assertEquals(\"Nodes\", targetGroupSize, group.getNodes().size());\n assertEquals(RepTestUtils.TEST_REP_GROUP_NAME, group.getName());\n for (int ii = 0; ii < targetGroupSize; ii++) {\n RepTestUtils.RepEnvInfo rinfo = repEnvInfo[ii];\n final ReplicationConfig repConfig = rinfo.getRepConfig();\n ReplicationNode member =\n group.getMember(repConfig.getNodeName());\n assertNotNull(\"Member\", member);\n assertEquals(repConfig.getNodeName(), member.getName());\n assertEquals(repConfig.getNodeType(), member.getType());\n assertEquals(repConfig.getNodeSocketAddress(),\n member.getSocketAddress());\n }\n\n /* verify data nodes */\n final Set<ReplicationNode> dataNodes = group.getDataNodes();\n for (final ReplicationNode n : dataNodes) {\n assertEquals(NodeType.ELECTABLE, n.getType());\n }\n logger.info(\"data nodes verified\");\n }\n }", "@Before\n\tpublic void setup() {\n\t\t\n\t\t\n\t}", "@Parameters({\"useCloudEnv\", \"userName\", \"accessKey\", \"os\", \"browserName\", \"browserVersion\", \"url\", \"ScreenCastValue\"})\n @BeforeMethod\n public void setUp(@Optional(\"false\") boolean useCloudEnv, @Optional(\"mdhossain\") String userName, @Optional(\"\")\n String accessKey, @Optional(\"Windows 8\") String os, @Optional(\"firefox\") String browserName, @Optional(\"34\")\n String browseVersion, @Optional(\"http://www.google.com\") String url, @Optional(\"false\") boolean screenCastValue) throws IOException, NullPointerException {\n BasicConfigurator.configure();\n if (useCloudEnv == true) {\n // run in cloud\n getCloudDriver(userName, accessKey, os, browserName, browseVersion);\n } else {\n // run in local\n getLocalDriver(os, browserName);\n // logger.info(\"Test is running on Local\");\n }\n driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);\n driver.get(url);\n driver.manage().window().maximize();\n }", "public synchronized void setEnvironment(TestEnvironment environment) {\n if (!isMutable()) {\n throw new IllegalStateException(\n \"This TestResult is no longer mutable!\");\n }\n for (TestEnvironment.Element elem : environment.elementsUsed()) {\n // this is stunningly inefficient and should be fixed\n env = PropertyArray.put(env, elem.getKey(), elem.getValue());\n }\n }", "@BeforeClass\n\t\tpublic static void setUp() {\n\t\t\tboard = Board.getInstance();\n\t\t\t// set the file names to use my config files\n\t\t\tboard.setConfigFiles(\"ourConfigFiles/GameBoard.csv\", \"ourConfigFiles/Rooms.txt\");\t\t\n\t\t\t// Initialize will load BOTH config files \n\t\t\tboard.setCardFiles(\"ourConfigFiles/Players.txt\", \"ourConfigFiles/Weapons.txt\");\t\t\n\t\t\t// Initialize will load BOTH config files \n\t\t\tboard.initialize();\n\t\t}", "@BeforeClass\n public static void beforeAll() {\n // The logger is shared by everything so this is the right place for it.\n TestSupportLogger.initLogger();\n\n /**\n * The context represents the application environment - should be fine to set up once here.\n * It includes creation and adding (as attributes) other one off objects such as:\n * - SessionFactory\n * - Configuration\n * - GalleryManager\n */\n context = new MockServletContext(TestSupportConstants.contextBaseDirPrefix + TestSupportConstants.contextBaseDir, null);\n String realPath = context.getRealPath(\"/\");\n assertEquals(TestSupportConstants.contextBaseDir, realPath);\n\n factory = TestSupportSessionFactory.getSessionFactory();\n\n context.setAttribute(\"sessionFactory\", factory);\n assertSame(factory, context.getAttribute(\"sessionFactory\"));\n\n configurationManager = new Configuration(factory);\n // Test one configuration value to check this has worked.\n assertTrue(((BlogEnabled) (configurationManager.getConfigurationItem(\"blogEnabled\"))).get());\n\n context.setAttribute(\"configuration\", configurationManager);\n assertSame(configurationManager, context.getAttribute(\"configuration\"));\n\n galleryManager = gallerySetup();\n context.setAttribute(\"Galleries\",galleryManager);\n assertSame(galleryManager, context.getAttribute(\"Galleries\"));\n }", "public void initialization() {\n\t\t\t\n\t\t if(prop.getProperty(\"browser\").equals(\"chrome\")) {\n\t\t \t\n\t\t \tWebDriverManager.chromedriver().setup();\n\t\t\t\t\n\t\t\t\t driver=new ChromeDriver();\n\t\t\t\t\n\t\t } else if(prop.getProperty(\"browser\").equals(\"firefox\")) {\n\t\t \t\n\t\t \tWebDriverManager.firefoxdriver().setup();\n\t\t\t\t\n\t\t\t\t driver=new FirefoxDriver();\n\t\t\t\t \n\t\t } else if(prop.getProperty(\"browser\").equals(\"edge\")) {\n\t\t \tWebDriverManager.edgedriver().setup();\n\t\t\t\t\n\t\t\t\t driver=new EdgeDriver();\n\t\t \t\n\t\t }\n\t\t\t\n\t }" ]
[ "0.6501957", "0.6066527", "0.6045768", "0.5954028", "0.59119165", "0.5781158", "0.5763087", "0.57365215", "0.57365215", "0.57193226", "0.5708826", "0.56955266", "0.5616164", "0.55979705", "0.55858314", "0.55790514", "0.55513793", "0.55493385", "0.5520407", "0.546932", "0.5455312", "0.5444245", "0.5432923", "0.5420995", "0.54063976", "0.539325", "0.5389146", "0.53887457", "0.53836477", "0.53752494", "0.5353074", "0.5349741", "0.5341762", "0.53253967", "0.5317849", "0.5311123", "0.5281626", "0.5266899", "0.52474153", "0.5241333", "0.522921", "0.52288324", "0.52267367", "0.522471", "0.5224629", "0.5213083", "0.5184967", "0.51791507", "0.5169696", "0.5156458", "0.51537544", "0.5144718", "0.5132582", "0.51225954", "0.5122372", "0.51185393", "0.51145995", "0.5106017", "0.51057094", "0.5101217", "0.5096854", "0.5092503", "0.5088448", "0.50835943", "0.5073074", "0.50684553", "0.5066192", "0.50642514", "0.5058379", "0.50510126", "0.50508946", "0.50429887", "0.50425094", "0.5039345", "0.503619", "0.5029088", "0.5028886", "0.5027842", "0.5025828", "0.50248814", "0.50247085", "0.50146645", "0.5012759", "0.5008497", "0.5002061", "0.5001151", "0.49947938", "0.49891412", "0.49874005", "0.498733", "0.49840483", "0.49817735", "0.497408", "0.49696842", "0.49668056", "0.49628776", "0.4961896", "0.49587113", "0.49553296", "0.49539423" ]
0.579224
5
Tear down environment for image comparison.
private void tearDown() { if (tempDir != null) { OS.deleteDirectory(tempDir); tempFiles.clear(); tempDir = null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@After\n\tpublic void teardown() {\n\t\tdrv.quit();\n\t}", "protected void tearDown() {\n testEnv.close();\n }", "@After\r\n public void tearDown() throws Exception {\r\n super.tearDown();\r\n TestHelper.cleanupEnvironment();\r\n instance = null;\r\n }", "public void teardown() {\n LOGGER.info(\"Shutting down driver\");\n driver.quit();\n }", "public void clearEnvironment()\r\n\t{\r\n\t\tEnvironment.e = null;\r\n\t}", "public void shutdown() {\n\t\tInput.cleanUp();\n\t\tVAO.cleanUp();\n\t\tTexture2D.cleanUp();\n\t\tResourceLoader.cleanUp();\n\t}", "@AfterClass(alwaysRun = true)\n public void stopEnvironment() {\n \ttry {\n al.closeMongoDbConnection();\n \t} catch (Exception e) {\n\t\t\tfail(e.toString());\n\t\t\t}\n }", "public static void teardown() {\n\t\tdriver.quit();\n\t}", "@After\n public void teardown() {\n RoboGuice.Util.reset();\n }", "void reset() throws EnvironmentException;", "public void environmentStop(EnvironmentClassLoader loader)\n {\n forceClose();\n }", "public void shutDown() {\n StunStack.shutDown();\n stunStack = null;\n stunProvider = null;\n requestSender = null;\n\n this.started = false;\n\n }", "protected void tearDown() throws Exception {\n action = null;\n manager = null;\n activityGraph = null;\n state = null;\n\n TestHelper.clearProjectConfiguration();\n }", "@AfterEach\n public void tearDown() throws Exception\n {\n\n application = null;\n config = null;\n externalContext = null;\n if (facesContext != null)\n {\n facesContext.release();\n }\n facesContext = null;\n lifecycle = null;\n lifecycleFactory = null;\n renderKit = null;\n request = null;\n response = null;\n servletContext = null;\n session = null;\n FactoryFinder.releaseFactories();\n ResourceBundleVarNames.resetNames();\n\n tearDownClassloader();\n }", "public void destroy(){\n runner.destroy();\n }", "public synchronized void shutDown() {\n\t state.shutDown();\n\t}", "protected void tearDown() {\n config = null;\n }", "@After\n public void clearState() throws Exception {\n getTagManager().clearTagsFromMemory();\n getTagManager().removeAllListeners();\n reset(topology);\n bigDeviceManager.clearAntiSpoofingMemoryStructures();\n testDeleteWithoutHttp(\"/tag-manager\");\n if (moduleContext != null) {\n IThreadPoolService tp = \n moduleContext.getServiceImpl(IThreadPoolService.class);\n if (tp != null)\n tp.getScheduledExecutor().shutdown();\n }\n }", "private void shutdown() {\n mMediaRecorder.reset();\n mMediaRecorder.release();\n mCamera.release();\n\n // once the objects have been released they can't be reused\n mMediaRecorder = null;\n mCamera = null;\n }", "protected void tearDown() throws Exception {\n instance = null;\n manager = null;\n AccuracyTestsHelper.clearConfig();\n }", "@After\n public void cleanup()\n throws Exception\n {\n moduleManager.stop();\n }", "@Override\n public void cleanup() {\n if (this.cleanedUp) {\n throw new IllegalStateException(\"Tried cleanup already cleared swapchain!\");\n }\n\n if (this.swapchain != VK_NULL_HANDLE) {\n for (final var imageView : this.imageViews) {\n imageView.close();\n }\n\n vkDestroySwapchainKHR(this.deviceContext.getDeviceHandle(), this.swapchain, null);\n }\n this.cleanedUp = true;\n }", "@Override\n public void tearDown() {\n setName(caseLabel + '-' + getName());\n\n if (env != null) {\n try {\n closeAll();\n } catch (Throwable e) {\n System.out.println(\"During tearDown: \" + e);\n }\n }\n envHome = null;\n env = null;\n store = null;\n caseCls = null;\n caseObj = null;\n caseLabel = null;\n\n /* Do not delete log files so they can be used by 2nd phase of test. */\n }", "@After\n\tpublic void teardown() {\n\t\tthis.driver.quit();\n\t}", "@AfterSuite\n\tpublic void teardown() {\n\t\t\n\t\tdriver.quit();\n\t}", "public static void shutdown ()\n\t{\n\t\tif (m_interpreter != null)\n\t\t{\n\t\t\tm_console.dispose ();\n\t\t\tm_interpreter.cleanup ();\n\t\t}\n\t}", "@After\n public void teardown() throws Exception{\n localScribenginCluster.shutdown();\n }", "public void shutdown(){\n\t\tAndroidSensorDataManagerSingleton.cleanup();\n\t}", "public void ShutDown()\n {\n bRunning = false;\n \n LaunchLog.Log(COMMS, LOG_NAME, \"Shut down instruction received...\");\n\n for(LaunchServerSession session : Sessions.values())\n {\n LaunchLog.Log(COMMS, LOG_NAME, \"Closing session...\");\n session.Close();\n }\n \n LaunchLog.Log(COMMS, LOG_NAME, \"...All sessions are closed.\");\n }", "@AfterTest\n\tpublic void teardown()\n\t{\n\t\t\n\t\tdriver.close();\n\t}", "void exitSession()\n\t{\n\t\t// clear out our watchpoint list and displays\n\t\t// keep breakpoints around so that we can try to reapply them if we reconnect\n\t\tm_displays.clear();\n\t\tm_watchpoints.clear();\n\n\t\tif (m_fileInfo != null)\n\t\t\tm_fileInfo.unbind();\n\n\t\tif (m_session != null)\n\t\t\tm_session.terminate();\n\n\t\tm_session = null;\n\t\tm_fileInfo = null;\n\t}", "@AfterClass\n public static void destroyDriver() {\n driver.quit();\n driver = null;\n }", "@Override\n\tpublic void onDestroy() {\n\t\tquitAllFocus();\n\t\timg.setImageBitmap(null);\n\t\tclearMemory();\n\t\tsuper.onDestroy();\n\t\ttry {\n\t\t\t//GARBAGE COLLECTOR\n\t\t\tSystem.gc();\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t}\n\t}", "@After\n\tpublic void tearDown() throws Exception {\n\t\t// release the memory\n\t\tringBuffer = null;\n\t}", "public static void shutdown()\n\t{\n\t\tinstance = null;\n\t}", "public void stop()\n {\n _panel.cleanup();\n _appContext.cleanup();\n }", "public void destroy(){\n\t\tIterator toolIterator = tools.iterator();\n\t\twhile(toolIterator.hasNext()){\n\t\t\tToolBridge tb = (ToolBridge) toolIterator.next();\n\t\t\ttb.terminate();\n\t\t}\n\n\t\tmultiplexingClientServer.stopRunning();\n\t}", "@After\n public void tearDown() {\n try {\n removeKeyPair(ALIAS_IMPORTED);\n removeKeyPair(ALIAS_GENERATED);\n removeKeyPair(ALIAS_1);\n } catch (RemoteException e) {\n // Nothing to do here but warn that clean-up was not successful.\n Log.w(TAG, \"Failed cleaning up installed keys\", e);\n }\n unbindTestSupportService();\n assertThat(mIsSupportServiceBound).isFalse();\n unbindKeyChainService();\n assertThat(mIsKeyChainServiceBound).isFalse();\n }", "@AfterClass\r\n public static void tearDown() throws Exception {\r\n instance = null;\r\n }", "@After\r\n\tpublic void tearDown() {\r\n\t\tvend = null; \r\n\t\tcsListen = null;\r\n\t\tdcListen = null;\r\n\t}", "@AfterClass\n\tpublic static void teardown() {\n\t\tmatrixAdditionCalculator = null;\n\n\t}", "public void tearDown() {\n instance = null;\n }", "@AfterClass\n\tpublic void teardown()\n\t{\n\t\tdriver.close();\n\t}", "void destroy() {\n \t\ttry {\r\n \t\t\tupKeep.stopRunning();\r\n \t\t} catch (InterruptedException e) {\r\n \t\t}\r\n \r\n \t\t// Kill all running processes.\r\n \t\tfor (MaximaProcess mp : pool) {\r\n \t\t\tmp.kill();\r\n \t\t}\r\n \t\tpool.clear();\r\n \r\n \t\t// Kill all used processes.\r\n \t\tfor (MaximaProcess mp : usedPool) {\r\n \t\t\tmp.kill();\r\n \t\t}\r\n \t\tusedPool.clear();\r\n \t}", "@AfterSuite\n\tpublic void teardown() {\n\t\tlogger.info(\"ALL TESTS COMPLETED: Quiting driver\");\n\t\tgmailPg.quitDriver();\n\t}", "public void destroy() {\n getBuildContextHolder().destroy();\n rememberedSet.clear();\n }", "public static void shutDown(){\n for(int i = PS3_LIST_.size()-1; i >= 0; i--){\n PS3 instance = PS3_LIST_.get(i);\n instance.setLed(false);\n instance.destroy();\n }\n PS3Logger.log(PS3Logger.TYPE.DEBUG, null, \"PS3 SHUTDOWN\");\n }", "public void deactivate() {\n\t\tlog.info(\"Deactivating simple JNDI environment\");\n\t\tactivated = null;\n\t}", "public static void shut () {\r\n if(factory != null) { \t \r\n factory.finalixe(); \r\n }\r\n factory = null ;\r\n }", "@Override\n public void afterEach(ExtensionContext context) throws Exception {\n if (!failedBoot) {\n RestAssuredURLManager.clearURL();\n TestScopeManager.tearDown(true);\n }\n }", "void teardown();", "void teardown();", "protected void tearDown() throws Exception {\r\n AccuracyTestHelper.tearDownDataBase();\r\n AccuracyTestHelper.clearConfig();\r\n\r\n instance = null;\r\n }", "@Override\n public final void preTearDown() throws Exception {\n Invoke.invokeInEveryVM(() -> ConcurrentIndexUpdateWithoutWLDUnitTest.destroyRegions());\n Invoke.invokeInEveryVM(CacheTestCase::closeCache);\n }", "public void destroy() {\r\n Display.destroy();\r\n System.exit(0);\r\n }", "public static void tearDown() {\n \tif(driver != null) {//if you get a nullpointer exception, the driver is not initialized\n \tdriver.quit(); //only when the driver is initialized only then driver will quit, not if not initialized\n \t}\n }", "public static void kill(){\r\n\t\tDisplay.destroy();//create Display\r\n\t\tMouse.destroy();//create Mouse\r\n\t\tKeyboard.destroy();//create Keyboard\r\n\t}", "public void teardown() {\n for (App app : applications) {\n app.icon.setCallback(null);\n }\n\t}", "@AfterClass\n\tpublic static void tearDown() throws RemoteException, NotBoundException {\n\t\tSystem.out.println(\n\t\t\t\t\"----------------------------------------Test Recovery Tearing down----------------------------------------\");\n\t\treg.unbind(BINDING_NAME);\n\t\treg = null;\n\t\tSystem.out.println(\n\t\t\t\t\"----------------------------------------Test Recovery Tear down done----------------------------------------\");\n\t}", "@AfterClass\n\tpublic static void teardown() {\n\t\tdataMunger = null;\n\n\t}", "@AfterClass\n public static void teardown() {\n app = null;\n\n }", "protected void tearDown() throws Exception {\r\n validator = null;\r\n bundle = null;\r\n TestHelper.clearConfiguration();\r\n }", "@AfterClass\r\n\tpublic static void testCleanup() {\r\n\t\tConfig.teardown();\r\n\t}", "public void stop(BundleContext context) throws Exception {\n super.stop(context);\n ivyCpcSerializer = null;\n ivyAttachmentManager = null;\n resourceBundle = null;\n IWorkspace workspace = ResourcesPlugin.getWorkspace();\n workspace.removeSaveParticipant(ID);\n colorManager = null;\n ivyMarkerManager = null;\n ivyResolveJob = null;\n retrieveSetupManager = null;\n workspace.removeResourceChangeListener(workspaceListener);\n workspaceListener = null;\n workspace.removeResourceChangeListener(ivyFileListener);\n ivyFileListener = null;\n\n getPreferenceStore().removePropertyChangeListener(propertyListener);\n propertyListener = null;\n\n if (console != null) {\n console.destroy();\n }\n plugin = null;\n }", "@After\n\tpublic void cleanUp() {\n\t\tsuper.unload();\n\n\t\t// shutdown the database\n\t\tif (db != null) {\n\t\t\tdb.shutDownDb();\n\t\t}\n\t\tassertTrue(Files.deleteDir(tmpDir));\n\t}", "@AfterAll\n\tpublic static void destroy() {\n\t\tif (isSingleTest) {\n\t\t\tlogger.debug(\"Closing ChromeDriver for single test class.\");\n\t\t\tIntegrationUITestListener.stopWebDriver();\n\t\t}\n\t}", "public static void tearDown() {\n\t\tif (driver != null) {\n\t\t\tdriver.quit();\n\t\t}\n\t}", "public void destroy() {\n this.bfc.cleanUp();\n }", "@After\n\tpublic void tearDown() throws Exception {\n\t\tg1 = null;\n\t\tg2 = null;\n\t\tg3 = null;\n\t}", "public static void destruct() {\n\t\tinstance = null;\n\t}", "@Override\n public void postEnvCall() {\n shutdown(this.getEnvironment());\n }", "void deactivate() {\n\t\tanimalTemplate = null;\n\t\tscope=null;\n\t\ttriggerOnID=false;\n\t\tstate = null;\n\t\tlog.debug(bundleMarker, \"deactivating...\");\n\t}", "@AfterClass\n\tpublic static void tearDownAfterClass() throws Exception {\n\t\tydelseService = null;\n\t}", "public static void shutdown() {\n resetCache();\n listeningForChanges = false;\n }", "@Teardown\n public void tearDown() {\n if (channel != null) {\n channel.shutdownNow();\n channel = null;\n }\n }", "public static void releaseState() {\n MockPageContext.methodArguments.clear();\n MockPageContext.methodResults.clear();\n MockPageContext.throwExceptions.clear();\n MockPageContext.globalException = null;\n }", "@After\n\n\tpublic void tearDown() {\n\n\t\tif (dummyFrame != null) {\n\n\t\t\tdummyFrame.dispose();\n\n\t\t}\n\n\t}", "public static void tearDown() {\n reset();\n clear();\n APIConfig.getInstance().setAppId(null, null);\n APIConfig.getInstance().setDeviceId(null);\n APIConfig.getInstance().setToken(null);\n APIConfig.getInstance().setUserId(null);\n Leanplum.setApplicationContext(null);\n }", "public void destroy() {\n destroyFingerprintSDK();\n //destroyDB();\n }", "public void destroy() {\n this.octaveExec.destroy();\n }", "@Override\n protected void onDestroy() {\n EasyImage.clearConfiguration(this);\n super.onDestroy();\n }", "public static void destroy() {\n\t}", "protected void tearDown() throws Exception {\r\n super.tearDown();\r\n FailureTestHelper.unloadConfig();\r\n }", "@After\n\tpublic void tearDown() throws Exception {\n\t\tinstance.unlock();\n\t}", "protected void tearDown() {\n\n\t\tif (isNetwork) {\n\t\t\tserver.stop();\n\t\t\tserver = null;\n\t\t\tisServer = false;\n\t\t}\n\t}", "@After\n public void tearDown() {\n controller\n .pause()\n .stop()\n .destroy();\n }", "protected void tearDown() throws Exception {\n actionManager = null;\n TestHelper.clearConfig();\n super.tearDown();\n }", "@AfterSuite\r\n\tpublic void tearDown() {\r\n\t\tSystem.out.println(\"Driver teared down\");\r\n\t}", "private void cleanUp(){\n\t\tSSHUtil sSHUtil=(SSHUtil) SpringUtil.getBean(\"sSHUtil\");\n\t\ttry {\n\t\t\tsSHUtil.disconnect();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static synchronized void cleanup() {\n if (defaultDataSourceInitialized) {\n // try to deregister bundled H2 driver\n try {\n final Enumeration<Driver> drivers = DriverManager.getDrivers();\n while (drivers.hasMoreElements()) {\n final Driver driver = drivers.nextElement();\n if (\"org.h2.Driver\".equals(driver.getClass().getCanonicalName())) {\n // deregister our bundled H2 driver\n LOG.info(\"Uninstalling bundled H2 driver\");\n DriverManager.deregisterDriver(driver);\n }\n }\n } catch (Exception e) {\n LOG.warn(\"Failed to deregister H2 driver\", e);\n }\n }\n \n dataSourcesByName.clear();\n for (int i = 0; i < dataSources.length; i++) {\n dataSources[i] = null;\n }\n for (int i = 0; i < dataSourcesNoTX.length; i++) {\n dataSourcesNoTX[i] = null;\n }\n globalDataSource = null;\n testDataSource = null;\n testDataSourceNoTX = null;\n }", "protected void tearDown() \n\t{\n\t\tif (container != null) \n\t\t{\n\t\t\tcontainer.dispose();\n\t\t}\n\t\tcontainer = null;\n\t}", "public synchronized void shutdown() {\n try {\n stop();\n } catch (Exception ex) {\n }\n \n try {\n cleanup();\n } catch (Exception ex) {\n }\n }", "@Override\r\n protected void tearDown() throws Exception {\r\n ctx = null;\r\n projectService = null;\r\n }", "public static void cleanUp() {\n\t\tHashDecay.stopAll();\n\t\tSystem.gc();\n\t}", "@After\n public void tearDown(){\n choose = null;\n tmp = null;\n }", "@After\n\tpublic void tearDown() throws Exception {\n\t\teventDao = null;\t\t\n\t\tcontroller = null;\n\t\tresponse = null;\n\t\trequest = null;\n\t}", "@AfterEach\n public void tearDown() {\n scope.close();\n tracer = null;\n assertNull(tracer);\n }", "public void cleanShutDown () {\n shutdown = true;\n }", "@AfterClass(alwaysRun = true)\n public static void cleanup() {\n try {\n driver.close();\n driver.quit();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "@AfterClass(alwaysRun = true)\n\tpublic void destroy() throws Exception {\n\t\tsuper.cleanup();\n\t}" ]
[ "0.6883036", "0.67982364", "0.67860067", "0.67677087", "0.676313", "0.67410654", "0.67196417", "0.66758204", "0.65085566", "0.65056604", "0.6503522", "0.643088", "0.6429619", "0.6397748", "0.6397187", "0.6395781", "0.63939166", "0.6389152", "0.6375153", "0.6353316", "0.6343867", "0.63299525", "0.6311273", "0.63018715", "0.62966734", "0.62931424", "0.62843937", "0.62786573", "0.62527275", "0.625024", "0.624694", "0.6246591", "0.62402266", "0.623557", "0.6230228", "0.62289995", "0.6223152", "0.6221068", "0.62163734", "0.62158376", "0.6209729", "0.6206065", "0.6202742", "0.6197709", "0.6160396", "0.61525816", "0.6145373", "0.61352324", "0.6130577", "0.61261874", "0.6118868", "0.6118868", "0.61087763", "0.61080295", "0.61017346", "0.6094465", "0.6089381", "0.6089217", "0.6084883", "0.60836345", "0.60824496", "0.607763", "0.6071708", "0.6064168", "0.60483587", "0.6045922", "0.6042497", "0.6040217", "0.60255456", "0.6024828", "0.6021369", "0.6020284", "0.6019326", "0.6017228", "0.6016864", "0.601497", "0.5998537", "0.59966284", "0.5995842", "0.5995294", "0.59938633", "0.5991146", "0.59854245", "0.59837306", "0.598277", "0.59823704", "0.59817564", "0.5981215", "0.59754735", "0.59747005", "0.59726226", "0.5972253", "0.5970387", "0.5968207", "0.5962861", "0.59617054", "0.5959412", "0.5957073", "0.5956739", "0.595645" ]
0.6054986
64
TODO Autogenerated method stub
@Override public void selectDataGridByProvince(PageInfo pageInfo) { Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize()); page.setOrderByField(pageInfo.getSort()); page.setAsc(pageInfo.getOrder().equalsIgnoreCase("asc")); List<Map<String, Object>> list = dataMapper.selectDataPageByProvince(page, pageInfo.getCondition()); pageInfo.setRows(list); pageInfo.setTotal(page.getTotal()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
TODO Autogenerated method stub
@Override public void selectDataGridByPrinciple(PageInfo pageInfo) { Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize()); page.setOrderByField(pageInfo.getSort()); page.setAsc(pageInfo.getOrder().equalsIgnoreCase("asc")); List<Map<String, Object>> list = dataMapper.selectDataPageByPrinciple(page, pageInfo.getCondition()); pageInfo.setRows(list); pageInfo.setTotal(page.getTotal()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Step 1: Read in the radius Create a scanner object
public static void main(String[] args) { Scanner input = new Scanner(System.in); //Prompt user to enter a radius System.out.print("Please enter a radius: "); double radius = input.nextDouble(); // Step 2: Compute area double area = radius*radius*3.141359; // Step 3: Display the area System.out.println("The area for the circle of radius " + radius + " is " + area); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) {\r\n\t\tdouble circum;\r\n\t\t\r\n\t\t\r\n\t\tSystem.out.println(\"Type the radius:\");\r\n\t int radius = STDIN_SCANNER.nextInt();\r\n\t \r\n\t \r\n\t circum = 2 * Math.PI * radius;\r\n\t \r\n\t System.out.println(\"Circumference of the Circle: \" + circum);\r\n\t \r\n\t \r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\r\n}", "void doScanner() {\r\n\t\tsetTurnRadarLeftRadians(2 * PI);\r\n\t}", "public Scanner(java.io.Reader in) {\n this.zzReader = in;\n }", "public Scanner(java.io.Reader in) {\n this.zzReader = in;\n }", "private static Circle readCircle(String s) {\n\t\tScanner line = new Scanner(s);\n\n\t\tint x = line.nextInt();\n\t\tint y = line.nextInt();\n\t\tint vx = line.nextInt();\n\t\tint vy = line.nextInt();\n\t\tboolean isFilled = line.nextBoolean();\n\t\tint diameter = line.nextInt();\n\t\tColor colour = Color.rgb(line.nextInt(), line.nextInt(), line.nextInt());\n\t\tint insertionTime = line.nextInt();\n\t\tboolean willPulse = line.nextBoolean();\n\t\tline.close();\n\n\t\treturn new Circle(insertionTime, x, y, vx, vy, diameter, colour, isFilled, willPulse);\n\t}", "public Scanner(java.io.Reader in) {\r\n this.zzReader = in;\r\n }", "private static Coord getInput() throws IOException\n {\n \n //Information to be passed to the constructor\n Scanner typeOfCoord = new Scanner(System.in);\n System.out.print(\"Enter the type of Coordinates you \"\n + \"are inputting ((C)artesian / (P)olar): \");\n char type = typeOfCoord.next().charAt(0);\n type = Character.toUpperCase(type); \n \n if (type == 'C'){\n Scanner first = new Scanner(System.in);\n System.out.print(\"Enter the X Coordinate using a decimal point(.):\");\n double x = first.nextDouble();\n \n Scanner second = new Scanner(System.in);\n System.out.print(\"Enter the Y Coordinate using a decimal point(.):\");\n double y = second.nextDouble();\n \n \n return new Cartesian(x,y);\n }\n else if (type == 'P');{\n \n Scanner first = new Scanner(System.in);\n System.out.print(\"Enter the Rho Coordinate using a decimal point(.):\");\n double rho = first.nextDouble();\n \n Scanner second = new Scanner(System.in);\n System.out.print(\"Enter the Theta Coordinate using a decimal point(.):\");\n double theta = second.nextDouble();\n \n return new Polar(rho,theta);\n }\n \n \n \n \n \n}", "public static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\r\n\t\tSystem.out.println(\"Enter the radius of the circle: \");\r\n\t\tdouble r=sc.nextDouble();\r\n\t\tdouble area=Math.PI * (r*r);\r\n\t\tSystem.out.println(\"The area of circle is: \"+area);\r\n\t\tdouble circumference=Math.PI * 2*r;\r\n\t\tSystem.out.println(\"The circumference of circle is: \"+circumference);\r\n\t\tsc.close();\r\n\r\n\t}", "public Ex1Circle(double radiusIn)\n {\n radius = radiusIn;\n }", "public static double getRadius(){\n Scanner kb = new Scanner(System.in);\n double radius = 0;\n\n System.out.println(\"Please enter in the radius: \");\n radius = kb.nextDouble();\n\n // if they don't enter in a number\n if(radius == 0){\n System.out.println(\"Please enter in a number: \");\n radius = kb.nextDouble();\n return radius;\n }\n\n // if negative number\n if(radius < 0){\n System.out.println(\"The radius must be greater than zero. \\nPlease enter the radius: \");\n radius = kb.nextDouble();\n return radius;\n }\n\n return radius;\n }", "public PCLParser(java_cup.runtime.Scanner s) {super(s);}", "private Scanner getScanner(String fixedString) throws IOException {\n\t\tURLConnection connection = new URL(SUPERVALU_URL_START +fixedString).openConnection();\n\t\treturn new Scanner(connection.getInputStream());\n\t}", "public static void main(String[] args) {\n\n Locale.setDefault(Locale.US); //1\n Scanner sc = new Scanner(System.in); //1\n\n Calculator_Membros_Estaticos2 calc = new Calculator_Membros_Estaticos2(); //2\n System.out.print(\"Enter radius: \"); //3\n\n double radius = sc.nextDouble(); //4\n double c = calc.circumference(radius); //5\n double v = calc.volume(radius); //5\n\n System.out.printf(\"Circumference: %.2f%n\", c); //6\n System.out.printf(\"Volume: %.2f%n\", v); //6\n System.out.printf(\"PI value: %.2f%n\", calc.PI); //6\n\n sc.close();\n }", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble radius;\n\t\tdouble circ;\n\t\tSystem.out.println(\"Radius of a circle =\");\n\t\tradius = sc.nextDouble();\n\t\tsc.close();\n\t\tcirc = 2 * radius * Math.PI;\n\t\tSystem.out.println(\"Circumference =\" + circ);\n\t}", "public InputReader() {\n reader = new Scanner(System.in);\n }", "public FractalParser(java_cup.runtime.Scanner s) {super(s);}", "private void start() {\n Scanner scanner = new Scanner(System.in);\n \n // While there is input, read line and parse it.\n String input = scanner.nextLine();\n TokenList parsedTokens = readTokens(input);\n }", "public Scanner(java.io.InputStream in) {\n this(new java.io.InputStreamReader(in));\n }", "public Scanner(java.io.InputStream in) {\n this(new java.io.InputStreamReader(in));\n }", "public void executeTask11 () {\n double r = UserInput.input(\"Input rsdius:\");\n\n //Methods which take one parameter - radius of circle and returns perimeter and lenth:\n double l = CircleCalculator.calculateLength(r);\n double s = CircleCalculator.calculateArea(r);\n\n //Print to the console finaly results:\n Printer.print(\"Circle with r = \" + r + \": \");\n Printer.print(\"L = \" + l);\n Printer.print(\"S = \" + s);\n }", "private ConsoleScanner() {}", "public void setScan(InputStream inStream){\t\t\n\t\tthis.scan = new Scanner (inStream);\t\t\t\t\t\n\t}", "public Scanner(java.io.InputStream in) {\r\n this(new java.io.InputStreamReader(in));\r\n }", "public void cargar(Scanner scanner) {\n posX = Integer.parseInt(scanner.nextLine());\n posY = Integer.parseInt(scanner.nextLine());\n }", "public static void init() {\n\t\tscanner = new Scanner(System.in);\n\t\treturn;\n\t}", "public PasitoScanner(java.io.Reader in) {\n this.yy_reader = in;\n }", "public Parser(Scanner scanner) {\n this.scanner = scanner;\n scan();\n }", "public PasitoScanner(java.io.InputStream in) {\n this(new java.io.InputStreamReader(in));\n }", "public void doScan() throws IOException {\n\t// System.out.println(\"ROVER_02 method doScan()\");\n\tGson gson = new GsonBuilder().setPrettyPrinting().create();\n\tout.println(\"SCAN\");\n\n\tString jsonScanMapIn = in.readLine(); // grabs the string that was\n\t\t\t\t\t\t\t\t\t\t\t// returned first\n\tif (jsonScanMapIn == null) {\n\t\t// System.out.println(\"ROVER_02 check connection to server\");\n\t\tjsonScanMapIn = \"\";\n\t}\n\tStringBuilder jsonScanMap = new StringBuilder();\n\t// System.out.println(\"ROVER_02 incomming SCAN result - first readline:\n\t// \" + jsonScanMapIn);\n\n\tif (jsonScanMapIn.startsWith(\"SCAN\")) {\n\t\twhile (!(jsonScanMapIn = in.readLine()).equals(\"SCAN_END\")) {\n\t\t\t// System.out.println(\"ROVER_02 incomming SCAN result: \" +\n\t\t\t// jsonScanMapIn);\n\t\t\tjsonScanMap.append(jsonScanMapIn);\n\t\t\tjsonScanMap.append(\"\\n\");\n\t\t\t// System.out.println(\"ROVER_02 doScan() bottom of while\");\n\t\t}\n\t} else {\n\t\t// in case the server call gives unexpected results\n\t\tclearReadLineBuffer();\n\t\treturn; // server response did not start with \"SCAN\"\n\t}\n\t// System.out.println(\"ROVER_02 finished scan while\");\n\n\tString jsonScanMapString = jsonScanMap.toString();\n\t// debug print json object to a file\n\t// new MyWriter( jsonScanMapString, 0); //gives a strange result -\n\t// prints the \\n instead of newline character in the file\n\n\t// System.out.println(\"ROVER_02 convert from json back to ScanMap\n\t// class\");\n\t// convert from the json string back to a ScanMap object\n\tscanMap = gson.fromJson(jsonScanMapString, ScanMap.class);\n}", "public Scanner(Reader reader, String confFile) throws Exception{\n\t\tsourceReader = new BufferedReader(reader);\n\t\ttry{\n\t\t\tinit(confFile);\n\t\t}catch(Exception e){\n\t\t\tString msj = \"Error during initializacion of scanner - init()\";\n\t\t\tthrow new Exception(msj,e);\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tScanner s=new Scanner(System.in);\r\n\t\tSystem.out.println(\"Enter the radius: \");\r\n\t\tdouble r=s.nextDouble();\r\n\t\tdouble pi=3.14;\r\n\t\tdouble area=pi*(r*r);\r\n\t\tSystem.out.println(\"Area of circle: \"+area);\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint next = scanner.nextInt();\n\t\tprintCircle(next);\n\t}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public parser(java_cup.runtime.Scanner s) {super(s);}", "public Scanner(InputStream inStream)\n {\n in = new BufferedReader(new InputStreamReader(inStream));\n eof = false;\n getNextChar();\n }", "private Scanner getInput(String name) {\n try {\n return new Scanner(new File(name));\n } catch (IOException excp) {\n throw error(\"could not open %s\", name);\n }\n }", "public void read(final Polygon polygon, final Scanner scanner) {\n polygon.setNumberOfPoints(scanner.nextInt());\n polygon.setPoints();\n\n// Read all points\n for (int count = 0; count < polygon.getNumberOfPoints(); count++) {\n (polygon.getPoints())[count] = new Point();\n (polygon.getPoints())[count].read(scanner);\n }\n\n// Read colors\n polygon.getOutlineColor().read(scanner);\n polygon.getFillColor().read(scanner);\n }", "public void readData(Scanner strScanner) \n {\n super.readData(strScanner);\n \n bodyType = strScanner.next();\n \n noOfDoors = strScanner.nextInt();\n noOfSeats = strScanner.nextInt();\n }", "void scanner() {\r\n\t\tSystem.out.println(\"---------- Scanner\" + ++exampleNumber\r\n\t\t\t\t+ \"----------\");\r\n\r\n\t\tString source = \"asdqw easd casa\";\r\n\t\tScanner s1 = new Scanner(source);\r\n\t\t// hasNext() - testuje wartosc kolejnego tokena, ale go nie pobiera\r\n\t\t// next() - pobiera kolejny token\r\n\t\t// domyslnie bialy znak jest delimiterem\r\n\t\twhile (s1.hasNext()) {\r\n\t\t\tSystem.out.println(s1.next());\r\n\t\t}\r\n\r\n\t\tSystem.out.println(\"---------- Scanner\" + ++exampleNumber\r\n\t\t\t\t+ \"----------\");\r\n\r\n\t\t// hasNextXxx() - dla wszystkich primitives oprocz chara\r\n\t\t// nextXxx() - pobiera kolejny prymitywny token\r\n\t\tScanner s2 = new Scanner(\"1 true 34 hi\");\r\n\t\tboolean b;\r\n\t\twhile (b = s2.hasNext()) {\r\n\t\t\tif (s2.hasNextInt()) {\r\n\t\t\t\tint i = s2.nextInt();\r\n\t\t\t\tSystem.out.println(\"integer token: \" + i);\r\n\t\t\t} else if (s2.hasNextBoolean()) {\r\n\t\t\t\tboolean b2 = s2.nextBoolean();\r\n\t\t\t\tSystem.out.println(\"boolean token: \" + b2);\r\n\t\t\t} else {\r\n\t\t\t\tString str = s2.next();\r\n\t\t\t\tSystem.out.println(\"String token: \" + str);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tSystem.out.println(\"---------- Scanner\" + ++exampleNumber\r\n\t\t\t\t+ \"----------\");\r\n\r\n\t\t// useDelimiter(delimiter) - ustawienie delimitera (wyrazenia regularnego) wg ktorego bedzie przetwarzany strumien\r\n\t\t// domyslnym delimiterem jest spacja, tabulator, ogolnie bialy znak lub znaki\r\n\t\tScanner s3 = new Scanner(\"Test1 true 34 hi\");\r\n\t\ts3.useDelimiter(\"\\\\d\"); // delimiterem jest cyfra\r\n\t\twhile (s3.hasNext()) {\r\n\t\t\tSystem.out.println(s3.next());\r\n\t\t}\r\n\t}", "public java_cup.runtime.Symbol scan()\n throws java.lang.Exception\n {\n return getScanner().next_token(); \n }", "public void readInstanceData(Scanner scan) {\r\n name = scan.next();\r\n address = scan.next();\r\n phone = scan.next();\r\n }", "public MyInput() {\r\n\t\tthis.scanner = new Scanner(System.in);\r\n\t}", "public void read(Scanner input) {\r\n finalRoot = readInternal(input);\r\n }", "public abstract void startSingleScan();", "private static PointCP2 getInput() throws IOException\n {\n byte[] buffer = new byte[1024]; //Buffer to hold byte input\n boolean isOK = false; // Flag set if input correct\n String theInput = \"\"; // Input information\n \n //Information to be passed to the constructor\n \n double a = 0.0;\n double b = 0.0;\n\n // Allow the user to enter the three different arguments\n for (int i = 0; i < 2; i++)\n {\n while (!(isOK))\n {\n isOK = true; //flag set to true assuming input will be valid\n \n // Prompt the user\n if (i == 0) // First argument - type of coordinates\n {\n System.out.print(\"Enter Rho value: \");\n }\n else // Second and third arguments\n {\n System.out.print(\"Enter Theta value: \");\n }\n\n // Get the user's input \n \n // Initialize the buffer before we read the input\n for(int k=0; k<1024; k++)\n \tbuffer[k] = '\\u0020'; \n \n System.in.read(buffer);\n theInput = new String(buffer).trim();\n \n // Verify the user's input\n try\n {\n if (i == 0) // First argument \n {\n a = Double.valueOf(theInput).doubleValue();\n }\n else // Second and \n { \n b = Double.valueOf(theInput).doubleValue();\n }\n }\n catch(Exception e)\n {\n \tSystem.out.println(\"Incorrect input\");\n \tisOK = false; //Reset flag as so not to end while loop\n }\n }\n\n //Reset flag so while loop will prompt for other arguments\n isOK = false;\n }\n //Return a new PointCP object\n return (new PointCP2( a, b));\n }", "public Ch12Ex1to9()\n {\n scan = new Scanner( System.in );\n }", "public Scanner(String source) {\n // The source code read in from stdin is stored here as a char array\n // TODO: if source is empty in Sc.java do something??\n this.source = source.toCharArray();\n this.position = 0;\n this.size = source.length();\n this.comments = false;\n this.depth = 0;\n this.called = false;\n }", "public static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in); \n\t\t\n\t\t//Start of application code\n\t\t/*\n\t\t * Calculate the first circle\n\t\t */\n\t\tSystem.out.println(\"Enter the radius of the 1st circle:\"); //Prompt the user for the radius of the 1st circle\n\t\tdouble radius1 = input.nextDouble(); //Get the input of radius\n\t\t\n\t\t//Edit: Cleaned up the lin by utilizing a method call instead\n\t\tdouble area1 = Circle.getArea(radius1);\n\t\t\n\t\tString area1s = String.format(\"%.2f\", area1); \n\t\tSystem.out.println(\"Area of circle is: \" + area1s);\t\t\n\t\t/*\n\t\t * Calculate the second circle\n\t\t */\n\t\tSystem.out.println(\"Enter the radius of the 2nd circle:\"); //Prompt the user for the radius of the 1st circle\n\t\tdouble radius2 = input.nextDouble(); //Get the input of radius\n\t\t\n\t\t//Edit: Cleaned up the lien by utilizing a method call instead\n\t\tdouble area2 = Circle.getArea(radius2);\n\t\t\n\t\tString area2s = String.format(\"%.2f\", area2); \n\t\tSystem.out.println(\"Area of circle is: \" + area2s);\n\t\t//End of application code\n\t\tinput.close();\n\t}", "private static void readCircuit( Scanner sc ) {\n while (sc.hasNext()) {\n\t String command = sc.next();\n\t if (\"gate\".equals( command )) {\n\t\ttry {\n\t\t gates.add( Gate.newGate( sc ) );\n\t\t} catch (Gate.ConstructorFailure e) {\n\t\t // do nothing, the constructor already reported the error \n\t\t}\n\t } else if (\"wire\".equals( command )) {\n\t\ttry {\n\t\t wires.add( new Wire( sc ) );\n\t\t} catch (Wire.ConstructorFailure e) {\n\t\t // do nothing, the constructor already reported the error \n\t\t}\n\t } else if (\"--\".equals( command )) {\n\t\tsc.nextLine();\n\t } else {\n\t Errors.warn( \"unknown command: \" + command );\n\t\tsc.nextLine();\n\t }\n\t}\n }", "public UserInput()\n {\n try\n {\n scanner = new Scanner(System.in);\n input = new InputMethods();\n citiesTotal = new CityContainer();\n\n if(scanner != null)\n {\n askUser();\n }\n } catch(Exception ex)\n {\n }\n }", "public void scan() throws ScanErrorException\n {\n while(! eof)\n {\n Token next = nextToken();\n if (next != null)\n System.out.println(next);\n }\n\n try\n {\n in.close();\n }\n catch (IOException e)\n {\n System.err.println(\"Catastrophic File IO error.\\n\" + e);\n System.exit(1); \n //exit with nonzero exit code to indicate catastrophic error\n }\n }", "public Scanner(String program) {\n\t\tthis.program=program;\n\t\tpos=0;\n\t\ttoken=null;\n\t\tinitWhitespace(whitespace);\n\t\tinitDigits(digits);\n\t\tinitLetters(letters);\n\t\tinitLegits(legits);\n\t\tinitKeywords(keywords);\n\t\tinitOperators(operators);\n }", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble n = sc.nextDouble() ; \n\t\tcircle A = new circle(n) ;\n\t\tSystem.out.println(A.area());\n\t\tSystem.out.println(A.perimeter());\n\t}", "public java_cup.runtime.Symbol scan()\r\n throws java.lang.Exception\r\n {\r\n\r\n\tSymbol s = this.getScanner().next_token();\r\n\tif (s != null && s.value != null) \r\n\t\tlog.info(s.toString() + \" \" + s.value.toString());\r\n\treturn s;\r\n\r\n }", "private List<CityByDegrees> parseCityInput() throws IOException,NumberFormatException {\r\n\r\n\t\t BufferedReader br = null;\r\n\r\n\t try\r\n\t {\r\n\t \tList <CityByDegrees> cityList = new ArrayList<CityByDegrees>();\r\n\r\n // first try to read from standard input\r\n\t br = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n\t String inputLine = null;\r\n\r\n\t //Retrieve and store the different tokens from each line from STDIN\r\n\t\t\t\t\twhile ((inputLine = br.readLine()) != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinputLine = inputLine.trim();\r\n\t\t\t\t\t\tif(inputLine.startsWith(\"#\")) continue;\r\n\t\t\t\t\t\tString[] tokens = inputLine.split(\"\\\\|\");\r\n\t\t\t\t\t\tString[] interstates = tokens[3].split(\";\");\r\n\t\t\t\t\t\tList interstateList = Arrays.asList(interstates);\r\n\r\n\t\t\t\t\t\tCityByDegrees cityByDegrees = new CityByDegrees(Integer.parseInt(tokens[0].trim()), tokens[1].trim(), tokens[2].trim(), interstateList);\r\n\t\t\t\t\t\tif(cityByDegrees.getCity().equalsIgnoreCase(getStartingVertexCityName())) {\r\n\t\t\t\t\t\t\tcityByDegrees.setDegrees(ZERO_DEGREE);\r\n\t\t\t\t\t\t\tsetStartingVertexCity(cityByDegrees);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcityList.add(cityByDegrees);\r\n\t\t\t\t\t}//end while\r\n\r\n\t\t\t\t\treturn cityList;\r\n\t }\r\n\t\t\tfinally {\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tif (br != null) br.close();\r\n\r\n\t\t\t\t\t\t} catch (IOException ex) {\r\n\r\n\t\t\t\t\t\t\tex.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t}\r\n\t}", "public Scan(byte[] buffer) throws IOException, ClassNotFoundException\n\t{\n\t\t_type = TYPE;\n\t\tdeserialize(buffer);\n\t}", "private RadiusSector() {}", "public Scanner getScanner(){\n\t\t\n\t\tString filename = \"\";\n\t\tfor(int i = 0; i<argList.size(); i++ ){\n\t\t\tif(argList.get(i).equals(\"-f\")){\n\t\t\t\tfilename = argList.get(i+1);\n\t\t\t\t//DIFFERENT FROM OTHER INIT FILE!\n\t\t\t\tfilename = filename.trim().replace(\".s230\", \".S230\");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(System.getProperty(\"user.dir\") + \" ... \" + filename);\n\t\tString dirName = System.getProperty(\"user.dir\");\n\t\tdirName = dirName.replace(\"\\\\Program_Files\\\\source\",\"\\\\\").trim();\n\t\tdirName = dirName.replace(\"\\\\Program_Files\\\\classes\",\"\\\\\").trim();\n\t\tdirName = dirName.concat(\"\\\\InputOutputFolder\\\\\");\n\t\tSystem.out.println(dirName+filename);\n\t\tFile file = new File(dirName, filename);\n\t\tScanner toReturn = null;\n\t\ttry {\n\t\t\ttoReturn = new Scanner(file);\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn toReturn;\n\t}", "private void readGPS() {\n }", "public static void main(String[] args) {\n\t\tint radius = 1;\r\n\t\tboolean con;\r\n\t\twhile(con = (radius != 0))\r\n\t\t{\r\n\t\t\tboolean b;\r\n\t\t\tString str;\r\n\t\t\tScanner scan = new Scanner(System.in);\r\n\t\t\tSystem.out.println(\"################ 원 만들기 프로그램 ###############\");\r\n\t\t\tSystem.out.println(\"\\\"*\\\"로 원을 만드는 프로그램입니다.\");\r\n\t\t\tSystem.out.println(\"숫자(반지름)입력시 해당 숫자 크기 만큼의 원을 만들 수 있습니다.\");\r\n\t\t\tSystem.out.println(\"############################################\");\r\n\t\t\tSystem.out.print(\"숫자를 입력해주세요(1부터 숫자 입력, 0입력시 종료) : \");\r\n\t\t\tstr = scan.next();\r\n\t\t\tscan.nextLine();\r\n\t\t\tradius = Integer.parseInt(str);\r\n\t\t\tSystem.out.println(\"반지름 \"+radius+\"이(가) 입력되었습니다\");\r\n\t\t\tif(radius == 0)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"프로그램을 종료합니다\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tchar circle [][] = new char [radius*2][radius*4]; \r\n\t\t\t\tfor(int i = 0;i < radius*2; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(int j = 0; j< radius*4; j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(radius*radius > (i+0.5-radius)*(i+0.5-radius)+(j/2+0.5-radius)*(j/2+0.5-radius))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcircle[i][j]='*';\r\n\t\t\t\t\t\t\tcircle[i][++j]=' ';\r\n\t\t\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tSystem.out.println(circle[i]);\r\n\t\t\t\t}\r\n\t\t\t\tSystem.out.println(\"\");\r\n\t\t\t\tSystem.out.println(\"Enter 키를 누르세요\");\r\n\t\t\t\tpause();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void readInSupercar() {\r\n\t\tScanner kbInput = new Scanner(System.in);\r\n\t\tSystem.out.print(\"Car's make and model? \");\r\n\t\tthis.setMakeAndModel(kbInput.nextLine());\r\n\t\tSystem.out.print(\"Country of origin? \");\r\n\t\tthis.setCountry(kbInput.nextLine());\r\n\t\tSystem.out.print(\"0 to 60 time (in seconds)? \");\r\n\t\tthis.setZeroTo60(kbInput.nextDouble());\r\n\t\tSystem.out.print(\"Total cost? $\");\r\n\t\tthis.setTotalCost(kbInput.nextInt());\r\n\t\t}", "public void read(Scanner input) {\r\n overallRoot = readHelper(input);\r\n }", "public static void init()throws IOException{if(fileIO){f=new FastScanner(\"\");}else{f=new FastScanner(System.in);}}", "CreateScanFilterResponse createScanFilter(CreateScanFilterRequest request);", "public Point inSearch(){\n\t\tSystem.out.println(\"Enter point coordinate, which you want to check\");\n\t\tthis.in = new Scanner(System.in);\n\t\tString temp = in.nextLine();\n\t\tString[] data = temp.trim().split(\" \");\n\t\tint a = Integer.parseInt(data[0]);\n\t\tint\tb = Integer.parseInt(data[1]);\n\t\tPoint p = new Point(a, b);\n\t\treturn p;\n\t}", "private void searchSpecificCar() {\n\t\tSystem.out.print(\"Enter Registration Number: \");\n\t\tSystem.out.println(application.displaySpecificCar(console.nextLine()));\n\t}", "private static void scan() {\n\t\tt = la;\n\t\tla = Scanner.next();\n\t\tla.toString();\n\t\tsym = la.kind;\n\t}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public Parser(java_cup.runtime.Scanner s) {super(s);}", "public void getInput(){\n\t\tScanner scan= new Scanner(System.in);\n\t\t//Get the range\n\t\tif(scan.hasNext()){\n\t\t\tcount=Integer.parseInt(scan.nextLine()); \n\t\t}\n\t\t//Initialize the array\n\t\tpeople = new People[count];\n\t\t//Get the array elements\n\t\tint i=0;\n\t\twhile(i<count){\n\t\t\tString lin[] = scan.nextLine().split(\" \");\n\t\t\tpeople[i] = new People(Integer.parseInt(lin[0]), Double.parseDouble(lin[1]));\n\t\t\ti++;\n\t\t}\n\t\t\n\t\t\n\t}", "public Scanner(String inString)\n {\n in = new BufferedReader(new StringReader(inString));\n eof = false;\n getNextChar();\n }", "public CoolParser(java_cup.runtime.Scanner s) {super(s);}", "public java_cup.runtime.Symbol scan()\n throws java.lang.Exception\n {\n return s.next_token(); \n }", "public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\r\n\r\n //Reads ints from user\r\n int angles = scanner.nextInt();\n int anglesPerHour = 30;\n int anglePerMin = 12;\r\n int angleRemainder;\n int angleMultipliedMin;\n\r\n /*\r\n * your code goes here\r\n */\n\r\n angleRemainder = angles % anglesPerHour;\n angleMultipliedMin = angleRemainder * anglePerMin;\n\n System.out.print(angleMultipliedMin);\n\r\n // closing the scanner object\r\n scanner.close();\r\n }", "private void scan() {\n token = nextToken;\n nextToken = scanner.next();\n }", "public java_cup.runtime.Symbol scan()\n throws java.lang.Exception\n {\n return new Symbol (sym.EOF); \n }", "public reglas(java.io.Reader in) {\n this.zzReader = in;\n }", "private void init(RnsReader inputRnsReader){\n\t\tsynchronized(this.getVehicleLock()){\n\t\t\tsetRnsRoot();\n\t\t\t//connections first because they are needed for\n\t\t\t//computing next places\n\t\t\tsetConnections(inputRnsReader); \n\t\t\tsetRoads(inputRnsReader);\n\t\t\tsetPlaces(inputRnsReader);\t\t\n\t\t}\n\t}", "static void gatherInfo() {\n Scanner keyboard = new Scanner(System.in);\n System.out.print(\"Enter the type of measurement (inches, feet, etc.). >> \");\n measurementType = keyboard.nextLine();\n System.out.print(\"Enter the rectangle width. >> \");\n height = keyboard.nextDouble();\n System.out.print(\"Enter the rectangle height. >> \");\n width = keyboard.nextDouble();\n }", "void readPepXmlSearchScan(T scan) {\n for (int i = 0; i < reader.getAttributeCount(); i++) {\n String attrib = reader.getAttributeLocalName(i);\n String val = reader.getAttributeValue(i);\n if (attrib.equalsIgnoreCase(\"start_scan\"))\n scan.setScanNumber(Integer.parseInt(val));\n else if (attrib.equalsIgnoreCase(\"precursor_neutral_mass\"))\n // NOTE: We store M+H in the database\n scan.setObservedMass(new BigDecimal(val).add(BigDecimal.valueOf(BaseAminoAcidUtils.PROTON)));\n else if (attrib.equalsIgnoreCase(\"assumed_charge\"))\n scan.setCharge(Integer.parseInt(val));\n else if (attrib.equalsIgnoreCase(\"retention_time_sec\"))\n scan.setRetentionTime(new BigDecimal(val));\n }\n }", "private static void takeInput() throws IOException {\n\n System.out.println(\"Enter number 1\");\n BufferedReader br= new BufferedReader(new InputStreamReader(System.in));\n String number1=br.readLine();\n System.out.println(\"Enter number 2\");\n String number2=br.readLine();\n System.out.println(\"Operation\");\n String op=br.readLine();\n //WhiteHatHacker processes the input\n WhiteHatHacker hack=new WhiteHatHacker(number1,number2,op);\n hack.processInput();\n }", "public Scanner createScanner(File file) {\n Scanner scanner;\n try {\n scanner = new Scanner(file);\n\n } catch (FileNotFoundException e) {\n scanner = null;\n }\n return scanner;\n }", "public static void main(String[] args) throws Exception {\r\n Scanner reader = new Scanner(System.in);\r\n\r\n System.out.println(\"Service address to be scanned?\");\r\n String address = reader.nextLine();\r\n \r\n System.out.println(\"Select ports starting point:\");\r\n int start = Integer.parseInt(reader.nextLine());\r\n \r\n System.out.println(\"End to which port?\");\r\n int end = Integer.parseInt(reader.nextLine());\r\n\r\n Set<Integer> ports = getAccessiblePorts(address, start, end);\r\n System.out.println(\"\");\r\n\r\n if (ports.isEmpty()) {\r\n System.out.println(\"Couldn't find any ports, sorry.\"); \r\n } else {\r\n // Prints out the found scanned ports, one by one slowly\r\n System.out.println(\"Ports found:\");\r\n ports.stream().forEach(p -> \r\n System.out.println(\"\\t\" + p));\r\n }\r\n \r\n }", "private static Scanner createScanner(File inputFile)\n\t{\n\t\t/// create Scanner to read from file and also check if the file exists\n\t Scanner in = null; // closes before the end of readDataFile\n\t try \n\t {\n\t \tin=new Scanner(inputFile);\n\t }\n\t catch(FileNotFoundException e) \n\t {\n\t \tSystem.out.println(\"The file \"+ inputFile.getName() + \" can not be found!\");\n\t \tSystem.exit(0);\n\t }\n\t \n\t return in;\n\t}", "andGate( Scanner sc, String name ){\n\tthis.name = name; \n\tScanSupport.lineEnd( sc, name); \n }", "public Ui() {\n this.scanner = new Scanner(System.in);\n }", "public Ui() {\n this.scanner = new Scanner(System.in);\n }", "public void setScan(ByteArrayInputStream inStream){\t\t\n\t\tthis.programIn= (ByteArrayInputStream) inStream;\t\t\n\t\tthis.scan = new Scanner (programIn);\t\t\n\t}", "RocchioSearcher(Configuration config) throws IOException {\n this(config, 1.0, 0.75);\n }", "public Scanner getScanner(){\n\t\t\n\t\tboolean hasFile = false;\n\t\tString filename = \"\";\n\t\tfor(int i = 0; i<argList.size(); i++ ){\n\t\t\tif(argList.get(i).equals(\"-f\")){\n\t\t\t\thasFile = true;\n\t\t\t\tfilename = argList.get(i+1);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(System.getProperty(\"user.dir\") + \" ... \" + filename);\n\t\tFile file = new File(System.getProperty(\"user.dir\")+\"\\\\ARM230Compiler\\\\InputOutputFolder\\\\\", filename);\n\t\tScanner toReturn = null;\n\t\ttry {\n\t\t\ttoReturn = new Scanner(file);\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn toReturn;\n\t}", "private void readRC(Scanner scan){\n\t\t//read in number of row and column in the first line\n\t\t\t\tString line = scan.nextLine();\n\t\t\t\t// read in number of rows and colums\n\t\t\t\t// declare a new scanner on the line. \n\t\t\t\tScanner scanLine = new Scanner(line);\n\t\t\t\t// assume col comes before row (the hw example)\n\t\t\t\t// try reading in the number of row\n\t\t\t\tif (scanLine.hasNextInt()) \n\t\t\t\t\t// scan that integer into row number or row\n\t\t\t\t\tcol=scanLine.nextInt(); \n\t\t\t\telse throw new InputMismatchException(\"The input file does not have number of columns\");\n\t\t\t\tif (scanLine.hasNextInt()) \n\t\t\t\t\t// scan that integer into row number or row\n\t\t\t\t\trow=scanLine.nextInt();\n\t\t\t\telse throw new InputMismatchException(\"The input file does not have number of rows\");\n\t\t\t\t// try reading in the number of cols\n\t\t\t\t// if there are more than 2 entries then throw an exception\n\t\t\t\tif (scanLine.hasNext()) throw new InputMismatchException(\"The \" +\n\t\t\t\t\t\t\"input file has wrong format of the number of rows and columns\");\n\t}" ]
[ "0.6395212", "0.60446936", "0.5725469", "0.5725469", "0.56906754", "0.56789327", "0.5661981", "0.5543031", "0.54934144", "0.5424186", "0.5422038", "0.5417793", "0.5414527", "0.5389101", "0.5380962", "0.5364675", "0.53375626", "0.5302247", "0.5302247", "0.52994937", "0.52957684", "0.5294049", "0.5285372", "0.5236209", "0.5233712", "0.52227324", "0.52203035", "0.52018404", "0.51941526", "0.5190536", "0.5182751", "0.5140757", "0.5124864", "0.5124864", "0.5124864", "0.5124864", "0.5124864", "0.5124864", "0.5124864", "0.5124864", "0.512032", "0.511239", "0.5110797", "0.5085035", "0.5078581", "0.50702095", "0.50688905", "0.50620383", "0.5057807", "0.50533676", "0.5051513", "0.5049693", "0.5049681", "0.50365734", "0.5031087", "0.50102293", "0.49904385", "0.49874842", "0.49870735", "0.49835214", "0.4976288", "0.49728787", "0.49684933", "0.4968099", "0.49604192", "0.49582788", "0.49463603", "0.4943351", "0.49415424", "0.49232423", "0.49215388", "0.491944", "0.4919229", "0.49181578", "0.49181578", "0.49181578", "0.49181578", "0.49181578", "0.49181578", "0.49166423", "0.49130216", "0.49116617", "0.49001032", "0.4898688", "0.48941508", "0.48932356", "0.48868552", "0.4883299", "0.4882571", "0.48775315", "0.48746747", "0.48740104", "0.4863291", "0.4858338", "0.48576623", "0.4855545", "0.4855545", "0.48524866", "0.4850388", "0.484644", "0.48432642" ]
0.0
-1
ONLY execute in this main method
public static void main(String[] args) { name = "Izzat"; num = 200; System.out.println(name); System.out.println(num); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Main() {\n\n super();\n }", "public static void main() {\n \n }", "public Main() {\r\n\t\tsuper();\r\n\t\tinitialize();\r\n\r\n\t}", "public static void main()\n\t{\n\t}", "public static void main(){\n\t}", "public void run() {\n // The run method should be overridden by the subordinate class. Please\n // see the example applications provided for more details.\n }", "public static void run(){}", "public static void main(String args[]) throws Exception\n {\n \n \n \n }", "private DungeonBotsMain() {\n\t\t// Does nothing.\n\t}", "private Main ()\n {\n super ();\n }", "protected void run() {\r\n\t\t//\r\n\t}", "public void run() {\r\n\t\t// overwrite in a subclass.\r\n\t}", "public Main() {\n\t\tsuper();\n\t}", "@Override\n\t\t\tpublic void run() {\n\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\t\n\t\t\t}", "public void run()\n\t\t{\n\t\t}", "@Override\n\tprotected void postRun() {\n\n\t}", "public Main() {\n \n \n }", "public static void run() {\n }", "public void run() {\n\t\t\t\t\n\t\t\t}", "@Override\r\n\tpublic void runn() {\n\t\t\r\n\t}", "public void run() {\n }", "@Override\n\t\tpublic void run() {\n\t\t\t\n\t\t}", "@Override\n\t\tpublic void run() {\n\t\t\t\n\t\t}", "public void run() {\n\t\t\r\n\t}", "public void run() {\n\t\t\r\n\t}", "@Override\r\n\t\tprotected void run() {\n\t\t\t\r\n\t\t}", "void PrepareRun() {\n }", "public void run() {\n\t\t}", "public void run() {\n\t\t}", "public void run() {\n\t\t}", "public void run() {\n\n }", "public void run() {\n\t\t\n\t}", "public static void main(String[] args) throws Exception {\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t}", "private ThoseMain()\n {\n // Do nothing\n }", "@Override\n\t\tpublic void run() {\n\n\t\t}", "public void run() {\n\t\t\t\t\t\t}", "public void intialRun() {\n }", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void postRun() {\n\t}", "public static void main() {\n }", "public void run() {\n\n\t}", "public void run() {\n\n\t}", "private Main() {}", "public void run() {\n }", "public static void main(String[]args) {\n\t\n\t\t\n\n}", "public static void run() {\n try {\n //recreating tables added to update csv data without application restart\n new SqlUtility().setConnection().dropAllTables().createPersonTable().createRecipientTable();\n new CsvPersonParser().run();\n new CsvReсipientParser().run();\n\n List<Person> list;\n list = new SqlUtility().setConnection().grubData();\n String result = \"\";\n result = ListToMessage.converter(list);\n if(!\"\".equals(result)) {\n NotificationSender.sender(result, email, pass, addressList);\n }\n } catch (ClassNotFoundException e){e.printStackTrace();}\n catch (SQLException ee){ee.printStackTrace();}\n catch (ParseException eee) {eee.printStackTrace();}\n\n }", "public Main() {\r\n\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\tsuper.run();\r\n\t\t\t}", "@Override\r\n\tabstract public void run();", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "public void Main(){\n }", "public void main(){\n }", "public static void main(String[] args) {\r\n// Use for unit testing\r\n }", "public static void main(String[] args) {\n \n \n \n \n }", "private void start() {\n\n\t}", "public static void main(String[] args)\r\t{", "private Main() {\n }", "public static void main(String[] args) {\r\n\t\t//method body\r\n\t}", "@Override\n public void preRun() {\n super.preRun();\n }", "public static void main(String[] args) {\n \r\n\t}", "public void run(){\n\t}", "void PostRun() {\n }", "private Main() {\r\n throw new IllegalStateException();\r\n }", "protected abstract void preRun();", "boolean run();", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "public void run()\r\n\t{\r\n\t\t\r\n\t}", "private void runBest() {\n }", "public static void main(String[] args) {\n\t \t\n\t \t\n\t }", "public static void main(String[] args) {\n \n \n \n\t}", "private TetrisMain() {\r\n //ensure uninstantiability\r\n }", "public void runProgram()\n\t{\n\t\tintro();\n\t\tfindLength();\n\t\tguessLetter();\n\t\tguessName();\n\t}", "public Main() {}", "public void run() {\n }", "public void run() {\n }", "public void run() {\n }", "public static void main(String[] args) {\n \n \n }", "public static void main(String[] args) {\n \n \n }", "@Override\n\t\tpublic void run() {\n\t\t\tExecutor executor = new Executor(this.env);\n\n\t\t\t// control loop\n\t\t\t//String dataFileName = monitorLog.monitor();\n\t\t\t//AnalysisStatus analysisStatus = analyser.analyse(dataFileName, args);\n\t\t\t// AdaptationPlan adaptationPlan =\n\t\t\t// planner.selectPlan(analysisStatus);\n\t\t\t//executor.execute(adaptationPlan);\n\t\t\t//System.out.println(this.getClass()+\" **************** CHANGE **************\"+System.nanoTime());\n\t\t\texecutor.executeFake(this.env);\n\t\t\t//executeFake();\n\t\t}", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "@Override\n public void run() {\n \t\n }", "@Override\n public void run() {\n\n }", "@Override\n public void run() {\n\n }" ]
[ "0.71503925", "0.7100356", "0.69079876", "0.6877687", "0.68602115", "0.6792756", "0.6778552", "0.6778312", "0.6738868", "0.6732387", "0.6730313", "0.67268527", "0.669786", "0.6686831", "0.66672766", "0.66672766", "0.6643581", "0.6627343", "0.6618601", "0.6615642", "0.6597712", "0.6595346", "0.65876883", "0.6581821", "0.6581821", "0.65675205", "0.65675205", "0.656549", "0.65407085", "0.6539453", "0.6539453", "0.6539453", "0.6533954", "0.6528661", "0.65178293", "0.6514961", "0.65041757", "0.6486498", "0.6477756", "0.6477429", "0.6477429", "0.64492995", "0.6439422", "0.6423965", "0.6423965", "0.6422897", "0.64152414", "0.6403577", "0.63948834", "0.6389067", "0.63879234", "0.63836867", "0.6372058", "0.6372058", "0.6372058", "0.6364447", "0.63601065", "0.63594556", "0.6354539", "0.6351792", "0.6347085", "0.6324954", "0.63132876", "0.6297432", "0.6295749", "0.6294487", "0.629249", "0.62919766", "0.627774", "0.6275105", "0.6273686", "0.6273686", "0.6273686", "0.6273686", "0.6273686", "0.6273686", "0.6273686", "0.6273686", "0.6273686", "0.6260604", "0.6259629", "0.62596226", "0.6255933", "0.6254089", "0.6239208", "0.6238777", "0.6229585", "0.6229585", "0.6229585", "0.6214058", "0.6214058", "0.6206455", "0.6200062", "0.6200062", "0.6200062", "0.6200062", "0.6200062", "0.6200062", "0.6191565", "0.61840963", "0.61840963" ]
0.0
-1
/ These special emergency number will show ecc in MMI but sent to nw as normal call
public boolean isSpecialEmergencyNumber(String dialString) { return (dialString.equals("110") || dialString.equals("119") || dialString.equals("000") || dialString.equals("08") || dialString.equals("118") || dialString.equals("999") || dialString.equals("120")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static String m21400e() {\n try {\n return new BufferedReader(new FileReader(new File(\"/sys/class/net/wlan0/address\"))).readLine();\n } catch (Throwable th) {\n C5205o.m21464a(th);\n return \"02:00:00:00:00:00\";\n }\n }", "public synchronized void sendNo() {\r\n\t\tbeginMessage();\r\n\t\tsend(ServerConst.ANS + ServerConst.ANS_NO);\r\n\t\tendMessage();\r\n\t}", "private void m81855s() {\n try {\n String c = m81844c(C6969H.m41409d(\"G738BEA1BAF209420E2\"));\n if (!TextUtils.isEmpty(c)) {\n this.f58082n = Integer.parseInt(c);\n }\n } catch (Throwable th) {\n WebUtil.m68654a(C6969H.m41409d(\"G5C91D93EBA3CAE2EE71A95\"), th.getMessage());\n this.f58082n = 0;\n }\n if (this.f58082n == 0 && C6969H.m41409d(\"G7E94C254A538A221F3409347FF\").equals(this.f58071c.getHost())) {\n this.f58082n = AppIdRouterHelper.m81728a(this.f58072d.getPath());\n }\n }", "@Override\n\t\tpublic void emergencyServices() {\n\t\t\tSystem.out.println(\"FH--emergency services\");\t\n\t\t\t\n\t\t}", "String mo7390hn() throws RemoteException;", "public void mo1534c() {\n C2201w.m8371a((int) C0965R.string.ota_send_fail, 1);\n this.f3965a.f4003i.mo1526d();\n }", "public void sendMicroServer(String message, Long num) throws Exception {\n InetAddress ip = InetAddress.getByName(\"localhost\");\n \tDatagramPacket dp = new DatagramPacket(message.getBytes(), message.length(), ip, (int) (7000+num));\n \ttoMicroServer.send(dp);\n System.out.printf(\"Sending message '%s' to micro-service %s\\n\", message, num);\n\t\n }", "public static void sendInfo(int cpuUsg, int mmUsg) {\n try {\n disObj.performanceInfo(1, cpuUsg, mmUsg); //cluster ID HC\n } catch (RemoteException e) {\n e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n }\n }", "@Override\n\tpublic void EmergencySend(byte[] data) {\n\t\t\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "private static String m21383C(Context context) {\n WifiInfo wifiInfo;\n String str = \"02:00:00:00:00:00\";\n if (context == null) {\n return str;\n }\n WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(\"wifi\");\n if (wifiManager == null) {\n return str;\n }\n try {\n wifiInfo = wifiManager.getConnectionInfo();\n } catch (Exception e) {\n C5205o.m21464a((Throwable) e);\n wifiInfo = null;\n }\n if (wifiInfo == null) {\n return null;\n }\n String macAddress = wifiInfo.getMacAddress();\n if (!TextUtils.isEmpty(macAddress)) {\n macAddress = macAddress.toUpperCase(Locale.ENGLISH);\n }\n return macAddress;\n }", "public synchronized void sendInvalid() {\r\n\t\tbeginMessage();\r\n\t\tsend(ServerConst.ANS + ServerConst.ANS_INVALID);\r\n\t\tendMessage();\r\n\t}", "private void m6585B() {\n this.f5395O = (TelephonyManager) getSystemService(\"phone\");\n this.f5399S = new C1425w(this.f5389I);\n this.f5404X = C1018a.m5416a(this.f5389I);\n }", "private static String m21398d() {\n try {\n for (NetworkInterface networkInterface : Collections.list(NetworkInterface.getNetworkInterfaces())) {\n if (networkInterface.getName().equalsIgnoreCase(\"wlan0\")) {\n byte[] hardwareAddress = networkInterface.getHardwareAddress();\n if (hardwareAddress == null) {\n return \"\";\n }\n StringBuilder sb = new StringBuilder();\n for (byte valueOf : hardwareAddress) {\n sb.append(String.format(\"%02X:\", new Object[]{Byte.valueOf(valueOf)}));\n }\n if (sb.length() > 0) {\n sb.deleteCharAt(sb.length() - 1);\n }\n return sb.toString();\n }\n }\n } catch (Throwable th) {\n C5205o.m21464a(th);\n }\n return \"02:00:00:00:00:00\";\n }", "public static String m21395b(String str) {\n if (TextUtils.isEmpty(str)) {\n return str;\n }\n try {\n char[] cArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};\n byte[] digest = MessageDigest.getInstance(\"MD5\").digest(str.getBytes(\"UTF8\"));\n StringBuilder sb = new StringBuilder();\n for (byte b : digest) {\n byte b2 = b & DeviceInfos.NETWORK_TYPE_UNCONNECTED;\n sb.append(cArr[b2 / 16]);\n sb.append(cArr[b2 % 16]);\n }\n return sb.toString();\n } catch (Exception e) {\n C5205o.m21464a((Throwable) e);\n return str;\n }\n }", "public void emergencyStop(){\r\n\t\tif (grblPort.isConnected()){\r\n\t\t\tgrblPort.sendDataLine(\"\\u0018\");\r\n\t\t}\r\n\t}", "C15430g mo56154a();", "@Override\n\tpublic void getError() {\n System.err.println(\"8877挂掉了\");\n\t}", "public void mo55254a() {\n }", "private static String m21388a(WifiManager wifiManager) {\n String a = m21386a(wifiManager.getConnectionInfo().getIpAddress());\n return a != null ? a : \"\";\n }", "private void m81856t() {\n try {\n String c = m81844c(C6969H.m41409d(\"G738BEA0DBA32BD20E319AF5CEBF5C6\"));\n if (!TextUtils.isEmpty(c)) {\n this.f58084p = Integer.parseInt(c);\n }\n } catch (Exception e) {\n WebUtil.m68654a(C6969H.m41409d(\"G5C91D93EBA3CAE2EE71A95\"), e.getMessage());\n }\n }", "public void m5015e() {\n if (C1663a.m5979a().m5993N() && (this.f3996b == null || \"\".equals(this.f3996b))) {\n C2201w.m8371a((int) C0965R.string.ota_low_version, 0);\n } else {\n this.f3997c.m4989a();\n }\n }", "private void checkDataBalance() {\n String ussdCode = \"*175*4\" + Uri.encode(\"#\");\n startActivity(new Intent(Intent.ACTION_CALL,Uri.parse(\"tel:\"+ussdCode)));\n\n }", "private static String m4387a() {\n String str;\n String str2 = \"\";\n try {\n Class cls = Class.forName(\"android.os.SystemProperties\");\n Method method = cls.getMethod(\"get\", new Class[]{String.class});\n if (method != null) {\n if (((String) method.invoke(cls.newInstance(), new Object[]{\"telephony.lteOnCdmaDevice\"})).equals(\"1\")) {\n Method method2 = Class.forName(\"com.huawei.android.hwnv.HWNVFuncation\").getMethod(\"getNVIMEI\", new Class[0]);\n if (method2 == null) {\n return str2;\n }\n method2.setAccessible(true);\n str = (String) method2.invoke(null, new Object[0]);\n return str;\n }\n }\n } catch (Throwable th) {\n }\n str = str2;\n return str;\n }", "private void m6597N() {\n C0938a.m5002a(\"SR/SoundRecorder\", \"<popClearDialogBox>\");\n String lowerCase = this.f5399S.mo6173f().getAbsolutePath().toLowerCase();\n if (this.f5419h) {\n C1492b.m7431a((Context) this, (CharSequence) getResources().getString(R.string.phone_mtp_space_expired_smartkey), 1).show();\n this.f5419h = false;\n }\n Intent intent = new Intent(\"com.iqoo.secure.LOW_MEMORY_WARNING\");\n intent.addFlags(268435456);\n intent.putExtra(\"require_size\", 5242880);\n intent.putExtra(\"pkg_name\", getPackageName());\n intent.putExtra(\"extra_loc\", 1);\n intent.putExtra(\"tips_title\", getResources().getString(R.string.manager_title));\n intent.putExtra(\"tips_title_all\", getResources().getString(R.string.unable_to_record));\n try {\n startActivity(intent);\n } catch (Exception unused) {\n Intent intent2 = new Intent();\n intent2.putExtra(\"BBKPhoneCardName\", lowerCase);\n intent2.setComponent(new ComponentName(\"com.android.filemanager\", \"com.android.filemanager.FileManagerActivity\"));\n startActivity(intent2);\n }\n }", "void getEmergencyContact();", "pb4server.EatPoisonNumAskReq getEatPoisonNumAskReq();", "public String readDeviceSN(){\r\n return mFactoryBurnUtil.readDeviceSN();\r\n }", "public static C2573hn m5600a(boolean z, boolean z2) {\n C2573hn hnVar;\n String str = \"\\\"\";\n Context c = C2505gd.m5298c();\n if (c == null) {\n return null;\n }\n try {\n WifiInfo connectionInfo = ((WifiManager) c.getSystemService(TapjoyConstants.TJC_CONNECTION_TYPE_WIFI)).getConnectionInfo();\n if (connectionInfo != null) {\n String bssid = connectionInfo.getBSSID();\n String ssid = connectionInfo.getSSID();\n if (bssid != null && !m5603a(z, ssid)) {\n hnVar = new C2573hn();\n try {\n hnVar.f5675a = m5599a(bssid);\n String substring = (ssid == null || !ssid.startsWith(str) || !ssid.endsWith(str)) ? ssid : ssid.substring(1, ssid.length() - 1);\n if (z2) {\n substring = null;\n }\n hnVar.f5676b = substring;\n hnVar.f5677c = connectionInfo.getRssi();\n hnVar.f5678d = connectionInfo.getIpAddress();\n } catch (Exception e) {\n e = e;\n C2463fd.m5161a().mo28382a(new C2495fz(e));\n return hnVar;\n }\n return hnVar;\n }\n }\n hnVar = null;\n } catch (Exception e2) {\n e = e2;\n hnVar = null;\n C2463fd.m5161a().mo28382a(new C2495fz(e));\n return hnVar;\n }\n return hnVar;\n }", "private String setProtocolNumber() {\n\t\tRandom rnd = new Random();\n\t\treturn Integer.toString(rnd.nextInt(999999));\n\t}", "public static String m21410m(Context context) {\n if (TextUtils.isEmpty(f16896g)) {\n f16896g = ((TelephonyManager) context.getSystemService(\"phone\")).getSimOperator();\n if (TextUtils.isEmpty(f16896g)) {\n f16896g = \"\";\n }\n }\n return f16896g;\n }", "@Override\n public void cUSerialNumber(long value) {\n //throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }", "public final void mo7656e(int i, int i2, String str, C1207m c1207m) {\n AppMethodBeat.m2504i(41893);\n if (c46020a.nqx.vYe != null) {\n C4990ab.m7416i(HoneyPayMainUI.this.TAG, \"do realname guide\");\n Bundle bundle = new Bundle();\n bundle.putString(\"realname_verify_process_jump_activity\", \".ui.HoneyPayMainUI\");\n C28289c.m44883a(HoneyPayMainUI.this, bundle, c46020a.nqx.vYe, true);\n AppMethodBeat.m2505o(41893);\n return;\n }\n HoneyPayMainUI.m56321b(HoneyPayMainUI.this, c46020a.nqx.vYf);\n AppMethodBeat.m2505o(41893);\n }", "public String imei() {\n\t\t TelephonyManager telephonyManager = (TelephonyManager) activity\n\t\t .getSystemService(Context.TELEPHONY_SERVICE);\n\t\t return telephonyManager.getDeviceId();\n\t\t}", "public final void mo7656e(int i, int i2, String str, C1207m c1207m) {\n AppMethodBeat.m2504i(41892);\n if (c46020a.nqx.vYe != null) {\n C4990ab.m7416i(HoneyPayMainUI.this.TAG, \"do realname guide\");\n Bundle bundle = new Bundle();\n bundle.putString(\"realname_verify_process_jump_activity\", \".ui.HoneyPayMainUI\");\n C28289c.m44883a(HoneyPayMainUI.this, bundle, c46020a.nqx.vYe, true);\n }\n AppMethodBeat.m2505o(41892);\n }", "public String long_ip(long numero_ip){\n String str_num_ip=\"\";\n for(int i=3; i>=0; i--){\n str_num_ip += (0b1111_1111 & (numero_ip >> (i*8) )) + (i!=0? \".\": \"\");\n }\n return str_num_ip;\n }", "public void MO_XP5(int telecomCode) throws FileNotFoundException, IOException, ParseException, InterruptedException {\n\n\n\t\tSystem.out.println(\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\");\n\t\tSoftAssert sf = new SoftAssert();\n\n\t\tString Refdevid=JsonFileReaderAndWriter.ReadRefDeviceId();\n\t\tString Uid=JsonFileReaderAndWriter.primaryDevIdReader();\n\n\n\n\t\tSystem.out.println(AllQA.PRIMARYDEVMDN +\"----\"+ AllQA.REFERENCEDEVMDN);\n\n\t\tfor(int i=1;i<=AllQA.NUMOFCALLS;i++)\n\t\t{\n\t\t\tRuntime.getRuntime().exec(\"adb -s \"+Uid+\" shell am start -a android.intent.action.CALL -d tel:\"+AllQA.REFERENCEDEVMDN);\n\t\t\tThread.sleep(10000);\n\n\t\t\ttry {\n\n\t\t\t\tfor(int j=1;j<=100;j++){\n\n\n\t\t\t\t\tProcess child=Runtime.getRuntime().exec(\"adb -s \"+Refdevid+\" shell service call telecom \"+telecomCode+\"\");\n\t\t\t\t\tInputStream lsOut = child.getInputStream();\n\t\t\t\t\tInputStreamReader r = new InputStreamReader(lsOut);\n\t\t\t\t\tBufferedReader in = new BufferedReader(r);\n\t\t\t\t\tString value=in.readLine();\n\t\t\t\t\tSystem.out.println(value);\n\t\t\t\t\tif(value.contains(\"00000001\")) {\n\n\t\t\t\t\t\tSystem.out.println(\"Phone is rining\");\n\t\t\t\t\t\ttest.log(LogStatus.INFO, \"MO CALL #\"+i+\" : \"+\"\"+AllQA.PRIMARYDEVMDN +\" ===>>> \"+AllQA.REFERENCEDEVMDN);\n\t\t\t\t\t\tAllQA.NUM_OF_CALL_ITER=\"\\n\"+\"NUM OF MO CALL : \"+i;\n\n\t\t\t\t\t\tAllQA.CALL_COUNT=i;\n\n\n\t\t\t\t\t\tRuntime.getRuntime().exec(\"adb -s \\\"\"+Refdevid+\"\\\" shell input keyevent 5\");\n\t\t\t\t\t\tsf.assertTrue(true, \"\");\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}else if (value.contains(\"00000000\")) {\n\n\t\t\t\t\t\tSystem.out.println(\"Dont do Anythink\");\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\n\t\t\t\t\t\tAllQA.NUM_OF_CALL_ITER=\"\\n\"+\"REF PHONE IS NOT RINGING/MAY BE NETWORK ISSUE : \"+i;\n\t\t\t\t\t\tAllQA.CALL_COUNT=i;\n\n\t\t\t\t\t\ttest.log(LogStatus.INFO, \"MO CALL #\"+i +\" : Reference Phone is not Ringing because of network problem \");\n\t\t\t\t\t\tsf.fail();\n\n\n\n\n\t\t\t\t\t}\n\n\n\t\t\t\t}\n\t\t\t\t//\tThread.sleep(30000);\n\t\t\t\tTimeUnit.SECONDS.sleep(AllQA.CALLDURATION);\n\n\t\t\t\taDriver.pressKeyCode(AndroidKeyCode.KEYCODE_ENDCALL);\n\t\t\t\tThread.sleep(AllQA.CALLGAP*1000); \n\t\t\t\tcontinue;\n\n\t\t\t}catch (Exception e) {\n\n\t\t\t\tRuntime.getRuntime().exec(\"adb -s \"+Refdevid+\" shell input keyevent 6\");\n\t\t\t\tThread.sleep(2000);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t}\n\t\tsf.assertAll();\n\n\t}", "public void sendOtp(String medium) {\n\r\n }", "abstract public String getRegNum();", "public static int m21411n(Context context) {\n if (TextUtils.isEmpty(f16896g)) {\n f16896g = ((TelephonyManager) context.getSystemService(\"phone\")).getSimOperator();\n if (TextUtils.isEmpty(f16896g)) {\n f16896g = \"\";\n }\n }\n if (!\"46000\".equals(f16896g)) {\n if (!\"46002\".equals(f16896g)) {\n if (!\"46004\".equals(f16896g)) {\n if (!\"46007\".equals(f16896g)) {\n if (!\"46008\".equals(f16896g)) {\n if (!\"46001\".equals(f16896g)) {\n if (!\"46006\".equals(f16896g)) {\n if (!\"46009\".equals(f16896g)) {\n if (!\"46003\".equals(f16896g)) {\n if (!\"46005\".equals(f16896g)) {\n if (!\"46011\".equals(f16896g)) {\n return \"46020\".equals(f16896g) ? 4 : 0;\n }\n }\n }\n return 3;\n }\n }\n }\n return 2;\n }\n }\n }\n }\n }\n return 1;\n }", "public synchronized void m29983k() {\n if (this.f23294u.isEmpty()) {\n if (this.f23286B == null) {\n this.f23286B = new C7030c(7, null, this.f23290J);\n }\n if (this.f23286B.f23372f == null) {\n this.f23286B = new C7030c(7, null, this.f23290J);\n }\n if (XGPushConfig.enableDebug) {\n C6864a.m29298c(\"TpnsChannel\", \"Action -> send heartbeat \");\n }\n m29967a(-1, this.f23286B);\n if ((f23266a > 0 && f23266a % 3 == 0) || f23266a == 2) {\n C6901c.m29459a().mo33104a((Runnable) new Runnable() {\n public void run() {\n C7056i.m30212h(C6973b.m29776f());\n }\n });\n }\n }\n m29985m();\n C6860a.m29257b(C6973b.m29776f());\n C7059f.m30231a(C6973b.m29776f()).mo34155a();\n m29980i();\n if (XGPushConfig.isLocationEnable(C6973b.m29776f())) {\n if (f23264F == 0) {\n f23264F = C7055h.m30167a(C6973b.m29776f(), Constants.LOC_REPORT_TIME, 0);\n }\n long currentTimeMillis = System.currentTimeMillis();\n if (f23264F == 0 || Math.abs(currentTimeMillis - f23264F) > ((long) f23281p)) {\n final JSONObject reportLocationJson = CustomDeviceInfos.getReportLocationJson(C6973b.m29776f());\n C6901c.m29459a().mo33104a((Runnable) new Runnable() {\n public void run() {\n C7046a.m30130b(C6973b.m29776f(), \"location\", reportLocationJson);\n }\n });\n f23264F = currentTimeMillis;\n C7055h.m30171b(C6973b.m29776f(), Constants.LOC_REPORT_TIME, currentTimeMillis);\n }\n }\n }", "private void m81850n() {\n m81843b(m81844c(C6969H.m41409d(\"G738BEA12B634AE16F20F9277F0E4D1\")));\n }", "public static void main(String[] param) {\t\t\r\n //(new virtualModem()).nechopackets(5);\r\n //(new virtualModem()).imagepackets(\"error\");\r\n//(new virtualModem()).chronoechopackets(480000);\r\n//(new virtualModem()).gpspackets();\r\n //(new virtualModem()).acknackpackets(480000);\r\n }", "private void checkBalance() {\n String ussdCode = \"*131\"+ Uri.encode(\"#\");\n startActivity(new Intent(Intent.ACTION_CALL,Uri.parse(\"tel:\"+ussdCode)));\n }", "default public int getCodeToDevicePort()\t\t\t\t{ return 2225; }", "public static String m583i(Context context) {\r\n try {\r\n return ((TelephonyManager) context.getSystemService(\"phone\")).getSimSerialNumber();\r\n } catch (Exception e) {\r\n return null;\r\n }\r\n }", "public void mo1533b() {\n C2201w.m8371a((int) C0965R.string.ota_send_success, 1);\n this.f3965a.f4003i.mo1526d();\n }", "private static String m11g() {\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"sh\");\n stringBuilder.append(\"el\");\n stringBuilder.append(\"la\");\n stringBuilder.append(\"_ve\");\n stringBuilder.append(\"rs\");\n stringBuilder.append(\"i\");\n stringBuilder.append(\"on\");\n return stringBuilder.toString();\n }", "@Override\n\tpublic void teclaConfirmaDigitada() {\n\t\t\n\t}", "int getClientMsgNo();", "public void mo1611c() {\r\n Message.obtain(this.f4603a.f4598n, 6, null).sendToTarget();\r\n }", "private String getMobileIP(){\n try {\n for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();\n en.hasMoreElements();) {\n NetworkInterface networkinterface = en.nextElement();\n for (Enumeration<InetAddress> enumIpAddr = networkinterface.getInetAddresses(); enumIpAddr.hasMoreElements();) {\n InetAddress inetAddress = enumIpAddr.nextElement();\n if (!inetAddress.isLoopbackAddress()) {\n return inetAddress.getHostAddress().toString();\n }\n }\n }\n } catch (Exception ex) {\n Log.e(\"Current IP\", ex.toString());\n }\n return null;\n }", "public synchronized void sendUnknown(final String _req) {\r\n\t\tbeginMessage();\r\n\t\tsend(ServerConst.ANS + ServerConst.ANS_UNKNOWN + _req);\r\n\t\tendMessage();\r\n\t}", "public static String m21387a(Context context) {\n String str = \"wns_ab\";\n try {\n if (TextUtils.isEmpty(f16890a)) {\n f16890a = Secure.getString(context.getContentResolver(), \"android_id\");\n }\n if (TextUtils.isEmpty(f16890a)) {\n f16890a = C5206p.m21472b(context, str);\n if (TextUtils.isEmpty(f16890a)) {\n f16890a = UUID.randomUUID().toString().replace(\"-\", \"\");\n C5206p.m21471a(context, str, f16890a);\n }\n }\n } catch (Throwable th) {\n C5205o.m21464a(th);\n }\n return f16890a;\n }", "public static final String number2show(String phoneNumber) throws Exception {\n\t\tif (phoneNumber == null || phoneNumber.length() == 0) {\n\t\t\treturn phoneNumber;\n\t\t}\n\n\t\tboolean isIpCall = false;\n\n\t\tint lth = phoneNumber.length();\n\t\tif(lth >= CHINA_MOBILE_LDC.length()){\n\t\t\tif (phoneNumber.substring(0, 5).equals(CHINA_MOBILE_LDC)) {\n\t\t\t\tisIpCall = true;\n\n\t\t\t\tphoneNumber = phoneNumber.substring(5);\n\t\t\t}\n\t\t}\n\t\t//phone not encrypt yet, like 10086/955555 etc, it is not a cipher text\n\t\tif (phoneNumber.length() != CIPHER_FIXED_LENGTH) {\n\t\t\t//with '+'\n\t\t\tif (phoneNumber.length() != 22) {\n\t\t\t\tif (isIpCall) {\n\t\t\t\t\treturn CHINA_MOBILE_LDC + phoneNumber;\n\t\t\t\t}\n\t\t\t\treturn phoneNumber;\n\t\t\t} else {\n\t\t\t\t// with '+' maybe\n\t\t\t\t//TODO: strange here\n\t\t\t\tchar first = phoneNumber.charAt(0);\n\t\t\t\tif (first != '+') {\n\t\t\t\t\tif (isIpCall) {\n\t\t\t\t\t\treturn CHINA_MOBILE_LDC + phoneNumber;\n\t\t\t\t\t}\n\t\t\t\t\treturn phoneNumber;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn phoneNumber;\n\t\t}\n\t\tif (phoneNumber.charAt(0) == '+') {\n\t\t\tphoneNumber = phoneNumber.substring(1);\n\t\t}\n\t\t\n\t\t//TODO when input length is 21, can not know it is a \n\t\t//plain text or encrypt text\n\t\t//check the last two bit, if more than 19, return \n\t\tint length = phoneNumber.length();\n\t\tString twobitString = phoneNumber.substring(length - 2);\n\t\tint twobitInt = 0;\n\t\ttry{\n\t\t\ttwobitInt = Integer.parseInt(twobitString);\n\t\t}catch(Exception e){\n\t\t\treturn phoneNumber;\n\t\t}\n\t\t\n\t\tif(twobitInt > CIPHER_FIXED_LENGTH - LAST_TWO_BITS_INDICATOR){\n\t\t\treturn phoneNumber;\n\t\t}\n\t\t//do the real work, it is must the valid encrypt phone\n\t\tString body = unpadding(phoneNumber);\n\n\t\tString realPhone = show(body, TIMES);\n\t\tif (!isEmpty(realPhone) || realPhone.length() >= 2) {\n\t\t\tString with86 = realPhone.substring(0, 2);\n\n\t\t\tif (with86.equals(\"86\")) {\n\t\t\t\trealPhone = realPhone.substring(2);\n\t\t\t}\n\t\t}\n\n\t\tif (isIpCall) {\n\t\t\treturn CHINA_MOBILE_LDC + realPhone;\n\t\t}\n\t\treturn realPhone;\n\t}", "public static boolean isEmergencyNumber(String number, Context context) {\n\t\tLog.d(TAG, \"ContactsUtils isEmergencyNumber number=\" + number\n\t\t\t\t+ \" carrier=\" + getCarrierName(context));\n\t\tif (number != null) {\n\t\t\tif (getCarrierName(context).equals(Carrier_CMCC)) {\n\t\t\t\treturn (number.equals(\"112\") || number.equals(\"911\")\n\t\t\t\t\t\t|| number.equals(\"110\") || number.equals(\"999\")\n\t\t\t\t\t\t|| number.equals(\"000\") || number.equals(\"08\")\n\t\t\t\t\t\t|| number.equals(\"118\") || number.equals(\"119\"));\n\t\t\t} else if (getCarrierName(context).equals(Carrier_CT)) {\n\t\t\t\treturn (number.equals(\"112\") || number.equals(\"911\")\n\t\t\t\t\t\t|| number.equals(\"110\") || number.equals(\"999\")\n\t\t\t\t\t\t|| number.equals(\"120\") || number.equals(\"119\"));\n\t\t\t} else\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public static String getappno(){\n\t\t String result = \"123456\";\r\n\t\treturn result;\r\n\t}", "public final void mo66559hj() {\n int hl = m72695hl() | m72696hm();\n m72697hn();\n if (hl != 0) {\n m72694hk();\n notifyChanged();\n }\n }", "public void sendmessage(View v){\n \tIntent intent =new Intent();//意图\n \tintent.setAction(Intent.ACTION_SENDTO);//设置发短信意图\n \tintent.setData(Uri.parse(\"smsto:\"+1358752546));//设置拨号的信息\n \t//问题:怎么不能用11位电话号码\n \tString message=\"我是水哥,有妹子么\";\n \tintent.putExtra(\"sms_body\", message);\n \tstartActivity(intent);//开启意图\t \n }", "public void MAJInformation(Intent intent){\n\n XBee64BitAddress rAddress=hexStringToXBeeAddress(intent.getStringExtra(\"address\"));\n int indexTab=getindexFromXbeeAddress(rAddress);\n String rCMD=intent.getStringExtra(\"cmd\"); // cmd : PING || AUTH || START || STOP\n int status=intent.getIntExtra(\"status\",-1); // status de la borne\n int rExtStatus=intent.getIntExtra(\"ext_status\",-1); // ext status : DOOR OPENED || BOOT || ...\n int rError=intent.getIntExtra(\"error_status\",-1);\n int rSessionID=intent.getIntExtra(\"sessionID\",-1);\n int proto=intent.getIntExtra(\"proto\",-1);\n String rTag=intent.getStringExtra(\"tag\");\n Date time = new Date();\n time.setTime(intent.getLongExtra(\"time\", -1));\n\n\n Status rStatus=mCPStatus[indexTab];\n\n G2EvseCMD cmd=G2EvseCMD.valueOf(rCMD);\n\n if(cmd.equals(G2EvseCMD.PING)){\n rStatus.setInformationPing(G2EvseStatus.fromCode(status),rError,rExtStatus);\n rStatus.setSession(rSessionID, rTag, proto, time);//time in start session\n\n\n\n }else if(cmd.equals(G2EvseCMD.AUTH)){\n rStatus.setAuth(true);\n rStatus.setAuthInProgress( rTag );\n\n }else if(cmd.equals(G2EvseCMD.START)){\n rStatus.setSession(rSessionID, rTag, proto, time);\n\n }else if(cmd.equals(G2EvseCMD.STOP)){\n rStatus.setSession(rSessionID, rTag, proto, time);\n }\n }", "BaseConnet(){\n// pool = ThreadPool.getInstance();\n// sc = SendCommand.getInstance();\n HEART_CMD = new byte[]{\n\n WiStaticComm.UTRAL_H0,\n WiStaticComm.UTRAL_H1,\n WiStaticComm.UTRAL_H2,\n 0x00,\n 0x13,\n 0x00,\n 0x06,\n 0x01,\n 0x00,\n 0x00,\n 0x52,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x0A,\n (byte) 0xF4,\n (byte) 0xAA,\n 0x40\n };\n byte checkSum = HEART_CMD[0];\n for (int i = 1; i < 19; i++)\n {\n if (i != 19 - 5)\n checkSum ^= HEART_CMD[i];\n\n }\n HEART_CMD[19 - 5] = checkSum;\n }", "private static String smsCode() {\n\t\t\tString random=new Random().nextInt(1000000)+\"\";\r\n\t\t\treturn random;\r\n\t\t}", "private ClusterMonitor sendDummyMessage() {\n\t\tClusterMonitor.Builder cm = ClusterMonitor.newBuilder();\n\t\t//your cluster ID\n\t\tcm.setClusterId(0);\n\t\n\t\tcm.setTick(i++);\n\n\t\t\n\t\t//No of nodes in your cluster\n\t\tcm.setNumNodes(5);\n\t\t\n\t\t//Node Id = Process Id\n\t//\tcm.addProcessId(50);\n\t\t//cm.addProcessId(51);\n\t\t//cm.addProcessId(53);\n\t\t//cm.addProcessId(54);\n\t\t//cm.addProcessId(52);\n\t\t\n//\t\t/cm.set\n\t\t\n\t\t//Set processId,No of EnquedTask for that processId\n\t\t\n\t//\tcm.addEnqueued(19);\n\t\t\n\t//\tcm.addEnqueued(5);\n\t\t//Set processId,No of ProcessedTask for that processId\n\t//\tcm.addProcessed(3);\n\t\t//cm.addProcessed(3);\n\t\t//Set processId,No of StolenTask for that processId\n\t\t//cm.addStolen(2);\n\t\tcm.addStolen(2);\n\t\t\n\t\t//Increment tick every time you send the message, or else it would be ignored\n\t\t// Tick starts from 0\n\t\n\t\t\n\t\treturn cm.build();\n\t}", "public final /* synthetic */ void mo9023j() {\n C3517a.m12960a(this.f8025c, (int) R.string.f30);\n HashMap hashMap = new HashMap();\n hashMap.put(\"error_type\", \"2\");\n C8443c.m25663a().mo21606a(\"livesdk_anchor_network_error\", hashMap, new Object[0]);\n }", "public String processMessage() throws ICANException {\n String aSegment;\n HL7Group aGroup;\n HL7Message aInMess = new HL7Message(mHL7Message);\n HL7Segment aInMSHSegment = new HL7Segment(aInMess.getSegment(\"MSH\"));\n HL7Segment aOutMSHSegment = processMSHToUFD();\n if (mEnvironment.indexOf(\"TEST\") >= 0) {\n String aSendingApp = aOutMSHSegment.get(HL7_23.MSH_3_sending_application);\n if (aSendingApp.indexOf(\".TEST\") >= 0) {\n aOutMSHSegment.set(HL7_23.MSH_3_sending_application, aSendingApp.substring(0, aSendingApp.length() - 5));\n }\n }\n HL7Message aOutMess = new HL7Message(aOutMSHSegment.getSegment());\n\n if(aInMess.isEvent(\"A01, A02, A03, A08, A11, A12, A13, A21, A22, A28, A31\")) {\n aOutMess.append(processEVNToUFD());\n aOutMess.append(processPIDToUFD());\n aOutMess.append(processNK1s_ToUFD());\n aOutMess.append(processPV1ToUFD());\n aOutMess.append(processPV2ToUFD());\n aOutMess.append(processOBXs_ToUFD());\n aOutMess.append(processAL1s_ToUFD());\n aOutMess.append(processDG1s_ToUFD());\n aOutMess.append(processDRGToUFD());\n aOutMess.append(processPR1s_ToUFD());\n aOutMess.append(processGT1s_ToUFD());\n aOutMess.append(processInsuranceToUFD());\n aOutMess.append(processCSC_ZsegmentsToUFD());\n\n } else if (aInMess.isEvent(\"A17\")) {\n aOutMess.append(processEVNToUFD().getSegment());\n aOutMess.append(processA17GroupToUFD(1));\n aOutMess.append(processA17GroupToUFD(2));\n\n } else if (aInMess.isEvent(\"A34\")) {\n aOutMess.append(processEVNToUFD().getSegment());\n aOutMess.append(processPIDToUFD().getSegment());\n aOutMess.append(processMRGToUFD().getSegment());\n }\n if (aOutMess.getMessage().length() > 0) {\n aOutMess.append(setupZBX(\"MESSAGE\", \"SOURCE_ID\", aInMSHSegment.get(HL7_23.MSH_10_message_control_ID)));\n }\n return aOutMess.getMessage();\n }", "private static String m21403f() {\n String str;\n String str2 = \"\";\n try {\n Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces();\n while (networkInterfaces.hasMoreElements()) {\n Enumeration inetAddresses = ((NetworkInterface) networkInterfaces.nextElement()).getInetAddresses();\n while (inetAddresses.hasMoreElements()) {\n InetAddress inetAddress = (InetAddress) inetAddresses.nextElement();\n if (!inetAddress.isLoopbackAddress()) {\n str2 = inetAddress.getHostAddress();\n }\n }\n }\n } catch (Throwable th) {\n C5205o.m21464a(th);\n }\n return str;\n }", "public String accionemergencia(){\n\t\tString resp=\"\";\n\t\tif(puntosvida<=5 && acc!=1){\n\t\t\tpuntosvida=puntosvida+15;\n\t\t\tresp=\"\\nAccion de emergencia \"+ tipo +\"activada vida +15\";\n\t\t\tacc=1;\n\t\t}\n\t\treturn resp;\n\t}", "public static String m582i() {\r\n try {\r\n Class cls = Class.forName(\"android.os.SystemProperties\");\r\n Object newInstance = cls.newInstance();\r\n return (String) cls.getMethod(\"get\", new Class[]{String.class, String.class}).invoke(newInstance, new Object[]{\"gsm.version.baseband\", \"no message\"});\r\n } catch (Exception e) {\r\n return null;\r\n }\r\n }", "public static void main(String[] args) throws MobileException {\n\n HTC mobil_htc = new HTC(\"HTC\", \"Desire\", true, true);\n Nokia mobil_nokia = new Nokia(\"Nokia\", \"N650\", true, false);\n\n\n try {\n mobil_htc.callContact(\"Iulian\");\n mobil_htc.getMobileInfo();\n mobil_htc.printContactNumber(\"Mihai\");\n mobil_nokia.getMobileInfo();\n mobil_nokia.testForWirelessConnection();\n mobil_htc.testForWirelessConnection();\n mobil_htc.chargeBattery();\n mobil_nokia.chargeBattery();\n mobil_htc.sendMessage(\"Politia\");\n mobil_htc.callContact(\"Salvare\");\n mobil_htc.setPowerON(false);\n mobil_htc.printContactNumber(\"Giulia\");// first exception: the device is turned off and cannot perform actions\n\n\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n\n try {\n mobil_htc.setPowerON(true);\n mobil_htc.printContactNumber(\"Giulia\");\n mobil_htc.callContact(\"Ajutor\");\n // mobil_htc.callContact(\"Mirel\"); // second exception: contact does not exist\n mobil_htc.getMobileInfo();\n mobil_htc.getMobileInfo();\n // mobil_htc.callContact(\"Ajutor\"); //third exception: battery level too low to perform this action;\n mobil_htc.chargeBattery();\n mobil_htc.chargeBattery();\n mobil_htc.setPowerON(true);\n mobil_htc.callContact(\"Ajutor\");\n mobil_nokia.sendMessage(\"Politia\");\n mobil_nokia.callContact(\"Salvare\");\n mobil_nokia.setPowerON(false);\n // mobil_nokia.printContactNumber(\"Giulia\"); //fourth exception: the device is turned off and cannot perform actions\n mobil_nokia.setPowerON(true);\n mobil_nokia.printContactNumber(\"Giulia\");\n mobil_nokia.callContact(\"Ajutor\");\n System.out.println(\"Sfarsit testare.\");\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }", "public static void poweroff(NetSocket socket) {\n String data = \"CS01*868807049006736*0008*POWEROFF,20190814114414I4021\";\n String deviceId = \"868807049006736\";\n send(socket, data, deviceId);\n }", "private void setMeteredInterface(java.lang.String r10, boolean r11) {\n /*\n r9 = this;\n if (r10 != 0) goto L_0x0003;\n L_0x0002:\n return;\n L_0x0003:\n r0 = \"network_management\";\n r0 = android.os.ServiceManager.getService(r0);\n if (r0 != 0) goto L_0x0014;\n L_0x000b:\n r1 = \"network-policy\";\n r2 = \"setIfWhitelist networkManager is null\";\n android.util.Log.e(r1, r2);\n return;\n L_0x0014:\n r1 = android.os.Parcel.obtain();\n r2 = android.os.Parcel.obtain();\n r3 = \"bandwidth\";\n r4 = 2;\n r4 = new java.lang.String[r4];\n if (r11 != 0) goto L_0x0026;\n L_0x0023:\n r5 = \"enable_ifwhitelist\";\n goto L_0x0028;\n L_0x0026:\n r5 = \"disable_ifwhitelist\";\n L_0x0028:\n r6 = 0;\n r4[r6] = r5;\n r5 = 1;\n r4[r5] = r10;\n r1.writeString(r3);\t Catch:{ Exception -> 0x005e }\n r1.writeArray(r4);\t Catch:{ Exception -> 0x005e }\n r7 = 201; // 0xc9 float:2.82E-43 double:9.93E-322;\t Catch:{ Exception -> 0x005e }\n r0.transact(r7, r1, r2, r6);\t Catch:{ Exception -> 0x005e }\n r6 = r9.sIncreaseCmdCount;\t Catch:{ Exception -> 0x005e }\n r6 = r6 + r5;\t Catch:{ Exception -> 0x005e }\n r9.sIncreaseCmdCount = r6;\t Catch:{ Exception -> 0x005e }\n r5 = \"network-policy\";\t Catch:{ Exception -> 0x005e }\n r6 = new java.lang.StringBuilder;\t Catch:{ Exception -> 0x005e }\n r6.<init>();\t Catch:{ Exception -> 0x005e }\n r7 = \"\";\t Catch:{ Exception -> 0x005e }\n r6.append(r7);\t Catch:{ Exception -> 0x005e }\n r6.append(r2);\t Catch:{ Exception -> 0x005e }\n r6 = r6.toString();\t Catch:{ Exception -> 0x005e }\n android.util.Log.e(r5, r6);\t Catch:{ Exception -> 0x005e }\n if (r1 == 0) goto L_0x0059;\n L_0x0056:\n r1.recycle();\n L_0x0059:\n if (r2 == 0) goto L_0x0080;\n L_0x005b:\n goto L_0x007d;\n L_0x005c:\n r5 = move-exception;\n goto L_0x0081;\n L_0x005e:\n r5 = move-exception;\n r6 = \"HwNetworkPolicy\";\t Catch:{ all -> 0x005c }\n r7 = new java.lang.StringBuilder;\t Catch:{ all -> 0x005c }\n r7.<init>();\t Catch:{ all -> 0x005c }\n r8 = \"setIfWhitelist-->\";\t Catch:{ all -> 0x005c }\n r7.append(r8);\t Catch:{ all -> 0x005c }\n r7.append(r5);\t Catch:{ all -> 0x005c }\n r7 = r7.toString();\t Catch:{ all -> 0x005c }\n android.util.Slog.e(r6, r7);\t Catch:{ all -> 0x005c }\n if (r1 == 0) goto L_0x007b;\n L_0x0078:\n r1.recycle();\n L_0x007b:\n if (r2 == 0) goto L_0x0080;\n L_0x007d:\n r2.recycle();\n L_0x0080:\n return;\n L_0x0081:\n if (r1 == 0) goto L_0x0086;\n L_0x0083:\n r1.recycle();\n L_0x0086:\n if (r2 == 0) goto L_0x008b;\n L_0x0088:\n r2.recycle();\n L_0x008b:\n throw r5;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.android.server.net.HwNetworkPolicyManagerService.setMeteredInterface(java.lang.String, boolean):void\");\n }", "public final /* synthetic */ void mo9024k() {\n C3517a.m12960a(this.f8025c, (int) R.string.f0l);\n HashMap hashMap = new HashMap();\n hashMap.put(\"error_type\", \"1\");\n C8443c.m25663a().mo21606a(\"livesdk_anchor_network_error\", hashMap, new Object[0]);\n }", "public static String m588l(Context context) {\r\n try {\r\n WifiManager wifiManager = (WifiManager) context.getSystemService(\"wifi\");\r\n if (wifiManager.isWifiEnabled()) {\r\n return wifiManager.getConnectionInfo().getBSSID();\r\n }\r\n } catch (Throwable th) {\r\n }\r\n return bi_常量类.f6358b_空串;\r\n }", "@Override\n\tpublic void sendISRMail(char message) {\n\t\tif (isrSendMessage(message) == TaskControl.NOT_OK) {\n\t\t\tsystem.getTelemetryData().setISRSendMessageError(mailbox_number);\n\t\t}\n\t}", "private void sendPhoneDetail(Context context, Intent intent, SmsMessage inMessage){\n\t\t\tSmsManager mng= SmsManager.getDefault();\n\t\t\tPendingIntent dummyEvent = PendingIntent.getBroadcast(context, 0, new Intent(\"com.example.SMSExample.IGNORE_ME\"), 0);\n\t\t\tString addr = inMessage.getOriginatingAddress();\n\n\t\t\tif(addr == null)\n\t\t\t{\n\t\t\t\tLog.i(\"SmsIntent\", \"Unable to get Address from Sent Message\");\n\t\t\t}\n\t\t\tString ipaddress=getipAddress();\n\t\t\t//String ipaddress=getLocalIpAddress();\n\t\t\t\n\t\t\tString replymsg;\n\t\t\tif(ipaddress == null){\n\t\t\t\treplymsg = \"null\";\n\t\t\t}else{\n\t\t\t\treplymsg = \"startip\" + ipaddress + \"stopip\"; \n\t\t\t\n\t\t\t}\n\t\t\n\t\t\ttry{\n\t\t\t\tmng.sendTextMessage(addr, null, replymsg, dummyEvent, dummyEvent);\n\t\t\t}catch(Exception e){\n\t\t\t\tLog.e(\"SmsIntent\",\"SendException\", e );\n\t\t\t}\n\t\t\n\t\t}", "public String getMACCHN()\n {\n return this.MACCHN;\n }", "public final void mo5699d(boolean z, String str) {\n AppMethodBeat.m2504i(16649);\n if (z) {\n C4990ab.m7416i(\"MicroMsg.PermissionWarningDialog\", \"set MicroPhone unmute.\");\n ((AudioManager) C4996ah.getContext().getSystemService(SlookAirButtonRecentMediaAdapter.AUDIO_TYPE)).setMicrophoneMute(false);\n }\n PermissionWarningDialog.this.finish();\n AppMethodBeat.m2505o(16649);\n }", "public void v_Verify_Guest9_Hidden(){\n\t}", "private void sendSMS() {\n String msg = \"\";\n\n switch (s) {\n case \"Accelerometre\":\n msg = acce;\n break;\n case \"Lumiere\":\n msg = light;\n break;\n case \"Proximite\":\n msg = proxi;\n break;\n case \"Gyroscope\":\n msg = gyro;\n break;\n }\n\n String num = numero.getText().toString();\n\n final int PERMISSION_REQUEST_CODE = 1;\n\n if (checkSelfPermission(android.Manifest.permission.SEND_SMS) ==\n PackageManager.PERMISSION_DENIED) {\n Log.d(\" permission \", \" permission denied to SEND_SMS - requesting it \");\n String[] permissions = {android.Manifest.permission.SEND_SMS};\n requestPermissions(permissions, PERMISSION_REQUEST_CODE);\n } else {\n if (num.length() == 10) {\n SmsManager.getDefault().sendTextMessage(num, null, msg, null, null);\n numero.setText(\"\");\n } else {\n //On affiche un petit message d'erreur dans un Toast\n Toast toast = Toast.makeText(CapteurActivity.this, \"Veuilliez écrire un numero a 10 chiffres\", Toast.LENGTH_LONG);\n toast.show();\n\n }\n }\n }", "public void setMsisdn(java.lang.String param){\n localMsisdnTracker = true;\n \n this.localMsisdn=param;\n \n\n }", "String mo729c() throws RemoteException;", "public String getSystemID()\n/* */ {\n/* 1299 */ return this.systemID;\n/* */ }", "public void get_IMEI(){\n TelephonyManager mngr = (TelephonyManager) getSystemService(this.TELEPHONY_SERVICE);\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n mngr.getDeviceId();\n }", "public void sendToOutpatients(){\r\n\t\t//here is some code that we do not have access to\r\n\t}", "public void v_Verify_Guest11_Hidden(){\n\t}", "public String getWmoId() {\n String wmoID = \"\";\n if (!(stnm == GempakConstants.IMISSD)) {\n wmoID = String.valueOf(stnm / 10);\n }\n return wmoID;\n }", "public static String m21421x(Context context) {\n try {\n WifiManager wifiManager = (WifiManager) context.getSystemService(\"wifi\");\n return wifiManager.isWifiEnabled() ? m21388a(wifiManager) : m21403f();\n } catch (Throwable th) {\n C5205o.m21464a(th);\n return \"0.0.0.0\";\n }\n }", "public void callHelp() {\n System.out.println(\"Enter emergency number: \");\n String emergencyNeed = input.nextLine();\n this.emergencyNeed = emergencyNeed;\n if (emergencyNeed.equals(police)) {\n System.out.println(\"Calling for police!\");\n }\n else if (emergencyNeed.equals(fire)) {\n System.out.println(\"Calling for fire department!\");\n }\n else if (emergencyNeed.equals(emt)) {\n System.out.println(\"Calling for emt!\");\n }\n else {\n System.out.println(\"Invalid emergency number.\");\n }\n }", "public void notifyNoKAliveReceived (COPSPdpOSReqStateMan man);", "public void notificar()\n\t{\n\n\t\tSocket socket;\n\t\tDataOutputStream out;\n\n\t\ttry\n\t\t{\n\t\t\tsocket = new Socket(host, port);\n\n\t\t\tout = new DataOutputStream(socket.getOutputStream());\n\n\t\t\tout.writeUTF(id);\n\n\t\t\tsocket.close();\n\n\t\t} catch (IOException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static String m21416s(Context context) {\n if (TextUtils.isEmpty(f16894e)) {\n try {\n f16894e = ((TelephonyManager) context.getSystemService(\"phone\")).getDeviceId();\n } catch (Exception e) {\n C5205o.m21464a((Throwable) e);\n }\n }\n return f16894e;\n }", "protected void reply_no() throws java.io.IOException {\n byte[] no = PushCacheProtocol.instance().noPacket();\n _socket.getOutputStream().write(no, 0, no.length);\n }", "public final void mo56355c(String str) {\n C7573i.m23587b(str, \"msg\");\n this.f56252a.mo38742c(str);\n }", "public void send(Message dmsg) throws IOException {\n\tString phoneNumber = null;\n\tString address = null;\n\n\tif (dmsg == null) {\n\t throw new NullPointerException();\n\t}\n\n if (dmsg.getAddress() == null) {\n throw new IllegalArgumentException();\n\t}\n\n /*\n * parse name into host and port\n */\n\tString addr = dmsg.getAddress();\n HttpUrl url = new HttpUrl(addr);\n if (url.port == -1) {\n /* no port supplied */\n url.port = 0;\n }\n\n\t/* Can not send to cbs address. */\n\tif (addr.startsWith(\"cbs:\")) {\n\t // Can't send a CBS message.\n\t throw new IllegalArgumentException(\"Can't send CBS msg.\");\n\t}\n\n int numSeg = numberOfSegments(dmsg);\n\tif ((numSeg <= 0) || (numSeg > 3)) {\n throw new IOException(\"Error: message is too large\");\n\t}\n\n try {\n midletSuite.checkForPermission(Permissions.SMS_SEND,\n url.host,\n Integer.toString(numSeg));\n } catch (InterruptedException ie) {\n throw new InterruptedIOException(\"Interrupted while trying \" +\n \"to ask the user permission\");\n }\n\n\tensureOpen();\n\n\tif ((m_mode & Connector.WRITE) == 0) {\n\n\t throw new IOException(\"Invalid mode\");\n\t}\n\n int sourcePort = 0;\n if ((m_mode & Connector.READ) != 0 && host == null) {\n sourcePort = m_iport;\n }\n\n for (int restrictedPortIndex = 0;\n restrictedPortIndex < restrictedPorts.length;\n restrictedPortIndex++) {\n if (url.port == restrictedPorts[restrictedPortIndex]) {\n throw new SecurityException(\n \"not allowed to send SMS messages to the restricted ports\");\n }\n }\n\n\tint messageType = GSM_BINARY;\n\tbyte[] msgBuffer = null;\n\n if (dmsg instanceof TextObject)\t {\n byte[] gsm7bytes;\n msgBuffer = ((TextObject)dmsg).getBytes();\n\t if (msgBuffer != null) {\n /*\n * Attempt to encode the UCS2 bytes as GSM 7-bit.\n */\n gsm7bytes = TextEncoder.encode(msgBuffer);\n if (gsm7bytes != null) {\n\t\t msgBuffer = gsm7bytes;\n\t\t messageType = GSM_TEXT;\n } else {\n /*\n * Encoding attempt failed. Send UCS2 bytes.\n */\n\t\t messageType = GSM_UCS2;\n }\n\t }\n\n } else if (dmsg instanceof BinaryObject) {\n msgBuffer = ((BinaryObject)dmsg).getPayloadData();\n\t} else {\n throw new IllegalArgumentException(\"Message type not supported\");\n\t}\n\n try {\n send0(connHandle, messageType,\n url.host,\n url.port,\n\t\t\t sourcePort,\n msgBuffer);\n } catch (IOException ex) {\n io2InterruptedIOExc(ex, \"sending\");\n }\n }" ]
[ "0.5970243", "0.57603014", "0.5671708", "0.5653973", "0.56164014", "0.5594028", "0.5587765", "0.55604154", "0.55378246", "0.5523966", "0.5523966", "0.5523966", "0.5523966", "0.5523966", "0.5523966", "0.5523966", "0.54764694", "0.5474616", "0.54588085", "0.5445328", "0.5425166", "0.5409411", "0.5407097", "0.54069954", "0.5406313", "0.53650576", "0.53580594", "0.5353378", "0.533909", "0.5325259", "0.5317825", "0.5314882", "0.5311081", "0.53089035", "0.53018725", "0.529976", "0.52929866", "0.5292014", "0.5287576", "0.52748746", "0.5269304", "0.5247007", "0.5244236", "0.52428186", "0.52404034", "0.522562", "0.5214635", "0.52142924", "0.52051765", "0.51933014", "0.51901656", "0.51898783", "0.518882", "0.5187123", "0.51838183", "0.5181921", "0.5179209", "0.5170809", "0.5170533", "0.51595944", "0.51582545", "0.5147004", "0.5144415", "0.51432186", "0.5138661", "0.5132836", "0.51288754", "0.5128504", "0.5127603", "0.51220155", "0.511748", "0.51132655", "0.51095104", "0.51088685", "0.5098398", "0.5097344", "0.50877863", "0.50830156", "0.50799894", "0.5079849", "0.5079021", "0.5076444", "0.5074692", "0.50732064", "0.5068006", "0.50677013", "0.506716", "0.5065649", "0.50605553", "0.5060312", "0.5058375", "0.50583655", "0.5055899", "0.5055603", "0.5053634", "0.50518435", "0.5050857", "0.5050671", "0.50486344", "0.5048047" ]
0.5641857
4
Customized ecc number when SIM card is not inserted
public boolean isCustomizedEmergencyNumberExt(String number, String plusNumber, String numberPlus) { String []emergencyNumList = {"112", "911", "000", "08", "110", "118", "119", "999", "120"}; for (String emergencyNum : emergencyNumList) { numberPlus = emergencyNum + "+"; if (emergencyNum.equals(number) || numberPlus.equals(number)) { return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setEmbossCardNum(String value) {\r\n setAttributeInternal(EMBOSSCARDNUM, value);\r\n }", "@Override\r\n\tpublic int getcc() {\n\t\treturn 120;\r\n\t}", "public String getEmbossCardNum() {\r\n return (String) getAttributeInternal(EMBOSSCARDNUM);\r\n }", "String getCE();", "String getCE();", "String getCE();", "String getCE();", "String getEACCode();", "public double getEccentricity() {\n return eccentricity;\n }", "@Override\n\tpublic void teclaConfirmaDigitada() {\n\t\t\n\t}", "@Override\n public void cUSerialNumber(long value) {\n //throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }", "java.lang.String getSerialNumber();", "java.lang.String getSerialNumber();", "public String epcString()\n {\n StringBuilder sb = new StringBuilder(epc.length * 2);\n\n for (int i = 0; i < epc.length; i++)\n {\n sb.append(String.format(\"%02X\", (epc[i] & 0xff)));\n }\n return new String(sb);\n }", "public int mo15797hn() {\n return this.f3883JI;\n }", "BigInteger getCEP();", "private static String getNonceStr() {\r\n\t\tRandom random = new Random();\r\n\t\treturn MD5Util.MD5Encode(String.valueOf(random.nextInt(10000)), \"GBK\");\r\n\t}", "private void setAccountNumber() // setare numar de cont\n {\n int random = ThreadLocalRandom.current().nextInt(1, 100 + 1);\n accountNumber = ID + \"\" + random + SSN.substring(0,2);\n System.out.println(\"Your account number is: \" + accountNumber);\n }", "public static String generateCardNumber(Issuer issuer) {\n // cardNumber = Visa start with 4400, AMex: 3715, MasterCard = 3507\n String number = \"\";\n switch(issuer){\n case VISA: number += \"4400\"; break;\n case MASTER_CARD: number += \"3507\"; break;\n case AMEX: number += \"3715\"; break;\n case DISCOVER: number += \"5555\"; break;\n }\n /*\n if(issuer.equalsIgnoreCase(\"Visa\")) {\n number += \"4400\";\n }\n else if(issuer.equalsIgnoreCase(\"MasterCard\")) {\n number += \"3507\";\n }\n else if(issuer.equalsIgnoreCase(\"American Express\") \n || issuer.equalsIgnoreCase(\"Amex\")) {\n number += \"3715\";\n }\n else { // for our program, a default starting number\n number += \"5555\"; \n }\n */\n // could make random 12 digit number to add on.\n // or a counter that would add on\n number += COUNTER; \n COUNTER++;\n\n return number;\n }", "String getDefaultCardLast4();", "public String getCvvNumber();", "public java.math.BigInteger getSerialNumber() {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e5 in method: android.security.keystore.DelegatingX509Certificate.getSerialNumber():java.math.BigInteger, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.security.keystore.DelegatingX509Certificate.getSerialNumber():java.math.BigInteger\");\n }", "long getAlgIdExt();", "public ECP getKGCRandomKey(){return R;}", "public void creditCard() {\n\t\tSystem.out.println(\"hsbc --- credit card\");\n\t\t\n\t}", "private String getCardNumber() {\n try {\n String cardNumberWithoutSpaces = cardNumber.getAttribute(\"value\").replaceAll(\" \", \"\");\n int cardLength = cardNumberWithoutSpaces.length();\n return cardNumberWithoutSpaces.substring(cardLength - 4, cardLength);\n }\n catch (Exception ex) {\n // no action\n }\n return null;\n }", "public String getNGAYCAP_CCHN()\n {\n return this.NGAYCAP_CCHN;\n }", "public String m50420r() {\n try {\n return this.f30729a0.getCardNumber();\n } catch (Exception unused) {\n return this.f30729a0.getText().toString().trim();\n }\n }", "@Override\r\n\tpublic String getBind_oth_card_ind() {\n\t\treturn super.getBind_oth_card_ind();\r\n\t}", "public String getUSECIF_NUMBER5() {\r\n return USECIF_NUMBER5;\r\n }", "public String getUSECIF_NUMBER5() {\r\n return USECIF_NUMBER5;\r\n }", "@SuppressWarnings(\"unused\")\n\tpublic static String retornaNumeroCNF() {\n\n\t\tInteger cnf = (int) (Math.random() * 99999999);\n\n\t\treturn /*cnf.toString();*/ \"18005129\";\n\t}", "public int getCCN(){\n\t\treturn ccn;\n\t}", "public static int m21411n(Context context) {\n if (TextUtils.isEmpty(f16896g)) {\n f16896g = ((TelephonyManager) context.getSystemService(\"phone\")).getSimOperator();\n if (TextUtils.isEmpty(f16896g)) {\n f16896g = \"\";\n }\n }\n if (!\"46000\".equals(f16896g)) {\n if (!\"46002\".equals(f16896g)) {\n if (!\"46004\".equals(f16896g)) {\n if (!\"46007\".equals(f16896g)) {\n if (!\"46008\".equals(f16896g)) {\n if (!\"46001\".equals(f16896g)) {\n if (!\"46006\".equals(f16896g)) {\n if (!\"46009\".equals(f16896g)) {\n if (!\"46003\".equals(f16896g)) {\n if (!\"46005\".equals(f16896g)) {\n if (!\"46011\".equals(f16896g)) {\n return \"46020\".equals(f16896g) ? 4 : 0;\n }\n }\n }\n return 3;\n }\n }\n }\n return 2;\n }\n }\n }\n }\n }\n return 1;\n }", "String billingPartNumber();", "public java.math.BigInteger getSerialNumber() {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e5 in method: sun.security.x509.X509CRLEntryImpl.getSerialNumber():java.math.BigInteger, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: sun.security.x509.X509CRLEntryImpl.getSerialNumber():java.math.BigInteger\");\n }", "public static String getSerialNo(byte[] edid) {\n // Bytes 12-15 are Serial number (last 4 characters)\n if (Logger.get().isDebug()) {\n Logger.debug(\"Serial number: {}\", Arrays.toString(Arrays.copyOfRange(edid, 12, Normal._16)));\n }\n return String.format(\"%s%s%s%s\", getAlphaNumericOrHex(edid[15]), getAlphaNumericOrHex(edid[14]),\n getAlphaNumericOrHex(edid[13]), getAlphaNumericOrHex(edid[12]));\n }", "public java.lang.String getCardNo() {\r\n return localCardNo;\r\n }", "public java.lang.String getCardNo() {\r\n return localCardNo;\r\n }", "private void setCC(int CC) {\n\t\tCMN.CC = CC;\n\t}", "public EnzymeCommissionNumber getEc() {\n return ec;\n }", "int getMcc();", "int getMcc();", "String mo7390hn() throws RemoteException;", "public String getMcc() {\n return mcc;\n }", "public static String getIccid() {\n\t\treturn null;\n\t}", "@Override\n\tpublic void createccuntNum() {\n\t\t\n\t}", "public void setComNumber(long value) {\r\n this.comNumber = value;\r\n }", "private String encodeCode11() {\n if (!checkNumericOnly(getRawData().replace(\"-\", \"\"))) {\n error(\"EC11-1: Numeric data and '-' Only\");\n }\n\n //calculate the checksums\n int weight = 1;\n int CTotal = 0;\n String dataToEncodeWithChecksums = getRawData();\n\n //figure the C checksum\n for (int i = getRawData().length() - 1; i >= 0; i--) {\n //C checksum weights go 1-10\n if (weight == 10) {\n weight = 1;\n }\n\n if (getRawData().charAt(i) != '-') {\n CTotal += Integer.parseInt(String.valueOf(getRawData().charAt(i))) * weight++;\n } else {\n CTotal += 10 * weight++;\n }\n }\n\n int checksumC = CTotal % 11;\n\n dataToEncodeWithChecksums += String.valueOf(checksumC);\n\n //K checksums are recommended on any message length greater than or equal to 10\n if (getRawData().length() >= 10) {\n weight = 1;\n int KTotal = 0;\n\n //calculate K checksum\n for (int i = dataToEncodeWithChecksums.length() - 1; i >= 0; i--) {\n //K checksum weights go 1-9\n if (weight == 9) {\n weight = 1;\n }\n\n if (dataToEncodeWithChecksums.charAt(i) != '-') {\n KTotal += Integer.parseInt(String.valueOf(dataToEncodeWithChecksums.charAt(i))) * weight++;\n } else {\n KTotal += 10 * weight++;\n }\n }\n\n int checksumK = KTotal % 9;\n dataToEncodeWithChecksums += checksumK;\n }\n\n //encode data\n String space = \"0\";\n StringBuilder builder = new StringBuilder();\n builder.append(C11_Code[11]);//start-stop char\n builder.append(space); //interchar space\n\n for (char c : dataToEncodeWithChecksums.toCharArray()) {\n int index = (c == '-' ? 10 : Integer.parseInt(String.valueOf(c)));\n builder.append(C11_Code[index]);\n\n //inter-character space\n builder.append(space);\n }//foreach\n\n //stop bars\n builder.append(C11_Code[11]);\n\n return builder.toString();\n }", "public static String m583i(Context context) {\r\n try {\r\n return ((TelephonyManager) context.getSystemService(\"phone\")).getSimSerialNumber();\r\n } catch (Exception e) {\r\n return null;\r\n }\r\n }", "public String getCardNo() {\n return cardNo;\n }", "public String accionemergencia(){\n\t\tString resp=\"\";\n\t\tif(puntosvida<=5 && acc!=1){\n\t\t\tpuntosvida=puntosvida+15;\n\t\t\tresp=\"\\nAccion de emergencia \"+ tipo +\"activada vida +15\";\n\t\t\tacc=1;\n\t\t}\n\t\treturn resp;\n\t}", "@Override\n\tpublic String getCPUBrand() {\n\t\treturn \"Intel\";\n\t}", "public String getIdCardNo() {\n return idCardNo;\n }", "public String getencodedCard() {\r\n \r\n String cardDesc=\"\";\r\n String partnerId=\"\";\r\n String cardId=\"\";\r\n \r\n if(session!=null) {\r\n if (session.getAttribute(\"Partner_Object_List\") != null) {\r\n partnerInfoList =\r\n (List<PartnerInfo>)session.getAttribute(\"Partner_Object_List\");\r\n if(getPartner()!=null && !getPartner().equals(\"\") && getCardPk() != null && !getCardPk().equals(\"\")){\r\n partnerId=getPartner();\r\n cardId=getCardPk().toString().trim();\r\n \r\n if (partnerInfoList != null) {\r\n for (int k = 0; k < partnerInfoList.size(); k++) {\r\n if (partnerId.equalsIgnoreCase(partnerInfoList.get(k).getPartnerValue().toString())) {\r\n for (int ac = 0;ac < partnerInfoList.get(k).getAccountList().size();ac++) {\r\n for (int cg = 0;cg < partnerInfoList.get(k).getAccountList().get(ac).getCardGroup().size();cg++) {\r\n for (int cd = 0;cd < partnerInfoList.get(k).getAccountList().get(ac).getCardGroup().get(cg).getCard().size();cd++) {\r\n if(cardId.equalsIgnoreCase(partnerInfoList.get(k).getAccountList().get(ac).getCardGroup().get(cg).getCard().get(cd).getCardID())) {\r\n if(partnerInfoList.get(k).getAccountList().get(ac).getCardGroup().get(cg).getCard().get(cd).getDisplayCardNumber() != null)\r\n {\r\n cardDesc= partnerInfoList.get(k).getAccountList().get(ac).getCardGroup().get(cg).getCard().get(cd).getDisplayCardNumber().toString();\r\n }\r\n }\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return cardDesc;\r\n \r\n \r\n }", "private String generateNonce() {\n // Get the time of day and run MD5 over it.\n Date date = new Date();\n long time = date.getTime();\n Random rand = new Random();\n long pad = rand.nextLong();\n // String nonceString = (new Long(time)).toString()\n // + (new Long(pad)).toString();\n String nonceString = Long.valueOf(time).toString()\n + Long.valueOf(pad).toString();\n byte mdbytes[] = messageDigest.digest(nonceString.getBytes());\n // Convert the mdbytes array into a hex string.\n return toHexString(mdbytes);\n }", "public String getCardNo() {\n\t\treturn cardNo;\n\t}", "private String formatTccId(TCC tcc) {\n\t\tString id = Integer.toString(tcc.getIdTCC());\n\t\twhile (id.length() < 5) {\n\t\t\tid = \"0\" + id;\n\t\t}\n\t\treturn id;\n\t}", "public java.lang.String getCivNo () {\n\t\treturn civNo;\n\t}", "private String m50428v() {\n if (TextUtils.isEmpty(this.f30737h0.getText().toString())) {\n return this.f30720S.getString(C10232R.string.payment_error_blank_field);\n }\n return !CardPaymentParams.m53958j(this.f30737h0.getText().toString().trim()) ? this.f30720S.getString(C10232R.string.payment_error_security_code_invalid) : \"\";\n }", "public java.lang.String getCardSerNo() {\r\n return localCardSerNo;\r\n }", "public String ebcExample() {\n\t\tString ret = AESEBC.AESEncrypt(blockPlaintext, key);\n\t\tret += \"\\n\\n\" + AESEBC.AESDecrypt(ebcCiphertext, key);\n\t\treturn ret;\n\t}", "private static String smsCode() {\n\t\t\tString random=new Random().nextInt(1000000)+\"\";\r\n\t\t\treturn random;\r\n\t\t}", "public String getNRC() {\r\n return NRC;\r\n }", "public String getCardNumber() {\n return this.account;\n }", "public C1450o mo13883e() {\n C1450o c1450o = new C1450o(mo13877c());\n c1450o.f5121c = this.f5079e;\n c1450o.f5119a = this.f5080f;\n c1450o.f5120b = this.f5081g;\n String str = this.f5088n;\n if (!TextUtils.isEmpty(str)) {\n c1450o.f5122d = str;\n }\n return c1450o;\n }", "public String getIdCardNo() {\n\t\treturn idCardNo;\n\t}", "public String getUSECIF_NUMBER4() {\r\n return USECIF_NUMBER4;\r\n }", "public String getUSECIF_NUMBER4() {\r\n return USECIF_NUMBER4;\r\n }", "public String getCsNumber() {\n return csNumber;\n }", "private void setDocumentNo() {\n //\tCash Transfer\n if (\"X\".equals(getTenderType())) {\n return;\n }\n //\tCurrent Document No\n String documentNo = getDocumentNo();\n //\tExisting reversal\n if (documentNo != null\n && documentNo.indexOf(REVERSE_INDICATOR) >= 0) {\n return;\n }\n\n //\tIf external number exists - enforce it\n if (getR_PnRef() != null && getR_PnRef().length() > 0) {\n if (!getR_PnRef().equals(documentNo)) {\n setDocumentNo(getR_PnRef());\n }\n return;\n }\n\n documentNo = \"\";\n\n /* Begin e-Evolution\n //\tCredit Card\n if (TENDERTYPE_CreditCard.equals(getTenderType()))\n {\n documentNo = getCreditCardType()\n + \" \" + Obscure.obscure(getCreditCardNumber())\n + \" \" + getCreditCardExpMM()\n + \"/\" + getCreditCardExpYY();\n }\n //\tOwn Check No\n else\n // End e-Evolution */\n\n if (TENDERTYPE_Check.equals(getTenderType())\n && !isReceipt()\n && getCheckNo() != null && getCheckNo().length() > 0) {\n documentNo = getCheckNo();\n }\n //\tCustomer Check: Routing: Account #Check\n //begin e-evolution vpj-cd 11 MAy 2006\n\t\t/*else if (TENDERTYPE_Check.equals(getTenderType())\n && isReceipt())\n {\n if (getRoutingNo() != null)\n documentNo = getRoutingNo() + \": \";\n if (getAccountNo() != null)\n documentNo += getAccountNo();\n if (getCheckNo() != null)\n {\n if (documentNo.length() > 0)\n documentNo += \" \";\n documentNo += \"#\" + getCheckNo();\n }\n }\n // End e-Evolution */\n //\tSet Document No\n documentNo = documentNo.trim();\n if (documentNo.length() > 0) {\n setDocumentNo(documentNo);\n }\n }", "public String enkodeRC4(String result)\n {\n try\n {\n String text2Encrypt;\n byte[] ciphertext1;\n ab.system.libraries.security.ABSecurity.ControllEncRC4Engine s1 = new ab.system.libraries.security.ABSecurity.ControllEncRC4Engine();\n text2Encrypt = result;\n s1.init(true, new KeyParameter(ABSecurity.keyRC4().getBytes()));\n ciphertext1 = new byte[text2Encrypt.length()];\n s1.processBytes(text2Encrypt.getBytes(), 0, text2Encrypt.length(), ciphertext1, 0);\n result = s1.bytesToHex(ciphertext1);\n }\n catch(Exception e)\n {\n e.printStackTrace();\n }\n return result;\n }", "public void generateCardValue() {\r\n\t\tswitch (cardNumber) {\r\n\t\tcase 1:\r\n\t\t\tcardValue = \"Ace\";\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\t\tcardValue = \"Two\";\r\n\t\t\tbreak;\r\n\t\tcase 3:\r\n\t\t\tcardValue = \"Three\";\r\n\t\t\tbreak;\r\n\t\tcase 4:\r\n\t\t\tcardValue = \"Four\";\r\n\t\t\tbreak;\r\n\t\tcase 5:\r\n\t\t\tcardValue = \"Five\";\r\n\t\t\tbreak;\r\n\t\tcase 6:\r\n\t\t\tcardValue = \"Six\";\r\n\t\t\tbreak;\r\n\t\tcase 7:\r\n\t\t\tcardValue = \"Seven\";\r\n\t\t\tbreak;\r\n\t\tcase 8:\r\n\t\t\tcardValue = \"Eight\";\r\n\t\t\tbreak;\r\n\t\tcase 9:\r\n\t\t\tcardValue = \"Nine\";\r\n\t\t\tbreak;\r\n\t\tcase 10:\r\n\t\t\tcardValue = \"Ten\";\r\n\t\t\tbreak;\r\n\t\tcase 11:\r\n\t\t\tcardValue = \"Jack\";\r\n\t\t\tcardNumber = 10;\r\n\t\t\tbreak;\r\n\t\tcase 12:\r\n\t\t\tcardValue = \"Queen\";\r\n\t\t\tcardNumber = 10;\r\n\t\t\tbreak;\r\n\t\tcase 13:\r\n\t\t\tcardValue = \"King\";\r\n\t\t\tcardNumber = 10;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "public void setSerialNumber(java.math.BigInteger r1) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e9 in method: com.android.org.bouncycastle.x509.X509V1CertificateGenerator.setSerialNumber(java.math.BigInteger):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.android.org.bouncycastle.x509.X509V1CertificateGenerator.setSerialNumber(java.math.BigInteger):void\");\n }", "public static String getNonce(){\r\n\t\tRandom random = new Random();\r\n\t\treturn getNonce(MIN_NONCE_SIZE+random.nextInt(MAX_NONCE_SIZE-MIN_NONCE_SIZE+1));\r\n\t}", "public int getCC() {\n\t\treturn CC;\n\t}", "public String getEpaCertNo() {\n return epaCertNo;\n }", "public String getUSECIF_NUMBER2() {\r\n return USECIF_NUMBER2;\r\n }", "public String getUSECIF_NUMBER2() {\r\n return USECIF_NUMBER2;\r\n }", "public String getOemID() {\n final byte[] data = new byte[8];\n mem.getBytes(8, data, 0, data.length);\n return new String(data).trim();\n }", "public java.lang.String getIDCardNo() {\r\n return localIDCardNo;\r\n }", "public java.lang.String getIDCardNo() {\r\n return localIDCardNo;\r\n }", "public String getCertCardNo() {\n\t\treturn certCardNo;\n\t}", "Etf(char extended, double price, int number)\n {\n super();\n this.extended = extended;\n this.price = price;\n this.number = number;\n }", "public int getMcc() {\n return mcc_;\n }", "public int getMcc() {\n return mcc_;\n }", "private static String pseudoUniqueId() {\n\t\t// decimal\n\t\tfinal Integer DECIMAL = 10;\n\n\t\t// return the android device some common info(board, brand, CPU type +\n\t\t// ABI convention, device, display, host, id, manufacturer, model,\n\t\t// product, tags, type and user) combined string\n\t\treturn new StringBuilder().append(Build.BOARD.length() % DECIMAL)\n\t\t\t\t.append(Build.BRAND.length() % DECIMAL)\n\t\t\t\t.append(Build.CPU_ABI.length() % DECIMAL)\n\t\t\t\t.append(Build.DEVICE.length() % DECIMAL)\n\t\t\t\t.append(Build.DISPLAY.length() % DECIMAL)\n\t\t\t\t.append(Build.HOST.length() % DECIMAL)\n\t\t\t\t.append(Build.ID.length() % DECIMAL)\n\t\t\t\t.append(Build.MANUFACTURER.length() % DECIMAL)\n\t\t\t\t.append(Build.MODEL.length() % DECIMAL)\n\t\t\t\t.append(Build.PRODUCT.length() % DECIMAL)\n\t\t\t\t.append(Build.TAGS.length() % DECIMAL)\n\t\t\t\t.append(Build.TYPE.length() % DECIMAL)\n\t\t\t\t.append(Build.USER.length() % DECIMAL).toString();\n\t}", "public void cardGen(){\n\t\tRandom rand = new Random();\n\t\tint randValue = rand.nextInt(13);\n\t\tcardString = value[randValue] + suit[rand.nextInt(4)];\n\t}", "public CreditCard(int pin, String number, String holder, Date expiryDate, int cvc){\r\n this.pin = pin;\r\n this.number = number;\r\n this.holder = holder;\r\n this.expiryDate = expiryDate;\r\n this.cvc = cvc;\r\n}", "java.lang.String getAccountNumber();", "public static String m571c(Context context) {\r\n if (context == null) {\r\n return null;\r\n }\r\n try {\r\n TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(\"phone\");\r\n return telephonyManager != null ? telephonyManager.getLine1Number() : null;\r\n } catch (Exception e) {\r\n return null;\r\n }\r\n }", "java.lang.String getField1305();", "public void setCompnayNum(String comnayNum) {\n this.companyNum = FileUtils.hexStringFromatByF(10, \"\");\n }", "public int getMcc() {\n return mcc_;\n }", "public int getMcc() {\n return mcc_;\n }", "public static String calc_nonce(){\n\t\treturn String.valueOf(System.currentTimeMillis());\n\t}", "public static String getCompany(String _card){\r\n\t\t\tString _errorLength = \"Invalid number of digits.\";\r\n\t\t\tString _errorInvalid = \"Invalid credit card number.\";\r\n\t\t\t\r\n\t\t\tif (_card.length() >= 13 && _card.length() <=16){\r\n\t\t\t\tif (_card.charAt(0) == '4'){\r\n\t\t\t\t\treturn \"Visa\";\r\n\t\t\t\t}else if (_card.charAt(0) == '5'){\r\n\t\t\t\t\treturn \"Mastercard\";\r\n\t\t\t\t}else if (_card.charAt(0) == '6'){\r\n\t\t\t\t\treturn \"Discover\";\r\n\t\t\t\t}else if (_card.charAt(0) == '3' && _card.charAt(1) == '7'){\r\n\t\t\t\t\treturn \"American Express\";\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn _errorInvalid;\r\n\t\t\t\t}\r\n\t\t\t}else {\r\n\t\t\t\treturn _errorLength;\r\n\t\t\t}\r\n\t}", "Etf()\n {\n super();\n extended = 'A';\n price = 2176.33;\n number = 10;\n }", "public int getE04(final int digitNumber);", "public int mo15788hn() {\n return this.f3880Mw.mo15797hn();\n }", "String getCidr();" ]
[ "0.60532945", "0.58796585", "0.5866555", "0.58041257", "0.58041257", "0.58041257", "0.58041257", "0.5767671", "0.5689174", "0.5674918", "0.5665321", "0.56372887", "0.56372887", "0.55832493", "0.55179495", "0.5514721", "0.54905367", "0.5459067", "0.5425899", "0.5413679", "0.5409118", "0.53940785", "0.53877664", "0.538654", "0.53859246", "0.5378762", "0.53757584", "0.53513074", "0.53441584", "0.5324374", "0.5324374", "0.5321002", "0.53099877", "0.5301353", "0.52918625", "0.5285905", "0.52847046", "0.52806765", "0.52806765", "0.527817", "0.527619", "0.52731186", "0.52731186", "0.5271596", "0.5271577", "0.5269358", "0.52625775", "0.5251637", "0.52465934", "0.5242513", "0.5241757", "0.5238078", "0.5235597", "0.52344954", "0.52336824", "0.52231693", "0.5222046", "0.5210125", "0.5208184", "0.5202721", "0.5196085", "0.51958615", "0.518982", "0.51893", "0.518498", "0.5173699", "0.5172986", "0.5161757", "0.5161757", "0.51533496", "0.5145438", "0.51436067", "0.5131942", "0.51281625", "0.5119144", "0.5117673", "0.5115997", "0.5113886", "0.5113886", "0.5112227", "0.5111997", "0.5111997", "0.51063025", "0.5103109", "0.5102852", "0.5102852", "0.5098775", "0.5097903", "0.5094735", "0.50929296", "0.5085301", "0.5081161", "0.5076797", "0.50594336", "0.50594336", "0.505911", "0.5054425", "0.50477546", "0.50398064", "0.503684", "0.5033243" ]
0.0
-1
WZQFrame ui = new WZQFrame();
public void WZQFrame() { JFrame jf = new javax.swing.JFrame(); jf.setTitle("五子棋"); jf.setDefaultCloseOperation(3); jf.setSize(1246, 1080); jf.setLocationRelativeTo(null); jf.setResizable(false); jf.setLayout(new FlowLayout()); this.setLayout(new FlowLayout()); this.setPreferredSize(new Dimension(1030, 1080)); // this.setBackground(Color.CYAN); // 把面板对象添加到窗体上 jf.add(this); JPanel jp1 = new JPanel(); jp1.setPreferredSize(new Dimension(200, 1080)); jp1.setLayout(new FlowLayout()); jf.add(jp1); LoginListener ll = new LoginListener(); String[] str = { "悔棋", "重新开始" }; for (int i = 0; i < str.length; i++) { JButton jbu1 = new JButton(str[i]); jbu1.setPreferredSize(new Dimension(150, 80)); jbu1.setFont(new Font("楷体", Font.BOLD,20));//设置字体 jp1.add(jbu1); jbu1.addActionListener(ll); } jf.setVisible(true); Graphics g = this.getGraphics(); this.addMouseListener(ll); ll.setG(g); ll.setU(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Hwk2JFrame() {\n initComponents();\n }", "public Mainframe() {\n initComponents();\n }", "private FrameUIController(){\r\n\t\t\r\n\t}", "public QLHocSinhJFrame() {\n initComponents();\n }", "public mainframe() {\n initComponents();\n }", "public FrameDesign() {\n initComponents();\n }", "public interface Frame\r\n{\r\n\t/**\r\n\t * all frames should set their desired size...\r\n\t * \r\n\t * use getframeWidth() and getframeHeight() \r\n\t * which should be inherited from UI_setup abstract class\r\n\t */\r\n\tpublic void setFrameSize();\r\n\t\r\n\t/**\r\n\t * Classes must initiate the construction of a display\r\n\t */\r\n\tpublic void buildFrame();\r\n\t\r\n\t/**\r\n\t * allows us to get the jpanel within the panel object\r\n\t * @return jpanel the actual panel to be added to the window\r\n\t */\r\n\tpublic JFrame getFrame();\r\n}", "FRAME createFRAME();", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "Frame createFrame();", "public mainUI() {\n initComponents();\n }", "public DashboardFrame() {\n WebLookAndFeel.install ();\n Controller = new Controller();\n initComponents();\n }", "public MainFrame() {\n initComponents();\n\n\n }", "public void go(QA qa){\n\t\tpanel = new MyPanel (qa);\r\n\t\tframe = new JFrame (\"Random:Q&A\");\r\n\t\tJMenuBar menubar = new JMenuBar ();\r\n\t\tJMenu fileMenu = new JMenu (\"file\");\r\n\t\tJMenuItem loadQ = new JMenuItem (\"Load Q\");\r\n\t\tJMenuItem loadA = new JMenuItem (\"Load A\");\r\n\t\tloadQ.addActionListener(new LoadQActionListener());\r\n\t\tloadA.addActionListener(new loadAActionListener());\r\n\t\tfileMenu.add(loadQ);\r\n\t\tfileMenu.add(loadA);\r\n\t\tmenubar.add(fileMenu);\r\n//\t\tframe.setLayout(null);\r\n//\t\tpanel.setSize(1200,500);\r\n\t\tframe.add(panel);\r\n//\t\tpanel.repaint();\r\n\t\tframe.setJMenuBar(menubar);\r\n\t\tframe.setSize(1200,400);\r\n\t\tframe.setLocation(400, 400);\r\n\t\tframe.setVisible(true);\r\n\t\t\r\n\t}", "public static void run(){\n EventQueue.invokeLater(new Runnable() {\n public void run() {\n try {\n PlanHomeCoach frame = new PlanHomeCoach();\n frame.init();\n Dimension screenSize =Toolkit.getDefaultToolkit().getScreenSize();\n frame.setLocation(screenSize.width/2-400/2,screenSize.height/2-700/2);\n frame.setResizable(false);\n frame.setVisible(true);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n });\n }", "private static void createAndShowUI(){\n JFrame frame = new JFrame(\"TargetTest\");\n TargetTest test = new TargetTest();\n frame.setLayout(new FlowLayout());\n frame.getContentPane().add(test.getMainPanel());\n //frame.getContentPane().add(test.getControlsPanel());\n\n frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\n frame.pack();\n\n frame.setLocationRelativeTo(null);\n\n frame.setVisible(true);\n}", "@Override\n protected JXFrame createXFrame() {\n return new JXDemoFrame();\n }", "protected HFrame(){\n\t\tinit();\n\t}", "public MainFrame() {\n initComponents();\n \n }", "public FrameControl() {\n initComponents();\n }", "public Frame() {\n initComponents();\n }", "public Frame() {\n initComponents();\n }", "public QuanLyKhoanThuJFrame() {\n initComponents();\n }", "private void $$$setupUI$$$() {\n\t\tpanel_overview = new JPanel();\n\t\tpanel_overview.setLayout(new BorderLayout(0, 0));\n\t\twebView = new WebbrowserPanel();\n\t\tpanel_overview.add(webView, BorderLayout.CENTER);\n\t}", "public QATrackerView(){\n initComponents();\n addPanel();\n }", "public xinxiNewJFrame() {\n initComponents();\n }", "public GuiMainFrame() {\n this(new ArrayBlockingQueue<String>(100), new OBORunnerConfiguration());\n }", "public internalFrame() {\r\n initComponents();\r\n }", "public DisplayStaffMemberFrame() {\n initComponents();\n }", "public static void main(String[] args) {\r\n UserInterface ui;\r\n try {\r\n ui = new UserInterface();\r\n \r\n ui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n ui.pack(); \r\n ui.setVisible(true); \r\n } catch(InterruptedException ex) {\r\n \r\n }\r\n\r\n }", "public UI() {\n initComponents();\n }", "public userinterface() {\n initComponents();\n }", "void initUI();", "private static void createAndShowGUI() {\n JFrame frame = new JFrame(\"FEEx v. \"+VERSION);\n frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n \n //Create and set up the content pane.\n Main p = new Main();\n p.addComponentToPane(frame.getContentPane());\n\n frame.addWindowListener(new java.awt.event.WindowAdapter() {\n @Override\n public void windowClosing(java.awt.event.WindowEvent windowEvent) {\n \tstopPolling();\n \tstopMPP();\n p.port.close();\n Utils.storeSizeAndPosition(frame);\n }\n });\n \n //Display the window.\n frame.pack();\n Utils.restoreSizeAndPosition(frame);\n frame.setVisible(true);\n }", "public AddPowerUnitFrame() {\n initComponents();\n setLocationRelativeTo(null);\n }", "private void initUI() {\n }", "public MainFrame5(){\r\n inint();\r\n }", "public NewJFrame1() {\n initComponents();\n\n dip();\n sh();\n }", "public MainFrame() {\n initComponents();\n setLocationRelativeTo(null);\n }", "public MenuFrame() {\n initComponents();\n }", "private static void initAndShowGUI() {\n }", "public ShopHoursFrame() {\n initComponents();\n }", "private NKE_BrowserWindow() {}", "public void buildFrame();", "public A4Q9() {\n initComponents();\n }", "private Frame3() {\n\t}", "public ClientFrame() {\n initComponents();\n }", "public ClientFrame() {\n initComponents();\n }", "public static void main(String[] args) {\n \n javax.swing.SwingUtilities.invokeLater(new Runnable() {\n \npublic void run() {\n \n createAndShowGUI(); \n \n}\n \n });\n }", "private GUIMain() {\n\t}", "protected void setupUI() {\n\n }", "public JFrame() {\n initComponents();\n }", "public static void createMainframe()\n\t{\n\t\t//Creates the frame\n\t\tJFrame foodFrame = new JFrame(\"USDA Food Database\");\n\t\t//Sets up the frame\n\t\tfoodFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tfoodFrame.setSize(1000,750);\n\t\tfoodFrame.setResizable(false);\n\t\tfoodFrame.setIconImage(icon.getImage());\n\t\t\n\t\tGui gui = new Gui();\n\t\t\n\t\tgui.setOpaque(true);\n\t\tfoodFrame.setContentPane(gui);\n\t\t\n\t\tfoodFrame.setVisible(true);\n\t}", "public History_GUI(){\n super();\n InitializeComponents();\n ConfigureWin();\n\n }", "public FrameManageTests() {\n initComponents();\n }", "public MainWindow() {\n\t\t\tthis.initUI();\n\t\t\t\n\t\t}", "public SearchFrame(){//The main search frame which calls other methods\n\t\t/*Calling the methods intitialiseGUI and buildGUI*/\n\t\tintitialiseGUI();\n\t\tbuildGUI();\n\t}", "public Frame1() {\n initComponents();\n }", "public uitax() {\n initComponents();\n }", "public MainFrameController() {\n }", "public JGSFrame() {\n\tsuper();\n\tinitialize();\n }", "public NuevoProductoJInternalFrame() {\n initComponents();\n }", "public SystemFrame() {\n initComponents();\n }", "public frame_utama() {\n initComponents();\n }", "public static void main(String[] args) {\r\n\t\tEventQueue.invokeLater(new Runnable() {\r\n\t\t\tpublic void run() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tGui_lz77 window = new Gui_lz77();\r\n\t\t\t\t\twindow.frame.setVisible(true);\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tResourceTestFrame frame=new ResourceTestFrame();\n\t\t\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\t\t\tframe.setVisible(true);\n\t\t\t}", "public NewJFrame17() {\n initComponents();\n }", "public CFJInternalFrame( ) {\n initComponents();\n \n refresh();\n }", "public BaciWindow() {\r\n}", "public MainWindow() {\n initComponents();\n }", "public MainWindow() {\n initComponents();\n }", "public GUI() {\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n this.setContentPane(new ZombiePanel());\n pack();\n }", "public JFrameMain() {\n initComponents();\n }", "public Jframe() {\n initComponents();\n setIndice();\n loadTextBoxs();\n }", "private GUI()\n {\n makeGUI();\n }", "public FrameIntroGUI() {\n\t\ttry {\n\t\t\tjbInit();\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public AuthFrame() {\n initComponents();\n }", "public NewFrame() {\n initComponents();\n }", "public void createframe(String cid) {\n\t\tviewframe = new JFrame();\n\t\tviewconsumer(cid);\n\t\tviewframe.setTitle(\"Search result\");\n\t\tviewframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);\n\t\tviewframe.setLayout(new BorderLayout()); \n\t\tviewframe.add(viewpage);\n\t\tviewframe.setVisible(true); \n\t\tviewframe.setSize(500, 400);\n\t\tviewframe.setResizable(true);\n\t}", "public GUI() {\n }", "private static void createAndShowGUI() {\n\n frame = new JFrame(messages.getString(\"towers.of.hanoi\"));\n frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);\n addComponentsToPane(frame.getContentPane());\n frame.pack();\n frame.setSize(800, 600);\n frame.setVisible(true);\n }", "private JInternalFrame createInternalFrame() {\n\n initializeChartPanel();\n\n chartPanel.setPreferredSize(new Dimension(200, 100));\n final JInternalFrame frame = new JInternalFrame(\"Frame 1\", true);\n frame.getContentPane().add(chartPanel);\n frame.setClosable(true);\n frame.setIconifiable(true);\n frame.setMaximizable(true);\n frame.setResizable(true);\n return frame;\n\n }", "public jPQuanLy() {\n initComponents();\n this.loadContent(\"\");\n this.loadClass();\n this.hienThiSiSo(\"\");\n }", "private void favouriteChampion() {\r\n JFrame recordWindow = new JFrame(\"Favourite a champion\");\r\n// recordWindow.setLocationRelativeTo(null);\r\n// recordWindow.getContentPane().setLayout(new BoxLayout(recordWindow.getContentPane(), BoxLayout.Y_AXIS));\r\n initiateFavouriteChampionFields(recordWindow);\r\n new Frame(recordWindow);\r\n// recordWindow.pack();\r\n// recordWindow.setVisible(true);\r\n }", "public GUI() {\n initComponents();\n }", "public MembershipFrame() {\n initComponents();\n }", "public UserInterfaceJFrame() {\n initComponents();\n jPanel1.add(new FeatureViewPanel());\n jPanel2.add(new DataVisualizationPanel());\n jPanel3.add(new DataParserPanel());\n }", "public FrameForm() {\n initComponents();\n }", "public addStFrame() {\n initComponents();\n }" ]
[ "0.66910684", "0.6632719", "0.66072613", "0.65321153", "0.65102524", "0.6476015", "0.64381987", "0.64344275", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.64135855", "0.6394177", "0.6391732", "0.63741475", "0.637102", "0.6358174", "0.6355149", "0.6353663", "0.63444257", "0.6292153", "0.6284491", "0.6284166", "0.62784374", "0.62784374", "0.6255333", "0.62446576", "0.624047", "0.6235765", "0.62329984", "0.6226238", "0.6225123", "0.6197354", "0.6195461", "0.6191972", "0.61907816", "0.61905336", "0.6189673", "0.6167203", "0.6165618", "0.61591375", "0.615418", "0.6151772", "0.61453885", "0.61453426", "0.6141828", "0.6141732", "0.6133295", "0.61281973", "0.6118543", "0.6118543", "0.60994494", "0.6094398", "0.6089907", "0.6085569", "0.6082111", "0.608077", "0.607864", "0.60686654", "0.60683066", "0.60581666", "0.6055726", "0.60527605", "0.60507584", "0.604979", "0.60481834", "0.6037839", "0.60366803", "0.6035218", "0.6030169", "0.60285175", "0.60214186", "0.601366", "0.601366", "0.60096717", "0.6006181", "0.59924996", "0.59826255", "0.5981854", "0.5980662", "0.59793705", "0.59791905", "0.59787786", "0.5975059", "0.59679794", "0.596646", "0.5966044", "0.5962795", "0.5961031", "0.5958906", "0.59571123", "0.59537107" ]
0.657135
3
do not run scheduler if is set to inactive
@Scheduled(cron = "0 0 */1 * * ?") public void schedule() { if (!active) { return; } // do not process if there is no update if (updateService.count() == 0) { return; } LOGGER.info("Updating indices"); // import all indices list try { List<String> indices = getAllIndices(); for (String index : indices) { StockIndex indexEntity = getIndex(index); try { processIndexCompanies(indexEntity); } catch (IOException ex) { LOGGER.error("EXCEPTION.DOWNLOAD.CMPS." + index, ex); } } } catch (IOException e) { LOGGER.error("EXCEPTION.DOWNLOAD.IDXS", e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void disabledPeriodic() {\n\tScheduler.getInstance().run();\n }", "public abstract boolean isScheduled();", "public boolean isScheduled();", "@Override\n\tpublic boolean isScheduled();", "@Override\n public void onDisable()\n {\n if (this.schedulerManager.getScheduler() != null)\n {\n try\n {\n this.schedulerManager.getScheduler().shutdown();\n } catch (SchedulerException e)\n {\n e.printStackTrace();\n }\n }\n }", "@Override\n\tpublic boolean isScheduled() {\n\t\treturn model.isScheduled();\n\t}", "public final boolean unblockAndStartScheduler() {\n\n\t\tunblockStartAndStopOperations();\n\t\treturn startScheduler();\n\n\t}", "public synchronized void stopScheduler() {\r\n\t\tstatus = false;\r\n\t\tstart = null;\r\n\t\tif (t != null) {\r\n\t\t\tt.cancel();\r\n\t\t\tt.purge();\r\n\t\t\tt = null;\r\n\t\t}\r\n\t\tstartDate = null;\r\n\t\tsuper.interrupt();\r\n\t}", "public boolean isEnabled()\n {\n return schedulerService.isEnabled();\n }", "boolean hasScheduling();", "boolean hasScheduling();", "public void disabledPeriodic() {\n if (m_dpFirstRun) {\n System.out.println(\"Default disabledPeriodic() method... Override me!\");\n m_dpFirstRun = false;\n }\n }", "public boolean isScheduled(){\n //System.out.println(\"nextrun: \" + nextrun.getTime() + \" nu: \" + System.currentTimeMillis());\n if (nextrun != null){\n long next = nextrun.getTime();\n \n return next < System.currentTimeMillis();\n }else{\n //null => instance has never run before & should run asap\n return true;\n }\n }", "@Override\n public void onDisable() {\n super.onDisable();\n running = false;\n }", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\t\n\t}", "@Override\n\tpublic boolean isSleeping() {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean isJobRunning() {\n\t\treturn false;\n\t}", "@Override\n public void disabledInit() {\n\t// new SetElevator(0).start();\n\tif (autonomousCommand != null)\n\t autonomousCommand.cancel();\n\tScheduler.getInstance().removeAll();\n }", "public boolean generateSchedule(){\r\n return true;\r\n }", "public void setActiveTask(boolean active)\r\n\t{\r\n\t\tif (active)\r\n\t\t{\r\n\t\t\tif (this.getPeriod() != null)\r\n\t\t\t{\r\n\t\t\t\t// Support without at load\r\n\t\t\t\tMassivePlugin plugin = this.getPlugin();\r\n\t\t\t\tif (plugin.isEnabled())\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this.isSync())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.task = Bukkit.getScheduler().runTaskTimer(this.getPlugin(), this, this.getDelay(), this.getPeriod());\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.getPlugin(), this, this.getDelay(), this.getPeriod());\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif (this.task != null)\r\n\t\t\t{\r\n\t\t\t\tthis.task.cancel();\r\n\t\t\t\tthis.task = null;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void autonomousPeriodic() \n {\n Scheduler.getInstance().run();\n }", "protected void noActiveActivity() {\n\t\tLog.i(STARTUP, \"no active activity\");\n\t\tcancelNotification();\n\t\tcreateNotification();\n\t\tstartMainService();\t\t\n\t}", "@Override\r\n\tpublic IScheduler getForcedScheduler() {\n\t\treturn null;\r\n\t}", "@Override\n public void autonomousPeriodic() {\n \n Scheduler.getInstance().run();\n \n }", "private void srtScheduler(){\n\tif((GlobalVariables.processes.size() != 0) && (GlobalVariables.processes.get(0).getArrivalTime() == GlobalVariables.time) && GlobalVariables.processes.get(0).getRemainingTime() > 0){\n\t //add process pages to page table and disk\n\t Process p = GlobalVariables.processes.get(0);\n\t GlobalVariables.mm.addPagesToTableAndDisk(p);\n\t GlobalVariables.processes.remove(0);\n\t makeReadyFromNew(p);\n\t if (GlobalVariables.runningProcess != null){\n\t\treadyQueue.offer(GlobalVariables.runningProcess);\n\t\tGlobalVariables.runningProcess.setStatus(GlobalVariables.READY_STATUS);\n\t\tGlobalVariables.runningProcess = null;\n\t }\n\t}\n\n\t//handling blocked processes that are ready to be unblocked\n\tif (!blockedQueue.isEmpty()){\n\t Process head = blockedQueue.peek();\n\t int headPID = head.getId();\n\t int id = headPID;\n\t do {\n\t\tProcess curProcess = blockedQueue.poll();\n\t\tcurProcess.decrementBlockedTime();\n\t\tif (curProcess.getBlockedTime() == 0){\n\t\t readyQueue.offer(curProcess);\n\t\t curProcess.setStatus(GlobalVariables.READY_STATUS);\n\t\t GlobalVariables.write(\"\\tUNBLOCKING: Blocked Process \" + curProcess.getId());\n\t\t} else{\n\t\t blockedQueue.offer(curProcess);\n\t\t}\n\t\tProcess nextProcess = blockedQueue.peek();\n\t\tif (nextProcess != null){\n\t\t id = nextProcess.getId();\n\t\t} \n\t } while (id != headPID && !blockedQueue.isEmpty());\n\t}\n\n\t//handling blocked suspended processes that are ready to be unblocked\n\tif (!blockedSuspendedQueue.isEmpty()){\n\t Process head = blockedSuspendedQueue.peek();\n\t int headPID = head.getId();\n\t int id = headPID;\n\t do {\n\t\tProcess curProcess = blockedSuspendedQueue.poll();\n\t\tcurProcess.decrementBlockedTime();\n\t\tif (curProcess.getBlockedTime() == 0){\n\t\t readySuspendedQueue.offer(curProcess);\n\t\t curProcess.setStatus(GlobalVariables.READY_SUSPENDED_STATUS);\n\t\t GlobalVariables.write(\"\\tUNBLOCKING: Blocked/Suspended Process \" + curProcess.getId());\n\t\t} else{\n\t\t blockedSuspendedQueue.offer(curProcess);\n\t\t}\n\t\tProcess nextProcess = blockedSuspendedQueue.peek();\n\t\tif (nextProcess != null){\n\t\t id = nextProcess.getId();\n\t\t} \n\t } while (id != headPID && !blockedSuspendedQueue.isEmpty());\n\t}\n\n\n\t\n\tif (GlobalVariables.runningProcess == null && !readyQueue.isEmpty()){\n\t GlobalVariables.runningProcess = readyQueue.poll();\n\t GlobalVariables.runningProcess.setStatus(GlobalVariables.RUNNING_STATUS);\n\t}\n\t// if there is a process running, run process one unit\n\t// we are letting a started process run on the same unit as it is being chosen\n\t// this assumes a low overhead as we talked about in class\n\tif (GlobalVariables.runningProcess != null){\n\t char c = GlobalVariables.runningProcess.runOneUnit();\n\n\t switch (c) {\n\t case '*':\n\t\tGlobalVariables.write(\"\\t\" + GlobalVariables.runningProcess.getId() + \":\\t\" + c);\n\t\tblockRunningProcess();\n\t\tbreak;\n\t case '!':\n\t\tGlobalVariables.write(\"\\t\" + GlobalVariables.runningProcess.getId() + \":\\t\" + c);\n\t\texitRunningProcess();\n\t\tbreak;\n\t default:\n\t GlobalVariables.write(\"\\t\" + GlobalVariables.runningProcess.getId() + \":\\t\" + c);\n\t }\n\t}\n }", "@Override\n public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "@Override\n public void autonomousPeriodic()\n {\n Scheduler.getInstance().run();\n }", "public boolean isRunning();", "public boolean isRunning();", "public boolean isRunning();", "public boolean isRunning();", "public boolean isRunning();", "public boolean isRunning();", "public void autonomousPeriodic() {\r\n Scheduler.getInstance().run();\r\n }", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n public void run() {\n\n\n\n System.out.println(\"run scheduled jobs.\");\n\n\n checkBlackOutPeriod();\n\n\n\n checkOfficeActionPeriod1();\n\n checkAcceptedFilings();\n\n checkNOAPeriod();\n checkFilingExtensions();\n\n\n\n }", "public void testPeriodic() {\n Scheduler.getInstance().run();\n }", "public boolean isSuspended();", "public static void enablePeriodicalRun(Context context) {\n\t}", "public void autonomousPeriodic()\n\t{\n\t\tScheduler.getInstance().run();\n\t}", "public void standby() throws SchedulerException {\n this.quartzPlugin.getScheduler().standby();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "private static ScriptedNonThreadScheduler test(GreenApp app, GreenRuntime runtime) {\n runtime.builder = new BuilderImpl(runtime.gm,runtime.args);\n\n //lowered for tests, we want tests to run faster, tests probably run on bigger systems.\n runtime.builder.setDefaultRate(10_000);\n \n \tapp.declareConfiguration(runtime.builder);\n GraphManager.addDefaultNota(runtime.gm, GraphManager.SCHEDULE_RATE, runtime.builder.getDefaultSleepRateNS());\n\n runtime.declareBehavior(app);\n\n\t\truntime.builder.buildStages(runtime);\n\n\t runtime.logStageScheduleRates();\n\n\t if ( runtime.builder.isTelemetryEnabled()) {\n\t\t runtime.gm.enableTelemetry(defaultTelemetryPort);\n\t }\n\n\t //exportGraphDotFile();\n\t boolean reverseOrder = false;\n\t\truntime.scheduler = new ScriptedNonThreadScheduler(runtime.gm, reverseOrder);\n\t\t\n\t\t/////////////\n\t\t//new work investigating the skipping of calls\n\t\t/////////////\n\t\t\n\t\tScriptedNonThreadScheduler s = (ScriptedNonThreadScheduler)runtime.scheduler;\n\t\tScriptedSchedule schedule = s.schedule();\n\t\t\n//\t\t//[0, 1, 2, 3, 5, 6, 7, -1, 0, 1, 2, 4, 5, 6, 7, -1]\n//\t\tSystem.err.println(\"testing list\");\n//\t\tSystem.err.println(Arrays.toString(schedule.script));\n//\t\t\n//\t\tfor(int i = 0; i<s.stages.length; i++) {\n//\t\t\tSystem.err.println(i+\" \"+s.stages[i].getClass());\n//\t\t\t\n//\t\t}\n\t\t\n\t\t\n\t\t//skip script is same length as the script\n\t\tGraphManager gm = runtime.gm;\n\t\t\n\t\t//TODO: must store the run count to the next skip point\n\t\t// skip points are Producers or merge pipe points.\n\t\t// all others are zero, to take point\n\t\t//high bit will be used to enable and 0 high for disable\n\t\tint[] skipScript = ScriptedNonThreadScheduler.buildSkipScript(schedule, gm, s.stages, schedule.script);\n\t\t\n//\t\tSystem.err.println(Arrays.toString(skipScript));\n\t\t\n\t\t//if enabled\n\t\t//if value is > 1\n\t\t//if input pipes are empty\n\t\t// jump n\n\t\t//else\n\t\t// count down value for each set of empty pipes\n\t\t// if we have zero at next >1 point enable else disable\n\t\t\n//\t\t\n//\t\tfor(int i = 0;i<schedule.script.length;i++) {\n//\t\t\tif (schedule.script[i] == -1) {\n//\t\t\t\tSystem.err.println(\"END\");\n//\t\t\t} else {\n//\t\t\t\tSystem.err.println(s.stages[schedule.script[i]].getClass());\n//\t\t\n//\t\t\t\tint inC = GraphManager.getInputPipeCount(runtime.gm, s.stages[schedule.script[i]].stageId);\n//\t\t\t\tSystem.err.print(\" input: \");\n//\t\t\t\tfor(int j = 1; j<=inC; j++) {\n//\t\t\t\t\tPipe p = GraphManager.getInputPipe(runtime.gm, s.stages[schedule.script[i]].stageId, j);\n//\t\t\t\t\tSystem.err.print(\" \"+p.id);\t\t\t\t\t\n//\t\t\t\t}\n//\t\t\t\tSystem.err.println();\n//\t\t\t\t\n//\t\t\t\tSystem.err.print(\" output: \");\n//\t\t\t\tint outC = GraphManager.getOutputPipeCount(runtime.gm, s.stages[schedule.script[i]].stageId);\n//\t\t\t\tfor(int j = 1; j<=outC; j++) {\n//\t\t\t\t\tPipe p = GraphManager.getOutputPipe(runtime.gm, s.stages[schedule.script[i]].stageId, j);\n//\t\t\t\t\tSystem.err.print(\" \"+p.id);\t\t\t\t\t\n//\t\t\t\t}\n//\t\t\t\tSystem.err.println();\n//\t\t\t}\t\t\n//\t\t}\n\t\t\n\t\t\n\t\t////////////////\n\t\t////////////////\n\t\t/////////////\n\t\t\n\t\t\n\t\t\n\t\treturn (ScriptedNonThreadScheduler) runtime.scheduler;\n\t}", "@Override\n public void teleopPeriodic()\n {\n Scheduler.getInstance().run();\n }", "public boolean iAmRunning();", "@Override\n public void periodic() {\n // This method will be called once per scheduler run\n }", "public void autonomousPeriodic() {\r\n\t\tScheduler.getInstance().run();\r\n\t}", "protected abstract void scheduler_init();", "@Override\n public void reportScheduler() {\n }", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "private void beginSchedule(){\n\t\tDivaApp.getInstance().submitScheduledTask(new RandomUpdater(this), RandomUpdater.DELAY, RandomUpdater.PERIOD);\n\t}", "public void setToReschedule(boolean b) {\n this.toReschedule = b;\n }", "@Override\n public boolean active() {\n return false;\n }", "public void teleopPeriodic()\n\t{\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n public void teleopPeriodic() {\n Scheduler.getInstance().run();\n \n }", "public void teleopPeriodic() {\r\n\t\tScheduler.getInstance().run();\r\n\t}", "private void cancelSchedule() {\n\n if (timer == null)\n return;\n // timer.cancel();\n }", "@Override\n public boolean isRunning() {\n return isRunning;\n }", "@Override\n public boolean isRunning() {\n return isRunning;\n }", "private void schedule() {\n service.scheduleDelayed(task, schedulingInterval);\n isScheduled = true;\n }", "public boolean hasScheduling() {\n return scheduling_ != null;\n }", "@Override\n public void autonomousPeriodic() {\n \tbeginPeriodic();\n Scheduler.getInstance().run();\n endPeriodic();\n }", "public abstract void unschedule();", "public void teleopPeriodic() {\n if (m_tpFirstRun) {\n System.out.println(\"Default teleopPeriodic() method... Override me!\");\n m_tpFirstRun = false;\n }\n }", "boolean isRunning();", "boolean isRunning();", "boolean isRunning();", "boolean isRunning();", "boolean isRunning();", "@Override\n public boolean isRunning() {\n return !paused;\n }", "@Override\n public void teleopPeriodic() {\n \tbeginPeriodic();\n Scheduler.getInstance().run();\n endPeriodic();\n }", "abstract boolean shouldTaskActivate();", "boolean disableMonitoring();", "public void startScheduling() {\n new Thread(new Runnable() {\n public void run() {\n while(true) {\n try {\n Thread.sleep(30000);\n Calendar c = Calendar.getInstance();\n int min = c.get(Calendar.MINUTE);\n if (((min % 10) == 0) || (min == 0)) {\n boolean action = getLightOnWhenMovementDetectedSchedule().getCurrentSchedule();\n if (action) {\n configureSwitchOnWhenMovement(true);\n } else {\n configureSwitchOnWhenMovement(false);\n }\n action = getLightSchedule().getCurrentSchedule();\n if (action) {\n switchOn();\n } else {\n switchOff();\n }\n saveHistoryData();\n }\n Thread.sleep(30000);\n } catch (InterruptedException e) {\n return;\n } catch (RemoteHomeConnectionException e) {\n e.printStackTrace();\n } catch (RemoteHomeManagerException e) {\n e.printStackTrace();\n }\n }\n }\n }).start(); \n }", "public void stop(){\n executor.shutdown();\n active = false;\n \n tSec.setEditable(true);\n tMin.setEditable(true);\n tHours.setEditable(true);\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "void unsetSchedule();", "boolean isSetSchedule();", "private void scheduleOrExecuteJob() {\n try {\n for (TaskScheduler entry : this.schedulers.values()) {\n StandardTaskScheduler scheduler = (StandardTaskScheduler) entry;\n // Maybe other thread close&remove scheduler at the same time\n synchronized (scheduler) {\n this.scheduleOrExecuteJobForGraph(scheduler);\n }\n }\n } catch (Throwable e) {\n LOG.error(\"Exception occurred when schedule job\", e);\n }\n }", "@Override\n public void autonomousPeriodic() {\n teleopPeriodic();\n //Scheduler.getInstance().run();\n }", "public abstract void maintenanceSchedule() ;", "public void disable(){\n if(criticalStop) return;\n getModel().setStatus(false);\n }", "private void runPeriodic() {\n boolean ok = ScheduledFutureTask.super.runAndReset();\n boolean down = isShutdown();\n // Reschedule if not cancelled and not shutdown or policy allows\n if (ok && !down) {\n updateNextExecutionTime();\n MeasurableScheduler.super.getQueue().add(this);\n }\n // This might have been the final executed delayed\n // task. Wake up threads to check.\n else if (down)\n interruptIdleWorkers();\n }", "@Override\n public void autonomousPeriodic() {\n\t// updateDiagnostics();9\n\tScheduler.getInstance().run();\n }", "private void rrScheduler(){\n\tif((GlobalVariables.processes.size() != 0) && (GlobalVariables.processes.get(0).getArrivalTime() == GlobalVariables.time) && GlobalVariables.processes.get(0).getRemainingTime() > 0){\n\t //add process pages to page table and disk\n\t Process p = GlobalVariables.processes.get(0);\n\t GlobalVariables.mm.addPagesToTableAndDisk(p);\n\t GlobalVariables.processes.remove(0);\n\t makeReadyFromNew(p);\n\t GlobalVariables.write(p.getPagesString());\n\t}\n\n\t//handling blocked processes that are ready to be unblocked\n\tif (!blockedQueue.isEmpty()){\n\t Process head = blockedQueue.peek();\n\t int headPID = head.getId();\n\t int id = headPID;\n\t do {\n\t\tProcess curProcess = blockedQueue.poll();\n\t\tcurProcess.decrementBlockedTime();\n\t\tif (curProcess.getBlockedTime() == 0){\n\t\t readyQueue.offer(curProcess);\n\t\t curProcess.setStatus(GlobalVariables.READY_STATUS);\n\t\t GlobalVariables.write(\"\\tUNBLOCKING: Blocked Process \" + curProcess.getId());\n\t\t} else{\n\t\t blockedQueue.offer(curProcess);\n\t\t}\n\t\tProcess nextProcess = blockedQueue.peek();\n\t\tif (nextProcess != null){\n\t\t id = nextProcess.getId();\n\t\t} \n\t } while (id != headPID && !blockedQueue.isEmpty());\n\t}\n\n\t//handling blocked suspended processes that are ready to be unblocked\n\tif (!blockedSuspendedQueue.isEmpty()){\n\t Process head = blockedSuspendedQueue.peek();\n\t int headPID = head.getId();\n\t int id = headPID;\n\t do {\n\t\tProcess curProcess = blockedSuspendedQueue.poll();\n\t\tcurProcess.decrementBlockedTime();\n\t\tif (curProcess.getBlockedTime() == 0){\n\t\t readySuspendedQueue.offer(curProcess);\n\t\t curProcess.setStatus(GlobalVariables.READY_SUSPENDED_STATUS);\n\t\t GlobalVariables.write(\"\\tUNBLOCKING: Blocked/Suspended Process \" + curProcess.getId());\n\t\t} else{\n\t\t blockedSuspendedQueue.offer(curProcess);\n\t\t}\n\t\tProcess nextProcess = blockedSuspendedQueue.peek();\n\t\tif (nextProcess != null){\n\t\t id = nextProcess.getId();\n\t\t} \n\t } while (id != headPID && !blockedSuspendedQueue.isEmpty());\n\t}\n\t\n\tif (GlobalVariables.runningProcess == null && !readyQueue.isEmpty()){\n\t GlobalVariables.runningProcess = readyQueue.poll();\n\t GlobalVariables.write(\"\\tSTARTING: Process \" + GlobalVariables.runningProcess.getId());\n\t}\n\t// if there is a process running, run process one unit\n\t// we are letting a started process run on the same unit as it is being chosen\n\t// this assumes a low overhead as we talked about in class\n\tif (GlobalVariables.runningProcess != null){\n\t char c = GlobalVariables.runningProcess.runOneUnit();\n\n\t switch (c) {\n\t case '*':\n\t\tGlobalVariables.write(\"\\t\" + GlobalVariables.runningProcess.getId() + \":\\t\" + c);\n\t\tblockRunningProcess();\n\t\tquantumCount = 0;\n\t\tbreak;\n\t case '!':\n\t\tGlobalVariables.write(\"\\t\" + GlobalVariables.runningProcess.getId() + \":\\t\" + c);\n\t\texitRunningProcess();\n\t\tquantumCount = 0;\n\t\tbreak;\n\t default:\n\t GlobalVariables.write(\"\\t\" + GlobalVariables.runningProcess.getId() + \":\\t\" + c);\n\t\tquantumCount++;\n\t }\n\n\t if(quantumCount == GlobalVariables.ROUND_ROBIN_QUANTUM) {\n\t\tGlobalVariables.write(\"\\tTIMEOUT: Process \" + GlobalVariables.runningProcess.getId());\n\t\treadyQueue.offer(GlobalVariables.runningProcess);\n\t\tquantumCount = 0;\n\t\tGlobalVariables.runningProcess = null;\n\t }\n\t}\n }", "@Override\n\tpublic boolean isInactive();", "@Override\n public void run() {\n CuratorLocker locker = new CuratorLocker(schedulerBuilder.getServiceSpec());\n\n Runtime.getRuntime().addShutdownHook(new Thread(() -> {\n LOGGER.info(\"Shutdown initiated, releasing curator lock\");\n locker.unlock();\n }));\n locker.lock();\n\n SchedulerConfig schedulerConfig = SchedulerConfig.fromEnv();\n Metrics.configureStatsd(schedulerConfig);\n AbstractScheduler scheduler = schedulerBuilder.build();\n scheduler.start();\n Optional<Scheduler> mesosScheduler = scheduler.getMesosScheduler();\n if (mesosScheduler.isPresent()) {\n SchedulerApiServer apiServer = new SchedulerApiServer(schedulerConfig, scheduler.getResources());\n apiServer.start(new AbstractLifeCycle.AbstractLifeCycleListener() {\n @Override\n public void lifeCycleStarted(LifeCycle event) {\n scheduler.markApiServerStarted();\n }\n });\n\n runScheduler(\n scheduler.frameworkInfo,\n mesosScheduler.get(),\n schedulerBuilder.getServiceSpec(),\n schedulerBuilder.getSchedulerConfig(),\n schedulerBuilder.getStateStore());\n } else {\n /**\n * If no MesosScheduler is provided this scheduler has been deregistered and should report itself healthy\n * and provide an empty COMPLETE deploy plan so it may complete its UNINSTALL.\n *\n * See {@link UninstallScheduler#getMesosScheduler()}.\n */\n Plan emptyDeployPlan = new Plan() {\n @Override\n public List<Phase> getChildren() {\n return Collections.emptyList();\n }\n\n @Override\n public Strategy<Phase> getStrategy() {\n return new SerialStrategy<>();\n }\n\n @Override\n public UUID getId() {\n return UUID.randomUUID();\n }\n\n @Override\n public String getName() {\n return Constants.DEPLOY_PLAN_NAME;\n }\n\n @Override\n public List<String> getErrors() {\n return Collections.emptyList();\n }\n };\n\n PlanManager emptyPlanManager = DefaultPlanManager.createProceeding(emptyDeployPlan);\n PlansResource emptyPlanResource = new PlansResource();\n emptyPlanResource.setPlanManagers(Arrays.asList(emptyPlanManager));\n\n schedulerBuilder.getStateStore().clearAllData();\n\n SchedulerApiServer apiServer = new SchedulerApiServer(\n schedulerConfig,\n Arrays.asList(\n emptyPlanResource,\n new HealthResource()));\n apiServer.start(new AbstractLifeCycle.AbstractLifeCycleListener() {\n @Override\n public void lifeCycleStarted(LifeCycle event) {\n LOGGER.info(\"Started trivially healthy API server.\");\n }\n });\n }\n }", "@Override\n public boolean isRunning() {\n return running;\n }" ]
[ "0.72849905", "0.7168799", "0.71326697", "0.70003617", "0.6801155", "0.6606841", "0.6530901", "0.6447676", "0.64170116", "0.6369569", "0.6369569", "0.6338235", "0.6215497", "0.62059855", "0.6191174", "0.61681354", "0.614065", "0.61251545", "0.6119518", "0.61125875", "0.61119795", "0.61079", "0.60985684", "0.60784096", "0.60776126", "0.607684", "0.60752225", "0.6042504", "0.6042504", "0.6042504", "0.6042504", "0.6042504", "0.6042504", "0.60276914", "0.60196316", "0.60196316", "0.60196316", "0.60196316", "0.6009394", "0.5993028", "0.5986201", "0.5971629", "0.59616834", "0.595996", "0.5948424", "0.5948424", "0.5948424", "0.5948424", "0.5948424", "0.5948424", "0.5936289", "0.59338427", "0.5933511", "0.59289473", "0.59178144", "0.59160626", "0.5911831", "0.5906002", "0.5906002", "0.5906002", "0.58935344", "0.58893657", "0.5866375", "0.58652216", "0.5860832", "0.58552074", "0.5853802", "0.5844448", "0.5844448", "0.5842511", "0.5841911", "0.58255607", "0.58066696", "0.57994187", "0.57869273", "0.57869273", "0.57869273", "0.57869273", "0.57869273", "0.57862693", "0.57801473", "0.5779539", "0.5769581", "0.57681936", "0.5756596", "0.5748228", "0.5748228", "0.5748228", "0.5748228", "0.57319516", "0.5720088", "0.5699581", "0.56923145", "0.56856775", "0.5684052", "0.567866", "0.5677705", "0.56701845", "0.56592906", "0.56510216", "0.56494355" ]
0.0
-1
Prevents the tusks from trying to change all at the same time
public Sleep() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void bankrupt() {\n this.mortgaged = false;\n }", "private void conmuteFields() {\r\n\t\ttxPassword.setEditable(!txPassword.isEditable());\r\n\t\ttxUsuario.setEditable(!txUsuario.isEditable());\r\n\t\tcheckAdmin.setDisable(!checkAdmin.isDisable());\r\n\t\tcheckTPV.setDisable(!checkTPV.isDisable());\r\n\t}", "public void markCannotBeKept() {\n cannotBeKept = true;\n }", "private void enableSet(){\n addSubmit.setDisable(true);\n removeSubmit.setDisable(true);\n setSubmit.setDisable(false);\n addCS.setDisable(true);\n removeCS.setDisable(true);\n setCS.setDisable(false);\n addIT.setDisable(true);\n removeIT.setDisable(true);\n setIT.setDisable(false);\n addECE.setDisable(true);\n removeECE.setDisable(true);\n setECE.setDisable(false);\n partTime.setDisable(true);\n fullTime.setDisable(true);\n management.setDisable(true);\n dateAddText.setDisable(true);\n dateRemoveText.setDisable(true);\n dateSetText.setDisable(false);\n nameAddText.setDisable(true);\n nameRemoveText.setDisable(true);\n nameSetText.setDisable(false);\n hourlyAddText.setDisable(true);\n annualAddText.setDisable(true);\n managerRadio.setDisable(true);\n dHeadRadio.setDisable(true);\n directorRadio.setDisable(true);\n //codeAddText.setDisable(true);\n hoursSetText.setDisable(false);\n }", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "static void setNotAutoCopy(){isAutoCopying=false;}", "public boolean unSetDangerous() {\r\n\t\tif(isDangerous && isCovered) {\r\n\t\t\tisDangerous=false;\r\n\t\t\t\r\n\t\t\tthis.setChanged();\r\n\t\t\tthis.notifyObservers();\r\n\t\t\tthis.clearChanged();\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "private void resetAllTouched() {\n for (NetworkNode n: network.nodes) {\n n.touched = false;\n }\n }", "public void setUsed(){\n\t\talreadyUsed = true;\n\t}", "public void setUsed()\n\t{\n\t\tm_justReset = false;\n\t}", "@Override\n public boolean canUpdate() { return false; }", "public void setAllMissing();", "public void markReused() {\n\t\tupdate(Phase.vm_creation, State.SKIPPED);\n\t\tupdate(Phase.installation, State.SKIPPED);\n\t\tupdate(Phase.configuration, State.SKIPPED);\n\t\tsetState(State.SKIPPED);\n\t}", "void setUnused(){\n assert this.used == true;\n\n //let the parent pointer remain\n this.hf = 0;\n this.used = false;\n\n }", "public void planted(){\r\n\t\tenable = false; \r\n\t\tcount = 0; \r\n\t}", "@Override\n\tpublic void atirou() {\n\n\t\t\tatirou=true;\n\t\t\t\n\t\t\n\t}", "protected void setPlateauBlocked() {\r\n\t\tint idx = 0;\r\n\t\tfor (int i = 0; i < plateau4par4.getPlateau().length; i++) {\r\n\t\t\tfor (int j = 0; j < plateau4par4.getPlateau()[i].length; j++) {\r\n\t\t\t\tplateau4par4.getPlateau()[i][j] = new Case(new CaseContent(++idx));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "static void setNotCopying(){isCopying=false;}", "@Override\n public boolean isFrozen() {\n return true;\n }", "void outOfTime() {\r\n\r\n disableOptionButtons();\r\n }", "public void setAktiivisuus()\r\n\t{\r\n\t\tonAktiivinen = false;\r\n\t}", "void turnOffButtonsNotIn(TransactionType tt1, TransactionType tt2) {\n\t\tfor (TransactionType t : perTransRB.keySet()) {\n\t\t\tif (t == tt1)\n\t\t\t\tcontinue;\n\t\t\tif (t == tt2)\n\t\t\t\tcontinue;\n\t\t\tfor (RbSite rbs : perTransRB.get(t)) {\n\t\t\t\trbs.rb.setValue(false);\n\t\t\t}\n\t\t}\n\t}", "public void changeCanThrowFlag()\r\n\t{\r\n\t\tcanThrowFlag = !canThrowFlag;\r\n\t}", "@Override\r\n public boolean isSafe() {\n return false;\r\n }", "public boolean setDangerous() {\r\n\t\tif(!isDangerous && isCovered) {\r\n\t\t\tisDangerous=true;\r\n\t\t\t\r\n\t\t\tthis.setChanged();\r\n\t\t\tthis.notifyObservers();\r\n\t\t\tthis.clearChanged();\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public void setUsed() {\n used = true;\n }", "@org.junit.Before\n public void turnOffAllAccessDetection() {\n Settings.INSTANCE.set(Settings.SETT_MTD_ACCS, \"false\"); /* Not tested here. */\n Settings.INSTANCE.set(Settings.SETT_FLD_ACCS, \"false\"); /* Not tested here. */\n }", "private void sharplyChange(){\r\n\t\t\tgovernmentLegitimacy -= 0.3;\r\n\t\t}", "public void pleaseStop()\n {\n\t this.doorgaan_thread = false;\n\t this.doorgaan_wheel = true;\n draad = null; // waarom? \n }", "@Override\n public boolean isSoft() {\n return true;\n }", "public void disable() {\n operating = false;\n }", "private void lockButton(){\n\t\tconversionPdf_Txt.setEnabled(false);\n\t\tavisJury.setEnabled(false);\n\t\tstatistique.setEnabled(false);\n\t\tbData.setEnabled(false);\n\t\tbDataTraining.setEnabled(false);\n\t\tbCompare.setEnabled(false);\n\t}", "public void setToGridPermanently(){\n this.isPermanent = true;\n }", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "protected void setSafepoint() {\n\t\tfor (UpdatableWrapper<?> uw : this.wrappedObjects.asMap().values())\n\t\t\tuw.setSafepoint();\n\t}", "public void undock() {\n if (getSpeed() == 0) {\n inDock = false;\n }\n }", "public void setCanBeSafe(boolean on) {\r\n canBeSafe = on;\r\n }", "protected synchronized void startUpdateSuppressTimer(){\n AbstractWidgetProperty pvValueProperty =\n editpart.getWidgetModel().getProperty(controlPVValuePropId);\n pvValueListeners = pvValueProperty.getAllPropertyChangeListeners();\n pvValueProperty.removeAllPropertyChangeListeners();\n updateSuppressTimer.start(timerTask, getUpdateSuppressTime());\n }", "private void unsetOneAllChecks() {\r\n\r\n checkIman.setEnabled(false);\r\n checkBonferroni.setEnabled(false);\r\n checkHolm.setEnabled(false);\r\n checkHochberg.setEnabled(false);\r\n checkHommel.setEnabled(false);\r\n checkHolland.setEnabled(false);\r\n checkRom.setEnabled(false);\r\n checkFinner.setEnabled(false);\r\n checkLi.setEnabled(false);\r\n\r\n }", "public void unKingMe() {\r\n this.type = Type.SINGLE;\r\n }", "@Override\n\tpublic void setUgly(boolean newUgly) {\n\t\t\n\t}", "public void resetTask() {\n if (ShulkerEntity.this.getAttackTarget() == null) {\n ShulkerEntity.this.updateArmorModifier(0);\n }\n\n }", "public void makeTombstone()\r\n\t\t{\r\n\t\t\tisTombstone = true;\r\n\t\t}", "public void lockAdd(){\n\t\tthis.canAdd = false;\n\t}", "public void unsetUseTimings()\n {\n synchronized (monitor())\n {\n check_orphaned();\n get_store().remove_attribute(USETIMINGS$22);\n }\n }", "@Override\n\tpublic void naoAtirou() {\n\t\tatirou=false;\n\n\t}", "public void action() {\r\n\t\tLCD.drawString(\"Avoid Behavior!\", 0, 7);\r\n\r\n\t\tMapUpdate.updateWithoutObject(0);\r\n\t\tMapUpdate.updateWithObject(StandardRobot.us.getRange());\r\n\r\n\t\tif (StandardRobot.ts.isPressed()) {\r\n\t\t\tStandardRobot.pilot.setTravelSpeed(7);\r\n\t\t\tStandardRobot.pilot.travel(-5);\r\n\t\t\tcounter.countTravel();\r\n\r\n\t\t\tif (store.getFlag() == 0) {\r\n\t\t\t\tStandardRobot.pilot.rotate(-90);\r\n\t\t\t\tcounter.countTurn();\r\n\t\t\t} else {\r\n\t\t\t\tStandardRobot.pilot.rotate(90);\r\n\t\t\t\tcounter.countTurn();\r\n\t\t\t}\r\n\t\t} else {\r\n\r\n\t\t\tif (store.getFlag() == 0) {\r\n\t\t\t\tStandardRobot.pilot.rotate(-90);\r\n\t\t\t\tcounter.countTurn();\r\n\t\t\t} else {\r\n\t\t\t\tStandardRobot.pilot.rotate(90);\r\n\t\t\t\tcounter.countTurn();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void setStany(Towar t) {\n\t\t\n\t}", "protected void aktualisieren() {\r\n\r\n\t}", "synchronized void setOneshot( boolean value )\n {\n _cyclicTimer = ! value;\n }", "protected void maybeToReadonlyTransaction() {\n\t\tTransaction.current().toReadonly();\n\t}", "protected void cancelChanges() {\n }", "private void breakSpecialState() {\n this.inSpecialState = false;\n this.resetXMovement();\n }", "public void disconnetti() {\n\t\tconnesso = false;\n\t}", "@Override\n\tpublic boolean takeControl() {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean erTom() {\n\t\treturn (bak == null);\n\t}", "private void ensureChangesAllowed() {\n if (lifecycle.started() == false) {\n throw new IllegalStateException(\"Can't make changes to indices service, node is closed\");\n }\n }", "public void forceReasonerReSynchronization();", "public void disableUpdate() {\n\t\tupdate = false;\n\t}", "private void actionChangedEstimatorSettingsAuto ()\r\n\t{\r\n\t\tmainFormLink.getComponentPanelLeft().getCombobobxEstimatorBacteriaType().setEnabled(false);\r\n\t\tmainFormLink.getComponentPanelLeft().getComboboxEstimatorDrugType().setEnabled(false);\r\n\t}", "@Test\n\tpublic void testUpdateTicketFail() {\t//campos nulos\n\t\t//tp.set_name(\"\");\n\t\t//assertFalse(sa.updatePlatform(tp)); //name empty y campos nulos\n\t\t//tp.set_name(\"PS3PS3PS3PS3PS3PS3PS3PS3PS3PS3PS3PS3PS3PS3PS3PS3\");\n\t\t//assertFalse(sa.updatePlatform(tp)); //nombre >45 chars y campos nulos\n\t\t//tp.set_name(\"STEAM\"); //campos nulos menos nombre\n\t\t//assertFalse(sa.updatePlatform(tp)); //name empty y campos nulos\n\t\t//tp.set_activated(true);\n\t\t//assertFalse(sa.updatePlatform(tp)); //id nulo\n\t\t//Plataforma no existe\n\t\t//tp.set_id(8);\n\t\t//assertFalse(sa.updatePlatform(tp));\n\t}", "private void unsetMultipleChecks() {\r\n\r\n checkNemenyi.setEnabled(false);\r\n checkShaffer.setEnabled(false);\r\n checkBergman.setEnabled(false);\r\n\r\n }", "protected boolean asEaten() {\n return false;\n }", "static void setNotEdit(){isEditing=false;}", "public void setTC(boolean value) {\n this.TC = value;\n }", "@RequiresLock(\"SeaLock\")\r\n protected void invalidate_internal() {\n }", "public void freeze(){\n isFrozen = true;\n }", "public void setToDefualts(){\n\t\tchangeInPlayerHealth = 0;\n\t\tchangeInPlayerScore = 0;\n\t\tchangInBatteryCharge = 0;\n\t\tpuaseForAnimation = false;\n\t}", "@Override\r\n\tboolean isSunk() {\r\n\t\treturn false;\r\n\t}", "public void liftUp(){\n set(m_defaultLiftSpeedUp);\n }", "public void onExemptChanged(AppStateTracker sender) {\n updateAllJobs();\n unblockAllUnrestrictedAlarms();\n }", "public void getEaten() {\n\t\tsuper.flag=true;\n\t}", "public void reset() {\n this.inhibited = false;\n this.forced = false;\n }", "public final void CanNotBeChanged () {\n\t\tSystem.out.println(\"Can not be Changed\");\n\t}", "private void clearBlocked() {\n\n blocked_ = false;\n }", "public void setT(boolean t) {\n\tthis.t = t;\n }", "public void resetAll() {\n triggered = false;\n classBlacklist.clear();\n policies.clear();\n protectedFiles.clear();\n System.setSecurityManager(defaultSecurityManager);\n }", "@Test\n public void invalidTableEgress() throws InterruptedException {\n for (int i = 100; i < 110; ++i) {\n this.sfcOfRendererDataListener.onDataTreeChanged(createSfcOfRendererConfig(100, i));\n Thread.sleep(SLEEP); // otherwise the failure is not detected\n verifySettersNotCalled();\n }\n }", "public void setSafe(boolean safe) {\n\tthis.safe=safe;\n}", "public void genRepCheck(){\r\n if (tx_cb.getValue() == null || paModules.getValue() == null || mainExciterSW.getValue() == null\r\n || filter.getValue() == null || switchPatch.getValue() == null || testLoad.getValue() == null\r\n || mainAntFeed.getValue() == null)\r\n genRep.setDisable(true);\r\n else\r\n genRep.setDisable(false);\r\n }", "public boolean ignore() {\n\t\tif(ignoreT<=0) return false; // if ignoreT is 0, the user gets control again\n\t\telse return true; // otherwise the user doesn't have control\n\t}", "@Override\n\tpublic void BloquerCasesPlateau()\n\t{\n\t\tfor (Component bouton : this.unTableau.getComponents())\n\t\t\tbouton.setEnabled(false);\n\t\t\n\t\tthis.unTableau.updateUI();\n\t\t\n\t}", "private void clearRefuse() {\n \n refuse_ = false;\n }", "private void plannerOutOfSyncWithShoppingList(boolean a){\n settings.setShoppingListOutOfSync(a);\n }", "public void setORM_AntiKorantiKor(orm.AntiKor value) {\r\n\t\tthis.antiKorantiKor = value;\r\n\t}", "protected synchronized void clearChanged() {\n changed = false;\n }", "public void disableConcurrency() {\n concurrent = false;\n }", "@Override\n\tpublic boolean isRented() {\n\t\treturn false;\n\t}", "private void resetDataForAddAfterSchoolAlly() \r\n\t{\n\t\tStaticVariables.showAllyName1InAfterSchool = false;\r\n\t\tStaticVariables.showAllyName2InAfterSchool = false;\r\n\r\n\t\t/*\tStaticVariables.allySetFor1 = null;\r\n\t\tStaticVariables.allySetFor2 = null;*/\r\n\r\n\t}", "private void fixEnabled(){\n setEnabled(graph.getUndoManager().canRedo());\n }", "public void setSneaking ( boolean sneak ) {\n\t\texecute ( handle -> handle.setSneaking ( sneak ) );\n\t}", "@FXML\n void disableHourlyCode() {\n annualAddText.setDisable(false);\n managerRadio.setDisable(true);\n dHeadRadio.setDisable(true);\n directorRadio.setDisable(true);\n hourlyAddText.setDisable(true);\n }", "@FXML\n void disableHourly() {\n annualAddText.setDisable(false);\n managerRadio.setDisable(false);\n dHeadRadio.setDisable(false);\n directorRadio.setDisable(false);\n hourlyAddText.setDisable(true);\n }", "@RequiresLock(\"SeaLock\")\r\n protected void dependentInvalidAction() {\r\n // by default do nothing\r\n }", "public void resetTask() {\n ShulkerEntity.this.updateArmorModifier(0);\n }", "void setNotVeryEffectiveTo(List<Type> notVeryEffectiveTo) {\n this.notVeryEffectiveTo = notVeryEffectiveTo;\n }", "public void changeToxicity(int i) {\n \t\t if (toxicity + i < 1) {\n \t\t\ttoxicity = 0;\n \t\t}else if (toxicity + i < 100) {\n \t\t\ttoxicity += i;\n \t\t} else if (toxicity + i > 99) {\n \t\t\ttoxicity = 100;\n \t\t\talive = false;\n \t\t}\n \t}", "private void tallennaTiedostoon() {\n viitearkisto.tallenna();\n }", "private void notEligibleForRealMin() {\n eligibleForRealMin = false;\n }", "public void setFalse(){\n for (int i = 0; i < Nodes.size(); i++){\n this.MinDistanceStatus.add(false);\n }\n }", "public void setNoDamageTicks ( int ticks ) {\n\t\texecute ( handle -> handle.setNoDamageTicks ( ticks ) );\n\t}" ]
[ "0.6317449", "0.5938854", "0.59194386", "0.5876985", "0.5814631", "0.57791173", "0.57735705", "0.5731755", "0.57308537", "0.57209563", "0.57059985", "0.56648314", "0.56609505", "0.5656713", "0.56511235", "0.5625781", "0.5617923", "0.5617113", "0.5611275", "0.5597181", "0.55888784", "0.55861753", "0.5581126", "0.5578468", "0.5574536", "0.5566434", "0.5561682", "0.55603695", "0.5557845", "0.55574596", "0.5551551", "0.5518435", "0.55052936", "0.5505122", "0.54979426", "0.5482283", "0.54763186", "0.54657227", "0.5447861", "0.54440653", "0.54377615", "0.543454", "0.54323006", "0.54284143", "0.54229325", "0.54211235", "0.54036844", "0.54030645", "0.54016584", "0.54015154", "0.5397427", "0.53957474", "0.5387247", "0.53870517", "0.5384467", "0.53790265", "0.53757006", "0.537489", "0.5374546", "0.53631175", "0.5359104", "0.5347633", "0.53463674", "0.5345205", "0.5334278", "0.53253293", "0.5322199", "0.5322014", "0.53199756", "0.5317751", "0.5317001", "0.5315201", "0.5314682", "0.5302881", "0.53002316", "0.5292807", "0.5286503", "0.5286489", "0.52855194", "0.52841985", "0.52837104", "0.52831256", "0.528291", "0.52744395", "0.52712935", "0.52627605", "0.5260833", "0.5259767", "0.525942", "0.5258219", "0.52474284", "0.5246877", "0.5234578", "0.5233119", "0.52330625", "0.523182", "0.523101", "0.52300704", "0.5225745", "0.5217352", "0.52148515" ]
0.0
-1
Bach Conway Doe Smith
@Test(description = "Verify that after click last name, values will be sorted alphabetic order") public void Test8_YK(){ // PASS DONEEEEE driver.findElement(By.xpath("//table[@id='table1']//tr//th[1]")).click(); String[] expectedLastNameOrder = {"Bach", "Conway", "Doe", "Smith"}; List<WebElement> lastnames = driver.findElements(By.xpath("//table[@id='table1']//tbody//tr//td[1]")); for (int i = 0; i<4; i++){ Assert.assertEquals(lastnames.get(i).getText(), expectedLastNameOrder[i], "NOT EQUAL"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String getSurname();", "java.lang.String getSurname();", "java.lang.String getFirstName();", "java.lang.String getFirstName();", "String fullName();", "String getCustomerLastName(String bookingRef);", "String getLastName();", "String getLastName();", "public void getFirstAndLastName( String name ){//\r\n String nameNew = name.trim();\r\n String[] arr = nameNew.split(\"\\\\s\");\r\n firstName = arr[0];\r\n lastName = arr[1];\r\n }", "private String getFirstName() {\n System.out.println(\"Enter Your Last Name Of First Letter In Capital \");\n return sc.next();\n }", "java.lang.String getLastName();", "java.lang.String getLastName();", "String getCardLastName(String bookingRef);", "String getFirstName();", "String getFirstName();", "String getFirstName();", "public static String getFirstName() {\n String firstName = \"George\";\n String lastName = \"Washington\";\n return lastName;\n }", "public String getLastName();", "public String firstName() { return firstName; }", "public java.lang.String getFirstName();", "public void getName(ArrayList<String> document) {\r\n name = \"\";\r\n int atIndex = address.indexOf('@');\r\n String username = address.substring(0, atIndex);\r\n for(int i = 0; i < document.size(); i++)\r\n {\r\n String[] words = document.get(i).split(\" \");\r\n for(int j = 0; j < words.length; j++)\r\n {\r\n if(username.contains(words[j].toLowerCase()))\r\n {\r\n name = document.get(i);\r\n break;\r\n }\r\n }\r\n if(!name.equals(\"\"))\r\n {\r\n break;\r\n }\r\n } \r\n }", "private String getLastName() {\n System.out.println(\"Enter Your Last Name Of First Letter In Capital \");\n return sc.next();\n }", "public static void nameAndAddress () {\n\t\tSystem.out.println(\"Andrew Meiling\");\n\t\tSystem.out.println(\"224 South Dennis Ave\");\n\t\tSystem.out.println(\"Republic, MO 65738\");\n\t}", "People getUser();", "public static String meeting(String s) {\n\n String[] fullName = s.split(\";\");\n String[] firstName = new String[fullName.length];\n String[] lastName = new String[fullName.length];\n\n for (int i = 0; i < fullName.length; i++) {\n String[] nameSplit = fullName[i].split(\":\");\n firstName[i] = nameSplit[0];\n lastName[i] = nameSplit[1];\n }\n\n for (int i = 1; i < lastName.length; i++) {\n for (int j = i; j > 0; j--) {\n int order = lastName[j].toLowerCase().compareTo(lastName[j - 1].toLowerCase());\n if (order < 0) {\n String temp = lastName[j-1];\n lastName[j-1] = lastName[j];\n lastName[j] = temp;\n\n temp = firstName[j-1];\n firstName[j-1] = firstName[j];\n firstName[j] = temp;\n }\n else if (order == 0) {\n if (firstName[j].toLowerCase().compareTo(firstName[j-1].toLowerCase()) < 0) {\n String temp = lastName[j-1];\n lastName[j-1] = lastName[j];\n lastName[j] = temp;\n\n temp = firstName[j-1];\n firstName[j-1] = firstName[j];\n firstName[j] = temp;\n }\n }\n else {\n break;\n }\n }\n }\n String outputString = \"\";\n for (int i = 0; i < lastName.length; i++) {\n outputString += \"(\" + lastName[i].toUpperCase() + \", \" + firstName[i].toUpperCase() + \")\";\n }\n return outputString;\n }", "String getCardFirstName(String bookingRef);", "public java.lang.String getLastName();", "public String getFirstName() {\r\n // Bouml preserved body begin 00040B02\r\n\t System.out.println(firstName);\r\n\t return firstName;\r\n // Bouml preserved body end 00040B02\r\n }", "public static String starwarsname(String first, String last, String cit, String frend){\n String name;\r\n int citlen = cit.length();\r\n int frendlen = frend.length();\r\n \r\n //creating first name, taking letters from city and first name\r\n String firstname = cit.substring(citlen - 3, citlen) + first.substring(0, 3);\r\n \r\n //capitalizing the first letter and un-capitalizing the fourth letter of first name\r\n char firone = firstname.charAt(0);\r\n char firmid = first.charAt(0);\r\n firstname = Character.toUpperCase(firone) + firstname.substring(1, 3) + \r\n Character.toLowerCase(firmid) + firstname.substring(4, firstname.length());\r\n \r\n //capitalizing the first letter and un-capitalizing the fourth letter of last name\r\n String lastname = frend.substring(frendlen - 3, frendlen) + last.substring(0, 4);\r\n char lasone = lastname.charAt(0);\r\n char lasmid = last.charAt(0);\r\n lastname = Character.toUpperCase(lasone) + lastname.substring(1, 3) + \r\n Character.toLowerCase(lasmid) + lastname.substring(4, lastname.length());\r\n \r\n //adding the apostrophe before the first consonant for first and last name\r\n firstname = insertApostrophe(firstname);\r\n lastname = insertApostrophe(lastname);\r\n \r\n name = firstname + \" \" + lastname;\r\n return name;\r\n }", "public String searchLastNameUI() {\n console.promptForPrintPrompt(\" +++++++++++++++++++++++++++++++++++++++\");\n console.promptForPrintPrompt(\" + PLEASE ENTER LAST NAME TO SEARCH BY +\");\n console.promptForPrintPrompt(\" +++++++++++++++++++++++++++++++++++++++\");\n console.promptForString(\"\");\n String lastName = console.promptForString(\" LAST NAME: \");\n return lastName;\n }", "private String getName() {\n System.out.println(\"Enter contact name\");\n return scannerForAddressBook.scannerProvider().nextLine();\n }", "static void displaySalutation(String lastName) {\n System.out.println(\"Dear Mr. or Ms. \" + lastName);\n }", "static String getFirstName() {\n\t\tScanner s = new Scanner(System.in);\n\t\tSystem.out.print(\"Enter first name: \");\n\t\tString fn = s.nextLine();\n\t\treturn fn;\n\t}", "private String createName(String line) {\n line = line.replace(\"(L)\",\"\").replace(\"(D)\",\"\").replace(\"(R)\",\"\").replace(\"(I)\",\"\").replace(\"(\",\"\").replace(\")\",\"\");\n String firstName;\n String middleName = \"\";\n String lastName;\n String postNominal = \"\";\n\n firstName = line.split(\",\")[1].trim();\n if (firstName.contains(\" \")){\n middleName = firstName.split(\" \")[1];\n firstName = firstName.split(\" \")[0];\n }\n lastName = line.split(\",\")[0];\n if(lastName.split(\" \")[lastName.split(\" \").length-1].toLowerCase().equals(\"iii\")\n || lastName.split(\" \")[lastName.split(\" \").length-1].toLowerCase().equals(\"ii\")\n || lastName.split(\" \")[lastName.split(\" \").length-1].toLowerCase().equals(\"sr\")\n || lastName.split(\" \")[lastName.split(\" \").length-1].toLowerCase().equals(\"jr\")){\n postNominal = lastName.split(\" \")[1];\n lastName = lastName.split(\" \")[0];\n }\n\n return firstName.trim() + \",\" + middleName.trim() + \",\" + lastName.trim() + \",\" + postNominal.trim();\n }", "public static void main (String[] args){\n System.out.println(\"What is your name?\");\n Scanner console = new Scanner(System.in);\n String first = console.next();\n String subfirst = first.substring(1);\n String last = console.next();\n String sublast = last.substring(1);\n\n name(first, subfirst);\n name(last, sublast);\n\n\n }", "public String getName (){\r\n return firstName + \" \" + lastName;\r\n }", "com.google.protobuf.ByteString getFirstNameBytes();", "@AutoEscape\n\tpublic String getFirstName();", "String getFirstName( String key ) {\n return developer.firstName;\n }", "@Override\n\tpublic java.lang.String getFirstName() {\n\t\treturn _candidate.getFirstName();\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tScanner input = new Scanner(System.in);\n\t\tSystem.out.println(\"Enter fullname:\");\n\t\tString name = input.nextLine();\n\t\tinput.close();\n\t\t\n\t\t//find the index of the space between first and last names\n\t\tint spaceIndex = name.indexOf(\" \");\n\t\t//Gives the value from index 0 until spaceIndex \n\t\tString firstName = name.substring(0, spaceIndex);\n\t\t//Gives the value from spaceIndex + 1 until the last index of lastName\n\t\tString lastName = name.substring(spaceIndex + 1);\n\t\t\n\t\t\n\t\ttheNameSong(firstName);\n\t\ttheNameSong(lastName);\n\t}", "public abstract String fullName();", "public abstract String fullName();", "public static void main(String[] args) {\n System.out.println(\"Hey! Please enter your goodname: \");\n Scanner ip = new Scanner(System.in);\n String name = ip.nextLine();\n System.out.println(\"Happy Birthday \" + name);\n }", "public String getName(){\n\t\treturn this.firstName + \" \" + this.surname;\r\n\t}", "public String getFirstName();", "public String toString() {\r\n\t\treturn firstName;\r\n\t}", "public void greetPerson(String name) {\n\t\t\r\n\t\tif (name != null && name != \"\") {\r\n\t\t\tSystem.out.println(\"Hello dear \" + name + \" it is \" + _fullname + \", How are you today?\");\t\r\n\t\t} else {\r\n\t\t\tSystem.out.println(\"Im fine, Thank you, How are you?\");\r\n\t\t}\r\n\t\t\r\n\t}", "private String getFormattedName(String bossName) {\r\n\t\tString[] startingLetters = { \"corporeal\", \"king black\", \"nomad\", \"tormented\", \"avatar\" };\r\n\t\tfor(int i = 0; i < startingLetters.length; i++)\r\n\t\t\tif(bossName.toLowerCase().contains(startingLetters[i].toLowerCase()))\r\n\t\t\t\treturn \"the \"+bossName;\r\n\t\treturn bossName;\r\n\t}", "public void setLastName(java.lang.CharSequence value) {\n this.lastName = value;\n }", "private String fullName(){\n\t\tFullName=firstName+\" \"+lastName;\n\t\treturn (initial.toUpperCase()+\".\"+\" \"+firstName.toUpperCase()+\" \"+lastName.toUpperCase());\n\t}", "public String getGoogleUserFirstName(){\n return (String) attributes.get(GOOGLE_USER_FIRST_NAME);\n }", "static String concatName( String firstName , String lastName) {\n\t\treturn firstName + \" \" + lastName; \n\t}", "public void getFirstName() {\n\n\t}", "public String returnLastName() {\n\t\treturn this.registration_lastname.getAttribute(\"value\");\r\n\t}", "protected void validateFirstName(){\n Boolean firstName = Pattern.matches(\"[A-Z][a-z]{2,}\",getFirstName());\n System.out.println(nameResult(firstName));\n }", "@AutoEscape\n\tpublic String getLast_name();", "private static String getFirstName() {\n Scanner input = new Scanner(System.in);\n\n System.out.print(\"Enter your first name: \");\n String firstName = \"'\" + input.next() + \"'\";\n return firstName;\n }", "public String getFirstName() {\n\t\t System.out.println(\"method getFirstName() called.\");\n\t\t return firstName;\n\t\t}", "public Name (String firstName, String lastName) {\r\n\t\tthis.firstName = firstName;\r\n\t\tthis.lastName = lastName;\t\r\n\t}", "public static void main(String[] args) {\n\n\n\n Scanner scan = new Scanner(System.in);\n System.out.println(\"Enter your name here: \");\n String name = scan.next();\n System.out.println(\"Your name corrected is: \");\n String name2 = name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();\n System.out.println(name2);\n\n // make whole name uppercase the get the first character\n // get the rest of the characters starting from 2nd character\n /// then make it lowercase\n // eventually concatenate them\n\n\n }", "String getPassengerName();", "public java.lang.CharSequence getFirstName() {\n return first_name;\n }", "public FirstName(String entryString){\n super(entryString);\n }", "public Name(String firstName, String lastName) {\n this.firstName = firstName;\n this.lastName = lastName;\n }", "public String getLastName() {\r\n // Bouml preserved body begin 00040B82\r\n\t System.out.println(lastName);\r\n\t return lastName;\r\n\r\n // Bouml preserved body end 00040B82\r\n }", "public static void main(String[] args) {\n String forename = Keyboard.getText(\"Please enter your forname\");\n //Step 2: ask user for surname\n String surname = Keyboard.getText(\"Please enter your surname\");\n //Step 3: ask user for mothers maiden name\n String maiden = Keyboard.getText(\"Please enter your mothers maiden name\");\n //Step 4: ask user for city in which they were born\n String town = Keyboard.getText(\"Please enter the town where you were born\");\n //Step 5: starwarsname = first 3 letter of surname + first 2 letters of first name + \" \" + first 3 letters of motehrs maiden name + first 2 letters of town you **were born in\n\nString starwarsname = (surname.substring(0,3)+(forename.substring(0,2)) + \" \"+ (maiden.substring(0,3)+ (town.substring(0,2))));\n\n //Step 6: display \"your star wars name is \" + starwarsname\n System.out.println(\"Your Star Wars name is \" + starwarsname);\n }", "public String getLastName() { return lastName; }", "private String getBillerName(final SubmittedBill submittedBill) {\n String billerNameOne = submittedBill.getBillerName().equalsIgnoreCase(submittedBill.getAccountNickName())\n ? submittedBill.getBillerName().concat(\" (\" + submittedBill.getAccountNickName() + \")\")\n : submittedBill.getBillerName();\n return billerNameOne;\n }", "public String getContactLastName() {\n\n \n return contactLastName;\n\n }", "@Override\r\n\tpublic String getFistName() {\n\t\treturn first_name;\r\n\t}", "abstract void lastNameValidity();", "java.lang.String getBusinessName();", "int insertName(String nmNameLast, int idPerson);", "public static String fixAuthor_lastnameFirst(String in){\n \n // Check if we have cached this particular name string before:\n Object old = Globals.nameCache_lastFirst.get(in);\n if (old != null)\n return (String)old;\n \n //Util.pr(\"lastnamefirst: in\");\n StringBuffer sb=new StringBuffer();\n \n String[] authors = in.split(\" and \");\n for(int i=0; i<authors.length; i++){\n \t authors[i]=authors[i].trim();\n \t int comma = authors[i].indexOf(',');\n \t test:if (comma >= 0) {\n \t // There is a comma, so we assume it's ok.\n \t sb.append(authors[i]);\n }\n else {\n // The name is without a comma, so it must be rearranged.\n int pos = authors[i].lastIndexOf(' ');\n if (pos == -1) {\n // No spaces. Give up and just add the name.\n sb.append(authors[i]);\n break test;\n }\n String surname = authors[i].substring(pos+1);\n if (surname.equalsIgnoreCase(\"jr.\")) {\n pos = authors[i].lastIndexOf(' ', pos - 1);\n if (pos == -1) {\n // Only last name and jr?\n sb.append(authors[i]);\n break test;\n }\n else\n surname = authors[i].substring(pos+1);\n }\n // Ok, we've isolated the last name. Put together the rearranged name:\n sb.append(surname + \", \");\n sb.append(authors[i].substring(0, pos));\n \n }\n if (i != authors.length - 1)\n sb.append(\" and \");\n }\n /*String[] t = authors[i].split(\",\");\n if(t.length < 2) {\n // The name is without a comma, so it must be rearranged.\n t = authors[i].split(\" \");\n if (t.length > 1) {\n sb.append(t[t.length - 1]+ \",\"); // Last name\n for (int j=0; j<t.length-1; j++)\n sb.append(\" \"+t[j]);\n } else if (t.length > 0)\n sb.append(t[0]);\n }\n else {\n // The name is written with last name first, so it's ok.\n sb.append(authors[i]);\n }\n \n if(i !=authors.length-1)\n sb.append(\" and \");\n \n }*/\n //Util.pr(in+\" -> \"+sb.toString());\n String fixed = sb.toString();\n \n // Add the fixed name string to the cache.\n Globals.nameCache_lastFirst.put(in, fixed);\n \n return fixed;\n }", "public String setUserLastName(){\n String lastName = \"\";\n while(lastName.isBlank()) {\n System.out.print(\"Please Enter Last Name: \");\n lastName = supplyString.get();\n }\n return lastName.trim();\n }", "public String getName()\n {\n return foreName + \" \" + lastName;\n }", "public String getFirstName()\n\t{\n\t\t//local consants\n\n\t\t//local variables\n\n\t\t/*******************************************************************************/\n\n\t\t//Return the firstName.\n\t\treturn firstName;\n\n\t}", "public Person(String first, String middle, String last) {\n this.firstNames = first+ \" \" +middle;\n this.lastName = last;\n }", "private static void RecommendedUserNames(String first, String last) {\n\t\tString [][] usernames = new String [2][2];\n\t\tint [] RandomNumbers = new int [4];\n\t\tfor (int i=0; i < 4; i++) {\n\t\t\tRandomNumbers[i]=(int)(Math.random()*100);\n\t\t}\n\t\tint k = 0;\n\t\tSystem.out.println(\"Choose a unique username, some of the recommended ones for you are below\");\n\t\tfor (int i = 0; i < 2; i++)\n\t\t\tfor (int j = 0; j < 2; j++) {\n\t\t\t\tif (k%2==0) usernames[i][j] = first+last+RandomNumbers[k];\n\t\t\t\telse usernames[i][j] = last+first+RandomNumbers[k];\n\t\t\t\tk++;\n\t\t\t\tSystem.out.println(usernames[i][j]+ \" \");\n\t\t\t}\n\t\tSystem.out.println();\n\t}", "String printName(String input);", "public String getSurname()\r\n {\r\n return surname;\r\n }", "public java.lang.CharSequence getFirstName() {\n return first_name;\n }", "public String getName()\n/* */ {\n/* 336 */ return this.fullName;\n/* */ }", "public String setUserFirstName(){\n String firstName = \"\";\n while(firstName.isBlank()) {\n System.out.print(\"Please Enter First Name: \");\n firstName = supplyString.get();\n }\n return firstName.trim();\n }", "public static String fullName(String firstName, String lastName)\n\t{\n\t\treturn firstName + \" \" + lastName;\t\n\t}", "String simpleName();", "public void setLastName(java.lang.CharSequence value) {\n this.last_name = value;\n }", "public static void printLongestNamedPeople(){\n ArrayList<Person> longests = query.getLongestNamed();\n if (longests.size() == 1) {\n System.out.println(\"The person with the longest name is: \");\n } else {\n System.out.println(\"The people with the longest names are: \");\n }\n for (Person p : longests) {\n System.out.println(p);\n }\n }", "@Override\n\tpublic void FirstName(String firstName) {\n\t\t\n\t}", "@AutoEscape\n\tpublic String getFirst_name();", "public static void main(String[] args) {\n String username = \"\";\n if (args.length != 0) {\n username = args[0]; \n // If username, ensure proper case\n String[] userNamePropCase = username.split(\"\\\\s+\");\n username = \"\";\n for (int i = 0; i < userNamePropCase.length; i++) {\n if (i != 0) {\n username += \" \";\n } \n char firstLetter = userNamePropCase[i].charAt(0);\n firstLetter = Character.toUpperCase(firstLetter);\n System.out.printf(\"first letter: %c\\n\", firstLetter);\n String restOfName = userNamePropCase[i].substring(1, userNamePropCase[i].length());\n username += (firstLetter + restOfName);\n }\n System.out.printf(\"Hello, %s!\\n\", username);\n } else {\n System.out.println(\"Hello, Chris!\");\n }\n }", "public String getFirstName() { return firstName; }", "public String returnPerson(String person)\n\t{\n\t\tfor(int i = 0; i < peopleList.size(); i++)\n\t\t{\n\t\t\t// getSurname is a method defined in the Person class and return a persons last name\n\t\t\t// Compares the last name you typed in with the last name of each person in the peopleList list\n\t\t\t// if the last names are equal then return the person with the appropriate toString method\n\t\t\tif(person.equalsIgnoreCase(peopleList.get(i).getSurname())) \n\t\t\t{\n\t\t\t\treturn(peopleList.get(i).toString());\n\t\t\t}\n\t\t}\n\t\t// If the person looked for is not in the \"peopleList\" list; return the string \"notFound\" that is defined above\n\t\treturn notFound;\n\t}", "public String provideFullName( )\r\n {\r\n return String.format( \"%s %s\",\r\n getFirstNm( ),\r\n getLastNm( ) );\r\n }", "public String getFirstName(){\r\n\t\treturn firstName;\r\n\t}", "public String getFirstName() \r\n {\r\n return firstName;\r\n }", "@java.lang.Override\n public java.lang.String getFirstName() {\n java.lang.Object ref = firstName_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n firstName_ = s;\n return s;\n }\n }", "@java.lang.Override\n public java.lang.String getFirstName() {\n java.lang.Object ref = firstName_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n firstName_ = s;\n return s;\n }\n }", "protected void validateLastName(){\n Boolean lastName = Pattern.matches(\"[A-Z][a-z]{2,}\",getLastName());\n System.out.println(nameResult(lastName));\n }", "public String printByLastName() {\n StringBuilder result = new StringBuilder(\"--Printing statements by last name--\\n\\n\");\n sortByLastName();\n result.append(orderedPrint());\n return result.toString();\n }" ]
[ "0.6947397", "0.68836486", "0.6534487", "0.6534487", "0.65003705", "0.64909387", "0.6480009", "0.6480009", "0.6426362", "0.63263655", "0.6309762", "0.6309762", "0.63080865", "0.62895656", "0.62895656", "0.62895656", "0.6073615", "0.6072242", "0.6060288", "0.6031567", "0.6026251", "0.59986204", "0.598862", "0.59781206", "0.5926849", "0.59184", "0.59130555", "0.59106207", "0.5901905", "0.58580524", "0.5850321", "0.58431906", "0.58375615", "0.5837212", "0.5824605", "0.58174753", "0.5807942", "0.5802937", "0.580201", "0.5796126", "0.5792299", "0.57909626", "0.57909626", "0.5786339", "0.5777804", "0.57766014", "0.5764222", "0.5755952", "0.57517135", "0.57464594", "0.5734639", "0.57203704", "0.5715921", "0.57158566", "0.5666296", "0.5664444", "0.56618124", "0.56590086", "0.56535053", "0.5649558", "0.56445414", "0.56429756", "0.5636327", "0.5635909", "0.56317526", "0.56303006", "0.56290567", "0.5626069", "0.56219125", "0.5619877", "0.5613906", "0.56123537", "0.5611219", "0.5610473", "0.5600942", "0.5600603", "0.55997944", "0.5590249", "0.5589835", "0.5589812", "0.5580309", "0.5577568", "0.55754703", "0.5570811", "0.5569221", "0.55689293", "0.5565996", "0.5563418", "0.55634093", "0.5562717", "0.5560493", "0.55603755", "0.5558229", "0.55456203", "0.55403525", "0.55347884", "0.55341536", "0.55317456", "0.55317456", "0.5528618", "0.55260694" ]
0.0
-1
traverses node to find matching leaf node
public RegressionTreeNode traverseNode(Serializable value){ if(value instanceof Number && this.value instanceof Number){ Double number = ((Number) value).doubleValue(); return this.traverseNumericalNode(number); }else{ return this.traverseNominalNode(value); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\npublic boolean fjern(T verdi) {\n Node<T> curr = hode;\n while (curr != null) {\n if (curr.verdi.equals(verdi)) {\n if (antall == 1) {\n hode = hale = null;\n } else if (curr == hode) {\n hode = hode.neste;\n hode.forrige = null;\n } else if (curr == hale) {\n hale = hale.forrige;\n hale.neste = null;\n } else {\n curr.forrige.neste = curr.neste;\n curr.neste.forrige = curr.forrige;\n }\n antall--;\n endringer++;\n return true;\n }\n curr = curr.neste;\n }\n return false;\n}", "@Test\n public void Test7() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t2, null, t3);\n TreeNode.connect(t3, t1, null);\n TreeNode root = t2;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e1, null, e3);\n TreeNode.connect(e3, e2, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public void recoverTree2(TreeNode root) {\n traverse(root);\n\n // Swap the values of the two nodes\n int temp = firstElement.val;\n firstElement.val = secondElement.val;\n secondElement.val = temp;\n }", "private Node findOld(Node node) {\t\t\n\t\tfor (Node old : open) {\n\t\t\tif(old.state.id == node.state.id){\n\t\t\t\treturn old;\n\t\t\t}\n\t\t}\n\t\tfor (Node old : closed) {\n\t\t\tif(old.state.id == node.state.id){\n\t\t\t\treturn old;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "@Test\n public void Test6() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t3, null, t1);\n TreeNode.connect(t1, t2, null);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e1, null, e3);\n TreeNode.connect(e3, e2, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public void recoverTree(TreeNode root) {\n if(root == null)\n return;\n helper(root);\n \n //swap n2 and n3 val\n int temp = n1.val;\n n1.val = n2.val;\n n2.val = temp;\n return;\n }", "private MyBinNode getToReplace(MyBinNode node){\n MyBinNode replc_p = node;\n MyBinNode replace = node;\n MyBinNode aux = node.right;\n while(aux != null){\n replc_p = replace;\n replace = aux;\n aux = aux.left;\n }\n if(replace != node.right){\n replc_p.left = replace.right;\n replace.right = node.right;\n }\n return replace;\n }", "@Test\n public void Test2() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t1, null, t4);\n TreeNode.connect(t4, null, t3);\n TreeNode.connect(t3, null, t2);\n TreeNode.connect(t2, null, t5);\n TreeNode root = t1;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e1, null, e2);\n TreeNode.connect(e2, null, e3);\n TreeNode.connect(e3, null, e4);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "private BinarySearchTree deleteLeftMost(BinarySearchTree tree){\r\n\t\t\r\n\t\tif(tree.getLeftChild() == null){\r\n\t\t\t//this is the node we want. No left child\r\n\t\t\t//Right child might exist\r\n\t\t\t\r\n\t\t\treturn tree.getRightChild();\r\n\t\t}\r\n\t\telse{\r\n\t\t\tBinarySearchTree replacement = deleteLeftMost(tree.getLeftChild());\r\n\t\t\ttree.attachRightSubtree(replacement);\r\n\t\t\treturn tree;\r\n\t\t}\r\n\t}", "private void backToParent(){\n\t\tList<Node> tmp = new ArrayList<Node>();\n\t\t\n\t\tfor(int i = 0; i < r.size(); i++){\n\t\t\tif(r.get(i).getNodeType() == Node.ATTRIBUTE_NODE){\n\t\t\t\tNode localNode = ((Attr)r.get(i)).getOwnerElement();\n\t\t\t\tif(localNode != null)\n\t\t\t\t\ttmp.add(localNode);\n\t\t\t} else {\n\t\t\t\tNode localNode = r.get(i).getParentNode();\n\t\t\t\tif(localNode != null && localNode.getNodeType() != Node.DOCUMENT_NODE && !listContainsElement(tmp, localNode)){\n\t\t\t\t\ttmp.add(localNode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tr = tmp;\n\t}", "@Test\n public void Test4() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t2, t3, t4);\n TreeNode.connect(t3, t1, null);\n TreeNode.connect(t4, null, t5);\n TreeNode root = t2;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e3, e2, e4);\n TreeNode.connect(e2, e1, null);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e3;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public Node findSet(Node node ){\n Node parent = node.parent;\n //it means no one is parent\n if( parent == node ){\n return parent;\n }\n //do compression\n node.parent = findSet( parent );\n return node.parent;\n }", "private Node getReplacementKeyNode(Key key, Node node) {\n\t\tNode ret = node.getChild(node.getDataNumber(key));\r\n\t\t\r\n\t\twhile (!ret.isLeaf()) {\r\n\t\t\tret = ret.getChild(ret.getChildren().size() - 1);\r\n\t\t}\r\n\t\t\r\n\t\treturn ret;\r\n\t}", "Node deleteSuccessor(Node node) {\r\n\t\tNode successor = node.right , parentSuccessor = node ;\r\n\t\twhile( successor.left != null ) {\r\n\t\t\tparentSuccessor = successor ;\r\n\t\t\tsuccessor = successor.left ;\r\n\t\t}\r\n\t\tint value = node.value ;\r\n\t\tnode.value = successor.value ;\r\n\t\tsuccessor.value = value ;\r\n\t\t\r\n\t\tif( parentSuccessor == node ) {\r\n\t\t\tnode.right = successor.right ;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tparentSuccessor.left = successor.right ;\r\n\t\t}\r\n\t\tsuccessor.left = null ;\r\n\t\tsuccessor.right = null ;\r\n\t\treturn successor;\r\n\t}", "@Test\n public void Test3() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t3, t4, t2);\n TreeNode.connect(t4, t1, null);\n TreeNode.connect(t2, null, t5);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e3, e2, e4);\n TreeNode.connect(e2, e1, null);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e3;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public void recoverTree(TreeNode root) {\n if (root == null) {\n return;\n }\n\n prev = null;\n first = null;\n second = null;\n\n inorderTraversal(root);\n\n if (first != null && second != null) {\n int temp = first.val;\n first.val = second.val;\n second.val = temp;\n }\n\n }", "private Node prune(Node r) {\r\n if (r == null) return null;\r\n Op op = r.op();\r\n r.left(prune(r.left()));\r\n if (r.left() == null) r.ref(prune(r.ref()));\r\n else r.right(prune(r.right()));\r\n if (r.right() != null && r.right().op() == Temp) r.right(null);\r\n if (op == Temp) return r.left();\r\n return r;\r\n }", "public void deleteNode(BinaryTreeNode node) // Only leaf nodes and nodes with degree 1 can be deleted. If a degree 1 node is deleted, it is replaced by its subtree.\r\n {\n if(!node.hasRightChild() && !node.hasLeftChild()){\r\n if(node.mActualNode.mParent.mRightChild == node.mActualNode) {\r\n\r\n node.mActualNode.mParent.mRightChild = null;\r\n }\r\n else if(node.mActualNode.mParent.mLeftChild == node.mActualNode) {\r\n\r\n node.mActualNode.mParent.mLeftChild = null;\r\n }\r\n //node.mActualNode = null;\r\n\r\n }\r\n //if deleted node has degree 1 and has only left child\r\n else if(node.hasLeftChild() && !node.hasRightChild()){\r\n node.mActualNode.mLeftChild.mParent = node.mActualNode.mParent;\r\n //if deleted node is left child of his father\r\n if(node.mActualNode.mParent.mLeftChild == node.mActualNode)\r\n node.mActualNode.mParent.mLeftChild = node.mActualNode.mLeftChild;\r\n //if deleted node is right child of his father\r\n else {\r\n\r\n node.mActualNode.mParent.mRightChild = node.mActualNode.mLeftChild;\r\n }\r\n }\r\n // if deleted node has degree 1 and has only right child\r\n else if(node.hasRightChild() && !node.hasLeftChild()){\r\n node.mActualNode.mRightChild.mParent = node.mActualNode.mParent;\r\n\r\n //if node is left child of his father\r\n if(node.mActualNode.mParent.mLeftChild == node.mActualNode) {\r\n\r\n\r\n node.mActualNode.mParent.mLeftChild = node.mActualNode.mRightChild;\r\n\r\n }\r\n //if node is right child of his father\r\n else\r\n node.mActualNode.mParent.mRightChild = node.mActualNode.mRightChild;\r\n\r\n\r\n }\r\n else\r\n System.out.println(\"Error : node has two child\");\r\n\r\n }", "void flipPath(int lastNode) {\n int myLastNode = lastNode;\n while (myLastNode != EMPTY_LABEL) {\n int parent = this.tLabels[myLastNode];\n\n // Add (parent, lastNode) to matching. We don't need to\n // explicitly remove any edges from the matching because:\n // * We know at this point that there is no i such that\n // sMatches[i] = lastNode.\n // * Although there might be some j such that tMatches[j] =\n // parent, that j must be sLabels[parent], and will change\n // tMatches[j] in the next time through this loop.\n this.sMatches[parent] = lastNode;\n this.tMatches[myLastNode] = parent;\n\n myLastNode = this.sLabels[parent];\n }\n }", "@Test\n public void Test1() {\n TreeNode t1 = new TreeNode(5);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(1);\n TreeNode.connect(t1, t2, null);\n TreeNode.connect(t2, t3, null);\n TreeNode.connect(t3, t4, null);\n TreeNode.connect(t4, t5, null);\n TreeNode root = t1;\n\n TreeNode e1 = new TreeNode(5);\n TreeNode e2 = new TreeNode(4);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(2);\n TreeNode e5 = new TreeNode(1);\n TreeNode.connect(e1, e2, null);\n TreeNode.connect(e2, e3, null);\n TreeNode.connect(e3, e4, null);\n TreeNode.connect(e4, e5, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "private IAVLNode findSuccessor(IAVLNode node) \r\n\t {\r\n\t\t if(node.getRight().getHeight() != -1) \r\n\t\t\t return minPointer(node.getRight());\r\n\t\t IAVLNode parent = node.getParent();\r\n\t\t while(parent.getHeight() != -1 && node == parent.getRight())\r\n\t\t {\r\n\t\t\t node = parent;\r\n\t\t\t parent = node.getParent();\r\n\t\t }\r\n\t\t return parent;\t \r\n\t\t}", "public Node findSuccessor(int id);", "private BinarySearchTree deleteTree(BinarySearchTree tree, Comparable key){\r\n\t\t\r\n\t\t//If it is a leaf\r\n\t\tif(tree.getLeftChild() == null && tree.getRightChild() == null){\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t//Tree has only 1 leaf\r\n\t\telse if( (tree.getLeftChild() == null && tree.getRightChild() != null) ||\r\n\t\t\t\t (tree.getLeftChild() != null && tree.getRightChild() == null)){\r\n\t\t\t\r\n\t\t\t//Make a new tree out of the leaf and make it the new root\r\n\t\t\tif(tree.getLeftChild() != null){\r\n\t\t\t\treturn tree.getLeftChild();\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn tree.getRightChild();\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Has two leaves. This case is slightly more complicated\r\n\t\telse{\r\n\t\t\t//get the leftmost item in the right child subtree. This becomes the \r\n\t\t\t//new root. This allows the BinarySearchTree to stay a valid \r\n\t\t\t//BinarySearchTree\r\n\t\t\tKeyedItem replacementItem = findLeftMost(tree.getRightChild());\r\n\t\t\t\r\n\t\t\t//Delete the tree with that item so it can be moved to the new root\r\n\t\t\tBinarySearchTree replacementTree = deleteLeftMost(tree.getRightChild());\r\n\t\t\t\r\n\t\t\t//change the root to the new item\r\n\t\t\ttree.setRootItem(replacementItem);\r\n\t\t\t\r\n\t\t\t//Set the new roots right tree to the replacement tree\r\n\t\t\ttree.attachRightSubtree(replacementTree);\r\n\t\t\treturn tree;\r\n\t\t}\r\n\t}", "public Boolean DeleteAndMerge(Node node) {\n\t\tif (node.getLeftChild() == null) {\n\t\t\tDeleteAllChild(node);\n\t\t\treturn true;\n\t\t}\n\n\t\tif (node.getParent().getLeftChild() == node) {\n\t\t\t// Node tempNode=node.getLeftChild();\n\t\t\tint level = node.getLevel();\n\t\t\tNode pa = node.getParent();\n\t\t\tPreorderLevel(node.getLeftChild());\n\t\t\tnode.getParent().setLeftChild(node.getLeftChild());\n\t\t\tnode.getLeftChild().setParent(node.getParent());\n\t\t\tnode.getLeftChild().setLevel(node.getLevel());\n\t\t\tNode tempNode = node.getRightChild();\n\t\t\tnode = node.getLeftChild();\n\n\t\t\tfor (;;) {\n\t\t\t\tif (node.getRightChild() == null) {\n\t\t\t\t\tnode.setRightChild(tempNode);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tnode = node.getRightChild();\n\n\t\t\t\t\tnode.setLevel(level);\n\t\t\t\t\tnode.setParent(pa);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\tint level = node.getLevel();\n\t\t\tNode tNode = node.getParent().getLeftChild();\n\n\t\t\tfor (;;) {\n\t\t\t\tif (tNode.getRightChild() == node)\n\t\t\t\t\tbreak;\n\t\t\t\ttNode = tNode.getRightChild();\n\t\t\t}\n\t\t\ttNode.setRightChild(node.getLeftChild());\n\n\t\t\tNode parent = node.getParent();\n\t\t\tNode rNode = node.getRightChild();\n\t\t\tnode = node.getLeftChild();\n\t\t\tPreorderLevel(node);\n\t\t\tfor (;;) {\n\t\t\t\tif (node.getRightChild() == null)\n\t\t\t\t\tbreak;\n\t\t\t\telse {\n\t\t\t\t\tnode.setParent(parent);// 改变子结点的父结点\n\t\t\t\t\t// 修改结点层级\n\t\t\t\t\tif (node.getParent() == null) {\n\t\t\t\t\t\tnode.setLevel(0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.setLevel(level);\n\t\t\t\t\t}\n\t\t\t\t\tnode = node.getRightChild();\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tnode.setParent(parent);\n\t\t\tnode.setLevel(level);\n\t\t\tnode.setRightChild(rNode);\n\t\t\t// if (rNode.getParent() == null) {\n\t\t\t// rNode.setLevel(0);\n\t\t\t// } else {\n\t\t\t// rNode.setLevel(rNode.getParent().getLevel() + 1);\n\t\t\t// }\n\t\t}\n\n\t\treturn true;\n\n\t}", "public static void main(String[] args) {\n\n MultiChildTreeNode<String> ff = new MultiChildTreeNode<>(\"F\");\n MultiChildTreeNode<String> iff = new MultiChildTreeNode<>(\"I\");\n ff.children.add(iff);\n MultiChildTreeNode<String> kff = new MultiChildTreeNode<>(\"K\");\n ff.children.add(kff);\n MultiChildTreeNode<String> t2 = ff;//Subtree to find\n\n //Main tree\n MultiChildTreeNode<String> t1 = new MultiChildTreeNode<>(\"A\");\n MultiChildTreeNode<String> b = new MultiChildTreeNode<>(\"B\");\n MultiChildTreeNode<String> c = new MultiChildTreeNode<>(\"C\");\n MultiChildTreeNode<String> d = new MultiChildTreeNode<>(\"D\");\n t1.children.add(b);\n t1.children.add(c);\n t1.children.add(d);\n\n MultiChildTreeNode<String> e = new MultiChildTreeNode<>(\"E\");\n MultiChildTreeNode<String> h = new MultiChildTreeNode<>(\"H\");\n e.children.add(h);\n\n MultiChildTreeNode<String> f = new MultiChildTreeNode<>(\"F\");\n b.children.add(f);\n MultiChildTreeNode<String> i = new MultiChildTreeNode<>(\"I\");\n f.children.add(i);\n MultiChildTreeNode<String> j = new MultiChildTreeNode<>(\"J\");\n f.children.add(j);\n\n\n /**\n * A\n * / | \\\n * B C.. D...\n * / |\n *E.. F\n * / \\\n * I J\n * |\n * F\n * / \\\n * I K\n */\n j.children.add(ff); //commenting out this line should give false otherwise true\n\n MultiChildTreeNode<String> k = new MultiChildTreeNode<>(\"K\");\n MultiChildTreeNode<String> g = new MultiChildTreeNode<>(\"G\");\n b.children.add(e);\n\n b.children.add(g);\n MultiChildTreeNode<String> l = new MultiChildTreeNode<>(\"L\");\n c.children.add(k);\n c.children.add(l);\n\n MultiChildTreeNode<String> m = new MultiChildTreeNode<>(\"M\");\n MultiChildTreeNode<String> n = new MultiChildTreeNode<>(\"N\");\n MultiChildTreeNode<String> o = new MultiChildTreeNode<>(\"O\");\n d.children.add(m);\n d.children.add(n);\n d.children.add(o);\n CheckForSubTree<String> checker = new CheckForSubTree<>();\n System.out.println (checker.isSubTree(t1, t2));\n }", "private void deleteNode(Node<K> p) {\n // If strictly internal, copy successor's element to p and then make p\n // point to successor.\n if (p.left != null && p.right != null) {\n Node<K> s = successor(p); // 节点有 2 个子节点时,找到实际删除的后继节点\n p.key = s.key; // 将后继节点的值复制到原来节点上,原来的节点只是值被删除,节点本身不删除\n p = s; // 将实际要删除的节点位置指向后继节点位置\n } // p has 2 children //\n // //////////////////////////////////////////////////////////////////\n // Start fixup at replacement node, if it exists. //\n Node<K> replacement = (p.left != null ? p.left : p.right); // 实际删除的节点最多只有一个子节点,并且一定是红色子节点\n if (replacement != null) { // 如果有一个红色子节点\n // Link replacement to parent //\n replacement.parent = p.parent; // 将此节点上移\n if (p.parent == null) //\n root = replacement; //\n else if (p == p.parent.left) // 实际被删除的节点 p 为左子\n p.parent.left = replacement; //\n else // 实际被删除的节点 p 为右子\n p.parent.right = replacement; //\n // //\n // Null out links so they are OK to use by fixAfterDeletion. //\n p.left = p.right = p.parent = null; //\n // //\n // Fix replacement //////////////////////////////////////////////////////////////////\n if (p.color == BLACK) // 删除情形 5. 因为 replacement 是红节点,所以这里 p 的颜色一定是黑色的\n fixAfterDeletion(replacement); // 修复只要将此红节点上移并置黑就完成了\n } else if (p.parent == null) { // return if we are the only node. //////////////////////////////////////////////////////////////////\n root = null; // 根节点被删除\n } else { // No children. Use self as phantom replacement and unlink. // 被删除的节点没有子节点时\n if (p.color == BLACK) // 如果是红色的节点,直接删除就完成\n fixAfterDeletion(p); // 如果被删除的是黑色节点,则会破坏红黑树性质 5,需要修复红黑树\n\n if (p.parent != null) {\n if (p == p.parent.left)\n p.parent.left = null;\n else if (p == p.parent.right)\n p.parent.right = null;\n p.parent = null;\n }\n }\n }", "public TreeNode rewriteTreeNode(TreeNode node) {\n if (node instanceof Group) {\n BGP theBGP = new BGP(new ArrayList<TriplePatternNode>());\n Group g = (Group) node;\n ArrayList<GraphPattern> toAdd = new ArrayList<GraphPattern>(), toRemove = new ArrayList<GraphPattern>();\n\n for (GraphPattern pattern : g.getPatterns()) {\n if (pattern instanceof BGP || pattern instanceof Group) {\n if (conjoinGraphPattern(theBGP, g, pattern, toAdd))\n toRemove.add(pattern);\n }\n }\n\n for (GraphPattern gp : toRemove)\n g.removeGraphPattern(gp);\n for (GraphPattern gp : toAdd)\n g.addGraphPattern(gp);\n\n // we used to only add a BGP if it was non-empty\n // the special case of empty groups made backends more difficult\n // to implement in some cases, so now we ensure a single BGP for\n // every group, even if it is empty\n g.addGraphPattern(theBGP);\n }\n return node;\n }", "TrieNode root();", "public Node closestPrecedingNode(int id);", "TreeNode returnNode(TreeNode node);", "public Node<T> darTope();", "private BinaryNode<E> _delete(BinaryNode<E> node, E e) {\n\t\tif (node == null) {\n\t\t\treturn null;\n\t\t}\n\t\tif (comparator.compare(e, node.getData()) < 0) // <, so go left\n\t\t\tnode.setLeftChild(_delete(node.getLeftChild(), e));// recursive call\n\t\telse if (comparator.compare(e, node.getData()) > 0) // >, so go right\n\t\t\tnode.setRightChild(_delete(node.getRightChild(), e));// recursive call\n\t\telse { // FOUND THE NODE\n\t\t\tfoundNode = true;\n\t\t\tnode = _deleteNode(node);\n\t\t}\n\t\treturn node;\n\t}", "private void fixAVLTree(Node node) {\n\t\tfinal int lf = getLoadFactor(node);\n\t\t//if (lf == -1 || lf == 0 || lf == 1) {\n\t\tif (lf >= -1 && lf <= 1) {\n\t\t\t// do nothing\n\t\t\treturn;\n\t\t}\t\t\n\t\trotateTree(node);\n\t}", "private Node findNode(Node node, String name) {\n Node temp = node;\n\n if (temp.getNext() != null && name.compareTo(temp.getNext().getState().getName()) > 0) {\n temp = findNode(temp.getNext(), name);\n }\n return temp;\n }", "public void setToLeaf() {\r\n isLeaf = true;\r\n }", "private void singleRotationLR(BinaryNode node){\n if (node == root) {\n root = node.left;\n root.parent = null;\n root.right = node;\n node.parent = node.left;\n node.left = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = node.left;\n } else {\n node.parent.left = node.left;\n }\n node.left.parent = node.parent;\n node.left.right = node;\n node.parent = node.left;\n node.left = null;\n }\n }", "public void\nswitchToNodeTraversal(SoNode node)\n{\n // Store current state.\n SoActionP.AppliedData storeddata = new SoActionP.AppliedData(this.pimpl.applieddata);\n AppliedCode storedcode = this.pimpl.appliedcode;\n PathCode storedpathcode = this.currentpathcode;\n SoTempPath storedpath = new SoTempPath(this.currentpath);\n\n this.pimpl.appliedcode = SoAction.AppliedCode.NODE;\n this.pimpl.applieddata.node = node;\n this.currentpathcode = SoAction.PathCode.NO_PATH;\n this.currentpath.truncate(0);\n\n this.traverse(node);\n\n // Restore previous state.\n this.currentpath.copyFrom(storedpath);\n this.currentpathcode = storedpathcode;\n this.pimpl.applieddata.copyFrom(storeddata);\n this.pimpl.appliedcode = storedcode;\n}", "@Test\n public void Test5() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t3, t1, t2);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e2, e1, e3);\n TreeNode expected = e2;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "private boolean _deleteLeaf(Node node, T value) {\n if (node == null)\n // not found\n return false;\n /** if the value is found */\n if (value.compareTo(node.element) == 0) {\n // is it a leaf? if yes, delete it\n if(node.left == null && node.right == null){\n node = null;\n return true;\n }\n else{\n // not a leaf\n return false;\n }\n }\n /** Otherwise, continue the search recursively */\n return value.compareTo(node.element) < 0 ? _deleteLeaf(node.left, value) : _deleteLeaf(node.right, value);\n }", "public Node findSet(Node dataNode) {\n // something go wrong here?\n if (dataNode == dataNode.parent) {\n return dataNode;\n }\n dataNode.parent = findSet(dataNode.parent);\n // what is returned is the root, if dataNode is returned then it is the leaf not root\n return dataNode.parent;\n }", "void traverse2() {\n BTNode node = root, prev = null, next;\n while (node != null) {\n if (prev == node.parent) {\n if (node.left != null) {\n next = node.left;\n }\n else if (node.right != null) {\n next = node.right;\n }\n else {\n next = node.parent;\n }\n } else if (prev == node.left) {\n if (node.right != null) {\n next = node.right;\n }\n else {\n next = node.parent;\n }\n } else {\n next = node.parent;\n }\n prev = node;\n node = next;\n }\n }", "private static <K extends Comparable<? super K>, V> @Nullable Node<K, V> removeAndCopy0(\n K key, @Var Node<K, V> current) {\n\n @Var int comp = key.compareTo(current.getKey());\n\n if (comp < 0) {\n // key < current.data\n if (current.left == null) {\n // Target key is not in map.\n return current;\n }\n\n // Go down leftwards, keeping a red node.\n\n if (!Node.isRed(current.left) && !Node.isRed(current.left.left)) {\n // Push red to left if necessary.\n current = makeLeftRed(current);\n }\n\n // recursive descent\n Node<K, V> newLeft = removeAndCopy0(key, current.left);\n current = current.withLeftChild(newLeft);\n\n } else {\n // key >= current.data\n if ((comp > 0) && (current.right == null)) {\n // Target key is not in map.\n return current;\n }\n\n if (Node.isRed(current.left)) {\n // First chance to push red to right.\n current = rotateClockwise(current);\n\n // re-update comp\n comp = key.compareTo(current.getKey());\n assert comp >= 0;\n }\n\n if ((comp == 0) && (current.right == null)) {\n assert current.left == null;\n // We can delete the node easily, it's a leaf.\n return null;\n }\n\n if (!Node.isRed(current.right) && !Node.isRed(current.right.left)) {\n // Push red to right.\n current = makeRightRed(current);\n\n // re-update comp\n comp = key.compareTo(current.getKey());\n assert comp >= 0;\n }\n\n if (comp == 0) {\n // We have to delete current, but is has children.\n // We replace current with the smallest node in the right subtree (the \"successor\"),\n // and delete that (leaf) node there.\n\n @Var Node<K, V> successor = current.right;\n while (successor.left != null) {\n successor = successor.left;\n }\n\n // Delete the successor\n Node<K, V> newRight = removeMininumNodeInTree(current.right);\n // and replace current with it\n current =\n new Node<>(\n successor.getKey(),\n successor.getValue(),\n current.left,\n newRight,\n current.getColor());\n\n } else {\n // key > current.data\n // Go down rightwards.\n\n Node<K, V> newRight = removeAndCopy0(key, current.right);\n current = current.withRightChild(newRight);\n }\n }\n\n return restoreInvariants(current);\n }", "void arbitraryRemove(Nodefh node){\n\t\n\t\tif(node.Parent.Child == node){\n\t\t\tif(node.Right != null && node.Right != node){\n\t\t\t\tnode.Parent.Child = node.Right;\n\t\t\t\tif(node.Left!=null && node.Left != node){\n\t\t\t\t\tnode.Left.Right = node.Right;\n\t\t\t\t\tnode.Right.Left = node.Left;\n\t\t\t\t\tnode.Parent = null;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tnode.Right.Left = node.Right;\n\t\t\t\t\tnode.Parent = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnode.Parent.Child = null;\n\t\t\t\tnode.Parent = null;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tif(node.Left != null && node.Left != node){\n\t\t\t\tnode.Left.Right = node.Right;\n\t\t\t\tnode.Right.Left = node.Left;\n\t\t\t}\n\t\t\tnode.Parent = null;\n\n\t\t}\n\t\tif(node.Child!=null){\n\t\t\tNodefh temp = node.Child;\n\t\t\tif(node.Child.Right!=null){\n\t\t\t\ttemp = node.Child.Right;\n\t\t\t}\n\t\t\tfhInsert(node.Child);\n\t\t\twhile(temp!=node.Child.Right){\n\t\t\t\tfhInsert(temp);\n\t\t\t\ttemp = temp.Right;\n\t\t\t}\n\n\t\t}\n\n\t}", "private void pruneTree(QuadNode node){\n int i;\n while(node.parent != null && node.quads[0] == null && node.quads[1] == null && node.quads[2] == null && node.quads[3] == null){\n i=0;\n if(node.x != node.parent.x){\n i++;\n }\n if(node.z != node.parent.z){\n i+=2;\n }\n node = node.parent;\n node.quads[i] = null;\n }\n }", "private void RemoveRootNode() {\n\t\t\n\t\troot_map.remove(this);\n\t\tis_node_set = false;\n\t\tif(left_ptr == null && right_ptr == null) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tleft_ptr.RemoveRootNode();\n\t\tright_ptr.RemoveRootNode();\n\t}", "private Node serchNode(E input, Node current) {\n Node node = null;\n if (current.value.equals(input)) {\n node = current;\n } else {\n List<Node> children = current.children;\n for (Node child : children) {\n node = serchNode(input, child);\n if (node != null) {\n break;\n }\n }\n }\n return node;\n }", "@Test\n public void remove_BST_1_CaseLeafRight()\n {\n BinarySearchTree bst = new BinarySearchTree();\n No root = new No(6);\n No leaf = new No(9);\n \n bst.insert(null, root);\n //bst.printTree();\n \n bst.insert(root, new No(2));\n //bst.printTree();\n \n bst.insert(root, leaf);\n //bst.printTree();\n //System.err.println(); // Print[ERR] Devido a prioridade do buffer de impressao (out, err)\n \n assertEquals(leaf, bst.remove(leaf));\n assertEquals(new Integer(2), bst.size());\n //bst.printTree();\n }", "private Node getRoot( Node node )\n {\n // Base case: we are at root already. Simply return node.\n if (node.parent.equals(node))\n return node;\n // Recursive case: not at root, then find root, linking everything to\n // that root recursively on the way back. (This line does the path\n // compression part of the whole process.) When done, can return parent,\n // since that will now be overall tree root, wherever we started.\n node.parent = getRoot( node.parent );\n return node.parent;\n }", "protected Expression duplicateNodesUnderOps(Expression root, Fragment op) {\n Set<Expression> visited = new HashSet<>();\n if (duplicateNodesUnderOps(root, op, visited)) {\n return visited.iterator().next();\n }\n return null;\n }", "private Node<E> delete(E item, Node<E> root){\n\t\t/** the item to delete does not exist */\n\t\tif(root == null){\n\t\t\tdeleteReturn = null;\n\t\t\treturn root;\n\t\t}\n\t\t\n\t\tint comparison = item.compareTo(root.item);\n\t\t\n\t\t/** delete from the left subtree */\n\t\tif(comparison < 0){\n\t\t\troot.left = delete(item, root.left);\n\t\t\treturn root;\n\t\t}\n\t\t/** delete from the right subtree */\n\t\telse if(comparison > 0){\n\t\t\troot.right = delete(item, root.right);\n\t\t\treturn root;\n\t\t}\n\t\t/** the node to delete is found */\n\t\telse{\n\t\t\tdeleteReturn = root.item;\n\t\t\t\n\t\t\t/** the node is a leaf */\n\t\t\tif(root.left == null && root.right == null){\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t/** the node has one left child */\n\t\t\telse if(root.left != null && root.right == null){\n\t\t\t\treturn root.left;\n\t\t\t}\n\t\t\t/** the node has one right child */\n\t\t\telse if(root.left == null && root.right != null){\n\t\t\t\treturn root.right;\n\t\t\t}\n\t\t\t/** the node has two children */\n\t\t\telse{\n\t\t\t\t/**\n\t\t\t\t* the left child becomes the local root\n\t\t\t\t*/\n\t\t\t\tif(root.left.right == null){\n\t\t\t\t\troot.item = root.left.item;\n\t\t\t\t\troot.left = root.left.left;\n\t\t\t\t\treturn root;\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t* find the left-rightmost node and replace the local root's\n\t\t\t\t* item with that of left-rightmost node.\n\t\t\t\t*/\n\t\t\t\telse{\n\t\t\t\t\troot.item = findRightmost(root.left);\n\t\t\t\t\treturn root;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void rebalanceLeft(TreeNodeDataType n) {\n left(n);\r\n \r\n \r\n }", "public TreeNode pruneTree(TreeNode root) {\n if (containsOne(root) == false) {\n return null;\n } else {\n return root;\n }\n }", "public void fixViolationDelete(Node node){ \n\t\t\n\t while(node!=root && node.colour==\"Black\"){\n\t if(node==node.parent.left){\n\t \t//if the node is the left child and sibling is in the right\n\t Node sibling=node.parent.right;\n\t //check if the color of sibling is red then exchange the color with parent and rotate left \n\t if(sibling.colour == \"Red\"){\n\t \tsibling.colour = \"Black\";\n\t node.parent.colour = \"Red\";\n\t rotateLeft(node.parent);\n\t sibling=node.parent.right;\n\t }\n\t if(sibling.left.colour==\"Black\" && sibling.right.colour ==\"Black\"){\n\t \t//if both the children of sibling are black, change the color of the sibling and transfer the problem up the parent\n\t \tsibling.colour = \"Red\";\n\t node=node.parent;\n\t }\n\t else{ \n\t if(sibling.right.colour==\"Black\"){\n\t \t//if the left child of the sibling in red exchange the color of the sibling's child with sibling and color the child black\n\t \t// and rotate right\n\t \tsibling.left.colour = \"Black\";\n\t \tsibling.colour = \"Red\";\n\t rotateRight(sibling);\n\t sibling=node.parent.right;\n\t }\n\t //followed my the left rotation\n\t sibling.colour = node.parent.colour;\n\t node.parent.colour = \"Black\";\n\t sibling.right.colour = \"Black\";\n\t rotateLeft(node.parent);\n\t node=root;\n\t }\n\t }\n\t else{\n\t \t//node is the right child of the parent and sibling is the left child\n\t Node sibling=node.parent.left;\n\t \n\t if(sibling.colour == \"Red\"){\n\t \tsibling.colour = \"Black\";\n\t node.parent.colour = \"Red\";\n\t rotateRight(node.parent);\n\t sibling=node.parent.left;\n\t }\n\t \n\t if(sibling.right.colour==\"Black\" && sibling.left.colour==\"Black\"){\n\t \tsibling.colour = \"Red\";\n\t node=node.parent;\n\t }else{\n\t if(sibling.left.colour==\"Black\"){\n\t \tsibling.right.colour= \"Black\";\n\t \tsibling.colour = \"Red\";\n\t rotateLeft(sibling);\n\t sibling=node.parent.left;\n\t }\n\t \n\t sibling.colour = node.parent.colour;\n\t node.parent.colour = \"Black\";\n\t sibling.left.colour = \"Black\";\n\t rotateRight(node.parent);\n\t node=root;\n\t }\n\t }\n\t }\n\t //we color the node black\n\t node.colour = \"Black\";\n\t}", "private BinaryTreeNode getSuccessorFromRight(BinaryTreeNode node) {\n\n\t\tBinaryTreeNode nodeRight = node.right;\n\n\t\twhile(nodeRight.left != null) {\n\t\t\tnodeRight = nodeRight.left;\n\t\t}\n\n\t\treturn nodeRight;\n\n\t}", "public RBNode<T, E> searchRoot(RBNode<T, E> node) {\r\n\t\tRBNode<T, E> c = node;\r\n\t\tRBNode<T, E> p = node.parent;\r\n\t\t// While the parent of the current node is not null move up.\r\n\t\twhile (p != nillLeaf) {\r\n\t\t\tc = c.parent;\r\n\t\t}\r\n\t\t// c must be the root of the node being entered\r\n\t\t// return c which is the root.\r\n\t\treturn c;\r\n\t}", "Node<K, V> unwrapNode(Node<K, V> node) throws IOException;", "private void removeFixUp(RBNode<T> node, RBNode<T> parent) {\r\n RBNode<T> other;\r\n\r\n while((node == null || isBlack(node)) && (node != this.root)) {\r\n if(parent.left == node) { //node is leftChild\r\n other = parent.right; //brother of node\r\n if(isRed(other)) { //case1: brother is red\r\n setBlack(other);\r\n setRed(parent);\r\n leftRotate(parent);\r\n other = parent.right;\r\n }\r\n\r\n //case2: brother is black, both children of brother is black\r\n if((other.left == null || isBlack(other.left)) &&\r\n (other.right == null || isBlack(other.right))) {\r\n setRed(other);\r\n node = parent;\r\n parent = parentOf(node);\r\n } else {\r\n //case3: brother is black, left red right black\r\n if(other.right == null || isBlack(other.right)) {\r\n setBlack(other.left);\r\n setRed(other);\r\n rightRotate(other);\r\n other = parent.right;\r\n }\r\n\r\n //case4: brother is black, right red left any color\r\n setColor(other, colorOf(parent));\r\n setBlack(parent);\r\n setBlack(other.right);\r\n leftRotate(parent);\r\n node = this.root;\r\n break;\r\n }\r\n } else {\r\n other = parent.left;\r\n\r\n if (isRed(other)) {\r\n //case1: brother is red\r\n setBlack(other);\r\n setRed(parent);\r\n rightRotate(parent);\r\n other = parent.left;\r\n }\r\n\r\n if ((other.left==null || isBlack(other.left)) &&\r\n (other.right==null || isBlack(other.right))) {\r\n //case2: brother is black, both children of brother is black\r\n setRed(other);\r\n node = parent;\r\n parent = parentOf(node);\r\n } else {\r\n\r\n if (other.left==null || isBlack(other.left)) {\r\n //case3: brother is black, left red right black\r\n setBlack(other.right);\r\n setRed(other);\r\n leftRotate(other);\r\n other = parent.left;\r\n }\r\n\r\n //case4: brother is black, left red right any color\r\n setColor(other, colorOf(parent));\r\n setBlack(parent);\r\n setBlack(other.left);\r\n rightRotate(parent);\r\n node = this.root;\r\n break;\r\n }\r\n }\r\n }\r\n if (node!=null)\r\n setBlack(node);\r\n }", "public static Node delete (BST bst, String name){\n\t\tNode bstRoot = bst.getRoot();\n\t\tNode deletedNode = findByName(bstRoot, name); // The node to be removed from the bst.\n\t\tNode substituteNode = floorOrCeiling(deletedNode); // The substitute node for the removed one.\n\t\t\n\t\t\n\t\tSystem.out.println(\"\\nThe node to be deleted:\");\n\t\tSystem.out.println(deletedNode);\n\n\t\tSystem.out.println(\"\\nThe substitute for the deleted node:\");\n\t\tSystem.out.println(substituteNode);\n\t\t\n\t\t/* If the node to be removed is an external node, which has no children nodes,\n\t\t then there is no need for the substitute node. Thus, we can simply set the nodes\n\t\t that point to the external nodes to null to remove the node.\n\t\t*/\n\t\tif ((deletedNode.getRight()==null)&&(deletedNode.getLeft()==null)){\n\t\t\tif(deletedNode.getName().compareTo(deletedNode.getParent().getName())<0)\n\t\t\t\tdeletedNode.getParent().setLeft(null);\t\t\t\n\t\t\telse\n\t\t\t\tdeletedNode.getParent().setRight(null);\n\t\t\t\n\t\t\tdeletedNode.setLeft(null);\n\t\t\tdeletedNode.setRight(null);\n\t\t\tdeletedNode.setParent(null);\n\t\t\t\n\t\t\treturn bstRoot;\n\t\t}\n\t\t\n\t\t/* If the node to be removed is not a root node, we'll apply the general approach.\n\t\t*/\n\t\tif (deletedNode.getParent()!=null){\n\n\t\t\t/* If the name of the parent node of the substitute node precedes the one of the substitute,\n\t\t\t * then, set the right child of the parent node to a null unless the substitute node is a child\n\t\t\t * of the deleted node.\n\t\t\t */\n\t\t\tif(substituteNode.getParent().getName().compareTo(substituteNode.getName())<0)\t\t\t\n\t\t\t\tif(substituteNode == deletedNode.getRight())\n\t\t\t\t\tsubstituteNode.getParent().setRight(substituteNode.getRight());\n\t\t\t\telse\t\n\t\t\t\tsubstituteNode.getParent().setRight(null);\n\t\t\t\n\t\t\t/* If the name of the parent node of the substitute node succeeds the one of the substitute,\n\t\t\t * then, set the left child of the parent node to a null unless the substitute node is a child\n\t\t\t * of the deleted node.\n\t\t\t */\n\t\t\telse\n\t\t\t\tif(substituteNode == deletedNode.getLeft())\n\t\t\t\t\tsubstituteNode.getParent().setLeft(substituteNode.getLeft());\n\t\t\t\telse\n\t\t\t\t\tsubstituteNode.getParent().setLeft(null);\n\t\t\t\n\t\t\t\n\t\t\t/* If the name of the parent node of the deleted node succeed the one of the substitute,\n\t\t\t * then, set substitute node as the left child of the parent node of the deleted node.\n\t\t\t * Otherwise, set the substitute to the right child.\n\t\t\t */\n\t\t\tif(deletedNode.getParent().getName().compareTo(substituteNode.getName())>0)\n\t\t\t\tdeletedNode.getParent().setLeft(substituteNode);\n\t\t\t\t\n\t\t\telse\n\t\t\t\tdeletedNode.getParent().setRight(substituteNode);\t\t\t\n\t\t\t\n\n\t\t\t/* Duplicates the binding that the deleted node previously had.\n\t\t\t */\n\t\t\tsubstituteNode.setLeft(deletedNode.getLeft());\n\t\t\tsubstituteNode.setRight(deletedNode.getRight());\n\t\t\tsubstituteNode.setParent(deletedNode.getParent());\n\t\t\t\n\t\t\t\n\t\t\t/* If the deleted node has any child, then set the substitute node as their parent node.\n\t\t\t */\n\t\t\tif (deletedNode.getRight()!=null)\n\t\t\t\tdeletedNode.getRight().setParent(substituteNode);\n\t\t\t\n\t\t\tif (deletedNode.getLeft()!=null)\n\t\t\tdeletedNode.getLeft().setParent(substituteNode);\n\t\t\t\n\t\t\tdeletedNode.setLeft(null);\n\t\t\tdeletedNode.setRight(null);\n\t\t\tdeletedNode.setParent(null);\n\t\t}\t\n\t\t/* If the node to be removed is a root node, we'll approach a bit differently.\n\t\t*/\t\t\t\n\t\telse{\n\t\t\t/* Sets the child node of the parent of the substitute one to null.\n\t\t\t*/\t\t\t\n\t\t\tif(substituteNode.getParent().getName().compareTo(substituteNode.getName())<0)\n\t\t\t\tsubstituteNode.getParent().setRight(null);\n\t\t\telse\n\t\t\t\tsubstituteNode.getParent().setLeft(null);\n\t\t\t\n\t\t\t/* Duplicates the binding that the deleted node previously had without setting the parent node.\n\t\t\t */\n\t\t\tsubstituteNode.setLeft(deletedNode.getLeft());\n\t\t\tsubstituteNode.setRight(deletedNode.getRight());\n\t\t\t\n\t\t\t\n\t\t\t/* If the deleted node has any child, then set the substitute node as their parent node.\n\t\t\t*/\t\t\t\n\t\t\tif (deletedNode.getRight()!=null)\n\t\t\t\tdeletedNode.getRight().setParent(substituteNode);\n\t\t\t\n\t\t\tif (deletedNode.getLeft()!=null)\n\t\t\tdeletedNode.getLeft().setParent(substituteNode);\t\n\t\t\t\n\t\t\t\n\t\t\tdeletedNode.setLeft(null);\n\t\t\tdeletedNode.setRight(null);\n\t\t\tdeletedNode.setParent(null);\n\t\t\t\n\t\t\tSystem.out.println(\"\\nThe node \" + deletedNode + \" is removed from the tree successfully\\n\");\n\t\t\t\n\t\t\treturn substituteNode;\n\t\t}\n\t\t\n\t\tSystem.out.println(\"\\nThe node \" + deletedNode + \" is removed from the tree successfully\\n\");\n\n\n\t\treturn bstRoot;\n\t\t\n\t}", "private void doubleRotationLR(BinaryNode node) {\n BinaryNode temp = max(node.left);\n if (node == root) {\n root = temp;\n if (temp.parent.right == temp) { //temp could have a child on the left\n temp.parent.right = temp.left;\n if (temp.left != null) temp.left.parent = temp.parent;\n }\n else {\n temp.parent.left = temp.left;\n if (temp.left != null) temp.left.parent = temp.parent;\n }\n root.parent = null;\n root.right = node;\n root.left = node.left;\n if(node.left != null) node.left.parent = root;\n node.parent = root;\n node.left = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = temp;\n } else {\n node.parent.left = temp;\n }\n temp.parent = node.parent;\n temp.left = node.left;\n if(node.left != null) node.left.parent = temp;\n temp.right = node;\n node.parent = temp;\n node.left = null;\n }\n }", "public AVLNode findSuccessor(IAVLNode node) {\n\n\t\tif (node.getRight().getHeight() != -1) {\n\t\t\tAVLTree subtree = new AVLTree(node.getRight());\n\t\t\treturn subtree.findMin();\n\t\t}\n\t\tAVLNode parent = (AVLNode) node.getParent();\n\t\tAVLNode ourNode = (AVLNode) node;\n\t\twhile (parent.getHeight() != -1 && parent == ourNode.getParent() && ourNode.parentSide() != 'L') {\n\t\t\tourNode = parent;\n\t\t\tparent = (AVLNode) ourNode.getParent();\n\t\t}\n\t\treturn parent;\n\t}", "private Node<E> findSet(Node<E> x) {\n if (x != x.parent) {\n Node<E> p = findSet(x.parent);\n x.parent.children.remove(x);\n p.children.add(x);\n x.parent = p;\n }\n return x.parent;\n }", "public List<TreeNode> findDuplicateSubtrees(TreeNode root) {\n // like i thought, we can take the advantage of the serialization of the tree node\n // that is how we can put them into the map and check if there already exsit the same serials\n List<TreeNode> ans = new ArrayList<>();\n dfspostorder(root,new HashMap<String,Integer>(),ans);\n return new ArrayList<TreeNode>(ans);\n }", "private Node caseOneChild(Node deleteThis) {\r\n\r\n Node child, parent;\r\n if (deleteThis.getLeft() != null) {\r\n child = deleteThis.getLeft();\r\n } else {\r\n child = deleteThis.getRight();\r\n }\r\n parent = deleteThis.getParent();\r\n child.setParent(parent);\r\n\r\n\r\n if (parent == null) {\r\n this.root = child; // Poistettava on juuri\r\n return deleteThis;\r\n }\r\n if (deleteThis == parent.getLeft()) {\r\n parent.setLeft(child);\r\n } else {\r\n parent.setRight(child);\r\n }\r\n return deleteThis;\r\n }", "private void removeNode(AVLNode<T, U> node){\n\t\tAVLNode<T, U> newNode = null;\n\t\t\n\t\tif(node.getLeft() == null && node.getRight() == null){\n\t\t\t//If the node is a leaf, I delete it and I recompute \n\t\t\t//the heights and check the balance starting from its parent\n\t\t\tnewNode = node.getParent();\n\t\t\tthis.transplant(node, null);\n\t\t}else if(node.getLeft() == null){\n\t\t\tnewNode = node.getRight();\n\t\t\tthis.transplant(node, newNode);\n\t\t}else if(node.getRight() == null){\n\t\t\tnewNode = node.getLeft();\n\t\t\tthis.transplant(node, newNode);\n\t\t}else{\n\t\t\tnewNode = getMinimum(node.getRight());\n\t\t\tif(newNode.getParent() != node){\n\t\t\t\tthis.transplant(newNode, newNode.getRight());\n\t\t\t\tnewNode.setRight(node.getRight());\n\t\t\t\tnewNode.getRight().setParent(newNode);\n\t\t\t}\n\t\t\tthis.transplant(node, newNode);\n\t\t\tnewNode.setLeft(node.getLeft());\n\t\t\tnewNode.getLeft().setParent(newNode);\n\t\t}\n\t\tcomputeHeights(newNode);\n\t\tbalanceTree(newNode);\n\t}", "private Node findKey(Node R, String targetKey){ \n if(R == null || R.item.key.equals(targetKey)) return R;\n if(R.item.key.compareToIgnoreCase(targetKey)>0) return findKey(R.left, targetKey);\n else return findKey(R.right, targetKey); //(R.item.key.compareToIgnoreCase(targetKey)>0) \n }", "private BinaryNode<E> _findNode(BinaryNode<E> node, E e) {\n\t\tif (node == null)\n\t\t\treturn null;\n\t\telse if (comparator.compare(e, node.getData()) < 0) // *****CHANGE THIS for HW#4*****\n\t\t\treturn _findNode(node.getLeftChild(), e);\n\t\telse if (comparator.compare(e, node.getData()) > 0) // *****CHANGE THIS for HW#4*****\n\t\t\treturn _findNode(node.getRightChild(), e);\n\t\telse // found it!\n\t\t\treturn node;\n\t}", "private Node caseNoChildren(Node deleteThis) {\r\n\r\n Node parent = deleteThis.getParent();\r\n\r\n if (parent == null) {\r\n this.root = null; // Kyseessä on juuri\r\n return deleteThis;\r\n }\r\n if (deleteThis == parent.getLeft()) {\r\n parent.setLeft(null);\r\n } else {\r\n parent.setRight(null);\r\n }\r\n return deleteThis;\r\n }", "@Override\n public boolean shouldContinueSwitchedRootFound() {\n return false;\n }", "public TreeNode resolve(TreeNode root, TreeNode node){\n if (root == null) {\n return node;\n }\n else if(root.val > node.val){ // no replace, keep going down\n root.right = resolve(root.right, node);\n return root;\n }\n else { // new biggest, old root becomes left child\n node.left = root;\n root = null;\n return node;\n }\n }", "private Node getSuccessor(Node delNode) {\n Node successorParent = delNode;\n Node successor = delNode;\n Node current = delNode.rightChild;\n while (current != null) {\n // go to right child until no more left children\n successorParent = successor;\n successor = current;\n current = current.leftChild;\n }\n if (successor != delNode.rightChild) {\n successorParent.leftChild = successor.rightChild;\n successor.rightChild = delNode.rightChild;\n }\n return successor;\n }", "private RegressionTreeNode traverseNominalNode(Serializable value) {\n\t\tif(value.equals(this.value)){\n\t\t\treturn this.leftChild;\n\t\t}else{\n\t\t\treturn this.rightChild;\n\t\t}\n\t}", "@Test\n public void remove_BST_1_CaseLeafLeft()\n {\n BinarySearchTree bst = new BinarySearchTree();\n No root = new No(6);\n No leaf = new No(2);\n \n bst.insert(null, root);\n //bst.printTree();\n \n bst.insert(root, new No(9));\n //bst.printTree();\n \n bst.insert(root, leaf);\n //bst.printTree();\n //System.err.println(); // Print[ERR] Devido a prioridade do buffer de impressao (out, err)\n \n assertEquals(leaf, bst.remove(leaf));\n assertEquals(new Integer(2), bst.size());\n //bst.printTree();\n }", "private AvlNode<E> remove(Comparable<E> element, AvlNode<E> node){\n if(node == null) {\n return node;\n } else if(node.value.compareTo((E)element) > 0){\n node.left = remove(element, node.left);\n } else if(node.value.compareTo((E)element) < 0){\n node.right = remove(element, node.right);\n } else {\n if(node.left == null && node.right == null){\n return null;\n } else if(node.left == null){\n return node.right;\n } else if(node.right == null){\n return node.left;\n } else {\n AvlNode<E> replacement = findMax(node.left);\n replacement.left = remove(replacement.value, node.left);\n replacement.right = node.right;\n return replacement;\n }\n }\n\n if(height(node.left) - height(node.right) > 1){\n if(height(node.left.left) > height(node.left.right)){\n node = rotateWithLeftChild(node);\n } else {\n node = doubleWithLeftChild(node);\n }\n } else if(height(node.left) - height(node.right) < -1){\n if(height(node.right.right) > height(node.right.left)){\n node = rotateWithRightChild(node);\n } else {\n node = doubleWithRightChild(node);\n }\n }\n node.height = max(height(node.left), height(node.right)) + 1;\n return node;\n }", "public int delete(int k) {\n\t\tif (this.empty()) {// empty tree, nothing to erase\n\t\t\treturn -1;\n\t\t}\n\t\tAVLNode root = (AVLNode) this.root;\n\t\tAVLNode node = (AVLNode) root.delFindNode(k);\n\t\tif (node == null) {// no node with key==k in this tree\n\t\t\treturn -1;\n\t\t}\n\t\tchar side = node.parentSide();\n\t\tboolean rootTerm = (node.getLeft().getKey() != -1 && node.getRight().getKey() != -1);\n\t\tif (side == 'N' && (rootTerm == false)) {\n\t\t\treturn this.deleteRoot(node);\n\t\t}\n\t\tif (side == 'L') {\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.parent.getRight().getHeight();\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tif (leftEdge == 1 && rightEdge == 1) {// first case (\"easy one\", just delete)\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.updateSize();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (leftEdge == 1 && rightEdge == 2) {\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.setHeight(parent.getHeight() - 1);\n\t\t\t\t\tparent.setSize();\n\t\t\t\t\treturn this.delRecTwos(parent);\n\t\t\t\t} else {// leftEdge==2&&rightEdge==1\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\treturn this.delRecTriOne(parent, side);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((node.left != null && node.right == null) || (node.left == null && node.right != null)) {// node is //\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// unary\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.parent.getRight().getHeight();\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\tAVLNode parent = node.delUnaryLeft();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\tAVLNode parent = node.delUnaryRight();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 2)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryLeft());\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryRight());\n\t\t\t\t\t}\n\t\t\t\t} else {// leftEdge==2&&rightEdge==1\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryLeft(), side);\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryRight(), side);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif (side == 'R') {\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.parent.getLeft().getHeight();\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tif (leftEdge == 1 && rightEdge == 1) {// first case (\"easy one\", just delete)\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.updateSize();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (leftEdge == 2 && rightEdge == 1) {\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.setHeight(parent.getHeight() - 1);\n\t\t\t\t\tparent.setSize();\n\t\t\t\t\treturn this.delRecTwos(parent);\n\t\t\t\t} else {// leftEdge==1&&rightEdge==2\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\treturn this.delRecTriOne(parent, side);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((node.getLeft().getHeight() != -1 && node.getRight().getHeight() == -1)\n\t\t\t\t\t|| (node.getLeft().getHeight() == -1 && node.getRight().getHeight() != -1)) {// node is unary\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.parent.getLeft().getHeight();\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\tAVLNode parent = node.delUnaryLeft();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\tAVLNode parent = node.delUnaryRight();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ((leftEdge == 2 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryLeft());\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryRight());\n\t\t\t\t\t}\n\t\t\t\t} else {// leftEdge==1&&rightEdge==2\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryLeft(), side);\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryRight(), side);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t// we get here only if node is binary, and thus not going through any other\n\t\t// submethod\n\t\tAVLNode successor = this.findSuccessor(node); // successor must be unary/leaf\n\t\tif (node.checkRoot()) {\n\t\t\tthis.root = successor;\n\t\t}\n\t\tint numOp = this.delete(successor.key);\n\t\tsuccessor.setHeight(node.getHeight());\n\t\tsuccessor.size = node.getSize();\n\t\tsuccessor.setRight(node.getRight());\n\t\tnode.right.setParent(successor);\n\t\tnode.setRight(null);\n\t\tsuccessor.setLeft(node.getLeft());\n\t\tnode.left.setParent(successor);\n\t\tnode.setLeft(null);\n\t\tsuccessor.setParent(node.getParent());\n\t\tif (node.parentSide() == 'L') {\n\t\t\tnode.parent.setLeft(successor);\n\t\t} else if (node.parentSide() == 'R') {// node.parentSide()=='R'\n\t\t\tnode.parent.setRight(successor);\n\t\t}\n\t\tnode.setParent(null);\n\t\treturn numOp;\n\n\t}", "public Node applyTo(Node root, Set<Node> finalNodes) throws RewriteException, RepositoryException {\n if (!ruleNode.hasNode(\"replacement\")) {\n throw new RewriteException(\"The rule does not define a replacement node\");\n }\n\n // if the replacement node has no children, we replace the tree by the empty tree,\n // i.e. we remove the original tree\n Node replacement = ruleNode.getNode(\"replacement\");\n if (!replacement.hasNodes()) {\n root.remove();\n return null;\n }\n\n // true if the replacement tree is final and all its nodes are excluded from\n // further processing by the algorithm\n boolean treeIsFinal = false;\n if (replacement.hasProperty(PROPERTY_IS_FINAL)) {\n treeIsFinal = replacement.getProperty(PROPERTY_IS_FINAL).getBoolean();\n }\n\n // Set the flag if we need to copy all original children nodes to target.\n boolean copyChildren = false;\n /**\n * Approach:\n * - we move (rename) the tree to be rewritten to a temporary name\n * - we copy the replacement tree to be a new child of the original tree's parent\n * - we process the copied replacement tree (mapped properties, children etc)\n * - at the end, we remove the original tree\n */\n\n // move (rename) original tree\n Node parent = root.getParent();\n String rootName = root.getName();\n RewriteUtils.rename(root);\n\n // copy replacement to original tree under original name\n Node replacementNext = replacement.getNodes().nextNode();\n Node copy = JcrUtil.copy(replacementNext, parent, rootName);\n\n // collect mappings: (node in original tree) -> (node in replacement tree)\n Map<String, String> mappings = new HashMap<>();\n Map<String, String> mappingOrder = new HashMap<>();\n // traverse nodes of newly copied replacement tree\n TreeTraverser traverser = new TreeTraverser(copy);\n Iterator<Node> nodeIterator = traverser.iterator();\n\n\n while (nodeIterator.hasNext()) {\n Node node = nodeIterator.next();\n // iterate over all properties\n PropertyIterator propertyIterator = node.getProperties();\n Node rewritePropertiesNode = null;\n\n if (node.hasNode(NN_CQ_REWRITE_PROPERTIES)) {\n rewritePropertiesNode = node.getNode(NN_CQ_REWRITE_PROPERTIES);\n }\n\n while (propertyIterator.hasNext()) {\n Property property = propertyIterator.nextProperty();\n // skip protected properties\n if (property.getDefinition().isProtected()) {\n continue;\n }\n\n // add mapping to collection\n if (PROPERTY_MAP_CHILDREN.equals(property.getName())) {\n mappings.put(property.getString(), node.getPath());\n // remove property, as we don't want it to be part of the result\n property.remove();\n continue;\n }\n // Add the mapping order\n if (PROPERTY_ORDER_BEFORE.equals(property.getName())) {\n mappingOrder.put(node.getName(), property.getString());\n // remove order, as we don't want it to be part of the result\n property.remove();\n continue;\n }\n\n // add single node to final nodes\n if (PROPERTY_IS_FINAL.equals(property.getName())) {\n if (!treeIsFinal) {\n finalNodes.add(node);\n }\n property.remove();\n continue;\n }\n\n // Do we copy all of the children?\n if (PROPERTY_COPY_CHILDREN.equals(property.getName())) {\n copyChildren = property.getBoolean();\n property.remove();\n continue;\n }\n\n // set value from original tree in case this is a mapped property\n Property mappedProperty = mapProperty(root, property);\n\n if (mappedProperty != null && rewritePropertiesNode != null) {\n if (rewritePropertiesNode.hasProperty(\"./\" + mappedProperty.getName())) {\n rewriteProperty(property, rewritePropertiesNode.getProperty(\"./\" + mappedProperty.getName()));\n }\n }\n }\n\n // remove <cq:rewriteProperties> node post-mapping\n if (rewritePropertiesNode != null) {\n rewritePropertiesNode.remove();\n }\n }\n\n // copy children from original tree to replacement tree according to the mappings found, preserve order\n if (copyChildren || !mappings.isEmpty()) {\n Session session = root.getSession();\n NodeIterator children = root.getNodes();\n while (children.hasNext()) {\n Node child = children.nextNode();\n\n boolean foundMapping = false;\n for (Map.Entry<String, String> mapping : mappings.entrySet()) {\n // Don't process an unmapped key\n if (!root.hasNode(mapping.getKey())) {\n continue;\n }\n\n // Don't process this node if it isn't the one in the sequence.\n Node mappedSource = root.getNode(mapping.getKey());\n if (!mappedSource.getPath().equals(child.getPath())) {\n continue;\n }\n foundMapping = true;\n Node destination = session.getNode(mapping.getValue());\n NodeIterator iterator = child.getNodes();\n // copy over the source's children to the destination\n while (iterator.hasNext()) {\n Node n = iterator.nextNode();\n JcrUtil.copy(n, destination, n.getName());\n }\n }\n if (copyChildren && !foundMapping) {\n // Just copy it over if we're copying everything\n JcrUtil.copy(child, copy, child.getName());\n }\n }\n\n // now that everything is copied, reorder\n for (Map.Entry<String, String> orderEntry : mappingOrder.entrySet()) {\n copy.orderBefore(orderEntry.getKey(), orderEntry.getValue());\n }\n }\n\n doAdditionalApplyTo(root, copy, replacement);\n\n // we add the complete subtree to the final nodes\n if (treeIsFinal) {\n traverser = new TreeTraverser(copy);\n nodeIterator = traverser.iterator();\n while (nodeIterator.hasNext()) {\n finalNodes.add(nodeIterator.next());\n }\n }\n\n // remove original tree and return rewritten tree\n root.remove();\n return copy;\n }", "Optional<Node<UnderlyingData>> prevNode(Node<UnderlyingData> node);", "private long replace(long r, Node change) throws IOException {\n Node current = new Node(r);\r\n if (current.right != 0) {\r\n current.right = replace(current.right, change);\r\n current.height = getHeight(current);\r\n current.writeNode(r);\r\n int heightDifference = getHeightDifference(r);\r\n if (heightDifference < -1) {\r\n if (getHeightDifference(current.right) > 0) {\r\n current.right = rightRotate(current.right);\r\n current.writeNode(r);\r\n return leftRotate(r);\r\n }\r\n else {\r\n return leftRotate(r);\r\n }\r\n }\r\n else if (heightDifference > 1) {\r\n if (getHeightDifference(current.left) < 0) {\r\n current.left = leftRotate(current.left);\r\n current.writeNode(r);\r\n return rightRotate(r);\r\n }\r\n else {\r\n return rightRotate(r);\r\n }\r\n }\r\n return r;\r\n }\r\n else {\r\n change.key = current.key;\r\n change.fields = current.fields;\r\n addToFree(r);\r\n return current.left;\r\n }\r\n }", "private List<TreeNode> translatePath(List path, TreeNode node) {\n \n // TODO: Find the correct node given two identical paths. \n // For example suppose we have two paths Classes/String and Classes/String.\n // This method will always translate to the first path, regardless of the\n // actual path given.\n \n List tail = new ArrayList();\n tail.addAll(path);\n Object target = tail.remove(0);\n \n if (!node.toString().equals(target.toString())) {\n return null;\n }\n \n List<TreeNode> newPath = new ArrayList<TreeNode>();\n newPath.add(node);\n \n // no more nodes to find, just return this one\n if (tail.isEmpty()) return newPath;\n \n Enumeration e = node.children();\n while(e.hasMoreElements()) {\n TreeNode child = (TreeNode)e.nextElement();\n List nodes = translatePath(tail, child);\n if (nodes != null) {\n newPath.addAll(nodes);\n return newPath;\n }\n }\n \n // the path was not found under this subtree\n return null;\n }", "private PersistentLinkedList<T> pop() {\n //the latest element won't become empty\n int index = this.treeSize - 1;\n Node<T> newRoot = new Node<>(branchingFactor);\n\n Node<T> currentNode = this.root;\n Node<T> currentNewNode = newRoot;\n\n ArrayList<Node<T>> newNodes = new ArrayList<>();\n newNodes.add(newRoot);\n ArrayList<Integer> newNodesIndices = new ArrayList<>();\n\n for (int b = base; b > 1; b = b / branchingFactor) {\n TraverseData traverseData = traverseOneLevel(\n new TraverseData(currentNode, currentNewNode, newRoot, index, b));\n currentNode = traverseData.currentNode;\n currentNewNode = traverseData.currentNewNode;\n newNodes.add(currentNewNode);\n newNodesIndices.add(index / b);\n index = traverseData.index;\n }\n newNodesIndices.add(index);\n\n for (int i = 0; i < branchingFactor && i < index; i++) {\n currentNewNode.set(i, currentNode.get(i));\n }\n currentNewNode.set(index, null);\n\n if (index == 0) {\n int latestIndex = newNodes.size() - 2;\n newNodes.get(latestIndex).set(newNodesIndices.get(latestIndex), null);\n\n for (int i = latestIndex; i > 0; i--) {\n if (newNodesIndices.get(i) == 0) {\n newNodes.get(i - 1).set(newNodesIndices.get(i - 1), null);\n } else {\n break;\n }\n }\n }\n\n if (newNodes.size() > 1) {\n int nonNullChildren = 0;\n for (Node<T> child : newRoot.children) {\n if (child != null) {\n nonNullChildren++;\n }\n }\n if (nonNullChildren == 1) { //need new root\n newRoot = newRoot.get(0);\n return new PersistentLinkedList<>(newRoot, this.branchingFactor, this.depth - 1,\n this.base / branchingFactor, this.treeSize - 1, unusedTreeIndices,\n indexCorrespondingToTheFirstElement, indexCorrespondingToTheLatestElement);\n }\n }\n return new PersistentLinkedList<>(newRoot, this.branchingFactor, this.depth, this.base,\n this.treeSize - 1, unusedTreeIndices, indexCorrespondingToTheFirstElement,\n indexCorrespondingToTheLatestElement);\n }", "@SuppressWarnings(\"ReferenceEquality\") // cannot use equals() for check whether tree is the same\n private PersistentSortedMap<K, V> mapFromTree(@Var @Nullable Node<K, V> newRoot) {\n if (newRoot == root) {\n return this;\n } else if (newRoot == null) {\n return of();\n } else {\n // Root is always black.\n newRoot = newRoot.withColor(Node.BLACK);\n return new PathCopyingPersistentTreeMap<>(newRoot);\n }\n }", "private BSTNode<E> successor(BSTNode<E> node) {\n\t\treturn null;\n\t}", "private Node locatePrevNode(K key) { \n\t\tNode p = null; \n\t\tNode current = first; \n\t\twhile (current != null && current.getData().getKey().compareTo(key) < 0) {\n\t\t\tp = current; \n\t\t\tcurrent = current.getNext(); \n\t\t}\n\t\treturn p; \n\t}", "void fixViolation(Node node){\n\t\tNode parentPtr = nil;\n\t\tNode grParentPtr = nil;\n\t\t\n\t\twhile( node != root && node.colour != \"Black\" && node.parent.colour == \"Red\" && node.parent.parent != nil){\n\t\t\t\n\t\t\tparentPtr = node.parent;\n\t\t\tgrParentPtr = node.parent.parent;\n\t\t\t//case A\n\t\t\t//parent of node is the left child of grandparent\n\t\t\tif(parentPtr == grParentPtr.left){\n\t\t\t\tNode unclePtr = grParentPtr.right;\n\t\t\t\t\n\t\t\t\t//case 1 \n\t\t\t\t//Uncle is red in color\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//of node is the right child of its parent\n\t\t\t\t\tif(node == parentPtr.right){\n\t\t\t\t\t\trotateLeft(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the left child of its parent left rotation is required\n\t\t\t\t\trotateRight(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//case B\n\t\t\t//parent of the node is the right child of grand parent\n\t\t\tif(parentPtr == grParentPtr.right){\n\t\t\t\tNode unclePtr = grParentPtr.left;\n\t\t\t\t//case 1\n\t\t\t\t//uncle pointer is red\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//node is the left child of its parent right rotation is required\n\t\t\t\t\tif(node == parentPtr.left){\n\t\t\t\t\t\trotateRight(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the right child of its parent left rotation is required\n\t\t\t\t\trotateLeft(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\troot.colour = \"Black\";\n\t}", "private void replaceNode(Node curr, Node child, AtomicReference<Node> rootRef) {\n\t\tchild.parent = curr.parent;\n if(curr.parent == null) {\n \trootRef.set(child);\n }\n else {\n if(isLeftChild(curr)) {\n \tcurr.parent.left = child;\n } else {\n \tcurr.parent.right = child;\n }\n }\n\t}", "private E removeNode(Node n) {\n \tassert (n != sentinel);\n \tn.succ.pred = n.pred;\n \tn.pred.succ = n.succ;\n \tsize--;\n \treturn n.data;\n }", "private int FixAVLtree(IAVLNode node)\r\n\t{\r\n\t\tif (node.isRealNode()) \r\n\t\t{\r\n\t\t\tif(BFCalc(node) == -2) \r\n\t\t\t{\r\n\t\t\t\t//in insert we need to fix if BFCalc(node.getLeft())==-1\r\n\t\t\t\t//in delete we need to fix if BFCalc(node.getLeft())==0 or -1\r\n\t\t\t\tint rightBF=BFCalc(node.getRight());\r\n\t\t\t\tif(rightBF==0||rightBF==-1) {\r\n\t\t\t\t\tRRRotation(node);\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t} \r\n\t\t\t\telse \r\n\t\t\t\t{ \r\n\t\t\t\t\tRLRotation(node);\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse //if BFCalc(node) == 2 \r\n\t\t\t{\r\n\t\t\t\t//in insert we need to fix if BFCalc(node.getLeft())==1\r\n\t\t\t\t//in delete we need to fix if BFCalc(node.getLeft())==0 or 1\r\n\t\t\t\tint leftBF=BFCalc(node.getLeft());\r\n\t\t\t\tif(leftBF==1 ||leftBF==0) \r\n\t\t\t\t{\r\n\t\t\t\t\tLLRotation(node);\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{ \r\n\t\t\t\t\tLRRotation(node);\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t} \r\n\t\t} \r\n\t\t\treturn 0;\r\n\t}", "private BinaryTreeNode findNode(T item) {\n\t\tif (item.equals(root.data)) {\n\t\t\treturn root;\n\t\t}\n\n\t\telse return findNodeRecursive(item, root);\n\t}", "@Override\n protected void rebalanceInsert(Position<Entry<K, V>> p) {\n if (!isRoot(p)) {\n makeRed(p);\n resolveRed(p); // The inserted red node may cause a double-red problem\n }\n }", "private Node searchAux(Node tree, K key) {\n if(root == null) { return null; } //empty tree\n int cmp = key.compareTo(tree.key);\n if(cmp == 0 || cmp < 0 && tree.left == null || cmp > 0 && tree.right == null) { //found the node or last checked\n comparisons += 1;\n return tree;\n }\n if(cmp < 0) {\n comparisons += 1;\n return searchAux(tree.left, key);\n } else {\n comparisons += 1;\n return searchAux(tree.right, key);\n }\n }", "public int deleteRoot(AVLNode node) { // root is unary node or leaf\n\t\tif (node.isLeaf()) {\n\t\t\tthis.root = null;\n\t\t} else { // root is unary\n\t\t\tif (node.getRight().getHeight() != -1) { // root has a right child\n\t\t\t\tthis.root = node.getRight();\n\t\t\t\tnode.getRight().setParent(null);\n\t\t\t\tnode.setRight(null);\n\t\t\t} else { // root has a left child\n\t\t\t\tthis.root = node.getLeft();\n\t\t\t\tnode.getLeft().setParent(null);\n\t\t\t\tnode.setLeft(null);\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}", "public boolean deleteLeaf(int d, Leaf root){\n //hacemos la búsqueda del nodo y de su padre\n Leaf f, s;\n s = fetch(d, root);\n f = getFather(s, root);\n \n //Preguntamos si tiene hijos\n boolean l = s.left != null;\n boolean r = s.right != null;\n \n //Si no tiene hijos\n if(!l && !r){\n //Eliminamos nodo según caso 1\n //Si es el hijo de la izquierda, la apuntamos a NULL, caso contrario apuntamos hijo derecho a NULL.\n if(f.left == s){\n f.left = null;\n }else{\n f.right = null;\n }\n return true;\n }else if(!l && r){\n //Eliminamos nodo según caso 2, solo hijos a la derecha\n if (f.left == s){ //Si es el hijo de la izquierda\n f.left = s.right; //los hijos derechos del nodo eliminado se cuelgan en el brazo izquierdo de su padre\n }else{ //Si es el hijo de la derecha\n f.right = s.right;//los hijos erechos del nodo eliminado se cuelgan del brazo derecho de su padre\n }\n return true;\n }else if(l && !r){\n //Eliminamos nodo según caso 2, solo hijos a la izquierda\n if (f.left == s){\n f.left = s.left;\n }else{\n f.right = s.left;\n }\n return true;\n }else if(l && r){\n //Eliminamos nodo según caso 3\n //Obtenemos el nodo mas a la izquierda de su derecha\n Leaf ml = mostLeft(s.right);\n //Sustituimos el dato del nodo hijo por el de mas a la izquierda\n s.setData(ml.getData());\n //Eliminamos most left\n return deleteLeaf(ml.getData(), ml);\n }else{\n return false;\n }\n }", "public void RecursiveExpansion() throws TreeTooBigException {\r\n int transIndex; //Index to count transitions\r\n int[] newMarkup; //markup used to create new node\r\n boolean aTransitionIsEnabled = false; //To check for deadlock\r\n //Attribute used for assessing whether a node has occured before\r\n boolean repeatedNode = false; \r\n \r\n boolean allOmegas = false;\r\n \r\n boolean[] enabledTransitions = \r\n tree.dataLayer.getTransitionEnabledStatusArray(markup);\r\n\r\n //For each transition\r\n for (int i = 0; i < enabledTransitions.length; i++) {\r\n if (enabledTransitions[i] == true) {\r\n //Set transArray of to true for this index\r\n transArray[i] = true;\r\n \r\n //System.out.println(\"\\n Transition \" + i + \" Enabled\" );\r\n aTransitionIsEnabled = true;\r\n \r\n //print (\"\\n Old Markup is :\", markup);//debug\r\n \r\n //Fire transition to produce new markup vector\r\n newMarkup = fire(i);\r\n \r\n //print (\"\\n New Markup is :\", newMarkup);//debug\r\n \r\n //Check for safeness. If any of places have > 1 token set variable.\r\n for (int j = 0; j < newMarkup.length; j++) {\r\n if (newMarkup[j] > 1 || newMarkup[j] == -1) {\r\n tree.moreThanOneToken = true;\r\n break;\r\n }\r\n } \r\n \r\n //Create a new node using the new markup vector and attach it to\r\n //the current node as a child.\r\n children[i] = \r\n new myNode(newMarkup, this, tree, depth + 1);\r\n \r\n /* Now need to (a) check if any omegas (represented by -1) need to \r\n * be inserted in the markup vector of the new node, and (b) if the \r\n * resulting markup vector has appeared anywhere else in the tree. \r\n * We must do (a) before (b) as we need to know if the new node \r\n * contains any omegas to be able to compare it with existing nodes. \r\n */ \r\n allOmegas = children[i].InsertOmegas();\r\n \r\n //check if the resulting markup vector has occured anywhere else in the tree\r\n repeatedNode = (tree.root).FindMarkup(children[i]);\r\n \r\n if (tree.nodeCount >= Pipe.MAX_NODES && !tree.tooBig) {\r\n tree.tooBig = true;\r\n throw new TreeTooBigException();\r\n }\r\n \r\n if (!repeatedNode && !allOmegas) {\r\n children[i].RecursiveExpansion();\r\n }\r\n }\r\n }\r\n \r\n if (!aTransitionIsEnabled) {\r\n System.err.println(\"No transition enabled\");\r\n if (!tree.noEnabledTransitions || tree.pathToDeadlock.length < depth-1) {\r\n RecordDeadlockPath();\r\n tree.noEnabledTransitions = true;\r\n } else {\r\n System.err.println(\"Deadlocked node found, but path is not shorter\"\r\n + \" than current path.\");\r\n }\r\n } else {\r\n //System.out.println(\"Transitions enabled.\");\r\n }\r\n }", "public void removeNode(N node)\r\n/* 71: */ {\r\n/* 72:135 */ assert (checkRep());\r\n/* 73:137 */ for (N endNode : getSuccessors(node)) {\r\n/* 74:138 */ ((Map)this.map.get(endNode)).remove(node);\r\n/* 75: */ }\r\n/* 76:140 */ this.map.remove(node);\r\n/* 77: */ }", "private T removeNode(Node<T> curr, Node<T> parent) { //Time Complexity: O(n)\n T returnData;\n //checks if there are two children\n if (curr.left != null && curr.right != null) {\n Node<T> leftparent = curr;\n Node<T> RML = curr.left;\n //finds right most left node\n while (RML.right != null) {\n leftparent = RML;\n RML = RML.right;\n }\n returnData = curr.data;\n curr.data = RML.data;\n removeNode(RML, leftparent);\n return returnData;\n } else {\n //deals with 0 and 1 child\n Node<T> here = curr.left;\n if (here == null) {\n here = curr.right;\n }\n if (parent == null) {\n root = here;\n } else {\n if (curr == parent.left) {\n parent.left = here;\n } else {\n parent.right = here;\n }\n }\n returnData = curr.data;\n }\n return returnData;\n }", "public Node getSuccessor(Node element) {\r\n\t\tNode successor = null;\r\n\t\tif (element.getRightChild() != null) {\r\n\t\t\tsuccessor = element.getRightChild();\r\n\t\t\tif (successor.getLeftChild() == null) {\r\n\t\t\t\tsuccessor = element.getRightChild();\r\n\t\t\t} else {\r\n\t\t\t\twhile (successor.getLeftChild() != null) {\r\n\t\t\t\t\tsuccessor = successor.getLeftChild();\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tSystem.out.println(\"No right tree\");\r\n\t\t\tif (element.isRoot()) {\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t\tsuccessor = element;\r\n\t\t\tSystem.out.println(\"-- \" + element.getKey());\r\n\t\t\tNode leftChild = successor.getParent().getLeftChild();\r\n\t\t\tif (leftChild == null) {\r\n\t\t\t\tleftChild = successor.getParent();\r\n\t\t\t}\r\n\t\t\twhile (!successor.getParent().equals(root) && !leftChild.equals(successor)) {\r\n\t\t\t\tSystem.out.println(\"In loop\");\r\n\t\t\t\tsuccessor = successor.getParent();\r\n\t\t\t\tleftChild = successor.getParent().getLeftChild();\r\n\t\t\t\tif (leftChild == null) {\r\n\t\t\t\t\tleftChild = successor.getParent();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (successor.getKey() > element.getKey()) {\r\n\t\t\t\tsuccessor = successor.getParent();\r\n\t\t\t} else {\r\n\t\t\t\tsuccessor = null;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn successor;\r\n\t}", "private void slowscan(State state,SuffixNode currNode,int j){ \n boolean done = false; \n int keyLen = text.length() - j; \n for(int i=0;i<currNode.children.size();i++){ \n SuffixNode child = currNode.children.get(i); \n \n //use min(child.key.length, key.length) \n int childKeyLen = child.getLength(); \n int len = childKeyLen<keyLen?childKeyLen:keyLen; \n int delta = 0; \n for(;delta<len;delta++){ \n if(text.charAt(j+delta) != text.charAt(child.start+delta)){ \n break; \n } \n } \n if(delta==0){//this child doesn't match any character with the new key \n //order keys by lexi-order \n if(text.charAt(j) < text.charAt(child.start)){ \n //e.g. child=\"e\" (currNode=\"abc\") \n // abc abc \n // / \\ =========> / | \\ \n // e f insert \"c^\" c^ e f \n int pathlen = text.length() - j + currNode.pathlen; \n SuffixNode node = new SuffixNode(text,j,text.length()-1,pathlen); \n currNode.children.add(i,node); \n //state.u = currNode; //currNode is already registered as state.u, so commented out \n state.v = currNode; \n state.finished = true; \n done = true; \n break; \n }else{ //key.charAt(0)>child.key.charAt(0) \n //don't forget to add the largest new key after iterating all children \n continue; \n } \n }else{//current child's key partially matches with the new key \n if(delta==len){ \n if(keyLen>childKeyLen){ //suffix tree with ^ ending can't have other two cases \n //e.g. child=\"ab\" \n // ab ab \n // / \\ ==========> / | \\ \n // e f insert \"abc^\" c^ e f \n //recursion \n state.u = child; \n j += childKeyLen; \n state.j = j; \n slowscan(state,child,j); \n } \n }else{//0<delta<len \n \n //e.g. child=\"abc\" \n // abc ab \n // / \\ ==========> / \\ \n // e f insert \"abd^\" c d^ \n // / \\ \n // e f \n //insert the new node: ab \n int nodepathlen = child.pathlen \n - (child.getLength()-delta); \n SuffixNode node = new SuffixNode(text, \n child.start,child.start + delta - 1,nodepathlen); \n node.children = new LinkedList<SuffixNode>(); \n \n int tailpathlen = (text.length() - (j + delta)) + nodepathlen; \n SuffixNode tail = new SuffixNode(text, \n j+delta,text.length()-1,tailpathlen); \n \n //update child node: c \n child.start += delta; \n if(text.charAt(j+delta)<text.charAt(child.start)){ \n node.children.add(tail); \n node.children.add(child); \n }else{ \n node.children.add(child); \n node.children.add(tail); \n } \n //update parent \n currNode.children.set(i, node); \n \n //state.u = currNode; //currNode is already registered as state.u, so commented out \n state.v = node; \n state.finished = true; \n } \n done = true; \n break; \n } \n } \n if(!done){ \n int pathlen = text.length() - j + currNode.pathlen; \n SuffixNode node = new SuffixNode(text,j,text.length()-1,pathlen); \n currNode.children.add(node); \n //state.u = currNode; //currNode is already registered as state.u, so commented out \n state.v = currNode; \n state.finished = true; \n } \n }", "public TreeNode inorderSuccessor_naive(TreeNode root, TreeNode p) {\n Stack<TreeNode> stack = new Stack<>();\n TreeNode prev = null;\n while (root != null || !stack.empty()) {\n if (root != null) {\n stack.push(root);\n root = root.left;\n }\n else {\n root = stack.pop();\n if (prev != null && prev == p) {\n return root;\n }\n prev = root;\n root = root.right;\n }\n }\n return null;\n }", "private WAVLNode treePosForDel (WAVLTree tree,int key) {\n\t\t WAVLNode x=tree.root;\r\n\t\t WAVLNode y=EXT_NODE;\r\n\t\t if(x==EXT_NODE) { // if the tree happens to be empty return a node with a different key then expected\r\n\t\t\t return new WAVLNode(key-1,\"i\");\r\n\t\t }\r\n\t\t while (x!=EXT_NODE) {\r\n\t\t\t y=x;\r\n\t\t\t y.sizen--;\r\n\t\t\t if (key==x.key){\r\n\t\t\t\t return x;\r\n\t\t\t }\r\n\t\t\t else if (key<x.key) {\r\n\t\t\t\t x=x.left;\r\n\t\t\t }\r\n\t\t\t else {\r\n\t\t\t\t x=x.right;\r\n\t\t\t }\r\n\t\t }\r\n\t\t if(y.key!=key) { // if the node is not found, the method call refixfordel to fix the sizes\r\n\t\t\t reFixForDel(y);\r\n\t\t }\r\n\t\t return y;\r\n\t }", "private void keepRangeRecur(BinaryNode node, E a, E b) {\n\n if (node == null) return;\n\n //node is within a-b bounds so keep it\n if (a.compareTo((E)node.element) <= 0 && b.compareTo((E)node.element) >= 0) {\n keepRangeRecur(node.left, a, b);\n keepRangeRecur(node.right, a, b);\n\n //node is to the left of boundaries\n } else if (a.compareTo((E)node.element) > 0) {\n if (node == root) {\n root = node.right;\n node.right.parent = null;\n } else if (node.parent.right == node) { //node and its parent are out\n root = node;\n node.parent = null;\n keepRangeRecur(node.left, a, b);\n } else { //node is out but its parent is in\n node.parent.left = node.right;\n if (node.right != null) node.right.parent = node.parent; // checking if child exists\n }\n keepRangeRecur(node.right, a, b);\n\n // node is to the right of boundaries\n } else if (b.compareTo((E)node.element) < 0) {\n if (node == root) {\n root = node.left;\n node.left.parent = null;\n } else if (node.parent.left == node) { //node and its parent are out\n root = node;\n node.parent = null;\n keepRangeRecur(node.right, a, b);\n } else { //node is out but its parent is in\n node.parent.right = node.left;\n if (node.left != null) node.left.parent = node.parent; // checking if child exists\n }\n keepRangeRecur(node.left, a, b);\n }\n }", "private Node<E> nodeDelete(Node<E> current, E toDelete) {\n\t\tif (current == null)\n\t\t\treturn null;\n\t\tif (toDelete == current.data)\n\t\t\treturn current;\n\t\tif (((Comparable<E>) toDelete).compareTo((E) current.data) >= 0)\n\t\t\treturn nodeDelete(current.rightChild, toDelete);\n\t\telse\n\t\t\treturn nodeDelete(current.leftChild, toDelete);\n\t}", "public static Node findClosestLeaf(Node node, int search_key){\n\n if(search_key==node.key){ //เมื่อเจอ return ค่า\n return node;\n }\n else if(search_key>node.key){ //ถ้า search_key มากกว่า node.key ตอนนี้ แสดงว่า อยู่ทางด้านขวา\n if(node.right!=null){ //ถ้า node ตอนนี้มี right-subtree เรียก recursive โดยส่ง right-subtree\n return findClosestLeaf(node.right, search_key);\n }\n else {return node;} //ถ้า node ตอนนี้มีไม่มี right-subtree แสดงว่า node ตอนนีใกล้ search_key ที่สุด\n }\n else { //ถ้า search_key น้อยกว่า node.key ตอนนี้ แสดงว่า อยู่ทางด้านซ้าย\n if(node.left!=null){ //ถ้า node ตอนนี้มี left-subtree เรียก recursive โดยส่ง left-subtree\n return findClosestLeaf(node.left, search_key);\n }\n else{ return node;} ////ถ้า node ตอนนี้มีไม่มี left-subtree แสดงว่า node ตอนนีใกล้ search_key ที่สุด\n }\n\n }" ]
[ "0.580675", "0.5762074", "0.5711129", "0.56438696", "0.56417966", "0.5636632", "0.56326777", "0.5596886", "0.5578826", "0.55703574", "0.5566378", "0.5551716", "0.55181897", "0.5505268", "0.5505054", "0.5487797", "0.54863197", "0.54715216", "0.5438903", "0.5429865", "0.5400317", "0.53951144", "0.53922325", "0.53595847", "0.5328243", "0.53063047", "0.53034264", "0.5301468", "0.5285758", "0.52841955", "0.52689844", "0.52579594", "0.52544075", "0.52457005", "0.52386534", "0.5214824", "0.52135766", "0.52110106", "0.52052546", "0.5200211", "0.5190358", "0.5186677", "0.5183757", "0.5179177", "0.51634306", "0.5161564", "0.51552105", "0.51543474", "0.5145427", "0.5142106", "0.51201856", "0.5113377", "0.5112597", "0.5099312", "0.5094385", "0.50868183", "0.5077096", "0.507241", "0.5071137", "0.5070947", "0.5070008", "0.50683063", "0.5062261", "0.5061824", "0.5057479", "0.5053185", "0.5050378", "0.50498885", "0.5048362", "0.50425637", "0.50422114", "0.5034433", "0.5014336", "0.5013892", "0.50096506", "0.5008289", "0.50080544", "0.50031805", "0.5001473", "0.4998483", "0.49979717", "0.49941927", "0.49932796", "0.49886736", "0.4987968", "0.49875486", "0.49807277", "0.49777704", "0.49708995", "0.49703464", "0.49675706", "0.49669117", "0.49665555", "0.49658996", "0.49607342", "0.49583536", "0.49543267", "0.49542388", "0.4953887", "0.4952882", "0.49506685" ]
0.0
-1
traverses numerical node to find matching leaf node
private RegressionTreeNode traverseNumericalNode(Double v) { double val = (Double) this.value; if(v.compareTo(val) <= 0){ return this.leftChild; }else{ return this.rightChild; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int sumRootToLeafNumbers();", "public int scoreLeafNode();", "private int FixAVLtree(IAVLNode node)\r\n\t{\r\n\t\tif (node.isRealNode()) \r\n\t\t{\r\n\t\t\tif(BFCalc(node) == -2) \r\n\t\t\t{\r\n\t\t\t\t//in insert we need to fix if BFCalc(node.getLeft())==-1\r\n\t\t\t\t//in delete we need to fix if BFCalc(node.getLeft())==0 or -1\r\n\t\t\t\tint rightBF=BFCalc(node.getRight());\r\n\t\t\t\tif(rightBF==0||rightBF==-1) {\r\n\t\t\t\t\tRRRotation(node);\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t} \r\n\t\t\t\telse \r\n\t\t\t\t{ \r\n\t\t\t\t\tRLRotation(node);\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse //if BFCalc(node) == 2 \r\n\t\t\t{\r\n\t\t\t\t//in insert we need to fix if BFCalc(node.getLeft())==1\r\n\t\t\t\t//in delete we need to fix if BFCalc(node.getLeft())==0 or 1\r\n\t\t\t\tint leftBF=BFCalc(node.getLeft());\r\n\t\t\t\tif(leftBF==1 ||leftBF==0) \r\n\t\t\t\t{\r\n\t\t\t\t\tLLRotation(node);\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{ \r\n\t\t\t\t\tLRRotation(node);\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t} \r\n\t\t} \r\n\t\t\treturn 0;\r\n\t}", "private void fixAVLTree(Node node) {\n\t\tfinal int lf = getLoadFactor(node);\n\t\t//if (lf == -1 || lf == 0 || lf == 1) {\n\t\tif (lf >= -1 && lf <= 1) {\n\t\t\t// do nothing\n\t\t\treturn;\n\t\t}\t\t\n\t\trotateTree(node);\n\t}", "public void recoverTree2(TreeNode root) {\n traverse(root);\n\n // Swap the values of the two nodes\n int temp = firstElement.val;\n firstElement.val = secondElement.val;\n secondElement.val = temp;\n }", "private int first_leaf() { return n/2; }", "public void recoverTree(TreeNode root) {\n if(root == null)\n return;\n helper(root);\n \n //swap n2 and n3 val\n int temp = n1.val;\n n1.val = n2.val;\n n2.val = temp;\n return;\n }", "private RegressionTreeNode traverseNominalNode(Serializable value) {\n\t\tif(value.equals(this.value)){\n\t\t\treturn this.leftChild;\n\t\t}else{\n\t\t\treturn this.rightChild;\n\t\t}\n\t}", "Astro leafFloat64(double data, SourceSpan optSpan);", "@Test\n public void testHandleIndexNodeUnderflowed(){\n LeafNode<Integer, Integer> leaf1 = new LeafNode<Integer, Integer>(2, 2);\n leaf1.insertSorted(3, 3);\n LeafNode<Integer, Integer> leaf2 = new LeafNode<Integer, Integer>(5, 5);\n leaf2.insertSorted(7, 7);\n leaf2.insertSorted(8, 8);\n LeafNode<Integer, Integer> leaf3 = new LeafNode<Integer, Integer>(14, 14);\n leaf3.insertSorted(16, 16);\n LeafNode<Integer, Integer> leaf4 = new LeafNode<Integer, Integer>(22,22);\n leaf4.insertSorted(27, 27);\n leaf4.insertSorted(29, 29);\n LeafNode<Integer, Integer> leaf5 = new LeafNode<Integer, Integer>(33, 33);\n leaf5.insertSorted(34, 34);\n leaf5.insertSorted(38, 38);\n leaf5.insertSorted(39, 39);\n leaf1.nextLeaf = leaf2; leaf2.previousLeaf = leaf1; leaf2.nextLeaf = leaf3;\n leaf3.previousLeaf = leaf2; leaf3.nextLeaf = leaf4; leaf4.previousLeaf = leaf3;\n leaf4.nextLeaf = leaf5; leaf5.previousLeaf = leaf4; \n \n ArrayList<Integer> leftkeys = new ArrayList<>();\n leftkeys.add(5); leftkeys.add(13);\n ArrayList<Node<Integer, Integer>> leftNodeChilds = new ArrayList<>();\n leftNodeChilds.add(leaf1); leftNodeChilds.add(leaf2); leftNodeChilds.add(leaf3 );\n IndexNode<Integer, Integer> left = new IndexNode<>(leftkeys, leftNodeChilds);\n \n IndexNode<Integer, Integer> right = new IndexNode<>(30, leaf4, leaf5);\n \n IndexNode<Integer, Integer> parent = new IndexNode<>(17, left, right);\n left.parent = parent;\n right.parent = parent;\n // -----end construction\n \n BPlusTree<Integer, Integer> tree = new BPlusTree<>();\n int index = tree.handleIndexNodeUnderflow(left, right, parent);\n System.out.println(index);\n \n }", "public void recoverTree(TreeNode root) {\n if (root == null) {\n return;\n }\n\n prev = null;\n first = null;\n second = null;\n\n inorderTraversal(root);\n\n if (first != null && second != null) {\n int temp = first.val;\n first.val = second.val;\n second.val = temp;\n }\n\n }", "public void convertToGreater(TreeNode root){\n if(root==null)return;\n \n //if it is a leaf node\n if(root.left==null && root.right==null){\n //temporary variable to store root value\n int prev=root.val;\n //adding sum value to root\n root.val+=sum;\n //adding prev value to sum\n sum+=prev;\n return; \n };\n //calling right subtree\n convertToGreater(root.right);\n //temporary variable to store root value\n int prev=root.val;\n //adding sum value to root\n root.val+=sum;\n //adding prev value to sum\n sum+=prev;\n //calling left sub tree\n convertToGreater(root.left);\n }", "public int deleteRoot(AVLNode node) { // root is unary node or leaf\n\t\tif (node.isLeaf()) {\n\t\t\tthis.root = null;\n\t\t} else { // root is unary\n\t\t\tif (node.getRight().getHeight() != -1) { // root has a right child\n\t\t\t\tthis.root = node.getRight();\n\t\t\t\tnode.getRight().setParent(null);\n\t\t\t\tnode.setRight(null);\n\t\t\t} else { // root has a left child\n\t\t\t\tthis.root = node.getLeft();\n\t\t\t\tnode.getLeft().setParent(null);\n\t\t\t\tnode.setLeft(null);\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}", "@Test\n public void testIndexNodeRedistribute(){\n LeafNode<Integer, Integer> leaf1 = new LeafNode<Integer, Integer>(2, 2);\n leaf1.insertSorted(3, 3);\n LeafNode<Integer, Integer> leaf2 = new LeafNode<Integer, Integer>(5, 5);\n leaf2.insertSorted(7, 7);\n leaf2.insertSorted(8, 8);\n LeafNode<Integer, Integer> leaf3 = new LeafNode<Integer, Integer>(14, 14);\n leaf3.insertSorted(16, 16);\n LeafNode<Integer, Integer> leaf3_3 = new LeafNode<Integer, Integer>(17, 17);\n leaf3_3.insertSorted(18, 18);\n leaf3_3.insertSorted(19, 19);\n \n LeafNode<Integer, Integer> leaf4 = new LeafNode<Integer, Integer>(22,22);\n leaf4.insertSorted(27, 27);\n leaf4.insertSorted(29, 29);\n LeafNode<Integer, Integer> leaf5 = new LeafNode<Integer, Integer>(33, 33);\n leaf5.insertSorted(34, 34);\n leaf5.insertSorted(38, 38);\n leaf5.insertSorted(39, 39);\n leaf1.nextLeaf = leaf2; leaf2.previousLeaf = leaf1; leaf2.nextLeaf = leaf3;\n leaf3.previousLeaf = leaf2; leaf3.nextLeaf = leaf4; leaf4.previousLeaf = leaf3;\n leaf4.nextLeaf = leaf5; leaf5.previousLeaf = leaf4; \n \n ArrayList<Integer> leftkeys = new ArrayList<>();\n leftkeys.add(5); leftkeys.add(13); leftkeys.add(17);\n ArrayList<Node<Integer, Integer>> leftNodeChilds = new ArrayList<>();\n leftNodeChilds.add(leaf1); leftNodeChilds.add(leaf2); leftNodeChilds.add(leaf3 );\n leftNodeChilds.add(leaf3_3);\n IndexNode<Integer, Integer> left = new IndexNode<>(leftkeys, leftNodeChilds);\n \n IndexNode<Integer, Integer> right = new IndexNode<>(30, leaf4, leaf5);\n \n IndexNode<Integer, Integer> parent = new IndexNode<>(20, left, right);\n left.parent = parent;\n right.parent = parent;\n // -----end construction\n \n BPlusTree<Integer, Integer> tree = new BPlusTree<>();\n tree.root = parent;\n int index = tree.handleIndexNodeUnderflow(left, right, parent);\n System.out.println(index);\n Integer a = tree.search(17);\n System.out.println(a);\n }", "@Test\n public void Test7() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t2, null, t3);\n TreeNode.connect(t3, t1, null);\n TreeNode root = t2;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e1, null, e3);\n TreeNode.connect(e3, e2, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "void pairwiseCombine(){\n\t\t\n\t\tmin.Left.Right = min.Right;\n\t\tmin.Right.Left = min.Left;\n\t\t/**\n\t\tPairwise combine differentiates itself in operation of depending on the presence of a child node\n\t\t*/\n\t\t\n\t\tif(min.Child==null){\n\t\t/*map acts as the table to store similar degree nodes*/\n\t\t\tHashMap<Integer, Nodefh> map = new HashMap<Integer, Nodefh>();\n\t\t\tcurrent = min.Right;\n\t\t\tmin = null;\n\t\t\tmin = current;\n\t\t\tlast = current.Left;\n\t\t\twhile(current!=last){\n\t\t\t\tNodefh check = new Nodefh();\n\t\t\t\tcheck = current.Right;\n\t\t\t\twhile(map.containsKey(current.degree)){\n\t\t\t\t\tNodefh temp = map.remove(current.degree);\n\t\t\t\t\t\n\t\t\t\t\t/*Since a parent node can have only one child node a condition is checked to update its child node*/\n\t\t\t\t\tif(temp.dist < current.dist){\n\t\t\t\t\t/*If the node stored is less than the incoming node*/\n\t\t\t\t\t\tcurrent.Right.Left = current.Left;\n\t\t\t\t\t\tcurrent.Left.Right = current.Right;\n\t\t\t\t\t\ttemp.ChildCut = false;\n\t\t\t\t\t\tif(temp.isChildEmpty()){\n\t\t\t\t\t\t\ttemp.Child = current;\n\t\t\t\t\t\t\tcurrent.Left = current.Right = current;\n\t\t\t\t\t\t\ttemp.Child.Parent = temp;\n\t\t\t\t\t\t\ttemp.degree = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tcurrent.Right = temp.Child;\n\t\t\t\t\t\t\tcurrent.Left = temp.Child.Left;\n\t\t\t\t\t\t\ttemp.Child.Left.Right = current;\n\t\t\t\t\t\t\ttemp.Child.Left = current;\n\t\t\t\t\t\t\tcurrent.Parent = temp;\n\t\t\t\t\t\t\tif(temp.Child == temp.Child.Right){\n\t\t\t\t\t\t\t\ttemp.Child.Right = current;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttemp.degree +=1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrent = temp;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t/*If the incoming node is lower*/\n\t\t\t\t\t\ttemp.Right.Left = temp.Left;\n\t\t\t\t\t\ttemp.Left.Right = temp.Right;\n\t\t\t\t\t\tcurrent.ChildCut = false;\t\n\t\t\t\t\t\tif(current.isChildEmpty()){\n\n\t\t\t\t\t\t\tcurrent.Child = temp;\n\t\t\t\t\t\t\ttemp.Left = temp.Right = temp;\n\t\t\t\t\t\t\tcurrent.Child.Parent = current;\n\t\t\t\t\t\t\tcurrent.degree = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\ttemp.Right = current.Child;\n\t\t\t\t\t\t\ttemp.Left = current.Child.Left;\n\t\t\t\t\t\t\tcurrent.Child.Left.Right = temp;\n\t\t\t\t\t\t\tcurrent.Child.Left = temp;\n\t\t\t\t\t\t\ttemp.Parent = current;\n\t\t\t\t\t\t\tcurrent.degree +=1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tif(min.dist >= current.dist){\n\t\t\t\t\tmin = current;\n\t\t\t\t}\n\t\t\t\tmap.put(current.degree, current);\n\t\t\t\tcurrent = check;\n\n\t\t\t}\n\t\t\tlast = min.Left;\n\t\t\t/*Since our condition is used only till last node and exits during last node the iteration is repeated for the last node*/\n\t\t\twhile(map.containsKey(current.degree)){\n\t\t\t\tNodefh temp = map.remove(current.degree);\n\t\t\t\tif(temp.dist < current.dist){\n\t\t\t\t\ttemp.ChildCut = false;\n\t\t\t\t\tcurrent.Right.Left = current.Left;\n\t\t\t\t\tcurrent.Left.Right = current.Right;\n\t\t\t\t\tif(temp.isChildEmpty()){\n\t\t\t\t\t\ttemp.Child = current;\n\t\t\t\t\t\tcurrent.Left = current.Right = current;\n\t\t\t\t\t\ttemp.Child.Parent = temp;\n\t\t\t\t\t\ttemp.degree = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tcurrent.Right = temp.Child;\n\t\t\t\t\t\tcurrent.Left = temp.Child.Left;\n\t\t\t\t\t\ttemp.Child.Left.Right = current;\n\t\t\t\t\t\ttemp.Child.Left = current;\n\t\t\t\t\t\tcurrent.Parent = temp;\n\t\t\t\t\t\ttemp.degree +=1;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = temp;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttemp.Right.Left = temp.Left;\n\t\t\t\t\ttemp.Left.Right = temp.Right;\n\t\t\t\t\tcurrent.ChildCut = false;\n\t\t\t\t\tif(current.isChildEmpty()){\n\t\t\t\t\t\tcurrent.Child = temp;\n\t\t\t\t\t\ttemp.Left = temp.Right = temp;\n\t\t\t\t\t\tcurrent.Child.Parent = current;\n\t\t\t\t\t\tcurrent.degree = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ttemp.Right = current.Child;\n\t\t\t\t\t\ttemp.Left = current.Child.Left;\n\t\t\t\t\t\tcurrent.Child.Left.Right = temp;\n\t\t\t\t\t\tcurrent.Child.Left = temp;\n\t\t\t\t\t\ttemp.Parent = current;\n\t\t\t\t\t\tcurrent.degree +=1;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(min.dist >= current.dist){\n\t\t\t\tmin = current;\n\t\t\t}\n\t\t\tcurrent = min;\n\t\t\tlast = min.Left;\n\n\t\t}\n\t\telse{\n\t\t\tHashMap<Integer, Nodefh> map = new HashMap<Integer, Nodefh>();\n\t\t\tcurrent = min.Child;\n\t\t\tcurrent.Parent = null;\n\t\t\tif(min!=min.Right){\n\t\t\t\tcurrent.Right.Left = min.Left;\n\t\t\t\tmin.Left.Right = current.Right;\n\t\t\t\tcurrent.Right = min.Right;\n\t\t\t\tmin.Right.Left = current;\n\t\t\t\tlast = current.Left;\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\tlast = current.Left;\n\n\t\t\t}\n\t\t\tmin =null;\n\t\t\tmin = current;\n\t\t\t/*In the presence of a child the child has to be inserted at the top level*/\n\t\t\twhile(current != last){\n\t\t\t\tNodefh check = new Nodefh();\n\t\t\t\tcheck = current.Right;\n\n\t\t\t\twhile(map.containsKey(current.degree)){\n\n\t\t\t\t\tNodefh temp = map.remove(current.degree);\n\t\t\t\t\tif(temp.dist < current.dist){\n\t\t\t\t\t\ttemp.ChildCut = false;\n\t\t\t\t\t\tcurrent.Right.Left = current.Left;\n\t\t\t\t\t\tcurrent.Left.Right = current.Right;\n\t\t\t\t\t\tif(temp.isChildEmpty()){\n\n\t\t\t\t\t\t\ttemp.Child = current;\n\t\t\t\t\t\t\tcurrent.Left = current.Right = current;\n\t\t\t\t\t\t\ttemp.Child.Parent = temp;\n\t\t\t\t\t\t\ttemp.degree = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tcurrent.Right = temp.Child;\n\t\t\t\t\t\t\tcurrent.Left = temp.Child.Left;\n\t\t\t\t\t\t\ttemp.Child.Left.Right = current;\n\t\t\t\t\t\t\ttemp.Child.Left = current;\n\t\t\t\t\t\t\tcurrent.Parent = temp;\n\t\t\t\t\t\t\ttemp.degree +=1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcurrent = temp;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ttemp.Right.Left = temp.Left;\n\t\t\t\t\t\ttemp.Left.Right = temp.Right;\n\t\t\t\t\t\tcurrent.ChildCut = false;\n\t\t\t\t\t\tif(current.isChildEmpty()){\n\t\t\t\t\t\t\tcurrent.Child = temp;\n\t\t\t\t\t\t\ttemp.Left = temp.Right = temp;\n\t\t\t\t\t\t\tcurrent.Child.Parent = current;\n\t\t\t\t\t\t\tcurrent.degree = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\ttemp.Right = current.Child;\n\t\t\t\t\t\t\ttemp.Left = current.Child.Left;\n\t\t\t\t\t\t\tcurrent.Child.Left.Right = temp;\n\t\t\t\t\t\t\tcurrent.Child.Left = temp;\n\t\t\t\t\t\t\ttemp.Parent = current;\n\t\t\t\t\t\t\tcurrent.degree +=1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(min.dist >= current.dist){\n\t\t\t\t\tmin = current;\n\n\t\t\t\t}\n\t\t\t\tmap.put(current.degree, current);\n\t\t\t\tcurrent = check;\n\t\t\t}\n\t\t\tlast = min.Left;\n\t\t\twhile(map.containsKey(current.degree)){\n\t\t\t\tNodefh temp = map.remove(current.degree);\n\t\t\t\tif(temp.dist < current.dist && temp.dist!=0){\n\t\t\t\t\tcurrent.Right.Left = current.Left;\n\t\t\t\t\tcurrent.Left.Right = current.Right;\n\t\t\t\t\ttemp.ChildCut = false;\n\t\t\t\t\tif(temp.isChildEmpty()){\n\t\t\t\t\t\ttemp.Child = current;\n\t\t\t\t\t\tcurrent.Left = current.Right = current;\n\t\t\t\t\t\ttemp.Child.Parent = temp;\n\t\t\t\t\t\ttemp.degree = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tcurrent.Right = temp.Child;\n\t\t\t\t\t\tcurrent.Left = temp.Child.Left;\n\t\t\t\t\t\ttemp.Child.Left.Right = current;\n\t\t\t\t\t\ttemp.Child.Left = current;\n\t\t\t\t\t\tcurrent.Parent = temp;\n\t\t\t\t\t\ttemp.degree +=1;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = temp;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttemp.Right.Left = temp.Left;\n\t\t\t\t\ttemp.Left.Right = temp.Right;\n\t\t\t\t\tcurrent.ChildCut = false;\n\t\t\t\t\tif(current.isChildEmpty()){\n\t\t\t\t\t\tcurrent.Child = temp;\n\t\t\t\t\t\ttemp.Left = temp.Right = temp;\n\t\t\t\t\t\tcurrent.Child.Parent = current;\n\t\t\t\t\t\tcurrent.degree = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ttemp.Right = current.Child;\n\t\t\t\t\t\ttemp.Left = current.Child.Left;\n\t\t\t\t\t\tcurrent.Child.Left.Right = temp;\n\t\t\t\t\t\tcurrent.Child.Left = temp;\n\t\t\t\t\t\ttemp.Parent = current;\n\t\t\t\t\t\tcurrent.degree +=1;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(min.dist >= current.dist){\n\t\t\t\tmin = current;\n\n\t\t\t}\n\t\t\tcurrent = min;\n\t\t\tlast = min.Left;\n\t\t}\n\n\t}", "public void deleteNode(BinaryTreeNode node) // Only leaf nodes and nodes with degree 1 can be deleted. If a degree 1 node is deleted, it is replaced by its subtree.\r\n {\n if(!node.hasRightChild() && !node.hasLeftChild()){\r\n if(node.mActualNode.mParent.mRightChild == node.mActualNode) {\r\n\r\n node.mActualNode.mParent.mRightChild = null;\r\n }\r\n else if(node.mActualNode.mParent.mLeftChild == node.mActualNode) {\r\n\r\n node.mActualNode.mParent.mLeftChild = null;\r\n }\r\n //node.mActualNode = null;\r\n\r\n }\r\n //if deleted node has degree 1 and has only left child\r\n else if(node.hasLeftChild() && !node.hasRightChild()){\r\n node.mActualNode.mLeftChild.mParent = node.mActualNode.mParent;\r\n //if deleted node is left child of his father\r\n if(node.mActualNode.mParent.mLeftChild == node.mActualNode)\r\n node.mActualNode.mParent.mLeftChild = node.mActualNode.mLeftChild;\r\n //if deleted node is right child of his father\r\n else {\r\n\r\n node.mActualNode.mParent.mRightChild = node.mActualNode.mLeftChild;\r\n }\r\n }\r\n // if deleted node has degree 1 and has only right child\r\n else if(node.hasRightChild() && !node.hasLeftChild()){\r\n node.mActualNode.mRightChild.mParent = node.mActualNode.mParent;\r\n\r\n //if node is left child of his father\r\n if(node.mActualNode.mParent.mLeftChild == node.mActualNode) {\r\n\r\n\r\n node.mActualNode.mParent.mLeftChild = node.mActualNode.mRightChild;\r\n\r\n }\r\n //if node is right child of his father\r\n else\r\n node.mActualNode.mParent.mRightChild = node.mActualNode.mRightChild;\r\n\r\n\r\n }\r\n else\r\n System.out.println(\"Error : node has two child\");\r\n\r\n }", "public int my_leaf_count();", "public TreeNode convertBST(TreeNode root) {\n \tif (root==null) return null;\n \tif(root.right!=null){\n root.right = convertBST(root.right);\t\n\t}\n int org = root.val;\n \troot.val += sum;\n \t sum += org;\n \tif(root.left!=null){\n \t\troot.left = convertBST(root.left);\t\n \t}\n \treturn root;\n }", "@Override\npublic boolean fjern(T verdi) {\n Node<T> curr = hode;\n while (curr != null) {\n if (curr.verdi.equals(verdi)) {\n if (antall == 1) {\n hode = hale = null;\n } else if (curr == hode) {\n hode = hode.neste;\n hode.forrige = null;\n } else if (curr == hale) {\n hale = hale.forrige;\n hale.neste = null;\n } else {\n curr.forrige.neste = curr.neste;\n curr.neste.forrige = curr.forrige;\n }\n antall--;\n endringer++;\n return true;\n }\n curr = curr.neste;\n }\n return false;\n}", "private int joinSecnodCase(AVLTree t1, IAVLNode x, AVLTree t2) {\r\n\t\t\t\t int returnValue = 0;\r\n\t\t\t\t IAVLNode curr = t1.getRoot(), parent;\r\n\t\t\t\t \r\n\t\t\t\t while(true) {\r\n\t\t\t\t\t if(curr.getHeight() <= t2.getRoot().getHeight())\r\n\t\t\t\t\t\t break;\r\n\t\t\t\t\t if(curr.getRight().getHeight() == -1)\r\n\t\t\t\t\t\t break;\r\n\t\t\t\t\t curr = curr.getRight();\r\n\t\t\t\t }\r\n\t\t\t\t \r\n\t\t\t\t parent = curr.getParent();\r\n\t\t\t\t \r\n\t\t\t\t if(t1.getRoot() == curr) {\r\n\t\t\t\t\t curr.setRight(x);\r\n\t\t\t\t\t x.setParent(curr);\r\n\t\t\t\t\t curr.setHeight(curr.getHeight() + 1 );\r\n\t\t\t\t\t return 0;\r\n\t\t\t\t }\r\n\t\t\t\t \r\n\t\t\t\t returnValue = Math.abs(t2.getRoot().getHeight() - curr.getHeight());\r\n\t\t\t\t \r\n\t\t\t\t //replacing pointers\r\n\t\t\t\t \r\n\t\t\t\t x.setLeft(curr);\r\n\t\t\t\t x.setParent(parent);\r\n\t\t\t\t parent.setRight(x);\r\n\t\t\t\t curr.setParent(x);\r\n\t\t\t\t x.setRight(t2.getRoot());\r\n\t\t\t\t t2.getRoot().setParent(x);\r\n\t\t\t\t t2.setRoot(null);\r\n\t\t\t\t t2.setRoot(t1.getRoot());\r\n\t\t\t\t x.setHeight(Math.max(x.getRight().getHeight(), x.getLeft().getHeight()) + 1);\r\n\t\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t\t \r\n\t\t\t\t //t2.minimum = t1.minimum;\r\n\t\t\t\t t2.maximum = t1.maximum;\r\n\t\t\t\t \r\n\t\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t\t HieghtsUpdating(x);\r\n\t\t\t\t SizesUpdate(x);\r\n\t\t\r\n\t\t\t\t return returnValue;\r\n\t\t\t\t}", "Astro leafInteger(Number integralData, SourceSpan optSpan);", "public RegressionTreeNode traverseNode(Serializable value){\n\t\tif(value instanceof Number && this.value instanceof Number){\n\t\t\tDouble number = ((Number) value).doubleValue();\n\t\t\treturn this.traverseNumericalNode(number);\n\t\t}else{\n\t\t\treturn this.traverseNominalNode(value);\n\t\t}\n\t}", "private void doubleRotationLR(BinaryNode node) {\n BinaryNode temp = max(node.left);\n if (node == root) {\n root = temp;\n if (temp.parent.right == temp) { //temp could have a child on the left\n temp.parent.right = temp.left;\n if (temp.left != null) temp.left.parent = temp.parent;\n }\n else {\n temp.parent.left = temp.left;\n if (temp.left != null) temp.left.parent = temp.parent;\n }\n root.parent = null;\n root.right = node;\n root.left = node.left;\n if(node.left != null) node.left.parent = root;\n node.parent = root;\n node.left = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = temp;\n } else {\n node.parent.left = temp;\n }\n temp.parent = node.parent;\n temp.left = node.left;\n if(node.left != null) node.left.parent = temp;\n temp.right = node;\n node.parent = temp;\n node.left = null;\n }\n }", "@Test\n public void Test6() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t3, null, t1);\n TreeNode.connect(t1, t2, null);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e1, null, e3);\n TreeNode.connect(e3, e2, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "private WAVLNode treePosForDel (WAVLTree tree,int key) {\n\t\t WAVLNode x=tree.root;\r\n\t\t WAVLNode y=EXT_NODE;\r\n\t\t if(x==EXT_NODE) { // if the tree happens to be empty return a node with a different key then expected\r\n\t\t\t return new WAVLNode(key-1,\"i\");\r\n\t\t }\r\n\t\t while (x!=EXT_NODE) {\r\n\t\t\t y=x;\r\n\t\t\t y.sizen--;\r\n\t\t\t if (key==x.key){\r\n\t\t\t\t return x;\r\n\t\t\t }\r\n\t\t\t else if (key<x.key) {\r\n\t\t\t\t x=x.left;\r\n\t\t\t }\r\n\t\t\t else {\r\n\t\t\t\t x=x.right;\r\n\t\t\t }\r\n\t\t }\r\n\t\t if(y.key!=key) { // if the node is not found, the method call refixfordel to fix the sizes\r\n\t\t\t reFixForDel(y);\r\n\t\t }\r\n\t\t return y;\r\n\t }", "@Test\n public void Test2() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t1, null, t4);\n TreeNode.connect(t4, null, t3);\n TreeNode.connect(t3, null, t2);\n TreeNode.connect(t2, null, t5);\n TreeNode root = t1;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e1, null, e2);\n TreeNode.connect(e2, null, e3);\n TreeNode.connect(e3, null, e4);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public void fixViolationDelete(Node node){ \n\t\t\n\t while(node!=root && node.colour==\"Black\"){\n\t if(node==node.parent.left){\n\t \t//if the node is the left child and sibling is in the right\n\t Node sibling=node.parent.right;\n\t //check if the color of sibling is red then exchange the color with parent and rotate left \n\t if(sibling.colour == \"Red\"){\n\t \tsibling.colour = \"Black\";\n\t node.parent.colour = \"Red\";\n\t rotateLeft(node.parent);\n\t sibling=node.parent.right;\n\t }\n\t if(sibling.left.colour==\"Black\" && sibling.right.colour ==\"Black\"){\n\t \t//if both the children of sibling are black, change the color of the sibling and transfer the problem up the parent\n\t \tsibling.colour = \"Red\";\n\t node=node.parent;\n\t }\n\t else{ \n\t if(sibling.right.colour==\"Black\"){\n\t \t//if the left child of the sibling in red exchange the color of the sibling's child with sibling and color the child black\n\t \t// and rotate right\n\t \tsibling.left.colour = \"Black\";\n\t \tsibling.colour = \"Red\";\n\t rotateRight(sibling);\n\t sibling=node.parent.right;\n\t }\n\t //followed my the left rotation\n\t sibling.colour = node.parent.colour;\n\t node.parent.colour = \"Black\";\n\t sibling.right.colour = \"Black\";\n\t rotateLeft(node.parent);\n\t node=root;\n\t }\n\t }\n\t else{\n\t \t//node is the right child of the parent and sibling is the left child\n\t Node sibling=node.parent.left;\n\t \n\t if(sibling.colour == \"Red\"){\n\t \tsibling.colour = \"Black\";\n\t node.parent.colour = \"Red\";\n\t rotateRight(node.parent);\n\t sibling=node.parent.left;\n\t }\n\t \n\t if(sibling.right.colour==\"Black\" && sibling.left.colour==\"Black\"){\n\t \tsibling.colour = \"Red\";\n\t node=node.parent;\n\t }else{\n\t if(sibling.left.colour==\"Black\"){\n\t \tsibling.right.colour= \"Black\";\n\t \tsibling.colour = \"Red\";\n\t rotateLeft(sibling);\n\t sibling=node.parent.left;\n\t }\n\t \n\t sibling.colour = node.parent.colour;\n\t node.parent.colour = \"Black\";\n\t sibling.left.colour = \"Black\";\n\t rotateRight(node.parent);\n\t node=root;\n\t }\n\t }\n\t }\n\t //we color the node black\n\t node.colour = \"Black\";\n\t}", "public int[] mRtreeFromSource(int s,int k){\n double INFINITY = Double.MAX_VALUE;\n boolean[] SPT = new boolean[intersection];\n double[] d = new double[intersection];\n int[] parent = new int[intersection];\n\n for (int i = 0; i <intersection ; i++) {\n d[i] = INFINITY;\n parent[i] = -1;\n }\n\n d[s] = 0;\n parent[s]=s;\n\n MinHeap minHeap = new MinHeap(k);\n for (int i = 0; i <intersection ; i++) {\n minHeap.add(i,d[i]);\n }\n while(!minHeap.isEmpty()){\n\n int extractedVertex = minHeap.extractMin();\n\n if(d[extractedVertex]==INFINITY)\n break;\n\n SPT[extractedVertex] = true;\n\n LinkedList<Edge> list = g.adjacencylist[extractedVertex];\n for (int i = 0; i <list.size() ; i++) {\n Edge edge = list.get(i);\n int destination = edge.destination;\n if(SPT[destination]==false ) {\n\n double newKey = edge.weight ; //the different part with previous method\n double currentKey = d[destination];\n if(currentKey>=newKey){\n if(currentKey==newKey){\n if(extractedVertex<parent[destination]){\n minHeap.updateKey(newKey, destination, d[destination]);\n parent[destination] = extractedVertex;\n d[destination] = newKey;\n }\n }\n else {\n minHeap.updateKey(newKey, destination, d[destination]);\n parent[destination] = extractedVertex;\n d[destination] = newKey;\n }\n }\n }\n }\n }\n return parent;\n }", "private void rebalanceLeft(TreeNodeDataType n) {\n left(n);\r\n \r\n \r\n }", "protected void case3R(AbsTree t) {\n\t\t\tAbsTree min_right_t = t.right.min();\r\n\t\t\tif (min_right_t.left == null && min_right_t.right == null)\r\n\t\t\t\tcase1(min_right_t, this); // min_right_t is a leaf node\r\n\t\t\telse\r\n\t\t\t\tcase2(min_right_t, this); // min_right_t is a non-leaf node\r\n\t\t\tt.value = min_right_t.value;\r\n\t\t\tt.set_count(min_right_t.get_count());\r\n\t}", "private PersistentLinkedList<T> pop() {\n //the latest element won't become empty\n int index = this.treeSize - 1;\n Node<T> newRoot = new Node<>(branchingFactor);\n\n Node<T> currentNode = this.root;\n Node<T> currentNewNode = newRoot;\n\n ArrayList<Node<T>> newNodes = new ArrayList<>();\n newNodes.add(newRoot);\n ArrayList<Integer> newNodesIndices = new ArrayList<>();\n\n for (int b = base; b > 1; b = b / branchingFactor) {\n TraverseData traverseData = traverseOneLevel(\n new TraverseData(currentNode, currentNewNode, newRoot, index, b));\n currentNode = traverseData.currentNode;\n currentNewNode = traverseData.currentNewNode;\n newNodes.add(currentNewNode);\n newNodesIndices.add(index / b);\n index = traverseData.index;\n }\n newNodesIndices.add(index);\n\n for (int i = 0; i < branchingFactor && i < index; i++) {\n currentNewNode.set(i, currentNode.get(i));\n }\n currentNewNode.set(index, null);\n\n if (index == 0) {\n int latestIndex = newNodes.size() - 2;\n newNodes.get(latestIndex).set(newNodesIndices.get(latestIndex), null);\n\n for (int i = latestIndex; i > 0; i--) {\n if (newNodesIndices.get(i) == 0) {\n newNodes.get(i - 1).set(newNodesIndices.get(i - 1), null);\n } else {\n break;\n }\n }\n }\n\n if (newNodes.size() > 1) {\n int nonNullChildren = 0;\n for (Node<T> child : newRoot.children) {\n if (child != null) {\n nonNullChildren++;\n }\n }\n if (nonNullChildren == 1) { //need new root\n newRoot = newRoot.get(0);\n return new PersistentLinkedList<>(newRoot, this.branchingFactor, this.depth - 1,\n this.base / branchingFactor, this.treeSize - 1, unusedTreeIndices,\n indexCorrespondingToTheFirstElement, indexCorrespondingToTheLatestElement);\n }\n }\n return new PersistentLinkedList<>(newRoot, this.branchingFactor, this.depth, this.base,\n this.treeSize - 1, unusedTreeIndices, indexCorrespondingToTheFirstElement,\n indexCorrespondingToTheLatestElement);\n }", "public TreeNode bstToGst(TreeNode root) {\n helper(root, new int[] {0});\n return root;\n }", "private AvlNode<E> remove(Comparable<E> element, AvlNode<E> node){\n if(node == null) {\n return node;\n } else if(node.value.compareTo((E)element) > 0){\n node.left = remove(element, node.left);\n } else if(node.value.compareTo((E)element) < 0){\n node.right = remove(element, node.right);\n } else {\n if(node.left == null && node.right == null){\n return null;\n } else if(node.left == null){\n return node.right;\n } else if(node.right == null){\n return node.left;\n } else {\n AvlNode<E> replacement = findMax(node.left);\n replacement.left = remove(replacement.value, node.left);\n replacement.right = node.right;\n return replacement;\n }\n }\n\n if(height(node.left) - height(node.right) > 1){\n if(height(node.left.left) > height(node.left.right)){\n node = rotateWithLeftChild(node);\n } else {\n node = doubleWithLeftChild(node);\n }\n } else if(height(node.left) - height(node.right) < -1){\n if(height(node.right.right) > height(node.right.left)){\n node = rotateWithRightChild(node);\n } else {\n node = doubleWithRightChild(node);\n }\n }\n node.height = max(height(node.left), height(node.right)) + 1;\n return node;\n }", "private BinarySearchTree deleteLeftMost(BinarySearchTree tree){\r\n\t\t\r\n\t\tif(tree.getLeftChild() == null){\r\n\t\t\t//this is the node we want. No left child\r\n\t\t\t//Right child might exist\r\n\t\t\t\r\n\t\t\treturn tree.getRightChild();\r\n\t\t}\r\n\t\telse{\r\n\t\t\tBinarySearchTree replacement = deleteLeftMost(tree.getLeftChild());\r\n\t\t\ttree.attachRightSubtree(replacement);\r\n\t\t\treturn tree;\r\n\t\t}\r\n\t}", "public TreeNode bstToGst(TreeNode root) {\n if (root == null) {\n return null;\n }\n\n bstToGst(root.right);\n\n // Add the curSum to root.val and update curSum\n root.val += curSum;\n curSum = root.val;\n\n bstToGst(root.left);\n return root;\n }", "@Test\n public void Test4() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t2, t3, t4);\n TreeNode.connect(t3, t1, null);\n TreeNode.connect(t4, null, t5);\n TreeNode root = t2;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e3, e2, e4);\n TreeNode.connect(e2, e1, null);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e3;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "@Override\r\n public Pair<DeepTree, DeepTree> process(Tree tree) {\n\r\n IdentityHashMap<Tree, SimpleMatrix> goldVectors = new IdentityHashMap<Tree, SimpleMatrix>();\r\n double scoreGold = score(tree, goldVectors);\r\n DeepTree bestTree = getHighestScoringTree(tree, TRAIN_LAMBDA);\r\n DeepTree goldTree = new DeepTree(tree, goldVectors, scoreGold);\r\n return Pair.makePair(goldTree, bestTree);\r\n }", "TrieNode root();", "private void nullLeaf(AVLNode<T> node) {\n AVLNode<T> prev = getParent(root, node);\n int comp = node.getData().compareTo(prev.getData());\n if (comp > 0) {\n prev.setRight(null);\n AVLNode<T> min = findMin(prev.getLeft());\n AVLNode<T> max = findMax(prev.getLeft());\n if (min != null) {\n calcDeterminants(min);\n balanceTree(min);\n calcDeterminants(min);\n }\n if (max != null) {\n calcDeterminants(max);\n balanceTree(max);\n calcDeterminants(max);\n }\n } else {\n prev.setLeft(null);\n AVLNode<T> max = findMax(prev.getRight());\n AVLNode<T> min = findMin(prev.getRight());\n if (max != null) {\n calcDeterminants(max);\n balanceTree(max);\n calcDeterminants(max);\n }\n if (min != null) {\n calcDeterminants(min);\n balanceTree(min);\n calcDeterminants(min);\n }\n }\n }", "private AvlNode deleteNode(AvlNode root, int value) {\n\r\n if (root == null)\r\n return root;\r\n\r\n // If the value to be deleted is smaller than the root's value,\r\n // then it lies in left subtree\r\n if ( value < root.key )\r\n root.left = deleteNode(root.left, value);\r\n\r\n // If the value to be deleted is greater than the root's value,\r\n // then it lies in right subtree\r\n else if( value > root.key )\r\n root.right = deleteNode(root.right, value);\r\n\r\n // if value is same as root's value, then This is the node\r\n // to be deleted\r\n else {\r\n // node with only one child or no child\r\n if( (root.left == null) || (root.right == null) ) {\r\n\r\n AvlNode temp;\r\n if (root.left != null)\r\n temp = root.left;\r\n else\r\n temp = root.right;\r\n\r\n // No child case\r\n if(temp == null) {\r\n temp = root;\r\n root = null;\r\n }\r\n else // One child case\r\n root = temp; // Copy the contents of the non-empty child\r\n\r\n temp = null;\r\n }\r\n else {\r\n // node with two children: Get the inorder successor (smallest\r\n // in the right subtree)\r\n AvlNode temp = minValueNode(root.right);\r\n\r\n // Copy the inorder successor's data to this node\r\n root.key = temp.key;\r\n\r\n // Delete the inorder successor\r\n root.right = deleteNode(root.right, temp.key);\r\n }\r\n }\r\n\r\n // If the tree had only one node then return\r\n if (root == null)\r\n return root;\r\n\r\n // STEP 2: UPDATE HEIGHT OF THE CURRENT NODE\r\n root.height = Math.max(height(root.left), height(root.right)) + 1;\r\n\r\n // STEP 3: GET THE BALANCE FACTOR OF THIS NODE (to check whether\r\n // this node became unbalanced)\r\n int balance = balance(root).key;\r\n\r\n // If this node becomes unbalanced, then there are 4 cases\r\n\r\n // Left Left Case\r\n if (balance > 1 && balance(root.left).key >= 0)\r\n return doRightRotation(root);\r\n\r\n // Left Right Case\r\n if (balance > 1 && balance(root.left).key < 0) {\r\n root.left = doLeftRotation(root.left);\r\n return doRightRotation(root);\r\n }\r\n\r\n // Right Right Case\r\n if (balance < -1 && balance(root.right).key <= 0)\r\n return doLeftRotation(root);\r\n\r\n // Right Left Case\r\n if (balance < -1 && balance(root.right).key > 0) {\r\n root.right = doRightRotation(root.right);\r\n return doLeftRotation(root);\r\n }\r\n\r\n return root;\r\n }", "@Test\n public void Test1() {\n TreeNode t1 = new TreeNode(5);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(1);\n TreeNode.connect(t1, t2, null);\n TreeNode.connect(t2, t3, null);\n TreeNode.connect(t3, t4, null);\n TreeNode.connect(t4, t5, null);\n TreeNode root = t1;\n\n TreeNode e1 = new TreeNode(5);\n TreeNode e2 = new TreeNode(4);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(2);\n TreeNode e5 = new TreeNode(1);\n TreeNode.connect(e1, e2, null);\n TreeNode.connect(e2, e3, null);\n TreeNode.connect(e3, e4, null);\n TreeNode.connect(e4, e5, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "@Test\n public void Test3() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t3, t4, t2);\n TreeNode.connect(t4, t1, null);\n TreeNode.connect(t2, null, t5);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e3, e2, e4);\n TreeNode.connect(e2, e1, null);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e3;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "private void handleUnderflow(Node node) {\n\t\t\r\n\t\tNode parent = node.getParent();\r\n\t\t\r\n\t\t//underflow in parent\r\n\t\tif (parent == null) {\r\n\t\t\t//System.out.println(\"Underflow in root!\");\r\n\t\t\tNode newRoot = new Node();\r\n\t\t\t//copy all data of root children into new root\r\n\t\t\tfor (int i = 0; i < root.getChildren().size(); i++) {\r\n\t\t\t\tfor (int j = 0; j < root.getChild(i).getData().size(); j++) {\r\n\t\t\t\t\tnewRoot.addData(root.getChild(i).getData(j));\r\n\t\t\t\t\tif (!root.getChild(i).isLeaf()) {\r\n\t\t\t\t\t\tnewRoot.addChild(root.getChild(i).getChild(j));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!root.getChild(i).isLeaf())\r\n\t\t\t\t\tnewRoot.addChild(root.getChild(i).getChild(root.getChild(i).getChildren().size()));\r\n\t\t\t}\r\n\t\t\tsize--;\r\n\t\t\troot = newRoot;\r\n\t\t} else {\r\n\t\t\t\r\n\t\t\tint nodePosInParent = parent.getEmptyChild();\r\n\t\t\t//if right most child of parent, must borrow from left\r\n\t\t\tif (nodePosInParent == parent.getChildren().size() - 1 ) {\r\n\t\t\t\t//take right most data value from parent\r\n\t\t\t\tnode.addData(parent.removeData(parent.getData().size() - 1));\r\n\t\t\t\t\r\n\t\t\t\tif (node.getSibling(\"left\").getData().size() > 1) {\r\n\t\t\t\t\tparent.addData(node.getSibling(\"left\").removeData(node.getSibling(\"left\").getData().size() - 1));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmerge(node.getSibling(\"left\"), node);\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\t//take immediate greater value from parent\r\n\t\t\t\t//node.addData(parent.removeData(nodePosInParent));\r\n\r\n\t\t\t\t//if we can steal from right sibling\r\n\t\t\t\tif (node.getSibling(\"right\").getData().size() > 1) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t//take immediate greater value from parent\r\n\t\t\t\t\tnode.addData(parent.removeData(nodePosInParent));\r\n\t\t\t\t\t\r\n\t\t\t\t\tparent.addData(node.getSibling(\"right\").removeData(0));\r\n\t\t\t\t\t\r\n\t\t\t\t//otherwise steal from left\r\n\t\t\t\t} else if (nodePosInParent != 0 && node.getSibling(\"left\").getData().size() > 1) {\r\n\r\n\t\t\t\t\t//take immediate lesser value from parent\r\n\t\t\t\t\tnode.addData(parent.removeData(nodePosInParent - 1));\r\n\t\t\t\t\t\r\n\t\t\t\t\tparent.addData(node.getSibling(\"left\").removeData(node.getSibling(\"left\").getData().size() - 1));\r\n\t\t\t\t\t\r\n\t\t\t\t//else, merge\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t//take immediate greater value from parent\r\n\t\t\t\t\tnode.addData(parent.removeData(nodePosInParent));\r\n\t\t\t\t\t\r\n\t\t\t\t\tmerge(node, node.getSibling(\"right\"));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void removeNode(AVLNode<T, U> node){\n\t\tAVLNode<T, U> newNode = null;\n\t\t\n\t\tif(node.getLeft() == null && node.getRight() == null){\n\t\t\t//If the node is a leaf, I delete it and I recompute \n\t\t\t//the heights and check the balance starting from its parent\n\t\t\tnewNode = node.getParent();\n\t\t\tthis.transplant(node, null);\n\t\t}else if(node.getLeft() == null){\n\t\t\tnewNode = node.getRight();\n\t\t\tthis.transplant(node, newNode);\n\t\t}else if(node.getRight() == null){\n\t\t\tnewNode = node.getLeft();\n\t\t\tthis.transplant(node, newNode);\n\t\t}else{\n\t\t\tnewNode = getMinimum(node.getRight());\n\t\t\tif(newNode.getParent() != node){\n\t\t\t\tthis.transplant(newNode, newNode.getRight());\n\t\t\t\tnewNode.setRight(node.getRight());\n\t\t\t\tnewNode.getRight().setParent(newNode);\n\t\t\t}\n\t\t\tthis.transplant(node, newNode);\n\t\t\tnewNode.setLeft(node.getLeft());\n\t\t\tnewNode.getLeft().setParent(newNode);\n\t\t}\n\t\tcomputeHeights(newNode);\n\t\tbalanceTree(newNode);\n\t}", "public int delete(int k) {\n\t\tif (this.empty()) {// empty tree, nothing to erase\n\t\t\treturn -1;\n\t\t}\n\t\tAVLNode root = (AVLNode) this.root;\n\t\tAVLNode node = (AVLNode) root.delFindNode(k);\n\t\tif (node == null) {// no node with key==k in this tree\n\t\t\treturn -1;\n\t\t}\n\t\tchar side = node.parentSide();\n\t\tboolean rootTerm = (node.getLeft().getKey() != -1 && node.getRight().getKey() != -1);\n\t\tif (side == 'N' && (rootTerm == false)) {\n\t\t\treturn this.deleteRoot(node);\n\t\t}\n\t\tif (side == 'L') {\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.parent.getRight().getHeight();\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tif (leftEdge == 1 && rightEdge == 1) {// first case (\"easy one\", just delete)\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.updateSize();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (leftEdge == 1 && rightEdge == 2) {\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.setHeight(parent.getHeight() - 1);\n\t\t\t\t\tparent.setSize();\n\t\t\t\t\treturn this.delRecTwos(parent);\n\t\t\t\t} else {// leftEdge==2&&rightEdge==1\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\treturn this.delRecTriOne(parent, side);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((node.left != null && node.right == null) || (node.left == null && node.right != null)) {// node is //\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// unary\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.parent.getRight().getHeight();\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\tAVLNode parent = node.delUnaryLeft();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\tAVLNode parent = node.delUnaryRight();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 2)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryLeft());\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryRight());\n\t\t\t\t\t}\n\t\t\t\t} else {// leftEdge==2&&rightEdge==1\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryLeft(), side);\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryRight(), side);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif (side == 'R') {\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.parent.getLeft().getHeight();\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tif (leftEdge == 1 && rightEdge == 1) {// first case (\"easy one\", just delete)\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.updateSize();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (leftEdge == 2 && rightEdge == 1) {\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.setHeight(parent.getHeight() - 1);\n\t\t\t\t\tparent.setSize();\n\t\t\t\t\treturn this.delRecTwos(parent);\n\t\t\t\t} else {// leftEdge==1&&rightEdge==2\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\treturn this.delRecTriOne(parent, side);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((node.getLeft().getHeight() != -1 && node.getRight().getHeight() == -1)\n\t\t\t\t\t|| (node.getLeft().getHeight() == -1 && node.getRight().getHeight() != -1)) {// node is unary\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.parent.getLeft().getHeight();\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\tAVLNode parent = node.delUnaryLeft();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\tAVLNode parent = node.delUnaryRight();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ((leftEdge == 2 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryLeft());\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryRight());\n\t\t\t\t\t}\n\t\t\t\t} else {// leftEdge==1&&rightEdge==2\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryLeft(), side);\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryRight(), side);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t// we get here only if node is binary, and thus not going through any other\n\t\t// submethod\n\t\tAVLNode successor = this.findSuccessor(node); // successor must be unary/leaf\n\t\tif (node.checkRoot()) {\n\t\t\tthis.root = successor;\n\t\t}\n\t\tint numOp = this.delete(successor.key);\n\t\tsuccessor.setHeight(node.getHeight());\n\t\tsuccessor.size = node.getSize();\n\t\tsuccessor.setRight(node.getRight());\n\t\tnode.right.setParent(successor);\n\t\tnode.setRight(null);\n\t\tsuccessor.setLeft(node.getLeft());\n\t\tnode.left.setParent(successor);\n\t\tnode.setLeft(null);\n\t\tsuccessor.setParent(node.getParent());\n\t\tif (node.parentSide() == 'L') {\n\t\t\tnode.parent.setLeft(successor);\n\t\t} else if (node.parentSide() == 'R') {// node.parentSide()=='R'\n\t\t\tnode.parent.setRight(successor);\n\t\t}\n\t\tnode.setParent(null);\n\t\treturn numOp;\n\n\t}", "private static <K extends Comparable<? super K>, V> @Nullable Node<K, V> removeAndCopy0(\n K key, @Var Node<K, V> current) {\n\n @Var int comp = key.compareTo(current.getKey());\n\n if (comp < 0) {\n // key < current.data\n if (current.left == null) {\n // Target key is not in map.\n return current;\n }\n\n // Go down leftwards, keeping a red node.\n\n if (!Node.isRed(current.left) && !Node.isRed(current.left.left)) {\n // Push red to left if necessary.\n current = makeLeftRed(current);\n }\n\n // recursive descent\n Node<K, V> newLeft = removeAndCopy0(key, current.left);\n current = current.withLeftChild(newLeft);\n\n } else {\n // key >= current.data\n if ((comp > 0) && (current.right == null)) {\n // Target key is not in map.\n return current;\n }\n\n if (Node.isRed(current.left)) {\n // First chance to push red to right.\n current = rotateClockwise(current);\n\n // re-update comp\n comp = key.compareTo(current.getKey());\n assert comp >= 0;\n }\n\n if ((comp == 0) && (current.right == null)) {\n assert current.left == null;\n // We can delete the node easily, it's a leaf.\n return null;\n }\n\n if (!Node.isRed(current.right) && !Node.isRed(current.right.left)) {\n // Push red to right.\n current = makeRightRed(current);\n\n // re-update comp\n comp = key.compareTo(current.getKey());\n assert comp >= 0;\n }\n\n if (comp == 0) {\n // We have to delete current, but is has children.\n // We replace current with the smallest node in the right subtree (the \"successor\"),\n // and delete that (leaf) node there.\n\n @Var Node<K, V> successor = current.right;\n while (successor.left != null) {\n successor = successor.left;\n }\n\n // Delete the successor\n Node<K, V> newRight = removeMininumNodeInTree(current.right);\n // and replace current with it\n current =\n new Node<>(\n successor.getKey(),\n successor.getValue(),\n current.left,\n newRight,\n current.getColor());\n\n } else {\n // key > current.data\n // Go down rightwards.\n\n Node<K, V> newRight = removeAndCopy0(key, current.right);\n current = current.withRightChild(newRight);\n }\n }\n\n return restoreInvariants(current);\n }", "private void singleRotationLR(BinaryNode node){\n if (node == root) {\n root = node.left;\n root.parent = null;\n root.right = node;\n node.parent = node.left;\n node.left = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = node.left;\n } else {\n node.parent.left = node.left;\n }\n node.left.parent = node.parent;\n node.left.right = node;\n node.parent = node.left;\n node.left = null;\n }\n }", "private WAVLNode treePos (WAVLTree tree,int key) {\n\t WAVLNode x=tree.root;\r\n\t WAVLNode y=EXT_NODE;\r\n\t while (x!=EXT_NODE) { \r\n\t\t y=x;\r\n\t\t y.sizen++;\r\n\t\t if (key==x.key){\r\n\t\t\t reFix(x);\r\n\t\t\t return x;\r\n\t\t }\r\n\t\t else if (key<x.key) {\r\n\t\t\t x=x.left;\r\n\t\t }\r\n\t\t else {\r\n\t\t\t x=x.right;\r\n\t\t }\r\n\t }\r\n\t return y;\r\n }", "private int joinFirstCase(AVLTree t1, IAVLNode x, AVLTree t2) {\r\n\t\t\t int returnValue = 0;\r\n\t\t\t IAVLNode curr = t2.getRoot();\r\n\t\t\t \r\n\t\t\t while(true) {\r\n\t\t\t\t if(curr.getHeight() <= t1.getRoot().getHeight())\r\n\t\t\t\t\t break;\r\n\t\t\t\t if(curr.getLeft().getHeight() == -1)\r\n\t\t\t\t\t break;\r\n\t\t\t\t curr = curr.getLeft();\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t if(t2.getRoot() == curr) {\r\n\t\t\t\t curr.setLeft(x);\r\n\t\t\t\t x.setParent(curr);\r\n\t\t\t\t curr.setHeight(curr.getHeight() + 1 );\r\n\t\t\t\t return 0;\r\n\t\t\t\t\t\t \r\n\t\t\t }\r\n\t\t\t returnValue = t2.getRoot().getHeight() - curr.getHeight();\r\n\t\t\r\n\t\t\t //replacing pointers\r\n\t\t\t x.setRight(curr);\r\n\t\t\t x.setParent(curr.getParent());\r\n\t\t\t curr.getParent().setLeft(x);\r\n\t\t\t curr.setParent(x);\r\n\t\t\t x.setLeft(t1.getRoot());\r\n\t\t\t t1.getRoot().setParent(x);\r\n\t\t\t t1.setRoot(t2.getRoot());\r\n\t\t\t x.setHeight(Math.max(x.getRight().getHeight(),x.getLeft().getHeight()) + 1);\r\n\t\t\t \r\n\t\t\t t2.minimum = t1.minimum;\r\n\t\t\t \r\n\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t HieghtsUpdating(x);\r\n\t\t\t SizesUpdate(x);\r\n\t\r\n\t\t\t return returnValue;\r\n\t\t\t \r\n\t\t}", "void fixViolation(Node node){\n\t\tNode parentPtr = nil;\n\t\tNode grParentPtr = nil;\n\t\t\n\t\twhile( node != root && node.colour != \"Black\" && node.parent.colour == \"Red\" && node.parent.parent != nil){\n\t\t\t\n\t\t\tparentPtr = node.parent;\n\t\t\tgrParentPtr = node.parent.parent;\n\t\t\t//case A\n\t\t\t//parent of node is the left child of grandparent\n\t\t\tif(parentPtr == grParentPtr.left){\n\t\t\t\tNode unclePtr = grParentPtr.right;\n\t\t\t\t\n\t\t\t\t//case 1 \n\t\t\t\t//Uncle is red in color\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//of node is the right child of its parent\n\t\t\t\t\tif(node == parentPtr.right){\n\t\t\t\t\t\trotateLeft(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the left child of its parent left rotation is required\n\t\t\t\t\trotateRight(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//case B\n\t\t\t//parent of the node is the right child of grand parent\n\t\t\tif(parentPtr == grParentPtr.right){\n\t\t\t\tNode unclePtr = grParentPtr.left;\n\t\t\t\t//case 1\n\t\t\t\t//uncle pointer is red\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//node is the left child of its parent right rotation is required\n\t\t\t\t\tif(node == parentPtr.left){\n\t\t\t\t\t\trotateRight(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the right child of its parent left rotation is required\n\t\t\t\t\trotateLeft(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\troot.colour = \"Black\";\n\t}", "private Node makeTree(Node currentNode, DataNode dataNode,\r\n\t\t\tint featureSubsetSize, int height) {\n\r\n\t\tif (dataNode.labels.size() < this.traineeDataSize / 25 || height > 7) {\r\n\t\t\treturn new Node(majority(dataNode));\r\n\t\t}\r\n\t\telse{\r\n\r\n\t\t\tEntropyCalculation e1 = new EntropyCalculation();\r\n\r\n\t\t\tNode n = e1.maxGainedElement(dataNode.features, dataNode.labels, featureSubsetSize); //new\r\n\r\n\r\n\t\t\tif(e1.zeroEntropy){\r\n\r\n\t\t\t\tcurrentNode = new Node(dataNode.labels.get(0));\r\n\r\n\t\t\t\t/*currentNode.attribute = dataNode.features;\r\n\t\t\t\tcurrentNode.decision = dataNode.labels;\r\n\t\t\t\tcurrentNode.nodeValue = dataNode.labels.get(0);*/\r\n\r\n\t\t\t\treturn currentNode;\r\n\t\t\t}\r\n\t\t\telse{\r\n\r\n\t\t\t\tcurrentNode = new Node();\r\n\r\n\t\t\t\tcurrentNode.featureIndexColumn = n.featureIndexColumn;\r\n\t\t\t\tcurrentNode.featureIndexRow = n.featureIndexRow;\r\n\r\n\t\t\t\tcurrentNode.attribute = dataNode.features;\r\n\t\t\t\tcurrentNode.decision = dataNode.labels;\r\n\r\n\t\t\t\tcurrentNode.nodeValue = dataNode.features.get(currentNode.featureIndexRow).get(currentNode.featureIndexColumn);\r\n\r\n\t\t\t\tcurrentNode.leftChild = new Node();\r\n\t\t\t\tcurrentNode.rightChild = new Node();\r\n\r\n\t\t\t\tDataNode leftNode = new DataNode();\r\n\t\t\t\tDataNode rightNode = new DataNode();\r\n\r\n\t\t\t\tfor (int i = 0; i < dataNode.features.size(); i++) {\r\n\r\n\t\t\t\t\tif(currentNode.nodeValue >= dataNode.features.get(i).get(currentNode.featureIndexColumn)) {\r\n\r\n\t\t\t\t\t\tleftNode.features.add(dataNode.features.get(i));\r\n\t\t\t\t\t\tleftNode.labels.add(dataNode.labels.get(i));\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\trightNode.features.add(dataNode.features.get(i));\r\n\t\t\t\t\t\trightNode.labels.add(dataNode.labels.get(i));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif((leftNode.labels.isEmpty() || rightNode.labels.isEmpty()) && height == 0){\r\n\t\t\t\t\tSystem.out.println(\"Ghapla\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcurrentNode.leftChild = makeTree(currentNode.leftChild, leftNode, featureSubsetSize, height+1);\r\n\r\n\t\t\t\tcurrentNode.rightChild = makeTree(currentNode.rightChild, rightNode, featureSubsetSize, height+1);\r\n\r\n\t\t\t\treturn currentNode;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n BinaryTreeNode<Integer> tree = new BinaryTreeNode<>(3);\n tree.setLeft(new BinaryTreeNode<>(2));\n tree.getLeft().setLeft(new BinaryTreeNode<>(1));\n tree.getLeft().getLeft().setLeft(new BinaryTreeNode<>(10));\n tree.getLeft().getLeft().getLeft().setRight(new BinaryTreeNode<>(13));\n tree.setRight(new BinaryTreeNode<>(5));\n tree.getRight().setLeft(new BinaryTreeNode<>(4));\n tree.getRight().setRight(new BinaryTreeNode<>(6));\n List<List<Integer>> result = btDepthOrder(tree);\n List<List<Integer>> goldenRes = new ArrayList<>();\n goldenRes.add(Arrays.asList(3));\n goldenRes.add(Arrays.asList(2, 5));\n goldenRes.add(Arrays.asList(1, 4, 6));\n goldenRes.add(Arrays.asList(10));\n goldenRes.add(Arrays.asList(13));\n goldenRes.add(new ArrayList());\n System.out.println(goldenRes.equals(result));\n System.out.println(result);\n }", "private BinarySearchTree deleteTree(BinarySearchTree tree, Comparable key){\r\n\t\t\r\n\t\t//If it is a leaf\r\n\t\tif(tree.getLeftChild() == null && tree.getRightChild() == null){\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t//Tree has only 1 leaf\r\n\t\telse if( (tree.getLeftChild() == null && tree.getRightChild() != null) ||\r\n\t\t\t\t (tree.getLeftChild() != null && tree.getRightChild() == null)){\r\n\t\t\t\r\n\t\t\t//Make a new tree out of the leaf and make it the new root\r\n\t\t\tif(tree.getLeftChild() != null){\r\n\t\t\t\treturn tree.getLeftChild();\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn tree.getRightChild();\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Has two leaves. This case is slightly more complicated\r\n\t\telse{\r\n\t\t\t//get the leftmost item in the right child subtree. This becomes the \r\n\t\t\t//new root. This allows the BinarySearchTree to stay a valid \r\n\t\t\t//BinarySearchTree\r\n\t\t\tKeyedItem replacementItem = findLeftMost(tree.getRightChild());\r\n\t\t\t\r\n\t\t\t//Delete the tree with that item so it can be moved to the new root\r\n\t\t\tBinarySearchTree replacementTree = deleteLeftMost(tree.getRightChild());\r\n\t\t\t\r\n\t\t\t//change the root to the new item\r\n\t\t\ttree.setRootItem(replacementItem);\r\n\t\t\t\r\n\t\t\t//Set the new roots right tree to the replacement tree\r\n\t\t\ttree.attachRightSubtree(replacementTree);\r\n\t\t\treturn tree;\r\n\t\t}\r\n\t}", "private A deleteLargest(int subtree) {\n return null; \n }", "@Test\n void removeLeaves_on3HeightLeftSpindlyTree_returnsCorrectTree() {\n IntTree tree = new IntTree(6,\n 5, 2,\n 4, null, null, null,\n 1, 3);\n IntTreeProblems.removeLeaves(tree);\n IntTree expected = new IntTree(6,\n 5, null,\n 4);\n assertThat(tree).isEqualTo(expected);\n }", "@Override\n public float getTreeBalance() {\n\treturn 0;\n }", "@Test\n\tpublic void testInsert4() {\n\t\t\n\t\tBTree<Long,String> T = new BTree<Long, String>(3);\n\t\tT.insert(new Long(10), \"Ten\");\n\t\tT.insert(new Long(20), \"Twenty\");\n\t\tT.insert(new Long(30), \"Thirty\");\n\t\t\n\t\tT.insert(new Long(70), \"Seventy\");\n\t\tT.insert(new Long(60), \"Sixty\");\n\t\tT.insert(new Long(80), \"Eighty\");\n\t\t\n\t\tT.insert(new Long(50), \"Fifty\");\n\t\tT.insert(new Long(40), \"Fourty\");\n\t\tT.insert(new Long(55), \"Fifty-Five\");\n\t\tT.insert(new Long(65), \"Sixty-Five\");\n\t\t\n\t\tassertTrue( T.root instanceof InnerNode);\n\t\t\n\t\tInnerNode<Long,String> root = (InnerNode<Long,String>) T.root;\n\t\tassertEquals(1, root.keys.size());\n\t\tassertEquals(60, (long) root.keys.get(0));\n\t\tassertEquals(2, root.children.size());\n\t\t\n\t\tInnerNode<Long,String> left = (InnerNode<Long,String>) root.children.get(0);\n\t\tInnerNode<Long,String> right = (InnerNode<Long,String>) root.children.get(1);\n\t\t\n\t\tassertEquals(30, (long) left.keys.get(0));\n\t\tassertEquals(50, (long) left.keys.get(1));\n\t\t\n\t\tassertEquals(70, (long) right.keys.get(0));\n\t\t\n\t\tLeafNode<Long, String> child0 = (LeafNode<Long, String>) left.children.get(0);\n\t\tLeafNode<Long, String> child1 = (LeafNode<Long, String>) left.children.get(1);\n\t\t\n\t\tLeafNode<Long, String> child2 = (LeafNode<Long, String>) left.children.get(2);\n\t\t\n\t\tLeafNode<Long, String> child3 = (LeafNode<Long, String>) right.children.get(0);\n\t\tLeafNode<Long, String> child4 = (LeafNode<Long, String>) right.children.get(1);\n\t\t\n\t\tassertEquals(10, (long) child0.children.get(0).key);\n\t\tassertEquals(20, (long) child0.children.get(1).key);\n\t\t\n\t\tassertEquals(30, (long) child1.children.get(0).key);\n\t\tassertEquals(40, (long) child1.children.get(1).key);\n\t\t\n\t\tassertEquals(50, (long) child2.children.get(0).key);\n\t\tassertEquals(55, (long) child2.children.get(1).key);\n\t\t\n\t\tassertEquals(60, (long) child3.children.get(0).key);\n\t\tassertEquals(65, (long) child3.children.get(1).key);\n\t\t\n\t\tassertEquals(70, (long) child4.children.get(0).key);\n\t\tassertEquals(80, (long) child4.children.get(1).key);\n\t\t\n\t}", "public Node closestPrecedingNode(int id);", "public T fjern(){\n Node temp = hode.neste;\n temp.neste.forrige = hode;\n hode.neste = temp.neste;\n elementer--;\n return temp.element;\n }", "@Override\n\tpublic boolean add(T elem) {\n\t\tif (this.contains(elem)) { // no duplicates\n\t\t\treturn false;\n\t\t} else if (valCount < 3) { // if has space for more\n\t\t\tif (childCount == 0) { // add elem as direct descendant\n\t\t\t\tfor (int i = 0; i < valCount; ++i) {\n\t\t\t\t\tif (comp.compare(elem,values[i]) < 0) {\n\t\t\t\t\t\tfor (int j = 2; j > i; --j) { // shifts all other elements by 1\n\t\t\t\t\t\t\tvalues[j] = values[j - 1];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvalues[i] = elem;\n\t\t\t\t\t++valCount;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} else { // add elem as indirect descendant\n\t\t\t\tfor (int i = 0; i < childCount; ++i) { // searching with which child elem belongs\n\t\t\t\t\tif (comp.compare(elem,values[i]) < 0) {\n\t\t\t\t\t\treturn children[i].add(elem);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn children[childCount].add(elem); // elem is greater than all other children and should be put rightmost\n\t\t\t}\n\t\t} else { // node is 4-tree and should be reduced\n\t\t\tTwoThreeFourTreeSet<T> tempLeft = new TwoThreeFourTreeSet<T>(); // generating new left and right children of reduced node\n\t\t\tTwoThreeFourTreeSet<T> tempRight = new TwoThreeFourTreeSet<T>();\n\t\t\t\n\t\t\ttempLeft.values[0] = values[0];\n\t\t\ttempLeft.valCount = 1;\n\t\t\ttempLeft.children[0] = this.children[0];\n\t\t\ttempLeft.children[1] = this.children[1];\n\t\t\ttempLeft.childCount = 2;\n\t\t\t\n\t\t\ttempRight.values[0] = values[2];\n\t\t\ttempRight.valCount = 1;\n\t\t\ttempRight.children[0] = this.children[2];\n\t\t\ttempRight.children[1] = this.children[3];\n\t\t\ttempRight.childCount = 2;\n\t\t\t\n\t\t\tif (parent == null) { // if no parent, create new node with middle value\n\t\t\t\tTwoThreeFourTreeSet<T> tempParent = new TwoThreeFourTreeSet<T>();\n\t\t\t\ttempParent.values[0] = values[1];\n\t\t\t\t\t\n\t\t\t\ttempParent.children[0] = tempLeft;\n\t\t\t\ttempParent.children[1] = tempRight;\n\t\t\t\ttempParent.childCount = 2;\n\t\t\t\tthis.parent = tempParent;\n\t\t\t} else { // else parent exists, and current node should be added\n\t\t\t\tif (comp.compare(parent.values[0],values[1]) < 0) { // if node belongs leftmost\n\t\t\t\t\tif (parent.valCount > 1) {\n\t\t\t\t\t\t// shift right element by 1\n\t\t\t\t\t\tparent.values[2] = parent.values[1];\n\t\t\t\t\t\tparent.children[3] = parent.children[2];\n\t\t\t\t\t}\n\t\t\t\t\t// shift left element by 1\n\t\t\t\t\tparent.values[1] = parent.values[0];\n\t\t\t\t\tparent.children[2] = parent.children[1];\n\t\t\t\t\t\n\t\t\t\t\t// push left;\n\t\t\t\t\tparent.values[0] = values[1];\n\t\t\t\t\tparent.children[0] = tempLeft;\n\t\t\t\t\tparent.children[1] = tempRight;\n\t\t\t\t} else if (parent.valCount < 2 || comp.compare(parent.values[1],values[1]) < 0) { // if node belongs in center\n\t\t\t\t\tif (parent.valCount > 1) { // should we shift?\n\t\t\t\t\t\tparent.values[2] = parent.values[1];\n\t\t\t\t\t\tparent.children[3] = parent.children[2];\n\t\t\t\t\t}\n\t\t\t\t\t// push center\n\t\t\t\t\tparent.values[1] = values[1];\n\t\t\t\t\tparent.children[1] = tempLeft;\n\t\t\t\t\tparent.children[2] = tempRight;\n\t\t\t\t} else { // if node belongs rightmost\n\t\t\t\t\t// push right\n\t\t\t\t\tparent.values[2] = values[1];\n\t\t\t\t\tparent.children[2] = tempLeft;\n\t\t\t\t\tparent.children[3] = tempRight;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tTwoThreeFourTreeSet<T> newTree = this;\n\t\t\tnewTree = newTree.parent; // changing this indirectly\n\t\t\t++newTree.valCount;\n\t\t\treturn newTree.add(elem);\n\t\t}\n\t\treturn false;\n\t}", "public int goodNodes(TreeNode root) {\n helper(root, Integer.MIN_VALUE);\n return res;\n }", "private void doubleRotationRL(BinaryNode node) {\n BinaryNode temp = min(node.right);\n if (node == root) {\n root = temp;\n if (temp.parent.right == temp) { //temp could have a child on the right\n temp.parent.right = temp.right;\n if (temp.right != null) temp.right.parent = temp.parent;\n }\n else {\n temp.parent.left = temp.right;\n if (temp.right != null) temp.right.parent = temp.parent;\n }\n root.parent = null;\n root.left = node;\n root.right = node.right;\n if(node.right != null) node.right.parent = root;\n node.parent = root;\n node.right = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = temp;\n } else {\n node.parent.left = temp;\n }\n temp.parent = node.parent;\n temp.right = node.right;\n if(node.right != null) node.right.parent = temp;\n temp.left = node;\n node.parent = temp;\n node.right = null;\n }\n }", "private void pruneTree(QuadNode node){\n int i;\n while(node.parent != null && node.quads[0] == null && node.quads[1] == null && node.quads[2] == null && node.quads[3] == null){\n i=0;\n if(node.x != node.parent.x){\n i++;\n }\n if(node.z != node.parent.z){\n i+=2;\n }\n node = node.parent;\n node.quads[i] = null;\n }\n }", "private double calcErrForNeighbour(GNode node) {\n return 0.0;\n }", "int getBaseNode();", "private void removeFixUp(RBNode<T> node, RBNode<T> parent) {\r\n RBNode<T> other;\r\n\r\n while((node == null || isBlack(node)) && (node != this.root)) {\r\n if(parent.left == node) { //node is leftChild\r\n other = parent.right; //brother of node\r\n if(isRed(other)) { //case1: brother is red\r\n setBlack(other);\r\n setRed(parent);\r\n leftRotate(parent);\r\n other = parent.right;\r\n }\r\n\r\n //case2: brother is black, both children of brother is black\r\n if((other.left == null || isBlack(other.left)) &&\r\n (other.right == null || isBlack(other.right))) {\r\n setRed(other);\r\n node = parent;\r\n parent = parentOf(node);\r\n } else {\r\n //case3: brother is black, left red right black\r\n if(other.right == null || isBlack(other.right)) {\r\n setBlack(other.left);\r\n setRed(other);\r\n rightRotate(other);\r\n other = parent.right;\r\n }\r\n\r\n //case4: brother is black, right red left any color\r\n setColor(other, colorOf(parent));\r\n setBlack(parent);\r\n setBlack(other.right);\r\n leftRotate(parent);\r\n node = this.root;\r\n break;\r\n }\r\n } else {\r\n other = parent.left;\r\n\r\n if (isRed(other)) {\r\n //case1: brother is red\r\n setBlack(other);\r\n setRed(parent);\r\n rightRotate(parent);\r\n other = parent.left;\r\n }\r\n\r\n if ((other.left==null || isBlack(other.left)) &&\r\n (other.right==null || isBlack(other.right))) {\r\n //case2: brother is black, both children of brother is black\r\n setRed(other);\r\n node = parent;\r\n parent = parentOf(node);\r\n } else {\r\n\r\n if (other.left==null || isBlack(other.left)) {\r\n //case3: brother is black, left red right black\r\n setBlack(other.right);\r\n setRed(other);\r\n leftRotate(other);\r\n other = parent.left;\r\n }\r\n\r\n //case4: brother is black, left red right any color\r\n setColor(other, colorOf(parent));\r\n setBlack(parent);\r\n setBlack(other.left);\r\n rightRotate(parent);\r\n node = this.root;\r\n break;\r\n }\r\n }\r\n }\r\n if (node!=null)\r\n setBlack(node);\r\n }", "io.dstore.values.IntegerValue getTreeNodeIdForVariantMatrix();", "Pair<String,LeafNode> chooseNode(T i){\n Set<Map.Entry<String, Identifier>> s= leafInfos.entrySet();\n Identifier page=null;\n LeafNode ln = null;\n for(Map.Entry<String,Identifier> p: s){\n TriangleShape t = triangleEncoder.parse(p.getKey());\n if(Geom2DSuits.contains(t,i.getLowerBound(),i.getUpperBound())){\n ln = readNode(p.getValue());\n return new Pair<String,LeafNode>(p.getKey(),ln);\n }\n\n// int r = test(t,(Interval)i);\n// if(r==0)\n// continue;\n// else{\n// page = p.getValue();\n// if(page.longValue()!=-1)\n// ln = readNode(page);\n// else{\n// ln = new LeafNode();\n// }\n// return new Pair<String,LeafNode>(p.getKey(),ln);\n// }\n }\n\n //2. there is no leaf node that contains i, scan the emptyNodes only when the insertion is running\n int k=0;\n for(String str: emptyNodes){\n TriangleShape t = triangleEncoder.parse(str);\n if(Geom2DSuits.contains(t,i.getLowerBound(),i.getUpperBound())){\n String sss = emptyNodes.remove(k);\n ln = new LeafNode();\n ln.triangle = t;\n return new Pair<String,LeafNode>(sss,ln);\n }\n ++k;\n }\n\n //3. error\n assert false;\n return new Pair<String,LeafNode>(null,null);\n }", "public static void main(String[] args) {\n\t\tint array[]={2,3,4,6};\n\t\tint n=array.length;\n\t\tint maximum=Integer.MIN_VALUE;\n\t\tint minimum=Integer.MAX_VALUE;\n\t\tfor(int i:array)\n\t\t{\n\t\t\tif(i>maximum)\n\t\t\t\tmaximum=i;\n\t\t\tif(i<minimum)\n\t\t\t\tminimum=i;\n\t\t}\n\t\t\n\t\tint mark[]=new int[maximum+2];\n\t\tint value[]=new int[maximum+2];\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tmark[array[i]]=1; // marking ki exist karta hai no need to search in the array.\n\t\t\tvalue[array[i]]=1; //har value se ek fbt to banega hi (1 node ka)\n\t\t}\n\t\tint ans=0;\n\t\tfor(int i=minimum;i<=maximum;i++){\n\t\t\tif(mark[i]==1) // element is present in the array.// we have found the first factor now find 2nd factor.\n\t\t\t{\n\t\t// find the multiples of arr[i] which are less than max value and also less than its square\n\t\t\tfor(int j=i+i ;j<=maximum && j/i<=i;j=j+i)\n\t\t\t{\n\t\t\t\tif(mark[j]==1 && mark[j/i]==1) // i is the first factor and j/i is the 2nd factor.j is the product that serves as root.\n\t\t\t\t{\n\t\t\t\t\t// value =all combination of left child with right child.\n\t\t\t\t\tvalue[j]=value[j] + (value[i] * value[j/i]);\n\t\t\t\t\t\n\t\t\t\t\t// if the 2 child are not same then one more orientation.\n\t\t\t\t\tif(i!=(j/i))\n\t\t\t\t\t\tvalue[j]=value[j] + (value[i] * value[j/i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t}\n\t\t\tans=ans+value[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}", "@Test\n public void testPhylogeneticTreeParserUnnamednodesAndDistance() {\n // create the actual tree\n String tree = \"(:0.1,:0.2,(:0.3,:0.4):0.5);\";\n PhylogeneticTreeItem rootActual = PhylogeneticTreeParser.parse(tree);\n\n // create the expected Tree\n // root node\n PhylogeneticTreeItem rootExpected = new PhylogeneticTreeItem();\n // add 3 child nodes\n PhylogeneticTreeItem current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n current.setDistance(0.2);\n current = new PhylogeneticTreeItem();\n current.setDistance(0.1);\n current.setParent(rootExpected);\n current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n current.setDistance(0.5);\n // add 2 child nodes to the third node\n PhylogeneticTreeItem current2 = new PhylogeneticTreeItem();\n current2.setParent(current);\n current2.setDistance(0.3);\n current2 = new PhylogeneticTreeItem();\n current2.setParent(current);\n current2.setDistance(0.4);\n // compare the trees\n assertEquals(\"both trees do not match\", rootExpected, rootActual);\n\n }", "@Override\r\n\tpublic int compareTo(Object o) {\n\t\tNode other=(Node)o;\r\n\t\t\r\n\t\t\r\n\t\treturn this.getWeight()-other.getWeight();//正序,\r\n\t}", "private static <K, V> Node<K, V> restoreInvariants(@Var Node<K, V> current) {\n if (Node.isRed(current.right)) {\n // Right should not be red in a left-leaning red-black tree.\n current = rotateCounterclockwise(current);\n }\n\n if (Node.isRed(current.left) && Node.isRed(current.left.left)) {\n // Don't have consecutive red nodes.\n current = rotateClockwise(current);\n }\n\n if (Node.isRed(current.left) && Node.isRed(current.right)) {\n // Again, don't have red right children.\n // We make both children black and this one red,\n // so we pass the potential problem of having a red right upwards in the tree.\n current = colorFlip(current);\n }\n\n return current;\n }", "private void pruneRecur(BinaryNode node, Integer sum, Integer k) {\n\n if (node == null) return;\n else {\n sum += (Integer)node.element;\n if (largestPath(node.left, sum) >= k) {\n pruneRecur(node.left, sum, k);\n } else {\n node.left = null;\n }\n if (largestPath(node.right, sum) >= k) {\n pruneRecur(node.right, sum, k);\n } else {\n node.right = null;\n }\n }\n }", "private int getRoot(int index) {\n while(index < nodes.length && index != nodes[index]) {\n index = nodes[index];\n }\n return nodes[index];\n }", "public TreeNode convertBST(TreeNode root){\n\t\t\n\t\tif( root == null){\n\t\t\treturn null;\n\t\t}\n\t\t\n//\t\tint l = root.val;\n\t\tTreeNode right = convertBST(root.right);\n\t\t\n//\t\troot.val = root.val + right.val;\n\t\tsum = sum + root.val;\n\t\troot.val = sum;\n//\t\tSystem.out.println(root.val);\n\n\t\tTreeNode left = convertBST(root.left);\n\t\t\n//\t\troot.val = root.val + left.val;\n\t\t\n//\t\tif(right == null)\n//\t\t\tright.val = 0;\n//\t\tif(left == null)\n//\t\t\tleft.val = 0;\n\t\t\n//\t\troot.val = root.val + right.val + left.val;\n//\t\troot.val = root.val + right.val;\n\t\t\n//\t\tsum = sum + root.val;\n//\t\troot.val = sum;\n\t\t\n\t\t\n//\t\tSystem.out.println(root.val);\n\t\t\n\t\t\n\t\treturn root;\n\t\t\n\t\t\n\t\t\n//\t\tif(root!=null){\n//\t\t\tconvertBST(root.right);\n//\t\t\tsum = sum + root.val;\n//\t\t\troot.val = sum;\n//\t\t\tconvertBST(root.left);\n//\t\t}\n//\t\treturn root;\n\t\t\n\t\t\n\t}", "public void RecursiveExpansion() throws TreeTooBigException {\r\n int transIndex; //Index to count transitions\r\n int[] newMarkup; //markup used to create new node\r\n boolean aTransitionIsEnabled = false; //To check for deadlock\r\n //Attribute used for assessing whether a node has occured before\r\n boolean repeatedNode = false; \r\n \r\n boolean allOmegas = false;\r\n \r\n boolean[] enabledTransitions = \r\n tree.dataLayer.getTransitionEnabledStatusArray(markup);\r\n\r\n //For each transition\r\n for (int i = 0; i < enabledTransitions.length; i++) {\r\n if (enabledTransitions[i] == true) {\r\n //Set transArray of to true for this index\r\n transArray[i] = true;\r\n \r\n //System.out.println(\"\\n Transition \" + i + \" Enabled\" );\r\n aTransitionIsEnabled = true;\r\n \r\n //print (\"\\n Old Markup is :\", markup);//debug\r\n \r\n //Fire transition to produce new markup vector\r\n newMarkup = fire(i);\r\n \r\n //print (\"\\n New Markup is :\", newMarkup);//debug\r\n \r\n //Check for safeness. If any of places have > 1 token set variable.\r\n for (int j = 0; j < newMarkup.length; j++) {\r\n if (newMarkup[j] > 1 || newMarkup[j] == -1) {\r\n tree.moreThanOneToken = true;\r\n break;\r\n }\r\n } \r\n \r\n //Create a new node using the new markup vector and attach it to\r\n //the current node as a child.\r\n children[i] = \r\n new myNode(newMarkup, this, tree, depth + 1);\r\n \r\n /* Now need to (a) check if any omegas (represented by -1) need to \r\n * be inserted in the markup vector of the new node, and (b) if the \r\n * resulting markup vector has appeared anywhere else in the tree. \r\n * We must do (a) before (b) as we need to know if the new node \r\n * contains any omegas to be able to compare it with existing nodes. \r\n */ \r\n allOmegas = children[i].InsertOmegas();\r\n \r\n //check if the resulting markup vector has occured anywhere else in the tree\r\n repeatedNode = (tree.root).FindMarkup(children[i]);\r\n \r\n if (tree.nodeCount >= Pipe.MAX_NODES && !tree.tooBig) {\r\n tree.tooBig = true;\r\n throw new TreeTooBigException();\r\n }\r\n \r\n if (!repeatedNode && !allOmegas) {\r\n children[i].RecursiveExpansion();\r\n }\r\n }\r\n }\r\n \r\n if (!aTransitionIsEnabled) {\r\n System.err.println(\"No transition enabled\");\r\n if (!tree.noEnabledTransitions || tree.pathToDeadlock.length < depth-1) {\r\n RecordDeadlockPath();\r\n tree.noEnabledTransitions = true;\r\n } else {\r\n System.err.println(\"Deadlocked node found, but path is not shorter\"\r\n + \" than current path.\");\r\n }\r\n } else {\r\n //System.out.println(\"Transitions enabled.\");\r\n }\r\n }", "static int downToZero(Node root) {\n /*\n * Write your code here.\n */\n Queue<Node> queue = new PriorityQueue<>();\n queue.add(root);\n int min = 100001;\n while (!queue.isEmpty()){\n Node current = queue.poll();\n if(current.value <= 4){\n if (current.value == 4){\n min = current.depth + 3;\n return min;\n }\n min = current.depth+current.value;\n return min;\n }\n Node toAdd1 = new Node(current.value-1, current.depth+1);\n queue.add(toAdd1);\n for(int i = 2; i<=Math.sqrt(current.value); i++){\n if(current.value%i==0){\n Node toAdd = new Node(current.value/i, current.depth+1);\n queue.add(toAdd);\n }\n }\n }\n return min;\n }", "public int insert(int k, String i) { // insert a node with a key of k and info of i, the method returns the number of rebalance operation\r\n WAVLNode x = new WAVLNode(k,i);// create the new node to insert\r\n x.left=EXT_NODE;\r\n x.right=EXT_NODE;\r\n if(root==EXT_NODE) { // checking if the tree is empty, in that case put x as a root\r\n \t root=x;\r\n \t return 0;\r\n }\r\n WAVLNode y = treePos(this, k); // find the correct position to insert the node\r\n int [] f = {x.key,y.key};\r\n if (f[0]==f[1]) { // in case the key is already exists in the tree, return -1 and dosent insert anything\r\n \t \r\n \t return -1;\r\n }\r\n x.parent=y; \r\n if(y.rank!=0) {// if y is onary do:\r\n \t if(x.key<y.key) {// check if x should be left son of y\r\n \t\t y.left=x;\r\n \t }\r\n \t else { // x should be right son of y\r\n \t\t y.right=x;\r\n \t }\r\n \t return 0; // no rebalance operation was needed, return 0\r\n }\r\n if(x.key<y.key) { // if y is a leaf\r\n \t y.left=x;\r\n }\r\n else {\r\n \t y.right=x;\r\n }\r\n int cnt=0;//rebalance operation to return\r\n while(x.parent!=null&&x.parent.rank-x.rank==0) { // while the tree is not balanced continue to balance the tree\r\n \t if(parentside(x.parent, x).equals(\"left\")) { // check if x is a left son of x's parent\r\n \t\t if (x.parent.rank-x.parent.right.rank==1) {//check the conditions for promotion\r\n \t\t\t promote(x.parent);\r\n \t\t\t x=x.parent;\r\n \t\t\t cnt++;\r\n \t\t }\r\n \t\t else if(x.rank-x.left.rank==1) { // check the conditions for rotate\r\n \t\t\t rightRotate(x);\r\n \t\t\t cnt+=2;\r\n \t\t }\r\n \t\t else {\r\n \t\t\t doubleRotateleft(x); // check the conditions for double rotate\r\n \t\t\t cnt+=5;\r\n \t\t }\r\n \t }\r\n \t else { // x is a right son of x's parent, all conditions and actions are symmetric to the left side\r\n \t\t if (x.parent.rank-x.parent.left.rank==1) {\r\n \t\t\t promote(x.parent);\r\n \t\t\t x=x.parent;\r\n \t\t\t cnt++;\r\n \t\t }\r\n \t\t else if(x.rank-x.right.rank==1) {\r\n \t\t\t leftRotate(x);\r\n \t\t\t cnt+=2;\r\n \t\t }\r\n \t\t else {\r\n \t\t\t \r\n \t\t\t doubleRotateright(x);\r\n \t\t\t cnt+=5;\r\n \t\t }\r\n \t }\r\n }\r\n return cnt;\r\n \r\n }", "public void insert(double key, Double value){\n\tif(search(key)!=null){\r\n\t\tLeaf Leaf = (Leaf)Search(root, key);\r\n\t\t\r\n\t\tfor(int i=0; i<Leaf.keyvalues.size(); i++) {\r\n\t\t\tif(key==Leaf.getKeyValue(i).getKey()) {\r\n\t\t\t\t\tLeaf.getKeyValue(i).values.add(value);\r\n\t\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}\r\n\t\r\n\tLeaf newleaf = new Leaf(key, value);\r\n\t\r\n\tPair<Double,Node> entry=new Pair<Double, Node>(key,newleaf);\r\n\r\n\tif(root == null ) {\r\n\t\troot = entry.getValue();\r\n\t}\r\n\t\r\n\r\n\tPair<Double, Node> newChildEntry = getChildEntry(root, entry, null);\r\n\t\r\n\tif(newChildEntry == null) {\r\n\t\treturn;\r\n\t} else {\r\n\t\tIntrnlNode newRoot = new IntrnlNode(newChildEntry.getKey(), root, newChildEntry.getValue());\r\n\t\troot = newRoot;\r\n\t\treturn;\r\n\t}\r\n}", "public int delete(int k){\n\t WAVLNode x = treePosForDel(this, k); // find the node to delete\r\n\t int cnt = 0; // rebalance operations counter\r\n\t if(x.key!=k) { // if a node with a key of k doesnt exist in the tree there is nothing to delete, return -1\r\n\t\t return -1;\r\n\t }\r\n\t if(this.root.key==x.key&&this.root.rank==0) {//root is a leaf\r\n\t\t this.root=EXT_NODE;// change the root pointer to EXT_NODE\r\n\t\t return 0;\r\n\t }\r\n\t else if(this.root.key==x.key&&(this.root.right==EXT_NODE||this.root.left==EXT_NODE)) {//root is onary\r\n\t\t if(x.left!=EXT_NODE) { // x is a root with a left child\r\n\t\t\t x.left.parent = null;\r\n\t\t\t this.root = x.left; // change the root pointer to the root's left child\r\n\t\t\t x.left.sizen=1;\r\n\t\t\t return 0;\r\n\t\t }\r\n\t\t x.right.parent = null; // x is a root with a right child \r\n\t\t x.right.sizen=1;\r\n\t\t this.root = x.right; // change the root pointer to the root's right child\r\n\t\t return 0;\r\n\t }\r\n\t WAVLNode z;\r\n\t if(isInnerNode(x)) {// x is an inner node, requires a call for successor and swap\r\n\t\t z = successorForDel(x); // find the successor of x\r\n\t\t x = swap(x,z); // put x's successor instead of x and delete successor \r\n\t }\r\n\t\t if(x.rank == 0) {//x is a leaf\r\n\t\t\t if(parentside(x.parent, x).equals(\"left\")) { // x is a left child of it's parent, requires change in pointers \r\n\t\t\t\t x.parent.left = EXT_NODE;\r\n\t\t\t\t z = x.parent;\r\n\t\t\t\t x = x.parent.left;\r\n\t\t\t }\r\n\t\t\telse { // x is a right child of it's parent, requires change in pointers \r\n\t\t\t\t x.parent.right = EXT_NODE;\r\n\t\t\t\t z = x.parent;\r\n\t\t\t\t x = x.parent.right; \r\n\t\t\t }\r\n\t\t }\r\n\t\t else {//x is onary\r\n\t\t\t boolean onaryside = onaryLeft(x); // check if x is onary with a left child\r\n\t\t\t WAVLNode x_child = EXT_NODE;\r\n\t\t\t if (onaryside) {\r\n\t\t\t\t x_child=x.left; // get a pointer for x child\r\n\t\t\t }\r\n\t\t\t else {\r\n\t\t\t\t x_child=x.right;\r\n\t\t\t }\r\n\t\t\t if(parentside(x.parent, x).equals(\"left\")) { // x is a left child of its parent, change pointers for delete and rebalance loop\r\n\t\t\t\t x.parent.left=x_child;\r\n\t\t\t\t x_child.parent=x.parent;\r\n\t\t\t\t z=x.parent;\r\n\t\t\t\t x=x_child;\r\n\t\t\t\t \r\n\t\t\t }\r\n\t\t\t else {// x is a left child of its parent, change pointers for delete and rebalance loop\r\n\t\t\t\t x.parent.right=x_child;\r\n\t\t\t\t x_child.parent=x.parent;\r\n\t\t\t\t z=x.parent;\r\n\t\t\t\t x=x_child;\r\n\t\t\t }\r\n\t\t }\r\n\t if (z.left.rank==-1&&z.right.rank==-1) {//special case, z becomes a leaf, change pointers and demote\r\n\t\t demote(z);\r\n\t\t x=z;\r\n\t\t z=z.parent;\r\n\t\t cnt++;\r\n\t }\r\n\t \r\n\t while(z!=null&&z.rank-x.rank==3) { // while the tree is not balanced continue to balance the tree\r\n\t\t if(parentside(z, x).equals(\"left\")) { // x is z's left son\r\n\t\t\t if(z.rank-z.right.rank==2) {//condition for demote\r\n\r\n\t\t\t\t demote(z);\r\n\r\n\t\t\t\t x=z;\r\n\t\t\t\t z=z.parent;\r\n\t\t\t\t cnt++;\r\n\t\t\t }\r\n\t\t\t else {\r\n\t\t\t\t if(z.right.rank-z.right.left.rank==2&&z.right.rank-z.right.right.rank==2) {//condition for doubledemote left\r\n\t\t\t\t\t doubleDemoteLeft(z);\r\n\t\t\t\t\t x=z;\r\n\t\t\t\t\t z=z.parent;\r\n\t\t\t\t\t cnt+=2;\r\n\t\t\t\t\t \r\n\t\t\t\t }\r\n\t\t\t\t else if((z.right.rank-z.right.left.rank==1||z.right.rank-z.right.left.rank==2)&&z.right.rank-z.right.right.rank==1) {// condition for rotate left for del\r\n\t\t\t\t\t rotateLeftDel(z);\r\n\t\t\t\t\t cnt+=3;\r\n\t\t\t\t\t break; // tree is balanced\r\n\t\t\t\t }\r\n\t\t\t\t else {//condition for doublerotate left for del\r\n\t\t\t\t\t doubleRotateLeftDel(z);\r\n\t\t\t\t\t \r\n\t\t\t\t\t cnt=cnt+5;\r\n\t\t\t\t\t break; // tree is balanced\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t }\r\n\t\t else { // x is z's right son, conditions are symmetric to left side\r\n\t\t\t if(z.rank-z.left.rank==2) {\r\n\t\t\t\t demote(z);\r\n\t\t\t\t x=z;\r\n\t\t\t\t z=z.parent;\r\n\t\t\t\t cnt++;\r\n\t\t\t\t \r\n\t\t\t }\r\n\t\t\t else {\r\n\t\t\t\t if(z.left.rank-z.left.right.rank==2&&z.left.rank-z.left.left.rank==2) {\r\n\t\t\t\t\t doubleDemoteright(z);\r\n\t\t\t\t\t x=z;\r\n\t\t\t\t\t z=z.parent;\r\n\t\t\t\t\t cnt+=2;\r\n\t\t\t\t }\r\n\t\t\t\t else if((z.left.rank-z.left.right.rank==1||z.left.rank-z.left.right.rank==2)&&z.left.rank-z.left.left.rank==1) {\r\n\t\t\t\t\t rotateRightDel(z);\r\n\t\t\t\t\t cnt+=3;\r\n\t\t\t\t\t break;\r\n\t\t\t\t }\r\n\t\t\t\t else {\r\n\r\n\t\t\t\t\t doubleRotateRightDel(z);\r\n\t\t\t\t\t cnt+=5;\r\n\t\t\t\t\t break;\r\n\t\t\t\t }\r\n\t\t\t\t \r\n\t\t\t }\r\n\t\t }\r\n\t }\r\n\t return cnt;\r\n }", "public int goodNodes (TreeNode root) {\n \n return goodNodes(root, -10000);\n \n }", "private static Node buildSmallerTree() {\n\t\tNode root = createNode(10);\n\t\troot.leftChild = createNode(25);\n\t\troot.rightChild = createNode(25);\n\t\troot.leftChild.leftChild = createNode(13);\n\t\troot.rightChild.rightChild = createNode(7);\n\t\troot.leftChild.rightChild = createNode(27);\n\t\t\n\t\treturn root;\n\t}", "Node deleteSuccessor(Node node) {\r\n\t\tNode successor = node.right , parentSuccessor = node ;\r\n\t\twhile( successor.left != null ) {\r\n\t\t\tparentSuccessor = successor ;\r\n\t\t\tsuccessor = successor.left ;\r\n\t\t}\r\n\t\tint value = node.value ;\r\n\t\tnode.value = successor.value ;\r\n\t\tsuccessor.value = value ;\r\n\t\t\r\n\t\tif( parentSuccessor == node ) {\r\n\t\t\tnode.right = successor.right ;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tparentSuccessor.left = successor.right ;\r\n\t\t}\r\n\t\tsuccessor.left = null ;\r\n\t\tsuccessor.right = null ;\r\n\t\treturn successor;\r\n\t}", "@Test(timeout = 4000)\n public void test21() throws Throwable {\n byte[] byteArray0 = new byte[0];\n ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0, 1, 1);\n JavaParser javaParser0 = new JavaParser(byteArrayInputStream0);\n SimpleNode simpleNode0 = new SimpleNode(javaParser0, (-120811353));\n Node[] nodeArray0 = new Node[6];\n nodeArray0[0] = (Node) simpleNode0;\n nodeArray0[1] = (Node) simpleNode0;\n nodeArray0[2] = (Node) simpleNode0;\n nodeArray0[3] = (Node) simpleNode0;\n nodeArray0[4] = (Node) simpleNode0;\n SimpleNode simpleNode1 = new SimpleNode(javaParser0, 1);\n nodeArray0[5] = (Node) simpleNode1;\n simpleNode0.children = nodeArray0;\n int int0 = simpleNode0.jjtGetNumChildren();\n assertEquals(6, int0);\n }", "@Test\n\tpublic void test2() {\n\t\tassertEquals(-1,b.removeNode(500));\n\t\t\n\t\t//Borro una hoja\n\t\tassertEquals(0,b.removeNode(3));\n\t\tassertEquals(\"1:FB=0\\t2:FB=0\\t7:FB=0\\t10:FB=1\\t13:FB=1\\t15:FB=0\\t20:FB=-1\\t23:FB=0\\t30:FB=0\\t40:FB=0\\t43:FB=1\\t49:FB=1\\t50:FB=0\\t60:FB=0\\t65:FB=0\\t70:FB=-1\\t90:FB=0\\t100:FB=0\\t110:FB=0\\t230:FB=0\\t\",b.inOrder());\n\n\t\t//Borra un elemento con un hijo\n\t\tassertEquals(0,b.removeNode(110));\n\t\tassertEquals(\"1:FB=0\\t2:FB=0\\t7:FB=0\\t10:FB=1\\t13:FB=1\\t15:FB=0\\t20:FB=-1\\t23:FB=0\\t30:FB=0\\t40:FB=0\\t43:FB=1\\t49:FB=1\\t50:FB=0\\t60:FB=0\\t65:FB=0\\t70:FB=-1\\t90:FB=0\\t100:FB=1\\t230:FB=0\\t\",b.inOrder());\n\t\t//Borra un elemento con dos hijos\n\t\tassertEquals(0,b.removeNode(90));\n\t\tassertEquals(\"1:FB=0\\t2:FB=0\\t7:FB=0\\t10:FB=1\\t13:FB=1\\t15:FB=0\\t20:FB=-1\\t23:FB=0\\t30:FB=0\\t40:FB=0\\t43:FB=1\\t49:FB=1\\t50:FB=0\\t60:FB=0\\t65:FB=0\\t70:FB=1\\t100:FB=1\\t230:FB=0\\t\",b.inOrder());\t\n\t\t\n\t\t//Borra la raiz (30)\n\t\tassertEquals(0,b.removeNode(30));\n\t\tassertEquals(\"1:FB=0\\t2:FB=0\\t7:FB=0\\t10:FB=0\\t13:FB=0\\t15:FB=0\\t20:FB=0\\t23:FB=1\\t40:FB=0\\t43:FB=1\\t49:FB=1\\t50:FB=0\\t60:FB=0\\t65:FB=0\\t70:FB=1\\t100:FB=1\\t230:FB=0\\t\",b.inOrder());\n\t\t\n\t\t//Borro 1\\t7\\t13\n\t\tassertEquals(0,b.removeNode(1));\n\t\tassertEquals(0,b.removeNode(7));\n\t\tassertEquals(0,b.removeNode(13));\n\t\tassertEquals(\"2:FB=0\\t10:FB=1\\t15:FB=1\\t20:FB=0\\t23:FB=1\\t40:FB=0\\t43:FB=1\\t49:FB=1\\t50:FB=0\\t60:FB=0\\t65:FB=0\\t70:FB=1\\t100:FB=1\\t230:FB=0\\t\",b.inOrder());\n\t\t\n\t\t//Borro 20. RSD 2,0\n\t\tassertEquals(0,b.removeNode(20));\n\t\t\n\t\t\n\t\t\n\t\tassertEquals(\"2:FB=0\\t10:FB=0\\t15:FB=0\\t23:FB=1\\t40:FB=0\\t43:FB=1\\t49:FB=1\\t50:FB=0\\t60:FB=-1\\t65:FB=0\\t70:FB=1\\t100:FB=1\\t230:FB=0\\t\",b.inOrder());\n\t\t\n\t\t//Borro el 230. RDI -2, 1\n\t\tassertEquals(0,b.removeNode(230));\n\t\tassertEquals(\"2:FB=0\\t10:FB=0\\t15:FB=0\\t23:FB=-1\\t40:FB=0\\t43:FB=0\\t49:FB=1\\t50:FB=0\\t60:FB=0\\t65:FB=0\\t70:FB=0\\t100:FB=0\\t\",b.inOrder());\n\t\t\n\t\t//Borro 23\n\t\tassertEquals(0,b.removeNode(23));\n\t\tassertEquals(\"2:FB=0\\t10:FB=-1\\t15:FB=-1\\t40:FB=0\\t43:FB=0\\t49:FB=1\\t50:FB=0\\t60:FB=0\\t65:FB=0\\t70:FB=0\\t100:FB=0\\t\",b.inOrder());\n\t\t\n\t\t//Borro 43 (raiz) y RSI sobre el nodo 15\n\t\tassertEquals(0,b.removeNode(43));\n\t\tassertEquals(\"2:FB=0\\t10:FB=0\\t15:FB=0\\t40:FB=1\\t49:FB=1\\t50:FB=0\\t60:FB=0\\t65:FB=0\\t70:FB=0\\t100:FB=0\\t\",b.inOrder());\n\t\t\n\t}", "private Node removeMin(Node node){\n if(node == null)\n return null;\n else if(node.left == null) {//use right child to replace this node (min value node)\n if(node.count!=0){ //multiple value in same node\n node.count--;\n return node;\n }\n else{\n decDepth(node.right); //maintain depth when chain in right tree\n return node.right;\n }\n }\n\n //walk through left branch\n node.left = removeMin(node.left);\n if(node!=null) node.size--; // the min value must be removed\n return node;\n }", "public static void main(String[] args) {\n// TreeNode node1 = new TreeNode(0);\n// TreeNode node2l = new TreeNode(3);\n// TreeNode node2r = new TreeNode(5);\n//// TreeNode node3l = new TreeNode(2);\n// TreeNode node3r = new TreeNode(2);\n//// TreeNode node4l = new TreeNode(4);\n// TreeNode node4r = new TreeNode(1);\n//\n// node1.left = node2l;\n// node1.right = node2r;\n//// node2l.left = node3l;\n// node2l.right = node3r;\n// node3r.right = node4r;\n//\n\n int[] nums = {3, 2, 1, 6, 0, 5};\n\n }", "public abstract MetricTreeNode getRoot();", "public Node<T> darTope();", "private void GreedySearch(){\n\n Queue<Node> expanded = new LinkedList<>();\n ArrayList<Node> fringe = new ArrayList<>();\n ArrayList<Node> fringeTemp = new ArrayList<>();\n\n\n Node current = startNode;\n\n while(expanded.size() < 1000){\n\n if(current.getDigit().getDigitString().equals(goalNode.getDigit().getDigitString())){\n //goal is reached.\n solutionPath(current);\n expanded.add(current);\n printExpanded(expanded);\n System.exit(0);\n }\n\n\n boolean b = cycleCheck(current,expanded);\n\n if(!b) {\n expanded.add(current);\n }\n\n if(!b){\n\n if(current.getDigit().last_changed != 0){\n\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n\n //+1 child first digit\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n\n }\n }\n\n if(current.getDigit().last_changed != 1){\n\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n\n //+1 child\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n }\n\n if(current.getDigit().last_changed != 2){\n if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n //+1 child\n if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n }\n\n }\n\n\n\n for(Node n : fringe){\n heuristicSetter(n);\n\n }\n\n fringeTemp.addAll(fringe);\n //now all the nodes in fringe have the heuristic value.\n //We can get the last added minm\n Node minm;\n if(fringeTemp.size() != 0){\n minm = fringeTemp.get(0);\n }else{\n break;\n }\n for(int i = 1; i<fringeTemp.size(); i++){\n if(fringeTemp.get(i).getHeuristic() <= minm.getHeuristic()){\n minm = fringeTemp.get(i);\n }\n }\n\n //now we have the minm for the next stage.\n current = minm;\n fringeTemp.remove(minm);\n fringe.clear();\n }\n\n //While loop ends\n System.out.println(\"No solution found.\");\n printExpanded(expanded);\n\n\n\n }", "public void kruskalMST()\n{\n PriorityQueue<Edge> completeTree = this._getKruskalTree(false);\n /*\n * Once we have the queue, we can display the tree and see how much it\n * weighs.\n */\n while (0 != completeTree.size()) {\n Edge nextEdge = completeTree.remove();\n System.out.println(\n this.vertexList[nextEdge.srcVert].label + \" --- \"\n + this.vertexList[nextEdge.destVert].label\n + \": \" + nextEdge.distance\n );\n }\n}", "private int eval(ExpressionNodes root)\n\t {\n\t \tif (root.right == null && root.left == null) \n\t \t{\n\t \t\t\tint leaf = Integer.parseInt(root.data);\n\t \t\t\treturn leaf; \n\t \t}\n\t \t\n\t \t// if the node is an operator // \n\t \telse \n\t \t{\n\t \t\t\tint op1 = eval(root.left); \n\t \t\t\tint op2 = eval(root.right);\n\t \n\t \t\n\t\t\t \tString operator = root.data; // initialize operator string \n\t\t\t \tint n = 0; // initialize the integer that will be returned \n\t\t\t \t\n\t\t\t \t// switch case to conduct for the different operators \n\t\t\t \tswitch(operator) \n\t\t\t \t{\n\t\t\t\t case \"+\":\n\t\t\t\t \tn = op1 + op2; \n\t\t\t\t \tbreak;\n\t\t\t\t \t\n\t\t\t\t case \"-\":\n\t\t\t\t n = op1 - op2; \n\t\t\t\t break;\n\t\t\t\t \n\t\t\t\t case \"*\":\n\t\t\t\t n = op1 * op2; \n\t\t\t\t break;\n\t\t\t\t \n\t\t\t\t case \"/\":\n\t\t\t\t n = op1 / op2; \n\t\t\t\t break;\n\t\t\t \t}\n\t\t\t \t\n\t\t\t \treturn n; \n\t \t}\n\t\t\t\n\t }", "@Override\npublic int compareTo(BinaryTreeNode arg0) {\n\treturn 0;\n}", "TreeNode returnNode(TreeNode node);", "private void sortLeaves() {\r\n\r\n\t\tboolean swapOccured;\r\n\r\n\t\tdo {\r\n\t\t\tswapOccured = false;\r\n\r\n\t\t\tfor(int index=0; index < this.treeNodes.length - 1; index++) {\r\n\t\t\t\tint currentLeaf = index;\r\n\t\t\t\tint nextLeaf = currentLeaf + 1;\r\n\t\t\t\tif(this.treeNodes[currentLeaf].getFrequency() > this.treeNodes[nextLeaf].getFrequency()) {\r\n\t\t\t\t\tswapLeaves(currentLeaf, nextLeaf);\r\n\t\t\t\t\tswapOccured=true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\twhile(swapOccured);\r\n\t}", "private void resolveRed(Position<Entry<K, V>> p) {\n Position<Entry<K, V>> parent = parent(p);\n if (isRed(parent)) {\n Position<Entry<K, V>> uncle = sibling(parent);\n if (isBlack(uncle)) { // Case 1: mis-shaped 4-node\n Position<Entry<K, V>> middle = restructure(p); // trinode restructuring\n makeBlack(middle);\n makeRed(left(middle));\n makeRed(right(middle));\n } else { // Case 2: overfill 5-node\n makeBlack(parent);\n makeBlack(uncle);\n Position<Entry<K, V>> grand = parent(parent);\n if (!isRoot(grand)) {\n makeRed(grand);\n resolveRed(grand);\n }\n }\n }\n }", "public static void main(String args[]){\n SimpleBST<Integer> t = new SimpleBST<Integer>();\n\n //build the tree / set the size manually\n //only for testing purpose\n Node<Integer> node = new Node<>(112);\n Node<Integer> node2 = new Node<>(330);\n node2 = new Node<>(440,node2,null);\n node = new Node<>(310,node,node2);\n t.root = node;\n t.size = 4;\n\n // Current tree:\n //\t\t\t 310\n // / \\\n // 112 440\n // /\n // 330\n\n\n //checking basic features\n if (t.root.data == 310 && t.contains(112) && !t.contains(211) && t.height() == 2){\n System.out.println(\"Yay 1\");\n }\n\n //checking more features\n if (t.numLeaves() == 2 && SimpleBST.findMax(t.root)==440\n && SimpleBST.findPredecessor(t.root) == 112){\n System.out.println(\"Yay 2\");\n }\n\n //toString and toArray\n if (t.toString().equals(\"112 310 330 440 \") && t.toArray().length==t.size()\n && t.toArray()[0].equals(310) && t.toArray()[1].equals(112)\n && t.toArray()[2].equals(440) && t.toArray()[3].equals(330) ){\n System.out.println(\"Yay 3\");\n //System.out.println(t.toString());\n }\n\n // start w/ an empty tree and insert to build the same tree as above\n t = new SimpleBST<Integer>();\n if (t.insert(310) && !t.insert(null) && t.size()==1 && t.height()==0\n && t.insert(112) && t.insert(440) && t.insert(330) && !t.insert(330)\n ){\n System.out.println(\"Yay 4\");\n }\n\n if (t.size()==4 && t.height()==2 && t.root.data == 310 &&\n t.root.left.data == 112 && t.root.right.data==440\n && t.root.right.left.data == 330){\n System.out.println(\"Yay 5\");\n }\n\n // more insertion\n t.insert(465);\n t.insert(321);\n t.insert(211);\n\n //\t\t\t 310\n // / \\\n // 112 440\n // \\ / \\\n // 211 330 465\n // /\n // 321\n\n\n\n //remove leaf (211), after removal:\n //\t\t\t 310\n // / \\\n // 112 440\n // / \\\n // 330 465\n // /\n // 321\n\n if (t.remove(211) && !t.contains(211) && t.size()==6 && t.height() == 3\n && SimpleBST.findMax(t.root.left) == 112){\n System.out.println(\"Yay 6\");\n }\n\n //remove node w/ single child (330), after removal:\n //\t\t\t 310\n // / \\\n // 112 440\n // / \\\n // 321 465\n\n if (t.remove(330) && !t.contains(330) && t.size()==5 && t.height() == 2\n && t.root.right.left.data == 321){\n System.out.println(\"Yay 7\");\n }\n\n //remove node w/ two children (440), after removal:\n //\t\t\t 310\n // / \\\n // 112 321\n // \\\n // 465\n\n if ((t.root!=null) && SimpleBST.findPredecessor(t.root.right) == 321 && t.remove(440) && !t.contains(440)\n && t.size()==4 && t.height() == 2 && t.root.right.data == 321){\n System.out.println(\"Yay 8\");\n }\n\n }", "@Test\n public void Test5() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t3, t1, t2);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e2, e1, e3);\n TreeNode expected = e2;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public TreeNode resolve(TreeNode root, TreeNode node){\n if (root == null) {\n return node;\n }\n else if(root.val > node.val){ // no replace, keep going down\n root.right = resolve(root.right, node);\n return root;\n }\n else { // new biggest, old root becomes left child\n node.left = root;\n root = null;\n return node;\n }\n }" ]
[ "0.6008356", "0.577374", "0.5600321", "0.55934894", "0.5571244", "0.5523134", "0.54959285", "0.5453201", "0.53601635", "0.53277296", "0.5306354", "0.52526915", "0.52429104", "0.52357846", "0.52189666", "0.5209216", "0.52006966", "0.5192351", "0.5190808", "0.5161797", "0.5139634", "0.5122594", "0.51159286", "0.5104676", "0.5095864", "0.5094463", "0.508989", "0.5088108", "0.5073623", "0.5071701", "0.5061882", "0.50462335", "0.50460404", "0.50120026", "0.5009974", "0.50085336", "0.5004923", "0.4997751", "0.49949765", "0.4991053", "0.4990979", "0.4989386", "0.498265", "0.4982248", "0.49757802", "0.4975625", "0.49555457", "0.4954889", "0.49492544", "0.494482", "0.4942984", "0.49363968", "0.49352503", "0.49250382", "0.4921356", "0.4921267", "0.49184042", "0.4916533", "0.4911258", "0.49106786", "0.4900189", "0.4897297", "0.4889052", "0.48866555", "0.48760626", "0.4874038", "0.48706365", "0.4868267", "0.48602596", "0.4858821", "0.4856158", "0.48534057", "0.48529807", "0.48503086", "0.48476285", "0.48462558", "0.4841791", "0.4834973", "0.48335248", "0.48250633", "0.4819936", "0.4818217", "0.4809908", "0.48096016", "0.48088267", "0.48042938", "0.4802636", "0.48012757", "0.4798951", "0.4797449", "0.47945407", "0.47917473", "0.47914955", "0.47885808", "0.47802085", "0.47768694", "0.47759154", "0.47712576", "0.47694796", "0.47682968" ]
0.5298668
11
traverses nominal node to find matching leaf node
private RegressionTreeNode traverseNominalNode(Serializable value) { if(value.equals(this.value)){ return this.leftChild; }else{ return this.rightChild; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void fixAVLTree(Node node) {\n\t\tfinal int lf = getLoadFactor(node);\n\t\t//if (lf == -1 || lf == 0 || lf == 1) {\n\t\tif (lf >= -1 && lf <= 1) {\n\t\t\t// do nothing\n\t\t\treturn;\n\t\t}\t\t\n\t\trotateTree(node);\n\t}", "public void recoverTree(TreeNode root) {\n if(root == null)\n return;\n helper(root);\n \n //swap n2 and n3 val\n int temp = n1.val;\n n1.val = n2.val;\n n2.val = temp;\n return;\n }", "@Override\npublic boolean fjern(T verdi) {\n Node<T> curr = hode;\n while (curr != null) {\n if (curr.verdi.equals(verdi)) {\n if (antall == 1) {\n hode = hale = null;\n } else if (curr == hode) {\n hode = hode.neste;\n hode.forrige = null;\n } else if (curr == hale) {\n hale = hale.forrige;\n hale.neste = null;\n } else {\n curr.forrige.neste = curr.neste;\n curr.neste.forrige = curr.forrige;\n }\n antall--;\n endringer++;\n return true;\n }\n curr = curr.neste;\n }\n return false;\n}", "public void deleteNode(BinaryTreeNode node) // Only leaf nodes and nodes with degree 1 can be deleted. If a degree 1 node is deleted, it is replaced by its subtree.\r\n {\n if(!node.hasRightChild() && !node.hasLeftChild()){\r\n if(node.mActualNode.mParent.mRightChild == node.mActualNode) {\r\n\r\n node.mActualNode.mParent.mRightChild = null;\r\n }\r\n else if(node.mActualNode.mParent.mLeftChild == node.mActualNode) {\r\n\r\n node.mActualNode.mParent.mLeftChild = null;\r\n }\r\n //node.mActualNode = null;\r\n\r\n }\r\n //if deleted node has degree 1 and has only left child\r\n else if(node.hasLeftChild() && !node.hasRightChild()){\r\n node.mActualNode.mLeftChild.mParent = node.mActualNode.mParent;\r\n //if deleted node is left child of his father\r\n if(node.mActualNode.mParent.mLeftChild == node.mActualNode)\r\n node.mActualNode.mParent.mLeftChild = node.mActualNode.mLeftChild;\r\n //if deleted node is right child of his father\r\n else {\r\n\r\n node.mActualNode.mParent.mRightChild = node.mActualNode.mLeftChild;\r\n }\r\n }\r\n // if deleted node has degree 1 and has only right child\r\n else if(node.hasRightChild() && !node.hasLeftChild()){\r\n node.mActualNode.mRightChild.mParent = node.mActualNode.mParent;\r\n\r\n //if node is left child of his father\r\n if(node.mActualNode.mParent.mLeftChild == node.mActualNode) {\r\n\r\n\r\n node.mActualNode.mParent.mLeftChild = node.mActualNode.mRightChild;\r\n\r\n }\r\n //if node is right child of his father\r\n else\r\n node.mActualNode.mParent.mRightChild = node.mActualNode.mRightChild;\r\n\r\n\r\n }\r\n else\r\n System.out.println(\"Error : node has two child\");\r\n\r\n }", "private void rebalanceLeft(TreeNodeDataType n) {\n left(n);\r\n \r\n \r\n }", "public void recoverTree2(TreeNode root) {\n traverse(root);\n\n // Swap the values of the two nodes\n int temp = firstElement.val;\n firstElement.val = secondElement.val;\n secondElement.val = temp;\n }", "@Test\n public void Test7() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t2, null, t3);\n TreeNode.connect(t3, t1, null);\n TreeNode root = t2;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e1, null, e3);\n TreeNode.connect(e3, e2, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public void makeWeakRepresentative() {\n\t\t\tif (mPrimaryEdge == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// hash map from store indices we have seen on the primary path to the previous destination/new source of\n\t\t\t// the primary edge (or in other words, to the new candidate for weak-i equivalence class).\n\t\t\tfinal HashMap<CCTerm, ArrayNode> seenStores = new HashMap<CCTerm, ArrayNode>();\n\t\t\t// for each index, the information about secondary edge that we later need to invert.\n\t\t\tfinal HashMap<CCTerm, ArrayNode> todoSecondary = new HashMap<CCTerm, ArrayNode>();\n\t\t\tfinal HashMap<CCTerm, CCAppTerm> todoSecondaryStores = new HashMap<CCTerm, CCAppTerm>();\n\t\t\t// the select information for the new root node.\n\t\t\tfinal HashMap<CCTerm, CCAppTerm> newSelectMap = new HashMap<CCTerm, CCAppTerm>();\n\t\t\tArrayNode node = this;\n\t\t\tArrayNode prev = null;\n\t\t\tCCAppTerm prevStore = null;\n\t\t\twhile (node.mPrimaryEdge != null) {\n\t\t\t\t// invert the last primary edge\n\t\t\t\tfinal ArrayNode next = node.mPrimaryEdge;\n\t\t\t\tfinal CCAppTerm nextStore = node.mPrimaryStore;\n\t\t\t\tnode.mPrimaryEdge = prev;\n\t\t\t\tnode.mPrimaryStore = prevStore;\n\n\t\t\t\tfinal CCTerm index = getIndexFromStore(nextStore).getRepresentative();\n\t\t\t\tfinal ArrayNode old = seenStores.put(index, next);\n\t\t\t\tif (old == node) {\n\t\t\t\t\t// the node is in the middle of two consecutive stores on the same\n\t\t\t\t\t// index. There is no need to move the secondary information\n\t\t\t\t\t// around.\n\t\t\t\t\t//\n\t\t\t\t\t// This branch is intentionally left empty!\n\t\t\t\t} else if (node.mSecondaryEdge != null) { //NOPMD\n\t\t\t\t\tif (old == null) {\n\t\t\t\t\t\t// we have to invert the secondary edge in the end, but\n\t\t\t\t\t\t// we should wait until the inversion of the primary edges\n\t\t\t\t\t\t// is completed.\n\t\t\t\t\t\ttodoSecondary.put(index, node.mSecondaryEdge);\n\t\t\t\t\t\ttodoSecondaryStores.put(index, node.mSecondaryStore);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// insert the secondary edge of node into old node. The reasoning is that\n\t\t\t\t\t\t// the old node is connected using only primary edges on different indices, so it has\n\t\t\t\t\t\t// the same weak-i representative as node.\n\t\t\t\t\t\tassert (getIndexFromStore(old.mPrimaryStore).getRepresentative() == index);\n\t\t\t\t\t\tassert (old.mSecondaryEdge == null);\n\t\t\t\t\t\told.mSecondaryEdge = node.mSecondaryEdge;\n\t\t\t\t\t\told.mSecondaryStore = node.mSecondaryStore;\n\t\t\t\t\t}\n\t\t\t\t\tnode.mSecondaryEdge = null;\n\t\t\t\t\tnode.mSecondaryStore = null;\n\t\t\t\t} else if (!node.mSelects.isEmpty()) {\n\t\t\t\t\tif (old == null) {\n\t\t\t\t\t\t// assertion holds, because index was not in seenStores.\n\t\t\t\t\t\tassert node.mSelects.get(index) != null;\n\t\t\t\t\t\t// we need to move the select information into the new root node.\n\t\t\t\t\t\tnewSelectMap.put(index, node.mSelects.get(index)); \n\t\t\t\t\t} else {\n\t\t\t\t\t\t// old is weak-i equivalent to node and can be used as new weak-i representative.\n\t\t\t\t\t\told.mSelects = node.mSelects;\n\t\t\t\t\t}\n\t\t\t\t\tnode.mSelects = Collections.emptyMap();\n\t\t\t\t}\n\n\t\t\t\tprev = node;\n\t\t\t\tnode = next;\n\t\t\t\tprevStore = nextStore;\n\t\t\t}\n\t\t\tnode.mPrimaryEdge = prev;\n\t\t\tnode.mPrimaryStore = prevStore;\n\t\t\tmConstTerm = node.mConstTerm;\n\t\t\tnode.mConstTerm = null;\n\t\t\tfinal Map<CCTerm, CCAppTerm> rootSelects = node.mSelects;\n\t\t\tnode.mSelects = Collections.emptyMap();\n\t\t\tfor (final Entry<CCTerm, ArrayNode> entry : seenStores.entrySet()) {\n\t\t\t\t// The seen stores get the new representatives of their weak-i equivalence groups\n\t\t\t\tfinal CCTerm index = entry.getKey();\n\t\t\t\tfinal CCAppTerm select = rootSelects.remove(index);\n\t\t\t\tif (select != null) {\n\t\t\t\t\tentry.getValue().mSelects = \n\t\t\t\t\t\tCollections.singletonMap(index, select);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Now invert the secondary edges\n\t\t\tfor (final Entry<CCTerm, ArrayNode> entry : todoSecondary.entrySet()) {\n\t\t\t\tfinal CCTerm index = entry.getKey();\n\t\t\t\tArrayNode dest = entry.getValue();\n\t\t\t\tdest = dest.findSecondaryNode(index);\n\t\t\t\tif (dest.mSecondaryEdge != null) {\n\t\t\t\t\tdest.makeWeakIRepresentative();\n\t\t\t\t}\n\t\t\t\tdest.mSecondaryEdge = this;\n\t\t\t\tdest.mSecondaryStore = todoSecondaryStores.get(index);\n\t\t\t\tnewSelectMap.putAll(dest.mSelects);\n\t\t\t\tdest.mSelects = Collections.emptyMap();\n\t\t\t}\n\t\t\tnewSelectMap.putAll(rootSelects);\n\t\t\tmSelects = newSelectMap;\n\t\t}", "@Test\n public void Test6() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t3, null, t1);\n TreeNode.connect(t1, t2, null);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e1, null, e3);\n TreeNode.connect(e3, e2, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "@Test\n public void Test2() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t1, null, t4);\n TreeNode.connect(t4, null, t3);\n TreeNode.connect(t3, null, t2);\n TreeNode.connect(t2, null, t5);\n TreeNode root = t1;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e1, null, e2);\n TreeNode.connect(e2, null, e3);\n TreeNode.connect(e3, null, e4);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "private int FixAVLtree(IAVLNode node)\r\n\t{\r\n\t\tif (node.isRealNode()) \r\n\t\t{\r\n\t\t\tif(BFCalc(node) == -2) \r\n\t\t\t{\r\n\t\t\t\t//in insert we need to fix if BFCalc(node.getLeft())==-1\r\n\t\t\t\t//in delete we need to fix if BFCalc(node.getLeft())==0 or -1\r\n\t\t\t\tint rightBF=BFCalc(node.getRight());\r\n\t\t\t\tif(rightBF==0||rightBF==-1) {\r\n\t\t\t\t\tRRRotation(node);\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t} \r\n\t\t\t\telse \r\n\t\t\t\t{ \r\n\t\t\t\t\tRLRotation(node);\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse //if BFCalc(node) == 2 \r\n\t\t\t{\r\n\t\t\t\t//in insert we need to fix if BFCalc(node.getLeft())==1\r\n\t\t\t\t//in delete we need to fix if BFCalc(node.getLeft())==0 or 1\r\n\t\t\t\tint leftBF=BFCalc(node.getLeft());\r\n\t\t\t\tif(leftBF==1 ||leftBF==0) \r\n\t\t\t\t{\r\n\t\t\t\t\tLLRotation(node);\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{ \r\n\t\t\t\t\tLRRotation(node);\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t} \r\n\t\t} \r\n\t\t\treturn 0;\r\n\t}", "@Test\n public void Test4() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t2, t3, t4);\n TreeNode.connect(t3, t1, null);\n TreeNode.connect(t4, null, t5);\n TreeNode root = t2;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e3, e2, e4);\n TreeNode.connect(e2, e1, null);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e3;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public void recoverTree(TreeNode root) {\n if (root == null) {\n return;\n }\n\n prev = null;\n first = null;\n second = null;\n\n inorderTraversal(root);\n\n if (first != null && second != null) {\n int temp = first.val;\n first.val = second.val;\n second.val = temp;\n }\n\n }", "private void nullLeaf(AVLNode<T> node) {\n AVLNode<T> prev = getParent(root, node);\n int comp = node.getData().compareTo(prev.getData());\n if (comp > 0) {\n prev.setRight(null);\n AVLNode<T> min = findMin(prev.getLeft());\n AVLNode<T> max = findMax(prev.getLeft());\n if (min != null) {\n calcDeterminants(min);\n balanceTree(min);\n calcDeterminants(min);\n }\n if (max != null) {\n calcDeterminants(max);\n balanceTree(max);\n calcDeterminants(max);\n }\n } else {\n prev.setLeft(null);\n AVLNode<T> max = findMax(prev.getRight());\n AVLNode<T> min = findMin(prev.getRight());\n if (max != null) {\n calcDeterminants(max);\n balanceTree(max);\n calcDeterminants(max);\n }\n if (min != null) {\n calcDeterminants(min);\n balanceTree(min);\n calcDeterminants(min);\n }\n }\n }", "public int deleteRoot(AVLNode node) { // root is unary node or leaf\n\t\tif (node.isLeaf()) {\n\t\t\tthis.root = null;\n\t\t} else { // root is unary\n\t\t\tif (node.getRight().getHeight() != -1) { // root has a right child\n\t\t\t\tthis.root = node.getRight();\n\t\t\t\tnode.getRight().setParent(null);\n\t\t\t\tnode.setRight(null);\n\t\t\t} else { // root has a left child\n\t\t\t\tthis.root = node.getLeft();\n\t\t\t\tnode.getLeft().setParent(null);\n\t\t\t\tnode.setLeft(null);\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}", "private void singleRotationLR(BinaryNode node){\n if (node == root) {\n root = node.left;\n root.parent = null;\n root.right = node;\n node.parent = node.left;\n node.left = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = node.left;\n } else {\n node.parent.left = node.left;\n }\n node.left.parent = node.parent;\n node.left.right = node;\n node.parent = node.left;\n node.left = null;\n }\n }", "@Test\n public void Test3() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t3, t4, t2);\n TreeNode.connect(t4, t1, null);\n TreeNode.connect(t2, null, t5);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e3, e2, e4);\n TreeNode.connect(e2, e1, null);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e3;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "private void removeNode(AVLNode<T, U> node){\n\t\tAVLNode<T, U> newNode = null;\n\t\t\n\t\tif(node.getLeft() == null && node.getRight() == null){\n\t\t\t//If the node is a leaf, I delete it and I recompute \n\t\t\t//the heights and check the balance starting from its parent\n\t\t\tnewNode = node.getParent();\n\t\t\tthis.transplant(node, null);\n\t\t}else if(node.getLeft() == null){\n\t\t\tnewNode = node.getRight();\n\t\t\tthis.transplant(node, newNode);\n\t\t}else if(node.getRight() == null){\n\t\t\tnewNode = node.getLeft();\n\t\t\tthis.transplant(node, newNode);\n\t\t}else{\n\t\t\tnewNode = getMinimum(node.getRight());\n\t\t\tif(newNode.getParent() != node){\n\t\t\t\tthis.transplant(newNode, newNode.getRight());\n\t\t\t\tnewNode.setRight(node.getRight());\n\t\t\t\tnewNode.getRight().setParent(newNode);\n\t\t\t}\n\t\t\tthis.transplant(node, newNode);\n\t\t\tnewNode.setLeft(node.getLeft());\n\t\t\tnewNode.getLeft().setParent(newNode);\n\t\t}\n\t\tcomputeHeights(newNode);\n\t\tbalanceTree(newNode);\n\t}", "@Test\n public void Test1() {\n TreeNode t1 = new TreeNode(5);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(1);\n TreeNode.connect(t1, t2, null);\n TreeNode.connect(t2, t3, null);\n TreeNode.connect(t3, t4, null);\n TreeNode.connect(t4, t5, null);\n TreeNode root = t1;\n\n TreeNode e1 = new TreeNode(5);\n TreeNode e2 = new TreeNode(4);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(2);\n TreeNode e5 = new TreeNode(1);\n TreeNode.connect(e1, e2, null);\n TreeNode.connect(e2, e3, null);\n TreeNode.connect(e3, e4, null);\n TreeNode.connect(e4, e5, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "void flipPath(int lastNode) {\n int myLastNode = lastNode;\n while (myLastNode != EMPTY_LABEL) {\n int parent = this.tLabels[myLastNode];\n\n // Add (parent, lastNode) to matching. We don't need to\n // explicitly remove any edges from the matching because:\n // * We know at this point that there is no i such that\n // sMatches[i] = lastNode.\n // * Although there might be some j such that tMatches[j] =\n // parent, that j must be sLabels[parent], and will change\n // tMatches[j] in the next time through this loop.\n this.sMatches[parent] = lastNode;\n this.tMatches[myLastNode] = parent;\n\n myLastNode = this.sLabels[parent];\n }\n }", "private void shortenNodeLabels() {\n for (NodeImpl n : supervisedNodes) {\n if (n.hasLabel()) {\n shortenNodeLabel(n.getLabel());\n }\n }\n }", "private int joinSecnodCase(AVLTree t1, IAVLNode x, AVLTree t2) {\r\n\t\t\t\t int returnValue = 0;\r\n\t\t\t\t IAVLNode curr = t1.getRoot(), parent;\r\n\t\t\t\t \r\n\t\t\t\t while(true) {\r\n\t\t\t\t\t if(curr.getHeight() <= t2.getRoot().getHeight())\r\n\t\t\t\t\t\t break;\r\n\t\t\t\t\t if(curr.getRight().getHeight() == -1)\r\n\t\t\t\t\t\t break;\r\n\t\t\t\t\t curr = curr.getRight();\r\n\t\t\t\t }\r\n\t\t\t\t \r\n\t\t\t\t parent = curr.getParent();\r\n\t\t\t\t \r\n\t\t\t\t if(t1.getRoot() == curr) {\r\n\t\t\t\t\t curr.setRight(x);\r\n\t\t\t\t\t x.setParent(curr);\r\n\t\t\t\t\t curr.setHeight(curr.getHeight() + 1 );\r\n\t\t\t\t\t return 0;\r\n\t\t\t\t }\r\n\t\t\t\t \r\n\t\t\t\t returnValue = Math.abs(t2.getRoot().getHeight() - curr.getHeight());\r\n\t\t\t\t \r\n\t\t\t\t //replacing pointers\r\n\t\t\t\t \r\n\t\t\t\t x.setLeft(curr);\r\n\t\t\t\t x.setParent(parent);\r\n\t\t\t\t parent.setRight(x);\r\n\t\t\t\t curr.setParent(x);\r\n\t\t\t\t x.setRight(t2.getRoot());\r\n\t\t\t\t t2.getRoot().setParent(x);\r\n\t\t\t\t t2.setRoot(null);\r\n\t\t\t\t t2.setRoot(t1.getRoot());\r\n\t\t\t\t x.setHeight(Math.max(x.getRight().getHeight(), x.getLeft().getHeight()) + 1);\r\n\t\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t\t \r\n\t\t\t\t //t2.minimum = t1.minimum;\r\n\t\t\t\t t2.maximum = t1.maximum;\r\n\t\t\t\t \r\n\t\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t\t HieghtsUpdating(x);\r\n\t\t\t\t SizesUpdate(x);\r\n\t\t\r\n\t\t\t\t return returnValue;\r\n\t\t\t\t}", "@Override\n public void nullstill() {\n Node<T> curr= hode;\n while (curr!=null){\n Node<T> p= curr.neste;\n curr.forrige=curr.neste= null;\n curr.verdi= null;\n curr= p;\n }\n hode= hale= null;\n endringer++;\n antall=0;\n }", "private void doubleRotationLR(BinaryNode node) {\n BinaryNode temp = max(node.left);\n if (node == root) {\n root = temp;\n if (temp.parent.right == temp) { //temp could have a child on the left\n temp.parent.right = temp.left;\n if (temp.left != null) temp.left.parent = temp.parent;\n }\n else {\n temp.parent.left = temp.left;\n if (temp.left != null) temp.left.parent = temp.parent;\n }\n root.parent = null;\n root.right = node;\n root.left = node.left;\n if(node.left != null) node.left.parent = root;\n node.parent = root;\n node.left = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = temp;\n } else {\n node.parent.left = temp;\n }\n temp.parent = node.parent;\n temp.left = node.left;\n if(node.left != null) node.left.parent = temp;\n temp.right = node;\n node.parent = temp;\n node.left = null;\n }\n }", "private BinarySearchTree deleteLeftMost(BinarySearchTree tree){\r\n\t\t\r\n\t\tif(tree.getLeftChild() == null){\r\n\t\t\t//this is the node we want. No left child\r\n\t\t\t//Right child might exist\r\n\t\t\t\r\n\t\t\treturn tree.getRightChild();\r\n\t\t}\r\n\t\telse{\r\n\t\t\tBinarySearchTree replacement = deleteLeftMost(tree.getLeftChild());\r\n\t\t\ttree.attachRightSubtree(replacement);\r\n\t\t\treturn tree;\r\n\t\t}\r\n\t}", "private int joinFirstCase(AVLTree t1, IAVLNode x, AVLTree t2) {\r\n\t\t\t int returnValue = 0;\r\n\t\t\t IAVLNode curr = t2.getRoot();\r\n\t\t\t \r\n\t\t\t while(true) {\r\n\t\t\t\t if(curr.getHeight() <= t1.getRoot().getHeight())\r\n\t\t\t\t\t break;\r\n\t\t\t\t if(curr.getLeft().getHeight() == -1)\r\n\t\t\t\t\t break;\r\n\t\t\t\t curr = curr.getLeft();\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t if(t2.getRoot() == curr) {\r\n\t\t\t\t curr.setLeft(x);\r\n\t\t\t\t x.setParent(curr);\r\n\t\t\t\t curr.setHeight(curr.getHeight() + 1 );\r\n\t\t\t\t return 0;\r\n\t\t\t\t\t\t \r\n\t\t\t }\r\n\t\t\t returnValue = t2.getRoot().getHeight() - curr.getHeight();\r\n\t\t\r\n\t\t\t //replacing pointers\r\n\t\t\t x.setRight(curr);\r\n\t\t\t x.setParent(curr.getParent());\r\n\t\t\t curr.getParent().setLeft(x);\r\n\t\t\t curr.setParent(x);\r\n\t\t\t x.setLeft(t1.getRoot());\r\n\t\t\t t1.getRoot().setParent(x);\r\n\t\t\t t1.setRoot(t2.getRoot());\r\n\t\t\t x.setHeight(Math.max(x.getRight().getHeight(),x.getLeft().getHeight()) + 1);\r\n\t\t\t \r\n\t\t\t t2.minimum = t1.minimum;\r\n\t\t\t \r\n\t\t\t //FIXING NEW TREE CREATED\r\n\t\t\t HieghtsUpdating(x);\r\n\t\t\t SizesUpdate(x);\r\n\t\r\n\t\t\t return returnValue;\r\n\t\t\t \r\n\t\t}", "protected void case3R(AbsTree t) {\n\t\t\tAbsTree min_right_t = t.right.min();\r\n\t\t\tif (min_right_t.left == null && min_right_t.right == null)\r\n\t\t\t\tcase1(min_right_t, this); // min_right_t is a leaf node\r\n\t\t\telse\r\n\t\t\t\tcase2(min_right_t, this); // min_right_t is a non-leaf node\r\n\t\t\tt.value = min_right_t.value;\r\n\t\t\tt.set_count(min_right_t.get_count());\r\n\t}", "public UpTreeDisjointSetForest() {\n\t\t// Use an efficient map!\n\t\tmap = new LinearProbingHashMap<E, UpTreeNode<E>>();\n\t}", "@Test\n public void Test5() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t3, t1, t2);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e2, e1, e3);\n TreeNode expected = e2;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public int scoreLeafNode();", "private int first_leaf() { return n/2; }", "public void setToLeaf() {\r\n isLeaf = true;\r\n }", "public TreeNode rewriteTreeNode(TreeNode node) {\n if (node instanceof Group) {\n BGP theBGP = new BGP(new ArrayList<TriplePatternNode>());\n Group g = (Group) node;\n ArrayList<GraphPattern> toAdd = new ArrayList<GraphPattern>(), toRemove = new ArrayList<GraphPattern>();\n\n for (GraphPattern pattern : g.getPatterns()) {\n if (pattern instanceof BGP || pattern instanceof Group) {\n if (conjoinGraphPattern(theBGP, g, pattern, toAdd))\n toRemove.add(pattern);\n }\n }\n\n for (GraphPattern gp : toRemove)\n g.removeGraphPattern(gp);\n for (GraphPattern gp : toAdd)\n g.addGraphPattern(gp);\n\n // we used to only add a BGP if it was non-empty\n // the special case of empty groups made backends more difficult\n // to implement in some cases, so now we ensure a single BGP for\n // every group, even if it is empty\n g.addGraphPattern(theBGP);\n }\n return node;\n }", "void pairwiseCombine(){\n\t\t\n\t\tmin.Left.Right = min.Right;\n\t\tmin.Right.Left = min.Left;\n\t\t/**\n\t\tPairwise combine differentiates itself in operation of depending on the presence of a child node\n\t\t*/\n\t\t\n\t\tif(min.Child==null){\n\t\t/*map acts as the table to store similar degree nodes*/\n\t\t\tHashMap<Integer, Nodefh> map = new HashMap<Integer, Nodefh>();\n\t\t\tcurrent = min.Right;\n\t\t\tmin = null;\n\t\t\tmin = current;\n\t\t\tlast = current.Left;\n\t\t\twhile(current!=last){\n\t\t\t\tNodefh check = new Nodefh();\n\t\t\t\tcheck = current.Right;\n\t\t\t\twhile(map.containsKey(current.degree)){\n\t\t\t\t\tNodefh temp = map.remove(current.degree);\n\t\t\t\t\t\n\t\t\t\t\t/*Since a parent node can have only one child node a condition is checked to update its child node*/\n\t\t\t\t\tif(temp.dist < current.dist){\n\t\t\t\t\t/*If the node stored is less than the incoming node*/\n\t\t\t\t\t\tcurrent.Right.Left = current.Left;\n\t\t\t\t\t\tcurrent.Left.Right = current.Right;\n\t\t\t\t\t\ttemp.ChildCut = false;\n\t\t\t\t\t\tif(temp.isChildEmpty()){\n\t\t\t\t\t\t\ttemp.Child = current;\n\t\t\t\t\t\t\tcurrent.Left = current.Right = current;\n\t\t\t\t\t\t\ttemp.Child.Parent = temp;\n\t\t\t\t\t\t\ttemp.degree = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tcurrent.Right = temp.Child;\n\t\t\t\t\t\t\tcurrent.Left = temp.Child.Left;\n\t\t\t\t\t\t\ttemp.Child.Left.Right = current;\n\t\t\t\t\t\t\ttemp.Child.Left = current;\n\t\t\t\t\t\t\tcurrent.Parent = temp;\n\t\t\t\t\t\t\tif(temp.Child == temp.Child.Right){\n\t\t\t\t\t\t\t\ttemp.Child.Right = current;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttemp.degree +=1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrent = temp;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t/*If the incoming node is lower*/\n\t\t\t\t\t\ttemp.Right.Left = temp.Left;\n\t\t\t\t\t\ttemp.Left.Right = temp.Right;\n\t\t\t\t\t\tcurrent.ChildCut = false;\t\n\t\t\t\t\t\tif(current.isChildEmpty()){\n\n\t\t\t\t\t\t\tcurrent.Child = temp;\n\t\t\t\t\t\t\ttemp.Left = temp.Right = temp;\n\t\t\t\t\t\t\tcurrent.Child.Parent = current;\n\t\t\t\t\t\t\tcurrent.degree = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\ttemp.Right = current.Child;\n\t\t\t\t\t\t\ttemp.Left = current.Child.Left;\n\t\t\t\t\t\t\tcurrent.Child.Left.Right = temp;\n\t\t\t\t\t\t\tcurrent.Child.Left = temp;\n\t\t\t\t\t\t\ttemp.Parent = current;\n\t\t\t\t\t\t\tcurrent.degree +=1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tif(min.dist >= current.dist){\n\t\t\t\t\tmin = current;\n\t\t\t\t}\n\t\t\t\tmap.put(current.degree, current);\n\t\t\t\tcurrent = check;\n\n\t\t\t}\n\t\t\tlast = min.Left;\n\t\t\t/*Since our condition is used only till last node and exits during last node the iteration is repeated for the last node*/\n\t\t\twhile(map.containsKey(current.degree)){\n\t\t\t\tNodefh temp = map.remove(current.degree);\n\t\t\t\tif(temp.dist < current.dist){\n\t\t\t\t\ttemp.ChildCut = false;\n\t\t\t\t\tcurrent.Right.Left = current.Left;\n\t\t\t\t\tcurrent.Left.Right = current.Right;\n\t\t\t\t\tif(temp.isChildEmpty()){\n\t\t\t\t\t\ttemp.Child = current;\n\t\t\t\t\t\tcurrent.Left = current.Right = current;\n\t\t\t\t\t\ttemp.Child.Parent = temp;\n\t\t\t\t\t\ttemp.degree = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tcurrent.Right = temp.Child;\n\t\t\t\t\t\tcurrent.Left = temp.Child.Left;\n\t\t\t\t\t\ttemp.Child.Left.Right = current;\n\t\t\t\t\t\ttemp.Child.Left = current;\n\t\t\t\t\t\tcurrent.Parent = temp;\n\t\t\t\t\t\ttemp.degree +=1;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = temp;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttemp.Right.Left = temp.Left;\n\t\t\t\t\ttemp.Left.Right = temp.Right;\n\t\t\t\t\tcurrent.ChildCut = false;\n\t\t\t\t\tif(current.isChildEmpty()){\n\t\t\t\t\t\tcurrent.Child = temp;\n\t\t\t\t\t\ttemp.Left = temp.Right = temp;\n\t\t\t\t\t\tcurrent.Child.Parent = current;\n\t\t\t\t\t\tcurrent.degree = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ttemp.Right = current.Child;\n\t\t\t\t\t\ttemp.Left = current.Child.Left;\n\t\t\t\t\t\tcurrent.Child.Left.Right = temp;\n\t\t\t\t\t\tcurrent.Child.Left = temp;\n\t\t\t\t\t\ttemp.Parent = current;\n\t\t\t\t\t\tcurrent.degree +=1;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(min.dist >= current.dist){\n\t\t\t\tmin = current;\n\t\t\t}\n\t\t\tcurrent = min;\n\t\t\tlast = min.Left;\n\n\t\t}\n\t\telse{\n\t\t\tHashMap<Integer, Nodefh> map = new HashMap<Integer, Nodefh>();\n\t\t\tcurrent = min.Child;\n\t\t\tcurrent.Parent = null;\n\t\t\tif(min!=min.Right){\n\t\t\t\tcurrent.Right.Left = min.Left;\n\t\t\t\tmin.Left.Right = current.Right;\n\t\t\t\tcurrent.Right = min.Right;\n\t\t\t\tmin.Right.Left = current;\n\t\t\t\tlast = current.Left;\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\tlast = current.Left;\n\n\t\t\t}\n\t\t\tmin =null;\n\t\t\tmin = current;\n\t\t\t/*In the presence of a child the child has to be inserted at the top level*/\n\t\t\twhile(current != last){\n\t\t\t\tNodefh check = new Nodefh();\n\t\t\t\tcheck = current.Right;\n\n\t\t\t\twhile(map.containsKey(current.degree)){\n\n\t\t\t\t\tNodefh temp = map.remove(current.degree);\n\t\t\t\t\tif(temp.dist < current.dist){\n\t\t\t\t\t\ttemp.ChildCut = false;\n\t\t\t\t\t\tcurrent.Right.Left = current.Left;\n\t\t\t\t\t\tcurrent.Left.Right = current.Right;\n\t\t\t\t\t\tif(temp.isChildEmpty()){\n\n\t\t\t\t\t\t\ttemp.Child = current;\n\t\t\t\t\t\t\tcurrent.Left = current.Right = current;\n\t\t\t\t\t\t\ttemp.Child.Parent = temp;\n\t\t\t\t\t\t\ttemp.degree = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tcurrent.Right = temp.Child;\n\t\t\t\t\t\t\tcurrent.Left = temp.Child.Left;\n\t\t\t\t\t\t\ttemp.Child.Left.Right = current;\n\t\t\t\t\t\t\ttemp.Child.Left = current;\n\t\t\t\t\t\t\tcurrent.Parent = temp;\n\t\t\t\t\t\t\ttemp.degree +=1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcurrent = temp;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ttemp.Right.Left = temp.Left;\n\t\t\t\t\t\ttemp.Left.Right = temp.Right;\n\t\t\t\t\t\tcurrent.ChildCut = false;\n\t\t\t\t\t\tif(current.isChildEmpty()){\n\t\t\t\t\t\t\tcurrent.Child = temp;\n\t\t\t\t\t\t\ttemp.Left = temp.Right = temp;\n\t\t\t\t\t\t\tcurrent.Child.Parent = current;\n\t\t\t\t\t\t\tcurrent.degree = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\ttemp.Right = current.Child;\n\t\t\t\t\t\t\ttemp.Left = current.Child.Left;\n\t\t\t\t\t\t\tcurrent.Child.Left.Right = temp;\n\t\t\t\t\t\t\tcurrent.Child.Left = temp;\n\t\t\t\t\t\t\ttemp.Parent = current;\n\t\t\t\t\t\t\tcurrent.degree +=1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(min.dist >= current.dist){\n\t\t\t\t\tmin = current;\n\n\t\t\t\t}\n\t\t\t\tmap.put(current.degree, current);\n\t\t\t\tcurrent = check;\n\t\t\t}\n\t\t\tlast = min.Left;\n\t\t\twhile(map.containsKey(current.degree)){\n\t\t\t\tNodefh temp = map.remove(current.degree);\n\t\t\t\tif(temp.dist < current.dist && temp.dist!=0){\n\t\t\t\t\tcurrent.Right.Left = current.Left;\n\t\t\t\t\tcurrent.Left.Right = current.Right;\n\t\t\t\t\ttemp.ChildCut = false;\n\t\t\t\t\tif(temp.isChildEmpty()){\n\t\t\t\t\t\ttemp.Child = current;\n\t\t\t\t\t\tcurrent.Left = current.Right = current;\n\t\t\t\t\t\ttemp.Child.Parent = temp;\n\t\t\t\t\t\ttemp.degree = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tcurrent.Right = temp.Child;\n\t\t\t\t\t\tcurrent.Left = temp.Child.Left;\n\t\t\t\t\t\ttemp.Child.Left.Right = current;\n\t\t\t\t\t\ttemp.Child.Left = current;\n\t\t\t\t\t\tcurrent.Parent = temp;\n\t\t\t\t\t\ttemp.degree +=1;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = temp;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttemp.Right.Left = temp.Left;\n\t\t\t\t\ttemp.Left.Right = temp.Right;\n\t\t\t\t\tcurrent.ChildCut = false;\n\t\t\t\t\tif(current.isChildEmpty()){\n\t\t\t\t\t\tcurrent.Child = temp;\n\t\t\t\t\t\ttemp.Left = temp.Right = temp;\n\t\t\t\t\t\tcurrent.Child.Parent = current;\n\t\t\t\t\t\tcurrent.degree = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ttemp.Right = current.Child;\n\t\t\t\t\t\ttemp.Left = current.Child.Left;\n\t\t\t\t\t\tcurrent.Child.Left.Right = temp;\n\t\t\t\t\t\tcurrent.Child.Left = temp;\n\t\t\t\t\t\ttemp.Parent = current;\n\t\t\t\t\t\tcurrent.degree +=1;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(min.dist >= current.dist){\n\t\t\t\tmin = current;\n\n\t\t\t}\n\t\t\tcurrent = min;\n\t\t\tlast = min.Left;\n\t\t}\n\n\t}", "public Node<T> darTope();", "private void originalAttributesToMirror(Node node) {\n for (NodeAttributeToPreserve attribute : nodeAttributesToPreserve) {\n NodeAttribute<Object> originalAttribute = originalGraph.nodeAttribute(attribute.id);\n NodeAttribute<Object> mirrorAttribute = mirrorGraph.nodeAttribute(attribute.id);\n copyAttributeValue(originalAttribute, node, mirrorAttribute, node);\n }\n copyPosition(originalPositions, mirrorPositions, node);\n }", "public void removeNode(N node)\r\n/* 71: */ {\r\n/* 72:135 */ assert (checkRep());\r\n/* 73:137 */ for (N endNode : getSuccessors(node)) {\r\n/* 74:138 */ ((Map)this.map.get(endNode)).remove(node);\r\n/* 75: */ }\r\n/* 76:140 */ this.map.remove(node);\r\n/* 77: */ }", "protected Node<T> removeFixupCase1(Node<T> u) {\n\t\tflipRight(u.parent);\n\t\treturn u;\n\t}", "private TreeNode traverseTree(Instance i) {\n TreeNode next = root;\n while (next != null && !next.isLeafNode()) {\n Attribute a = next.split.attribute;\n if (a.isNominal()) {\n next = next.nominals()[(int) i.value(a)];\n } else {\n if (i.value(a) < next.split.splitPoint) {\n next = next.left();\n } else {\n next = next.right();\n }\n }\n }\n return next;\n }", "private void updateTree(String st, int lineno, double bl, PrintWriter missing){\n\t\t String[] str = st.split(\"\\\\s+\");\n\t\t String specName = str[0];\n\t\t if(str[0].indexOf(\"GRCh38\")>=0){\n\t\t\t specName= \"Homo_sapiens\";\n\t\t\t str[0] = specName;\n\t\t }\n\t\t String alias1 = collapse(str, 2, str.length, \" \");\n\t\t Node n = getSlug(specName, alias1);\n\t\t if(n==null) n = this.unclassified;\n\t\t Node newnode = this.createFromSpeciesFile(str,alias1, n, lineno, bl);\n\t\t this.putSlug(newnode);\n\t\t\t \n\t\t\n\t\t \n\t }", "private MyBinNode getToReplace(MyBinNode node){\n MyBinNode replc_p = node;\n MyBinNode replace = node;\n MyBinNode aux = node.right;\n while(aux != null){\n replc_p = replace;\n replace = aux;\n aux = aux.left;\n }\n if(replace != node.right){\n replc_p.left = replace.right;\n replace.right = node.right;\n }\n return replace;\n }", "private BinaryNode<AnyType> mirror1(BinaryNode<AnyType> t)\r\n\t{\r\n\t\tif(t==null)\r\n\t\t\treturn t;\r\n\r\n\t\tBinaryNode n1=mirror1(t.left);\r\n\t\tBinaryNode n2=mirror1(t.right);\r\n\t\tt.left=n2;\r\n\t\tt.right=n1;\r\n\t\treturn t;\r\n\t}", "private void eliminarAux(NodoAVL<T> actual){\n NodoAVL<T> papa= actual.getPapa();\n if(actual.getHijoIzq()==null && actual.getHijoDer()==null)\n eliminaSinHijos(actual,papa); \n else{//CASO2: Nodo con un solo hijo (izq)\n NodoAVL<T> sustituto;\n if(actual.getHijoIzq()!=null && actual.getHijoDer()==null){\n sustituto= actual.getHijoIzq();\n eliminaSoloConHijoIzq(actual,papa,sustituto); \n }\n else//CASO3: Nodo con un solo hijo (der)\n if(actual.getHijoIzq()==null && actual.getHijoDer()!=null){\n sustituto= actual.getHijoDer();\n eliminaSoloConHijoDer(actual,papa, sustituto);\n }\n else //CASO4: Nodo con dos hijos\n if(actual.getHijoIzq()!=null && actual.getHijoDer()!=null)\n eliminaConDosHijos(actual);\n }\n \n }", "private void toMirrorImage(Node root){\n if(root==null){\n return;\n }\n Node temp = root.getLeft();\n root.setLeft(root.getRight());\n root.setRight(temp);\n\n toMirrorImage(root.getLeft());\n toMirrorImage(root.getRight());\n }", "private Node prune(Node r) {\r\n if (r == null) return null;\r\n Op op = r.op();\r\n r.left(prune(r.left()));\r\n if (r.left() == null) r.ref(prune(r.ref()));\r\n else r.right(prune(r.right()));\r\n if (r.right() != null && r.right().op() == Temp) r.right(null);\r\n if (op == Temp) return r.left();\r\n return r;\r\n }", "public abstract Node apply(Node node);", "public void fixViolationDelete(Node node){ \n\t\t\n\t while(node!=root && node.colour==\"Black\"){\n\t if(node==node.parent.left){\n\t \t//if the node is the left child and sibling is in the right\n\t Node sibling=node.parent.right;\n\t //check if the color of sibling is red then exchange the color with parent and rotate left \n\t if(sibling.colour == \"Red\"){\n\t \tsibling.colour = \"Black\";\n\t node.parent.colour = \"Red\";\n\t rotateLeft(node.parent);\n\t sibling=node.parent.right;\n\t }\n\t if(sibling.left.colour==\"Black\" && sibling.right.colour ==\"Black\"){\n\t \t//if both the children of sibling are black, change the color of the sibling and transfer the problem up the parent\n\t \tsibling.colour = \"Red\";\n\t node=node.parent;\n\t }\n\t else{ \n\t if(sibling.right.colour==\"Black\"){\n\t \t//if the left child of the sibling in red exchange the color of the sibling's child with sibling and color the child black\n\t \t// and rotate right\n\t \tsibling.left.colour = \"Black\";\n\t \tsibling.colour = \"Red\";\n\t rotateRight(sibling);\n\t sibling=node.parent.right;\n\t }\n\t //followed my the left rotation\n\t sibling.colour = node.parent.colour;\n\t node.parent.colour = \"Black\";\n\t sibling.right.colour = \"Black\";\n\t rotateLeft(node.parent);\n\t node=root;\n\t }\n\t }\n\t else{\n\t \t//node is the right child of the parent and sibling is the left child\n\t Node sibling=node.parent.left;\n\t \n\t if(sibling.colour == \"Red\"){\n\t \tsibling.colour = \"Black\";\n\t node.parent.colour = \"Red\";\n\t rotateRight(node.parent);\n\t sibling=node.parent.left;\n\t }\n\t \n\t if(sibling.right.colour==\"Black\" && sibling.left.colour==\"Black\"){\n\t \tsibling.colour = \"Red\";\n\t node=node.parent;\n\t }else{\n\t if(sibling.left.colour==\"Black\"){\n\t \tsibling.right.colour= \"Black\";\n\t \tsibling.colour = \"Red\";\n\t rotateLeft(sibling);\n\t sibling=node.parent.left;\n\t }\n\t \n\t sibling.colour = node.parent.colour;\n\t node.parent.colour = \"Black\";\n\t sibling.left.colour = \"Black\";\n\t rotateRight(node.parent);\n\t node=root;\n\t }\n\t }\n\t }\n\t //we color the node black\n\t node.colour = \"Black\";\n\t}", "private void RemoveRootNode() {\n\t\t\n\t\troot_map.remove(this);\n\t\tis_node_set = false;\n\t\tif(left_ptr == null && right_ptr == null) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tleft_ptr.RemoveRootNode();\n\t\tright_ptr.RemoveRootNode();\n\t}", "TreeNode returnNode(TreeNode node);", "void arbitraryRemove(Nodefh node){\n\t\n\t\tif(node.Parent.Child == node){\n\t\t\tif(node.Right != null && node.Right != node){\n\t\t\t\tnode.Parent.Child = node.Right;\n\t\t\t\tif(node.Left!=null && node.Left != node){\n\t\t\t\t\tnode.Left.Right = node.Right;\n\t\t\t\t\tnode.Right.Left = node.Left;\n\t\t\t\t\tnode.Parent = null;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tnode.Right.Left = node.Right;\n\t\t\t\t\tnode.Parent = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnode.Parent.Child = null;\n\t\t\t\tnode.Parent = null;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tif(node.Left != null && node.Left != node){\n\t\t\t\tnode.Left.Right = node.Right;\n\t\t\t\tnode.Right.Left = node.Left;\n\t\t\t}\n\t\t\tnode.Parent = null;\n\n\t\t}\n\t\tif(node.Child!=null){\n\t\t\tNodefh temp = node.Child;\n\t\t\tif(node.Child.Right!=null){\n\t\t\t\ttemp = node.Child.Right;\n\t\t\t}\n\t\t\tfhInsert(node.Child);\n\t\t\twhile(temp!=node.Child.Right){\n\t\t\t\tfhInsert(temp);\n\t\t\t\ttemp = temp.Right;\n\t\t\t}\n\n\t\t}\n\n\t}", "@SuppressWarnings(\"unchecked\")\n\tprivate void build(Node<VirtualDataSet> node) {\n\n\t\tif (node == null)\n\t\t\tthrow new NullPointerException(\"Cannot built a decision (sub)tree for a null node.\");\n\n\t\tVirtualDataSet set = node.data;\n\n\t\tif (set == null || set.getNumberOfDatapoints() == 0 || set.getNumberOfAttributes() == 0)\n\t\t\tthrow new IllegalStateException(\"The dataset is in an invalid state!\");\n\n\t\tif (set.getNumberOfAttributes() == 1) // We have only the class attribute left\n\t\t\treturn;\n\n\t\tif (set.getAttribute(set.getNumberOfAttributes() - 1).getValues().length == 1) // No uncertainty left\n\t\t\treturn;\n\n\t\tboolean needsSplit = false;\n\n\t\tfor (int i = 0; i < set.getNumberOfAttributes() - 1; i++) {\n\t\t\tif (set.getAttribute(i).getValues().length < 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tneedsSplit = true;\n\t\t}\n\n\t\tif (!needsSplit) // split would be futile for all remaining attributes\n\t\t\treturn;\n\n\t\tGainInfoItem[] gains = InformationGainCalculator.calculateAndSortInformationGains(set);\n\t\t\n\t\tif (gains[0].getGainValue() == 0.0) // No split when there is no gain\n\t\t\treturn; \n\n\t\tAttribute bestAttribute = set.getAttribute(gains[0].getAttributeName());\n\n\t\tif (bestAttribute.getType() == AttributeType.NOMINAL) {\n\t\t\tVirtualDataSet[] partitions = set\n\t\t\t\t\t.partitionByNominallAttribute(set.getAttributeIndex(bestAttribute.getName()));\n\t\t\tnode.children = (Node<VirtualDataSet>[]) new Node[partitions.length];\n\n\t\t\tfor (int i = 0; i < node.children.length; i++) {\n\t\t\t\tnode.children[i] = new Node<VirtualDataSet>(partitions[i]);\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < node.children.length; i++) {\n\t\t\t\tbuild(node.children[i]);\n\t\t\t}\n\n\t\t} else {\n\t\t\tint attributeIndex = node.data.getAttributeIndex(bestAttribute.getName());\n\n\t\t\tString[] values = bestAttribute.getValues();\n\n\t\t\tint valueIndex = -1;\n\n\t\t\tfor (int i = 0; i < values.length; i++) {\n\t\t\t\tif (values[i].equals(gains[0].getSplitAt())) {\n\t\t\t\t\tvalueIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (valueIndex == -1) {\n\t\t\t\tSystem.out.println(\"Houston, we have a problem!\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tVirtualDataSet[] partitions = set.partitionByNumericAttribute(attributeIndex, valueIndex);\n\n\t\t\tnode.children = (Node<VirtualDataSet>[]) new Node[partitions.length];\n\n\t\t\tfor (int i = 0; i < node.children.length; i++) {\n\t\t\t\tnode.children[i] = new Node<VirtualDataSet>(partitions[i]);\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < node.children.length; i++) {\n\t\t\t\tbuild(node.children[i]);\n\t\t\t}\n\t\t}\n\t}", "private E removeNode(Node n) {\n \tassert (n != sentinel);\n \tn.succ.pred = n.pred;\n \tn.pred.succ = n.succ;\n \tsize--;\n \treturn n.data;\n }", "private void mirrorAttributesToOriginal(Node node) {\n assert (!isPartOfMirrorEdge(node)) : \"The method should not be called on node bends.\";\n for (NodeAttributeToPreserve attribute : nodeAttributesToPreserve) {\n NodeAttribute<Object> originalAttribute = originalGraph.nodeAttribute(attribute.id);\n NodeAttribute<Object> mirrorAttribute = mirrorGraph.nodeAttribute(attribute.id);\n copyAttributeValue(mirrorAttribute, node, originalAttribute, node);\n }\n copyPosition(mirrorPositions, originalPositions, node);\n }", "private void deleteDegreeOneChild(Node curr, AtomicReference<Node> rootRef) {\n\t\tNode child = curr.right.isNull ? curr.left : curr.right;\n replaceNode(curr, child, rootRef);\n if(curr.color == Color.BLACK) {\n if(child.color == Color.RED) {\n child.color = Color.BLACK;\n } else {\n adjustRootDeficiency(child, rootRef);\n }\n }\n\t}", "private Node makeTree(Node currentNode, DataNode dataNode,\r\n\t\t\tint featureSubsetSize, int height) {\n\r\n\t\tif (dataNode.labels.size() < this.traineeDataSize / 25 || height > 7) {\r\n\t\t\treturn new Node(majority(dataNode));\r\n\t\t}\r\n\t\telse{\r\n\r\n\t\t\tEntropyCalculation e1 = new EntropyCalculation();\r\n\r\n\t\t\tNode n = e1.maxGainedElement(dataNode.features, dataNode.labels, featureSubsetSize); //new\r\n\r\n\r\n\t\t\tif(e1.zeroEntropy){\r\n\r\n\t\t\t\tcurrentNode = new Node(dataNode.labels.get(0));\r\n\r\n\t\t\t\t/*currentNode.attribute = dataNode.features;\r\n\t\t\t\tcurrentNode.decision = dataNode.labels;\r\n\t\t\t\tcurrentNode.nodeValue = dataNode.labels.get(0);*/\r\n\r\n\t\t\t\treturn currentNode;\r\n\t\t\t}\r\n\t\t\telse{\r\n\r\n\t\t\t\tcurrentNode = new Node();\r\n\r\n\t\t\t\tcurrentNode.featureIndexColumn = n.featureIndexColumn;\r\n\t\t\t\tcurrentNode.featureIndexRow = n.featureIndexRow;\r\n\r\n\t\t\t\tcurrentNode.attribute = dataNode.features;\r\n\t\t\t\tcurrentNode.decision = dataNode.labels;\r\n\r\n\t\t\t\tcurrentNode.nodeValue = dataNode.features.get(currentNode.featureIndexRow).get(currentNode.featureIndexColumn);\r\n\r\n\t\t\t\tcurrentNode.leftChild = new Node();\r\n\t\t\t\tcurrentNode.rightChild = new Node();\r\n\r\n\t\t\t\tDataNode leftNode = new DataNode();\r\n\t\t\t\tDataNode rightNode = new DataNode();\r\n\r\n\t\t\t\tfor (int i = 0; i < dataNode.features.size(); i++) {\r\n\r\n\t\t\t\t\tif(currentNode.nodeValue >= dataNode.features.get(i).get(currentNode.featureIndexColumn)) {\r\n\r\n\t\t\t\t\t\tleftNode.features.add(dataNode.features.get(i));\r\n\t\t\t\t\t\tleftNode.labels.add(dataNode.labels.get(i));\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\trightNode.features.add(dataNode.features.get(i));\r\n\t\t\t\t\t\trightNode.labels.add(dataNode.labels.get(i));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif((leftNode.labels.isEmpty() || rightNode.labels.isEmpty()) && height == 0){\r\n\t\t\t\t\tSystem.out.println(\"Ghapla\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcurrentNode.leftChild = makeTree(currentNode.leftChild, leftNode, featureSubsetSize, height+1);\r\n\r\n\t\t\t\tcurrentNode.rightChild = makeTree(currentNode.rightChild, rightNode, featureSubsetSize, height+1);\r\n\r\n\t\t\t\treturn currentNode;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "Node deleteSuccessor(Node node) {\r\n\t\tNode successor = node.right , parentSuccessor = node ;\r\n\t\twhile( successor.left != null ) {\r\n\t\t\tparentSuccessor = successor ;\r\n\t\t\tsuccessor = successor.left ;\r\n\t\t}\r\n\t\tint value = node.value ;\r\n\t\tnode.value = successor.value ;\r\n\t\tsuccessor.value = value ;\r\n\t\t\r\n\t\tif( parentSuccessor == node ) {\r\n\t\t\tnode.right = successor.right ;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tparentSuccessor.left = successor.right ;\r\n\t\t}\r\n\t\tsuccessor.left = null ;\r\n\t\tsuccessor.right = null ;\r\n\t\treturn successor;\r\n\t}", "public void setToOriginals(){\n\t\t//set all occupied nodes as empty\n\t\tif(nodeStatus == Status.occupied){\n\t\t\tsetAsEmpty();\n\t\t}\n\t\t//if the node had a unit end on it, reset that value\n\t\tif(ended == true){\n\t\t\tended=false;\n\t\t}\n\t\tf=0;\n\t\tg=0;\n\t\th=0;\n\t}", "@Override\n protected boolean removeChanceNode() {\n\n Node candidateToReduce;\n Node candidateToRemove;\n Node nodeToRemove;\n String operation;\n int i;\n NodeList children;\n Node valueNodeToReduce;\n\n NodeList chancesID;\n boolean removed = false;\n Node nodeUtil = null;\n\n\n\n\n // Obtain the value node \n\n //sv = ((IDWithSVNodes) diag).getTerminalValueNode();\n\n //diag.save(\"debug-mediastinet.elv\");\n\n //List of chance nodes in the diagram\n chancesID = diag.getNodesOfKind(Node.CHANCE);\n\n for (i = 0; (i < chancesID.size()) && removed == false; i++) {\n\n candidateToRemove = chancesID.elementAt(i);\n\n //Check if the candidaToRemove can be removed\n if (isRemovableChance(candidateToRemove)) {\n\n nodeToRemove = candidateToRemove;\n children = nodeToRemove.getChildrenNodes();\n //Reduce value nodes if it's necessary\n\n if (children.size() > 1) {\n //We have to reduce\n candidateToReduce = getCandidateValueNodeToReduceForChanceNode(nodeToRemove);\n\n //valueNodeToReduce =\tobtainValueNodeToReduce(reachableParents);\n valueNodeToReduce = obtainValueNodeToReduce(nodeToRemove, candidateToReduce);\n ReductionAndEvalID.reduceNode(\n (IDWithSVNodes) diag,\n valueNodeToReduce);\n nodeUtil = valueNodeToReduce;\n operation = \"Reduce: \" + nodeUtil.getName() + \" to eliminate: \" + nodeToRemove.getName();\n System.out.println(operation);\n statistics.addOperation(operation);\n\n indexOperation++;\n try {\n diag.save(\"debug-operation-\" + indexOperation + \".elv\");\n } catch (IOException ex) {\n Logger.getLogger(ArcReversalSV.class.getName()).log(Level.SEVERE, null, ex);\n }\n } else {\n //The chance has only one child (utility)\n nodeUtil = children.elementAt(0);\n\n }\n\n\n String auxName = candidateToRemove.getName();\n operation = \"Chance node removal: \" + auxName;\n System.out.println(operation);\n statistics.addOperation(operation);\n\n //Add the name of the node to 'orderOfElimination'\n ((PropagationStatisticsID) statistics).addNameToOrderOfElimination(auxName);\n\n // The relation of the utility node is modified. In this \n // case the parents of the node to remove will be parents \n // of the utility node \n\n modifyUtilityRelation(nodeUtil, nodeToRemove, true);\n\n // Calculate the new expected utility \n getExpectedUtility(nodeUtil, nodeToRemove);\n\n // The node is deleted \n\n diag.removeNodeOnly(nodeToRemove);\n\n//\t\t\t\tStore the size of the diagram\n\n statistics.addSize(diag.calculateSizeOfPotentials());\n\n statistics.addTime(crono.getTime());\n\n indexOperation++;\n try {\n diag.save(\"debug-operation-\" + indexOperation + \".elv\");\n } catch (IOException ex) {\n Logger.getLogger(ArcReversalSV.class.getName()).log(Level.SEVERE, null, ex);\n }\n // Set removed \n removed = true;\n\n }\n }//for\n return removed;\n }", "private void doubleRotationRL(BinaryNode node) {\n BinaryNode temp = min(node.right);\n if (node == root) {\n root = temp;\n if (temp.parent.right == temp) { //temp could have a child on the right\n temp.parent.right = temp.right;\n if (temp.right != null) temp.right.parent = temp.parent;\n }\n else {\n temp.parent.left = temp.right;\n if (temp.right != null) temp.right.parent = temp.parent;\n }\n root.parent = null;\n root.left = node;\n root.right = node.right;\n if(node.right != null) node.right.parent = root;\n node.parent = root;\n node.right = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = temp;\n } else {\n node.parent.left = temp;\n }\n temp.parent = node.parent;\n temp.right = node.right;\n if(node.right != null) node.right.parent = temp;\n temp.left = node;\n node.parent = temp;\n node.right = null;\n }\n }", "void fixViolation(Node node){\n\t\tNode parentPtr = nil;\n\t\tNode grParentPtr = nil;\n\t\t\n\t\twhile( node != root && node.colour != \"Black\" && node.parent.colour == \"Red\" && node.parent.parent != nil){\n\t\t\t\n\t\t\tparentPtr = node.parent;\n\t\t\tgrParentPtr = node.parent.parent;\n\t\t\t//case A\n\t\t\t//parent of node is the left child of grandparent\n\t\t\tif(parentPtr == grParentPtr.left){\n\t\t\t\tNode unclePtr = grParentPtr.right;\n\t\t\t\t\n\t\t\t\t//case 1 \n\t\t\t\t//Uncle is red in color\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//of node is the right child of its parent\n\t\t\t\t\tif(node == parentPtr.right){\n\t\t\t\t\t\trotateLeft(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the left child of its parent left rotation is required\n\t\t\t\t\trotateRight(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//case B\n\t\t\t//parent of the node is the right child of grand parent\n\t\t\tif(parentPtr == grParentPtr.right){\n\t\t\t\tNode unclePtr = grParentPtr.left;\n\t\t\t\t//case 1\n\t\t\t\t//uncle pointer is red\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//node is the left child of its parent right rotation is required\n\t\t\t\t\tif(node == parentPtr.left){\n\t\t\t\t\t\trotateRight(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the right child of its parent left rotation is required\n\t\t\t\t\trotateLeft(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\troot.colour = \"Black\";\n\t}", "private IAVLNode findSuccessor(IAVLNode node) \r\n\t {\r\n\t\t if(node.getRight().getHeight() != -1) \r\n\t\t\t return minPointer(node.getRight());\r\n\t\t IAVLNode parent = node.getParent();\r\n\t\t while(parent.getHeight() != -1 && node == parent.getRight())\r\n\t\t {\r\n\t\t\t node = parent;\r\n\t\t\t parent = node.getParent();\r\n\t\t }\r\n\t\t return parent;\t \r\n\t\t}", "public TreeNode reconstruct(int[] pre) {\n if (pre == null || pre.length == 0) {\n return null;\n }\n return buildBST(pre, 0, pre.length - 1);\n }", "@Test\n public void remove_BST_1_CaseLeafRight()\n {\n BinarySearchTree bst = new BinarySearchTree();\n No root = new No(6);\n No leaf = new No(9);\n \n bst.insert(null, root);\n //bst.printTree();\n \n bst.insert(root, new No(2));\n //bst.printTree();\n \n bst.insert(root, leaf);\n //bst.printTree();\n //System.err.println(); // Print[ERR] Devido a prioridade do buffer de impressao (out, err)\n \n assertEquals(leaf, bst.remove(leaf));\n assertEquals(new Integer(2), bst.size());\n //bst.printTree();\n }", "private static <K, V> Node<K, V> restoreInvariants(@Var Node<K, V> current) {\n if (Node.isRed(current.right)) {\n // Right should not be red in a left-leaning red-black tree.\n current = rotateCounterclockwise(current);\n }\n\n if (Node.isRed(current.left) && Node.isRed(current.left.left)) {\n // Don't have consecutive red nodes.\n current = rotateClockwise(current);\n }\n\n if (Node.isRed(current.left) && Node.isRed(current.right)) {\n // Again, don't have red right children.\n // We make both children black and this one red,\n // so we pass the potential problem of having a red right upwards in the tree.\n current = colorFlip(current);\n }\n\n return current;\n }", "@Test\n public void testPhylogeneticTreeParserNamedLeafsNoDistance() {\n // create the actual tree\n String tree = \"(A,B,(C,D));\";\n PhylogeneticTreeItem rootActual = PhylogeneticTreeParser.parse(tree);\n\n // create the expected Tree\n // root node\n PhylogeneticTreeItem rootExpected = new PhylogeneticTreeItem();\n // add 3 child nodes\n PhylogeneticTreeItem current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n current.setName(\"A\");\n current = new PhylogeneticTreeItem();\n current.setName(\"B\");\n current.setParent(rootExpected);\n current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n // add 2 child nodes to the third node\n PhylogeneticTreeItem current2 = new PhylogeneticTreeItem();\n current2.setParent(current);\n current2.setName(\"C\");\n current2 = new PhylogeneticTreeItem();\n current2.setParent(current);\n current2.setName(\"D\");\n\n // compare the trees\n assertEquals(\"both trees do not match\", rootExpected, rootActual);\n\n }", "public void fixup(RBTNode z){\n if (z.parent == nil){\n z.color = 'B';\n// System.out.println(\"Root\");\n }\n else if (z.parent.color == 'B');\n// System.out.println(\"NIC SIĘ NIE DZIEJE\");\n else if (z.parent.parent.left == z.parent)\n fixupL(z);\n else fixupR(z);\n// System.out.println(\"——————————————————— koniec fixup: \" + z.word);\n }", "public void RBFixup(Node n) {\r\n\t\twhile(n.parent.color == 0) {\r\n\t\t\tif(n.parent == n.parent.parent.left) {\r\n\t\t\t\tNode y = n.parent.parent.right;\r\n\t\t\t\tif(y.color == 0) {\r\n\t\t\t\t\tn.parent.color = 1;\r\n\t\t\t\t\ty.color = 1;\r\n\t\t\t\t\tn.parent.parent.color = 0;\r\n\t\t\t\t\tn = n.parent.parent;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tif(n == n.parent.right) {\r\n\t\t\t\t\t\tn = n.parent;\r\n\t\t\t\t\t\tleftRotate(n);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tn.parent.color = 1;\r\n\t\t\t\t\tn.parent.parent.color = 0;\r\n\t\t\t\t\t//mark n and n's grandparent, because in the end these two nodes will be the children\r\n\t\t\t\t\t//marking will be handled in recUpdateNode\r\n\t\t\t\t\tn.marked = true;\r\n\t\t\t\t\tn.parent.parent.marked = true;\r\n\t\t\t\t\trightRotate(n.parent.parent);\r\n\t\t\t\t\tif(hFlag == 1)\r\n\t\t\t\t\t\theight--;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tNode y = n.parent.parent.left;\r\n\t\t\t\tif(y.color == 0) {\r\n\t\t\t\t\tn.parent.color = 1;\r\n\t\t\t\t\ty.color = 1;\r\n\t\t\t\t\tn.parent.parent.color = 0;\r\n\t\t\t\t\tn = n.parent.parent;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tif(n == n.parent.left) {\r\n\t\t\t\t\t\tn = n.parent;\r\n\t\t\t\t\t\trightRotate(n);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tn.parent.color = 1;\r\n\t\t\t\t\tn.parent.parent.color = 0;\r\n\t\t\t\t\t//mark n and n's grandparent, because in the end these two nodes will be the children\r\n\t\t\t\t\t//marking will be handled in recUpdateNode\r\n\t\t\t\t\tn.marked = true;\r\n\t\t\t\t\tn.parent.parent.marked = true;\r\n\t\t\t\t\tleftRotate(n.parent.parent);\r\n\t\t\t\t\tif(hFlag == 1)\r\n\t\t\t\t\t\theight--;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\troot.color = 1;\r\n\t}", "public int my_leaf_count();", "public int delete(int k) {\n\t\tif (this.empty()) {// empty tree, nothing to erase\n\t\t\treturn -1;\n\t\t}\n\t\tAVLNode root = (AVLNode) this.root;\n\t\tAVLNode node = (AVLNode) root.delFindNode(k);\n\t\tif (node == null) {// no node with key==k in this tree\n\t\t\treturn -1;\n\t\t}\n\t\tchar side = node.parentSide();\n\t\tboolean rootTerm = (node.getLeft().getKey() != -1 && node.getRight().getKey() != -1);\n\t\tif (side == 'N' && (rootTerm == false)) {\n\t\t\treturn this.deleteRoot(node);\n\t\t}\n\t\tif (side == 'L') {\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.parent.getRight().getHeight();\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tif (leftEdge == 1 && rightEdge == 1) {// first case (\"easy one\", just delete)\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.updateSize();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (leftEdge == 1 && rightEdge == 2) {\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.setHeight(parent.getHeight() - 1);\n\t\t\t\t\tparent.setSize();\n\t\t\t\t\treturn this.delRecTwos(parent);\n\t\t\t\t} else {// leftEdge==2&&rightEdge==1\n\t\t\t\t\tnode.parent.setLeft(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\treturn this.delRecTriOne(parent, side);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((node.left != null && node.right == null) || (node.left == null && node.right != null)) {// node is //\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// unary\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.parent.getRight().getHeight();\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\tAVLNode parent = node.delUnaryLeft();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\tAVLNode parent = node.delUnaryRight();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 2)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryLeft());\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryRight());\n\t\t\t\t\t}\n\t\t\t\t} else {// leftEdge==2&&rightEdge==1\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryLeft(), side);\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryRight(), side);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif (side == 'R') {\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.parent.getLeft().getHeight();\n\t\t\t\tAVLNode parent = (AVLNode) node.parent;\n\t\t\t\tif (leftEdge == 1 && rightEdge == 1) {// first case (\"easy one\", just delete)\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.updateSize();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (leftEdge == 2 && rightEdge == 1) {\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\tparent.setHeight(parent.getHeight() - 1);\n\t\t\t\t\tparent.setSize();\n\t\t\t\t\treturn this.delRecTwos(parent);\n\t\t\t\t} else {// leftEdge==1&&rightEdge==2\n\t\t\t\t\tnode.parent.setRight(new AVLNode());\n\t\t\t\t\tnode.setParent(null);\n\t\t\t\t\treturn this.delRecTriOne(parent, side);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((node.getLeft().getHeight() != -1 && node.getRight().getHeight() == -1)\n\t\t\t\t\t|| (node.getLeft().getHeight() == -1 && node.getRight().getHeight() != -1)) {// node is unary\n\t\t\t\tint rightEdge = node.parent.getHeight() - node.getHeight();\n\t\t\t\tint leftEdge = node.parent.getHeight() - node.parent.getLeft().getHeight();\n\t\t\t\tif ((leftEdge == 1 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\tAVLNode parent = node.delUnaryLeft();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\tAVLNode parent = node.delUnaryRight();\n\t\t\t\t\t\tparent.updateSize();\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ((leftEdge == 2 && rightEdge == 1)) {\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryLeft());\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTwos(node.delUnaryRight());\n\t\t\t\t\t}\n\t\t\t\t} else {// leftEdge==1&&rightEdge==2\n\t\t\t\t\tif (node.left != null) {\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryLeft(), side);\n\t\t\t\t\t} else {// node.right!=null\n\t\t\t\t\t\treturn this.delRecTriOne(node.delUnaryRight(), side);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t// we get here only if node is binary, and thus not going through any other\n\t\t// submethod\n\t\tAVLNode successor = this.findSuccessor(node); // successor must be unary/leaf\n\t\tif (node.checkRoot()) {\n\t\t\tthis.root = successor;\n\t\t}\n\t\tint numOp = this.delete(successor.key);\n\t\tsuccessor.setHeight(node.getHeight());\n\t\tsuccessor.size = node.getSize();\n\t\tsuccessor.setRight(node.getRight());\n\t\tnode.right.setParent(successor);\n\t\tnode.setRight(null);\n\t\tsuccessor.setLeft(node.getLeft());\n\t\tnode.left.setParent(successor);\n\t\tnode.setLeft(null);\n\t\tsuccessor.setParent(node.getParent());\n\t\tif (node.parentSide() == 'L') {\n\t\t\tnode.parent.setLeft(successor);\n\t\t} else if (node.parentSide() == 'R') {// node.parentSide()=='R'\n\t\t\tnode.parent.setRight(successor);\n\t\t}\n\t\tnode.setParent(null);\n\t\treturn numOp;\n\n\t}", "private void processNode(BranchNode bn, Grid[][] map) {\n\t\tif (bn.leaf_alive) {\r\n\t\t\tfor (int i = 0; i < leaf_size; i++) {\r\n\t\t\t\tint l = bn.x + i - leaf_size / 2;\r\n\t\t\t\tif (l >= 0 && l < World.WORLD_WIDTH) {\r\n\t\t\t\t\thealth += map[l][bn.y].sunlight;\r\n\t\t\t\t\tmap[l][bn.y].sunlight -= World.LEAF_BLOCK;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Kill Leaf if the leaf is too old\r\n\t\t\tbn.leaf_age += 1;\r\n\t\t\tif (bn.leaf_age >= LEAF_LIFETIME) {\r\n\t\t\t\tbn.killLeaf(this, map);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// If I really want to be safe, I should put a check for if bn.children.size() > 0\r\n\t\t// But the for loop here checks it for me already.\r\n\t\tfor (int i = 0; i < bn.children.size(); i++) {\r\n\t\t\tprocessNode(bn.children.get(i), map);\r\n\t\t}\t\t\r\n\t}", "public abstract String toName(Object inNode);", "private void removeFixUp(RBNode<T> node, RBNode<T> parent) {\r\n RBNode<T> other;\r\n\r\n while((node == null || isBlack(node)) && (node != this.root)) {\r\n if(parent.left == node) { //node is leftChild\r\n other = parent.right; //brother of node\r\n if(isRed(other)) { //case1: brother is red\r\n setBlack(other);\r\n setRed(parent);\r\n leftRotate(parent);\r\n other = parent.right;\r\n }\r\n\r\n //case2: brother is black, both children of brother is black\r\n if((other.left == null || isBlack(other.left)) &&\r\n (other.right == null || isBlack(other.right))) {\r\n setRed(other);\r\n node = parent;\r\n parent = parentOf(node);\r\n } else {\r\n //case3: brother is black, left red right black\r\n if(other.right == null || isBlack(other.right)) {\r\n setBlack(other.left);\r\n setRed(other);\r\n rightRotate(other);\r\n other = parent.right;\r\n }\r\n\r\n //case4: brother is black, right red left any color\r\n setColor(other, colorOf(parent));\r\n setBlack(parent);\r\n setBlack(other.right);\r\n leftRotate(parent);\r\n node = this.root;\r\n break;\r\n }\r\n } else {\r\n other = parent.left;\r\n\r\n if (isRed(other)) {\r\n //case1: brother is red\r\n setBlack(other);\r\n setRed(parent);\r\n rightRotate(parent);\r\n other = parent.left;\r\n }\r\n\r\n if ((other.left==null || isBlack(other.left)) &&\r\n (other.right==null || isBlack(other.right))) {\r\n //case2: brother is black, both children of brother is black\r\n setRed(other);\r\n node = parent;\r\n parent = parentOf(node);\r\n } else {\r\n\r\n if (other.left==null || isBlack(other.left)) {\r\n //case3: brother is black, left red right black\r\n setBlack(other.right);\r\n setRed(other);\r\n leftRotate(other);\r\n other = parent.left;\r\n }\r\n\r\n //case4: brother is black, left red right any color\r\n setColor(other, colorOf(parent));\r\n setBlack(parent);\r\n setBlack(other.left);\r\n rightRotate(parent);\r\n node = this.root;\r\n break;\r\n }\r\n }\r\n }\r\n if (node!=null)\r\n setBlack(node);\r\n }", "public myBinaryTree<T> my_mirror();", "private BinarySearchTree deleteTree(BinarySearchTree tree, Comparable key){\r\n\t\t\r\n\t\t//If it is a leaf\r\n\t\tif(tree.getLeftChild() == null && tree.getRightChild() == null){\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t//Tree has only 1 leaf\r\n\t\telse if( (tree.getLeftChild() == null && tree.getRightChild() != null) ||\r\n\t\t\t\t (tree.getLeftChild() != null && tree.getRightChild() == null)){\r\n\t\t\t\r\n\t\t\t//Make a new tree out of the leaf and make it the new root\r\n\t\t\tif(tree.getLeftChild() != null){\r\n\t\t\t\treturn tree.getLeftChild();\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn tree.getRightChild();\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Has two leaves. This case is slightly more complicated\r\n\t\telse{\r\n\t\t\t//get the leftmost item in the right child subtree. This becomes the \r\n\t\t\t//new root. This allows the BinarySearchTree to stay a valid \r\n\t\t\t//BinarySearchTree\r\n\t\t\tKeyedItem replacementItem = findLeftMost(tree.getRightChild());\r\n\t\t\t\r\n\t\t\t//Delete the tree with that item so it can be moved to the new root\r\n\t\t\tBinarySearchTree replacementTree = deleteLeftMost(tree.getRightChild());\r\n\t\t\t\r\n\t\t\t//change the root to the new item\r\n\t\t\ttree.setRootItem(replacementItem);\r\n\t\t\t\r\n\t\t\t//Set the new roots right tree to the replacement tree\r\n\t\t\ttree.attachRightSubtree(replacementTree);\r\n\t\t\treturn tree;\r\n\t\t}\r\n\t}", "private void pruneTree(QuadNode node){\n int i;\n while(node.parent != null && node.quads[0] == null && node.quads[1] == null && node.quads[2] == null && node.quads[3] == null){\n i=0;\n if(node.x != node.parent.x){\n i++;\n }\n if(node.z != node.parent.z){\n i+=2;\n }\n node = node.parent;\n node.quads[i] = null;\n }\n }", "private void adjustRedParentNode(Node deficientNode, AtomicReference<Node> rootRef) {\n\t\tNode sibling = getSibling(deficientNode);\n if(deficientNode.parent.color == Color.RED && sibling.color == Color.BLACK && sibling.left.color == Color.BLACK\n && sibling.right.color == Color.BLACK) {\n \tsibling.color = Color.RED;\n \tdeficientNode.parent.color = Color.BLACK;\n return;\n } else {\n \tadjustRedChildBlackSibling(deficientNode, rootRef);\n }\n\t}", "void remap()\n\t\t{\n\t\t\tif(nextMap == null)\n\t\t\t\treturn;\n\t\t\tnextMap = newNodeMap(nextMap);\n\t\t\tfor(Node<T> node : nextMap.values())\n\t\t\t\tnode.remap();\n\t\t}", "private Node getReplacementKeyNode(Key key, Node node) {\n\t\tNode ret = node.getChild(node.getDataNumber(key));\r\n\t\t\r\n\t\twhile (!ret.isLeaf()) {\r\n\t\t\tret = ret.getChild(ret.getChildren().size() - 1);\r\n\t\t}\r\n\t\t\r\n\t\treturn ret;\r\n\t}", "public abstract Type treeCopyNoTransform();", "private BSTNode<E> successor(BSTNode<E> node) {\n\t\treturn null;\n\t}", "@SuppressWarnings(\"ReferenceEquality\") // cannot use equals() for check whether tree is the same\n private PersistentSortedMap<K, V> mapFromTree(@Var @Nullable Node<K, V> newRoot) {\n if (newRoot == root) {\n return this;\n } else if (newRoot == null) {\n return of();\n } else {\n // Root is always black.\n newRoot = newRoot.withColor(Node.BLACK);\n return new PathCopyingPersistentTreeMap<>(newRoot);\n }\n }", "private void updateOriginalNodesInMirror() {\n for (Node node : originalGraph.nodes()) {\n if (!mirrorGraph.has(node)) {\n mirrorGraph.add(node);\n }\n originalAttributesToMirror(node);\n }\n }", "private void reFixForDel(WAVLNode y) { // in a case of deletion of a node that doesnt exist in the tree, the method will fix the size all the way to the root\r\n\t y.sizen++;\r\n\t while(y.parent!=null) {\r\n\t\t y=y.parent;\r\n\t\t y.sizen++;\r\n\t }\r\n }", "@Test\n public void testPhylogeneticTreeParserNamednodesNoDistance() {\n // create the actual tree\n String tree = \"(A,B,(C,D)E)F;\";\n PhylogeneticTreeItem rootActual = PhylogeneticTreeParser.parse(tree);\n\n // create the expected Tree\n // root node\n PhylogeneticTreeItem rootExpected = new PhylogeneticTreeItem();\n rootExpected.setName(\"F\");\n // add 3 child nodes\n PhylogeneticTreeItem current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n current.setName(\"A\");\n current = new PhylogeneticTreeItem();\n current.setName(\"B\");\n current.setParent(rootExpected);\n current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n current.setName(\"E\");\n // add 2 child nodes to the third node\n PhylogeneticTreeItem current2 = new PhylogeneticTreeItem();\n current2.setParent(current);\n current2.setName(\"C\");\n current2 = new PhylogeneticTreeItem();\n current2.setParent(current);\n current2.setName(\"D\");\n\n // compare the trees\n assertEquals(\"both trees do not match\", rootExpected, rootActual);\n\n }", "@Override\npublic int compareTo(BinaryTreeNode arg0) {\n\treturn 0;\n}", "TrieNode root();", "private void singleRotationRL(BinaryNode node) {\n if (node == root) {\n root = node.right;\n root.parent = null;\n root.left = node;\n node.parent = node.right;\n node.right = null;\n } else {\n if (node.parent.right == node) {\n node.parent.right = node.right;\n } else {\n node.parent.left = node.right;\n }\n node.right.parent = node.parent;\n node.right.left = node;\n node.parent = node.right;\n node.right = null;\n }\n }", "private RBNode<T> removeMin(RBNode<T> node){\n //find the min node\n RBNode<T> parent = node;\n while(node!=null && node.getLeft()!=null){\n parent = node;\n node = node.getLeft();\n }\n //remove min node\n if(parent==node){\n return node;\n }\n\n parent.setLeft(node.getRight());\n setParent(node.getRight(),parent);\n\n //don't remove right pointer,it is used for fixed color balance\n //node.setRight(null);\n return node;\n }", "@Test\n public void remove_BST_1_CaseLeafLeft()\n {\n BinarySearchTree bst = new BinarySearchTree();\n No root = new No(6);\n No leaf = new No(2);\n \n bst.insert(null, root);\n //bst.printTree();\n \n bst.insert(root, new No(9));\n //bst.printTree();\n \n bst.insert(root, leaf);\n //bst.printTree();\n //System.err.println(); // Print[ERR] Devido a prioridade do buffer de impressao (out, err)\n \n assertEquals(leaf, bst.remove(leaf));\n assertEquals(new Integer(2), bst.size());\n //bst.printTree();\n }", "private static <K extends Comparable<? super K>, V> @Nullable Node<K, V> removeAndCopy0(\n K key, @Var Node<K, V> current) {\n\n @Var int comp = key.compareTo(current.getKey());\n\n if (comp < 0) {\n // key < current.data\n if (current.left == null) {\n // Target key is not in map.\n return current;\n }\n\n // Go down leftwards, keeping a red node.\n\n if (!Node.isRed(current.left) && !Node.isRed(current.left.left)) {\n // Push red to left if necessary.\n current = makeLeftRed(current);\n }\n\n // recursive descent\n Node<K, V> newLeft = removeAndCopy0(key, current.left);\n current = current.withLeftChild(newLeft);\n\n } else {\n // key >= current.data\n if ((comp > 0) && (current.right == null)) {\n // Target key is not in map.\n return current;\n }\n\n if (Node.isRed(current.left)) {\n // First chance to push red to right.\n current = rotateClockwise(current);\n\n // re-update comp\n comp = key.compareTo(current.getKey());\n assert comp >= 0;\n }\n\n if ((comp == 0) && (current.right == null)) {\n assert current.left == null;\n // We can delete the node easily, it's a leaf.\n return null;\n }\n\n if (!Node.isRed(current.right) && !Node.isRed(current.right.left)) {\n // Push red to right.\n current = makeRightRed(current);\n\n // re-update comp\n comp = key.compareTo(current.getKey());\n assert comp >= 0;\n }\n\n if (comp == 0) {\n // We have to delete current, but is has children.\n // We replace current with the smallest node in the right subtree (the \"successor\"),\n // and delete that (leaf) node there.\n\n @Var Node<K, V> successor = current.right;\n while (successor.left != null) {\n successor = successor.left;\n }\n\n // Delete the successor\n Node<K, V> newRight = removeMininumNodeInTree(current.right);\n // and replace current with it\n current =\n new Node<>(\n successor.getKey(),\n successor.getValue(),\n current.left,\n newRight,\n current.getColor());\n\n } else {\n // key > current.data\n // Go down rightwards.\n\n Node<K, V> newRight = removeAndCopy0(key, current.right);\n current = current.withRightChild(newRight);\n }\n }\n\n return restoreInvariants(current);\n }", "public TreeNode pruneTree(TreeNode root) {\n if (containsOne(root) == false) {\n return null;\n } else {\n return root;\n }\n }", "protected Node<T> removeFixupCase2(Node<T> u) {\n\t\tNode<T> w = u.parent;\n\t\tNode<T> v = w.right;\n\t\tpullBlack(w); // w.left\n\t\tflipLeft(w); // w is now red\n\t\tNode<T> q = w.right;\n\t\tif (q.colour == red) { // q-w is red-red\n\t\t\trotateLeft(w);\n\t\t\tflipRight(v);\n\t\t\tpushBlack(q);\n\t\t\tif (v.right.colour == red)\n\t\t\t\tflipLeft(v);\n\t\t\treturn q;\n\t\t} else {\n\t\t\treturn v;\n\t\t}\n\t}", "public abstract TreeNode copy();", "public T fjern(){\n Node temp = hode.neste;\n temp.neste.forrige = hode;\n hode.neste = temp.neste;\n elementer--;\n return temp.element;\n }", "public void optimize(){\n\n NfaState currState;\n HashMap<Integer, State> statesCloned = (HashMap)states.clone();\n\n\n boolean removed;\n\n for(Map.Entry<Integer, State> entry : statesCloned.entrySet()) {//for each state of the nfa\n\n do {\n removed=false;\n Integer id = entry.getKey();\n\n if (states.get(id) == null)//state already been removed\n continue;\n else\n currState = (NfaState) entry.getValue();\n\n HashMap<String, ArrayList<Integer>> startEdges = currState.getOut_edges();\n\n for (Map.Entry<String, ArrayList<Integer>> startEdge : startEdges.entrySet()) {//for each edge of the current state being optimezed\n\n ArrayList<Integer> transactions = new ArrayList(startEdge.getValue());\n\n\n for (Integer state2DegID : transactions) {// for each transaction the 2nd degree state\n NfaState stateDeg2 = (NfaState) states.get(state2DegID);\n\n if (stateDeg2.getOut_edges() == null)\n continue;\n\n\n\n ArrayList<Integer> edgesDeg2 = stateDeg2.getOut_edges().get(EPSILON);\n\n if (edgesDeg2 != null && edgesDeg2.size() == 1 && stateDeg2.getOut_edges().size() == 1) {//if the next state has only a epsilon transaction, we can remove this state\n NfaState successor = (NfaState) states.get(edgesDeg2.get(0));\n\n\n for (Map.Entry<String, ArrayList<Integer>> inEdgesDeg2 : stateDeg2.getIn_edges().entrySet()) {//for every in_edge of the state being removed, update the elements accordingly\n String key = inEdgesDeg2.getKey();\n\n if (inEdgesDeg2.getValue().size() > 0)\n removed = true;\n\n for (Integer stateBeingUpdatedId : inEdgesDeg2.getValue()) {//state to be updated\n NfaState stateBeingUpdated = (NfaState) states.get(stateBeingUpdatedId);\n //add new edge\n stateBeingUpdated.addEdge(key, successor);\n\n //remove out and in edge to intermediate\n stateBeingUpdated.getOut_edges().get(key).remove((Integer) stateDeg2.getId());\n }\n }\n\n //remove out_edges\n for (Map.Entry<String, ArrayList<Integer>> outEdgesDeg2 : stateDeg2.getOut_edges().entrySet()) {\n for (Integer sucId : outEdgesDeg2.getValue()){\n ((NfaState)states.get(sucId)).getIn_edges().get(outEdgesDeg2.getKey()).remove((Integer) stateDeg2.getId());\n }\n }\n //remove state\n states.remove(stateDeg2.getId());\n }\n }\n\n }\n\n }while (removed);\n }\n }", "private RBNode<T, E> uncleNode(RBNode<T, E> node) {\r\n\t\t// Check if the Node has a Grand Parent else, uncle dont exist\r\n\t\tif (grandPNode(node) != nillLeaf) {\r\n\t\t\t// Now there's a chance of an Uncle existing\r\n\t\t\tRBNode<T, E> g = grandPNode(node);\r\n\t\t\t// check if uncle is left or right\r\n\t\t\tif (checkLR(node) == -1) {\r\n\t\t\t\t// Must return right uncle\r\n\t\t\t\treturn g.rightChild;\r\n\t\t\t} else if (checkLR(node) == 1) {\r\n\t\t\t\t// must return left uncle\r\n\t\t\t\treturn g.leftChild;\r\n\t\t\t} else {\r\n\t\t\t\t// else it must be equal, it should never land here either way.\r\n\t\t\t\treturn nillLeaf;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// returns null if has node has no Grand Parent, then has no uncle.\r\n\t\treturn nillLeaf;\r\n\t}", "public static void setOldTree(RootedTree t) {\r\n\t\tsetOldNewickString(createNewickString(t)); // Added by Madhu, it is where I save the newick\r\n\t\t// string for the uploaded tree.\r\n\t\tSystem.out.println(\"OLD NODE:\" + getOldNewickString());\r\n\t\toldTree = t;\r\n\t}", "protected Node<T> removeFixupCase3(Node<T> u) {\n\t\tNode<T> w = u.parent;\n\t\tNode<T> v = w.left;\n\t\tpullBlack(w);\n\t\tflipRight(w); // w is now red\n\t\tNode<T> q = w.left;\n\t\tif (q.colour == red) { // q-w is red-red\n\t\t\trotateRight(w);\n\t\t\tflipLeft(v);\n\t\t\tpushBlack(q);\n\t\t\treturn q;\n\t\t} else {\n\t\t\tif (v.left.colour == red) {\n\t\t\t\tpushBlack(v); // both v's children are red\n\t\t\t\treturn v;\n\t\t\t} else { // ensure left-leaning\n\t\t\t\tflipLeft(v);\n\t\t\t\treturn w;\n\t\t\t}\n\t\t}\n\t}", "public Node decode(TreeNode root) {\n if (root == null) {\n return null;\n }\n return new Node(root.val, de(root.left));\n }", "void transplantNode(TreeNode nodeTodelete, TreeNode replacementNode, TreeNode nullNode) {\n assert nodeTodelete != nullNode;\n if (nodeTodelete.getParent() == nullNode) {\n // root Node\n this.root = replacementNode;\n } else if (nodeTodelete.getParent().getLeft() == nodeTodelete) {\n nodeTodelete.getParent().setLeft(replacementNode);\n } else {\n nodeTodelete.getParent().setRight(replacementNode);\n }\n\n if (replacementNode != nullNode) {\n replacementNode.setParent(nodeTodelete.getParent());\n }\n }" ]
[ "0.5674491", "0.5653049", "0.56218046", "0.55775404", "0.54726005", "0.5464795", "0.5400543", "0.532825", "0.5324603", "0.52687174", "0.52566075", "0.5251731", "0.52378607", "0.5205781", "0.5195405", "0.51917243", "0.5173908", "0.5163372", "0.5159947", "0.51513463", "0.51151776", "0.50799364", "0.50753814", "0.5075253", "0.5066932", "0.50397354", "0.5025502", "0.50151944", "0.5013438", "0.5010567", "0.5009398", "0.50047183", "0.5003949", "0.5001297", "0.50000644", "0.49926013", "0.49896458", "0.49745718", "0.49546185", "0.49526435", "0.49443376", "0.49406788", "0.49387324", "0.492919", "0.4916045", "0.4911919", "0.490542", "0.4903198", "0.48901317", "0.4889088", "0.488831", "0.48768586", "0.48763627", "0.48620802", "0.4861631", "0.48587036", "0.48544326", "0.48497137", "0.48404753", "0.4839602", "0.48352033", "0.48303798", "0.48282912", "0.48225707", "0.48179033", "0.4816015", "0.4814899", "0.48105493", "0.48068962", "0.48046088", "0.48043102", "0.47967193", "0.47934076", "0.47857663", "0.47838762", "0.47792804", "0.47790125", "0.47785884", "0.47762886", "0.47710377", "0.47688344", "0.47678685", "0.47602126", "0.47577286", "0.47547844", "0.47526628", "0.4752071", "0.4749097", "0.47484592", "0.47466213", "0.474552", "0.47405958", "0.47382843", "0.4738133", "0.47373706", "0.473348", "0.4733248", "0.473024", "0.47266546", "0.47247165" ]
0.56235236
2
sets new left child of this node
public void setLeftChild(RegressionTreeNode leftChild) { this.leftChild = leftChild; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setLeftChild(TreeNode left){\n\t\tleftChild = left;\n\t}", "public void setLeftChild(Node<T> leftChild) {\n this.leftChild = leftChild;\n }", "public void setLeftChild(BinaryNode leftChild) {\n\t\tthis.leftChild = leftChild;\n\t}", "public void setLeftChild(TreeNode leftChild) {\n this.leftChild = leftChild;\n }", "public void setLeftChild(BSTNode left) {\n\t\tthis.leftChild = left;\n\t}", "@Override\n\tpublic void setLeftChild(ASTNode node) {\n\t\tthis.leftChild = node;\n\n\t}", "@Override\n\tpublic void setLeftChild(WhereNode leftChild) {\n\n\t}", "public void setLeft (Node l) {\r\n\t\tleft = l;\r\n\t}", "public void setLeft(BinaryTree<E> newLeft)\r\n\t// post: sets left subtree to newLeft\r\n\t// re-parents newLeft if not null\r\n\t{\r\n\t\tif (isEmpty()) return;\r\n\t\tif (left != null && left.parent() == this) left.setParent(null);\r\n\t\tleft = newLeft;\r\n\t\tleft.setParent(this);\r\n\t}", "public void setLeft(Node left) {\n this.left = left;\n }", "public void setLeft(TreeNode left) {\n\t\tthis.left = left;\n\t}", "public void setLeft(Node<T> left) {\n this.left = left;\n if (left != null)\n left.setParent(this);\n }", "@Override\r\n\tpublic void setLeftChild(BinaryNodeInterface<E> leftChild) {\n\t\tthis.left=(BinaryNode<E>) leftChild;\r\n\t}", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public boolean SetLeft(Tree ln){\n\tleft = ln ;\n\treturn true ;\n }", "public void setLeft(Node<T> val) {\r\n\r\n\t\tif (getLeft() != null)\r\n\t\t\tgetLeft().setParent(null);\r\n\r\n\t\tif (val != null) {\r\n\t\t\tval.removeParent();\r\n\t\t\tval.setParent(this);\r\n\t\t}\r\n\r\n\t\tthis.left = val;\r\n\t}", "public void setLeftChild(ObjectTreeNode parent, ObjectTreeNode r) {\n if (parent == null || parent.getLeft() != null) {\n System.out.println(\"Runtime Error: setLeftChild()\");\n System.exit(1);\n }\n parent.setLeft(r);\n }", "public void setLeft(BinNode<E> l)\n {\n left = l;\n }", "void setLeft(T data) {\n\t\tthis.left = new TreeNode<T>(data, null, null, null, this);\n\t}", "void setLeft(TreeNode<T> left);", "public void setLeft(final BinaryTreeNode<E> left) {\n this.left = left;\n }", "public Node getLeftChild() {\r\n \treturn getChild(true);\r\n }", "public void setLeft(Fork left) {\n\t\tthis.left = left;\n\t}", "public void setLeft(AVLNode<E> left) {\r\n\t\tthis.left = left;\r\n\t}", "public void setLeft(IAVLNode node);", "public void setLeft(IAVLNode node);" ]
[ "0.83084154", "0.82234514", "0.81852645", "0.8169852", "0.80874306", "0.80418766", "0.80403256", "0.7797494", "0.77971673", "0.7784631", "0.7782275", "0.7631145", "0.76292413", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75808954", "0.75602674", "0.7517464", "0.7501319", "0.7419447", "0.73934746", "0.7387124", "0.7316571", "0.7260447", "0.72261435", "0.71879077", "0.71879077" ]
0.78303224
7
sets new right child of this node
public void setRightChild(RegressionTreeNode rightChild) { this.rightChild = rightChild; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void setRightChild(WhereNode rightChild) {\n\n\t}", "public void setRightChild(TreeNode right){\n\t\trightChild = right;\n\t}", "@Override\n\tpublic void setRightChild(ASTNode node) {\n\t\tthis.rightChild = node;\n\n\t}", "public void setRightChild(Node<T> rightChild) {\n this.rightChild = rightChild;\n }", "public void setRightChild(BSTNode right) {\n\t\tthis.rightChild = right;\n\t}", "public void setRightChild(TreeNode rightChild) {\n this.rightChild = rightChild;\n }", "public void setRightChild(BinaryNode rightChild) {\n\t\tthis.rightChild = rightChild;\n\t}", "public void setRightChild(ObjectTreeNode parent, ObjectTreeNode r){\n if (parent == null || parent.getRight() != null) {\n System.out.println(\"Runtime Error: setRightChild()\");\n System.exit(1);\n }\n parent.setRight(r);\n }", "public void setRight(BTNode myNode){\n rightleaf = myNode;\r\n }", "private boolean setChild(TreeNode parent, TreeNode newChild, boolean isRightChild) {\n\t\tif(isRightChild) {\n\t\t\tparent.setRightChild(newChild);\n\t\t\tlength--;\n\t\t\treturn true;\n\t\t} else {\n\t\t\tparent.setLeftChild(newChild);\n\t\t\tlength--; \n\t\t\treturn true;\n\t\t}\n\t}", "@Override\r\n\tpublic void setRightChild(BinaryNodeInterface<E> rightChild) {\n\t\tthis.right=(BinaryNode<E>) rightChild;\r\n\t}", "void setRight(TreeNode<T> right);", "public void setRight(Node<T> val) {\r\n\r\n\t\tif (getRight() != null) {\r\n\t\t\tgetRight().setParent(null);\r\n\t\t}\r\n\r\n\t\tif (val != null) {\r\n\t\t\tval.removeParent();\r\n\t\t\tval.setParent(this);\r\n\t\t}\r\n\r\n\t\tthis.right = val;\r\n\t}", "public void setRight(Node<T> right) {\n this.right = right;\n if (right != null)\n right.setParent(this);\n }", "@Override\n\tpublic void setLeftChild(WhereNode leftChild) {\n\n\t}", "public void setRight(TreeNode right) {\n\t\tthis.right = right;\n\t}", "public void setLeftChild(TreeNode left){\n\t\tleftChild = left;\n\t}", "public void setRight(Node right) {\n this.right = right;\n }", "public void setLeftChild(Node<T> leftChild) {\n this.leftChild = leftChild;\n }", "public void setChild(boolean isLeft, Node value) {\r\n \t// System.out.println(this + \", \" + value + \", \" + leftChild + \", \" + rightChild);\r\n if (isLeft) {\r\n leftChild = value;\r\n if (value != null) leftChild.parent = this;\r\n }\r\n else {\r\n rightChild = value;\r\n if (value != null) rightChild.parent = this;\r\n }\r\n }", "public void setRight (Node r) {\r\n\t\tright = r;\r\n\t}", "public void setRight(Fork right) {\n\t\tthis.right = right;\n\t}", "public void setLeftChild(TreeNode leftChild) {\n this.leftChild = leftChild;\n }", "public void setLeftChild(BinaryNode leftChild) {\n\t\tthis.leftChild = leftChild;\n\t}", "void setRight(T data) {\n\t\tthis.right = new TreeNode<T>(data, null, null, null, this);\n\t}", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }", "public boolean SetRight(Tree rn){\n\tright = rn ;\n\treturn true ;\n }" ]
[ "0.7792961", "0.75892824", "0.74713135", "0.7411916", "0.73788905", "0.72925246", "0.7237142", "0.71354383", "0.7057225", "0.6952203", "0.6930766", "0.6868085", "0.6835947", "0.6824757", "0.6779103", "0.6696141", "0.6665561", "0.6614685", "0.65978456", "0.6551169", "0.6545011", "0.65176207", "0.6514332", "0.6496882", "0.64741033", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64728063", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425", "0.64718425" ]
0.70477283
9
Inflate the menu; this adds items to the action bar if it is present.
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n \tMenuInflater inflater = getMenuInflater();\n \tinflater.inflate(R.menu.main_activity_actions, menu);\n \treturn super.onCreateOptionsMenu(menu);\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n super.onCreateOptionsMenu(menu, inflater);\n inflater.inflate(R.menu.actions, menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n \tgetMenuInflater().inflate(R.menu.actions, menu);\n \treturn super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.actions_bar, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\n\t\tinflater.inflate(R.menu.main_actions, menu);\n\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\r\n\t\tinflater.inflate(R.menu.action_bar_menu, menu);\r\n\t\tmMenu = menu;\r\n\t\treturn super.onCreateOptionsMenu(menu);\r\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.act_bar_menu, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\r\n inflater.inflate(R.menu.main_actions, menu);\r\n\t\treturn true;\r\n //return super.onCreateOptionsMenu(menu);\r\n\t}", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t MenuInflater inflater = getMenuInflater();\r\n\t inflater.inflate(R.menu.action_bar_all, menu);\r\n\t return super.onCreateOptionsMenu(menu);\r\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(android.view.Menu menu) {\n\t\t super.onCreateOptionsMenu(menu);\n\t\tMenuInflater muu= getMenuInflater();\n\t\tmuu.inflate(R.menu.cool_menu, menu);\n\t\treturn true;\n\t\t\n\t\t\n\t}", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.adventure_archive, menu);\r\n\t\treturn true;\r\n\t}", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.archive_menu, menu);\r\n\t\treturn true;\r\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.main_activity_actions, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.main_activity_actions, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.main_activity_actions, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n \tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n \t\tinflater.inflate(R.menu.main, menu);\n \t\tsuper.onCreateOptionsMenu(menu, inflater);\n \t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t MenuInflater inflater = getMenuInflater();\n\t inflater.inflate(R.menu.action_menu, menu);\n\t return super.onCreateOptionsMenu(menu);\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tsuper.onCreateOptionsMenu(menu);\n\t\tMenuInflater bow=getMenuInflater();\n\t\tbow.inflate(R.menu.menu, menu);\n\t\treturn true;\n\t\t}", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n inflater.inflate(R.menu.action_menu, menu);\n super.onCreateOptionsMenu(menu, inflater);\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\n\t\tinflater.inflate(R.menu.main, menu);\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\n\t\tinflater.inflate(R.menu.main, menu);\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\n\t\tinflater.inflate(R.menu.main, menu);\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\n\t\tinflater.inflate(R.menu.main, menu);\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\t\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\t\t\n\t\t/* Inflate the menu; this adds items to the action bar if it is present */\n\t\tgetMenuInflater().inflate(R.menu.act_main, menu);\t\t\n\t\treturn true;\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflate = getMenuInflater();\n inflate.inflate(R.menu.menu, ApplicationData.amvMenu.getMenu());\n return true;\n }", "@Override\n\t\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\t\tgetMenuInflater().inflate(R.menu.menu, menu);\n\t\t\treturn true; \n\t\t\t\t\t\n\t\t}", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t\tinflater.inflate(R.menu.main, menu);\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu, menu);//Menu Resource, Menu\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu, menu);//Menu Resource, Menu\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) \n {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.menu_bar, menu);\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.menu_item, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t\tinflater.inflate(R.menu.menu, menu);\n\t\tsuper.onCreateOptionsMenu(menu, inflater);\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t MenuInflater inflater = getMenuInflater();\n\t inflater.inflate(R.menu.menu, menu);\n\t return super.onCreateOptionsMenu(menu);\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\n\t inflater.inflate(R.menu.menu, menu);\n\t \n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t\tsuper.onCreateOptionsMenu(menu, inflater);\n\t\t//menu.clear();\n\t\tinflater.inflate(R.menu.soon_to_be, menu);\n\t\t//getActivity().getActionBar().show();\n\t\t//getActivity().getActionBar().setBackgroundDrawable(\n\t\t\t\t//new ColorDrawable(Color.rgb(223, 160, 23)));\n\t\t//return true;\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n this.getMenuInflater().inflate(R.menu.main, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n super.onCreateOptionsMenu(menu, inflater);\n inflater.inflate(R.menu.main, menu);\n }", "@Override\n\tpublic void onCreateOptionsMenu( Menu menu, MenuInflater inflater )\n\t{\n\t\tsuper.onCreateOptionsMenu( menu, inflater );\n\t}", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.main, menu);\r\n\t\treturn super.onCreateOptionsMenu(menu);\r\n\t}", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\r\n \t// We must call through to the base implementation.\r\n \tsuper.onCreateOptionsMenu(menu);\r\n \t\r\n MenuInflater inflater = getMenuInflater();\r\n inflater.inflate(R.menu.main_menu, menu);\r\n\r\n return true;\r\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main, menu);//Menu Resource, Menu\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main, menu);//Menu Resource, Menu\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater= getMenuInflater();\n inflater.inflate(R.menu.menu_main, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n super.onCreateOptionsMenu(menu, inflater);\n inflater.inflate(R.menu.inter_main, menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.action, menu);\n\t\treturn true;\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.menu, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.menu, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu (Menu menu){\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.menu_main, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.custom_action_bar, menu);\n\t\treturn true;\n\t}", "public void initMenubar() {\n\t\tremoveAll();\n\n\t\t// \"File\"\n\t\tfileMenu = new FileMenuD(app);\n\t\tadd(fileMenu);\n\n\t\t// \"Edit\"\n\t\teditMenu = new EditMenuD(app);\n\t\tadd(editMenu);\n\n\t\t// \"View\"\n\t\t// #3711 viewMenu = app.isApplet()? new ViewMenu(app, layout) : new\n\t\t// ViewMenuApplicationD(app, layout);\n\t\tviewMenu = new ViewMenuApplicationD(app, layout);\n\t\tadd(viewMenu);\n\n\t\t// \"Perspectives\"\n\t\t// if(!app.isApplet()) {\n\t\t// perspectivesMenu = new PerspectivesMenu(app, layout);\n\t\t// add(perspectivesMenu);\n\t\t// }\n\n\t\t// \"Options\"\n\t\toptionsMenu = new OptionsMenuD(app);\n\t\tadd(optionsMenu);\n\n\t\t// \"Tools\"\n\t\ttoolsMenu = new ToolsMenuD(app);\n\t\tadd(toolsMenu);\n\n\t\t// \"Window\"\n\t\twindowMenu = new WindowMenuD(app);\n\n\t\tadd(windowMenu);\n\n\t\t// \"Help\"\n\t\thelpMenu = new HelpMenuD(app);\n\t\tadd(helpMenu);\n\n\t\t// support for right-to-left languages\n\t\tapp.setComponentOrientation(this);\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.main, menu);\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tsuper.onCreateOptionsMenu(menu);\n\t\tMenuInflater blowUp=getMenuInflater();\n\t\tblowUp.inflate(R.menu.welcome_menu, menu);\n\t\treturn true;\n\t}", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.listing, menu);\r\n\t\treturn true;\r\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.item, menu);\n return true;\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.resource, menu);\n\t\treturn true;\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater= getMenuInflater();\n inflater.inflate(R.menu.menu,menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.main, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.main, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.home_action_bar, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.template, menu);\n\t\treturn true;\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n Log.d(\"onCreateOptionsMenu\", \"create menu\");\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.socket_activity_actions, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main_menu, menu);//Menu Resource, Menu\n\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.actionbar, menu);\n return true;\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(toolbar_res, menu);\n updateMenuItemsVisibility(menu);\n return true;\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\t// \n\t\tMenuInflater mi = getMenuInflater();\n\t\tmi.inflate(R.menu.thumb_actv_menu, menu);\n\t\t\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t\tsuper.onCreateOptionsMenu(menu, inflater);\n\t}", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t\tsuper.onCreateOptionsMenu(menu, inflater);\n\t}", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t\tsuper.onCreateOptionsMenu(menu, inflater);\n\t}", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n super.onCreateOptionsMenu(menu, inflater);\n }", "@Override\n\t\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\t\tgetMenuInflater().inflate(R.menu.main, menu);\n\t\t\treturn true;\n\t\t}", "@Override\n\t\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\t\tgetMenuInflater().inflate(R.menu.main, menu);\n\t\t\treturn true;\n\t\t}", "@Override\n\t\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\t\tgetMenuInflater().inflate(R.menu.main, menu);\n\t\t\treturn true;\n\t\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.swag_list_activity_menu, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n super.onCreateOptionsMenu(menu, inflater);\n\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.main_menu, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(android.view.Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.main, menu);\n\n\t\treturn true;\n\t}", "@Override\n\t\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\t\tgetMenuInflater().inflate(R.menu.main, menu);\n\t\t\treturn true;\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.jarvi, menu);\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}", "public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {\n menuInflater.inflate(R.menu.main, menu);\n\n }", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.add__listing, menu);\r\n\t\treturn true;\r\n\t}", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.actmain, menu);\r\n return true;\r\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.buat_menu, menu);\n\t\treturn true;\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.layout.menu, menu);\n\t\treturn true;\n\t}", "@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n\n\t\n\t\n\tgetMenuInflater().inflate(R.menu.main, menu);\n\t\n\treturn super.onCreateOptionsMenu(menu);\n}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.ichat, menu);\n\t\treturn true;\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu, menu);\n return super.onCreateOptionsMenu(menu);\n }", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater)\n\t{\n\t\tsuper.onCreateOptionsMenu(menu, inflater);\n\t\tinflater.inflate(R.menu.expenses_menu, menu);\n\t}", "@Override\n \tpublic boolean onCreateOptionsMenu(Menu menu) {\n \t\tgetMenuInflater().inflate(R.menu.main, menu);\n \t\treturn true;\n \t}", "@Override\n \tpublic boolean onCreateOptionsMenu(Menu menu) {\n \t\tgetMenuInflater().inflate(R.menu.main, menu);\n \t\treturn true;\n \t}", "@Override\n \tpublic boolean onCreateOptionsMenu(Menu menu) {\n \t\tgetMenuInflater().inflate(R.menu.main, menu);\n \t\treturn true;\n \t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.action_bar, menu);\n return true;\n }", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tsuper.onCreateOptionsMenu(menu);\n\t\tMenuInflater blowUp = getMenuInflater();\n\t\tblowUp.inflate(R.menu.status, menu);\n\t\treturn true;\n\t}", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.menu, menu);\r\n\t\treturn true;\r\n\t}", "@Override\n\tpublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n\t}", "@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tMenuInflater inflater = getMenuInflater();\n\t\tinflater.inflate(R.menu.main, menu);\n\t\treturn true;\n\t}", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.ui_main, menu);\r\n\t\treturn true;\r\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main_activity_actions, menu);\n return true;\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n inflater.inflate(R.menu.menu_main, menu);\n super.onCreateOptionsMenu(menu, inflater);\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n inflater.inflate(R.menu.menu_main, menu);\n super.onCreateOptionsMenu(menu, inflater);\n }" ]
[ "0.7246102", "0.7201358", "0.7194834", "0.7176498", "0.71066517", "0.7039537", "0.7037961", "0.70112145", "0.70094734", "0.69807225", "0.6944953", "0.69389373", "0.6933199", "0.6916928", "0.6916928", "0.6891486", "0.68831646", "0.68754137", "0.68745375", "0.68621665", "0.68621665", "0.68621665", "0.68621665", "0.68515885", "0.68467957", "0.68194443", "0.6817494", "0.6813087", "0.6813087", "0.6812847", "0.6805774", "0.6801204", "0.6797914", "0.6791314", "0.6789091", "0.67883503", "0.6783642", "0.6759701", "0.6757412", "0.67478645", "0.6744127", "0.6744127", "0.67411774", "0.6740183", "0.6726017", "0.6723245", "0.67226785", "0.67226785", "0.67208904", "0.67113477", "0.67079866", "0.6704564", "0.6699229", "0.66989094", "0.6696622", "0.66952467", "0.66865396", "0.6683476", "0.6683476", "0.6682188", "0.6681209", "0.6678941", "0.66772443", "0.6667702", "0.66673946", "0.666246", "0.6657578", "0.6657578", "0.6657578", "0.6656586", "0.66544783", "0.66544783", "0.66544783", "0.66524047", "0.6651954", "0.6650132", "0.66487855", "0.6647077", "0.66467404", "0.6646615", "0.66464466", "0.66449624", "0.6644209", "0.6643461", "0.6643005", "0.66421187", "0.6638628", "0.6634786", "0.6633529", "0.6632049", "0.6632049", "0.6632049", "0.66315657", "0.6628954", "0.66281766", "0.6627182", "0.6626297", "0.6624309", "0.6619582", "0.6618876", "0.6618876" ]
0.0
-1
Handle action bar item clicks here. The action bar will automatically handle clicks on the Home/Up button, so long as you specify a parent activity in AndroidManifest.xml.
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean onOptionsItemSelected(MenuItem item) { Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n\n //\n // HANDLE BACK BUTTON\n //\n int id = item.getItemId();\n if (id == android.R.id.home) {\n // Back button clicked\n this.finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n // app icon in action bar clicked; goto parent activity.\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n // Respond to the action bar's Up/Home button\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n switch (id) {\r\n case android.R.id.home:\r\n // app icon in action bar clicked; go home\r\n this.finish();\r\n return true;\r\n default:\r\n return super.onOptionsItemSelected(item);\r\n }\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n // app icon in action bar clicked; go home\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n Log.e(\"clik\", \"action bar clicked\");\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n\t public boolean onOptionsItemSelected(MenuItem item) {\n\t int id = item.getItemId();\n\t \n\t\t\tif (id == android.R.id.home) {\n\t\t\t\t// Respond to the action bar's Up/Home button\n\t\t\t\t// NavUtils.navigateUpFromSameTask(this);\n\t\t\t\tonBackPressed();\n\t\t\t\treturn true;\n\t\t\t}\n\t \n\t \n\t return super.onOptionsItemSelected(item);\n\t }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\r\n switch (item.getItemId()) {\r\n // Respond to the action bar's Up/Home button\r\n case android.R.id.home:\r\n finish();\r\n return true;\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n // Respond to the action bar's Up/Home button\n case android.R.id.home:\n finish();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n\n switch (item.getItemId()) {\n case android.R.id.home:\n\n // app icon in action bar clicked; goto parent activity.\n this.finish();\n return true;\n default:\n\n return super.onOptionsItemSelected(item);\n\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n\n switch (item.getItemId()) {\n case android.R.id.home:\n\n // app icon in action bar clicked; goto parent activity.\n this.finish();\n return true;\n default:\n\n return super.onOptionsItemSelected(item);\n\n }\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tonBackPressed();\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn super.onOptionsItemSelected(item);\n\t\t}\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Handle presses on the action bar items\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n case R.id.action_clear:\n return true;\n case R.id.action_done:\n\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n switch (id) {\n case android.R.id.home:\n onActionHomePressed();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case android.R.id.home:\n onBackPressed();\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n switch (id) {\n case android.R.id.home:\n onBackPressed();\n break;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n switch (item.getItemId())\n {\n case android.R.id.home :\n super.onBackPressed();\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId ()) {\n case android.R.id.home:\n onBackPressed ();\n return true;\n\n default:\n break;\n }\n return super.onOptionsItemSelected ( item );\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t switch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\t// app icon in action bar clicked; go home \n\t\t\tIntent intent = new Intent(this, Kelutral.class); \n\t\t\tintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); \n\t\t\tstartActivity(intent); \n\t\t\treturn true;\t\t\n\t case R.id.Search:\n\t \treturn onSearchRequested();\n\t\tcase R.id.AppInfo:\n\t\t\t// Place holder menu item\n\t\t\tIntent newIntent = new Intent(Intent.ACTION_VIEW,\n\t\t\t\t\tUri.parse(\"http://forum.learnnavi.org/mobile-apps/\"));\n\t\t\tstartActivity(newIntent);\n\t\t\treturn true;\n\t\tcase R.id.Preferences:\n\t\t\tnewIntent = new Intent(getBaseContext(), Preferences.class);\n\t\t\tstartActivity(newIntent);\n\t\t\treturn true;\t\n\t }\n\t return false;\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n\n case android.R.id.home:\n onBackPressed();\n return true;\n\n }\n return super.onOptionsItemSelected(item);\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n // Intent homeIntent = new Intent(this, MainActivity.class);\n // homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n // startActivity(homeIntent);\n finish();\n return true;\n default:\n return (super.onOptionsItemSelected(item));\n }\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // setResult and close the activity when Action Bar Up Button clicked.\n if (item.getItemId() == android.R.id.home) {\n setResult(RESULT_CANCELED);\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n // This ID represents the Home or Up button. In the case of this\n // activity, the Up button is shown. Use NavUtils to allow users\n // to navigate up one level in the application structure. For\n // more details, see the Navigation pattern on Android Design:\n //\n // http://developer.android.com/design/patterns/navigation.html#up-vs-back\n //\n \tgetActionBar().setDisplayHomeAsUpEnabled(false);\n \tgetFragmentManager().popBackStack();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n switch (item.getItemId()) {\n case android.R.id.home:\n super.onBackPressed();\n return true;\n\n default:\n // If we got here, the user's action was not recognized.\n // Invoke the superclass to handle it.\n return super.onOptionsItemSelected(item);\n\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if(id == android.R.id.home){\n onBackPressed();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n\n }\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\r\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tif(item.getItemId()==android.R.id.home)\r\n\t\t{\r\n\t\t\tgetActivity().onBackPressed();\r\n\t\t}\r\n\t\treturn super.onOptionsItemSelected(item);\r\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if(item.getItemId()==android.R.id.home){\n super.onBackPressed();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case android.R.id.home:\n onBackPressed();\n return false;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n //Back arrow\n case android.R.id.home:\n onBackPressed();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n // android.R.id.home是Android内置home按钮的id\n finish();\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n super.onBackPressed();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n this.onBackPressed();\n return false;\n }\n return false;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n int id = item.getItemId();\n\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\r\n switch (item.getItemId()) {\r\n\r\n case android.R.id.home:\r\n /*Intent i= new Intent(getApplication(), MainActivity.class);\r\n i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(i);*/\r\n onBackPressed();\r\n finish();\r\n return true;\r\n default:\r\n return super.onOptionsItemSelected(item);\r\n }\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id){\n case android.R.id.home:\n this.finish();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Pass the event to ActionBarDrawerToggle, if it returns\n // true, then it has handled the app icon touch event\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n\n // Handle your other action bar items...\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n // Respond to the action bar's Up/Home button\n case android.R.id.home:\n NavUtils.navigateUpFromSameTask(getActivity());\n return true;\n case R.id.action_settings:\n Intent i = new Intent(getActivity(), SettingsActivity.class);\n startActivity(i);\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n //Fixes the Up Button\n if(id == android.R.id.home) {\n BuildRoute.this.finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()){\n case android.R.id.home:\n onBackPressed();\n break;\n }\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n\n if (id == android.R.id.home) {\n NavUtils.navigateUpFromSameTask(this);\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\r\n case android.R.id.home:\r\n onBackPressed();\r\n break;\r\n }\r\n return true;\r\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tif (item.getItemId() == android.R.id.home) {\n\t\t\tfinish();\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n onBackPressed();\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n if ( id == android.R.id.home ) {\r\n finish();\r\n return true;\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.home) {\r\n NavUtils.navigateUpFromSameTask(this);\r\n return true;\r\n }\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.action_about) {\r\n AboutDialog();\r\n return true;\r\n }\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.action_exit) {\r\n finish();\r\n return true;\r\n }\r\n\r\n\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n\n this.finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n\n this.finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n//noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n// finish the activity\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item)\n {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if( id == android.R.id.home ) // Back button of the actionbar\n {\n finish();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n\t\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\t\tswitch (item.getItemId()) {\r\n\t\t\tcase android.R.id.home:\r\n\t\t\t\tfinish();\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\treturn super.onOptionsItemSelected(item);\r\n\t\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n\n this.finish();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (item.getItemId() == android.R.id.home) {\n onBackPressed();\n return true;\n }\n return false;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n\n if(id == android.R.id.home){\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n if (item.getItemId() == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\r\n\t\tcase android.R.id.home:\r\n\t\t\tsetResult(RESULT_OK, getIntent());\r\n\t\t\tfinish();\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n finish();\n return true;\n default:\n // If we got here, the user's action was not recognized.\n // Invoke the superclass to handle it.\n return super.onOptionsItemSelected(item);\n\n }\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tfinish();\n\t\t\tbreak;\n\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n\n case android.R.id.home:\n this.finish();\n return true;\n }\n return true;\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tfinish();\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tint id = item.getItemId();\n\t\tif (id == android.R.id.home) {\n\t\t\tfinish();\n\t\t\treturn true;\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n if (id == android.R.id.home) {\r\n finish();\r\n return true;\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n //NavUtils.navigateUpFromSameTask(this);\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n // todo: goto back activity from here\n finish();\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\r\n // Handle item selection\r\n switch (item.getItemId()) {\r\n case android.R.id.home:\r\n onBackPressed();\r\n return true;\r\n\r\n case me.cchiang.lookforthings.R.id.action_sample:\r\n// Snackbar.make(parent_view, item.getTitle() + \" Clicked \", Snackbar.LENGTH_SHORT).show();\r\n return true;\r\n default:\r\n return super.onOptionsItemSelected(item);\r\n }\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n finish();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n\n\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tonBackPressed();\n\t\t\treturn true;\n\t\tcase R.id.scan_menu:\n\t\t\tonScan();\n\t\t\tbreak;\n\t\tcase R.id.opt_about:\n\t\t\t//onAbout();\n\t\t\tbreak;\n\t\tcase R.id.opt_exit:\n\t\t\tfinish();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn super.onOptionsItemSelected(item);\n\t\t}\n\t\treturn true;\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n super.onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case android.R.id.home:\n this.finish();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(@NonNull MenuItem item) {\n if (item.getItemId() == android.R.id.home) {\n onBackPressed();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n switch (id) {\n case android.R.id.home:\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n\n case android.R.id.home:\n finish();\n return true;\n\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if(id==android.R.id.home){\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\r\n\t switch (item.getItemId()) {\r\n\t \t// back to previous page\r\n\t case android.R.id.home:\r\n\t finish();\r\n\t return true;\r\n\t }\r\n\t return super.onOptionsItemSelected(item);\r\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == android.R.id.home) {\r\n // finish the activity\r\n onBackPressed();\r\n return true;\r\n }\r\n\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == android.R.id.home) {\r\n // finish the activity\r\n onBackPressed();\r\n return true;\r\n }\r\n\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId())\n {\n case android.R.id.home:\n this.finish();\n return (true);\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id){\n case R.id.home:{\n NavUtils.navigateUpFromSameTask(this);\n return true;\n }\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n switch(item.getItemId())\n {\n case android.R.id.home:\n super.onBackPressed();\n break;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tfinish();\n\t\t\treturn true;\n\n\t\tdefault:\n\t\t\treturn super.onOptionsItemSelected(item);\n\t\t}\n\t}", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n\r\n int id = item.getItemId();\r\n if(id==android.R.id.home){\r\n finish();\r\n return true;\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }" ]
[ "0.79041183", "0.7805934", "0.77659106", "0.7727251", "0.7631684", "0.7621701", "0.75839096", "0.75300384", "0.74873656", "0.7458051", "0.7458051", "0.7438486", "0.742157", "0.7403794", "0.7391802", "0.73870087", "0.7379108", "0.7370295", "0.7362194", "0.7355759", "0.73454577", "0.734109", "0.73295504", "0.7327726", "0.73259085", "0.73188347", "0.731648", "0.73134047", "0.7303978", "0.7303978", "0.7301588", "0.7298084", "0.72932935", "0.7286338", "0.7283324", "0.72808945", "0.72785115", "0.72597474", "0.72597474", "0.72597474", "0.725962", "0.7259136", "0.7249966", "0.7224023", "0.721937", "0.7216621", "0.72045326", "0.7200649", "0.71991026", "0.71923256", "0.71851367", "0.7176769", "0.7168457", "0.71675026", "0.7153402", "0.71533287", "0.71352696", "0.71350807", "0.71350807", "0.7129153", "0.7128639", "0.7124181", "0.7123387", "0.7122983", "0.71220255", "0.711715", "0.711715", "0.711715", "0.711715", "0.7117043", "0.71169263", "0.7116624", "0.71149373", "0.71123946", "0.7109806", "0.7108778", "0.710536", "0.7098968", "0.70981944", "0.7095771", "0.7093572", "0.7093572", "0.70862055", "0.7082207", "0.70808214", "0.7080366", "0.7073644", "0.7068183", "0.706161", "0.7060019", "0.70598614", "0.7051272", "0.70374316", "0.70374316", "0.7035865", "0.70352185", "0.70352185", "0.7031749", "0.703084", "0.7029517", "0.7018633" ]
0.0
-1
index of the resource to get from resList
public MummyThread(String name, int resId) { this.name = name; this.resId = resId; this.shutdown = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected static int findResourceInList(List resources, String id)\n\t{\n\t\tfor (int i = 0; i < resources.size(); i++)\n\t\t{\n\t\t\t// if this is the one, return this index\n\t\t\tif (((BrowseItem) (resources.get(i))).getId().equals(id)) return i;\n\t\t}\n\n\t\t// not found\n\t\treturn -1;\n\n\t}", "public int findNext(Resource resource);", "public int getIndex(){\r\n \treturn index;\r\n }", "int getItem(int index);", "private int getIndex() {\n\t\treturn this.index;\r\n\t}", "int getIndex(){\r\n\t\treturn index;\r\n\t}", "public int getRessource(Ressource r){\n return this.ressource.get(r);\n }", "int getIndex() {\n\t\treturn index;\n\t}", "public int getIndex(){\n return index;\n }", "public int getIndex(){\n return index;\n }", "public int getIndex() { return this.index; }", "public int getIndex(){\n\t\treturn index;\n\t}", "public int getIndex(){\n\t\treturn index;\n\t}", "public int getIndex(){\n\t\treturn index;\n\t}", "public int getIndex() {\r\n return _index;\r\n }", "public int getIndex() {\r\n return _index;\r\n }", "public int getIndex();", "public int getIndex();", "public int getIndex();", "int index(){\n\n\t\t\n\t\tif (cursor == null) \n\t\t{\n\t\t\treturn -1;\n\t\t}\n\t\treturn index;\n\t}", "public int getIndex() {\r\n \t\t\treturn index;\r\n \t\t}", "public int getIndex()\n {\n return index;\n }", "int getItems(int index);", "public int getIndex() {\n \t\treturn index;\n \t}", "@Override\r\n\tpublic int getIndex() {\n\t\treturn index;\r\n\t}", "public int getIndex() {\n return index;\n }", "int getSrcId(int index);", "public int getIndex()\n {\n return getInt(\"Index\");\n }", "public int getIndex()\n {\n return m_index;\n }", "public final int getIndex(){\n return index_;\n }", "public java.lang.String getResources(int index) {\n return resources_.get(index);\n }", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getIndex();", "int getListSnId(int index);", "public int getIndex()\n {\n return index;\n }", "public int index();", "public CoreResourceHandle get(int index) {\n if (index >= 0 && index < doSize()) {\n return doGet(index);\n }\n throw new IndexOutOfBoundsException();\n }", "public java.lang.String getResources(int index) {\n return resources_.get(index);\n }", "public int getIndex() {\r\n return index;\r\n }", "public Integer get(int index){\n return list.get(index);\n }", "public int getIndex(\n )\n {return index;}", "@Override\n public ResourceInformation getResourceInformation(int index)\n throws ResourceNotFoundException {\n ResourceInformation ri = null;\n try {\n ri = super.getResourceInformation(index);\n } catch (ResourceNotFoundException e) {\n // Retry once to reinitialize resource information.\n initResourceMap();\n try {\n return super.getResourceInformation(index);\n } catch (ResourceNotFoundException ee) {\n throwExceptionWhenArrayOutOfBound(index);\n }\n }\n return ri;\n }", "public int getIndex() {\r\n\t\treturn index;\r\n\t}", "public int getIndex() {\n return index;\n }", "public int getIndex() {\n return index;\n }", "public int getIndex() {\n return index;\n }", "public int getIndex() {\n return index;\n }", "public int getIndex() {\n return index;\n }", "public int getIndex() {\n\t\treturn index;\n\t}", "public int getIndex() {\n\t\treturn index;\n\t}", "public int getIndex() {\n\t\treturn index;\n\t}", "public int getIndex() {\n return index;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "int index();", "@java.lang.Override\n public int getIndex() {\n return index_;\n }", "@java.lang.Override\n public int getIndex() {\n return index_;\n }", "@java.lang.Override\n public int getIndex() {\n return index_;\n }", "protected final int getIndex() {\n return index;\n }", "public int getResources(Type type) {\n \t\treturn resources[type.ordinal()];\n \t}", "@java.lang.Override\n public int getIndex() {\n return index_;\n }", "@java.lang.Override\n public int getIndex() {\n return index_;\n }", "@java.lang.Override\n public int getIndex() {\n return index_;\n }", "@java.lang.Override\n public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return this.index;\n }", "public int getIndex() {\n return this.index;\n }", "private int getIndex(String rib){\n for (int i=0;i<ribSp.getCount();i++){\n if (ribSp.getItemAtPosition(i).toString().equalsIgnoreCase(rib)){\n return i;\n }\n }\n\n return 0;\n }", "@java.lang.Override\n public int getIndex() {\n return index_;\n }", "public int getIndex() {\n\t\treturn 0;\n\t}", "@Override\n public final int getIndex() {\n return index;\n }", "public int index() {\n\t\treturn this.index;\n\t}", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int getIndex() {\n return index_;\n }", "public int get(int index);", "public int getIndex() {\n\t\treturn this.index;\n\t}", "public int getIndexNumber(){\n return id;\r\n }", "public java.lang.String getResourceNames(int index) {\n return resourceNames_.get(index);\n }", "public int getSelectionIndex () {\r\n\tcheckWidget();\r\n\tint [] args = {OS.Pt_ARG_PG_CURRENT_INDEX, 0, 0};\r\n\tOS.PtGetResources (handle, args.length / 3, args);\r\n\treturn args [1] == OS.Pt_PG_INVALID ? -1 : args [1];\r\n}", "int getStatus(int index);", "private int getInstr(int index) {\n switch (index) {\n case 0:\n return R.drawable.chickpeacurry;\n case 1:\n return R.drawable.sweetpotatoblackbeanburger;\n case 2:\n return R.drawable.cabbagedietsoup;\n case 3:\n return R.drawable.instantpotvegetablesoup;\n case 4:\n return R.drawable.veganpumpkinsoup;\n\n default:\n return -1;\n }\n }", "int getResourceId();", "public abstract int getIndex();" ]
[ "0.6473773", "0.6454439", "0.6328271", "0.63259184", "0.62988573", "0.6281324", "0.62772536", "0.6249967", "0.62419343", "0.62419343", "0.62117153", "0.6204525", "0.6204525", "0.6204525", "0.6201321", "0.6201321", "0.6199323", "0.6199323", "0.6199323", "0.6196109", "0.6171488", "0.6165748", "0.6138002", "0.613664", "0.6136406", "0.61257887", "0.61227775", "0.6118315", "0.61159486", "0.61129117", "0.6100814", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6099751", "0.6096527", "0.6084729", "0.6084316", "0.60821575", "0.6042771", "0.60415214", "0.60334545", "0.60229784", "0.6004852", "0.5997623", "0.598657", "0.598657", "0.598657", "0.598657", "0.598657", "0.5979139", "0.5979139", "0.5979139", "0.5977982", "0.59595066", "0.59595066", "0.59595066", "0.59595066", "0.59595066", "0.59595066", "0.5948651", "0.5909247", "0.5909247", "0.5909247", "0.59086573", "0.58881015", "0.5873259", "0.5868869", "0.5868869", "0.5868869", "0.58687186", "0.58687186", "0.58643025", "0.58484924", "0.58467764", "0.5835668", "0.58151454", "0.5809604", "0.5809604", "0.5809604", "0.5809604", "0.5809604", "0.5809604", "0.58076155", "0.58020604", "0.57913226", "0.57899076", "0.5785553", "0.5766096", "0.57632226", "0.57554823", "0.57553756" ]
0.0
-1
overridden in producer / consumer
@Override public void run() { do{ if(resList[resId].semaphore.tryLock()){ //gets lock and returns true if free (basically wait) try{ this.doJob(); } catch(Exception e){ //just in case System.out.println(e.toString()); } finally{ resList[resId].semaphore.unlock(); //frees resource (basically signal) } } } while(!shutdown); System.out.println(name + " stopped."); //notify that the thread has stopped. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void AsyncPush(String topic){\n\t\t\t\t \t\n\t \t/**\n\t \t * output a map, delete existed items\n\t \t */\n\t \t//Map<Key, Integer> deduplicatedBuff = mergeDuplicatedItemsAndDelte(buff);\n\t \t\n\t \t//not in, create, delay\n\t \tif(!producerMap.containsKey(topic)){\n\t \t\ttry {\n\t\t\t\t\t\t\tCreateProducer(topic,LogicController.batchMessagesMaxMessagesPerBatch);\n\t\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t} catch (ExecutionException e) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t}\t \t\t \n\t \t}\n\t \tlog.info(\"#publish\"+topic+\", \"+buffMap.size());\n\t \tProducer<byte[]> producer = producerMap.get(topic);\n\t \t/**\n\t \t * init set, copy to hash set\n\t \t */\n\t \t//Set<Key> Keys = Sets.newConcurrentHashSet(buffMap.keySet());\n\t \t\n\t \t \n\t \tfor (Key key : buffMap.keySet()){\n\t \t\t \n\t \t\t //if(buffMap.containsKey(key)){\n\t \t\t \n\t \t\t \n\t \t\t if(buffMap.containsKey(key)){\n\t \t\t\t Integer val = buffMap.get(key);\n\t \t\t\t //clear,skip\n\t \t\t\t if(val<=0){buffMap.remove(key);continue;}\n\t \t\t\t //concenate\n\t \t\t\t byte[] out = createKVByte(key,val);\n\t \t\t\t \n\t \t\t\t//get producer\n\t\t\t \t\t\t \n\t\t\t \t\t\t //byte[] tempTable = new byte[](buffMap);\n\t\t producer.sendAsync(out).thenRun(() -> {\n\t\t\t messagesSent.increment();\n\t\t\t bytesSent.add(out.length);\n\t\t\t //update\n\t\t\t TopicMap.replace(topic, TopicMap.get(topic)+out.length);\t\n\t\t\t \n\t\t\t //delete\n\t\t\t rescaleBufferMap(buffMap,key,val);\n\t\t\t \n\t\t\t //CheckNumberPacketsEnoughEndMessageAndSend(topic);\n\t\t\t //buffMap.remove(key);\n\t\t\t //remove from the set\n\t\t\t //ier.remove();\n\t\t\t \t\t \t\t \n\t\t\t }).exceptionally(ex -> {\n\t\t\t log.warn(\"Write error on message\", ex);\n\t\t\t //System.exit(-1);\n\t\t\t return null;\n\t\t\t });\n\t \t\t }\n\t \t\t }\n\t \t\t \n\t \t }", "public abstract boolean isConsumed();", "@Override\n\tpublic void invoke() {\n\t\t\n\t\tIBuffer b = Buffer.getBuffer();\n\t\tint r = b.getRemainingCapacity();\n\t\t\n\t\t// the buffer is empty - this means that invoke was called after a grid was removed\n\t\t// and we need to fill it up to prevent starvation. Ideally the only way this could\n\t\t// happen is if the buffer size was 1\n\t\tif (r == 0) {\n\t\t\tPublisher.getInstance().send(new ProduceMessage());\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (r < b.getCapacity())\n\t\t\tPublisher.getInstance().send(new ProduceMessage());\n\t\t\n\t\tif (r > 0)\n\t\t\tPublisher.getInstance().send(new ConsumeMessage());\n\t\t\n\t}", "@Override\n public void onDrainComplete()\n {\n }", "public interface IProducer {\n\n\n /** sends out the filled in message to kafka */\n public void dispatchMessage(KeyedMessage<byte[], byte[]> msg);\n\n public void shutdown();\n\n public void dispatchMessage(final List<KeyedMessage<byte[], byte[]>> msgBatch );\n\n\n}", "@Override\r\n\tpublic void updateConsumer(Consumer con) {\n\r\n\t}", "Producer(final Consumer<String, Integer> obj, final T1 msg, final int time) {\n cons = obj;\n message = msg;\n this.time = time;\n }", "public Object consumeBloqueante();", "Consumer getConsumer();", "private Producer getWrappedProducer() {\n return (Producer) getWrappedProcessor();\n }", "public static void main(String[] args) throws ExecutionException, InterruptedException {\n String topicName = \"mockProducerTopic1\";\n MockProducer<String,String> mockProducer = new MockProducer<String,String>(true, new DefaultPartitioner(),new StringSerializer(),new StringSerializer());\n\n String KEY=\"\";\n for(int i=1;i<=10;i++) {\n KEY= i%2 == 0 ? \"CS\" : \"IT\";\n ProducerRecord<String, String> record = new ProducerRecord<>(\"mockProducerTopic1\", KEY, \"value\"+i);\n Future<RecordMetadata> metadata = mockProducer.send(record);\n System.out.println(\"Topic : \" + metadata.get().topic() + \", Partition : \" + metadata.get().partition() + \", Offset : \" + metadata.get().offset() + \", TimeStamp : \" + metadata.get().hasTimestamp());\n //System.out.println(\"Topic : \" + metadata.topic() + \", Partition : \" + metadata.partition() + \", Offset : \" + metadata.offset() + \", TimeStamp : \" + metadata.timestamp());\n\n }\n\n System.out.println(\"Topic Partitions Details : \" + mockProducer.partitionsFor(\"mockProducerTopic1\"));\n for(int i=0;i<mockProducer.history().size();i++)\n {\n System.out.println(\"Topic : \"+ mockProducer.history().get(i).topic()+ \", Key : \" + mockProducer.history().get(i).key()\n + \", Value : \"+mockProducer.history().get(i).value() );\n }\n\n mockProducer.clear();\n mockProducer.close();\n }", "public void drain() {\r\n if (getAndIncrement() == 0) {\r\n SimpleQueue<T> simpleQueue = this.queue;\r\n int i = this.consumed;\r\n int i2 = this.bufferSize;\r\n int i3 = i2 - (i2 >> 2);\r\n boolean z = this.sourceMode != 1;\r\n int i4 = 1;\r\n int i5 = i;\r\n SimpleQueue<T> simpleQueue2 = simpleQueue;\r\n int i6 = i5;\r\n while (true) {\r\n if (simpleQueue2 != null) {\r\n long j = LongCompanionObject.MAX_VALUE;\r\n InnerSubscription[] innerSubscriptionArr = (InnerSubscription[]) this.subscribers.get();\r\n boolean z2 = false;\r\n for (InnerSubscription innerSubscription : innerSubscriptionArr) {\r\n long j2 = innerSubscription.get();\r\n if (j2 != Long.MIN_VALUE) {\r\n j = Math.min(j2 - innerSubscription.emitted, j);\r\n z2 = true;\r\n }\r\n }\r\n long j3 = 0;\r\n if (!z2) {\r\n j = 0;\r\n }\r\n while (true) {\r\n if (j == j3) {\r\n break;\r\n }\r\n boolean z3 = this.done;\r\n try {\r\n Object poll = simpleQueue2.poll();\r\n boolean z4 = poll == null;\r\n if (!checkTerminated(z3, z4)) {\r\n if (z4) {\r\n break;\r\n }\r\n int length = innerSubscriptionArr.length;\r\n for (int i7 = 0; i7 < length; i7++) {\r\n InnerSubscription innerSubscription2 = innerSubscriptionArr[i7];\r\n if (!innerSubscription2.isCancelled()) {\r\n innerSubscription2.downstream.onNext(poll);\r\n innerSubscription2.emitted++;\r\n }\r\n }\r\n if (z) {\r\n i6++;\r\n if (i6 == i3) {\r\n ((Subscription) this.upstream.get()).request((long) i3);\r\n i6 = 0;\r\n }\r\n }\r\n j--;\r\n if (innerSubscriptionArr != this.subscribers.get()) {\r\n break;\r\n }\r\n j3 = 0;\r\n } else {\r\n return;\r\n }\r\n } catch (Throwable th) {\r\n Throwable th2 = th;\r\n Exceptions.throwIfFatal(th2);\r\n ((Subscription) this.upstream.get()).cancel();\r\n simpleQueue2.clear();\r\n this.done = true;\r\n signalError(th2);\r\n return;\r\n }\r\n }\r\n if (checkTerminated(this.done, simpleQueue2.isEmpty())) {\r\n return;\r\n }\r\n }\r\n this.consumed = i6;\r\n i4 = addAndGet(-i4);\r\n if (i4 != 0) {\r\n if (simpleQueue2 == null) {\r\n simpleQueue2 = this.queue;\r\n }\r\n } else {\r\n return;\r\n }\r\n }\r\n }\r\n }", "public void setProducer(Producer producer){\n this.producer = producer;\n }", "private int consumeElement(int index) throws InterruptedException {\n\t while (sharedBuffer.isEmpty()) {\r\n\t synchronized (sharedBuffer) {\r\n\t \tString msg=\"Queue is empty \" + Thread.currentThread().getName()\r\n + \" is waiting , size: \" + sharedBuffer.size();\r\n\t \t\r\n\t // \t System.out.println(msg);\r\n\t\t writeLn(msg);\r\n\r\n\t sharedBuffer.wait();\r\n\t \r\n\t }\r\n\t }\r\n\r\n\t // Consume data from Buffer and Notify Producer that Data has been consumed from Buffer\r\n\t synchronized (sharedBuffer) {\r\n\t \tsharedBuffer.notifyAll();\r\n\t \t\r\n\t return (Integer) sharedBuffer.poll();\r\n\t }\r\n\t }", "protected void beforeConsume() {\n // Do nothing\n }", "@Override\n public void run() {\n while (queue.num < 100) {\n try {\n queue.producer();\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }\n }", "public boolean wasConsumed() {\n return(_consumed);\n }", "@Test\n public void testConsumerAccessExceptionDuringBatchRun() throws ExecutionException, InterruptedException {\n List<Chunk> chunkList = new ArrayList<>();\n //generate chunks\n int numOfChunksToUpload = 1000;\n while (numOfChunksToUpload > 0) {\n chunkList.add(generateChunk(10));\n numOfChunksToUpload--;\n }\n\n //Start a producer thread\n ExecutorService executorService = Executors.newFixedThreadPool(2);\n ProducerThread producerThread = new ProducerThread(\"Producer1\", chunkList, 20, new ApplicationService());\n Future<String> producerResult = executorService.submit(producerThread);\n //Wait for batch run to start\n Thread.sleep(10);\n //Start a consumer thread in parallel\n Future<String> result = executorService.submit(new ConsumerThread(\"Consumer1\", 1, new ApplicationService()));\n //Consumer threads gets null value of instrument id price\n assertNull(result.get());\n log.info(\"Producer result:\" + producerResult.get());\n\n }", "@Override\n public ConsumerNode getConsumer(){\n return super.getConsumer();\n }", "void drainFused() {\n int n;\n int n2 = 1;\n Subscriber<T> subscriber = this.actual;\n SimpleQueueWithConsumerIndex<Object> simpleQueueWithConsumerIndex = this.queue;\n do {\n if (this.cancelled) {\n simpleQueueWithConsumerIndex.clear();\n return;\n }\n Throwable throwable = (Throwable)this.error.get();\n if (throwable != null) {\n simpleQueueWithConsumerIndex.clear();\n subscriber.onError(throwable);\n return;\n }\n n = simpleQueueWithConsumerIndex.producerIndex() == this.sourceCount ? 1 : 0;\n if (!simpleQueueWithConsumerIndex.isEmpty()) {\n subscriber.onNext(null);\n }\n if (n != 0) {\n subscriber.onComplete();\n return;\n }\n n2 = n = this.addAndGet(-n2);\n } while (n != 0);\n }", "@Override\n @SuppressWarnings(\"unchecked\")\n protected void customSync() {\n Exchanger<Void>[] exchangers = (Exchanger<Void>[]) new Exchanger<?>[PRODUCERS_COUNT];\n\n for (int i = 0; i < PRODUCERS_COUNT; i++) {\n exchangers[i] = new Exchanger<>();\n new Producer(params.dataResults, params.postResult, exchangers[i]).start();\n }\n\n new Consumer(params.postFinish, exchangers).start();\n }", "public Producer(Buffer buff) {\n buffer = buff;\n }", "@Override\n\tpublic void receive() {\n\t}", "@Override\n protected void sink(Message message) {\n }", "public Producer(Buffer shared) {\n sharedLocation = shared;\n }", "public interface PersistentProducer<T> extends Producer<T> {\n\n}", "@Test\n public void multipleProducerAndMultipleConsumerScenarioTest() throws InterruptedException, ExecutionException {\n List<Chunk> chunkList1 = new ArrayList<>();\n //generate chunks for producer 1\n int numOfChunksToUpload = 1000;\n while (numOfChunksToUpload > 0) {\n chunkList1.add(generateChunk(10));\n numOfChunksToUpload--;\n }\n\n //Calculate the cached price list for producer 1\n Map<String, Record> expectedPriceList = new HashMap<>();\n String expectedPrice;\n chunkList1.forEach((chunk) -> {\n Map<String, List<Record>> groupedRecords = chunk.getData().stream().collect(Collectors.groupingBy(Record::getId));\n groupedRecords.forEach((s, l) -> {\n l.sort(recordComparator);\n Record latestRecord = l.get(0);\n expectedPriceList.put(latestRecord.getId(), latestRecord);\n\n });\n\n });\n\n\n List<Chunk> chunkList2 = new ArrayList<>();\n //generate chunks for producer 2\n numOfChunksToUpload = 1000;\n while (numOfChunksToUpload > 0) {\n chunkList2.add(generateChunk(10));\n numOfChunksToUpload--;\n }\n\n //Calculate cached price list for producer 2\n Map<String, Record> cachedPriceList = new HashMap<>();\n chunkList2.forEach((chunk) -> {\n Map<String, List<Record>> groupedRecords = chunk.getData().stream().collect(Collectors.groupingBy(Record::getId));\n groupedRecords.forEach((s, l) -> {\n l.sort(recordComparator);\n Record latestRecord = l.get(0);\n cachedPriceList.put(latestRecord.getId(), latestRecord);\n\n });\n\n });\n\n //calculating expected price with both the producer's cached price list\n cachedPriceList.forEach((k, v) -> {\n Record originalRecord = expectedPriceList.get(k);\n if (originalRecord != null) {\n if (v.getAsOf().compareTo(originalRecord.getAsOf()) >= 0) {\n expectedPriceList.put(k, v);\n }\n } else {\n expectedPriceList.put(k, v);\n }\n });\n\n expectedPrice = String.valueOf(expectedPriceList.get(\"5\").getPayload().get(\"Price\"));\n log.info(\"Expected latest price: \" + expectedPrice);\n //Start the producer 1 thread\n ExecutorService executorService = Executors.newFixedThreadPool(4);\n ProducerThread producerThread1 = new ProducerThread(\"Producer1\", chunkList1, 100, new ApplicationService());\n Future<String> producerResult1 = executorService.submit(producerThread1);\n\n //Start the producer 2 thread\n ProducerThread producerThread2 = new ProducerThread(\"Producer2\", chunkList2, 100, new ApplicationService());\n Future<String> producerResult2 = executorService.submit(producerThread2);\n\n //Wait for both the batch run to start\n Thread.sleep(20);\n //Start a consumer thread to access the price while the batch is running\n Future<String> consumer1Result = executorService.submit(new ConsumerThread(\"Consumer1\", 1, new ApplicationService()));\n assertNull(consumer1Result.get());\n\n //Wait for all the batch runs to be completed\n if (ProducerConstants.BATCH_COMPLETION_MESSAGE.equals(producerResult1.get()) && ProducerConstants.BATCH_COMPLETION_MESSAGE.equals(producerResult2.get())) {\n //Start a consumer thread to access the price and then apply assertion to the expected and actual price\n Future<String> consumer2Result = executorService.submit(new ConsumerThread(\"Consumer2\", 5, new ApplicationService()));\n assertEquals(expectedPrice, consumer2Result.get());\n }\n executorService.shutdown();\n\n }", "@Test\n public void multipleProducerScenarioTest() throws InterruptedException, JsonProcessingException, ExecutionException {\n\n //Create list of chunk for producer 1\n ObjectMapper objectMapper = new ObjectMapper();\n List<Chunk> chunkList1 = new ArrayList<>();\n Chunk chunk = new Chunk();\n chunk.setData(Arrays.asList(objectMapper.readValue(\"{\\\"id\\\":\\\"1\\\", \\\"asOf\\\":\\\"2021-09-07T21:26:57.202898400\\\", \\\"payload\\\":{\\\"Price\\\":20.139961889377744}}\", Record.class),\n objectMapper.readValue(\"{\\\"id\\\":\\\"2\\\", \\\"asOf\\\":\\\"2021-09-07T09:26:57.265399700\\\", \\\"payload\\\":{\\\"Price\\\":70.14384608537513}}\", Record.class)));\n chunkList1.add(chunk);\n ExecutorService executorService = Executors.newFixedThreadPool(2);\n ProducerThread producerThread1 = new ProducerThread(\"Producer1\", chunkList1, 10, new ApplicationService());\n\n Future<String> producerResult = executorService.submit(producerThread1);\n while (true) {\n if (producerResult.isDone())\n break;\n }\n\n //Once the producer 1 is done with the batch run, producer 2 starts the batch run\n if (ProducerConstants.BATCH_COMPLETION_MESSAGE.equals(producerResult.get())) {\n List<Chunk> chunkList2 = new ArrayList<>();\n chunk.setData(Arrays.asList(objectMapper.readValue(\"{\\\"id\\\":\\\"1\\\", \\\"asOf\\\":\\\"2021-09-07T21:55:57.265399700\\\", \\\"payload\\\":{\\\"Price\\\":98.12933222921298}}\", Record.class),\n objectMapper.readValue(\"{\\\"id\\\":\\\"2\\\", \\\"asOf\\\":\\\"2021-09-06T10:26:57.265399700\\\", \\\"payload\\\":{\\\"Price\\\":31.54355122981366}}\", Record.class)));\n chunkList2.add(chunk);\n ProducerThread producerThread2 = new ProducerThread(\"Producer2\", chunkList2, 10, new ApplicationService());\n\n producerResult = executorService.submit(producerThread2);\n while (true) {\n if (producerResult.isDone())\n break;\n }\n\n //Once producer 2 is also done with the batch , then start 2 consumer threads to access the instrument id value.\n if (ProducerConstants.BATCH_COMPLETION_MESSAGE.equals(producerResult.get())) {\n Future<String> priceFromConsumer1 = executorService.submit(new ConsumerThread(\"Consumer1\", 1, new ApplicationService()));\n Future<String> priceFromConsumer2 = executorService.submit(new ConsumerThread(\"Consumer2\", 2, new ApplicationService()));\n\n assertEquals(\"98.12933222921298\", priceFromConsumer1.get());\n assertEquals(\"70.14384608537513\", priceFromConsumer2.get());\n }\n }\n\n executorService.shutdown();\n\n }", "@Override\n public void run() {\n\n int sum = 0;\n\n for (int count = 1; count <= 10; count++) {\n try {\n Thread.sleep(generator.nextInt(3000)); // random sleep\n sharedLocation.set(count); // set value in buffer\n sum += count; // increment sum of values\n System.out.printf(\"\\t%2d\\n\", sum);\n } // end try\n catch (InterruptedException exception) {\n exception.printStackTrace();\n } // end catch\n } // end for\n\n System.out.println(\"Producer done producing\\nTerminating Producer\");\n }", "public int drain(MessagePassingQueue.Consumer<E> c)\r\n/* 357: */ {\r\n/* 358:644 */ return drain(c, capacity());\r\n/* 359: */ }", "@Override\n public void peek(MessageWritable writer) {\n }", "synchronized A consume() {\n try {\r\n if ((noMore && slack >= 0) || consumedAll) {\r\n notifyAll();\r\n consumedAll = true;\r\n return null;\r\n }\r\n while (slack != -1) {\r\n wait();\r\n }\r\n A tmp;\r\n\r\n int bSize = CodecUtil.slackOrSize(consumerBuffer, codec);\r\n if(bSize < 0 && endOfStream) {\r\n bSize = Math.abs(bSize);\r\n }\r\n if (bSize <= 0) {\r\n slack = Math.abs(bSize);\r\n notifyAll();\r\n return null;\r\n }\r\n tmp = codec.from(consumerBuffer);\r\n totConsumed += bSize;\r\n notifyAll();\r\n return tmp;\r\n }\r\n catch (InterruptedException e) {\r\n }\r\n return null;\r\n }", "private void workOnQueue() {\n }", "@Override\n\tpublic void handleConsumeOk(String consumerTag) {\n\t\t\n\t}", "public void produce() throws InterruptedException {\n\t\tsynchronized(this) {\r\n\t\t\tSystem.out.println(\"Producer Thread Running.....\");\r\n\t\t\t// wait() relinquishes the lock\r\n\t\t\t// the control moves to another thread calling consume() method\r\n\t\t\twait();\r\n\t\t\tSystem.out.println(\"Resumed.....\");\r\n\t\t}\r\n\t}", "@Test\n public void successScenarioTest() throws ExecutionException, InterruptedException {\n List<Chunk> chunkList = new ArrayList<>();\n //generate 5 chunks of 10 records each\n int numOfChunksToUpload = 5;\n while (numOfChunksToUpload > 0) {\n chunkList.add(generateChunk(10));\n numOfChunksToUpload--;\n }\n\n //Calculate expected result\n Map<String, Record> expectedPriceList = new HashMap<>();\n String expectedPrice;\n chunkList.forEach((chunk) -> {\n Map<String, List<Record>> groupedRecords = chunk.getData().stream().collect(Collectors.groupingBy(Record::getId));\n groupedRecords.forEach((s, l) -> {\n l.sort(recordComparator);\n Record latestRecord = l.get(0);\n expectedPriceList.put(latestRecord.getId(), latestRecord);\n\n });\n\n });\n expectedPrice = String.valueOf(expectedPriceList.get(\"7\").getPayload().get(\"Price\"));\n log.debug(\"Expected latest price: \" + expectedPrice);\n\n //InstrumentId 7 is to be accessed by consumer thread\n int instrumentId = 7;\n log.info(\"Latest price to be accessed for : \" + instrumentId);\n ExecutorService executorService = Executors.newFixedThreadPool(2);\n ProducerThread producerThread = new ProducerThread(\"Producer1\", chunkList, 20, new ApplicationService());\n ConsumerThread consumerThread = new ConsumerThread(\"Consumer1\", instrumentId, new ApplicationService());\n\n Future<String> producerResult = executorService.submit(producerThread);\n //Wait for producer thread to complete\n while (true) {\n if (producerResult.isDone())\n break;\n }\n\n //Check if the producer thread is complete successfully\n if (ProducerConstants.BATCH_COMPLETION_MESSAGE.equals(producerResult.get())) {\n Future<String> consumerResult = executorService.submit(consumerThread);\n while (true) {\n if (consumerResult.isDone())\n break;\n }\n String str = consumerResult.get();\n //Check if the expected and actual price is same\n assertEquals(0, Double.compare(Double.parseDouble(expectedPrice), Double.parseDouble(str)));\n } else {\n //If producer fails to complete batch run, then fail the test case\n Assert.fail();\n }\n\n\n executorService.shutdown();\n\n\n }", "public Producer(Store storage){\n\t\tthis.storage=storage;\n\t}", "public final void drain(rx.subjects.ReplaySubject.ReplayProducer<T> r19) {\n /*\n r18 = this;\n r0 = r18;\n r1 = r19;\n r2 = r19.getAndIncrement();\n if (r2 == 0) goto L_0x000b;\n L_0x000a:\n return;\n L_0x000b:\n r2 = r1.actual;\n r3 = r0.capacity;\n r4 = 1;\n r5 = r4;\n L_0x0011:\n r6 = r1.requested;\n r6 = r6.get();\n r8 = r1.node;\n r8 = (java.lang.Object[]) r8;\n if (r8 != 0) goto L_0x001f;\n L_0x001d:\n r8 = r0.head;\n L_0x001f:\n r9 = r1.tailIndex;\n r10 = r1.index;\n r14 = r8;\n r13 = r9;\n r8 = 0;\n L_0x0027:\n r15 = (r8 > r6 ? 1 : (r8 == r6 ? 0 : -1));\n r16 = 0;\n r11 = 0;\n if (r15 == 0) goto L_0x006c;\n L_0x002e:\n r12 = r2.isUnsubscribed();\n if (r12 == 0) goto L_0x0037;\n L_0x0034:\n r1.node = r11;\n return;\n L_0x0037:\n r12 = r0.done;\n r15 = r0.size;\n if (r10 != r15) goto L_0x003f;\n L_0x003d:\n r15 = r4;\n goto L_0x0041;\n L_0x003f:\n r15 = r16;\n L_0x0041:\n if (r12 == 0) goto L_0x0053;\n L_0x0043:\n if (r15 == 0) goto L_0x0053;\n L_0x0045:\n r1.node = r11;\n r1 = r0.error;\n if (r1 == 0) goto L_0x004f;\n L_0x004b:\n r2.onError(r1);\n return;\n L_0x004f:\n r2.onCompleted();\n return;\n L_0x0053:\n if (r15 != 0) goto L_0x006c;\n L_0x0055:\n if (r13 != r3) goto L_0x005e;\n L_0x0057:\n r11 = r14[r13];\n r11 = (java.lang.Object[]) r11;\n r14 = r11;\n r13 = r16;\n L_0x005e:\n r11 = r14[r13];\n r2.onNext(r11);\n r11 = 1;\n r15 = r8 + r11;\n r13 = r13 + r4;\n r10 = r10 + 1;\n r8 = r15;\n goto L_0x0027;\n L_0x006c:\n r12 = (r8 > r6 ? 1 : (r8 == r6 ? 0 : -1));\n if (r12 != 0) goto L_0x0093;\n L_0x0070:\n r12 = r2.isUnsubscribed();\n if (r12 == 0) goto L_0x0079;\n L_0x0076:\n r1.node = r11;\n return;\n L_0x0079:\n r12 = r0.done;\n r15 = r0.size;\n if (r10 != r15) goto L_0x0081;\n L_0x007f:\n r16 = r4;\n L_0x0081:\n if (r12 == 0) goto L_0x0093;\n L_0x0083:\n if (r16 == 0) goto L_0x0093;\n L_0x0085:\n r1.node = r11;\n r1 = r0.error;\n if (r1 == 0) goto L_0x008f;\n L_0x008b:\n r2.onError(r1);\n return;\n L_0x008f:\n r2.onCompleted();\n return;\n L_0x0093:\n r11 = 0;\n r15 = (r8 > r11 ? 1 : (r8 == r11 ? 0 : -1));\n if (r15 == 0) goto L_0x00a7;\n L_0x0099:\n r11 = 9223372036854775807; // 0x7fffffffffffffff float:NaN double:NaN;\n r15 = (r6 > r11 ? 1 : (r6 == r11 ? 0 : -1));\n if (r15 == 0) goto L_0x00a7;\n L_0x00a2:\n r6 = r1.requested;\n rx.internal.operators.BackpressureUtils.produced(r6, r8);\n L_0x00a7:\n r1.index = r10;\n r1.tailIndex = r13;\n r1.node = r14;\n r5 = -r5;\n r5 = r1.addAndGet(r5);\n if (r5 != 0) goto L_0x0011;\n L_0x00b4:\n return;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: rx.subjects.ReplaySubject.ReplayUnboundedBuffer.drain(rx.subjects.ReplaySubject$ReplayProducer):void\");\n }", "protected void onQueued() {}", "public ChannelPipeline method_4119() {\n return null;\n }", "@Override\n public void flush() {\n new QueueConsumer().run();\n }", "public synchronized void produce(){\n\t\tif(num==capacity){\n\t\t\ttry {\n\t\t\t\twait();\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\t\n\t\t}\n\t\tnum++;\n\t\tSystem.out.println(\"Produce 1, now we have \"+num+\" products\");\n\t\tnotify();\n\t}", "public final void drain(rx.subjects.ReplaySubject.ReplayProducer<T> r19) {\n /*\n r18 = this;\n r0 = r18;\n r1 = r19;\n r2 = r19.getAndIncrement();\n if (r2 == 0) goto L_0x000b;\n L_0x000a:\n return;\n L_0x000b:\n r2 = r1.actual;\n r3 = 1;\n r4 = r3;\n L_0x000f:\n r5 = r1.requested;\n r5 = r5.get();\n r7 = r1.node;\n r7 = (rx.subjects.ReplaySubject.ReplaySizeBoundBuffer.Node) r7;\n r8 = 0;\n if (r7 != 0) goto L_0x001f;\n L_0x001d:\n r7 = r0.head;\n L_0x001f:\n r10 = r8;\n L_0x0020:\n r12 = (r10 > r5 ? 1 : (r10 == r5 ? 0 : -1));\n r13 = 0;\n r14 = 0;\n if (r12 == 0) goto L_0x005f;\n L_0x0026:\n r12 = r2.isUnsubscribed();\n if (r12 == 0) goto L_0x002f;\n L_0x002c:\n r1.node = r14;\n return;\n L_0x002f:\n r12 = r0.done;\n r15 = r7.get();\n r15 = (rx.subjects.ReplaySubject.ReplaySizeBoundBuffer.Node) r15;\n if (r15 != 0) goto L_0x003c;\n L_0x0039:\n r16 = r3;\n goto L_0x003e;\n L_0x003c:\n r16 = r13;\n L_0x003e:\n if (r12 == 0) goto L_0x0050;\n L_0x0040:\n if (r16 == 0) goto L_0x0050;\n L_0x0042:\n r1.node = r14;\n r1 = r0.error;\n if (r1 == 0) goto L_0x004c;\n L_0x0048:\n r2.onError(r1);\n return;\n L_0x004c:\n r2.onCompleted();\n return;\n L_0x0050:\n if (r16 != 0) goto L_0x005f;\n L_0x0052:\n r7 = r15.value;\n r2.onNext(r7);\n r12 = 1;\n r16 = r10 + r12;\n r7 = r15;\n r10 = r16;\n goto L_0x0020;\n L_0x005f:\n r12 = (r10 > r5 ? 1 : (r10 == r5 ? 0 : -1));\n if (r12 != 0) goto L_0x0087;\n L_0x0063:\n r12 = r2.isUnsubscribed();\n if (r12 == 0) goto L_0x006c;\n L_0x0069:\n r1.node = r14;\n return;\n L_0x006c:\n r12 = r0.done;\n r15 = r7.get();\n if (r15 != 0) goto L_0x0075;\n L_0x0074:\n r13 = r3;\n L_0x0075:\n if (r12 == 0) goto L_0x0087;\n L_0x0077:\n if (r13 == 0) goto L_0x0087;\n L_0x0079:\n r1.node = r14;\n r1 = r0.error;\n if (r1 == 0) goto L_0x0083;\n L_0x007f:\n r2.onError(r1);\n return;\n L_0x0083:\n r2.onCompleted();\n return;\n L_0x0087:\n r12 = (r10 > r8 ? 1 : (r10 == r8 ? 0 : -1));\n if (r12 == 0) goto L_0x0099;\n L_0x008b:\n r8 = 9223372036854775807; // 0x7fffffffffffffff float:NaN double:NaN;\n r12 = (r5 > r8 ? 1 : (r5 == r8 ? 0 : -1));\n if (r12 == 0) goto L_0x0099;\n L_0x0094:\n r5 = r1.requested;\n rx.internal.operators.BackpressureUtils.produced(r5, r10);\n L_0x0099:\n r1.node = r7;\n r4 = -r4;\n r4 = r1.addAndGet(r4);\n if (r4 != 0) goto L_0x000f;\n L_0x00a2:\n return;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: rx.subjects.ReplaySubject.ReplaySizeBoundBuffer.drain(rx.subjects.ReplaySubject$ReplayProducer):void\");\n }", "public abstract Pipe deliver( Pipe sink );", "@Override\n\tprotected void channelRead0(ChannelHandlerContext ctx, WsClientMessage msg) throws Exception {\n\t}", "public interface MqConsumer {\n}", "public EventHandleThread(){\n gson = new Gson();\n producer = KafkaProducerCreator.createProducer();\n this.paymentController = new PaymentController();\n }", "@Override\n public void run()\n {\n while (true) {\n if (isReadyToStop && (buffer.poll() == null)) {\n System.out.println(\"Thread stop\");\n producerClient.close();\n return;\n }\n try {\n Message msg = buffer.poll(config.getBufferPollTimeout());\n if (msg == null) {\n // ignore it\n continue;\n }\n System.out.println(\"Sent out: [\" + msg + \"]\");\n if (msg.getTopic().isPresent()) {\n String topic = msg.getTopic().get();\n Optional<Function<String, Integer>> function = funcMapBuffer.get(topic);\n function.ifPresent(stringLongFunction -> {\n int fiberId = stringLongFunction.apply(msg.getKey());\n msg.setFiberId(fiberId);\n producerClient.send(topic, fiberId, msg);\n });\n // else ignore this message\n }\n // else ignore this message\n }\n catch (InterruptedException ignored) {\n // if poll nothing, enter next loop\n }\n }\n }", "public void run()\r\n {\r\n\t\tconsume();\r\n }", "@Override\n\tpublic void run() {\n\t\ttry {\n\t\t\tconsume();\n\t\t} catch (InterruptedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n\tpublic void consume(Scan scan) {\n\n\t}", "@Override\n public void handleDelivery(String consumerTag, Envelope envelope,\n AMQP.BasicProperties properties, byte[] body) throws IOException \n {\n try\n {\n Object obj = getObjectForBytes(body);\n json = returnJson(obj);\n System.out.println(\"The json is \"+json.toString());\n \n } catch (ClassNotFoundException ex)\n {\n Logger.getLogger(JsonTranslator.class.getName()).log(Level.SEVERE, null, ex);\n }finally \n {\n System.out.println(\" [x] Done\");\n publishJsonData();//VERY INOVATIVE\n //DDO NOT KILL THE \n // channel.basicAck(envelope.getDeliveryTag(), false);\n }\n \n }", "private void sendReceiveRes(){\n\t}", "public void handle(QueueItem<T>[] events, SyncProducer producer, Encoder<T> encoder) throws Exception;", "public void onResultConsumed() {\n }", "public synchronized void consumeX() {\n while(!produced){\n try {\n wait();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n //its consuming now\n System.out.println(\"consumed \"+x);\n //after consumption, value is gone, so produced is false\n produced = false;\n // producer to be notified to start production\n notify();\n\n }", "private void startConsumeMsg() {\n try {\n ConsumerRecords<byte[], byte[]> records;\n while (true) {\n records = kafkaConsumer.poll(Long.MAX_VALUE);\n for (ConsumerRecord<byte[], byte[]> record : records) {\n processMsg(record);\n kafkaConsumer.commitSync();\n LOG.info(\"Single consumer consume the message {}th\", counter.incrementAndGet());\n }\n\n }\n } catch (Exception ex) {\n LOG.error(\"Consumer get message error {}\", ex);\n } finally {\n LOG.info(\"Shutting down consumer ...\");\n shutdown();\n }\n }", "public interface ConsumerProducer<T> extends Consumer<T>, Producer<T> {\n\n /**\n * Consumes the next item in a sequence, for subsequent production. \n * This method may block if necessary until {@link #get}() is called.\n * \n * @param The next item in a sequence.\n */\n @Override\n void accept(/*@Nullable*/ T item);\n\n /**\n * Produces the next item in a sequence. This method may block if \n * necessary until {@link #accept}() is called.\n *\n * @return The next item in a sequence.\n * @throws NoSuchElementException if the sequence has finished.\n */\n @Override\n /*@Nullable*/ T get();\n\n}", "private static void addProducer()\r\n\t{\r\n\t\tfetchers++;\r\n\t\tFetcher producer = new Fetcher();\r\n\t\tproducer.start();\r\n\t}", "private void offer() {\n\t\t\t\n\t\t}", "void visitProducer(MethodHandle handle);", "public final void drain(rx.subjects.ReplaySubject.ReplayProducer<T> r19) {\n /*\n r18 = this;\n r0 = r18;\n r1 = r19;\n r2 = r19.getAndIncrement();\n if (r2 == 0) goto L_0x000b;\n L_0x000a:\n return;\n L_0x000b:\n r2 = r1.actual;\n r3 = 1;\n r4 = r3;\n L_0x000f:\n r5 = r1.requested;\n r5 = r5.get();\n r7 = r1.node;\n r7 = (rx.subjects.ReplaySubject.ReplaySizeAndTimeBoundBuffer.TimedNode) r7;\n r8 = 0;\n if (r7 != 0) goto L_0x0021;\n L_0x001d:\n r7 = r18.latestHead();\n L_0x0021:\n r10 = r8;\n L_0x0022:\n r12 = (r10 > r5 ? 1 : (r10 == r5 ? 0 : -1));\n r13 = 0;\n r14 = 0;\n if (r12 == 0) goto L_0x0061;\n L_0x0028:\n r12 = r2.isUnsubscribed();\n if (r12 == 0) goto L_0x0031;\n L_0x002e:\n r1.node = r14;\n return;\n L_0x0031:\n r12 = r0.done;\n r15 = r7.get();\n r15 = (rx.subjects.ReplaySubject.ReplaySizeAndTimeBoundBuffer.TimedNode) r15;\n if (r15 != 0) goto L_0x003e;\n L_0x003b:\n r16 = r3;\n goto L_0x0040;\n L_0x003e:\n r16 = r13;\n L_0x0040:\n if (r12 == 0) goto L_0x0052;\n L_0x0042:\n if (r16 == 0) goto L_0x0052;\n L_0x0044:\n r1.node = r14;\n r1 = r0.error;\n if (r1 == 0) goto L_0x004e;\n L_0x004a:\n r2.onError(r1);\n return;\n L_0x004e:\n r2.onCompleted();\n return;\n L_0x0052:\n if (r16 != 0) goto L_0x0061;\n L_0x0054:\n r7 = r15.value;\n r2.onNext(r7);\n r12 = 1;\n r16 = r10 + r12;\n r7 = r15;\n r10 = r16;\n goto L_0x0022;\n L_0x0061:\n r12 = (r10 > r5 ? 1 : (r10 == r5 ? 0 : -1));\n if (r12 != 0) goto L_0x0089;\n L_0x0065:\n r12 = r2.isUnsubscribed();\n if (r12 == 0) goto L_0x006e;\n L_0x006b:\n r1.node = r14;\n return;\n L_0x006e:\n r12 = r0.done;\n r15 = r7.get();\n if (r15 != 0) goto L_0x0077;\n L_0x0076:\n r13 = r3;\n L_0x0077:\n if (r12 == 0) goto L_0x0089;\n L_0x0079:\n if (r13 == 0) goto L_0x0089;\n L_0x007b:\n r1.node = r14;\n r1 = r0.error;\n if (r1 == 0) goto L_0x0085;\n L_0x0081:\n r2.onError(r1);\n return;\n L_0x0085:\n r2.onCompleted();\n return;\n L_0x0089:\n r12 = (r10 > r8 ? 1 : (r10 == r8 ? 0 : -1));\n if (r12 == 0) goto L_0x009b;\n L_0x008d:\n r8 = 9223372036854775807; // 0x7fffffffffffffff float:NaN double:NaN;\n r12 = (r5 > r8 ? 1 : (r5 == r8 ? 0 : -1));\n if (r12 == 0) goto L_0x009b;\n L_0x0096:\n r5 = r1.requested;\n rx.internal.operators.BackpressureUtils.produced(r5, r10);\n L_0x009b:\n r1.node = r7;\n r4 = -r4;\n r4 = r1.addAndGet(r4);\n if (r4 != 0) goto L_0x000f;\n L_0x00a4:\n return;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: rx.subjects.ReplaySubject.ReplaySizeAndTimeBoundBuffer.drain(rx.subjects.ReplaySubject$ReplayProducer):void\");\n }", "@Override\n public void channelActive(ChannelHandlerContext ctx) throws Exception {\n super.channelActive(ctx);\n \n }", "public interface MessageProducer {\n String getMessage();\n}", "@Override\r\n\tpublic void run() {\n\t\tsynchronized (arr) {\r\n\t\t\twhile (!arr.isEmpty()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tSystem.out.println(\"Producer Waiting as array is full.\");\r\n\t\t\t\t\tarr.wait();\r\n\t\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tsynchronized(arr){\r\n\t\t\ttry {\r\n\t\t\t\tarr.put(5);\r\n\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\tSystem.out.println(\"Producer making the array full.\");\r\n\t\t\tarr.notifyAll();\r\n\t\t}\r\n\t\t}\r\n\t}", "@Override\n public void onPutSpiceRaised() {\n }", "public abstract void processMsg(ConsumerRecord<byte[], byte[]> record);", "@Override\n\tpublic void receiveProduct(Product product) {\n\t\t\n\t}", "@Override\n\tprotected ProducedData performs() {\n\t\treturn null;\n\t}", "public interface ProducerService {\n}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "public int fill(MessagePassingQueue.Supplier<E> s, int batchSize)\r\n/* 296: */ {\r\n/* 297: */ long pIndex;\r\n/* 298: */ long mask;\r\n/* 299: */ E[] buffer;\r\n/* 300: */ for (;;)\r\n/* 301: */ {\r\n/* 302:569 */ long producerLimit = lvProducerLimit();\r\n/* 303:570 */ pIndex = lvProducerIndex();\r\n/* 304:572 */ if ((pIndex & 1L) != 1L)\r\n/* 305: */ {\r\n/* 306:581 */ mask = this.producerMask;\r\n/* 307:582 */ buffer = this.producerBuffer;\r\n/* 308: */ \r\n/* 309: */ \r\n/* 310: */ \r\n/* 311:586 */ long batchIndex = Math.min(producerLimit, pIndex + 2 * batchSize);\r\n/* 312:588 */ if ((pIndex >= producerLimit) || (producerLimit < batchIndex))\r\n/* 313: */ {\r\n/* 314:590 */ int result = offerSlowPath(mask, pIndex, producerLimit);\r\n/* 315:591 */ switch (result)\r\n/* 316: */ {\r\n/* 317: */ case 0: \r\n/* 318: */ case 1: \r\n/* 319: */ break;\r\n/* 320: */ case 2: \r\n/* 321:598 */ return 0;\r\n/* 322: */ case 3: \r\n/* 323:600 */ resize(mask, buffer, pIndex, s.get());\r\n/* 324:601 */ return 1;\r\n/* 325: */ }\r\n/* 326: */ }\r\n/* 327:606 */ else if (casProducerIndex(pIndex, batchIndex))\r\n/* 328: */ {\r\n/* 329:608 */ int claimedSlots = (int)((batchIndex - pIndex) / 2L);\r\n/* 330:609 */ break;\r\n/* 331: */ }\r\n/* 332: */ }\r\n/* 333: */ }\r\n/* 334: */ int claimedSlots;\r\n/* 335:613 */ for (int i = 0; i < claimedSlots; i++)\r\n/* 336: */ {\r\n/* 337:615 */ long offset = LinkedArrayQueueUtil.modifiedCalcElementOffset(pIndex + 2 * i, mask);\r\n/* 338:616 */ UnsafeRefArrayAccess.soElement(buffer, offset, s.get());\r\n/* 339: */ }\r\n/* 340:618 */ return claimedSlots;\r\n/* 341: */ }", "@Override\n\t\tpublic void readyToRead(Vector<byte[]> outQ) {\n\t\t\t\n\t\t}", "@Override\n\tpublic void process(long a_maxReads, String a_topic, int a_partition, List<String> a_seedBrokers, int a_port)\n\t\t\tthrows Exception {\n\n\t}", "@Override\n protected void releaseBuffer() {\n }", "public AbstractMessageProducer() {\n }", "private static void backPressureFix() {\n\t\tFlowable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t\t\t\n\t}", "@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\ts.put();\n\t\t\t\t}", "@Override\n public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {\n }", "@Override\n\tpublic void run() {\n\t\ttry {\n\t\t\tproduce();\n\t\t} catch (InterruptedException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n public Object getQoS ()\n {\n return getEncapsulatedQueue ().getQoS ();\n }", "@DSSafe(DSCat.IPC_CALLBACK)\n @DSGenerator(tool_name = \"Doppelganger\", tool_version = \"2.0\", generated_on = \"2013-12-30 12:59:45.580 -0500\", hash_original_method = \"2469457C965E8FC7C139A1D414384428\", hash_generated_method = \"42C86E9B0B120923F19E3F5FDF13C046\")\n \n@Override\n public void handleMessage(Message msg) {\n mResultMsg = Message.obtain();\n mResultMsg.copyFrom(msg);\n synchronized(mLockObject) {\n mLockObject.notify();\n }\n }", "private static void backPressureChallenge() {\n\t\tObservable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t}", "public void consume() throws InterruptedException {\n\n\t\tRandom random = new Random();\n\t\twhile (true) {\n\t\t\tsynchronized (lock) {\n\t\t\t\twhile (buffer.size() == 0) {\n\t\t\t\t\tlock.wait();\n\t\t\t\t}\n\n\t\t\t\tSystem.out.println(\"Consumed : \" + buffer.removeFirst());\n\t\t\t\tlock.notify();\n\n\t\t\t}\n\t\t\tThread.sleep(random.nextInt(1000));\n\t\t}\n\n\t}", "public boolean offer(E e)\r\n/* 72: */ {\r\n/* 73:259 */ if (null == e) {\r\n/* 74:261 */ throw new NullPointerException();\r\n/* 75: */ }\r\n/* 76: */ long pIndex;\r\n/* 77: */ long mask;\r\n/* 78: */ E[] buffer;\r\n/* 79: */ for (;;)\r\n/* 80: */ {\r\n/* 81:270 */ long producerLimit = lvProducerLimit();\r\n/* 82:271 */ pIndex = lvProducerIndex();\r\n/* 83:273 */ if ((pIndex & 1L) != 1L)\r\n/* 84: */ {\r\n/* 85:280 */ mask = this.producerMask;\r\n/* 86:281 */ buffer = this.producerBuffer;\r\n/* 87:285 */ if (producerLimit <= pIndex)\r\n/* 88: */ {\r\n/* 89:287 */ int result = offerSlowPath(mask, pIndex, producerLimit);\r\n/* 90:288 */ switch (result)\r\n/* 91: */ {\r\n/* 92: */ case 0: \r\n/* 93: */ break;\r\n/* 94: */ case 1: \r\n/* 95: */ break;\r\n/* 96: */ case 2: \r\n/* 97:295 */ return false;\r\n/* 98: */ case 3: \r\n/* 99:297 */ resize(mask, buffer, pIndex, e);\r\n/* 100:298 */ return true;\r\n/* 101: */ }\r\n/* 102: */ }\r\n/* 103: */ else\r\n/* 104: */ {\r\n/* 105:302 */ if (casProducerIndex(pIndex, pIndex + 2L)) {\r\n/* 106: */ break;\r\n/* 107: */ }\r\n/* 108: */ }\r\n/* 109: */ }\r\n/* 110: */ }\r\n/* 111:308 */ long offset = LinkedArrayQueueUtil.modifiedCalcElementOffset(pIndex, mask);\r\n/* 112:309 */ UnsafeRefArrayAccess.soElement(buffer, offset, e);\r\n/* 113:310 */ return true;\r\n/* 114: */ }", "public interface QueueService {\n\n /**\n * 添加元素\n *\n * @param messageQueue\n */\n void add(MessageQueue messageQueue);\n\n\n /**\n * 弹出元素\n */\n MessageQueue poll();\n\n Iterator<MessageQueue> iterator();\n\n\n}", "public void setProducer(p030rx.Producer r3) {\n /*\n r2 = this;\n monitor-enter(r2)\n boolean r0 = r2.emitting // Catch:{ all -> 0x0028 }\n if (r0 == 0) goto L_0x000d\n if (r3 != 0) goto L_0x0009\n rx.Producer r3 = NULL_PRODUCER // Catch:{ all -> 0x0028 }\n L_0x0009:\n r2.missedProducer = r3 // Catch:{ all -> 0x0028 }\n monitor-exit(r2) // Catch:{ all -> 0x0028 }\n return\n L_0x000d:\n r0 = 1\n r2.emitting = r0 // Catch:{ all -> 0x0028 }\n monitor-exit(r2) // Catch:{ all -> 0x0028 }\n r2.currentProducer = r3 // Catch:{ all -> 0x001e }\n if (r3 == 0) goto L_0x001a\n long r0 = r2.requested // Catch:{ all -> 0x001e }\n r3.request(r0) // Catch:{ all -> 0x001e }\n L_0x001a:\n r2.emitLoop() // Catch:{ all -> 0x001e }\n return\n L_0x001e:\n r3 = move-exception\n monitor-enter(r2)\n r0 = 0\n r2.emitting = r0 // Catch:{ all -> 0x0025 }\n monitor-exit(r2) // Catch:{ all -> 0x0025 }\n throw r3\n L_0x0025:\n r3 = move-exception\n monitor-exit(r2) // Catch:{ all -> 0x0025 }\n throw r3\n L_0x0028:\n r3 = move-exception\n monitor-exit(r2) // Catch:{ all -> 0x0028 }\n throw r3\n */\n throw new UnsupportedOperationException(\"Method not decompiled: p030rx.internal.producers.ProducerArbiter.setProducer(rx.Producer):void\");\n }", "public interface MQPullConsumer extends MQConsumer {\n\n\n\n\n\n /**\n * 拉取一条消息,不会阻塞\n * @param mq\n * @param subExpression 子标签\n * @param offset 偏移量\n * @param maxNums 拉取的最大个数\n * @return\n * @throws MQClientException\n * @throws RemotingException\n * @throws MQBrokerException\n * @throws InterruptedException\n */\n PullResult pull(final MessageQueue mq, final String subExpression, final long offset,\n final int maxNums) throws MQClientException, RemotingException, MQBrokerException,\n InterruptedException;\n\n}", "@Override\n\tpublic void process(Exchange arg0) throws Exception {\n\t\t\n\t}", "@Override\n protected boolean shouldAck() {\n return true;\n }", "public interface EntityCollector {\n\n /**\n * Add httpContent to the queue.\n * @param httpContent httpContent\n */\n void addHttpContent(HttpContent httpContent);\n\n /**\n * Get the first httpContent from the queue.\n * @return HttpContent\n */\n HttpContent getHttpContent();\n\n /**\n * Get the first ByteBuffer version of the HttpContent from the queue.\n * @return ByteBuffer\n */\n ByteBuf getMessageBody();\n\n /**\n * Add the ByteBuffer version the httpContent to the queue.\n * @param msgBody ByteBuffer version of the httpContent.\n */\n void addMessageBody(ByteBuffer msgBody);\n\n /**\n * Check if the queue is empty.\n * @return true or false\n */\n boolean isEmpty();\n\n /**\n * Get the full message length.\n * @return message length\n */\n long getFullMessageLength();\n\n /**\n * Count the message length till the given message length and returns.\n * If the message length is shorter than the given length it returns with the\n * available message size. This method is blocking function. Hence, use with care.\n *\n * @param maxLength is the maximum length to count\n * @return counted length\n * @throws IllegalStateException if illegal state occurs in the absence of content\n */\n long countMessageLengthTill(long maxLength) throws IllegalStateException;\n\n /**\n * Complete the message.\n */\n void completeMessage();\n\n /**\n * This is need to release content before GC.\n */\n void waitAndReleaseAllEntities();\n}", "private ByteChunker nextChunker() {\n\t\tif(curChunker != null)\n\t\t\tcurChunker.dispose();\n\t\treturn curChunker = sendQ.poll();\n\t}", "RequestSender onRefuse(Consumer<Message> consumer);", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "protected void addChannelToReadCompletePendingQueue() {\n/* 354 */ while (!Http2MultiplexHandler.this.readCompletePendingQueue.offer(this)) {\n/* 355 */ Http2MultiplexHandler.this.processPendingReadCompleteQueue();\n/* */ }\n/* */ }", "public E poll()\r\n/* 117: */ {\r\n/* 118:322 */ E[] buffer = this.consumerBuffer;\r\n/* 119:323 */ long index = this.consumerIndex;\r\n/* 120:324 */ long mask = this.consumerMask;\r\n/* 121: */ \r\n/* 122:326 */ long offset = LinkedArrayQueueUtil.modifiedCalcElementOffset(index, mask);\r\n/* 123:327 */ Object e = UnsafeRefArrayAccess.lvElement(buffer, offset);\r\n/* 124:328 */ if (e == null) {\r\n/* 125:330 */ if (index != lvProducerIndex()) {\r\n/* 126: */ do\r\n/* 127: */ {\r\n/* 128:337 */ e = UnsafeRefArrayAccess.lvElement(buffer, offset);\r\n/* 129:339 */ } while (e == null);\r\n/* 130: */ } else {\r\n/* 131:343 */ return null;\r\n/* 132: */ }\r\n/* 133: */ }\r\n/* 134:347 */ if (e == JUMP)\r\n/* 135: */ {\r\n/* 136:349 */ E[] nextBuffer = getNextBuffer(buffer, mask);\r\n/* 137:350 */ return newBufferPoll(nextBuffer, index);\r\n/* 138: */ }\r\n/* 139:353 */ UnsafeRefArrayAccess.soElement(buffer, offset, null);\r\n/* 140:354 */ soConsumerIndex(index + 2L);\r\n/* 141:355 */ return e;\r\n/* 142: */ }", "@Override\n\tpublic void run() {\n\t\tkafkaProducer.send(record);\n\t\tkafkaProducer.close();\n\t}", "synchronized void \n receivedLast() \n {\n closedByWriter = true;\n notifyAll();\n }", "@Override\n public Subscription addConsumer(ConnectionContext context,\n final ConsumerInfo info) throws Exception {\n if (++consumerCount == maxConsumers + (watchTopicAdvisories ? 1:0)) {\n context.setDontSendReponse(true);\n Executors.newSingleThreadExecutor().execute(new Runnable() {\n public void run() {\n LOG.info(\"Stopping broker on consumer: \" + info.getConsumerId());\n try {\n broker.stop();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n });\n }\n return super.addConsumer(context, info);\n }", "public FreebaseProducerImpl()\n {\n this.queue = new ArrayBlockingQueue<>(DEFAULT_QUEUE_CAPACITY);\n this.file = null;\n }", "public void consume() throws InterruptedException {\n int count = 0;\n while (true) {\n synchronized (this) {\n // consumer thread waits while list\n // is empty\n while (hydrogen.size() <= 1 || oxygen.size() == 0)\n wait();\n\n // to retrive the ifrst job in the list\n hydrogen.removeFirst();\n hydrogen.removeFirst();\n oxygen.removeFirst();\n count += 1;\n\n\n System.out.println(\"Consumer consumed-\"\n + count);\n\n // Wake up producer thread\n notify();\n\n // and sleep\n Thread.sleep(5000);\n }\n }\n }" ]
[ "0.64033204", "0.63426465", "0.61502045", "0.61079", "0.6074678", "0.60518795", "0.60385615", "0.6007881", "0.59675026", "0.59452266", "0.593747", "0.59323937", "0.59023035", "0.58977556", "0.5885339", "0.58381844", "0.5828321", "0.58020693", "0.5782161", "0.57792646", "0.57717615", "0.57530046", "0.5737086", "0.5733639", "0.5711844", "0.569835", "0.569498", "0.5684282", "0.5660201", "0.5644101", "0.5641414", "0.5636144", "0.5606418", "0.5604136", "0.559076", "0.5560641", "0.55567896", "0.5550782", "0.5546959", "0.5521256", "0.55189914", "0.551697", "0.5499262", "0.54917175", "0.5489623", "0.54895544", "0.54806477", "0.54794663", "0.5476919", "0.54756606", "0.5463296", "0.54552007", "0.54523194", "0.5447928", "0.5447107", "0.5442393", "0.5432724", "0.5429771", "0.54287696", "0.5425578", "0.541589", "0.5413796", "0.54069245", "0.5406668", "0.53975147", "0.5388711", "0.5387848", "0.53872067", "0.5382733", "0.53779024", "0.53732693", "0.5368085", "0.53594744", "0.53555864", "0.5350153", "0.53467226", "0.5346057", "0.5344504", "0.53285855", "0.5323196", "0.53208727", "0.5318154", "0.5317905", "0.5317783", "0.53155404", "0.53089046", "0.530667", "0.53055346", "0.5304639", "0.5304149", "0.530207", "0.5301558", "0.53009945", "0.52989393", "0.5297337", "0.5295771", "0.5294071", "0.5291772", "0.52909774", "0.52864176", "0.52845854" ]
0.0
-1
A empty service order with just the vin, techID, and dealershipID for cars that just came in so not much is know
ServiceOrder(String carVIN, int techID, int dealershipID, String serviceDate){ serviceNumber++; this.carVIN = carVIN; this.techID = techID; this.dealershipID = dealershipID; this.serviceDate = serviceDate; this.serviceDesc = "None"; this.partsUsed = "None"; this.partsCost = 0; this.totalCost = 0; this.laborHours = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ServiceOrder(String carVIN, String serviceDesc, String serviceDate, String partsUsed, int techID, int dealershipID, double partsCost, double totalCost, double laborHours){\n serviceNumber++;\n this.serviceDate = serviceDate;\n this.carVIN = carVIN;\n this.serviceDesc = serviceDesc;\n this.partsUsed = partsUsed;\n this.techID = techID;\n this.dealershipID = dealershipID;\n this.partsCost = partsCost;\n this.totalCost = totalCost;\n this.laborHours = laborHours;\n }", "public ServiceOrderRecord() {\n super(ServiceOrder.SERVICE_ORDER);\n }", "public TIdAddPotentialServicesEntity() {\n\t\tsuper();\n }", "public ServiceOrderRecord(Integer orderId, Integer storeId, String orderSn, Integer userId, Byte orderStatus, String orderStatusName, String subscriber, String mobile, Integer serviceId, Integer technicianId, String technicianName, String serviceDate, String servicePeriod, String addMessage, String adminMessage, String verifyCode, String verifyAdmin, String payCode, String payName, String paySn, BigDecimal moneyPaid, BigDecimal discount, Integer couponId, BigDecimal orderAmount, Timestamp payTime, Timestamp cancelledTime, Timestamp finishedTime, String prepayId, Byte delFlag, Byte verifyType, String cancelReason, Byte type, Byte verifyPay, String aliTradeNo, Timestamp createTime, Timestamp updateTime, String memberCardNo, BigDecimal memberCardBalance, BigDecimal useAccount) {\n super(ServiceOrder.SERVICE_ORDER);\n\n set(0, orderId);\n set(1, storeId);\n set(2, orderSn);\n set(3, userId);\n set(4, orderStatus);\n set(5, orderStatusName);\n set(6, subscriber);\n set(7, mobile);\n set(8, serviceId);\n set(9, technicianId);\n set(10, technicianName);\n set(11, serviceDate);\n set(12, servicePeriod);\n set(13, addMessage);\n set(14, adminMessage);\n set(15, verifyCode);\n set(16, verifyAdmin);\n set(17, payCode);\n set(18, payName);\n set(19, paySn);\n set(20, moneyPaid);\n set(21, discount);\n set(22, couponId);\n set(23, orderAmount);\n set(24, payTime);\n set(25, cancelledTime);\n set(26, finishedTime);\n set(27, prepayId);\n set(28, delFlag);\n set(29, verifyType);\n set(30, cancelReason);\n set(31, type);\n set(32, verifyPay);\n set(33, aliTradeNo);\n set(34, createTime);\n set(35, updateTime);\n set(36, memberCardNo);\n set(37, memberCardBalance);\n set(38, useAccount);\n }", "Service(){\r\n\t\tserviceName =\"x\";\r\n\t\tserviceID = 0;\r\n\t\tserviceFee = 0.0;\r\n\t\tserviceDescrp = \"zztop\";\r\n\t}", "@Override\n\tpublic void returnVehicleForService(Integer vehicle_number) {\n\n\t}", "@Transactional\r\n public String createServiceOrder(Transaction transaction) throws AncestorNotFoundException{\n \tString statusCode = dao.getServiceOrdeStatusCode(transaction.getId());\r\n \tif(\"CA\".equals(statusCode) || \"CV\".equals(statusCode)){\r\n \t\tString errMsg = String.format(cancellationException);\r\n log.info(errMsg);\r\n throw new AncestorNotFoundException(errMsg);\r\n \t}//SL-19776 end\r\n //SL-18883: CLONE - Duplicate Service Orders is being created for a single external order number\r\n //Adding code to prevent processing of data for creating service order object in case unique composite key constraint fails \r\n \tlog.info(\"Adding entry inside table to prevent duplicate service orders getting created with same external order number\");\r\n \tdao.saveExternalOrderNumber(transaction); \r\n log.info(\"Starting to create the service order IntegrationBO.createServiceOrder\");\r\n \t//cloning service order object in case we have to retry for deadlocks\r\n ServiceOrder so = cloneObjectUsingJAXBSerialization(transaction.getServiceOrder());\r\n //sl-16667\r\n if(null != so){\r\n \tso.setNewSoInjection(true);\r\n }\r\n Map<String,Object> processVariables = commonTransactionHelper.createProcessVarsForTxOrder(transaction);\r\n\r\n Identification buyerIdentification = commonTransactionHelper.createBuyerIdentification(transaction);\r\n String soId = processingBO.executeCreateWithGroups(buyerIdentification,so,processVariables);\r\n log.debug(\"ServiceOrder created successfully: \" + soId);\r\n transaction.setServiceLiveOrderId(soId);\r\n\r\n dao.markCompleted(transaction);\r\n log.info(\"IntegrationBO.createServiceOrder Completed!\" + transaction.getId());\r\n\r\n return soId;\r\n }", "public interface OrderService {\n\n /**\n * Returns route time\n * @param routeDTO route data transfer object\n * @param orderDTO order dto for building route\n * @return\n */\n Long getRouteTime(RouteDTO routeDTO, OrderDTO orderDTO);\n\n /**\n * Returns drivers from database by specified order duration and order dto\n * @param time order duration\n * @param orderDTO order dto for building a route\n * @return linked hash map, key - drivers' id, value - drivers\n */\n LinkedHashMap<Long, Driver> getDriversForOrder(Long time, OrderDTO orderDTO);\n\n /**\n * Returns trucks from database by specified weight of cargoes\n * @param weight cargoes's weight\n * @return linked hash map, key - trucks' id, value - trucks\n */\n LinkedHashMap<Long, Truck> getTrucksForOrder(Long weight);\n\n /**\n * Specifies drop locations for picked up cargoes\n * @param routeDTO route dto with route points\n * @param points temp collection for building sub route\n */\n void setDropLocations(RouteDTO routeDTO, List<RoutePointDTO> points);\n\n /**\n * Returns weight of cargoes\n * @param routePointDTO temp route point dto with cargo or drop location\n * @param points already built route as list of ordered route points\n * @param weight previous weight data before adding new route point\n * @return weight\n */\n Long getWeight(RoutePointDTO routePointDTO, List<RoutePointDTO> points, Long weight);\n\n /**\n * Adds new route point to the route\n * @param routePointDTO new route point dto\n * @param routeDTO route data transfer object\n * @param points route as an ordered list of route points dtos\n */\n void newRoutePoint(RoutePointDTO routePointDTO, RouteDTO routeDTO, List<RoutePointDTO> points);\n\n /**\n * Returns all cities from database\n * @return linked hash map of cities, key - cities' id\n */\n LinkedHashMap<Long, City> getAllCitiesMap();\n\n /**\n * Adds order to a database\n * @param routeDTO route for building path for the order\n * @param orderDTO complex order data\n */\n void saveOrder(RouteDTO routeDTO, OrderDTO orderDTO);\n\n /**\n * Returns orders' from database as dtos\n * @return unsorted list of orders' data transfer objects\n */\n List<OrderDTO> getAllOrdersDTO();\n\n /**\n * Returns route points for order\n * @param order order entity for getting specified route points\n * @return unsorted list of route points\n */\n List<RoutePoint> getRoutePointsForOrder(Order order);\n\n /**\n * Returns cities dto adopted for RESTful architecture\n * @param id order id for retrieving data from database\n * @return unsorted list of cities as dtos adopted for RESTful architecture\n */\n List<CityDTORest> getRoutePointsForOrder(Long id);\n\n /**\n * Returns cargoes from database for the given order dto\n * @param orderDTO order dto\n * @return unsorted list of cargoes\n */\n List<Cargo> getCargoesForOrder(OrderDTO orderDTO);\n\n /**\n * Deletes order from database\n * @param id order's id for deletion\n */\n void deleteOrder(Long id);\n\n /**\n * Updates order\n * @param order order entity for updating\n */\n void updateOrder(Order order);\n\n /**\n * Return orders as dtos adopted for RESTful architecture\n * @return unsorted list of orders dtos adopted for RESTful architecture\n */\n List<OrderDTORest> getAllOrdersDTORest();\n\n /**\n * Delete temp route point dto from the route dto\n * @param routePoint temp route point dto\n * @param routeDTO route dto collected already built route\n */\n void deleteRoutePoint(String routePoint, RouteDTO routeDTO);\n\n /**\n * Processes new route point, recalculates distance and weight\n * @param orderDTO order dto\n * @param routeDTO route dto\n * @param routePointDTO new route point\n * @return temp cargoes weight\n */\n Long tempProcessPoint(OrderDTO orderDTO, RouteDTO routeDTO, RoutePointDTO routePointDTO);\n}", "void addService(Long orderId, Long serviceId);", "public ServiceCompte() {\n\t\tsuper();\n\t}", "public com.kcdataservices.partners.kcdebdmnlib_hva.businessobjects.service.v1.Service getServiceReq(Service service){\n\t\tcom.kcdataservices.partners.kcdebdmnlib_hva.businessobjects.service.v1.Service serviceReq =\n\t\t\tnew com.kcdataservices.partners.kcdebdmnlib_hva.businessobjects.service.v1.Service();\n\t\t\n\t\tserviceReq.setServiceCode( service.getServiceCode() );\n\t\tserviceReq.setServiceName( service.getServiceName() );\n\t\tserviceReq.setGateway( service.getGateway() );\n\t\tserviceReq.setDestination( service.getDestination() );\n\t\tserviceReq.setAdultPrice( new Double( service.getAdultPrice() ) );\n\t\tserviceReq.setChild1Price( new Double( service.getChild1Price() ) );\n\t\tserviceReq.setChild2Price( new Double( service.getChild2Price() ) );\n\t\tserviceReq.setChild3Price( new Double( service.getChild3Price() ) );\n\t\tserviceReq.setChild1MinAge( new Byte( service.getChild1MinAge() ) );\n\t\tserviceReq.setChild2MinAge( new Byte( service.getChild2MinAge() ) );\n\t\tserviceReq.setChild3MinAge( new Byte( service.getChild3MinAge() ) );\n\t\tserviceReq.setChild1MaxAge( new Byte( service.getChild1MaxAge() ) );\n\t\tserviceReq.setChild2MaxAge( new Byte( service.getChild2MaxAge() ) );\n\t\tserviceReq.setChild3MaxAge( new Byte( service.getChild3MaxAge() ) );\n\t\tserviceReq.setCurrency( service.getCurrency() );\n\t\tserviceReq.setMaxQuantity( new Double( service.getMaxQuantity() ) );\n\t\tserviceReq.setUnitOfMeasure( service.getUnitOfMeasure() );\n\t\tserviceReq.setMandatory( new Boolean( service.isMandatory() ) );\n\t\tserviceReq.setFree( new Boolean( service.isFree() ) );\n\t\tserviceReq.setOccupancyBased( new Boolean( service.isOccupancyBased() ) );\n\t\tserviceReq.setDateSpecific( new Boolean( service.isDateSpecific() ) );\n\t\tserviceReq.setAllOrNothing( new Boolean( service.isAllOrNothing() ) );\n\t\tserviceReq.setWeightBased( new Boolean( service.isWeightBased() ) );\n\t\tserviceReq.setTierBased( new Boolean( service.isTierBased() ) );\n\t\tserviceReq.setGroupCode( service.getGroupCode() );\n\t\tserviceReq.setGroupDescription( service.getGroupDescription() );\n\t\tserviceReq.setMonday( new Boolean( service.isMonday() ) );\n\t\tserviceReq.setTuesday( new Boolean( service.isTuesday() ) );\n\t\tserviceReq.setWednesday( new Boolean( service.isWednesday() ) );\n\t\tserviceReq.setThursday( new Boolean( service.isThursday() ) );\n\t\tserviceReq.setFriday( new Boolean( service.isFriday() ) );\n\t\tserviceReq.setSaturday( new Boolean( service.isSaturday() ) );\n\t\tserviceReq.setSunday( new Boolean( service.isSunday() ) );\n\t\tserviceReq.setAdultQty( new Byte( service.getAdultQty() ) );\n\t\tserviceReq.setChild1Qty( new Byte( service.getChild1Qty() ) );\n\t\tserviceReq.setChild2Qty( new Byte( service.getChild2Qty() ) );\n\t\tserviceReq.setChild3Qty( new Byte( service.getChild3Qty() ) );\n\t\tserviceReq.setTravelAgentFee( new Double( service.getTravelAgentFee() ) );\n\t\tserviceReq.setFlightMaterialCode( service.getFlightMaterialCode() );\n\t\tserviceReq.setHotelMaterialCode( service.getHotelMaterialCode() );\n\t\tserviceReq.setParentItemRph(service.getParentItemRph() );\n\t\tserviceReq.setGuestAllocation( service.getGuestAllocation() );\n\t\tserviceReq.setTotalPrice( new Double( service.getTotalPrice() ) );\n\t\tserviceReq.setPosnr( service.getPosnr() );\n\t\tserviceReq.setOldPosnr( service.getOldPosnr() );\n\t\tif( service.getSelectedDate() != null ){\n\t\t\tserviceReq.setSelectedDate( this.getDate( service.getSelectedDate() ) );\n\t\t}\n\t\tif( service.getDepatureDate() != null ){\n\t\t\tserviceReq.setDepatureDate( this.getDate( service.getDepatureDate() ) );\n\t\t}\n\t\tif( service.getReturnDate() != null ){\n\t\t\tserviceReq.setReturnDate( this.getDate( service.getReturnDate() ));\n\t\t}\n\t\tif( (service.getAvailableDates() != null) && (service.getAvailableDates().size() > 0) ){\n\t\t\tfor(int i=0; i < service.getAvailableDates().size();i++){\n\t\t\t\tserviceReq.getAvailableDates().add( this.getDate( service.getAvailableDates().get(i) ) );\n\t\t\t}\n\t\t}\n\t\tif( (service.getServiceDescription() != null) && (service.getServiceDescription().size() > 0) ){\n\t\t\tfor(int i=0; i < service.getServiceDescription().size();i++){\n\t\t\t\tserviceReq.getServiceDescription().add( service.getServiceDescription().get(i) );\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn serviceReq;\n\t}", "public interface OrderService {\n\t\n\t/**\n\t * Gets all orders\n\t * \n\t * @return List of orders\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tList<Order> getOrderList() throws ServiceException;\n\t\n\t/**\n\t * Gets orders by certain status\n\t * \n\t * @param orderStatus\n\t * @return List of orders with specific status\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tList<Order> getOrderListByStatus(OrderStatusEnum orderStatus) throws ServiceException;\n\t\n\t/**\n\t * Adds new order\n\t * \n\t * @param order\n\t * @return 0 of adding is successful\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tint createNewOrder (Order order) throws ServiceException;\t\n\t\n\t/**\n\t * Gets order by id\n\t * \n\t * @param id\n\t * @return Order entity\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tOrder getOrder(int id) throws ServiceException;\t\n\t\n\t/**\n\t * Updates order status\n\t * \n\t * @param id\n\t * @param orderStatus\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tvoid updateOrderStatus(int id, OrderStatusEnum orderStatus) throws ServiceException;\t\n\t\n\t/**\n\t * Sets rejection reason for order\n\t * \n\t * @param id\n\t * @param reason\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tvoid rejectOrder(int id, String reason) throws ServiceException;\t\n\t\n\t/**\n\t * Sets damage amount for certain order\n\t * \n\t * @param id\n\t * @param totalAmount\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tvoid sendDamagesAmount(int id, int totalAmount) throws ServiceException;\t\n\t\n\t/**\n\t * Gets all orders of certain user\n\t * \n\t * @param userId\n\t * @return List of users orders\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tList<Order> getUserOrderList(int userId) throws ServiceException;\t\n\t\n\t/**\n\t * Checks if user unfinished and unpaid orders\n\t * \n\t * @param userId\n\t * @return false if users does not have unfinished orders\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tboolean checkForUnfinishedOrders (int userId) throws ServiceException;\t\n\t\n\t/**\n\t * Gets list of dates for which car is unavailable\n\t * \n\t * @param carId\n\t * @return List of dates\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tList<String> getResevedDatesList(int carId) throws ServiceException;\n}", "public OrderVO addOrder(String member_id, int order_pay, int delivery, String order_address, int order_fee, int order_status) {\n\t\t\n\t\tSystem.out.println(\"Service_addOrd Start\");\n\t\tOrderVO OrderVO = new OrderVO();\n\t\tOrderVO.setMember_id(member_id);\n\t\tOrderVO.setOrder_pay(order_pay);\n\t\tOrderVO.setDelivery(delivery);\n\t\tOrderVO.setOrder_address(order_address);\n\t\tOrderVO.setOrder_fee(order_fee);\n\t\tOrderVO.setOrder_status(order_status);\n\t\tdao.insert(OrderVO);\n\t\tSystem.out.println(\"ProINS¦¨¥\\\" + member_id );\n\t\treturn OrderVO;\n\t}\n\n\tpublic List<OrderVO> getAll() {\n\t\treturn dao.getAll();\n\t}\n\tpublic List<OrderVO> getAll(String member_id) {\n\t\treturn dao.getAllOrderByMemNo_All(member_id);\n\t}\n\tpublic List<OrderVO> getAll_Pay(String member_id) {\n\t\treturn dao.getAllOrderByMemNo_Pay(member_id);\n\t}\n\tpublic List<OrderVO> getAll_Com(String member_id) {\n\t\treturn dao.getAllOrderByMemNo_Com(member_id);\n\t}\n\tpublic List<OrderVO> getAll_Can(String member_id) {\n\t\treturn dao.getAllOrderByMemNo_Can(member_id);\n\t}\n\n\tpublic void complete_order(String order_id) {\n\t\tdao.complete_order(order_id);\n\t}\n\tpublic void cancel_order(String order_id) {\n\t\tdao.cancel_order(order_id);\n\t}\n\t\n\t\n\tpublic OrderVO getOneOrder(String order_id) {\n\t\tSystem.out.println(\"¨ì¹FGETONEPRODUCT\");\n\t\treturn dao.findByPrimaryKey(order_id);\n\t}\n\tpublic OrderVO UpdateStatus(String order_id,int order_status) {\n\t\tOrderVO OrderVO = new OrderVO();\n\t\tSystem.out.println(\"service update_status start\");\n\t\t\n\t\tOrderVO.setOrder_id(order_id);\n\t\tOrderVO.setOrder_status(order_status);\n\t\tdao.updatestatus(OrderVO);\n\t\tSystem.out.println(\"service update_status off\");\n\t\treturn OrderVO;\n\t}\n\tpublic OrderVO ProUpdate(String order_id,String member_id, int order_pay, int delivery, String order_address, int order_fee) {\n\t\tSystem.out.println(\"Service update start\");\n\t\tOrderVO OrderVO = new OrderVO();\n\t\tOrderVO.setOrder_id(order_id);\n\t\tOrderVO.setMember_id(member_id);\n\t\tOrderVO.setOrder_pay(order_pay);\n\t\tOrderVO.setDelivery(delivery);\n\t\tOrderVO.setOrder_address(order_address);\n\t\tOrderVO.setOrder_fee(order_fee);\n//\t\tOrderVO.setOrder_status(order_status);\n\t\t\n\t\tdao.update(OrderVO);\n\t\tSystem.out.println(\"Service update off \");\n\t\treturn OrderVO;\n\t}", "public Order(Integer id, Travel travel, double price, Hotel hotel, Transport transport, Date startDate, Date endDate) {\n this.id = id;\n this.travel = travel;\n this.price = price;\n this.hotel = hotel;\n this.transport = transport;\n this.startDate = startDate;\n this.endDate = endDate;\n }", "@Override\n\tpublic int addStationstoServices(Service serviceDTO) {\n\t\tcom.svecw.obtr.domain.Service serviceDomain = new com.svecw.obtr.domain.Service();\n\t\tserviceDomain.setSourceStationId(serviceDTO.getSourceStationId());\n\t\tserviceDomain.setDestinationStationId(serviceDTO.getDestinationStationId());\n\t\tserviceDomain.setServiceId(serviceDTO.getServiceId());\n\t\tSystem.out.println(serviceDTO.getServiceId());\n\t\t//System.out.println(serviceDTO.getDestinationStationId());\n\t\treturn iStationToService.addServiceToStation(serviceDomain);\n\t}", "public Order() {\n orderID = \"\";\n customerID = \"\";\n status = \"\";\n }", "private Order convertOrderElemeToOrderObj04(ISqlAdapter adapter, String orderId) throws HitspException {\n SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\r\n SimpleDateFormat formatter = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss\");\r\n DataTable dtOrderEleme = getOrderElemeInfo(adapter, orderId);\r\n if (dtOrderEleme == null || dtOrderEleme.size() == 0) {\r\n return null;\r\n }\r\n\r\n Order order = new Order();\r\n if (!Converter.toBoolean(dtOrderEleme.get(0, \"book\"))) {\r\n //若该订单非预订单\r\n order.setDeliverTime(null);\r\n } else {\r\n //若该订单为预订单\r\n formatter.setTimeZone(TimeZone.getTimeZone(\"GMT+8\"));\r\n// Date b = formatter.parse(a);\r\n// order.setDeliverTime(Converter.toDate(dtOrderEleme.get(0, \"deliverTime\")));\r\n try {\r\n order.setDeliverTime(formatter.parse(dtOrderEleme.get(0, \"deliverTime\")));\r\n } catch (ParseException e) {\r\n logger.error(\"预计送达时间处理错误\");\r\n }\r\n }\r\n order.setOrderId(dtOrderEleme.get(0, \"orderId\"));\r\n order.setId(Converter.toLong(orderId));\r\n\r\n String udate = dtOrderEleme.get(0, \"activeAt\");\r\n String cdate = dtOrderEleme.get(0, \"createdAt\");\r\n try {\r\n Date uDate = df.parse(udate);\r\n Date cDate = df.parse(cdate);\r\n order.setGmtCreate(cDate);\r\n order.setGmtModify(uDate);\r\n } catch (ParseException e) {\r\n logger.error(\"下单时间处理错误\");\r\n }\r\n\r\n order.setOrderFrom(\"15\");\r\n order.setTotalPrice(Converter.toBigDecimal(dtOrderEleme.get(0, \"totalPrice\")));\r\n order.setOriginalPrice(Converter.toBigDecimal(dtOrderEleme.get(0, \"originalPrice\")));\r\n order.setStatus(\"0\");\r\n String elemeShopId = dtOrderEleme.get(0, \"shopId\");\r\n DataTable dtShop = getShopInfoByElemeShopId(adapter, elemeShopId);\r\n if (dtShop == null || dtShop.size() == 0) {\r\n logger.error(\"饿了么({})门店不存在\", elemeShopId);\r\n return null;\r\n }\r\n\r\n order.setShopId(dtShop.get(0, \"id\"));\r\n order.setShopName(dtShop.get(0, \"name\"));\r\n// order.setShopAddress(dtOrderEleme.get(0, \"address\"));\r\n order.setShopAddress(\"\");//饿了么推送订单中无门店地址,暂置为空\r\n order.setShopPhone(null);\r\n order.setRecipientName(dtOrderEleme.get(0, \"consignee\"));\r\n order.setRecipientAddress(dtOrderEleme.get(0, \"deliveryPoiAddress\"));\r\n\r\n StringBuilder phones = new StringBuilder();\r\n JSONArray phoneList = JSON.parseArray(dtOrderEleme.get(0, \"phoneList\"));\r\n if (phoneList != null) {\r\n for (int i = 0; i < phoneList.size(); i++) {\r\n String phone = phoneList.getString(i);\r\n if (i != 0) {\r\n phones.append(\";\");\r\n }\r\n phones.append(phone);\r\n }\r\n }\r\n order.setRecipientPhone(phones.toString());\r\n\r\n order.setRecipientLongitude(Converter.toBigDecimal(dtOrderEleme.get(0, \"deliveryGeo\").split(\",\")[0]));\r\n order.setRecipientLatitude(Converter.toBigDecimal(dtOrderEleme.get(0, \"deliveryGeo\").split(\",\")[1]));\r\n order.setShippingType(\"10\");\r\n order.setShippingFee(dtOrderEleme.get(0, \"deliverFee\") == null ? BigDecimal.valueOf(0) : Converter.toBigDecimal(dtOrderEleme.get(0, \"deliverFee\")));\r\n order.setShipperName(null);\r\n order.setShipperPhone(null);\r\n order.setHasInvoiced(Converter.toBoolean(dtOrderEleme.get(0, \"invoiced\")));\r\n order.setInvoiceTitle(dtOrderEleme.get(0, \"invoice\"));\r\n order.setPackageFee(Converter.toBigDecimal(dtOrderEleme.get(0, \"packageFee\")));\r\n order.setPayType(Converter.toBoolean(dtOrderEleme.get(0, \"onlinePaid\")) == false ? \"1\" : \"2\");\r\n order.setCaution(dtOrderEleme.get(0, \"description\"));\r\n order.setRemark(\"\");\r\n BigDecimal shopPart = Converter.toBigDecimal(dtOrderEleme.get(0, \"shopPart\"));\r\n if (shopPart.signum() == -1) {\r\n shopPart = shopPart.abs();\r\n }\r\n order.setShopPart(shopPart);\r\n order.setShopIncome(Converter.toBigDecimal(dtOrderEleme.get(0, \"income\")));\r\n BigDecimal serviceFee = Converter.toBigDecimal(dtOrderEleme.get(0, \"serviceFee\"));\r\n if (serviceFee.signum() == -1) {\r\n serviceFee = serviceFee.abs();\r\n }\r\n order.setServiceFee(serviceFee);\r\n// List<OrderDetail> detailList = convertOrderElemeToOrderDetailList(adapter, dtOrderEleme);\r\n List<OrderDetail> detailList = convertOrderElemeToOrderDetailList04(adapter, dtOrderEleme, dtShop.get(0, \"id\"));\r\n order.setDetail(detailList);\r\n return order;\r\n }", "public Pricing checkoutVehicle(Card card) {\n return null;\n }", "public Services() {\n this.indexes = new ArrayList<Integer>();\n// this.indexes.add(ServiceTypes.NOSERVICES.getValue());\n this.services = new ArrayList<String>();\n// this.services.add(ServiceTypes.NOSERVICES.getKey());\n }", "@Override\n public String toString(){\n return \"\\n\"+String.valueOf(orderId) + \" $\"+String.valueOf(amount)+ \" Name:\"+String.valueOf(vendor);\n }", "@Test\n\tpublic void testOrderWithoutShoppingCart() {\n\t\ttry {\n\t\t\tassertEquals(orderService.order(order), null);\n\t\t} catch (OrderException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public M csolOrderNull(){if(this.get(\"csolOrderNot\")==null)this.put(\"csolOrderNot\", \"\");this.put(\"csolOrder\", null);return this;}", "public ArrayList<ServiceModel> getServiceModel(int idService) {\n ArrayList<ServiceModel> listService = new ArrayList<>();\n Cursor cursor;\n if (idService > 0)\n cursor = db.rawQuery(\"select *\"\n + \" from \" + DBSQLite.TABLE_SERVICE\n + \" where \" + DBSQLite.KEY_SERVICE_ID + \"=\" + idService, null);\n else\n cursor = db.rawQuery(\"select * from \" + DBSQLite.TABLE_SERVICE, null);\n\n if (cursor.moveToFirst()) {\n while (!cursor.isAfterLast()) {\n ServiceModel serviceModel = obtainServiceModelCursor(cursor);\n serviceModel.setServicePrice(serviceServicePrice.getServicePriceModel(serviceModel.getId()));\n\n listService.add(serviceModel);\n cursor.moveToNext();\n }\n }\n return listService;\n }", "public interface SuperOrderService {\n List<Order> queryForSettlement(Long customerId, Long carrierId, Date startDate, Date endDate);\n\n List<Order> queryForSettlement(Long customerId, Long carrierId, List<String> vins);\n\n List<Order> queryForSettlement(Map<String, Object> map);\n\n void updateForReconciliation(List<Long> orderDetailIds, boolean isReverse);\n\n void updateForTransfer(List<Long> orderDetailIds);\n\n void updateForSettlement(List<Long> orderDetailIds);\n\n List<Order> queryList(Map<String, Object> map);\n\n PageInfo<Order> queryList(Map<String, Object> map, int pageNum, int pageSize);\n\n List<OrderDetail> queryDetailByDetailIds(List<Long> detailIds);\n\n List<OrderDetail> queryDetailByOrderId(Long orderId);\n\n @Transactional\n void oneTouchOut(Long orderId, Long carrierId);\n\n void addSectionOrder(Order order);\n\n void addOrder(Order order);\n\n @Transactional\n void update(Order order);\n\n void checkDetailForOther(List<OrderDetail> details, boolean isSameCorp);\n\n void checkDetailForIn(List<OrderDetail> details);\n\n void checkOrder(Order order);\n}", "@Override\r\n\tpublic OrderInfo selectOne() {\n\t\treturn null;\r\n\t}", "List<Cargo> getCargoesForOrder(OrderDTO orderDTO);", "public interface OrderService {\n\n /**\n * Get Quote ID\n *\n * @return String id of quote\n */\n @POST(\"V1/carts/mine\")\n Observable<String> getQuoteID();\n\n /**\n * Add item to cart\n *\n * @param CartItemRequest\n * @return CartProductItem\n * @see CartProductItem\n */\n @POST(\"V1/carts/mine/items\")\n Observable<CartProductItem> addItemToCart(@Body CartItemRequest CartItemRequest);\n\n /**\n * @param mail\n * @return\n */\n @POST(\"V2/eshopping/store/clearCart/{mail}\")\n Observable<Integer> clearItemFromCart(@Path(\"mail\") String mail);\n\n /**\n * @param id\n * @return OrderDetail\n * @see OrderDetail\n */\n @GET(\"V1/orders/{order_id}\")\n Observable<OrderDetail> getOrderDetail(@Path(\"order_id\") Long id);\n\n /**\n * Get order detail list\n *\n * @param stringHashMap\n * @return ItemList\n * @see ItemList\n */\n @GET(\"V1/orders/?\")\n Observable<ItemList> getOrderDetailList(@QueryMap HashMap<String, String> stringHashMap);\n\n /**\n * @param shippingMethod\n * @return List of ShipmentMethodInfo\n * @see ShipmentMethodInfo\n */\n @POST(\"V1/carts/mine/estimate-shipping-methods\")\n Observable<List<ShipmentMethodInfo>> estimateShippingMethods(@Body ShippingMethod shippingMethod);\n\n /**\n * @param shippingBilling\n * @return CheckoutResponse\n * @see CheckoutResponse\n */\n @POST(\"V1/carts/mine/shipping-information\")\n Observable<CheckoutResponse> summitShipment(@Body ShippingBilling shippingBilling);\n\n /**\n * @param orderProduct\n * @return List of Bulk Order\n */\n @POST(\"V2/eshopping/store/orderProduct\")\n Observable<List<String>> bulkOrder(@Body OrderProduct orderProduct);\n\n /**\n *\n * @param id\n * @return\n */\n @GET(\"V2/eshopping/order/getAddressLatitudeLongitude/{order_id}\")\n Observable<List<String>> getOrderDetailLatLng(@Path(\"order_id\") Long id);\n\n /**\n *\n * @param id\n * @return\n */\n @GET(\"V2/eshopping/order/getServiceFee/{order_id}\")\n Observable<String> getOrderServiceFee(@Path(\"order_id\") Long id);\n\n /**\n *\n * @param id\n * @return\n */\n @GET(\"V2/eshopping/order/getDeliveryDate/{order_id}\")\n Observable<String> getDeliveryDate(@Path(\"order_id\") Long id);\n\n /**\n *\n * @param id\n * @return\n */\n @GET(\"V2/eshopping/order/getDeliveryComment/{order_id}\")\n Observable<String> getOrderComment(@Path(\"order_id\") Long id);\n\n /**\n *\n * @param incrementId\n * @return\n */\n @GET(\"V2/eshopping/order/getItemsByIncrementId/{increment_id}\")\n Observable<List<ProductItem>> getOrderItems(@Path(\"increment_id\") String incrementId);\n\n /**\n * @see OrderItem\n * @param orderId orderId\n * @return List of OrderItem\n */\n @GET(\"V2/eshopping/order/visibaleItem/{orderId}\")\n Observable<List<OrderItem>> getOrderItemsByOrderId(@Path(\"orderId\") Long orderId);\n\n /**\n * get order status comment\n * @param orderId Long\n * @return List of OrderStatus\n */\n @GET(\"V2/eshopping/order/statusHistories/{orderId}\")\n Observable<List<OrderStatus>> getOrderStatusComment(@Path(\"orderId\") Long orderId);\n\n /**\n * Get driver location history\n * @param orderId Long\n * @return List<DriverLocation>\n */\n @GET(\"V2/eshopping/driver/getDriverLocationByOrderId/{orderId}\")\n Observable<List<DriverLocation>> getLocationHistoryByOrderId(@Path(\"orderId\") Long orderId);\n\n /**\n * Get last driver location history\n * @param orderId Long\n * @return List<DriverLocation>\n */\n @GET(\"V2/eshopping/driver/getDriverLastLocation/{orderId}\")\n Observable<List<DriverLocation>> getLastDriverLocationByOrderId(@Path(\"orderId\") Long orderId);\n\n /**\n *\n * @param orderId\n * @return\n */\n @GET(\"V2/eshopping/driver/getDriverInfoByOrderId/{orderId}\")\n Observable<List<DriverInfo>> getDriverInfoByOrderId(@Path(\"orderId\") Long orderId);\n}", "public interface OrderService {\n\n /**\n * 司机发布信息\n *\n * @param idno\n * @param driverShareInfo\n * @return\n */\n DriverShareInfo shareDriverInfo(String idno, DriverShareInfo driverShareInfo);\n\n /**\n * 乘客预定校验\n *\n * @param idno\n * @param driverOrderId\n * @param passerOrderId\n * @param genToken\n * @return\n */\n Result passerReserveCheck(String idno, Long driverOrderId, Long passerOrderId, boolean genToken);\n\n /**\n * 乘客预定\n *\n * @param radomToken\n * @param idno\n * @param driverOrderId\n * @param passerOrderId\n * @return\n */\n Result passerReserve(String radomToken, String idno, Long driverOrderId, Long passerOrderId);\n\n\n}", "protected abstract Order getOrder( int O_W_ID, int O_D_ID, Integer NO_O_ID, int O_CARRIER_ID );", "public void clearOrder()\r\n\t{\r\n\t\tsubtotal = new BigDecimal(\"0.0\");\r\n\t\torderSize = 0;\r\n\t\tSystem.out.println(\"Starting a new order\");\r\n\t\tModelEvent me = new ModelEvent(this,0,\"New Order\",0);\r\n\t\tnotifyChanged(me);\r\n\t}", "@Override\n\tpublic int addService(Service serviceDTO) {\n\t\tcom.svecw.obtr.domain.Service serviceDomain = new com.svecw.obtr.domain.Service();\n\t\tserviceDomain.setSourceId(serviceDTO.getSourceId());\n\t\tserviceDomain.setDestinationId(serviceDTO.getDestinationId());\n\t\tserviceDomain.setNoOfSeats(serviceDTO.getNoOfSeats());\n\t\tserviceDomain.setFare(serviceDTO.getFare());\n\t\tserviceDomain.setDistance(serviceDTO.getDistance());\n\t\tserviceDomain.setJourneyDate(serviceDTO.getJourneyDate());\n\t\tserviceDomain.setArrivalTime(serviceDTO.getArrivalTime());\n\t\tserviceDomain.setDepartureTime(serviceDTO.getDepartureTime());\n\t\tserviceDomain.setStatus(serviceDTO.getStatus());\n\t\treturn iServiceDAO.addService(serviceDomain);\n\t}", "@Override\n\tpublic Servicos pesquisar(int idServicos) throws SQLException {\n\t\treturn null;\n\t}", "public Order() {\n\t\tsuper();\n\t\tcurrentOrder += 1;\n\t\torderNumber = currentOrder;\n\t\tthis.orderPrice.setScale(2, BigDecimal.ROUND_HALF_EVEN);\n\t}", "public interface PurchaseOrderService {\n /**\n * create Purchase Order From Boq.\n * @param boqDetail boqDetail\n * @param appUser appUser\n * @return PurchaseOrderHeader\n */\n PurchaseOrderHeader createPoFromBoq(BoqDetail boqDetail, AppUser appUser);\n /**\n * add lines to Purchase Order Header.\n * @param purchaseOrderHeader purchaseOrderHeader\n * @param boqDetail boqDetail\n * @return boolean\n */\n boolean addLineToPoFromBoqDetail(PurchaseOrderHeader purchaseOrderHeader, BoqDetail boqDetail);\n\n /**\n * save Purchase Order Header into database.\n * @param purchaseOrderHeader purchaseOrderHeader\n * @param securityContext securityContext\n * @return response\n */\n CommonResponse savePurchaseOrder(PurchaseOrderHeader purchaseOrderHeader, SecurityContext securityContext);\n\n /**\n * get all purchase Order Header.\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderHeaders();\n\n /**\n * get PurchaseOrderHeader whole oblect per pohId.\n * @param pohId pohId.\n * @return PurchaseOrderHeader\n */\n PurchaseOrderHeader getPurchaseOrderHeaderWhole(long pohId);\n /**\n /**\n * get product purchase items for specific supplier.\n * @param suppId suppId\n * @param searchStr searchStr\n * @return List of PruductPurchaseItem\n */\n List<ProductPurchaseItem> getAllSupplierProductPurchaseItems(long suppId, String searchStr);\n /**\n * get all purchase Order Header.\n * @param supplierId supplierId\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderHeaderPerOrguIdAndSupplierIdAndStatusCode(long supplierId);\n\n /**\n * get all purchase Order Header per orguid and status.\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderHeaderNotFullyReceived();\n\n /**\n * get all purchase Order Header for specific supplier.\n * @param supplierId supplierId\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderHeaderPerOrguIdAndSupplierId(long supplierId);\n /**\n * search purchase order header.\n * @param searchForm searchForm\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> searchPurchaseOrderHeaders(GeneralSearchForm searchForm);\n\n /**\n * get product purchase item for specific supplier and catalog no.\n * @param suppId suppId\n * @param catalogNo catalogNo\n * @return List of PruductPurchaseItem\n */\n ProductPurchaseItem getSupplierProductPurchaseItemPerCatalogNo(long suppId, String catalogNo);\n\n /**\n * get all purchase Order Header for specific product.\n * @param prodId prodId\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseLine> getAllPurchaseOrderOfProduct(long prodId);\n\n /**\n * search purchase order header.\n * @param searchForm searchForm\n * @return List of PurchaseOrderHeader\n */\n GeneralSearchForm searchPurchaseOrderHeadersPaging(GeneralSearchForm searchForm);\n /**\n * create Purchase Order From Boq.\n * @param txnDetail sale order detail\n * @param appUser appUser\n * @return PurchaseOrderHeader\n */\n PurchaseOrderHeader createPoFromSaleOrder(TxnDetail txnDetail, AppUser appUser);\n\n /**\n * add lines to Purchase Order Header from txn detail.\n * @param purchaseOrderHeader purchaseOrderHeader\n * @param txnDetail txnDetail\n * @return true if successfull, otherwise return false;\n */\n boolean addLineToPoFromTxnDetail(PurchaseOrderHeader purchaseOrderHeader, TxnDetail txnDetail);\n\n /**\n * get all purchase order headers linked to specific sale order.\n * @param txhdId transaction header id.\n * @return List of purchase order linked to sale order\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderOfSaleOrder(long txhdId);\n\n /**\n * update status of linked BOQ.\n * @param pohId purchaes order header id.\n */\n void updatePurchaseOrderLinkedBoqStatus(long pohId);\n\n /**\n * delete purchase order per poh id.\n * @param pohId pohId\n * @return CommonResponse.\n */\n CommonResponse deletePurchaseOrderPerPhoId(long pohId);\n\n /**\n * update order status of linked sales orders.\n * @param pohId purchaes order header id.\n */\n void updatePurchaseOrderLinkedSaleOrderStatus(long pohId);\n\n /**\n * get all IN-PROGRESS and CONFIRMED purchase Order Header.\n * @param supplierId supplierId\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllOutstandingAndConfirmedPurchaseOrderHeaderPerOrguIdAndSupplierId(long supplierId);\n\n\n /**\n * get product purchase item for specific supplier and catalog no.\n * @param sprcId sprcId\n * @return List of PruductPurchaseItem\n */\n ProductPurchaseItem getProductPurchaseItemPerId(long sprcId);\n}", "public String getServiceOrderNumber() {\n return serviceOrderNumber.get();\n }", "private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, com.drore.cloud.tdp.service.IWsPmsSdkServiceStub.GetVehicleInfoPage param, boolean optimizeContent)\n throws org.apache.axis2.AxisFault{\n\n \n try{\n\n org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();\n emptyEnvelope.getBody().addChild(param.getOMElement(com.drore.cloud.tdp.service.IWsPmsSdkServiceStub.GetVehicleInfoPage.MY_QNAME,factory));\n return emptyEnvelope;\n } catch(org.apache.axis2.databinding.ADBException e){\n throw org.apache.axis2.AxisFault.makeFault(e);\n }\n \n\n }", "public interface OrderService {\n /**\n * Save a order\n * \n * @param object\n * @return just saved profile\n */\n Order save(Order object);\n\n /**\n * Get all the order\n * \n * @return all the order\n */\n Collection<Order> getAll();\n\n /**\n * Get all the user profile filtered on user and project\n * \n * @param user\n * @param project\n * @param filterDate\n * @param filterDeliveredDate\n * @param filterStatus\n * @param firstResult\n * @param excludeCancelled\n * @param maxResult\n * @param sortProperty\n * @param isAscending\n * @return all the user profile\n */\n Collection<Order> get(User user, Project project, Date filterDate, Date filterDeliveredDate, OrderStatus filterStatus, boolean excludeCancelled, int firstResult,\n int maxResult, String sortProperty, boolean isAscending);\n\n /**\n * Remove a profile\n * \n * @param order\n */\n void remove(Order order);\n\n /**\n * Cancel an order\n * \n * @param order\n * @param user user is performing the action\n * \n */\n Order cancel(Order order, User user);\n\n /**\n * Return the order by id\n * \n * @param id\n * @return user with the passed email\n */\n Order getByID(String id);\n\n /**\n * place a new order\n * \n * @param order the new order to insert\n * @param project project relates to order\n * @param user user that place the order\n * @return\n */\n Order placeNewOrder(Order order, Project project, User user);\n\n /**\n * Creates a {@link ProductOrdered} with correct data, adds the new ProductOrdered to the Order, recalculates all the prices and discounts. <strong>NOT persists</strong>\n * \n * @param order\n * @param product\n * @param project\n * @param numberOfProds\n\n * @return\n */\n ProductOrdered addProductOrdered(Order order, Product product, Project project, int numberOfProds);\n\n /**\n * Remove a {@link ProductOrdered} from the given order, recalculates all the prices and discounts on the order.<strong>NOT persists</strong>\n * \n * @param order\n * @param productOrderedIndex position on the list of product to be removed\n * \n */\n void removeProductOrdered(Order order, int productOrderedIndex);\n\n /**\n * \n * @param user\n * @param project\n * @return\n */\n List<Date> getDates(User user, Project project);\n\n /**\n * \n * @param user\n * @param project\n * @return\n */\n List<Date> getDeliveredDates(User user, Project project);\n\n /**\n * Send mail notification, <b>Note</b>: <b>notificationEnabled</b> properties must be set to true\n * \n * @param order\n * @return\n */\n Order sendNotificationNewOrder(Order order);\n\n /**\n * Sets this order as in charge \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order setAsInCharge(Order order, User user);\n\n /**\n * Remove this order as in charge \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeInCharge(Order order, User user);\n\n /**\n * Sets this order as \"sent\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order setSentStatus(Order order, User user);\n\n /**\n * Remove this order as \"sent\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeSentStatus(Order order, User user);\n\n /**\n * Sets this order as \"delivered\" \n * \n * @param order\n * @param user user is performing the action\n * @param deliveredTime \n * @return\n */\n Order setDeliveredStatus(Order order, User user, Date deliveredTime);\n\n /**\n * Remove this order as \"delivered\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeDeliveredStatus(Order order, User user);\n\n /**\n * Sets this order as \"InvoiceApproved\" \n * \n * @param order\n * @param user user is performing the action\n * @param invoiceDate\n * @param invoiceDueDate \n * @return\n */\n Order setInvoiceApprovedStatus(Order order, User user);\n\n /**\n * Removes this order as \"InvoiceApproved\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeInvoiceApprovedStatus(Order order, User user);\n\n /**\n * Sets this order as \"InvoiceCreated\" \n * \n * @param order\n * @param user user is performing the action\n * @param invoiceDate\n * @param invoiceDueDate data di pagamento prevista \n * @return\n */\n Order setInvoiceCreatedStatus(Order order, User user, Date invoiceDate, Date invoiceDueDate);\n\n /**\n * Sets this order as \"PaidInvoice\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order setInvoicePaidStatus(Order order, User user);\n\n /**\n * Remove this order as \"InvoiceCreated\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeInvoiceCreatedStatus(Order order, User user);\n\n /**\n * Set the OrderStatus \n * \n * @param orderStatus\n * @param order\n * @param user user is performing the action\n * @return\n */\n Order setStatus(OrderStatus orderStatus, Order order, User user);\n\n /**\n * Set order on the given dates/project in charge\n * \n * @param user\n * @param project\n * @param date\n * @return\n */\n void setAsInCharge(User user, Project project, Date date);\n\n /**\n * Get products base on the given order properties\n * \n * @param order\n * @return\n */\n List<Product> getProducts(Order order);\n\n // /**\n // * \n // * @param o\n // * @return\n // */\n // Order applyDiscountIfApplicable(Order o);\n //\n // \n // /**\n // * \n // * @param o\n // * @return\n // */\n // Order applyFreeShippingCostIfApplicable(Order o);\n\n /**\n * \n * @param order\n * @return\n */\n boolean isOrderValid(Order order);\n\n String getNotesForDisplay(Order o);\n\n String getNotesForPDF(Order order);\n\n /**\n * Force discount on existing order <b>Use with caution</b>\n * \n * @param order\n * @param discountToAppply to the order\n * @return\n */\n Order modifyDiscountToOrder(Order order, int discountToAppply);\n\n /**\n * \n * @param o\n * @return the order, product ordered with the correct costs and discount applied\n */\n public abstract Order calculatesCostsAndDiscount(Order o);\n\n /**\n * \n * @param o\n * @param cost cost to apply\n * @param discountForced discount to be forced\n * @return\n */\n Order forcePriceAndDiscountAndRecalculate(Order o, BigDecimal cost, BigDecimal discountForced);\n\n}", "public interface OrderService {\n OrderDto makeOrder(OrderDto orderDto);\n\n List<OrderDto> getAllOrders(String userPhone);\n\n void removeOrderById(Long id);\n\n boolean getOrderById(Long id);\n\n List<OrderDto> getAllOrders();\n\n List<OrdersEntity> getOrders();\n\n OrderDto acceptOrder(OrderDto orderDto);\n\n List<OrderDto> getAcceptOrders(String driverPhone);\n\n OrderDto removeAcceptedOrder(Long id);\n}", "@PostMapping(value = \"/insertorderdetails\")\r\n public OrderInfo insertDummyOrder(@RequestBody OrderInfo order) \r\n\t\r\n\t{\r\n\t\treturn new OrderService().addOrder(order); //calling the service\r\n }", "public static void main(String[] args) throws Exception {\n\n System.out.println(\"###CustomerOrder Test###\");\n CustomerOrderService customerOrderService = new CustomerOrderService(new CustomerOrderDao());\n\n CustomerOrder customerOrder1 = new CustomerOrder(BigDecimal.valueOf(99.95), \"NEW\", \"1000\", 1, 1, 1);\n customerOrderService.addCustomerOrder(customerOrder1);\n\n System.out.println(\"getCustomerOrder(1): \" + customerOrderService.getCustomerOrder(1));\n System.out.println(\"getAllCustomerOrdersByCustId(1): \" + customerOrderService.getAllCustomerOrdersByCustId(1));\n\n System.out.println(\"getDetailedCustomerOrder(1): \" + customerOrderService.getDetailedCustomerOrder(1));\n\n System.out.println(\"getCustomerOrderStatus(1): \" + customerOrderService.getCustomerOrderStatus(1));\n \n\n CustomerOrder customerOrder2 = new CustomerOrder(1, BigDecimal.valueOf(88.88), \"SHIPPED\", \"2222\", 2, 2, 2);\n customerOrderService.updateCustomerOrder(customerOrder2);\n\n System.out.println(\"getCustomerOrder(1) - after update: \" + customerOrderService.getCustomerOrder(1));\n\n Payment payment1 = new Payment(1, \"PAYMENT\", \"PROCESSED\");\n customerOrderService.addPayment(payment1);\n\n System.out.println(\"getPayment(1): \" + customerOrderService.getPayment(1));\n customerOrderService.updatePayment(1, \"REFUNDED\");\n System.out.println(\"getPayment(1) - after status update: \" + customerOrderService.getPayment(1));\n\n System.out.println(\"getPaymentsByOrderId(1): \" + customerOrderService.getPaymentsByOrderId(1));\n\n CustomerOrderDetail customerOrderDetail1 = new CustomerOrderDetail(1, 3);\n customerOrderService.addCustomerOrderDetail(customerOrderDetail1);\n\n System.out.println(\"getCustomerOrderDetail(2): \" + customerOrderService.getCustomerOrderDetail(2));\n System.out.println(\"getCustomerOrderDetailsByOrderId(1): \" + customerOrderService.getCustomerOrderDetailsByOrderId(1));\n \n \n \n //Start of the Product test\n \n System.out.println(\"###Product Test###\"); \n ProductService productService = new ProductService(new ProductDao());\n\n Product productTest = new Product(1, \"1234\", \"ProductTest\", \"veryCool\", true, 1, 1, \"picture\");\n productService.createProduct(productTest);\n \n System.out.println(\"Select productTest by id: \" + productService.getProduct(4));\n \n System.out.println(\"select All Products: \" + productService.selectAllProducts());\n \n\n \n //End of product test\n \n //Partner test started\n \n System.out.println(\"###Partner Test###\"); \n PartnerService partnerService = new PartnerService(new PartnerDao());\n\n Partner partnerTest = new Partner(1, \"Myco\", \"6331 N Kenmore Ave\", \"Chicago\", \"IL\", \"60660\", \"USA\", \"800-556-8876\", \"[email protected]\", \"http://www.xyz.com/\", true);\n partnerService.createPartner(partnerTest);\n \n System.out.println(\"Select partnerTest by id: \" + partnerService.getPartner(1));\n \n System.out.println(\"select All Partners: \" + partnerService.selectAllPartner());\n \n \n //End of partner test\n }", "public interface OrderService {\n\n List<OrderInfoDto> getAllOrders();\n\n Long addNewOrder(OrderDto orderDto);\n\n OrderInfoDto getOrderInfoById(Long id);\n\n OrderDto getOrderById(Long id);\n\n void setTruckForOrder(Long orderId, Long truckId);\n\n void setDriverForOrder(Long orderId, Long driverId);\n\n void detachDriver(Long orderId, Long driverId);\n\n <T> T getCurrentOrderByDriverLogin(String login, Class<T> tClass);\n\n List<OrderInfoBoardDto> getOrdersInfo();\n\n List<CityDto> getRouteByOrderId(Long orderId);\n\n void addCityToRoute(Long orderId, List<Long> cityIdList);\n\n void removeCityFromRoute(Long orderId, Long cityId);\n\n void updateBoardUpdateOrder(Order order);\n\n void updateBoardUpdateOrder(String driverLogin);\n\n void closeOrder(Long orderId);\n\n boolean isAllPointsDoneByOrder(Order order);\n\n boolean isAllPointsDoneByOrderId(Long orderId);\n\n Order sortPathPointsByRoute(Order order);\n\n}", "@Override\n\tpublic void getSpecificOrders() {\n\t\t\n\t}", "@Override\n\tpublic void getSpecificOrders() {\n\t\t\n\t}", "public interface OrderService {\n\n MiaoshaOrder getMiaoshaOrderByUserIdGoodsId(long userId, long goodsId);\n\n OrderInfo createOrder(MiaoshaUser user, GoodsVo goods);\n\n OrderInfo getOrderById(long orderId);\n\n OrderInfo miaosha(MiaoshaUser user, GoodsVo goods);\n\n long getMiaoshaResult(Long userId, long goodsId);\n\n int updateOrderStatusById(OrderInfo orderInfo);\n\n int closeOrder(Date deadLine);\n}", "@Override\r\n\tpublic Order getOrderById(String orderId) {\n\t\treturn null;\r\n\t}", "public CreateOrderRequest() {\n\t\t_pcs = new PropertyChangeSupport(this);\n\t}", "public Order() {\n\t\tsuper();\n\t\titems = new HashMap<>();\n\t}", "CarAvailableCommand(CarService service){\n this.service=service;\n }", "@Test\n public void testOrderFactoryEmpty() {\n OrderController orderController = orderFactory.getOrderController();\n assertEquals(0, orderController.getOrders().size());\n }", "public Service getService(com.kcdataservices.partners.kcdebdmnlib_hva.businessobjects.service.v1.Service res){\n\t\tService service = new Service();\n\t\t\n\t\tservice.setServiceCode( res.getServiceCode() );\n\t\tservice.setServiceName( res.getServiceName() );\n\t\tservice.setGateway( res.getGateway() );\n\t\tservice.setCurrency( res.getCurrency() );\n\t\tservice.setDestination( res.getDestination() );\n\t\tservice.setUnitOfMeasure( res.getUnitOfMeasure() );\n\t\tservice.setGroupCode( res.getGroupCode() );\n\t\tservice.setGroupDescription( res.getGroupDescription() );\n\t\tservice.setFlightMaterialCode( res.getFlightMaterialCode() );\n\t\tservice.setHotelMaterialCode( res.getHotelMaterialCode() );\n\t\tservice.setParentItemRph( res.getParentItemRph() );\n\t\tservice.setGuestAllocation( res.getGuestAllocation() );\n\t\tservice.setPosnr( res.getPosnr() );\n\t\tservice.setOldPosnr( res.getOldPosnr() );\n\t\tif( res.isMandatory() != null ){\n\t\t\tservice.setMandatory( res.isMandatory().booleanValue() );\n\t\t}\n\t\tif( res.isFree() != null ){\n\t\t\tservice.setFree( res.isFree().booleanValue() );\n\t\t}\n\t\tif( res.isOccupancyBased() != null ){\n\t\t\tservice.setOccupancyBased( res.isOccupancyBased().booleanValue() );\n\t\t}\n\t\tif( res.isDateSpecific() != null ){\n\t\t\tservice.setDateSpecific( res.isDateSpecific().booleanValue() );\n\t\t}\n\t\tif( res.isAllOrNothing() != null ){\n\t\t\tservice.setAllOrNothing( res.isAllOrNothing().booleanValue() );\n\t\t}\n\t\tif( res.isWeightBased() != null ){\n\t\t\tservice.setWeightBased( res.isWeightBased().booleanValue() );\n\t\t}\n\t\tif( res.isTierBased() != null ){\n\t\t\tservice.setTierBased( res.isTierBased().booleanValue() );\n\t\t}\n\t\tif( res.isMonday() != null ){\n\t\t\tservice.setMonday( res.isMonday().booleanValue() );\n\t\t}\n\t\tif( res.isTuesday() != null ){\n\t\t\tservice.setTuesday( res.isTuesday().booleanValue() );\n\t\t}\n\t\tif( res.isWednesday() != null ){\n\t\t\tservice.setWednesday( res.isWednesday().booleanValue() );\n\t\t}\n\t\tif( res.isThursday() != null ){\n\t\t\tservice.setThursday( res.isThursday().booleanValue() );\n\t\t}\n\t\tif( res.isFriday() != null ){\n\t\t\tservice.setFriday( res.isFriday().booleanValue() );\n\t\t}\n\t\tif( res.isSaturday() != null ){\n\t\t\tservice.setSaturday( res.isSaturday().booleanValue() );\n\t\t}\n\t\tif( res.isSunday() ){\n\t\t\tservice.setSunday( res.isSunday().booleanValue() );\n\t\t}\n\t\tif( res.getSelectedDate() != null ){\n\t\t\tservice.setSelectedDate( this.getDate( res.getSelectedDate() ) );\n\t\t}\n\t\tif( res.getDepatureDate() != null ){\n\t\t\tservice.setDepatureDate( this.getDate( res.getDepatureDate() ) );\n\t\t}\n\t\tif( res.getReturnDate() != null ){\n\t\t\tservice.setReturnDate( this.getDate( res.getReturnDate() ) );\n\t\t}\n\t\tif( res.getAdultQty() != null ){\n\t\t\tservice.setAdultQty( res.getAdultQty().byteValue() );\n\t\t}\n\t\tif( res.getChild1Qty() != null ){\n\t\t\tservice.setChild1Qty( res.getChild1Qty().byteValue() );\n\t\t}\n\t\tif( res.getChild2Qty() != null ){\n\t\t\tservice.setChild2Qty( res.getChild2Qty().byteValue() );\n\t\t}\n\t\tif( res.getChild3Qty() != null ){\n\t\t\tservice.setChild3Qty( res.getChild3Qty().byteValue() );\n\t\t}\n\t\tif( res.getChild1MinAge() != null ){\n\t\t\tservice.setChild1MinAge( res.getChild1MinAge().byteValue() );\n\t\t}\n\t\tif( res.getChild2MinAge() != null ){\n\t\t\tservice.setChild2MinAge( res.getChild2MinAge().byteValue() );\n\t\t}\n\t\tif( res.getChild3MinAge() != null ){\n\t\t\tservice.setChild3MinAge( res.getChild3MinAge().byteValue() );\n\t\t}\n\t\tif( res.getChild1MaxAge() != null ){\n\t\t\tservice.setChild1MaxAge( res.getChild1MaxAge().byteValue() );\n\t\t}\n\t\tif( res.getChild2MaxAge() != null ){\n\t\t\tservice.setChild2MaxAge( res.getChild2MaxAge().byteValue() );\n\t\t}\n\t\tif( res.getChild3MaxAge() != null ){\n\t\t\tservice.setChild3MaxAge( res.getChild3MaxAge().byteValue() );\n\t\t}\n\t\tif( res.getTravelAgentFee() != null ){\n\t\t\tservice.setTravelAgentFee( res.getTravelAgentFee().doubleValue() );\n\t\t}\n\t\tif( res.getTotalPrice() != null ){\n\t\t\tservice.setTotalPrice( res.getTotalPrice().doubleValue() );\n\t\t}\n\t\tif( res.getMaxQuantity() != null ){\n\t\t\tservice.setMaxQuantity( res.getMaxQuantity().doubleValue() );\n\t\t}\n\t\tif( res.getAdultPrice() != null ){\n\t\t\tservice.setAdultPrice( res.getAdultPrice().doubleValue() );\n\t\t}\n\t\tif( res.getChild1Price() != null ){\n\t\t\tservice.setChild1Price( res.getChild1Price().doubleValue() );\n\t\t}\n\t\tif( res.getChild2Price() != null ){\n\t\t\tservice.setChild2Price( res.getChild2Price().doubleValue() );\n\t\t}\n\t\tif( res.getChild3Price() != null ){\n\t\t\tservice.setChild3Price( res.getChild3Price().doubleValue() );\n\t\t}\n\t\tif( (res.getAvailableDates() != null) && (res.getAvailableDates().size() > 0) ){\n\t\t\tservice.setAvailableDates( this.convertXMLGregorianCalendarList( res.getAvailableDates() ) );\n\t\t}\n\t\tservice.setServiceDescription( res.getServiceDescription());\n\t\t\n\t\treturn service;\n\t}", "public Vehicle()\n {\n name = \"none\";\n cost = 0;\n }", "private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, com.drore.cloud.tdp.service.IWsPmsSdkServiceStub.GetVehicleRecordPage param, boolean optimizeContent)\n throws org.apache.axis2.AxisFault{\n\n \n try{\n\n org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();\n emptyEnvelope.getBody().addChild(param.getOMElement(com.drore.cloud.tdp.service.IWsPmsSdkServiceStub.GetVehicleRecordPage.MY_QNAME,factory));\n return emptyEnvelope;\n } catch(org.apache.axis2.databinding.ADBException e){\n throw org.apache.axis2.AxisFault.makeFault(e);\n }\n \n\n }", "public com.trg.fms.api.Trip.Builder clearCarId() {\n carId = null;\n fieldSetFlags()[2] = false;\n return this;\n }", "public Vehicle() {\r\n\t\tthis.numOfDoors = 4;\r\n\t\tthis.price = 1;\r\n\t\tthis.yearMake = 2019;\r\n\t\tthis.make = \"Toyota\";\r\n\t}", "@Override\n\tpublic Service upstreamReserveDeliverServiceInit() {\n\t\treturn null;\n\t}", "public interface OrderService {\n /**\n * Create new order object and put it to database\n *\n * @param cart cart with data about new order\n * @param user session user - order owner\n * @throws FlowerValidationException if flowers count in cart more then count in shop\n * @see Cart\n */\n void create(Cart cart, User user) throws FlowerValidationException;\n\n /**\n * Change order status in database to PAID\n *\n * @param order order to update\n * @see flowershop.backend.enums.OrderStatus\n */\n void pay(Order order);\n\n /**\n * Change order status in database to CLOSED\n *\n * @param order order to update\n * @see flowershop.backend.enums.OrderStatus\n */\n void close(Order order);\n\n /**\n * Delete corresponding order object from database\n *\n * @param id order id to delete\n */\n void delete(Long id);\n\n /**\n * Find order in database with given id\n *\n * @param id order id\n * @return Order dto\n */\n Order find(Long id);\n\n /**\n * Get all orders from database\n *\n * @return orders list\n */\n List<Order> getAll();\n\n /**\n * Get all orders of given user from database\n *\n * @param user orders owner\n * @return orders list\n */\n List<Order> getByUser(User user);\n\n /**\n * Get items list (bought flowers) of given order\n *\n * @param order order to get details\n * @return items list (bought flowers)\n * @see OrderFlowerData\n */\n List<OrderFlowerData> getFlowersData(Order order);\n\n /**\n * Generates detailed cart from regular cart to represent data\n *\n * @param cart Cart to be detailed\n * @return DetailedCart\n * @see Cart\n * @see DetailedCart\n */\n DetailedCart generateDetailedCart(Cart cart);\n}", "@Test\n\tpublic void getOrderTest() {\n\t\tOrderDTO order = service.getOrder(2);\n\n\t\tassertEquals(3, order.getClientId());\n\t\tassertEquals(\"BT Group\", order.getInstrument().getName());\n\t\tassertEquals(\"BT\", order.getInstrument().getTicker());\n\t\tassertEquals(30.0, order.getPrice(), 1);\n\t\tassertEquals(500, order.getQuantity());\n\t\tassertEquals(OrderType.SELL, order.getType());\n\t}", "@Override\r\npublic List<OrderInfo> selectUnfinishedBuyOrderList(String comId) {\n\treturn OrderInfoMapper.selectUnfinishedBuyOrderList(comId);\r\n}", "public CustomerOrderDetails fallbackGetOrders(Long orderId) {\n\n\t\tCustomerOrderDetails orderDetails = CustomerOrderDetails.builder().orderId(0L)\n\t\t\t\t.externalReference(\"not available\").items(null).build();\n\n\t\treturn orderDetails;\n\n\t}", "public interface OrderService {\n\n /**\n * 查询订单列表\n *\n * @param userId userId\n * @param pageNum pageNum\n * @param pageSize pageSize\n * @return pageInfo\n */\n ServerResponse<PageInfo> list(Integer userId, int pageNum, int pageSize);\n\n /**\n * 创建订单\n *\n * @param userId userId\n * @param shippingId shippingId\n * @return orderVo\n */\n ServerResponse insert(Integer userId, Integer shippingId);\n\n /**\n * 取消订单\n *\n * @param userId userId\n * @param orderNo orderNo\n * @return 取消的结果\n */\n ServerResponse<String> delete(Integer userId, Long orderNo);\n\n /**\n * 查询购物车商品\n *\n * @param userId userId\n * @return orderProductVO\n */\n ServerResponse getOrderCartProduct(Integer userId);\n\n /**\n * 查询订单详情\n *\n * @param userId userId\n * @param orderNo orderNo\n * @return orderVo\n */\n ServerResponse<OrderVO> getOrderDetail(Integer userId, Long orderNo);\n\n /**\n * 管理员查询所有订单\n *\n * @param pageNum pageNum\n * @param pageSize pageSize\n * @return 订单列表\n */\n ServerResponse<PageInfo> listOfAdmin(int pageNum, int pageSize);\n\n /**\n * 查看订单详情\n *\n * @param orderNo orderNo\n * @return 订单详情\n */\n ServerResponse<OrderVO> detail(Long orderNo);\n\n /**\n * 搜索订单\n *\n * @param orderNo orderNo\n * @param pageNum pageNum\n * @param pageSize pageSize\n * @return 搜索结果\n */\n ServerResponse<PageInfo> search(Long orderNo, int pageNum, int pageSize);\n\n /**\n * 发货\n *\n * @param orderNo orderNo\n * @return 发货结果\n */\n ServerResponse<String> sendGoods(Long orderNo);\n\n /**\n * 订单支付\n *\n * @param userId userId\n * @param orderNo orderNo\n * @param path path\n * @return 支付结果\n */\n ServerResponse pay(Integer userId, Long orderNo, String path);\n\n /**\n * 支付宝回调\n *\n * @param params params\n * @return 更新结果\n */\n ServerResponse alipayCallback(Map<String, String> params);\n\n /**\n * 查询订单支付状态\n *\n * @param userId userId\n * @param orderNo orderNo\n * @return 支付状态\n */\n ServerResponse queryOrderPayStatus(Integer userId, Long orderNo);\n}", "void prepareOrder(int orderId);", "public interface OrderService {\n\n /**\n * Creates a new order\n *\n * @param orderDTO order dto\n *\n * @return order created\n */\n OrderDTO create(OrderDTO orderDTO);\n\n /**\n * Updates an order\n *\n * @param orderDTO order dto\n *\n * @return order updated\n */\n OrderDTO update(String id, OrderDTO orderDTO);\n\n /**\n * Deletes a new order\n *\n * @param id order id\n *\n * @return order deleted\n */\n OrderDTO delete(String id);\n\n /**\n * Find an order for its id\n *\n * @param id order id\n *\n * @return order found\n */\n OrderDTO findBy(String id);\n\n /**\n * Find all orders that belongs to a customer\n * if customerId is null or empty, retrieves all orders\n *\n * @param customerId id of a customer\n *\n * @return orders\n */\n List<OrderDTO> findAll(String customerId);\n}", "public List<String> retrieveServicesOfOrder(String orderID) {\r\n\t\tlogger.info(\"will retrieve ActiveServiceOfExternalPartners\" );\r\n\t\ttry {\r\n\t\t\t\r\n\t\t\tObject response = template.\r\n\t\t\t\t\trequestBody( CATALOG_GET_SERVICE_BY_ORDERID, orderID );\r\n\r\n\t\t\tlogger.debug(\"will retrieve ServicesOfOrder response: \" + response.getClass() );\r\n\t\t\tif ( !(response instanceof String)) {\r\n\t\t\t\tlogger.error(\"List object is wrong.\");\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\r\n\t\t\tString[] sor = toJsonObj( (String)response, String[].class ); \r\n\t\t\tlogger.debug(\"ServicesOfOrder response is: \" + response);\r\n\t\t\t\r\n\t\t\treturn Arrays.asList(sor);\r\n\t\t\t\r\n\t\t}catch (Exception e) {\r\n\t\t\tlogger.error(\"Cannot retrieve Listof ServicesOfOrder . \" + e.toString());\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public Vehicle(String carClass, BigDecimal price) {\n this.carClass = carClass;\n this.price = price;\n }", "public UsedCarLot2()\n {\n cars = new ArrayList<>();\n totalValue = 0;\n }", "public Service(int serviceID, String serviceName, double serviceFee, String serviceDescrp){\r\n\t\tthis.serviceName = serviceName;\r\n\t\tthis.serviceID = serviceID;\r\n\t\tthis.serviceFee = serviceFee;\r\n\t\tthis.serviceDescrp = serviceDescrp;\r\n\t}", "@Override\r\n\tprotected IAPIResponse executeOrderFulfillmentService(APIRequestVO apiVO) {\r\n\t\tProcessResponse cancelResponse = new ProcessResponse();\r\n\t\tOrderFulfillmentRequest ofRequest = null;\t\t\r\n\t\tString soId = apiVO.getSOId();\r\n\t\tint buyerId = apiVO.getBuyerIdInteger();\r\n\t\tSOCancelRequest soCancelRequest = (SOCancelRequest) apiVO.getRequestFromPostPut();\r\n\t\tcancelResponse.setCode(PublicAPIConstant.ONE);\r\n\t\t//Ensure that all the mandatory fields have actual values (excluding white spaces)\r\n\t\ttrimRequestElements(soCancelRequest);\r\n\t\tcancelResponse = validateMandatoryTags(soCancelRequest);\r\n\t\tif(!PublicAPIConstant.ONE.equals(cancelResponse.getCode())){\r\n\t\t\t//Create error response when request parameter mandatory validation failed.\r\n\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t}\r\n\t\tSecurityContext securityContext; \r\n\t\tif(PublicAPIConstant.BUYER_RESOURCE_ID.equalsIgnoreCase(soCancelRequest.getIdentification().getType())){\r\n\t\t\tsecurityContext = getSecurityContextForBuyer(apiVO.getBuyerResourceId());\r\n\t\t}else{\r\n\t\t\tsecurityContext = getSecCtxtForBuyerAdmin(buyerId);\r\n\t\t}\r\n\t\tServiceOrder so;\r\n\t\ttry {\r\n\t\t\tso = serviceOrderBO.getServiceOrder(soId);\r\n\t\t\t /* Validates the cancellation request.*/\r\n\t\t\tcancelResponse = validateCancelRequest(so, securityContext, soCancelRequest);\r\n\t\t} catch (Exception be) {\r\n\t\t\tLOGGER.error(be);\r\n\t\t\tcancelResponse.setMessage(be.getMessage());\r\n\t\t\tcancelResponse.setCode(ServiceConstants.SYSTEM_ERROR_RC);\r\n\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t}\r\n\t\t\r\n\t\tsetProviderAcknowledgement(soCancelRequest);\r\n\t\t//Use appropriate Signal based on the SO State (For draft/routed/expired use\r\n\t\t//cancellation through front specific signal SL_CANCEL_ORDER)\r\n\t\tSignalType signalType = getSignalType(so.getWfStateId().intValue());\r\n\t\tif ((PublicAPIConstant.ONE).equalsIgnoreCase(cancelResponse.getCode())) {\r\n\t\t\t//If request parameters are validated then create OF Request\r\n\t\t\ttry{\r\n\t\t\t\tofRequest = createOrderFulfillmentCancelSORequest(so, securityContext, soCancelRequest);\r\n\t\t\t}catch(Exception e){\r\n\t\t\t\tLOGGER.error(e);\r\n\t\t\t\tcancelResponse.setMessage(e.getMessage());\r\n\t\t\t\tcancelResponse.setCode(ServiceConstants.SYSTEM_ERROR_RC);\r\n\t\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(null == ofRequest){\r\n\t\t\t\tLOGGER.error(\"Error in fetching data from DB.\");\r\n\t\t\t\tcancelResponse.setMessage(CommonUtility\r\n\t\t\t\t\t\t.getMessage(PublicAPIConstant.cancelSO.DEFAULT_SYS_ERROR_MESSAGE));\r\n\t\t\t\tcancelResponse.setCode(ServiceConstants.SYSTEM_ERROR_RC);\r\n\t\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t//Create error response when request parameter validation failed.\r\n\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t}\r\n\t\t//OF call\r\n\t\tOrderFulfillmentResponse ofResponse = ofHelper\r\n\t\t\t\t.runOrderFulfillmentProcess(soId, signalType, ofRequest);\r\n\t\tif (!ofResponse.isSignalAvailable()) {\r\n\t\t\t//Create So Cancellation response when Signal is invalid.\r\n\t\t\treturn createInvalidStateResponse();\r\n\t\t}\r\n\t\tif (ofResponse.isError()) {\r\n\t\t\t//Create Error response for Cancellation when error\r\n\t\t\t//Occurred while OF processing\r\n\t\t\treturn createErrorResponse(ofResponse);\r\n\t\t}\r\n\t\treturn createCancelResponse(ofHelper.getServiceOrder(soId));\r\n\t}", "public void startOrder() {\r\n this.o= new Order();\r\n }", "private FournisseurArboTraficService() {\r\n\t\tsuper();\r\n\t}", "private void getOrderFromDatabase() {\r\n Cursor cursor = helper.getOrderMoreDetails(orderId);\r\n cursor.moveToFirst();\r\n try {\r\n JSONObject senderObject = new JSONObject(cursor.getString(0));\r\n sender = senderObject.getString(\"name\");\r\n JSONObject receiverObject = new JSONObject(cursor.getString(1));\r\n receiver = receiverObject.getString(\"name\");\r\n JSONObject departureObject = new JSONObject(cursor.getString(2));\r\n if (departureObject.getString(\"type\").equals(\"SpecifyAddress\"))\r\n departure = departureObject.getString(\"long_name\");\r\n else\r\n departure = departureObject.getString(\"short_name\");\r\n JSONObject destinationObject = new JSONObject(cursor.getString(3));\r\n if (destinationObject.getString(\"type\").equals(\"SpecifyAddress\"))\r\n destination = destinationObject.getString(\"long_name\");\r\n else\r\n destination = destinationObject.getString(\"short_name\");\r\n numberOfGoods = cursor.getInt(4);\r\n orderTime = cursor.getString(5);\r\n state = cursor.getString(6);\r\n JSONArray goodIdArray = new JSONArray(cursor.getString(7));\r\n goodId = new String[goodIdArray.length()];\r\n for (int i = 0; i < goodIdArray.length(); i++) {\r\n goodId[i] = goodIdArray.getString(i);\r\n }\r\n orderType = cursor.getString(8);\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n cursor.close();\r\n }", "@Override\n @Transactional\n public OrderDTO createOrder(OrderDTO orderDTO) {\n\n String orderId = KeyUtil.genUniqueKey();\n BigDecimal orderAmount = new BigDecimal(BigInteger.ZERO);\n// List<CartDTO> cartDTOList = new ArrayList<>();\n //1.\n for (OrderDetail orderDetail : orderDTO.getOrderDetailList()) {\n ProductInfo productInfo = productInfoService.findOne(orderDetail.getProductId());\n if (productInfo == null) {\n throw new ProjectException(ResultEnum.PRODUCT_NOT_EXIST);\n }\n\n //2.\n orderAmount = productInfo.getProductPrice()\n .multiply(new BigDecimal(orderDetail.getProductQuantity()))\n .add(orderAmount);\n //3. orderDetail db insertion\n orderDetail.setDetailId(KeyUtil.genUniqueKey());\n orderDetail.setOrderId(orderId);\n BeanUtils.copyProperties(productInfo, orderDetail);\n orderDetailRepository.save(orderDetail);\n// CartDTO cartDTO = new CartDTO(orderDetail.getProductId(), orderDetail.getProductQuantity());\n// cartDTOList.add(cartDTO);\n }\n\n //3. orderMaster\n OrderMaster orderMaster = new OrderMaster();\n orderDTO.setOrderId(orderId);\n BeanUtils.copyProperties(orderDTO, orderMaster);\n orderMaster.setOrderAmount(orderAmount);\n orderMaster.setOrderStatus(OrderStatusEnum.NEW.getCode());\n orderMaster.setPayStatus(PayStatusEnum.WAIT.getCode());\n orderMasterRepository.save(orderMaster);\n\n //4.\n List<CartDTO> cartDTOList = orderDTO.getOrderDetailList().stream().map(e ->\n new CartDTO(e.getProductId(), e.getProductQuantity())\n ).collect(Collectors.toList());\n\n productInfoService.decreaseInventory(cartDTOList);\n\n return orderDTO;\n }", "public interface OrderDetailsService {\n\n List<MallV_Order_Show> getMallV_Order_Show(Map<String, Object> map);/*列表*/\n\n int getMallV_Order_ShowCount(Map<String, Object> map);\n\n MallV_Order_Show selectMallV_Order_Show(String no);\n\n}", "@Override\n\tpublic int insertOrderTrading(Order_TradingVO otvo) {\n\t\treturn sql.insert(\"insertOrderTrading\", otvo);\n\t}", "public void saveOrder(Order order) {\n Client client = clientService.findBySecurityNumber(order.getClient().getSecurityNumber());\n Product product = productService.findByBarcode(order.getProduct().getBarcode());\n order.setClient(client);\n order.setProduct(product);\n if (isClientPresent(order) && isProductPresent(order)) {\n do {\n currencies = parseCurrencies();\n } while (currencies.isEmpty());\n\n generateTransactionDate(order);\n\n// Client client = ClientServiceImpl.getClientRepresentationMap().get(order.getClient());\n// Product product = ProductServiceImpl.getProductRepresentationMap().get(order.getProduct());\n convertPrice(order);\n orders.add(order);\n orderedClients.add(client);\n orderedProducts.add(product);\n }\n }", "public VendorService getVendorService(com.kcdataservices.partners.kcdebdmnlib_hva.businessobjects.vendorservice.v1.VendorService res){\n\t\tVendorService vendorService = new VendorService();\n\t\t\n\t\tif( res.getVendorId() != null ){\n\t\t\tvendorService.setVendorId( res.getVendorId().intValue() );\n\t\t}\n\t\tif( res.getPrice() != null ){\n\t\t\tvendorService.setPrice( res.getPrice().doubleValue() );\n\t\t}\n\t\t\n\t\tvendorService.setServiceCode( res.getServiceCode() );\n\t\tvendorService.setServiceName( res.getServiceName() );\n\t\tvendorService.setCurrency( res.getCurrency() );\n\t\t\n\t\treturn vendorService;\n\t}", "public interface OrderService {\n\n void makeOrder(Order order);\n}", "public interface OrderService {\n\n /**\n * 分页\n * @param rebateVo\n * @return\n */\n PageDTO<RebateDTO> fetchPage(OrderVo rebateVo);\n\n /**\n * 获得订单详细信息\n *\n * @param orderId\n * @return\n */\n OrderDTO getOrder(long orderId);\n\n /**\n * 确认订单\n * @param orderId\n * @return\n */\n OrderDTO sureOrder(long orderId);\n\n}", "public Dealership() {\n cars = new TreeMap<>();\n }", "private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, com.drore.cloud.tdp.service.IWsPmsSdkServiceStub.GetVehicleBookPage param, boolean optimizeContent)\n throws org.apache.axis2.AxisFault{\n\n \n try{\n\n org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();\n emptyEnvelope.getBody().addChild(param.getOMElement(com.drore.cloud.tdp.service.IWsPmsSdkServiceStub.GetVehicleBookPage.MY_QNAME,factory));\n return emptyEnvelope;\n } catch(org.apache.axis2.databinding.ADBException e){\n throw org.apache.axis2.AxisFault.makeFault(e);\n }\n \n\n }", "public interface OrderService {\n\n void insertOrder(Order order);\n\n void updateState(String state);\n\n Order selectByPrice(String uuid);\n\n PageInfo<Order> queryOrderList(Page page);\n}", "public interface OrderPrePayService {\n\n int add(OrderPrePayDO orderPrePayDO);\n\n int deleteByOrderNo(String orderNo);\n\n OrderPrePayDO queryByOrderNo(String orderNo);\n}", "private CarRental() {\r\n\t\tcompanyCars = new ArrayList<InterfaceAbstractCar>();\r\n\t\trentDetails = new HashMap<DriversLicense, InterfaceAbstractCar>();\r\n\t}", "public static ShoppingCartService createShoppingCartService() {\n\t\treturn null;\r\n\t}", "public Order() {\n\t}", "@VTID(10)\r\n int getOrder();", "@Override\n\tpublic Iterable<ComplitedOrderInfo> findAll() {\n\t\treturn null;\n\t}", "@Override\r\n\tpublic List<Order> getAllOrders() {\n\t\treturn null;\r\n\t}", "@Test\n\tpublic void testAddNullProduct() throws ApiException {\n\n\t\tOrderItemPojo order_item = getOrderItemPojo(null,5);\n\t\tList<OrderItemPojo> lis = new ArrayList<OrderItemPojo>();\n\t\tlis.add(order_item);\n\n\t\ttry {\n\t\t\torder_service.add(lis);\n\t\t\tfail(\"ApiException did not occur\");\n\t\t} catch (ApiException e) {\n\t\t\tassertEquals(e.getMessage(), \"Product with this id does not exist\");\n\t\t}\n\n\t}", "public Order(int _orderId){\n this.orderId = _orderId;\n }", "public OrderItem() {}", "public interface CarListService {\n\n public List<Transportation> getLocal();\n public List<Transportation> getLuxery();\n public List<Transportation> getExotic();\n}", "public OrderLine() {\n products = new ArrayList<>();\n price = new BigDecimal(0);\n }", "public interface OrderService {\n Order create(Order order);\n Order update(Order order);\n boolean delete(Order order);\n Order get(int id);\n Collection<Order> get();\n}", "public interface OrderlineService {\n\n List<Orderline> getAllOrderline();\n\n void insertOrderLine(Orderline orderline);\n\n List<Order> selectAllOrder();\n\n List<Order> selectALlOrderByID(int orderid);\n\n Address selectAddressByID(int addressId);\n\n List<Orderline> selectALlOrderlineByID(int orderId);\n}", "@Test\n public void shouldWithdrawTransportOrderByVehicle() {\n Kernel kernel = getKernelFromSomewhere();\n\n // Get the vehicle from which the transport order shall be withdrawn\n Vehicle curVehicle = kernel.getTCSObject(Vehicle.class,\n getSampleVehicle());\n // Withdraw the order.\n // The second argument indicates if the vehicle should finish the movements\n // it is already assigned to (false) or abort immediately (true).\n // The third argument indicates whether the vehicle's processing state should\n // be changed to UNAVAILABLE so it cannot be assigned another transport order\n // right after the withdrawal.\n kernel.withdrawTransportOrderByVehicle(curVehicle.getReference(), true, false);\n // end::documentation_withdrawTransportOrderByVehicle[]\n }", "public int getVehicleId() {\n return vehicleId;\n }", "@GetMapping(\"/order\")\r\n\tprivate ResponseEntity<Object> getAllOrder() \r\n\t{\tOrderDetailsResponse response = new OrderDetailsResponse();\r\n\t\tList<OrderDetailsRequest> ordersDetails = new ArrayList<OrderDetailsRequest>();\r\n\t\tList<OrderDetails> orders = orderService.getAllOrder();\r\n\t\t\r\n\t\tfor(OrderDetails order : orders) {\r\n\t\t\t\r\n\t\t\tOrderDetailsRequest details = new OrderDetailsRequest();\r\n\t\t\tconstructResponseData(order,details);\r\n\t\t\tList<OrderItemDetails> items = restClientService.findByOrderid(order.getId());\r\n\t\t\tdetails.setProductDetails(items);\r\n\t\t\tordersDetails.add(details);\r\n\t\t}\r\n\t\tresponse.setOrders(ordersDetails);\r\n\t\tresponse.setMessage(\"SUCCESS\");\r\n\t\tresponse.setStatus((long) 200);\r\n\t\treturn new ResponseEntity<Object>(response, HttpStatus.OK);\r\n\t}", "public TOfferGoodsRecord() {\n super(TOfferGoods.T_OFFER_GOODS);\n }", "@Override\n\tpublic void getOrders() {\n\t\t\n\t}", "public Services(){\n ID = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n state = STATUS_IN_PROGRESS;\n name = \"\";\n date = \"\";\n description = \"\";\n note = \"\";\n mileage = 000000;\n }" ]
[ "0.70096403", "0.59276277", "0.5772423", "0.5732867", "0.5480906", "0.54808253", "0.5461864", "0.53306675", "0.5324065", "0.53194183", "0.52921087", "0.52829725", "0.52071875", "0.52058685", "0.5192173", "0.51714015", "0.51525545", "0.51222634", "0.5118072", "0.5114578", "0.5102816", "0.50996816", "0.5095057", "0.50820935", "0.50694525", "0.5066045", "0.50346273", "0.5027944", "0.50206923", "0.5020064", "0.49949214", "0.49803156", "0.4978131", "0.49690163", "0.4965984", "0.4959101", "0.49529862", "0.4951825", "0.49315637", "0.4915966", "0.4899963", "0.4896904", "0.4896904", "0.4892051", "0.48878047", "0.48852146", "0.488174", "0.48783392", "0.48762584", "0.48720247", "0.48657298", "0.48652998", "0.48651394", "0.4863311", "0.48621896", "0.4860886", "0.48512283", "0.4838979", "0.4838212", "0.4835504", "0.48336792", "0.48195973", "0.48058304", "0.48037902", "0.4803255", "0.47909248", "0.478489", "0.47803885", "0.47772107", "0.47702938", "0.47674915", "0.47651526", "0.47625965", "0.47602224", "0.47516733", "0.47493643", "0.47457057", "0.4745586", "0.47399", "0.47329277", "0.4731141", "0.4730998", "0.47240147", "0.47227445", "0.4713351", "0.4707757", "0.47066557", "0.46957934", "0.46907026", "0.46851143", "0.46826765", "0.4682556", "0.46802405", "0.4675983", "0.4663448", "0.46605864", "0.46598497", "0.4657279", "0.46544144", "0.46541348" ]
0.7636433
0
a service order for when a car is leaving the service department
ServiceOrder(String carVIN, String serviceDesc, String serviceDate, String partsUsed, int techID, int dealershipID, double partsCost, double totalCost, double laborHours){ serviceNumber++; this.serviceDate = serviceDate; this.carVIN = carVIN; this.serviceDesc = serviceDesc; this.partsUsed = partsUsed; this.techID = techID; this.dealershipID = dealershipID; this.partsCost = partsCost; this.totalCost = totalCost; this.laborHours = laborHours; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ServiceOrder(String carVIN, int techID, int dealershipID, String serviceDate){\n serviceNumber++;\n this.carVIN = carVIN;\n this.techID = techID;\n this.dealershipID = dealershipID;\n this.serviceDate = serviceDate;\n this.serviceDesc = \"None\";\n this.partsUsed = \"None\";\n this.partsCost = 0;\n this.totalCost = 0;\n this.laborHours = 0;\n }", "private int compareAndRemoveInefficentService (BusService jaiService, BusService veeruService) {\n\n\t\tLocalTime jaiBusDepTime = jaiService.getDepartureTime ();\n\n\t\tLocalTime jaiBusArrTime = jaiService.getArrivalTime ();\n\n\t\tLocalTime veeruBusDepTime = veeruService.getDepartureTime ();\n\n\t\tLocalTime veeruBusArrTime = veeruService.getArrivalTime ();\n\n\t\tif (jaiBusDepTime.compareTo (veeruBusDepTime) == EQUAL_VALUE\n\t\t\t\t&& jaiBusArrTime.compareTo (veeruBusArrTime) == EQUAL_VALUE) {\n\t\t\tveeruBusServiceList.remove (veeruService);\n\t\t\treturn REMOVE_VEERU_BUS_SERVICE;\n\t\t}\n\n\t\tint result;\n\n\t\tif (jaiBusDepTime.compareTo (veeruBusDepTime) == EQUAL_VALUE) {\n\n\t\t\tresult = jaiBusArrTime.compareTo (veeruBusArrTime);\n\n\t\t\tif (result == GREATER_VALUE) {\n\t\t\t\t\n\t\t\t\tjaiBusServiceList.remove (jaiService);\n\t\t\t\n\t\t\t\treturn REMOVE_JAI_BUS_SERVICE;\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\tveeruBusServiceList.remove (veeruService);\n\t\t\t\t\n\t\t\t\treturn REMOVE_VEERU_BUS_SERVICE;\n\t\t\t}\n\t\t}\n\n\t\tif (jaiBusArrTime.compareTo (veeruBusArrTime) == EQUAL_VALUE) {\n\t\t\tresult = jaiBusDepTime.compareTo (veeruBusDepTime);\n\n\t\t\tif (result == GREATER_VALUE) {\n\t\t\t\t\n\t\t\t\tveeruBusServiceList.remove (veeruService);\n\t\t\t\t\n\t\t\t\treturn REMOVE_VEERU_BUS_SERVICE;\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\tjaiBusServiceList.remove (jaiService);\n\t\t\t\t\n\t\t\t\treturn REMOVE_JAI_BUS_SERVICE;\n\t\t\t}\n\t\t}\n\n\t\tif ((jaiBusDepTime.isAfter (veeruBusDepTime) && (jaiBusDepTime.isBefore (veeruBusArrTime)\n\t\t\t\t|| jaiBusDepTime.compareTo (veeruBusArrTime) == EQUAL_VALUE))\n\t\t\t\t|| (veeruBusDepTime.isAfter (jaiBusDepTime) && (veeruBusDepTime.isBefore (jaiBusArrTime)\n\t\t\t\t\t\t|| veeruBusDepTime.compareTo (jaiBusArrTime) == EQUAL_VALUE))) {\n\n\t\t\tint jaiBusTotalJourneyTime = jaiBusArrTime.toSecondOfDay () - jaiBusDepTime.toSecondOfDay ();\n\n\t\t\tint veeruBusTotalJourneyTime = veeruBusArrTime.toSecondOfDay () - veeruBusDepTime.toSecondOfDay ();\n\n\t\t\tresult = Integer.compare (jaiBusTotalJourneyTime, veeruBusTotalJourneyTime);\n\n\t\t\tif (result == EQUAL_VALUE || result == LESSER_VALUE) {\n\t\t\t\t\n\t\t\t\tveeruBusServiceList.remove (veeruService);\n\t\t\t\t\n\t\t\t\treturn REMOVE_VEERU_BUS_SERVICE;\n\t\t\t}\n\n\t\t\tjaiBusServiceList.remove (jaiService);\n\t\t\t\n\t\t\treturn REMOVE_JAI_BUS_SERVICE;\n\t\t}\n\n\t\treturn DO_NOTHING;\n\t}", "public interface OrderService {\n\t\n\t/**\n\t * Gets all orders\n\t * \n\t * @return List of orders\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tList<Order> getOrderList() throws ServiceException;\n\t\n\t/**\n\t * Gets orders by certain status\n\t * \n\t * @param orderStatus\n\t * @return List of orders with specific status\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tList<Order> getOrderListByStatus(OrderStatusEnum orderStatus) throws ServiceException;\n\t\n\t/**\n\t * Adds new order\n\t * \n\t * @param order\n\t * @return 0 of adding is successful\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tint createNewOrder (Order order) throws ServiceException;\t\n\t\n\t/**\n\t * Gets order by id\n\t * \n\t * @param id\n\t * @return Order entity\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tOrder getOrder(int id) throws ServiceException;\t\n\t\n\t/**\n\t * Updates order status\n\t * \n\t * @param id\n\t * @param orderStatus\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tvoid updateOrderStatus(int id, OrderStatusEnum orderStatus) throws ServiceException;\t\n\t\n\t/**\n\t * Sets rejection reason for order\n\t * \n\t * @param id\n\t * @param reason\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tvoid rejectOrder(int id, String reason) throws ServiceException;\t\n\t\n\t/**\n\t * Sets damage amount for certain order\n\t * \n\t * @param id\n\t * @param totalAmount\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tvoid sendDamagesAmount(int id, int totalAmount) throws ServiceException;\t\n\t\n\t/**\n\t * Gets all orders of certain user\n\t * \n\t * @param userId\n\t * @return List of users orders\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tList<Order> getUserOrderList(int userId) throws ServiceException;\t\n\t\n\t/**\n\t * Checks if user unfinished and unpaid orders\n\t * \n\t * @param userId\n\t * @return false if users does not have unfinished orders\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tboolean checkForUnfinishedOrders (int userId) throws ServiceException;\t\n\t\n\t/**\n\t * Gets list of dates for which car is unavailable\n\t * \n\t * @param carId\n\t * @return List of dates\n\t * @throws ServiceException if DAOException was thrown\n\t */\n\tList<String> getResevedDatesList(int carId) throws ServiceException;\n}", "public void addShopEndLeasing() {\n log.info(\"OrdersBean : addShopEndLeasing\");\n FacesContext context = FacesContext.getCurrentInstance();\n int idContract = Integer.parseInt(getParam(\"idContract\"));\n init();\n checkIfOrdersEntityIsNullAndCreateOrders();\n\n if (contractsBean.createContractEndLeasing(idContract)) {\n context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, JsfUtils.returnMessage(getLocale(), \"fxs.addShopButton.addShopSuccess\"), null));\n } else {\n context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, JsfUtils.returnMessage(getLocale(), \"fxs.addShopButton.addShopError\"), null));\n }\n findOrderAndfindContracts();\n }", "public void declineTransaction(CommandOfService c) throws Exception {\n // We give back the points to the user\n Service s = c.getService();\n User u = c.getOwner();\n if(s.getTypeService() == 0){\n userDAO.addPoints(s.getCost(),u);\n }\n DAO.declineTransaction(c);\n FacadeNotification facadeNotification = FacadeNotification.getInstance();\n String title = \"Transaction declined!\";\n String desc = \"Your command for: \"+s.getTitle()+\" has been declined.\\n\";\n try {\n facadeNotification.createNotification(u.getIdUser(),title,desc);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "void depart() {\n int i;\n double delay;\n\n\t\t/* Check to see whether the queue is empty. */\n\n if (num_in_q == 0) {\n\n\t\t\t/*\n\t\t\t * The queue is empty so make the server idle and eliminate the\n\t\t\t * departure (service completion) event from consideration.\n\t\t\t */\n\n server_status = ServerStatus.IDLE;\n time_next_event[2] = Double.MAX_VALUE;\n }\n\n else {\n\n\t\t\t/*\n\t\t\t * The queue is nonempty, so decrement the number of customers in\n\t\t\t * queue.\n\t\t\t */\n\n --num_in_q;\n\n\t\t\t/*\n\t\t\t * Compute the delay of the customer who is beginning service and\n\t\t\t * update the total delay accumulator.\n\t\t\t */\n\n delay = sim_time - time_arrival[1];\n total_of_delays += delay;\n\n\t\t\t/*\n\t\t\t * Increment the number of customers delayed, and schedule\n\t\t\t * departure.\n\t\t\t */\n\n ++num_custs_delayed;\n time_next_event[2] = sim_time + expon(mean_service);\n\n\t\t\t/* Move each customer in queue (if any) up one place. */\n\n for (i = 1; i <= num_in_q; ++i)\n time_arrival[i] = time_arrival[i + 1];\n }\n }", "protected void deadlineLeasing() {\n log.info(\"OrdersBean : deadlineLeasing\");\n List<OrdersEntity> ordersEntitiesDeadline = ordersServices.findAllOrdersByIdUserAndStatusIsValidate(usersBean.getUsersEntity().getId());\n if (!ordersEntitiesDeadline.isEmpty()) {\n contractsBean.findAllContractsInAllMyOrdersForLeasingAndDeadlineIsLowerThan1Month(ordersEntitiesDeadline);\n }\n }", "@Test\n public void shouldWithdrawTransportOrderByVehicle() {\n Kernel kernel = getKernelFromSomewhere();\n\n // Get the vehicle from which the transport order shall be withdrawn\n Vehicle curVehicle = kernel.getTCSObject(Vehicle.class,\n getSampleVehicle());\n // Withdraw the order.\n // The second argument indicates if the vehicle should finish the movements\n // it is already assigned to (false) or abort immediately (true).\n // The third argument indicates whether the vehicle's processing state should\n // be changed to UNAVAILABLE so it cannot be assigned another transport order\n // right after the withdrawal.\n kernel.withdrawTransportOrderByVehicle(curVehicle.getReference(), true, false);\n // end::documentation_withdrawTransportOrderByVehicle[]\n }", "void finishOrder(int orderId);", "public interface ProcesoMSGEliminarBuzonMensajeService extends Service {\n\n\t/**\n\t * Proceso que realiza la eliminacin del buzon de mensajes\n\t * \n\t * @param criteria\n\t */\n\tpublic void executeProcesarEliminarBuzonMensaje(Map criteria);\n\n}", "public OrderVO addOrder(String member_id, int order_pay, int delivery, String order_address, int order_fee, int order_status) {\n\t\t\n\t\tSystem.out.println(\"Service_addOrd Start\");\n\t\tOrderVO OrderVO = new OrderVO();\n\t\tOrderVO.setMember_id(member_id);\n\t\tOrderVO.setOrder_pay(order_pay);\n\t\tOrderVO.setDelivery(delivery);\n\t\tOrderVO.setOrder_address(order_address);\n\t\tOrderVO.setOrder_fee(order_fee);\n\t\tOrderVO.setOrder_status(order_status);\n\t\tdao.insert(OrderVO);\n\t\tSystem.out.println(\"ProINS¦¨¥\\\" + member_id );\n\t\treturn OrderVO;\n\t}\n\n\tpublic List<OrderVO> getAll() {\n\t\treturn dao.getAll();\n\t}\n\tpublic List<OrderVO> getAll(String member_id) {\n\t\treturn dao.getAllOrderByMemNo_All(member_id);\n\t}\n\tpublic List<OrderVO> getAll_Pay(String member_id) {\n\t\treturn dao.getAllOrderByMemNo_Pay(member_id);\n\t}\n\tpublic List<OrderVO> getAll_Com(String member_id) {\n\t\treturn dao.getAllOrderByMemNo_Com(member_id);\n\t}\n\tpublic List<OrderVO> getAll_Can(String member_id) {\n\t\treturn dao.getAllOrderByMemNo_Can(member_id);\n\t}\n\n\tpublic void complete_order(String order_id) {\n\t\tdao.complete_order(order_id);\n\t}\n\tpublic void cancel_order(String order_id) {\n\t\tdao.cancel_order(order_id);\n\t}\n\t\n\t\n\tpublic OrderVO getOneOrder(String order_id) {\n\t\tSystem.out.println(\"¨ì¹FGETONEPRODUCT\");\n\t\treturn dao.findByPrimaryKey(order_id);\n\t}\n\tpublic OrderVO UpdateStatus(String order_id,int order_status) {\n\t\tOrderVO OrderVO = new OrderVO();\n\t\tSystem.out.println(\"service update_status start\");\n\t\t\n\t\tOrderVO.setOrder_id(order_id);\n\t\tOrderVO.setOrder_status(order_status);\n\t\tdao.updatestatus(OrderVO);\n\t\tSystem.out.println(\"service update_status off\");\n\t\treturn OrderVO;\n\t}\n\tpublic OrderVO ProUpdate(String order_id,String member_id, int order_pay, int delivery, String order_address, int order_fee) {\n\t\tSystem.out.println(\"Service update start\");\n\t\tOrderVO OrderVO = new OrderVO();\n\t\tOrderVO.setOrder_id(order_id);\n\t\tOrderVO.setMember_id(member_id);\n\t\tOrderVO.setOrder_pay(order_pay);\n\t\tOrderVO.setDelivery(delivery);\n\t\tOrderVO.setOrder_address(order_address);\n\t\tOrderVO.setOrder_fee(order_fee);\n//\t\tOrderVO.setOrder_status(order_status);\n\t\t\n\t\tdao.update(OrderVO);\n\t\tSystem.out.println(\"Service update off \");\n\t\treturn OrderVO;\n\t}", "public void decrementOrder(View view) {\n final int numberOfCoffees = getNumberOfCoffees();\n if (numberOfCoffees == Constants.MIN_NUM_COFFEES_IN_ORDER) {\n Toast.makeText(getApplicationContext(),\n \"Minimum number of coffees in one order reached\",\n Toast.LENGTH_SHORT).show();\n return;\n }\n displayQuantity(numberOfCoffees-1);\n }", "@Transactional\r\n public String createServiceOrder(Transaction transaction) throws AncestorNotFoundException{\n \tString statusCode = dao.getServiceOrdeStatusCode(transaction.getId());\r\n \tif(\"CA\".equals(statusCode) || \"CV\".equals(statusCode)){\r\n \t\tString errMsg = String.format(cancellationException);\r\n log.info(errMsg);\r\n throw new AncestorNotFoundException(errMsg);\r\n \t}//SL-19776 end\r\n //SL-18883: CLONE - Duplicate Service Orders is being created for a single external order number\r\n //Adding code to prevent processing of data for creating service order object in case unique composite key constraint fails \r\n \tlog.info(\"Adding entry inside table to prevent duplicate service orders getting created with same external order number\");\r\n \tdao.saveExternalOrderNumber(transaction); \r\n log.info(\"Starting to create the service order IntegrationBO.createServiceOrder\");\r\n \t//cloning service order object in case we have to retry for deadlocks\r\n ServiceOrder so = cloneObjectUsingJAXBSerialization(transaction.getServiceOrder());\r\n //sl-16667\r\n if(null != so){\r\n \tso.setNewSoInjection(true);\r\n }\r\n Map<String,Object> processVariables = commonTransactionHelper.createProcessVarsForTxOrder(transaction);\r\n\r\n Identification buyerIdentification = commonTransactionHelper.createBuyerIdentification(transaction);\r\n String soId = processingBO.executeCreateWithGroups(buyerIdentification,so,processVariables);\r\n log.debug(\"ServiceOrder created successfully: \" + soId);\r\n transaction.setServiceLiveOrderId(soId);\r\n\r\n dao.markCompleted(transaction);\r\n log.info(\"IntegrationBO.createServiceOrder Completed!\" + transaction.getId());\r\n\r\n return soId;\r\n }", "public interface SeatYudingOrderService {\n\n\n void yudingOrder(String uid, String workday, String route, String time,String dateType);\n void yudingOrder(String uid, String workday, String route, String time,String startDate,String endDate);\n void yudingOrder(String uid, String route, String time, String bizDate, Integer dayNum);\n void addOrder();\n\n Map<String,Object> shikebiao(String route, String holiday, String uid,String dateType);\n\n void sendMsgBanci(String first,String yuanyin,String content,String url);\n\n void pingjia(String uid,String orderId,String content,Integer fuwu) throws Exception;\n}", "public interface OrderService {\n /**\n * Save a order\n * \n * @param object\n * @return just saved profile\n */\n Order save(Order object);\n\n /**\n * Get all the order\n * \n * @return all the order\n */\n Collection<Order> getAll();\n\n /**\n * Get all the user profile filtered on user and project\n * \n * @param user\n * @param project\n * @param filterDate\n * @param filterDeliveredDate\n * @param filterStatus\n * @param firstResult\n * @param excludeCancelled\n * @param maxResult\n * @param sortProperty\n * @param isAscending\n * @return all the user profile\n */\n Collection<Order> get(User user, Project project, Date filterDate, Date filterDeliveredDate, OrderStatus filterStatus, boolean excludeCancelled, int firstResult,\n int maxResult, String sortProperty, boolean isAscending);\n\n /**\n * Remove a profile\n * \n * @param order\n */\n void remove(Order order);\n\n /**\n * Cancel an order\n * \n * @param order\n * @param user user is performing the action\n * \n */\n Order cancel(Order order, User user);\n\n /**\n * Return the order by id\n * \n * @param id\n * @return user with the passed email\n */\n Order getByID(String id);\n\n /**\n * place a new order\n * \n * @param order the new order to insert\n * @param project project relates to order\n * @param user user that place the order\n * @return\n */\n Order placeNewOrder(Order order, Project project, User user);\n\n /**\n * Creates a {@link ProductOrdered} with correct data, adds the new ProductOrdered to the Order, recalculates all the prices and discounts. <strong>NOT persists</strong>\n * \n * @param order\n * @param product\n * @param project\n * @param numberOfProds\n\n * @return\n */\n ProductOrdered addProductOrdered(Order order, Product product, Project project, int numberOfProds);\n\n /**\n * Remove a {@link ProductOrdered} from the given order, recalculates all the prices and discounts on the order.<strong>NOT persists</strong>\n * \n * @param order\n * @param productOrderedIndex position on the list of product to be removed\n * \n */\n void removeProductOrdered(Order order, int productOrderedIndex);\n\n /**\n * \n * @param user\n * @param project\n * @return\n */\n List<Date> getDates(User user, Project project);\n\n /**\n * \n * @param user\n * @param project\n * @return\n */\n List<Date> getDeliveredDates(User user, Project project);\n\n /**\n * Send mail notification, <b>Note</b>: <b>notificationEnabled</b> properties must be set to true\n * \n * @param order\n * @return\n */\n Order sendNotificationNewOrder(Order order);\n\n /**\n * Sets this order as in charge \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order setAsInCharge(Order order, User user);\n\n /**\n * Remove this order as in charge \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeInCharge(Order order, User user);\n\n /**\n * Sets this order as \"sent\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order setSentStatus(Order order, User user);\n\n /**\n * Remove this order as \"sent\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeSentStatus(Order order, User user);\n\n /**\n * Sets this order as \"delivered\" \n * \n * @param order\n * @param user user is performing the action\n * @param deliveredTime \n * @return\n */\n Order setDeliveredStatus(Order order, User user, Date deliveredTime);\n\n /**\n * Remove this order as \"delivered\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeDeliveredStatus(Order order, User user);\n\n /**\n * Sets this order as \"InvoiceApproved\" \n * \n * @param order\n * @param user user is performing the action\n * @param invoiceDate\n * @param invoiceDueDate \n * @return\n */\n Order setInvoiceApprovedStatus(Order order, User user);\n\n /**\n * Removes this order as \"InvoiceApproved\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeInvoiceApprovedStatus(Order order, User user);\n\n /**\n * Sets this order as \"InvoiceCreated\" \n * \n * @param order\n * @param user user is performing the action\n * @param invoiceDate\n * @param invoiceDueDate data di pagamento prevista \n * @return\n */\n Order setInvoiceCreatedStatus(Order order, User user, Date invoiceDate, Date invoiceDueDate);\n\n /**\n * Sets this order as \"PaidInvoice\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order setInvoicePaidStatus(Order order, User user);\n\n /**\n * Remove this order as \"InvoiceCreated\" \n * \n * @param order\n * @param user user is performing the action\n * @return\n */\n Order removeInvoiceCreatedStatus(Order order, User user);\n\n /**\n * Set the OrderStatus \n * \n * @param orderStatus\n * @param order\n * @param user user is performing the action\n * @return\n */\n Order setStatus(OrderStatus orderStatus, Order order, User user);\n\n /**\n * Set order on the given dates/project in charge\n * \n * @param user\n * @param project\n * @param date\n * @return\n */\n void setAsInCharge(User user, Project project, Date date);\n\n /**\n * Get products base on the given order properties\n * \n * @param order\n * @return\n */\n List<Product> getProducts(Order order);\n\n // /**\n // * \n // * @param o\n // * @return\n // */\n // Order applyDiscountIfApplicable(Order o);\n //\n // \n // /**\n // * \n // * @param o\n // * @return\n // */\n // Order applyFreeShippingCostIfApplicable(Order o);\n\n /**\n * \n * @param order\n * @return\n */\n boolean isOrderValid(Order order);\n\n String getNotesForDisplay(Order o);\n\n String getNotesForPDF(Order order);\n\n /**\n * Force discount on existing order <b>Use with caution</b>\n * \n * @param order\n * @param discountToAppply to the order\n * @return\n */\n Order modifyDiscountToOrder(Order order, int discountToAppply);\n\n /**\n * \n * @param o\n * @return the order, product ordered with the correct costs and discount applied\n */\n public abstract Order calculatesCostsAndDiscount(Order o);\n\n /**\n * \n * @param o\n * @param cost cost to apply\n * @param discountForced discount to be forced\n * @return\n */\n Order forcePriceAndDiscountAndRecalculate(Order o, BigDecimal cost, BigDecimal discountForced);\n\n}", "public interface OrderService {\r\n\r\n /**\r\n * 创建订单\r\n * @param orderDTO\r\n * @return\r\n */\r\n OrderDTO create(OrderDTO orderDTO);\r\n\r\n /**\r\n * 完结订单(只能卖家操作)\r\n * @param orderId\r\n * @return\r\n */\r\n OrderDTO finish(String orderId);\r\n}", "void addService(Long orderId, Long serviceId);", "public void onDeleteService(final ForwardEvent event) {\r\n\t\t// Get the listitem from the event's target (button)\r\n\t\t// parent(hbox)->parent(listcell)->parent(listitem)\r\n\t\tfinal Listitem li = (Listitem) event.getOrigin().getTarget().getParent().getParent().getParent();\r\n\t\tfinal MasterService service = (MasterService) li.getValue();\r\n\r\n\t\t// delete the service\r\n\t\tfinal IPaymentDAO paymentDAO = (IPaymentDAO) SpringUtil.getBean(\"paymentDAO\");\r\n\t\tpaymentDAO.deleteService(service);\r\n\t\tfinal ListModelList services = (ListModelList) page.getAttribute(\"serviceslist\");\r\n\t\tint indx = getListIndex(service, services);\r\n\t\tservices.remove(indx);\r\n\t\tpage.setAttribute(\"serviceslist\", services);\r\n\t\tfinal Listbox lstservice = (Listbox) Path.getComponent(page, \"lstservice\");\r\n\t\tlstservice.setModel(services);\r\n\t\tlstservice.invalidate();\r\n\t\tClients.evalJavaScript(\"$.jGrowl(\\\"Successfully Deleted the service\\\", {life:2000});\");\r\n\t}", "@Override\n\tpublic int addStationstoServices(Service serviceDTO) {\n\t\tcom.svecw.obtr.domain.Service serviceDomain = new com.svecw.obtr.domain.Service();\n\t\tserviceDomain.setSourceStationId(serviceDTO.getSourceStationId());\n\t\tserviceDomain.setDestinationStationId(serviceDTO.getDestinationStationId());\n\t\tserviceDomain.setServiceId(serviceDTO.getServiceId());\n\t\tSystem.out.println(serviceDTO.getServiceId());\n\t\t//System.out.println(serviceDTO.getDestinationStationId());\n\t\treturn iStationToService.addServiceToStation(serviceDomain);\n\t}", "private void carsReadyToLeave(){\n\t\t\tCar car = getFirstLeavingCar();\r\n\t\t\twhile (car!=null) {\r\n\t\t\t\tif (car.getHasToPay()){\r\n\t\t\t\t\tcar.setIsPaying(true);\r\n\t\t\t\t\tpaymentCarQueue.addCar(car);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tcarLeavesSpot(car);\r\n\t\t\t\t}\r\n\t\t\t\tcar = getFirstLeavingCar();\r\n\t\t\t}\r\n\t\t}", "public interface DelOnceOrderForNotTMService extends EntityService<StudentBookOnceOrder> {\n public void del();\n}", "DeliverySystem getPseService();", "public interface ProcesoVENService extends Service {\n\n\t/**\n\t * Ejecuta procedimiento generico\n\t * @param nombreExecute\n\t * @param criteria\n\t */\n\tpublic void executeGenerico(String nombreExecute, Map criteria) ;\n\t\n\t/**Actualiza calensarios\n\t * @param calendario\n\t * @param usuario\n\t */\n\tpublic void updateCalendario(Calendario calendario, Usuario usuario);\n\t\n\t/**devuelve lista de calendarios\n\t * @param criteria\n\t * @return\n\t */\n\tpublic List getCalendarios(Map criteria);\n\t\n\t/**\n\t * devuelve el calendario\n\t * @param criteria\n\t * @return\n\t */\n\tpublic Calendario getCalendario(Map criteria);\n\t\n /**\n * devuelve los feriados d euna zona\n * @param criteria\n * @return\n */\n public List getFeriadoZona(Map criteria);\n\t\n\t/**\n\t * Actualiza feriados de una zona\n\t * @param feriadoZona\n\t * @param usuario\n\t */\n\tpublic void updateFeriadoZona(FeriadoZona feriadoZona, Usuario usuario);\n\t\n\t/**\n\t * Inserta los feriados de una zona\n\t * @param feriadoZona\n\t * @param usuario\n\t */\n\tpublic void insertFeriadoZona(FeriadoZona feriadoZona, Usuario usuario);\n\t\n\t/**\n\t * elimina los feriados d euna zona\n\t * @param feriadoZona\n\t * @param usuario\n\t */\n\tpublic void deleteFeriadoZona(FeriadoZona feriadoZona, Usuario usuario);\n\n\t/**\n\t * Metodo que trae las zonas de una region\n\t * @param feriadoRegion\n\t * @return\n\t */\n\tpublic List getZonasRegion(String feriadoRegion);\n\n\t/**\n\t * Retorna el indicador de habilitacion RUV\n\t * @param criteria\n\t * @return\n\t */\n\tpublic String getIndicadorHabilitacionRuv(Map criteria);\n\n\t/**\n\t * Genera la informacion para el reporte RUV\n\t * @param map\n\t */\n\tpublic void executeGeneracionReporteRUV(Map map);\n\t\n\t/**\n\t * Genera los archivos de libro de ventas - detalles SII\n\t * @param map\n\t */\n\tpublic void executeGenerarArchivosLibroVentasDetalleSII(Map map);\n\t\n}", "private void carsReadyToLeave(){\n\t Car car = cpview.getFirstLeavingCar();\n\t while (car!=null) {\n\t \tif (car.getHasToPay()){\n\t\t car.setIsPaying(true);\n\t\t paymentCarQueue.addCar(car);\n\t \t}\n\t \telse {\n\t \t\tcarLeavesSpot(car);\n\t \t}\n\t car = cpview.getFirstLeavingCar();\n\t }\n\t }", "private void checkTimeTableOfServices () {\n\n\t\tif (jaiBusServiceList != null && jaiBusServiceList.size () > 0 && veeruBusServiceList != null\n\t\t\t\t&& veeruBusServiceList.size () > 0) {\n\n\t\t\tObject jaiBusService[] = jaiBusServiceList.toArray ();\n\n\t\t\tObject veeruBusService[] = veeruBusServiceList.toArray ();\n\n\t\t\tBusService jaiService;\n\n\t\t\tBusService veeruService;\n\n\t\t\tint result;\n\n\t\t\tfor (int i = 0; i < jaiBusService.length; i++) {\n\n\t\t\t\tjaiService = (BusService) jaiBusService[i];\n\n\t\t\t\tif (jaiService == null)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tfor (int j = 0; j < veeruBusService.length; j++) {\n\n\t\t\t\t\tveeruService = (BusService) veeruBusService[j];\n\n\t\t\t\t\tif (veeruService == null)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tresult = compareAndRemoveInefficentService (jaiService, veeruService);\n\n\t\t\t\t\tif (result == REMOVE_JAI_BUS_SERVICE) {\n\t\t\t\t\t\tjaiBusService[i] = null;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if (result == REMOVE_VEERU_BUS_SERVICE) {\n\t\t\t\t\t\tveeruBusService[j] = null;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public interface OrderService {\n\n /**\n * Returns route time\n * @param routeDTO route data transfer object\n * @param orderDTO order dto for building route\n * @return\n */\n Long getRouteTime(RouteDTO routeDTO, OrderDTO orderDTO);\n\n /**\n * Returns drivers from database by specified order duration and order dto\n * @param time order duration\n * @param orderDTO order dto for building a route\n * @return linked hash map, key - drivers' id, value - drivers\n */\n LinkedHashMap<Long, Driver> getDriversForOrder(Long time, OrderDTO orderDTO);\n\n /**\n * Returns trucks from database by specified weight of cargoes\n * @param weight cargoes's weight\n * @return linked hash map, key - trucks' id, value - trucks\n */\n LinkedHashMap<Long, Truck> getTrucksForOrder(Long weight);\n\n /**\n * Specifies drop locations for picked up cargoes\n * @param routeDTO route dto with route points\n * @param points temp collection for building sub route\n */\n void setDropLocations(RouteDTO routeDTO, List<RoutePointDTO> points);\n\n /**\n * Returns weight of cargoes\n * @param routePointDTO temp route point dto with cargo or drop location\n * @param points already built route as list of ordered route points\n * @param weight previous weight data before adding new route point\n * @return weight\n */\n Long getWeight(RoutePointDTO routePointDTO, List<RoutePointDTO> points, Long weight);\n\n /**\n * Adds new route point to the route\n * @param routePointDTO new route point dto\n * @param routeDTO route data transfer object\n * @param points route as an ordered list of route points dtos\n */\n void newRoutePoint(RoutePointDTO routePointDTO, RouteDTO routeDTO, List<RoutePointDTO> points);\n\n /**\n * Returns all cities from database\n * @return linked hash map of cities, key - cities' id\n */\n LinkedHashMap<Long, City> getAllCitiesMap();\n\n /**\n * Adds order to a database\n * @param routeDTO route for building path for the order\n * @param orderDTO complex order data\n */\n void saveOrder(RouteDTO routeDTO, OrderDTO orderDTO);\n\n /**\n * Returns orders' from database as dtos\n * @return unsorted list of orders' data transfer objects\n */\n List<OrderDTO> getAllOrdersDTO();\n\n /**\n * Returns route points for order\n * @param order order entity for getting specified route points\n * @return unsorted list of route points\n */\n List<RoutePoint> getRoutePointsForOrder(Order order);\n\n /**\n * Returns cities dto adopted for RESTful architecture\n * @param id order id for retrieving data from database\n * @return unsorted list of cities as dtos adopted for RESTful architecture\n */\n List<CityDTORest> getRoutePointsForOrder(Long id);\n\n /**\n * Returns cargoes from database for the given order dto\n * @param orderDTO order dto\n * @return unsorted list of cargoes\n */\n List<Cargo> getCargoesForOrder(OrderDTO orderDTO);\n\n /**\n * Deletes order from database\n * @param id order's id for deletion\n */\n void deleteOrder(Long id);\n\n /**\n * Updates order\n * @param order order entity for updating\n */\n void updateOrder(Order order);\n\n /**\n * Return orders as dtos adopted for RESTful architecture\n * @return unsorted list of orders dtos adopted for RESTful architecture\n */\n List<OrderDTORest> getAllOrdersDTORest();\n\n /**\n * Delete temp route point dto from the route dto\n * @param routePoint temp route point dto\n * @param routeDTO route dto collected already built route\n */\n void deleteRoutePoint(String routePoint, RouteDTO routeDTO);\n\n /**\n * Processes new route point, recalculates distance and weight\n * @param orderDTO order dto\n * @param routeDTO route dto\n * @param routePointDTO new route point\n * @return temp cargoes weight\n */\n Long tempProcessPoint(OrderDTO orderDTO, RouteDTO routeDTO, RoutePointDTO routePointDTO);\n}", "public interface ContinuingEducationService extends EducatonCommonService<ContinuingEducationModel>\r\n{\r\n\tpublic ContinuingEducationModel getByPK(ContinuingEducationPKModel pk) throws AAException;\r\n\t\t\r\n\t/**\r\n\t * Check all the continuing educations in specific cap, if all conditions are matched then return true.\r\n\t *\r\n\t * @param capID\r\n\t * @return true - passed , false - not passed\r\n\t * @throws AAException \r\n\t * @throws RemoteException \r\n\t */\r\n\tpublic boolean isContinuingEducationPassed(CapIDModel capID) throws AAException, RemoteException;\r\n\t\r\n\t/**\r\n\t * Get the total required hours by cap type\r\n\t *\r\n\t * @param capType\t\t\tthe specific cap type model\r\n\t * @return\r\n\t * @throws RemoteException\r\n\t * @throws AAException\r\n\t */\r\n\tpublic double getTotalRequiredHours(CapTypeModel capType) throws RemoteException, AAException;\r\n\r\n\t/**\r\n\t * Get all continuing education info according to the specific cap ID and merge condition.\r\n\t *\r\n\t * @param source\r\n\t * @param isMergeRef true - merge reference data to daily side. false - only return daily side data. \r\n\t * @return \r\n\t * @throws AAException \r\n\t * @throws RemoteException \r\n\t */\r\n\tList<ContinuingEducationModel> getModelsByCapID(CapIDModel capId, boolean isMergeRef) throws AAException, RemoteException;\r\n\t\r\n\t/**\r\n\t * Check if task status is allowed to change. If the task status is configuired to be checked \r\n\t * before changing, then check if task's app have passed the continuing education. \r\n\t *\r\n\t * @param taskItem\r\n\t * @return\r\n\t * @throws AAException \r\n\t * @throws RemoteException \r\n\t */\r\n\tboolean isWorkflowStatusCanBeChanged(TaskItemModel taskItem) throws AAException, RemoteException;\r\n\t\r\n\t/**\r\n\t * Auto approve required cehs.\r\n\t * \r\n\t * @param capId the cap id\r\n\t * @param callerID TODO\r\n\t * \r\n\t * @throws AAException the AA exception\r\n\t * @throws RemoteException the remote exception\r\n\t */\r\n\tpublic void autoApproveRequiredCEHs(CapIDModel capId, String callerID) throws AAException, RemoteException;\r\n\r\n\t/**\r\n\t * Auto approve cont edus.\r\n\t * \r\n\t * @param contEduList the cont edu list\r\n\t * @param capID the cap id\r\n\t * @param callerID the caller id\r\n\t * \r\n\t * @return the int\r\n\t * \r\n\t * @throws AAException the AA exception\r\n\t * @throws RemoteException the remote exception\r\n\t */\r\n\tpublic int autoApproveContEdus(List<ContinuingEducationModel> contEduList, CapIDModel capID, String callerID)\r\n\t\t\tthrows AAException, RemoteException;\r\n\t\r\n}", "public void save_order_without_payment(String advert, String userWhoGive,String userWhoGet,Date date,Date start, Date finish,Float price);", "public void addAfterOrderGoods(AfterOrderGoods afterOrderGoods)\n\t\t\tthrows ErpServiceException {\n\t\ttry {\t \n\t\t\tafterSalesDao.addAfterOrderGoods(afterOrderGoods);\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(e.getMessage());\n\t\t\tthrow new ErpServiceException(e.getMessage());\n\t\t}\n\t\t\n\t}", "CarPaymentMethod processHotDollars();", "@Override\n public void depart(BusIfc bus)\n {\n LetterIfc letter = bus.getCurrentLetter();\n ItemInquiryCargo cargo = (ItemInquiryCargo)bus.getCargo();\n if (letter.getName().equals(\"Next\"))\n {\n POSUIManagerIfc ui = (POSUIManagerIfc)bus.getManager(UIManagerIfc.TYPE);\n AgeRestrictionBeanModel model = (AgeRestrictionBeanModel)ui.getModel();\n cargo.setRestrictedDOB(model.getDateOfBirth());\n }\n else if (letter.getName().equals(\"Skip\"))\n {\n cargo.setRestrictedDOB(new EYSDate(cargo.getPLUItem().getRestrictiveAge(), 1, 1));\n cargo.setModifiedFlag(true);\n }\n else if(letter.getName().equals(\"Continue\"))\n {\n cargo.setModifiedFlag(true);\n }\n else if (letter.getName().equals(\"Cancel\") ||\n letter.getName().equals(\"Undo\"))\n {\n //remove item from transaction\n cargo.setModifiedFlag(false);\n }\n else if (letter.getName().equals(\"Invalid\"))\n {\n cargo.setModifiedFlag(false);\n cargo.setPLUItem(null);\n }\n }", "@Test\n\tpublic void deleteOrderLine() {\n\t\t// TODO: JUnit - Populate test inputs for operation: deleteOrderLine \n\t\tOrderLine orderline = new ecom.domain.OrderLine();\n\t\tservice.deleteOrderLine(orderline);\n\t}", "public interface OrderPrePayService {\n\n int add(OrderPrePayDO orderPrePayDO);\n\n int deleteByOrderNo(String orderNo);\n\n OrderPrePayDO queryByOrderNo(String orderNo);\n}", "public interface PurchaseOrderService {\n /**\n * create Purchase Order From Boq.\n * @param boqDetail boqDetail\n * @param appUser appUser\n * @return PurchaseOrderHeader\n */\n PurchaseOrderHeader createPoFromBoq(BoqDetail boqDetail, AppUser appUser);\n /**\n * add lines to Purchase Order Header.\n * @param purchaseOrderHeader purchaseOrderHeader\n * @param boqDetail boqDetail\n * @return boolean\n */\n boolean addLineToPoFromBoqDetail(PurchaseOrderHeader purchaseOrderHeader, BoqDetail boqDetail);\n\n /**\n * save Purchase Order Header into database.\n * @param purchaseOrderHeader purchaseOrderHeader\n * @param securityContext securityContext\n * @return response\n */\n CommonResponse savePurchaseOrder(PurchaseOrderHeader purchaseOrderHeader, SecurityContext securityContext);\n\n /**\n * get all purchase Order Header.\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderHeaders();\n\n /**\n * get PurchaseOrderHeader whole oblect per pohId.\n * @param pohId pohId.\n * @return PurchaseOrderHeader\n */\n PurchaseOrderHeader getPurchaseOrderHeaderWhole(long pohId);\n /**\n /**\n * get product purchase items for specific supplier.\n * @param suppId suppId\n * @param searchStr searchStr\n * @return List of PruductPurchaseItem\n */\n List<ProductPurchaseItem> getAllSupplierProductPurchaseItems(long suppId, String searchStr);\n /**\n * get all purchase Order Header.\n * @param supplierId supplierId\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderHeaderPerOrguIdAndSupplierIdAndStatusCode(long supplierId);\n\n /**\n * get all purchase Order Header per orguid and status.\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderHeaderNotFullyReceived();\n\n /**\n * get all purchase Order Header for specific supplier.\n * @param supplierId supplierId\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderHeaderPerOrguIdAndSupplierId(long supplierId);\n /**\n * search purchase order header.\n * @param searchForm searchForm\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> searchPurchaseOrderHeaders(GeneralSearchForm searchForm);\n\n /**\n * get product purchase item for specific supplier and catalog no.\n * @param suppId suppId\n * @param catalogNo catalogNo\n * @return List of PruductPurchaseItem\n */\n ProductPurchaseItem getSupplierProductPurchaseItemPerCatalogNo(long suppId, String catalogNo);\n\n /**\n * get all purchase Order Header for specific product.\n * @param prodId prodId\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseLine> getAllPurchaseOrderOfProduct(long prodId);\n\n /**\n * search purchase order header.\n * @param searchForm searchForm\n * @return List of PurchaseOrderHeader\n */\n GeneralSearchForm searchPurchaseOrderHeadersPaging(GeneralSearchForm searchForm);\n /**\n * create Purchase Order From Boq.\n * @param txnDetail sale order detail\n * @param appUser appUser\n * @return PurchaseOrderHeader\n */\n PurchaseOrderHeader createPoFromSaleOrder(TxnDetail txnDetail, AppUser appUser);\n\n /**\n * add lines to Purchase Order Header from txn detail.\n * @param purchaseOrderHeader purchaseOrderHeader\n * @param txnDetail txnDetail\n * @return true if successfull, otherwise return false;\n */\n boolean addLineToPoFromTxnDetail(PurchaseOrderHeader purchaseOrderHeader, TxnDetail txnDetail);\n\n /**\n * get all purchase order headers linked to specific sale order.\n * @param txhdId transaction header id.\n * @return List of purchase order linked to sale order\n */\n List<PurchaseOrderHeader> getAllPurchaseOrderOfSaleOrder(long txhdId);\n\n /**\n * update status of linked BOQ.\n * @param pohId purchaes order header id.\n */\n void updatePurchaseOrderLinkedBoqStatus(long pohId);\n\n /**\n * delete purchase order per poh id.\n * @param pohId pohId\n * @return CommonResponse.\n */\n CommonResponse deletePurchaseOrderPerPhoId(long pohId);\n\n /**\n * update order status of linked sales orders.\n * @param pohId purchaes order header id.\n */\n void updatePurchaseOrderLinkedSaleOrderStatus(long pohId);\n\n /**\n * get all IN-PROGRESS and CONFIRMED purchase Order Header.\n * @param supplierId supplierId\n * @return List of PurchaseOrderHeader\n */\n List<PurchaseOrderHeader> getAllOutstandingAndConfirmedPurchaseOrderHeaderPerOrguIdAndSupplierId(long supplierId);\n\n\n /**\n * get product purchase item for specific supplier and catalog no.\n * @param sprcId sprcId\n * @return List of PruductPurchaseItem\n */\n ProductPurchaseItem getProductPurchaseItemPerId(long sprcId);\n}", "public interface OrderService {\n\n void makeOrder(Order order);\n}", "@Override\n\tpublic void openOrderEnd() {\n\t}", "@Override\r\n\tprotected IAPIResponse executeOrderFulfillmentService(APIRequestVO apiVO) {\r\n\t\tProcessResponse cancelResponse = new ProcessResponse();\r\n\t\tOrderFulfillmentRequest ofRequest = null;\t\t\r\n\t\tString soId = apiVO.getSOId();\r\n\t\tint buyerId = apiVO.getBuyerIdInteger();\r\n\t\tSOCancelRequest soCancelRequest = (SOCancelRequest) apiVO.getRequestFromPostPut();\r\n\t\tcancelResponse.setCode(PublicAPIConstant.ONE);\r\n\t\t//Ensure that all the mandatory fields have actual values (excluding white spaces)\r\n\t\ttrimRequestElements(soCancelRequest);\r\n\t\tcancelResponse = validateMandatoryTags(soCancelRequest);\r\n\t\tif(!PublicAPIConstant.ONE.equals(cancelResponse.getCode())){\r\n\t\t\t//Create error response when request parameter mandatory validation failed.\r\n\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t}\r\n\t\tSecurityContext securityContext; \r\n\t\tif(PublicAPIConstant.BUYER_RESOURCE_ID.equalsIgnoreCase(soCancelRequest.getIdentification().getType())){\r\n\t\t\tsecurityContext = getSecurityContextForBuyer(apiVO.getBuyerResourceId());\r\n\t\t}else{\r\n\t\t\tsecurityContext = getSecCtxtForBuyerAdmin(buyerId);\r\n\t\t}\r\n\t\tServiceOrder so;\r\n\t\ttry {\r\n\t\t\tso = serviceOrderBO.getServiceOrder(soId);\r\n\t\t\t /* Validates the cancellation request.*/\r\n\t\t\tcancelResponse = validateCancelRequest(so, securityContext, soCancelRequest);\r\n\t\t} catch (Exception be) {\r\n\t\t\tLOGGER.error(be);\r\n\t\t\tcancelResponse.setMessage(be.getMessage());\r\n\t\t\tcancelResponse.setCode(ServiceConstants.SYSTEM_ERROR_RC);\r\n\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t}\r\n\t\t\r\n\t\tsetProviderAcknowledgement(soCancelRequest);\r\n\t\t//Use appropriate Signal based on the SO State (For draft/routed/expired use\r\n\t\t//cancellation through front specific signal SL_CANCEL_ORDER)\r\n\t\tSignalType signalType = getSignalType(so.getWfStateId().intValue());\r\n\t\tif ((PublicAPIConstant.ONE).equalsIgnoreCase(cancelResponse.getCode())) {\r\n\t\t\t//If request parameters are validated then create OF Request\r\n\t\t\ttry{\r\n\t\t\t\tofRequest = createOrderFulfillmentCancelSORequest(so, securityContext, soCancelRequest);\r\n\t\t\t}catch(Exception e){\r\n\t\t\t\tLOGGER.error(e);\r\n\t\t\t\tcancelResponse.setMessage(e.getMessage());\r\n\t\t\t\tcancelResponse.setCode(ServiceConstants.SYSTEM_ERROR_RC);\r\n\t\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(null == ofRequest){\r\n\t\t\t\tLOGGER.error(\"Error in fetching data from DB.\");\r\n\t\t\t\tcancelResponse.setMessage(CommonUtility\r\n\t\t\t\t\t\t.getMessage(PublicAPIConstant.cancelSO.DEFAULT_SYS_ERROR_MESSAGE));\r\n\t\t\t\tcancelResponse.setCode(ServiceConstants.SYSTEM_ERROR_RC);\r\n\t\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t//Create error response when request parameter validation failed.\r\n\t\t\treturn createErrorResponse(cancelResponse);\r\n\t\t}\r\n\t\t//OF call\r\n\t\tOrderFulfillmentResponse ofResponse = ofHelper\r\n\t\t\t\t.runOrderFulfillmentProcess(soId, signalType, ofRequest);\r\n\t\tif (!ofResponse.isSignalAvailable()) {\r\n\t\t\t//Create So Cancellation response when Signal is invalid.\r\n\t\t\treturn createInvalidStateResponse();\r\n\t\t}\r\n\t\tif (ofResponse.isError()) {\r\n\t\t\t//Create Error response for Cancellation when error\r\n\t\t\t//Occurred while OF processing\r\n\t\t\treturn createErrorResponse(ofResponse);\r\n\t\t}\r\n\t\treturn createCancelResponse(ofHelper.getServiceOrder(soId));\r\n\t}", "public void buyorapplyService(Service s, User u) throws Exception{\n // We check if there is already an existing command\n if(DAO.commandPending(s,u) == null){\n // We retrieve the points if it's a proposed service\n if(s.getTypeService() == 0){\n userDAO.removePoints(s.getCost(),u);\n }\n DAO.applyorbuyForService(s,u);\n FacadeNotification facadeNotification = FacadeNotification.getInstance();\n String title = \"Command pending!\";\n String desc = \"Your command for: \"+s.getTitle()+\" is now pending.\\n\" +\n \"You will receive a notification telling you if the owner accepted \" +\n \"or not the transaction.\";\n try {\n facadeNotification.createNotification(u.getIdUser(),title,desc);\n title = \"You have a command pending to check!\";\n desc = \"A command for: \"+s.getTitle()+\" is now pending.\\n\" +\n \"You can accept or decline it.\";\n facadeNotification.createNotification(s.getOwner().getIdUser(),title,desc);\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n else{\n throw new ErrorCommand(\"You already have a pending command for this service.\");\n }\n }", "public static void main(String[] args) throws Exception {\n\n System.out.println(\"###CustomerOrder Test###\");\n CustomerOrderService customerOrderService = new CustomerOrderService(new CustomerOrderDao());\n\n CustomerOrder customerOrder1 = new CustomerOrder(BigDecimal.valueOf(99.95), \"NEW\", \"1000\", 1, 1, 1);\n customerOrderService.addCustomerOrder(customerOrder1);\n\n System.out.println(\"getCustomerOrder(1): \" + customerOrderService.getCustomerOrder(1));\n System.out.println(\"getAllCustomerOrdersByCustId(1): \" + customerOrderService.getAllCustomerOrdersByCustId(1));\n\n System.out.println(\"getDetailedCustomerOrder(1): \" + customerOrderService.getDetailedCustomerOrder(1));\n\n System.out.println(\"getCustomerOrderStatus(1): \" + customerOrderService.getCustomerOrderStatus(1));\n \n\n CustomerOrder customerOrder2 = new CustomerOrder(1, BigDecimal.valueOf(88.88), \"SHIPPED\", \"2222\", 2, 2, 2);\n customerOrderService.updateCustomerOrder(customerOrder2);\n\n System.out.println(\"getCustomerOrder(1) - after update: \" + customerOrderService.getCustomerOrder(1));\n\n Payment payment1 = new Payment(1, \"PAYMENT\", \"PROCESSED\");\n customerOrderService.addPayment(payment1);\n\n System.out.println(\"getPayment(1): \" + customerOrderService.getPayment(1));\n customerOrderService.updatePayment(1, \"REFUNDED\");\n System.out.println(\"getPayment(1) - after status update: \" + customerOrderService.getPayment(1));\n\n System.out.println(\"getPaymentsByOrderId(1): \" + customerOrderService.getPaymentsByOrderId(1));\n\n CustomerOrderDetail customerOrderDetail1 = new CustomerOrderDetail(1, 3);\n customerOrderService.addCustomerOrderDetail(customerOrderDetail1);\n\n System.out.println(\"getCustomerOrderDetail(2): \" + customerOrderService.getCustomerOrderDetail(2));\n System.out.println(\"getCustomerOrderDetailsByOrderId(1): \" + customerOrderService.getCustomerOrderDetailsByOrderId(1));\n \n \n \n //Start of the Product test\n \n System.out.println(\"###Product Test###\"); \n ProductService productService = new ProductService(new ProductDao());\n\n Product productTest = new Product(1, \"1234\", \"ProductTest\", \"veryCool\", true, 1, 1, \"picture\");\n productService.createProduct(productTest);\n \n System.out.println(\"Select productTest by id: \" + productService.getProduct(4));\n \n System.out.println(\"select All Products: \" + productService.selectAllProducts());\n \n\n \n //End of product test\n \n //Partner test started\n \n System.out.println(\"###Partner Test###\"); \n PartnerService partnerService = new PartnerService(new PartnerDao());\n\n Partner partnerTest = new Partner(1, \"Myco\", \"6331 N Kenmore Ave\", \"Chicago\", \"IL\", \"60660\", \"USA\", \"800-556-8876\", \"[email protected]\", \"http://www.xyz.com/\", true);\n partnerService.createPartner(partnerTest);\n \n System.out.println(\"Select partnerTest by id: \" + partnerService.getPartner(1));\n \n System.out.println(\"select All Partners: \" + partnerService.selectAllPartner());\n \n \n //End of partner test\n }", "public static void main(String[] args) {\n ArrayList saleEmployees = new ArrayList<>();\n saleEmployees.add(\"Irene\");\n saleEmployees.add(\"Mihael\");\n\n // emplyees list for service\n ArrayList purchaseEmployees = new ArrayList<>();\n purchaseEmployees.add(\"Eric\");\n purchaseEmployees.add(\"Irene\");\n\n\n Department direction = new Department(\"Alfred Boss\", \"Vorstand\");\n Department sale = new Department(\"Mustermann Max\", \"Vertrieb\", direction, saleEmployees);\n Department salePrivat = new Department(\"Musterfrau Angela\", \"Vertrieb Privatkunden\", sale);\n Department saleB2B = new Department(\"Muste Alfons\", \"Vertrieb Firmenkunden\", sale);\n Department purchase = new Department(\"Kufmann Alois\", \"Einkauf\", direction);\n Department purchaseMechanic = new Department(\"Gunz Herlinde\", \"Einkauf Mechanik\", purchase, purchaseEmployees);\n Department purchaseMechanicSmall = new Department(\"Friedrich Hermann\", \"Einkauf Kleinteile\", purchaseMechanic);\n Department purchaseMechanicBig = new Department(\"Peter Hannelore\", \"Einkauf Großteile\", purchaseMechanic);\n Department purchaseMechanicBigEU = new Department(\"But Moritz\", \"Einkauf Europa\", purchaseMechanicBig);\n Department service = new Department(\"Gyula H\", \"Service\");\n\n service.switchDepartment(saleB2B);\n service.switchDepartment(purchase);\n\n service.removeDepartment();\n\n sale.switchEmployees(\"Mihael\", purchaseMechanicBigEU);\n\n purchaseMechanicBigEU.switchDepartment(direction);\n direction.printOrganisation(\" \", \"- \", 1);\n\n }", "public void serviceRemoved(ServiceEvent event) {\n\t\t\tLog.e(\"z\", \"removed serivce: \" + event);\n\t\t}", "CancelOrderResponse cancelOrder(CancelOrderRequest cancelOrderRequest);", "public void verifyToDeleteService() throws Throwable{\r\n\t\tServicesPage srvpage=new ServicesPage();\r\n\t\tselServicOpt.click();\r\n\t\twdlib.waitForElement(getServiceText());\r\n\t\t\r\n\t\tif(getServiceText().getText().equals(\"None Included\"))\r\n\t\t{\r\n\t\t\tReporter.log(getServiceText().getText()+\" is deleted\",true);\r\n\t\t\tselServiceBtn.click();\r\n\t\t\twdlib.verify(wdlib.getPageTitle(),flib.getPropKeyValue(PROP_PATH, \"ServicesPage\") , \"Services Page \");\r\n\t\t\tsrvpage.selectServices();\r\n\t\t\tdeleteService();\r\n\t\t\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tdeleteService();\r\n\t\t}\r\n\t}", "public interface OrderService {\n\n /**\n * 司机发布信息\n *\n * @param idno\n * @param driverShareInfo\n * @return\n */\n DriverShareInfo shareDriverInfo(String idno, DriverShareInfo driverShareInfo);\n\n /**\n * 乘客预定校验\n *\n * @param idno\n * @param driverOrderId\n * @param passerOrderId\n * @param genToken\n * @return\n */\n Result passerReserveCheck(String idno, Long driverOrderId, Long passerOrderId, boolean genToken);\n\n /**\n * 乘客预定\n *\n * @param radomToken\n * @param idno\n * @param driverOrderId\n * @param passerOrderId\n * @return\n */\n Result passerReserve(String radomToken, String idno, Long driverOrderId, Long passerOrderId);\n\n\n}", "public interface OrderService {\n /**\n * Create new order object and put it to database\n *\n * @param cart cart with data about new order\n * @param user session user - order owner\n * @throws FlowerValidationException if flowers count in cart more then count in shop\n * @see Cart\n */\n void create(Cart cart, User user) throws FlowerValidationException;\n\n /**\n * Change order status in database to PAID\n *\n * @param order order to update\n * @see flowershop.backend.enums.OrderStatus\n */\n void pay(Order order);\n\n /**\n * Change order status in database to CLOSED\n *\n * @param order order to update\n * @see flowershop.backend.enums.OrderStatus\n */\n void close(Order order);\n\n /**\n * Delete corresponding order object from database\n *\n * @param id order id to delete\n */\n void delete(Long id);\n\n /**\n * Find order in database with given id\n *\n * @param id order id\n * @return Order dto\n */\n Order find(Long id);\n\n /**\n * Get all orders from database\n *\n * @return orders list\n */\n List<Order> getAll();\n\n /**\n * Get all orders of given user from database\n *\n * @param user orders owner\n * @return orders list\n */\n List<Order> getByUser(User user);\n\n /**\n * Get items list (bought flowers) of given order\n *\n * @param order order to get details\n * @return items list (bought flowers)\n * @see OrderFlowerData\n */\n List<OrderFlowerData> getFlowersData(Order order);\n\n /**\n * Generates detailed cart from regular cart to represent data\n *\n * @param cart Cart to be detailed\n * @return DetailedCart\n * @see Cart\n * @see DetailedCart\n */\n DetailedCart generateDetailedCart(Cart cart);\n}", "public void deleteAfterOrderGoods(AfterOrderGoods afterOrderGoods,String hql)\n\t\t\tthrows ErpServiceException {\n\t\ttry {\t \n\t\t\tafterSalesDao.deleteAfterOrderGoods(afterOrderGoods,hql);\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(e.getMessage());\n\t\t\tthrow new ErpServiceException(e.getMessage());\n\t\t}\n\t}", "@Override\n\t\tpublic void endService() {\n\t\t\t\n\t\t}", "Order removeDeliveredStatus(Order order, User user);", "public interface OrderDetailService {\n\t\n\t/**\n\t * This method is to create all order details to a specific order. \n\t * @param lOrderDetails List of details to a specific order.\n\t * @param order Order to assigned the list of details\n\t * @return\n\t */\n\tpublic int addOrderDetail(List<OrderDetail> lOrderDetails, Order order);\n\t\n\t/**\n\t * This method find all order details of the a specific order\n\t * @param orderId orderId\n\t * @return List of order detail asociated a specific order \n\t */\n\tpublic List<OrderDetail> getOrderDetailByOrder(Long orderId);\n\n}", "public void receiveOrder(MissMintOrder order) {\n\t\tAssert.notNull(order, \"order should not be null\");\n\n\t\tMissMintService service = serviceManager.getService(order);\n\t\tAssert.isTrue(orderService.isOrderAcceptable(service), \"service must be acceptable\");\n\t\titemCatalog.save(order.getItem());\n\n\t\torder.getOrderLines().forEach(orderLine ->\n\t\t\tfinanceService.add(\n\t\t\t\tmessages.get(\"orders.service.\" + orderLine.getProductName()) + \" \" + order.getId(),\n\t\t\t\torderLine.getPrice())\n\t\t);\n\n\t\tTimeTableEntry entry = timeTableService.createEntry(order);\n\t\torder.setExpectedFinished(entry.getDate());\n\t\torderManager.save(order);\n\t\tentryRepository.save(entry);\n\n\t\tServiceCategory serviceCategory = ServiceManager.getCategory(service);\n\t\tServiceConsumptionManager.serviceMatRelation.get(serviceCategory).forEach(x ->\n\t\t\t{\n\t\t\t\tString materialName = x.getFirst();\n\t\t\t\tQuantity quantity = x.getSecond();\n\t\t\t\tMaterial material = materialManager.fromName(materialName);\n\t\t\t\tUniqueInventoryItem item = materialInventory.findByProduct(material).orElseThrow(() -> new RuntimeException(\"could not find inventory item\"));\n\t\t\t\tmaterialManager.checkAndConsume(item.getId(), quantity.getAmount().intValue());\n\t\t\t}\n\t\t);\n\n\t}", "public void makeComplete(Order order) {}", "void transStatus()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(passenger != null && status.equals(\"soon\"))\r\n\t\t\t{\r\n\t\t\t\tService s_temp = new Service(passenger);\r\n\t\t\t\tdes = passenger.loc;\r\n\t\t\t\tmakeService(loc.i*80+loc.j,des.i*80+des.j);\r\n\t\t\t\tstatus = \"stop\";\r\n\t\t\t\tThread.sleep(1000);\r\n\t\t\t\tstatus = \"serve\";\r\n\t\t\t\tdes = passenger.des;\r\n\t\t\t\ts_temp.path.add(loc);\r\n\t\t\t\tmakeService(loc.i*80+loc.j,des.i*80+des.j,s_temp.path);\r\n\t\t\t\tstatus = \"stop\";\r\n\t\t\t\tThread.sleep(1000);\r\n\t\t\t\tcredit += 3;\r\n\t\t\t\tser_times += 1;\r\n\t\t\t\tservices.add(s_temp);\r\n\t\t\t\t//refresh:\r\n\t\t\t\tstatus = \"wait\";\r\n\t\t\t\tpassenger = null;\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Sorry to catch Exception!\");\r\n\t\t}\r\n\t}", "private static void checkArrivedOrderRemainder_RemoveArrivedOrder(\n StockDataBase dataBase, Order arrivedOrder) {\n if (arrivedOrder.getOrderDirection() == OrderDirection.BUY) {\n if (dataBase.getAwaitingBuyOrders().getCollection()\n .remove(arrivedOrder)) {\n MessagePrint.println(MessagePrint.Stream.OUT,\n Message.Out.StockDataBase\n .printOrderPerformedInItsEntirety());\n // FxDialogs.showInformation(\"INFO\", Message.Out.StockDataBase\n // .printOrderPerformedInItsEntirety());\n } else {\n MessagePrint.println(MessagePrint.Stream.ERR,\n new BuildError().getMessage() +\n Message.Err.Order.removeFail());\n FxDialogs.showError(\"ERROR\", new BuildError().getMessage() +\n Message.Err.Order.removeFail());\n }\n } else if (arrivedOrder.getOrderDirection() == OrderDirection.SELL) {\n\n if (dataBase.getAwaitingSellOrders().getCollection()\n .remove(arrivedOrder)) {\n MessagePrint.println(MessagePrint.Stream.OUT,\n Message.Out.StockDataBase\n .printOrderPerformedInItsEntirety());\n // FxDialogs.showInformation(\"INFO\", Message.Out.StockDataBase\n // .printOrderPerformedInItsEntirety());\n } else {\n MessagePrint.println(MessagePrint.Stream.ERR,\n new BuildError().getMessage() +\n Message.Err.Order.removeFail());\n FxDialogs.showError(\"ERROR\", new BuildError().getMessage() +\n Message.Err.Order.removeFail());\n }\n }\n }", "public void deleteService(){\r\n \tif(editService != null){\r\n \t\tint id = editService.getId();\r\n \t\ttry {\r\n\t \t\tif(id == 0){\r\n\t \t\t\tthis.getLog().error(\" unable to deleteService(). No id selected\");\r\n\t \t\t}else{\r\n\t \t\t\tthis.getLog().info(\" deleteService(\" + id + \")\");\r\n\t \t\t\tConnectionFactory.createConnection().deleteservice(editService.getId());\r\n\t \t\t}\r\n \t\t\tthis.getServiceList().populateServiceListFromDB();\r\n\t\t\t} catch (DataStorageException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n \t}\r\n }", "@Override\n\tpublic void serviceRemoved(ServiceEvent arg0) {\n\n\t}", "public void removeOrder() throws FlooringDaoException {\n boolean validDateOrderNumber = true;\n do {\n try {\n String date = view.getOrdersDate();\n int orderNumber = view.getOrderNumber();\n List<Order> ordersByDate = new ArrayList<>();\n ordersByDate = service.getOrdersByDate(date);\n view.displayOrderToEditOrDelete(ordersByDate, orderNumber);\n validDateOrderNumber = true;\n boolean confirmValid = true;\n do {\n try {\n String confirm = view.confirmDelete(); //unfortunately this line has to execute for it to pick up an invalidOrder exception. not the best but serviceable\n service.removeOrder(date, orderNumber, confirm);\n confirmValid = true;\n } catch (InvalidDataException ex) {\n view.displayError(ex.getMessage());\n confirmValid = false;\n }\n } while (!confirmValid);\n validDateOrderNumber = true;\n\n } catch (FlooringDaoException ex) {\n view.displayError(\"Orders file not found for given date. Please make sure your date is entered EXACTLY as YYYY-MM-DD or try a different date.\");\n validDateOrderNumber = false;\n } catch (NumberFormatException ex) {\n view.displayError(\"Invalid order number. Order number must consist of digits 0-9 only with no decimal points.\");\n validDateOrderNumber = false;\n } catch (InvalidOrderNumberException ex) {\n view.displayError(ex.getMessage());\n validDateOrderNumber = false;\n }\n } while (!validDateOrderNumber);\n }", "@Test\n public void shouldWithdrawTransportOrder() {\n Kernel kernel = getKernelFromSomewhere();\n\n // Get the transport order to be withdrawn.\n TransportOrder curOrder = getTransportOrderToWithdraw();\n // Withdraw the order.\n // The second argument indicates if the vehicle should finish the movements\n // it is already assigned to (false) or abort immediately (true).\n // The third argument indicates whether the vehicle's processing state should\n // be changed to UNAVAILABLE so it cannot be assigned another transport order\n // right after the withdrawal.\n kernel.withdrawTransportOrder(curOrder.getReference(), true, false);\n // end::documentation_withdrawTransportOrder[]\n }", "@Test\n public void testEditOrder() throws Exception {\n String stringDate1 = \"10012017\";\n LocalDate date = LocalDate.parse(stringDate1, DateTimeFormatter.ofPattern(\"MMddyyyy\"));\n\n String stringDate2 = \"11052020\";\n LocalDate date2 = LocalDate.parse(stringDate2, DateTimeFormatter.ofPattern(\"MMddyyyy\"));\n\n Orders edittedOrder = new Orders(1);\n edittedOrder.setOrderNumber(1);\n edittedOrder.setDate(date2);\n edittedOrder.setCustomerName(\"Jenna\");\n edittedOrder.setArea(new BigDecimal(\"30\"));\n Tax tax = new Tax(\"PA\");\n tax.setState(\"PA\");\n edittedOrder.setTax(tax);\n Product product = new Product(\"Tile\");\n product.setProductType(\"Tile\");\n edittedOrder.setProduct(product);\n service.addOrder(edittedOrder);\n\n Orders oldOrder = service.getOrder(date, 1);\n service.editOrder(oldOrder, edittedOrder);\n\n// Testing order date and product change \n assertEquals(new BigDecimal(\"4.15\"), service.getOrder(edittedOrder.getDate(), edittedOrder.getOrderNumber()).getProduct().getLaborCostPerSqFt());\n assertEquals(new BigDecimal(\"6.75\"), service.getOrder(edittedOrder.getDate(), edittedOrder.getOrderNumber()).getTax().getTaxRate());\n\n try {\n// Testing if order was removed from previous the date after the edit method\n service.getOrder(date, 1).getProduct().getProductType();\n fail(\"Exception was expected\");\n } catch (Exception e) {\n return;\n }\n\n }", "public interface DeliveryService {\n\n public List<Delivery> listDelivery(int pageStart, int pageSize);\n\n public int countDelivery();\n\n public List<Delivery> listDeliveryByStock(int pageStart, int pageSize, String class_id, String entity_id, String stock_id, String officeId);\n\n public List<Delivery> listDeliveryByOffice(int pageStart, int pageSize,String stock_id);\n\n public List<Delivery> listDeliveryUNIONStorageByOffice(int pageStart, int pageSize, String stock_id);\n\n public Map<String, Object> addDelivery(Stock stock, Delivery delivery,String status);\n\n public Map<String, Object> addDelivery(Delivery delivery, String status);\n\n public boolean updateDeliveryStatus(String id);\n\n public Map<String, Object> deliveryReport(String startDate,String endDate);\n\n}", "Service(){\r\n\t\tserviceName =\"x\";\r\n\t\tserviceID = 0;\r\n\t\tserviceFee = 0.0;\r\n\t\tserviceDescrp = \"zztop\";\r\n\t}", "public interface BuyerService {\n\n //查询一个订单\n OrderDTO findOrderOne(String openid, String orderId);\n\n //取消订单\n OrderDTO cancelOrder(String openid, String orderId);\n}", "public void delOrderAfterHandle(AfterOrderHandle afterOrderHandle)\n\t\t\tthrows ErpServiceException {\n\t\ttry {\t \n\t\t\tafterSalesDao.delOrderAfterHandle(afterOrderHandle);\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(e.getMessage());\n\t\t\tthrow new ErpServiceException(e.getMessage());\n\t\t}\n\t}", "void cancelOrder(String orderKey);", "public interface OrderService {\n\n MiaoshaOrder getMiaoshaOrderByUserIdGoodsId(long userId, long goodsId);\n\n OrderInfo createOrder(MiaoshaUser user, GoodsVo goods);\n\n OrderInfo getOrderById(long orderId);\n\n OrderInfo miaosha(MiaoshaUser user, GoodsVo goods);\n\n long getMiaoshaResult(Long userId, long goodsId);\n\n int updateOrderStatusById(OrderInfo orderInfo);\n\n int closeOrder(Date deadLine);\n}", "@Override\n\tpublic void CancelOrder(Order order) {\n\t\t\n\t}", "public PedidosState IrPedidoNovo() {\r\n\t\tSystem.out.print(\"Pedido Cancelado pelo cliente!\\n\"); \r\n\t\treturn null;\r\n\t\t}", "@Override\n\tpublic int addService(Service serviceDTO) {\n\t\tcom.svecw.obtr.domain.Service serviceDomain = new com.svecw.obtr.domain.Service();\n\t\tserviceDomain.setSourceId(serviceDTO.getSourceId());\n\t\tserviceDomain.setDestinationId(serviceDTO.getDestinationId());\n\t\tserviceDomain.setNoOfSeats(serviceDTO.getNoOfSeats());\n\t\tserviceDomain.setFare(serviceDTO.getFare());\n\t\tserviceDomain.setDistance(serviceDTO.getDistance());\n\t\tserviceDomain.setJourneyDate(serviceDTO.getJourneyDate());\n\t\tserviceDomain.setArrivalTime(serviceDTO.getArrivalTime());\n\t\tserviceDomain.setDepartureTime(serviceDTO.getDepartureTime());\n\t\tserviceDomain.setStatus(serviceDTO.getStatus());\n\t\treturn iServiceDAO.addService(serviceDomain);\n\t}", "@Override\n\tpublic void takeNewOrder() {\n\t\tif(customersInLine.size()>0&&wait==0){\n\t\t\tint customerSelectedIndex = 0;\n\t\t\tfor(int i=0; i<customersInLine.size(); i++){\n\t\t\t\tif(customersInLine.get(i).getTimeToPrepare()<customersInLine.get(customerSelectedIndex).getTimeToPrepare()){\n\t\t\t\t\tcustomerSelectedIndex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetWait(customersInLine.get(customerSelectedIndex).getTimeToPrepare());\n\t\t\taddToProfit(customersInLine.get(customerSelectedIndex).getCostOfOrder());\n\t\t\tcustomersInLine.remove(customerSelectedIndex);\n\t\t\tcustomersInRestaurant--;\n\t\t}\n\t}", "void rejectOrder(int id, String reason) throws ServiceException;", "void rejectNewOrders();", "private void reconsiderStop(NodeReference position, NodeReference station, IVehicleContext context) {\n NodeReference prev = context.getChargingStop();\n float ar = context.getEV().getActionRadius() / 1000; //convert m to km.\n //float distanceBef = (float) context.calculateRouteReference(position).resolveDistance(context.getGraphReference());\n context.scheduleChargingStop(station);\n float distanceAft = (float) context.calculateRouteReference(position).resolveDistance(context.getGraphReference());\n if (distanceAft > ar) {\n context.scheduleChargingStop(prev);\n }else{\n eventcontroller.publishEvent(\"agent:dmas:reconsider\", \"vehicle\",context.getEV().getVehicleEntity().getVehicleReference().getId());\n }\n }", "public void add(Department dep)\n\t{\n\t\tHRProtocol envelop = null;\n\t\tenvelop = new HRProtocol(HRPROTOCOL_ADD_DEPARTMENT_REQUEST, dep, null);\n\t\tsendEnvelop(envelop);\n\t\tenvelop = receiveEnvelop();\n\t\tif(envelop.getPassingCode() == HRPROTOCOL_ADD_DEPARTMENT_RESPONSE)\n\t\t{\t//Success in transition\n\t\t}else\n\t\t{\n\t\t\t//Error in transition. or other error codes.\n\t\t}\n\t}", "public void changeOutofService(Room room);", "public interface EssayGalaxyService {\n Object order(Long start, Long end);\n}", "@Override\n\tpublic void returnVehicleForService(Integer vehicle_number) {\n\n\t}", "@Override\n\tpublic Integer deleteServices(com.easybooking.model.BookedServices services) {\n\t\tint i = 0;\n\t\tSessionFactory factory = HibernateUtil.getSesssionFactory();\n\t\tSession session = factory.openSession();\n\t\tsession.beginTransaction();\n\t\tsession.delete(services);\n\t\tsession.getTransaction().commit();\n\t\tsession.close();\n\t\tfactory.close();\n\t\treturn i;\n\t}", "public void processReturnShipment() {\n \n }", "public void onSaveService(final ForwardEvent event) {\r\n\t\t// Get the listitem from the event's target (button)\r\n\t\t// parent(hbox)->parent(listcell)->parent(listitem)\r\n\t\tfinal Listitem li = (Listitem) event.getOrigin().getTarget().getParent().getParent().getParent();\r\n\t\tfinal MasterService service = (MasterService) li.getValue();\r\n\r\n\t\t// save the service\r\n\t\tfinal IPaymentDAO paymentDAO = (IPaymentDAO) SpringUtil.getBean(\"paymentDAO\");\r\n\t\tpaymentDAO.addMasterService(service);\r\n\r\n\t\t// Get the listmodel and update this service in it\r\n\t\tfinal ListModelList services = (ListModelList) page.getAttribute(\"serviceslist\");\r\n\t\tint indx = getListIndex(service, services);\r\n\t\tservices.set(indx, service);\r\n\t\tpage.setAttribute(\"serviceslist\", services);\r\n\t\tfinal Listbox lstservice = (Listbox) Path.getComponent(page, \"lstservice\");\r\n\t\tlstservice.setModel(services);\r\n\t\tlstservice.invalidate();\r\n\t\tClients.evalJavaScript(\"$.jGrowl(\\\"Successfully Saved the service\\\", {life:2000});\");\r\n\t}", "@Override\r\n public void notifyEndOfSale(RevenueDTO revenue) {\r\n\r\n }", "boolean isOrderCertain();", "public interface OrderService {\n OrderDto makeOrder(OrderDto orderDto);\n\n List<OrderDto> getAllOrders(String userPhone);\n\n void removeOrderById(Long id);\n\n boolean getOrderById(Long id);\n\n List<OrderDto> getAllOrders();\n\n List<OrdersEntity> getOrders();\n\n OrderDto acceptOrder(OrderDto orderDto);\n\n List<OrderDto> getAcceptOrders(String driverPhone);\n\n OrderDto removeAcceptedOrder(Long id);\n}", "private void departure(int intersection, double time, Vehicle veh, Direction direction) {\n // Last departure -> exit\n switch (direction) {\n case S:\n departureFromSouth(intersection, time, veh) ;\n break;\n case E:\n departureFromEast(intersection, time, veh);\n break;\n case W:\n departureFromWest(intersection, time, veh);\n break;\n default:\n System.out.println(\"Error - EventHandler.departure: No such direction!\");\n }\n }", "public void haltMarket(OrderManagementContext orderManagementContext_);", "public Position handleExternalServiceDown(String name)\r\n\t{\n\t\tPosition position = new Position();\r\n\t\tVehicle vehicle = repository.findByName(name);\r\n\t\tposition.setLat(vehicle.getLat());\r\n\t\tposition.setLongitude(vehicle.getLongitude());\r\n\t\tposition.setTimestamp(vehicle.getLastRecordedPosition());\r\n\t\tposition.setUpToDate(false);\r\n\t\treturn position;\r\n\t}", "@Override\r\n\tpublic sn.ucad.master.assurance.bo.Service ajoutService(sn.ucad.master.assurance.bo.Service service) {\n\t\treturn serviceRepository.save(service);\r\n\t}", "public interface RentToBuyService {\n}", "public void VehiclePositionIsFinal() {\n\t\tInteger idVehicle ;\n\t\tdouble lat;\n\t\tdouble lon;\n\t\tVehicle vehicle;\n\ttry {\n\t\tVehicleIntervention vehicleIntervention = VehicleIntervention.getInstance();\n\t\tif( ! vehicleIntervention.listIntervention.isEmpty()) {\n\t\t\t//parcourir toutes les interventions\n\t\t\t for( InterventionDto intervention: vehicleIntervention.listIntervention) {\n\t\t\t\t idVehicle = intervention.getVehicle().getId();\n\t\t\t\t lat = intervention.getFireLat();\n\t\t\t\t lon = intervention.getFireLon();\n\t\t\t\t vehicle = getVehicleById(idVehicle);\nSystem.out.println(\"vehicle:\" +vehicle.getId()+ \" at \"+vehicle.getLat() +\":\"+vehicle.getLon());\n \n\t\t\t\t //si le vehicule arrive a proximite et l'intensite du fire est nulle \n\t\t\t\t if( Math.abs(vehicle.getLat() - lat)<1e-3 \n\t\t\t\t\t\t && Math.abs(vehicle.getLon() - lon)<1e-3\n\t\t\t\t\t\t &&isFireOut(lat,lon) ) {\n\t\t\t\t\t //supprimer le vehicule de la liste\n\t\t\t\t\t vehicleIntervention.listIntervention.remove(intervention);\n\t\t\t\t\t //changer l'etat du vehicule\n\t\t\t\t\t Vehicle getvehicle = vRepository.findById(idVehicle).get();\n\t\t\t\t\t getvehicle.setIntervention(false);\n\t\t\t\t\t vRepository.save(getvehicle);\n\t\t\t\t\t \nSystem.out.println(\"Fire:\" + \" at \"+lat +\":\"+lon+\" is out thanks to vehicle: \"+idVehicle+\" Intervention:\"+getvehicle.isIntervention());\n\t\t\t\t }\n\t\t\t \t}\n\t\t }\n\t}\n\t\tcatch(Exception e) {\n\t\t\tSystem.out.println(e);\n\t\t}\n\t}", "protected void processOrder( Game game )\n {\n }", "public interface VehicleAssignmentService {\n\n /**\n * Get a list of vehicles assigned to the named depot.\n * \n * @param depotIdentifier The depot identifier to request vehicles for.\n */\n public ArrayList<AgencyAndId> getAssignedVehicleIdsForDepot(String depotIdentifier)\n throws Exception;\n\n /**\n * Get depot for the given vehicleId, assuming the depot has been previously requested\n * with getAssignedVehicleIdsForDepot().\n * \n * @param vehicleId The vehicle identifier to request depot for.\n */\n public String getAssignedDepotForVehicleId(AgencyAndId vehicle);\n\n}", "public void notifyDeleteRequestState (COPSPdpOSReqStateMan man);", "public interface ConsultarExpedienteService {\n \n DyctContribuyenteDTO buscarNumcontrol(String numControl); \n \n DeclaracionConsultarExpedienteVO buscarOrigenSaldo(String numControl); \n \n ExpedienteDTO buscarExpedienteNumControl(String noControl);\n \n TramiteCortoDTO buscaNumeroControl(String noControl, String rfc);\n \n TramiteCortoDTO buscaNumeroControl(String noControl);\n \n List<DocumentoReqDTO> buscaDocumentoRequerido (String numControl);\n \n List<SolicitudAdministrarSolVO> selecXNumControlEstAprobado(String numControl);\n\n void actualizarFolioNYVFechaNoti(String numControlDoc, String numControl, String folio, String fecha) throws SIATException;\n \n}", "public interface OrderService {\n\n List<OrderInfoDto> getAllOrders();\n\n Long addNewOrder(OrderDto orderDto);\n\n OrderInfoDto getOrderInfoById(Long id);\n\n OrderDto getOrderById(Long id);\n\n void setTruckForOrder(Long orderId, Long truckId);\n\n void setDriverForOrder(Long orderId, Long driverId);\n\n void detachDriver(Long orderId, Long driverId);\n\n <T> T getCurrentOrderByDriverLogin(String login, Class<T> tClass);\n\n List<OrderInfoBoardDto> getOrdersInfo();\n\n List<CityDto> getRouteByOrderId(Long orderId);\n\n void addCityToRoute(Long orderId, List<Long> cityIdList);\n\n void removeCityFromRoute(Long orderId, Long cityId);\n\n void updateBoardUpdateOrder(Order order);\n\n void updateBoardUpdateOrder(String driverLogin);\n\n void closeOrder(Long orderId);\n\n boolean isAllPointsDoneByOrder(Order order);\n\n boolean isAllPointsDoneByOrderId(Long orderId);\n\n Order sortPathPointsByRoute(Order order);\n\n}", "private void carsReadyToLeave() {\n\t\tCar car = getFirstLeavingCar();\n\t\twhile (car != null) {\n\t\t\tif (car.getHasToPay()) {\n\t\t\t\tcar.setIsPaying(true);\n\t\t\t\tpaymentCarQueue.addCar(car);\n\t\t\t} else {\n\t\t\t\tcarLeavesSpot(car);\n\t\t\t}\n\t\t\tcar = getFirstLeavingCar();\n\t\t}\n\t}", "public void addOrderAfterHandle(AfterOrderHandle afterOrderHandle) throws ErpServiceException {\n\t\ttry {\t \n\t\t\tafterSalesDao.addAfterOrderHandle(afterOrderHandle);\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(e.getMessage());\n\t\t\tthrow new ErpServiceException(e.getMessage());\n\t\t}\n\t\t\n\t}", "TransportationServiceType getFinalDeliveryTransportationService();", "@Override\r\n\tpublic void onStopOrder(StopOrder StopOrder) throws Exception {\n\t\t\r\n\t}", "public interface DownPaiementService {\r\n\r\n\t/**\r\n\t * Envoie d'un paiement vers saphir pour chaque {@link Paiement} reçue.\r\n\t * \r\n\t * @param commande\r\n\t * {@link Commande}.\r\n\t * @param paiement\r\n\t * {@link Paiement}.\r\n\t */\r\n\tpublic void envoiePaiement(Commande commande, Paiement paiement);\r\n\r\n}", "public DATE getDebutService(){\n\t\treturn debutService;\n\t}", "public interface OperationService {\n\n //在每次插座开断的时候插入状态的变化\n public int insertOperation(OperationPO operationPO);\n //根据时段查看所有的变换\n public List<OperationPO> selectOperation(TimeSpanBO timeSpanBO);\n}", "@SuppressWarnings(\"rawtypes\")\n public void service(DynamoHttpServletRequest request, DynamoHttpServletResponse response) throws ServletException, IOException {\n double itemDiscountAmount = 0.0d;\n double orderDiscountAmount = 0.0d;\n double shippingDiscountAmount = 0.0d;\n\n Order order = (Order) request.getLocalParameter(ORDER);\n if (order == null) {\n if (isLoggingError()) {\n logError(\"Order is a required parameter to display user \");\n }\n return;\n }\n List activePromotions = (List) request.getObjectParameter(ACTIVE_PROMOTIONS);\n\n List<AppliedPromotion> orderAppliedPromotions = new ArrayList<AppliedPromotion>();\n\n try {\n /**\n * First find out Order level promotion\n */\n if (order.getPriceInfo() != null) {\n List adjustments = (List) order.getPriceInfo().getAdjustments();\n if (adjustments != null) {\n getPromotionFromAdjustment(adjustments, orderAppliedPromotions, \"order\");\n }\n }\n\n List<?> sgList = order.getShippingGroups();\n if (sgList.size() >= 1) {\n Iterator<?> sgiter = sgList.iterator();\n while (sgiter.hasNext()) {\n ShippingGroup sg = (ShippingGroup) sgiter.next();\n ShippingPriceInfo shipPricingInfo = sg.getPriceInfo();\n if (shipPricingInfo != null) {\n List adjustments = (List) shipPricingInfo.getAdjustments();\n if (adjustments != null) {\n getPromotionFromAdjustment(adjustments, orderAppliedPromotions, \"shipping\");\n }\n }\n }\n }\n\n List commerceItems = (List) order.getCommerceItems();\n if (commerceItems != null) {\n Iterator ciIter = commerceItems.iterator();\n while (ciIter.hasNext()) {\n MFFCommerceItemImpl ci = (MFFCommerceItemImpl) ciIter.next();\n ItemPriceInfo priceInfo = ci.getPriceInfo();\n\n if (priceInfo != null) {\n\n List adjustments = (List) priceInfo.getAdjustments();\n if (adjustments != null) {\n getPromotionFromAdjustment(adjustments, orderAppliedPromotions, \"item\");\n }\n }\n }\n }\n applyRemainingActivePromotions(activePromotions,orderAppliedPromotions);\n itemDiscountAmount = calculateCouponItemDiscountAdjustments(commerceItems);\n orderDiscountAmount = calculateCouponOrderDiscountAdjustments(order);\n shippingDiscountAmount = calculateCouponShippingDiscountAdjustments(sgList);\n } catch (ClaimableException e) {\n if (isLoggingError()) {\n logError(\"Some error in fetching coupons applied.\", e);\n }\n }\n \n boolean showOutput = false;\n\n double totalCouponDiscountAmount = 0.0d;\n \n // 2564 - Handle free item shipping promos\n boolean hasItemShipDiscount = false;\n \n if (orderAppliedPromotions != null && orderAppliedPromotions.size() > 0) {\n Iterator itr = orderAppliedPromotions.iterator();\n while(itr.hasNext()){\n AppliedPromotion promo = (AppliedPromotion) itr.next();\n if(promo != null){\n \t// Flag free item shipping promos\n \tif(promo.isItemShipping()) {\n \t\thasItemShipDiscount=true;\n \t}\n if( promo.getDiscountType().equalsIgnoreCase(\"item\") && itemDiscountAmount > 0.0d){\n promo.setDiscountAmount(itemDiscountAmount);\n totalCouponDiscountAmount+=itemDiscountAmount;\n }else if( promo.getDiscountType().equalsIgnoreCase(\"shipping\") && shippingDiscountAmount > 0.0d){\n promo.setDiscountAmount(shippingDiscountAmount);\n totalCouponDiscountAmount+=shippingDiscountAmount;\n }else if( promo.getDiscountType().equalsIgnoreCase(\"order\") && orderDiscountAmount > 0.0d){\n promo.setDiscountAmount(orderDiscountAmount);\n totalCouponDiscountAmount+=orderDiscountAmount;\n }\n }\n }\n request.setParameter(RESULT, orderAppliedPromotions);\n }\n request.setParameter(COUPON_DISCOUNT, totalCouponDiscountAmount);\n request.setParameter(SHOW_OUTPUT, showOutput);\n // 2564 - Free item shipping promos will not have a $ discount\n // returning this flag to adjust the display on UI\n request.setParameter(\"hasItemShipDiscount\", hasItemShipDiscount);\n request.serviceLocalParameter(OUTPUT, request, response);\n }" ]
[ "0.6353346", "0.6052865", "0.5899312", "0.5797719", "0.5774068", "0.5552094", "0.5533782", "0.5437647", "0.5416232", "0.54075974", "0.5373799", "0.5334539", "0.52925193", "0.52900416", "0.5277955", "0.52694917", "0.5258177", "0.5250732", "0.5225811", "0.5224966", "0.5218805", "0.52004725", "0.5176185", "0.51658845", "0.5154197", "0.5153926", "0.5149835", "0.51330125", "0.5132779", "0.51290256", "0.510144", "0.50953424", "0.5094777", "0.5091602", "0.5081876", "0.50791043", "0.5078528", "0.5072387", "0.5068777", "0.50667524", "0.50549275", "0.5052768", "0.50527596", "0.50425816", "0.5036496", "0.50149745", "0.50146556", "0.50135815", "0.50095296", "0.50082207", "0.4993331", "0.4986696", "0.49861047", "0.4976252", "0.49756983", "0.4968901", "0.49671528", "0.49650607", "0.49611548", "0.49597666", "0.49557522", "0.49484548", "0.4947133", "0.49446765", "0.49415925", "0.4938603", "0.4937367", "0.4934576", "0.49344873", "0.4934054", "0.4930289", "0.49295276", "0.49154514", "0.49150518", "0.49091038", "0.49063897", "0.4905745", "0.49048567", "0.49047002", "0.4904318", "0.4901085", "0.48967415", "0.48963442", "0.48913127", "0.4886748", "0.4886268", "0.4882525", "0.48819396", "0.48728788", "0.48645356", "0.48627612", "0.48620793", "0.48588943", "0.48505026", "0.48499033", "0.48499027", "0.48456174", "0.48432258", "0.4830209", "0.48285142" ]
0.59702235
2
Load file, assuming UTF8 encoding
public void load() throws IOException { mText = null; mTicks.clear(); if (mLoadTicks && isAlreadyTicked()) { File tickFile = getTickFile(false); ZipFile zip = new ZipFile(tickFile); String basename = null; // Find ticked file name from ZIP Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); String name = entry.getName(); int idx = name.indexOf(TickConstants.TICK_ENTRY_EXT); if (idx != -1) { basename = name.substring(0, idx); } } // file ZipEntry fileEntry = zip.getEntry(basename); byte[] data = FileUtil.load(zip.getInputStream(fileEntry)); mText = new String(data, "UTF-8"); // registry mRegistry = new TickRegistry(); mRegistry.loadDefinitions(); // ticks ZipEntry tickEntry = zip.getEntry(basename + TickConstants.TICK_ENTRY_EXT); mTicks.addAll(loadTicks(zip.getInputStream(tickEntry))); mBasename = basename; } else { byte[] data = FileUtil.load(mFile); mText = new String(data, "UTF-8"); mBasename = mFile.getName(); // registry mRegistry = new TickRegistry(); mRegistry.loadDefinitions(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void load() {\n\t\tFileHandle file = Gdx.files.internal(DogRunner.PARENT_DIR + \"charset.txt\");\n\t\tcharset = file.readString();\n\t}", "@Test\n\tpublic void testUTF8() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(\n\t\t\t\tnew InputStreamReader(new FileInputStream(UTF8_FILE), \"UTF-8\")\n\t\t);\n\t\tReadTestCSVFile(reader);\n\t}", "public void loadFromFile(String file) throws IOException {\n loadFromFile(file,DEFAULT_CHAR_SET);\n }", "public void convertToUTF8() {\n FileInputStream istream = null;\n Writer out = null;\n try {\n istream = new FileInputStream(path);\n BufferedInputStream in = new BufferedInputStream(istream);\n CharsetDecoder charsetDecoder = Charset.forName(\"UTF-8\").newDecoder();\n charsetDecoder.onMalformedInput(CodingErrorAction.REPLACE);\n charsetDecoder.onUnmappableCharacter(CodingErrorAction.REPLACE);\n Reader inputReader = new InputStreamReader(in, charsetDecoder);\n StringWriter writer = new StringWriter();\n IOUtils.copy(inputReader, writer);\n String theString = writer.toString();\n FileUtils.deleteQuietly(new File(path));\n out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path), \"UTF-8\"));\n out.write(theString);\n out.close();\n// System.out.println(\"\");\n } catch (FileNotFoundException ex) {\n logger.error(\"Error converting the file to utf8\", ex);\n } catch (IOException ex) {\n logger.error(\"Error converting the file to utf8\", ex);\n } finally {\n try {\n if (out != null) {\n out.close();\n }\n if (istream != null) {\n istream.close();\n }\n } catch (IOException ex) {\n logger.error(\"Error converting the file to utf8\", ex);\n }\n }\n\n }", "void load(File file);", "public void load (File file) throws Exception;", "public void loadFile(File p_file) throws IOException;", "public String loadFileAsString(String filename) throws java.io.IOException {\n\t final int BUFLEN=1024;\n\t BufferedInputStream is = new BufferedInputStream(new FileInputStream(filename), BUFLEN);\n\t try {\n\t ByteArrayOutputStream baos = new ByteArrayOutputStream(BUFLEN);\n\t byte[] bytes = new byte[BUFLEN];\n\t boolean isUTF8=false;\n\t int read,count=0; \n\t while((read=is.read(bytes)) != -1) {\n\t if (count==0 && bytes[0]==(byte)0xEF && bytes[1]==(byte)0xBB && bytes[2]==(byte)0xBF ) {\n\t isUTF8=true;\n\t baos.write(bytes, 3, read-3); // drop UTF8 bom marker\n\t } else {\n\t baos.write(bytes, 0, read);\n\t }\n\t count+=read;\n\t }\n\t return isUTF8 ? new String(baos.toByteArray(), \"UTF-8\") : new String(baos.toByteArray());\n\t } finally {\n\t try{ is.close(); } catch(Exception ex){} \n\t }\n\t }", "public void load(InputStream stream) {\n Validate.notNull(stream, \"Stream may not be null\");\n\n load(new InputStreamReader(stream, StandardCharsets.UTF_8));\n }", "private static String loadFile(File file) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(file));\n\t\treturn br.readLine();\n\t}", "public void load(File source);", "public boolean load(String file);", "public static String loadFileAsString(String filename) throws java.io.IOException {\r\n final int BUFLEN=1024;\r\n BufferedInputStream is = new BufferedInputStream(new FileInputStream(filename), BUFLEN);\r\n try {\r\n ByteArrayOutputStream baos = new ByteArrayOutputStream(BUFLEN);\r\n byte[] bytes = new byte[BUFLEN];\r\n boolean isUTF8=false;\r\n int read,count=0;\r\n while((read=is.read(bytes)) != -1) {\r\n if (count==0 && bytes[0]==(byte)0xEF && bytes[1]==(byte)0xBB && bytes[2]==(byte)0xBF ) {\r\n isUTF8=true;\r\n baos.write(bytes, 3, read-3); // drop UTF8 bom marker\r\n } else {\r\n baos.write(bytes, 0, read);\r\n }\r\n count+=read;\r\n }\r\n return isUTF8 ? new String(baos.toByteArray(), \"UTF-8\") : new String(baos.toByteArray());\r\n } finally {\r\n try{ is.close(); } catch(Exception ex){}\r\n }\r\n }", "@Test\n\tpublic void testUTF16LE() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(\n\t\t\t\tnew InputStreamReader(new FileInputStream(UTF16LE_FILE), \"UTF-16le\")\n\t\t);\n\t\tReadTestCSVFile(reader);\n\t}", "@Test\n @JUnitTemporaryDatabase // Relies on specific IDs so we need a fresh database\n public void testImportUtf8() throws Exception {\n createAndFlushServiceTypes();\n createAndFlushCategories();\n \n //Initialize the database\n ModelImporter mi = m_importer;\n String specFile = \"/utf-8.xml\";\n mi.importModelFromResource(new ClassPathResource(specFile));\n \n assertEquals(1, mi.getNodeDao().countAll());\n // \\u00f1 is unicode for n~ \n assertEquals(\"\\u00f1ode2\", mi.getNodeDao().get(1).getLabel());\n }", "public void\tload(String fileName) throws IOException;", "@Test\n\tpublic void testUTF16BE() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(\n\t\t\t\tnew InputStreamReader(new FileInputStream(UTF16BE_FILE), \"UTF-16be\")\n\t\t);\n\t\tReadTestCSVFile(reader);\n\t}", "public abstract void load() throws IOException;", "@Override\n void load(String data) {\n }", "static String readFile(String path, Charset encoding) throws IOException {\n\t\tbyte[] encoded = Files.readAllBytes(Paths.get(path));\n\t\treturn encoding.decode(ByteBuffer.wrap(encoded)).toString();\n\t}", "default void load(String file) {\n load(new File(file));\n }", "private void Load( String szFileName )\n throws FileNotFoundException, NullPointerException, AppException\n {\n FileInputStream fs = null;\n File f = null;\n long nFileSize;\n \n f = new File( szFileName );\n if( !f.exists() || !f.canRead() )\n throw new FileNotFoundException( \"File \" + f.getPath() );\n\n try\n {\n nFileSize = f.length();\n fs = new FileInputStream( f );\n\n CharsetDecoder utf8Decoder = Charset.forName( \"UTF-8\" ).newDecoder();\n byte[] Data = null;\n\n // Read user name length and user name in UTF8\n if( nFileSize < 2 )\n throw new AppException( \"Bad file \" + f.getPath() );\n int nLength = (fs.read() << 8) | fs.read();\n nFileSize -= 2;\n if( nFileSize < nLength )\n throw new AppException( \"Bad file \" + f.getPath() );\n nFileSize -= nLength;\n Data = new byte[nLength];\n fs.read( Data );\n m_UserName = utf8Decoder.decode( ByteBuffer.wrap( Data ) ).toString();\n\n // Read user unique ID\n if( nFileSize < 16 )\n throw new AppException( \"Bad file \" + f.getPath() );\n nFileSize -= 16;\n m_Key = new byte[16];\n fs.read( m_Key );\n\n // Read template length and template data\n if( nFileSize < 2 )\n throw new AppException( \"Bad file \" + f.getPath() );\n nLength = (fs.read() << 8) | fs.read();\n nFileSize -= 2;\n if( nFileSize != nLength )\n throw new AppException( \"Bad file \" + f.getPath() );\n m_Template = new byte[nLength];\n fs.read( m_Template );\n fs.close();\n }\n catch( SecurityException e )\n {\n if( f == null )\n throw new AppException( \"Denies read access to the file \" + f.getPath() );\n else {\n throw new AppException( \"Denies read access to the file \" + szFileName );\n }\n }\n catch( IOException e)\n {\n if( f == null )\n throw new AppException( \"Bad file \" + f.getPath() );\n else\n throw new AppException( \"Bad file \" + szFileName );\n }\n }", "private static String loadFile(String path){\n try {\n\n BufferedReader reader = new BufferedReader(new FileReader(path));\n StringBuilder sb = new StringBuilder();\n\n String line;\n while((line = reader.readLine()) != null){\n sb.append(line);\n sb.append('\\n');\n }\n\n reader.close();\n return sb.toString();\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n return null;\n } catch (IOException e) {\n e.printStackTrace();\n return null;\n }\n }", "public static String read(File file) throws Exception {\r\n\t\treader.setFile(file);\r\n\t\treader.setCharset(\"UTF-8\");\r\n\t\treturn reader.read();\r\n\t}", "public String loadFromFile() {\n StringBuilder sb = new StringBuilder();\n try {\n Log.d(\"DEBUG\", this.context.getPackageName());\n Log.d(\"DEBUG\", this.file);\n FileInputStream fis = context.openFileInput(file);\n BufferedReader br = new BufferedReader(new InputStreamReader(fis, this.encoding));\n String line;\n while(( line = br.readLine()) != null ) {\n sb.append( line );\n sb.append( '\\n' );\n }\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n return sb.toString();\n }", "public void load (IFile file) throws Exception;", "@Test\n\tpublic void testUTF8WithoutBom() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(\n\t\t\t\tnew InputStreamReader(new FileInputStream(UTF8_NO_BOM_FILE), \"UTF-8\")\n\t\t);\n\t\tReadTestCSVFile(reader);\n\t}", "private String readFile(String path, Charset encoding) throws IOException \r\n\t{\r\n\t\tbyte[] encoded = Files.readAllBytes(Paths.get(path));\r\n\t\treturn new String(encoded, encoding);\r\n\t}", "public void load(Tokenizer tokenizer) throws IOException {\n this.load(tokenizer, StandardCharsets.UTF_8);\n }", "@Override\n\tpublic Object load(String file) {\n\t\treturn null;\n\t}", "public void load(String filename) throws IOException\n {\n DataInputStream input;\n\n try\n {\n input = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(filename))));\n }\n catch (Exception e)\n {\n throw new IOException(\"Cannot open input file \" + filename + \":\" + e.getMessage());\n }\n load(input);\n input.close();\n }", "private Set<String> loadSpecialCharacters() throws FileNotFoundException {\n return new BufferedReader(new FileReader(SPECIAL_CHARACTERS_FILE))\n .lines()\n .collect(Collectors.toSet());\n }", "public Resource load(String filename) throws MalformedURLException;", "private void load() {\n try {\n StringBuilder sb = new StringBuilder();\n InputStreamReader isr = new InputStreamReader(SpellCheckerDemo.class.getResourceAsStream(\"/org/jdesktop/swingx/demo/JuliusCaesar.txt\"));\n BufferedReader br = new BufferedReader(isr);\n String str;\n while((str = br.readLine()) != null) {\n sb.append(str);\n sb.append(\"\\n\");\n }\n str = sb.toString();\n textArea.setText(str);\n } catch (Throwable t) {\n logger.log(Level.SEVERE,\"Unable to load the text.\",t);\n }\n }", "public void load(String filename) {\n\t\tsetup();\n\t\tparseOBJ(getBufferedReader(filename));\n\t}", "public String loadTextFile(String path) throws IOException {\n File file = new File(path);\n\n // Convert the file to a string.\n String output;\n try {\n output = Files.toString(file, Charsets.UTF_8);\n } catch (IOException ex) {\n LoggerFactory.getLogger(Resources.class).error(\"Unable to locate the resource at \" + path + \".\", ex);\n throw ex;\n }\n\n return output;\n }", "static String readFile(String path, Charset encoding)\n throws IOException\n {\n byte[] encoded = Files.readAllBytes(Paths.get(path));\n return new String(encoded, encoding);\n }", "public void load (String argFileName) throws IOException;", "@Test\n\tpublic void testUTF16() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(\n\t\t\t\tnew InputStreamReader(new FileInputStream(UTF16LE_FILE), \"UTF-16\")\n\t\t);\n\t\tReadTestCSVFile(reader);\n\n\t\tBufferedReader reader1 = new BufferedReader(\n\t\t\t\tnew InputStreamReader(new FileInputStream(UTF16BE_FILE), \"UTF-16\")\n\t\t);\n\t\tReadTestCSVFile(reader1);\n\t}", "public static void load(FileIO fileIO) \r\n\t{\n\t\t\r\n\t}", "public static PropertiesConfiguration loadConfigurationInUtf8(String fileOrUrlOrClasspathUrl) {\n\n PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration();\n propertiesConfiguration.setEncoding(NinjaConstant.UTF_8);\n propertiesConfiguration.setDelimiterParsingDisabled(true);\n propertiesConfiguration.setFileName(fileOrUrlOrClasspathUrl);\n propertiesConfiguration.getLayout().setSingleLine(NinjaConstant.applicationSecret, true);\n\n try {\n\n propertiesConfiguration.load(fileOrUrlOrClasspathUrl);\n\n } catch (ConfigurationException e) {\n\n logger.info(\"Could not load file \" + fileOrUrlOrClasspathUrl\n + \" (not a bad thing necessarily, but I am returing null)\");\n\n return null;\n }\n\n return propertiesConfiguration;\n }", "public void load(String filename) throws IOException\n {\n FileInputStream input;\n\n try {\n input = new FileInputStream(new File(filename));\n }\n catch (Exception e)\n {\n throw new IOException(\"Cannot open input file \" + filename + \":\" + e.getMessage());\n }\n load(input);\n input.close();\n }", "private void ini_Translations()\r\n\t{\r\n\t\tLogger.DEBUG(\"ini_Translations\");\r\n\t\tnew Translation(\"data\", FileType.Internal);\r\n\t\ttry\r\n\t\t{\r\n\t\t\tTranslation.LoadTranslation(\"data/lang/en-GB/strings.ini\");\r\n\t\t}\r\n\t\tcatch (IOException e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void loadFile(String file) {\n\t\ttry {\n\t\t\tabd_realize.getProxy().loadFile(file);\n\t\t}\n\t\tcatch (FileReadErrorException ex) {\n\t\t\tlog(\"file read error: \" + ex.filename);\n\t\t}\n\t\tcatch (SyntaxErrorException ex) {\n\t\t\tlog(\"syntax error: \" + ex.error + \" in \" + ex.filename + \" on line \" + ex.line);\n\t\t}\n\t}", "protected void loadFile(String s) {\n\t\tpush();\n\t\tfile.load(s, curves);\n\t\trecalculateCurves();\n\t\tpushNew();\n\t}", "private void load(FileInputStream input) {\n\t\t\r\n\t}", "private static String loadConvert(String str) {\n\t\tint off = 0;\n\t\tint len = str.length();\n\t\tchar[] in = str.toCharArray();\n\t\tchar[] convtBuf = new char[1024];\n\t\tif (convtBuf.length < len) {\n\t\t\tint newLen = len * 2;\n\t\t\tif (newLen < 0) {\n\t\t\t\tnewLen = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\tconvtBuf = new char[newLen];\n\t\t}\n\t\tchar aChar;\n\t\tchar[] out = convtBuf;\n\t\tint outLen = 0;\n\t\tint end = off + len;\n\n\t\twhile (off < end) {\n\t\t\taChar = in[off++];\n\t\t\tif (aChar == '\\\\') {\n\t\t\t\taChar = in[off++];\n\t\t\t\tif (aChar == 'u') {\n\t\t\t\t\t// Read the xxxx\n\t\t\t\t\tint value = 0;\n\t\t\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\t\t\taChar = in[off++];\n\t\t\t\t\t\tswitch (aChar) {\n\t\t\t\t\t\tcase '0':\n\t\t\t\t\t\tcase '1':\n\t\t\t\t\t\tcase '2':\n\t\t\t\t\t\tcase '3':\n\t\t\t\t\t\tcase '4':\n\t\t\t\t\t\tcase '5':\n\t\t\t\t\t\tcase '6':\n\t\t\t\t\t\tcase '7':\n\t\t\t\t\t\tcase '8':\n\t\t\t\t\t\tcase '9':\n\t\t\t\t\t\t\tvalue = (value << 4) + aChar - '0';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'a':\n\t\t\t\t\t\tcase 'b':\n\t\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tcase 'd':\n\t\t\t\t\t\tcase 'e':\n\t\t\t\t\t\tcase 'f':\n\t\t\t\t\t\t\tvalue = (value << 4) + 10 + aChar - 'a';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'A':\n\t\t\t\t\t\tcase 'B':\n\t\t\t\t\t\tcase 'C':\n\t\t\t\t\t\tcase 'D':\n\t\t\t\t\t\tcase 'E':\n\t\t\t\t\t\tcase 'F':\n\t\t\t\t\t\t\tvalue = (value << 4) + 10 + aChar - 'A';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new IllegalArgumentException(\"Malformed \\\\uxxxx encoding.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tout[outLen++] = (char) value;\n\t\t\t\t} else {\n\t\t\t\t\tif (aChar == 't')\n\t\t\t\t\t\taChar = '\\t';\n\t\t\t\t\telse if (aChar == 'r')\n\t\t\t\t\t\taChar = '\\r';\n\t\t\t\t\telse if (aChar == 'n')\n\t\t\t\t\t\taChar = '\\n';\n\t\t\t\t\telse if (aChar == 'f')\n\t\t\t\t\t\taChar = '\\f';\n\t\t\t\t\tout[outLen++] = aChar;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tout[outLen++] = aChar;\n\t\t\t}\n\t\t}\n\t\treturn new String(out, 0, outLen);\n\t}", "private void readEncoding(BufferedReader reader) throws IOException {\n String encoding = reader.readLine();\r\n if ( ! AbstractUtf8Message.UTF8_ENCODING_HEADER_STRING.equals(encoding)) {\r\n throw new IOException(\"Expected UTF-8 header when decoding UTF-8 message\");\r\n }\r\n }", "public static String readFile(String fileName, String charset) throws IOException {\n File file = new File(fileName);\n return readFile(file, charset);\n }", "String readDocument(String path, Charset charset);", "private void messagesLoad(String mesagesFileName) throws IOException {\n String temp = new String(Files.readAllBytes(Paths.get(mesagesFileName)));\n String allMessages = stripAccents(temp); // only if you use mockmock or an non UTF-8 compatible SMPT server\n \n //then we split the String into an ArrayList of String\n //in the file messages.utf8 we have used \"=_=_=\" as seperator\n messages = new ArrayList<String>(Arrays.asList(allMessages.split(\"=_=_=\\n\")));\n }", "protected String readUnicodeInputStream(InputStream in) throws IOException {\n\t\tUnicodeReader reader = new UnicodeReader(in, null);\n\t\tString data = FileCopyUtils.copyToString(reader);\n\t\treader.close();\n\t\treturn data;\n\t}", "public void load(){\n Player temp;\n try{\n FileInputStream inputFile = new FileInputStream(\"./data.sec\");\n ObjectInputStream objectIn = new ObjectInputStream(inputFile);\n temp = (Player)objectIn.readObject();\n Arena.CUR_PLAYER = temp;\n objectIn.close();\n inputFile.close(); \n }\n catch(FileNotFoundException e ){\n System.err.print(\"data.sec not found\");\n }\n catch(IOException e){\n System.out.println(\"Error 201\");\n }\n catch(ClassNotFoundException e){\n System.out.println(\"Error 202\");\n }\n }", "private String[] loadFile(String filename) {\n\t\treturn loadFile(filename, new String[0], System.lineSeparator());\n\t}", "@Test\n\tpublic void test_ReadUtf8String() throws IOException {\n\t\tBinaryReader br = br(true, -22, -87, -107, -61, -65, 0);\n\t\tassertEquals(\"\\uaa55\\u00ff\", br.readUtf8String(0));\n\t}", "@Nullable\n public String readFile(String fileName) throws IOException {\n ObjectId objectId = findFile(fileName);\n if (objectId == null) {\n return null;\n }\n\n ObjectLoader obj = reader.open(objectId, Constants.OBJ_BLOB);\n byte[] raw = obj.getCachedBytes(Integer.MAX_VALUE);\n\n if (raw.length == 0) {\n return null;\n }\n return RawParseUtils.decode(raw);\n }", "@Test\n public void testunicode32() {\n assertEquals(\"\\uD834\\uDD1E\", JsonReader.read(\"\\\"\\\\uD834\\\\uDD1E\\\"\"));\n }", "public void GetData(String nameFile) throws IOException {\n File file = new File(nameFile);\n BufferedReader finalLoad = new BufferedReader(new FileReader(file));\n int symbol = finalLoad.read();\n int indexText = 0;\n while (symbol != -1) {\n text[indexText++] = (char) symbol;\n if (indexText >= Constants.MAX_TEXT - 1) {\n PrintError(\"to mach size of file\".toCharArray(), \"\".toCharArray());\n break;\n }\n symbol = finalLoad.read();\n }\n text[indexText++] = '\\n';\n text[indexText] = '\\0';\n finalLoad.close();\n //System.exit(1);\n }", "public static ParserResult loadDatabase(File fileToOpen, String encoding) throws IOException {\n \n Reader reader = getReader(fileToOpen, encoding);\n String suppliedEncoding = null;\n try {\n boolean keepon = true;\n int piv = 0, c;\n while (keepon) {\n c = reader.read();\n if ( (piv == 0 && Character.isWhitespace( (char) c)) ||\n c == GUIGlobals.SIGNATURE.charAt(piv))\n piv++;\n else\n keepon = false;\n found: if (piv == GUIGlobals.SIGNATURE.length()) {\n keepon = false;\n // Found the signature. The rest of the line is unknown, so we skip it:\n while (reader.read() != '\\n');\n // Then we must skip the \"Encoding: \"\n for (int i=0; i<GUIGlobals.encPrefix.length(); i++) {\n if (reader.read() != GUIGlobals.encPrefix.charAt(i))\n break found; // No, it doesn't seem to match.\n }\n // If ok, then read the rest of the line, which should contain the name\n // of the encoding:\n StringBuffer sb = new StringBuffer();\n while ((c = reader.read()) != '\\n')\n sb.append((char)c);\n suppliedEncoding = sb.toString();\n }\n \n }\n } catch (IOException ex) {}\n \n if ((suppliedEncoding != null) && (!suppliedEncoding.equalsIgnoreCase(encoding))) {\n Reader oldReader = reader;\n try {\n // Ok, the supplied encoding is different from our default, so we must make a new\n // reader. Then close the old one.\n reader = getReader(fileToOpen, suppliedEncoding);\n oldReader.close();\n //System.out.println(\"Using encoding: \"+suppliedEncoding);\n } catch (IOException ex) {\n reader = oldReader; // The supplied encoding didn't work out, so we keep our\n // existing reader.\n \n //System.out.println(\"Error, using default encoding.\");\n }\n } else {\n // We couldn't find a supplied encoding. Since we don't know far into the file we read,\n // we start a new reader.\n reader.close();\n reader = getReader(fileToOpen, encoding);\n //System.out.println(\"No encoding supplied, or supplied encoding equals default. Using default encoding.\");\n }\n \n \n //return null;\n \n BibtexParser bp = new BibtexParser(reader);\n \n ParserResult pr = bp.parse();\n pr.setEncoding(encoding);\n \n return pr;\n }", "public static String readFile(String fileName) throws IOException {\n return readFile(fileName, \"UTF-8\");\n }", "public void load (String fileName) throws IOException {\n\t\tBufferedReader in = new BufferedReader\n\t\t\t(new InputStreamReader\n\t\t\t (new FileInputStream(fileName), JetTest.encoding));\n\t\tannotator.readTagTable(in);\n\t\tmene.load(in);\n\t}", "public void load(String filePath){\r\n File loadFile = new File(filePath);\r\n if (!loadFile.exists()){\r\n System.out.println(\"I failed. There are no saved games.\");\r\n return;\r\n }\r\n FileInputStream fis = null;\r\n ObjectInputStream in = null;\r\n try {\r\n fis = new FileInputStream(filePath);\r\n in = new ObjectInputStream(fis);\r\n long versionUID = (long) in.readObject();\r\n if (versionUID != this.serialVersionUID) {\r\n throw new UnsupportedClassVersionError(\"Version mismatch for save game!\");\r\n }\r\n this.p = (Character) in.readObject();\r\n this.map = (SpecialRoom[][]) in.readObject();\r\n\r\n } catch (FileNotFoundException ex){\r\n System.out.println(\"The saved game was not found!\");\r\n ex.printStackTrace();\r\n } catch (IOException ex) {\r\n System.out.println(\"There was an error reading your save game :(\");\r\n ex.printStackTrace();\r\n System.out.println(\")\");\r\n } catch (ClassNotFoundException ex) {\r\n System.out.println(\"The version of the save game is not compatible with this game!\");\r\n ex.printStackTrace();\r\n } catch (UnsupportedClassVersionError ex) {\r\n System.out.println(ex.getMessage());\r\n ex.printStackTrace();\r\n } catch (Exception ex) {\r\n System.out.println(\"An unknown error occurred!\");\r\n }\r\n\r\n }", "public void load() throws ClassNotFoundException, IOException;", "public void load(String path) throws IOException, ClassNotFoundException {\n FileInputStream inputFile = new FileInputStream(path);\n ObjectInputStream objectInput = new ObjectInputStream(inputFile);\n\n map = (String[]) objectInput.readObject();\n\n objectInput.close();\n inputFile.close();\n }", "private void loadHTMLFile(File file) {\n\t\ttry {\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tFileInputStream fis = new FileInputStream(file);\n\t\t\tBufferedInputStream bis = new BufferedInputStream(fis);\n\t\t\twhile (bis.available() > 0) {\n\t\t\t\tsb.append((char) bis.read());\n\t\t\t}\n\t\t\tbis.close();\n\n\t\t\tString htmlContent = sb.toString();\n\n\t\t\twebEngineLoadContent(htmlContent, false);\n\t\t\thtmlEditor.setHtmlText(htmlContent);\n\n\t\t} catch (Exception e) { // catches ANY exception\n\t\t\tDialogs.create()\n\t\t\t\t\t.title(\"Error\")\n\t\t\t\t\t.masthead(\n\t\t\t\t\t\t\t\"Could not load data from file:\\n\" + file.getPath())\n\t\t\t\t\t.showException(e);\n\t\t}\n\t}", "public void loadFile(String fname) \n\t{\n\t\t// use Scanner used to read the file\n\t\ttry{\n\t\t\tScanner scan = new Scanner(new FileReader(fname));\n\t\t\t//read in number of row and column in the first line\n\t\t\treadRC(scan);\n\t\t\treadMaze(scan);\n\t\t\t//close the scanner\n\t\t\tscan.close();\t\t\t\t\t\t\t\t\n\t\t}catch(FileNotFoundException e){\n\t\t\tSystem.out.println(\"FileNotFound\"+e.getMessage());\n\t\t}\n\t}", "public static String readFile(File fileName) throws IOException {\n return readFile(fileName, \"UTF-8\");\n }", "public static String readString(File file) throws IOException {\n return readString(file, DEFAULT_ENCODING);\n }", "public String readUTF() throws IOException;", "private void load(File toLoad) {\n\t\tif (toLoad.getName().endsWith(\".ics\")) {\n\t\t\ttry {\n\t\t\t\tthis.calendar = new TCalendar(toLoad);\n\t\t\t\tthis.showWeek(new GregorianCalendar());\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\tnew JErrorFrame(e.getMessage());\n\t\t\t} catch (IOException e) {\n\t\t\t\tnew JErrorFrame(e.getMessage());\n\t\t\t} catch (CorruptedCalendarFileException e) {\n\t\t\t\tnew JErrorFrame(e.getMessage());\n\t\t\t}\n\t\t} else {\n\t\t\tnew JErrorFrame(\n\t\t\t\t\t\"The file type is incorrect, only .ics files are accepted\");\n\t\t}\n\t}", "private void loadFromDisk(String filename) throws IOException {\n Reader r = new FileReader(filename);\r\n load(r);\r\n }", "public static void demoReadAll(){\n try{\n //Read entire file bytes. Return in byte format. Don't need to close() after use. \n byte[] b = Files.readAllBytes(Paths.get(\"country.txt\"));\n String s = new String(b);\n System.out.println(s);\n }\n catch(IOException e){\n e.printStackTrace();\n }\n }", "public static UcsfWebGetConfig load(String filename)\n throws FileNotFoundException, UnsupportedEncodingException {\n Yaml yaml = new Yaml();\n return yaml.loadAs(new InputStreamReader(new FileInputStream(filename),\n \"UTF-8\"), UcsfWebGetConfig.class);\n }", "public static String readFileAsString(String path, String charsetName) throws IOException {\n ByteBuffer content = internalReadFileAsByteArray(path);\n CharBuffer result = Charset.forName(charsetName).decode(content);\n char[] charContent = null;\n if (result.hasArray()) {\n charContent = result.array();\n } else {\n charContent = new char[result.limit()];\n result.get(charContent);\n }\n return new String(charContent);\n\n }", "@Test\n\tpublic void test_ReadUtf8String_bad_data() throws IOException {\n\t\tBinaryReader br = br(true, -22, -87, 'A', 0);\n\t\tassertEquals(\"\\ufffdA\" /* unicode replacement char, 'A'*/, br.readUtf8String(0));\n\t}", "public static String readFile(String path, Charset encoding) throws IOException {\r\n\t\tbyte[] encoded = Files.readAllBytes(Paths.get(path));\r\n\t\treturn new String(encoded, encoding);\r\n\t}", "public MutableTextLabels loadSerialized(File file,TextBase base) throws IOException,FileNotFoundException\n\t{\n\t\ttry {\n\t\t\tObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));\n\t\t\tMutableTextLabels labels = (MutableTextLabels)in.readObject();\n\t\t\tlabels.setTextBase(base);\n\t\t\tin.close();\n\t\t\treturn labels;\n\t\t}\n\t\tcatch (ClassNotFoundException e) {\n\t\t\tthrow new IllegalArgumentException(\"can't read TextLabels from \"+file+\": \"+e);\n\t\t}\n\t}", "private void loadFromFile() {\n try {\n FileInputStream fis = openFileInput(FILENAME);\n BufferedReader in = new BufferedReader(new InputStreamReader(fis));\n\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Sub>>(){}.getType();\n subList = gson.fromJson(in, listType);\n\n } catch (FileNotFoundException e) {\n subList = new ArrayList<Sub>();\n }\n }", "public Resource load(IFile f);", "public static String readFile(File file) {\n FileInputStream fis = null;\n try {\n fis = new FileInputStream(file);\n byte[] b = Utils.readBytes(fis);\n return new String(b, StandardCharsets.UTF_8);\n } catch (IOException e) {\n e.printStackTrace();\n }finally {\n if(fis != null) {\n try {\n fis.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return null;\n }", "private void load(Path fileName) throws IOException {\n try(BufferedReader reader = Files.newBufferedReader(fileName)) {\n String line = \"\";\n\n // Matches lines with the format:\n // key=value\n // where the key is any sequence of lowercase letters. (a to z)\n // where value may be any letters from a to z (case insensitive) 0 to 9 or the letters '-' and '.'.\n Pattern validLine = Pattern.compile(\"^(?<key>[a-z]+)=(?<value>[a-zA-Z0-9-.]+)$\");\n\n // Read the file line by line\n while((line = reader.readLine()) != null) {\n if(line.startsWith(\";\")) { // Ignore lines that start with ;\n continue;\n }\n\n // Remove any whitespace\n line = line.trim();\n\n // Continue if our line is empty\n if(\"\".equals(line)) {\n continue;\n }\n\n Matcher matcher = validLine.matcher(line);\n\n if(!matcher.matches() || matcher.groupCount() != 2) {\n System.err.println(\"Unable to parse line: \" + line);\n continue;\n }\n\n String key = matcher.group(\"key\");\n String value = matcher.group(\"value\");\n\n map.put(key, value);\n }\n }\n }", "public static String readFile(File fileName, String charset) throws IOException {\n if (fileName == null || !fileName.isFile()) {\n return null;\n }\n StringBuilder sb = new StringBuilder(\"\");\n BufferedReader reader = null;\n try {\n InputStreamReader is = new InputStreamReader(new FileInputStream(fileName), charset);\n reader = new BufferedReader(is);\n String line = null;\n while ((line = reader.readLine()) != null) {\n if (!sb.toString().equals(\"\")) {\n sb.append(\"\\r\\n\");\n }\n sb.append(line);\n }\n reader.close();\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n throw e;\n } finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n throw e;\n }\n }\n }\n }", "public void loadFileToBackend(String fileName) throws Exception {\r\n\t\tArticleParser articleParser = null;\r\n\t\ttry {\r\n\t\t\tLOGGER.log(Level.FINEST,\"Parsing file\" + fileName);\r\n\t\t\tarticleParser = new ArticleParser(fileName,idGenerator,pubmedDump);\r\n\t\t\tarticleParser.parse();\r\n\t\t\tLOGGER.log(Level.FINEST,\"Parsing of {0} successfull \", fileName);\r\n\t\t\tgraphDelegator.updateGraph(articleParser.getPubmedId(),\r\n\t\t\t\t\t\tarticleParser.getKeywords(),\r\n\t\t\t\t\t\tarticleParser.getCitations());\r\n\t\t\t\r\n\t\t\tarticleParser = null;\r\n\t\t} catch (Exception ex) {\r\n\t\t\tLOGGER.warning(\"Exception while parsing ::\" + ex.getMessage());\r\n\t\t}\r\n\r\n\t}", "public static String readFile(Path path) {\n\t\tif (path != null) {\n\t\t\tbyte[] bytes = toByteArray(path);\n\t\t\tif (bytes != null) {\n\t\t\t\treturn new String(bytes, StandardCharsets.UTF_8);\n\t\t\t}\n\t\t}\n\t\treturn \"\";\n\t}", "public void setFileEncoding(String s) {\n if (s == null) fileEncoding = \"\";\n else fileEncoding = s;\n }", "public void readFromFile() {\n\n\t}", "public void loadStr(String str, String filename) throws Exceptions.OsoException {\n ffiPolar.loadStr(str, filename);\n checkInlineQueries();\n }", "private void loadFromFile(String fileName) {\n try {\n InputStream inputStream = this.openFileInput(fileName);\n if (inputStream != null) {\n ObjectInputStream input = new ObjectInputStream(inputStream);\n boardManager = (BoardManager) input.readObject();\n inputStream.close();\n }\n } catch (FileNotFoundException e) {\n Log.e(\"login activity\", \"File not found: \" + e.toString());\n } catch (IOException e) {\n Log.e(\"login activity\", \"Can not read file: \" + e.toString());\n } catch (ClassNotFoundException e) {\n Log.e(\"login activity\", \"File contained unexpected data type: \" + e.toString());\n }\n }", "public void LoadTxt(File Arquivo) {\n if (Arquivo.exists()) {\r\n\r\n try {\r\n\r\n FileReader FR = new FileReader(Arquivo);\r\n BufferedReader BW = new BufferedReader(new InputStreamReader(new FileInputStream(Arquivo.getAbsolutePath()), \"ISO-8859-1\"));\r\n\r\n //BufferedReader BW = new BufferedReader(FR);\r\n\r\n String dados;\r\n String[] paraArray = new String[3];\r\n String matricula;\r\n \r\n String serie = Arquivo.getName();\r\n int pos = serie.lastIndexOf(\".\");\r\n if (pos > 0) {\r\n serie = serie.substring(0, pos);\r\n }\r\n\r\n Sala novaSala = new Sala(serie); //CRIANDO SALA COM NOME DE TURMA\r\n salas2.add(novaSala); // ADICIONANDO SALA NA LISTA DE SALAS\r\n while ((dados = BW.readLine()) != null) {\r\n paraArray = dados.split(\";\");\r\n\r\n matricula = /*Integer.parseInt*/ (paraArray[0]);\r\n //senha = /*Integer.parseInt*/(paraArray[2]);\r\n Dados novoDado = new Dados(matricula, paraArray[1], paraArray[2]);\r\n\r\n novoDado.setSerie(serie); //ADICIONANDO TURMA AO DADO\r\n novaSala.getDadosalas().add(novoDado); //ADICIONANDO DADOS A LISTA DE DADOS QUE ESTA EM SALA\r\n\r\n }\r\n \r\n\r\n BW.close();\r\n FR.close();\r\n\r\n } catch (Exception e) {\r\n System.out.println(\"Erro ao carregar arquivo acima\");\r\n System.out.println(e.getMessage());\r\n\r\n }\r\n\r\n } else {\r\n System.out.println(\"Nenhum arquivo de dados encontrado\");\r\n }\r\n\r\n }", "public static String readString(File file, String encoding) throws IOException {\n return readString(new FileInputStream(file), encoding);\n }", "public void load(InputStream is) throws IOException;", "public ConfigFile(File file, String encoding) {\n if (file == null) {\n throw new IllegalArgumentException(\"File can not be null.\");\n }\n if (!file.isFile()) {\n throw new IllegalArgumentException(\"File not found : \" + file.getName());\n }\n\n InputStream inputStream = null;\n try {\n inputStream = new FileInputStream(file);\n properties = new Properties();\n if (file.getName().endsWith(\"yml\")){\n isYml = true;\n properties= new Yaml().loadAs(new InputStreamReader(inputStream, encoding),Properties.class);\n }else\n properties.load(new InputStreamReader(inputStream, encoding));\n } catch (IOException e) {\n throw new RuntimeException(\"Error loading properties file.\", e);\n } finally {\n if (inputStream != null) try {\n inputStream.close();\n } catch (IOException e) {\n LogKit.error(e.getMessage(), e);\n }\n }\n }", "public void setFileEncoding(String fileEncoding) {\n this.fileEncoding = fileEncoding;\n }", "@Override\n\tpublic void init(String file_name) { deserialize(file_name); }", "public void textFile(String path){\n\t\tBufferedReader br;\r\n\t\ttry {\r\n\t\t\tbr = new BufferedReader(new InputStreamReader(\r\n\t\t\t\t\tnew FileInputStream(path),Charset.forName(\"gbk\")));\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\tthrow new IllegalArgumentException(e);\r\n\t\t}\r\n\t\tLineBufferReader myReader=new LineBufferReader(br);\r\n\t}", "@Override\r\n\tpublic void initialLoad() throws IOException {\n\t\t\r\n\t}", "private static List<String> loadGenericDfFile(String file) throws IOException{\n\t\tList<String> lines = new ArrayList<String>();\n\t\t\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(\n\t\t\t\tnew FileInputStream(file), \"UTF-8\"));\n\t\ttry {\n\t\t\tString str;\n\t\t\twhile ((str = in.readLine()) != null) {\n\t\t\t\tlines.add(str);\n\t\t\t}\n\t\t} finally {\n\t\t\tin.close();\n\t\t}\n\n\t\treturn lines;\n\t}", "public void loadData() {\n Path path= Paths.get(filename);\n Stream<String> lines;\n try {\n lines= Files.lines(path);\n lines.forEach(ln->{\n String[] s=ln.split(\";\");\n if(s.length==3){\n try {\n super.save(new Teme(Integer.parseInt(s[0]),Integer.parseInt(s[1]),s[2]));\n } catch (ValidationException e) {\n e.printStackTrace();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }else\n System.out.println(\"linie corupta in fisierul teme.txt\");});\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public static void load() {\n }", "public abstract void loadFile(Model mod, String fn) throws IOException;", "void load();" ]
[ "0.7272873", "0.71061146", "0.6821409", "0.6453972", "0.64396197", "0.63558745", "0.62821734", "0.6205566", "0.61937624", "0.6069887", "0.60007185", "0.5988471", "0.5977934", "0.5927423", "0.5917506", "0.5905434", "0.5895876", "0.58907324", "0.5829466", "0.58033687", "0.5772012", "0.5732003", "0.570874", "0.5706932", "0.5698266", "0.5694372", "0.5690003", "0.56788206", "0.56731784", "0.56647676", "0.5655946", "0.56155753", "0.55915743", "0.55840045", "0.55815357", "0.5579002", "0.5554634", "0.55480665", "0.5540032", "0.55020887", "0.5491709", "0.5471921", "0.54718626", "0.547001", "0.5455533", "0.54097223", "0.54031473", "0.5370748", "0.536728", "0.53662056", "0.5359885", "0.53575927", "0.5346832", "0.5343984", "0.53349197", "0.53270316", "0.5319173", "0.5318971", "0.5310638", "0.5287509", "0.5269124", "0.52657074", "0.5264446", "0.52566594", "0.5251333", "0.5229855", "0.5222367", "0.52214044", "0.5212572", "0.5200052", "0.5193127", "0.517384", "0.5167219", "0.51671654", "0.5163767", "0.51435435", "0.5135357", "0.5130034", "0.51299983", "0.5127806", "0.5126211", "0.5121173", "0.5120889", "0.51179844", "0.51168", "0.51166123", "0.51051915", "0.5099952", "0.5099877", "0.50989836", "0.5098691", "0.5090417", "0.5083359", "0.5082538", "0.5079829", "0.50794625", "0.5077526", "0.50737035", "0.5070784", "0.5069715", "0.5061721" ]
0.0
-1
Load ticks from file
private List<Tick> loadTicks(InputStream pInput) throws IOException { List<Tick> result = new ArrayList<Tick>(); BufferedReader reader = new BufferedReader(new InputStreamReader(pInput)); String line; final Map<String, String> properties = new HashMap<String, String>(); while ( (line = reader.readLine()) != null) { String str = line.trim(); if (str.length() == 0 || str.startsWith("#")) { // Skip comment } else if (str.startsWith("[")) { // start new tick if (!properties.isEmpty()) { Tick tick = new Tick(); tick.restore(mRegistry, properties); result.add(tick); properties.clear(); } String name = str.substring(1, str.length() - 1); properties.put(Tick.P_TICK, name); } else if (properties != null) { // tick parameters int valueSep = str.indexOf('='); if (valueSep != -1) { String key = str.substring(0, valueSep).trim(); String value = str.substring(valueSep + 1).trim(); properties.put(key, value); } } } if (!properties.isEmpty()) { Tick tick = new Tick(); tick.restore(mRegistry, properties); result.add(tick); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void load() \n throws IOException\n {\n mText = null;\n mTicks.clear();\n \n if (mLoadTicks && isAlreadyTicked()) {\n File tickFile = getTickFile(false);\n ZipFile zip = new ZipFile(tickFile);\n\n String basename = null;\n \n // Find ticked file name from ZIP\n Enumeration<? extends ZipEntry> entries = zip.entries();\n while (entries.hasMoreElements()) {\n ZipEntry entry = entries.nextElement();\n String name = entry.getName();\n int idx = name.indexOf(TickConstants.TICK_ENTRY_EXT);\n if (idx != -1) {\n basename = name.substring(0, idx); \n }\n }\n \n // file\n ZipEntry fileEntry = zip.getEntry(basename);\n byte[] data = FileUtil.load(zip.getInputStream(fileEntry));\n mText = new String(data, \"UTF-8\");\n\n // registry\n mRegistry = new TickRegistry();\n mRegistry.loadDefinitions();\n\n // ticks\n ZipEntry tickEntry = zip.getEntry(basename + TickConstants.TICK_ENTRY_EXT);\n mTicks.addAll(loadTicks(zip.getInputStream(tickEntry)));\n \n mBasename = basename;\n } else {\n byte[] data = FileUtil.load(mFile);\n mText = new String(data, \"UTF-8\");\n mBasename = mFile.getName();\n \n // registry\n mRegistry = new TickRegistry();\n mRegistry.loadDefinitions();\n }\n }", "private void loadFromFile() {\n try {\n /* Load in the data from the file */\n FileInputStream fIn = openFileInput(FILENAME);\n BufferedReader inRead = new BufferedReader(new InputStreamReader(fIn));\n\n /*\n * access from the GSON file\n * Taken from lonelyTwitter lab code\n */\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Counter>>() {}.getType();\n counters = gson.fromJson(inRead, listType);\n\n } catch (FileNotFoundException e) {\n counters = new ArrayList<Counter>();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }", "public void load(){\n\t\t\tArrayList<String> entries = readEntriesFromFile(FILENAME);\n\t\t\t\n\t\t\tfor(int i = 1; i < entries.size(); i++){\n\t\t\t\tString entry = entries.get(i);\n\t\t\t\tString[] entryParts = entry.split(\",\");\n\t\t\t\tString name = entryParts[0];\n\t\t\t\tString power = entryParts[1];\n\t\t\t\tString gold = entryParts[2];\n\t\t\t\tString xp = entryParts[3];\n\t\t\t\tString location = entryParts[4];\n\t\t\t\tint powerInt = Integer.parseInt(power);\n\t\t\t\tint goldInt = Integer.parseInt(gold);\n\t\t\t\tint XPInt = Integer.parseInt(xp);\n\t\t\t\tRegion regionR = RM.getRegion(location);\n\t\t\t\tTrap trap = new Trap(name, powerInt, goldInt, XPInt, regionR);\n\t\t\t\ttrapList[i-1] = trap;\n\t\t\t}\n\t}", "public void load(File tFile) throws FileNotFoundException, IOException {\n BufferedReader reader = new BufferedReader(new FileReader(tFile));\n String line;\n\n\n while ((line = reader.readLine()) != null) {\n line = line.replaceAll(\"\\\\s+\", \" \");\n String[] elements = line.split(\" \");\n\n CSID desc = new CSID();\n // normalised lines are easier to compare as it is well defined, which point will be the 1st\n desc.axis1 = (ExtLine2D) ExtLine2D.normaliseLine(new ExtLine2D(Double.parseDouble(elements[0]),\n Double.parseDouble(elements[1]),\n Double.parseDouble(elements[2]),\n Double.parseDouble(elements[3])));\n desc.axis2 = (ExtLine2D) ExtLine2D.normaliseLine(new ExtLine2D(Double.parseDouble(elements[4]),\n Double.parseDouble(elements[5]),\n Double.parseDouble(elements[6]),\n Double.parseDouble(elements[7])));\n desc.isCS = elements[8].equals(\"Y\");\n\n this.csDescriptors.add(desc);\n }\n }", "void load(File file);", "public void load (File file) throws Exception;", "private void loadFromFile() {\n\t\ttry {\n\t\t\tFileInputStream fis = openFileInput(FILENAME);\n\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(fis));\n\t\t\tString line = in.readLine();\n\t\t\tGson gson = new Gson();\n\t\t\twhile (line != null) {\n\t\t\t\tCounterModel counter = gson.fromJson(line, CounterModel.class);\n\t\t\t\tif (counterModel.getCounterName().equals(counter.getCounterName())) {\n\t\t\t\t\tcounterListModel.addCounterToList(counterModel);\n\t\t\t\t\tcurrentCountTextView.setText(Integer.toString(counterModel.getCount()));\n\t\t\t\t} else {\n\t\t\t\t\tcounterListModel.addCounterToList(counter);\n\t\t\t\t}\n\t\t\t\tline = in.readLine();\n\t\t\t} \n\t\t\tfis.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public SVGView(String fileName, int ticksPerSec) throws IllegalArgumentException {\n super(fileName);\n if (ticksPerSec < 1) {\n throw new IllegalArgumentException(\"Ticks per second cannot 0 or less!\");\n }\n this.ticksPerSec = ticksPerSec;\n this.textDescription = this.textualize();\n }", "public MutableTextLabels loadSerialized(File file,TextBase base) throws IOException,FileNotFoundException\n\t{\n\t\ttry {\n\t\t\tObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));\n\t\t\tMutableTextLabels labels = (MutableTextLabels)in.readObject();\n\t\t\tlabels.setTextBase(base);\n\t\t\tin.close();\n\t\t\treturn labels;\n\t\t}\n\t\tcatch (ClassNotFoundException e) {\n\t\t\tthrow new IllegalArgumentException(\"can't read TextLabels from \"+file+\": \"+e);\n\t\t}\n\t}", "@Override\n protected void loadConfig(String fileName){\n fileName = PSO_PATH + fileName;\n File file = new File(fileName);\n try {\n Scanner sc = new Scanner(file); \n String line = sc.nextLine();\n List<List<String>> list = Arrays.asList(line.split(\",\"))\n .stream()\n .map(s -> Arrays.asList(s.split(\":\"))\n .stream()\n .map(n -> n.replaceAll(\"[^a-zA-Z0-9_.]\", \"\"))\n .collect(Collectors.toList())\n )\n .collect(Collectors.toList());\n\n this.initialTemperature = Double.parseDouble(list.get(0).get(1));\n this.coolingRate = Double.parseDouble(list.get(2).get(1));\n sc.close();\n } \n catch(IOException e) {\n e.printStackTrace();\n System.exit(1);\n }\n }", "public void loadDataFromFile() {\n startX = 0;\n startY = 540;\n\n }", "private void loadFromFile() {\n try {\n FileInputStream fis = openFileInput(FILENAME);\n InputStreamReader isr = new InputStreamReader(fis);\n BufferedReader reader = new BufferedReader(isr);\n Gson gson = new Gson();\n Type listFeelingType = new TypeToken<ArrayList<Feeling>>(){}.getType();\n recordedFeelings.clear();\n ArrayList<Feeling> tmp = gson.fromJson(reader, listFeelingType);\n recordedFeelings.addAll(tmp);\n fis.close();\n\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n recordedFeelings = new ArrayList<Feeling>();\n e.printStackTrace();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "static Schedules load(String fileName) throws RBEConfigObjectException\n {\n\n try\n {\n FileReader fis = new FileReader(fileName);\n\t\t return new Schedules(fis);\n } catch (Exception ioe) {\n throw new RBEConfigObjectException(ioe.toString());\n }\n }", "private void loadFromFile(){\n try {\n FileInputStream fis = openFileInput(FILENAME);\n BufferedReader in = new BufferedReader(new InputStreamReader(fis));\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Countbook>>() {}.getType();\n countbookList = gson.fromJson(in, listType);\n } catch (FileNotFoundException e) {\n countbookList = new ArrayList<Countbook>();\n }\n }", "public void load(final YAML.Node node)\n{\n\tnode[\"x\"] >> _x;\n\tnode[\"y\"] >> _y;\n\tnode[\"buildTime\"] >> _buildTime;\n}", "public List<Task> load() throws DukeException {\n List<Task> tasks = new ArrayList<>();\n\n try {\n BufferedReader reader = new BufferedReader(new FileReader(filePath));\n\n String line;\n while ((line = reader.readLine()) != null) {\n String[] tokens = line.split(\"\\\\|\");\n\n Task task = StorageSerializer.deserialize(tokens);\n tasks.add(task);\n }\n\n reader.close();\n } catch (FileNotFoundException e) {\n throw new IoDukeException(\"Error opening task file for reading\");\n } catch (IOException e) {\n throw new IoDukeException(\"Error closing file reader\");\n } catch (ParseException e) {\n throw new IoDukeException(\"Error parsing date in task file\");\n }\n\n return tasks;\n }", "private void readFromFile() {\n\t\tPath filePath = Paths.get(inputFile);\n\n\t\ttry (BufferedReader reader = Files.newBufferedReader(filePath,\n\t\t\t\tCharset.forName(\"UTF-8\"));) {\n\t\t\tString line = null;\n\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tString[] splitLine = line.split(\",\");\n\t\t\t\tcurrentGen.setValue(Integer.parseInt(splitLine[0]),\n\t\t\t\t\t\tInteger.parseInt(splitLine[1]), true);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Could not find file provided.\");\n\t\t}\n\t}", "public void loadEPILine(File file)\r\n\t{\r\n\t\tString name=file.getName();\r\n\t\tint [][] result=null;\r\n\t\ttry \r\n\t\t{\r\n\t\t\tScanner scanner=new Scanner(file);\r\n\t\t\tint size=scanner.nextInt();\r\n\t\t\tint width=scanner.nextInt();\t\t\t\r\n\t\t\tresult=new int[size][width];\r\n\t\t\tscanner.useDelimiter(\",\");\r\n\t\t\tString temp;\r\n\t\t\tfor(int i=0;i<size;i++)\r\n\t\t\t\tfor(int j=0;j<width;j++)\r\n\t\t\t\t{\r\n\t\t\t\t\ttemp=scanner.next();\r\n\t\t\t\t\tresult[i][j]=Integer.parseInt(temp.trim());\r\n\t\t\t\t}\r\n\t\t\tscanner.close();\t\r\n\t\t} catch (FileNotFoundException e) \r\n\t\t{\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t_pixels=result;\r\n\t\t\r\n\t\t//That's why I needed to get rid of \"_\" in directory name\r\n\t\tname=name.substring(0,name.lastIndexOf(\".\"));\r\n\t\tString[] split=name.split(\"_\");\r\n\t\t_line=Integer.parseInt(split[1])+1;\r\n\t\t_position=Position.valueOf(split[2]);\r\n\t\t\r\n\t}", "private void load(File toLoad) {\n\t\tif (toLoad.getName().endsWith(\".ics\")) {\n\t\t\ttry {\n\t\t\t\tthis.calendar = new TCalendar(toLoad);\n\t\t\t\tthis.showWeek(new GregorianCalendar());\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\tnew JErrorFrame(e.getMessage());\n\t\t\t} catch (IOException e) {\n\t\t\t\tnew JErrorFrame(e.getMessage());\n\t\t\t} catch (CorruptedCalendarFileException e) {\n\t\t\t\tnew JErrorFrame(e.getMessage());\n\t\t\t}\n\t\t} else {\n\t\t\tnew JErrorFrame(\n\t\t\t\t\t\"The file type is incorrect, only .ics files are accepted\");\n\t\t}\n\t}", "private void loadWorld(String path) {\r\n StringBuilder builder = new StringBuilder();\r\n \r\n try {\r\n BufferedReader br = new BufferedReader(new FileReader(path));\r\n String line;\r\n while ((line = br.readLine()) != null) {\r\n builder.append(line + \"\\n\");\r\n }\r\n br.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n \r\n String file = builder.toString();\r\n String[] tokens = file.split(\"\\\\s+\");\r\n width = Integer.parseInt(tokens[0]);\r\n height = Integer.parseInt(tokens[1]);\r\n spawnX = Integer.parseInt(tokens[2]);\r\n spawnY = Integer.parseInt(tokens[3]);\r\n winX = Integer.parseInt(tokens[4]);\r\n winY = Integer.parseInt(tokens[5]);\r\n \r\n tiles = new int[width][height];\r\n for (int y = 0;y < height;y++) {\r\n for (int x = 0;x < width;x++) {\r\n tiles[x][y] = Integer.parseInt(tokens[(x + y * width) + 6]);\r\n }\r\n }\r\n \r\n assert (tiles != null);\r\n }", "public void readFile(){\n try {\n highscores = new ArrayList<>();\n BufferedReader br = new BufferedReader(new FileReader(\"Highscores.txt\"));\n String line = br.readLine();\n while (line != null){\n try{\n highscores.add(Integer.parseInt(line));\n } catch (NumberFormatException e){}\n line = br.readLine();\n }\n br.close();\n } catch (FileNotFoundException e) {\n System.out.println(\"No file found\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private static BarChart readFile(String path) throws IOException {\r\n\t\tBufferedReader reader = new BufferedReader(new FileReader(path));\r\n\t\t\r\n\t\tString xLabel = reader.readLine();\r\n\t\tString yLabel = reader.readLine();\r\n\t\tString unparsedValues = reader.readLine();\r\n\t\tString minY = reader.readLine();\r\n\t\tString maxY = reader.readLine();\r\n\t\tString density = reader.readLine();\r\n\t\t\r\n\t\tunparsedValues.replace(\"\\\\s+\", \" \");\r\n\t\tString[] values = unparsedValues.split(\" \");\r\n\t\tList<XYValue> chartValues = new LinkedList<>();\r\n\t\t\r\n\t\tfor(String value : values) {\r\n\t\t\tif(value.contains(\"\\\\s+\")) {\r\n\t\t\t\treader.close();\r\n\t\t\t\tthrow new IllegalArgumentException(\"The value must be written in next format: x,y!\\n\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t + \"No spaces needed.\");\r\n\t\t\t}\r\n\t\t\tString[] xy = value.split(\",\");\r\n\t\t\ttry {\r\n\t\t\t\tchartValues.add(new XYValue(Integer.parseInt(xy[0]), Integer.parseInt(xy[1])));\r\n\t\t\t} catch (NumberFormatException e) {\r\n\t\t\t\tSystem.out.println(\"Format of the file is not good. For values is not provided\\n\"\r\n\t\t\t\t\t\t\t\t + \"value parsable to integer.\");\r\n\t\t\t\tSystem.exit(0);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\treader.close();\r\n\t\treturn new BarChart(chartValues, xLabel, yLabel, Integer.parseInt(minY),\r\n\t\t\t\t\t\t\tInteger.parseInt(maxY), Integer.parseInt(density));\r\n\t}", "@SuppressWarnings(\"unchecked\")\n public static void load() {\n\n System.out.print(\"Loading team data from file...\");\n\n try {\n\n String team_fil = config.Server.serverdata_file_location + \"/teams.ser\";\n\n FileInputStream fil = new FileInputStream(team_fil);\n ObjectInputStream in = new ObjectInputStream(fil);\n\n team_list = (ConcurrentHashMap<Integer, Team>) in.readObject();\n cleanTeams();\n\n fil.close();\n in.close();\n\n //Gå gjennom alle lagene og registrer medlemmene i team_members.\n Iterator<Team> lag = team_list.values().iterator();\n\n while (lag.hasNext()) {\n\n Team laget = lag.next();\n\n Iterator<TeamMember> medlemmer = laget.getTeamMembers();\n while (medlemmer.hasNext()) {\n registerMember(medlemmer.next().getCharacterID(), laget.getTeamID());\n }\n\n }\n\n System.out.println(\"OK! \" + team_list.size() + \" teams loaded.\");\n\n } catch (Exception e) {\n System.out.println(\"Error loading team data from file.\");\n }\n\n }", "static void loadTimeSlot() {\n\t\tScanner inputStreamT = null; // create object variable for Course\n\n\t\ttry { // create Scanner object & assign to variable\n\t\t\tinputStreamT = new Scanner(new File(\"timeslot.txt\"));\n\t\t\tinputStreamT.useDelimiter(\",\");\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.out.println(\"No time slot infomation was Loaded\");\n\t\t\t// System.exit(0);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\twhile (inputStreamT.hasNext()) {\n\n\t\t\t\tString readTimeSlotID = inputStreamT.next();\n\t\t\t\tString readTimePeriodID = inputStreamT.next();\n\t\t\t\tString readCourseID = inputStreamT.next();\n\t\t\t\tString readCasualUser = inputStreamT.next();\n\t\t\t\t\n\t\t\t\tTimeSlot t1 = new TimeSlot(readTimeSlotID, readCourseID, readTimePeriodID, readCasualUser);\n\t\t\t\ttimeSlotArray.add(t1);\n\t\t\t\t//t1.getTimeSlotDetails();\n\t\t\t\t\n\t\t\t} //eo while\n\t\t} catch (IllegalStateException e) {\n\t\t\tSystem.err.println(\"Could not read from the file\");\n\t\t} catch (InputMismatchException e) {\n\t\t\tSystem.err.println(\"Something wrong happened while reading the file\");\n\t\t}\n\t\tinputStreamT.close();\n\t}", "public void load(File source);", "public void loadDataType() throws IOException, NumberFormatException {\r\n InputStream flux;\r\n flux = new FileInputStream(\"././ressources/datatype.txt\");\r\n BufferedReader buff;\r\n InputStreamReader inputStreamReader = new InputStreamReader(flux);\r\n buff = new BufferedReader(inputStreamReader);\r\n String line;\r\n line = buff.readLine();\r\n int type = Integer.parseInt(line);\r\n leftShoe.getSerialReader().setDataType(type);\r\n rightShoe.getSerialReader().setDataType(type);\r\n buff.close();\r\n inputStreamReader.close();\r\n flux.close();\r\n }", "public void load(File file) throws IOException {\n FileReader reader = new FileReader(file); //new File Reader\r\n char str[] = new char[10000]; //create a character string array of 10000 values\r\n reader.read(str);//read the file\r\n boolean temp[][] = new boolean[100][100]; //create a temporary new colony\r\n for (int r = 0; r < 100; r++) { //iterate through to fill with values\r\n for (int c = 0; c < 100; c++) {\r\n if (str[r*100 + c] == '1') { //if the char is equal to one, cell is alive\r\n temp[r][c] = true;\r\n } else {\r\n temp[r][c] = false; //else, the cell is dead\r\n }\r\n }\r\n }\r\n grid = temp;\r\n }", "private void loadFromFile() {\n try {\n FileInputStream fis = openFileInput(FILENAME);\n BufferedReader in = new BufferedReader(new InputStreamReader(fis));\n\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Sub>>(){}.getType();\n subList = gson.fromJson(in, listType);\n\n } catch (FileNotFoundException e) {\n subList = new ArrayList<Sub>();\n }\n }", "public void loadCoordinatesFromFile(File f) {\n new Thread(new Runnable() {\n @Override\n public void run() {\n final BufferedReader in;\n try {\n in = new BufferedReader(new FileReader(f));\n } catch (FileNotFoundException ex) {\n JDialog.setDefaultLookAndFeelDecorated(true);\n JOptionPane.showMessageDialog(null, \"Oops! No such file exists.\",\n \"Error\", JOptionPane.ERROR_MESSAGE);\n return;\n }\n\n // Read and set markers.\n String tweet=\"\", coordinates, text, sep = \";&;\";\n try {\n // Read the CSV header to skip it.\n if(!TweetEntity.getCSVHeader(\";&;\").equals(in.readLine()))\n throw new Exception(\"Incorrect file.\");\n while (((tweet = in.readLine()) != null)) {\n coordinates = tweet.substring(UIutils.nthOccurrence(tweet, sep, 8)+sep.length(), \n UIutils.nthOccurrence(tweet, sep, 9));\n if(coordinates.equals(\"NULL\"))\n continue;\n int commaIndex = coordinates.indexOf(\",\");\n double lat = Double.parseDouble(coordinates.substring(1, commaIndex));\n double lon = Double.parseDouble(coordinates.substring(commaIndex + 1, \n coordinates.length()-1));\n text = tweet.substring(UIutils.nthOccurrence(tweet, sep, 3)+sep.length(), \n UIutils.nthOccurrence(tweet, sep, 4));\n newTweet(lat, lon, TweetEntity.getLinkedText(text));\n }\n } catch (IOException ex) {\n JDialog.setDefaultLookAndFeelDecorated(true);\n JOptionPane.showMessageDialog(null, \"Cannot read file.\",\n \"Error\", JOptionPane.ERROR_MESSAGE);\n } catch (Exception e) {\n System.out.println(tweet);\n JDialog.setDefaultLookAndFeelDecorated(true);\n JOptionPane.showMessageDialog(null, \"Unknown error occured. \"\n + \"Possibly loaded an incorrectly parsed file.\",\n \"Error\", JOptionPane.ERROR_MESSAGE);\n } finally {\n try {\n in.close();\n } catch (IOException ignore) {}\n }\n }\n }).start();\n }", "public void\tload(String fileName) throws IOException;", "public void readSpeedFile(File file) {\n\t/** predefine the periods **/\n\tperiods = Period.universalDefine();\n\t\n\tspeedTables = new ArrayList<SpeedTable>();\n\t\n\ttry (BufferedReader br = new BufferedReader(new FileReader(file)))\n\t{\n\t\tString sCurrentLine;\n\t\tString [] lineElements;\n\t\t\n\t\twhile ((sCurrentLine = br.readLine()) != null) {\n//\t\t\tSystem.out.println(sCurrentLine);\n\t\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\t\tSpeedTable speedTable = new SpeedTable();\n\t\t\tfor (int i = 0; i < lineElements.length; i++) {\n\t\t\t\tdouble fromTime = periods.get(i).fromTime();\n\t\t\t\tdouble toTime = periods.get(i).toTime();\n\t\t\t\tdouble speed = Double.parseDouble(lineElements[i]);\n\t\t\t\tPeriodSpeed periodSpeed = new PeriodSpeed(fromTime, toTime, speed);\n\t\t\t\tspeedTable.add(periodSpeed);\n\t\t\t}\n\t\t\t\n\t\t\tspeedTables.add(speedTable);\n\t\t}\n\t} catch (IOException e) {\n\t\te.printStackTrace();\n\t}\n\t\n\t// create the all one speed table\n\tallOneSpeedTable = new SpeedTable();\n\tfor (int i = 0; i < periods.size(); i++) {\n\t\tdouble fromTime = periods.get(i).fromTime();\n\t\tdouble toTime = periods.get(i).toTime();\n\t\tallOneSpeedTable.add(new PeriodSpeed(fromTime, toTime, 1));\n\t}\n\t/*\n\tfor (int i = 0; i < speedTables.size(); i++) {\n\t\tSystem.out.println(\"For category \" + i);\n\t\tspeedTables.get(i).printMe();\n\t}*/\n}", "public void loadScores() {\n try {\n File f = new File(filePath, highScores);\n if(!f.isFile()){\n createSaveData();\n }\n BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f)));\n\n topScores.clear();\n topName.clear();\n\n String[] scores = reader.readLine().split(\"-\");\n String[] names = reader.readLine().split(\"-\");\n\n for (int i =0; i < scores.length; i++){\n topScores.add(Integer.parseInt(scores[i]));\n topName.add(names[i]);\n }\n reader.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "String loadFromFile () throws Exception {\n\n Reader reader = new Reader(new FileReader(file));\n String line;\n\n// reads all lines of the file\n while ((line = reader.readLine()) != null) {\n\n// depending on the object tag [element], it reads relevant parameters and creates the Element\n if (line.contains(\"[timeline]\"))\n timelines.add(new Timeline(reader.getStringArgument()));\n\n else if (line.contains(\"[event]\")) {\n String timelineName = reader.getStringArgument();\n for (Timeline timeline : timelines) {\n if (timelineName.equals(timeline.name)) {\n timeline.addEvent(\n reader.getStringArgument(),\n reader.getDateArgument(),\n reader.getDateArgument(),\n reader.getIntArgument() != 0,\n reader.getNotesArgument());\n break;\n }\n }\n }\n }\n reader.close();\n return (\"Data loaded successfully\");\n }", "public void loadGridFromFile( String filename )\n\t{\n\t\ttry {\n\t\t\tBufferedReader br = new BufferedReader( new FileReader( filename ));\n\t\t\tString[] data = new String[width];\n\t\t\tString delimiter = \",\", line = null;\n\t\t\tint i = 0, j = 0;\n\t\t\t\n\t\t\ttry \n\t\t\t{ \n\t\t\t\tline = br.readLine(); \n\t\t\t\t\n\t\t\t\t// Based on file format, determine grid width / height\n\t\t\t\twidth = line.length() / 2 + 1;\n\t\t\t\theight = line.length() / 2 + 1;\n\t\t\t\tgrid = new int[width][height];\n\t\t\t\t\n\t\t\t\t// While file isn't empty\n\t\t\t\twhile ( line != null )\n\t\t\t\t{\n\t\t\t\t\t// Split lines using delimiter of ','\n\t\t\t\t\tdata = line.split( delimiter );\n\t\t\t\t\t\n\t\t\t\t\t// Put contents of each formatted line into grid array\n\t\t\t\t\tfor (i = 0; i < width; i++) \n\t\t\t\t\t{\n\t\t\t\t\t\tgrid[i][j] = Integer.parseInt( data[i] );\n\t\t\t\t\t\tif ( grid[i][j] == 0 ) \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tx0 = i;\n\t\t\t\t\t\t\ty0 = j;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\tj++;\n\t\t\t\t\tline = br.readLine();\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (IOException e) \n\t\t\t{ \n\t\t\t\tSystem.out.println( \"Unable to read from file \" + filename + \". Closing...\" ); \n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\tcatch ( FileNotFoundException e)\n\t\t{\n\t\t\tSystem.out.println( \"File with name \" + filename + \" not found. Closing...\" );\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "private static void read(String fileName) {\n try {\n BufferedReader sc = null;\n sc = new BufferedReader(new FileReader(fileName));\n String temp = sc.readLine();\n interval = Integer.parseInt(temp);\n System.out.println(\"Interval = \" + interval + \" seconds.\");\n while ((temp = sc.readLine()) != null) {\n String[] entry = temp.split(\",\");\n url = entry[0];\n cores = Integer.parseInt(entry[1]);\n System.out.println(url + \" : \" + cores);\n }\n sc.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "public TimeSeries(String filePath) throws Exception {\n\n\n fileReader = new JsonDataFileReader(filePath);\n\n // Number of dimensions is the amount of values for each time stamp.\n // For some reason, the value cannot be converted to int right away\n int noOfDimensions = (int) ((long) fileReader.get(\"dimension\"));\n if (noOfDimensions != 1)\n throw new InvalidDimensionException(\"Only data files with one value dimension are allowed.\");\n\n name = (String) fileReader.get(\"timeseres\");\n readObservations();\n rangeTree = new RangeTree(observations);\n\n }", "public Timeline loadTimeline(File file) throws Exception {\n\n\t\tJAXBContext context = JAXBContext.newInstance(Timeline.class);\n\t\tUnmarshaller unMarshaller = context.createUnmarshaller();\n\n\t\treturn (Timeline) unMarshaller.unmarshal(file);\n\n\t}", "public static void load(File file) throws IOException {\n while (LogicManager.isUpdating()) {} // wait until current update has finished\n\n LogicManager.setPaused(true);\n\n // clear current scene\n GridManager.clearScene();\n\n // open input stream\n ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));\n\n try {\n // load viewport data\n Point viewport = (Point) in.readObject();\n int scaling = (Integer) in.readObject();\n Window.getCurrentInstance()\n .getGameDisplay()\n .setViewport(viewport);\n Window.getCurrentInstance()\n .getGameDisplay()\n .setScaling(scaling);\n SwingUtilities.invokeLater(() -> {\n Window.getCurrentInstance()\n .getGameDisplay()\n .revalidate();\n Window.getCurrentInstance()\n .getGameDisplay()\n .repaint();\n });\n\n // load point data\n Point[] data;\n data = (Point[]) in.readObject();\n GridManager.loadScene(data);\n } catch (ClassNotFoundException e) {\n in.close();\n throw new IOException(\"File contains illegal data\");\n }\n in.close();\n }", "Graph<V,E> load(String filename);", "public void load( String fileName ) {\n System.out.println( \"Loading: \" + fileName );\n this.name = fileName;\n Object obj = null;\n try {\n FileInputStream fis = new FileInputStream(fileName);\n ObjectInputStream oos = new ObjectInputStream( fis );\n obj = oos.readObject();\n dofs = (double[][]) obj;\n oos.close();\n fis.close();\n } catch ( Exception e ) {\n e.printStackTrace();\n } \n }", "public static ArrayList<Point> read_from_file(String file){\n Locale.setDefault(new Locale(\"en\", \"US\"));\n\n ArrayList<Point> points = new ArrayList<>();\n\n try {\n //java.io.File myObj = new java.io.File(\"test_points_2.txt\");\n //java.io.File myObj = new java.io.File(\"points.txt\");\n java.io.File myObj = new java.io.File(file);\n Scanner myReader = new Scanner(myObj);\n int N = myReader.nextInt();\n\n //System.out.println(N);\n for (int i = 0; i < N; i++) {\n double x = myReader.nextDouble();\n double y = myReader.nextDouble();\n points.add(new Point(x, y));\n //System.out.println(\"x: \" + x + \" y: \" + y);\n }\n\n myReader.close();\n } catch (FileNotFoundException e) {\n System.out.println(\"An error occurred.\");\n e.printStackTrace();\n return null;\n }\n return points;\n }", "public void load (String argFileName) throws IOException;", "private void readInter() throws FileNotFoundException {\n\t\t\r\n\t\tFile file = new File(\"input.txt\");\r\n\r\n\t\tScanner input = new Scanner(file);\r\n\r\n\t\twhile (input.hasNext()) {\r\n\r\n\t\t\tint x = input.nextInt();\r\n\t\t\tint y = input.nextInt();\r\n\t\t\t\r\n\t\t\tintervals.add(new Point(x, y));\r\n\t\t}\r\n\t\t\r\n\t\t//Close 'input.txt'\r\n\t\tinput.close();\r\n\t\t\r\n\t}", "public static void loadFromFile() {\n\t\tloadFromFile(Main.getConfigFile(), Main.instance.getServer());\n\t}", "public void load (IFile file) throws Exception;", "public T loadConfig(File file) throws IOException;", "default void load(String file) {\n load(new File(file));\n }", "public void loadTilemap(File fileToLoad) \n {\n File levelFile = fileToLoad;\n boolean roverPainted = false; //Used to check if rover is painted twice\n try\n {\n Scanner scanner = new Scanner(levelFile);\n //Strict capture, instead of hasNextLine()\n // to enforce level grid size\n //Collect data for each column in row, then go to next row\n // 0 = surface, 1 = rover, 2 = rock, 3 = mineral\n for(int y = 0; y < Level.MAX_ROWS; y++)\n {\n for(int x = 0; x < Level.MAX_COLUMNS; x++)\n {\n if(scanner.hasNext())\n {\n tilemap[x][y] = scanner.nextInt();\n \n //Check if this tile paint was a rover\n if(tilemap[x][y] == 1)\n {\n //If rover has already been painted\n if(roverPainted)\n {\n System.out.println(\"WARNING: Multiple rovers exist. \"\n + \"Please fix level file. \");\n }\n roverPainted = true; //Set roverPainted to true\n }\n }\n else\n {\n tilemap[x][y] = 0;\n }\n }\n }\n scanner.close();\n repaint();\n }\n catch (FileNotFoundException e) \n {\n System.out.println(\"Invalid Level File\");\n e.printStackTrace();\n }\n }", "public void setTicks(final int t) {\r\n ticks = t;\r\n }", "public static TraceList readFrom(File file) throws IOException{\n\t\tString fileName=file.getName();\n\t\tString formatName=fileName.contains(\".\")?fileName.substring(fileName.indexOf('.')+1):\"png\";\n\t\tfor(TraceListFormat next:ServiceLoader.load(TraceListFormat.class)){\n\t\t\tif(formatName.endsWith(next.getSuffix())){\n\t\t\t\treturn next.read(file);\n\t\t\t}\n\t\t}\n\t\treturn Extractor.getDefault().extract(ImageIO.read(file));\n\t}", "private void loadData(){\n try (BufferedReader br = new BufferedReader(new FileReader(this.fileName))) {\n String line;\n while((line=br.readLine())!=null){\n E e = createEntity(line);\n super.save(e);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private LinkedList<Integer> loadLabels(int n){\n\t\tLinkedList<Integer> labels = new LinkedList<>();\n\t\ttry {\n\t\t\tFileInputStream in = new FileInputStream(\"labels\");\n\t\t\t//Skipping magic number and array size\n\t\t\tfor (int i = 0; i < 8; i++) {\n\t\t\t\tin.read();\t\n\t\t\t}\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tlabels.add(new Integer((int) in.read()));\n\t\t\t}\n\t\t\tin.close();\n\t\t}catch (Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn labels;\n\t\t\n\t}", "private Candle[] read(String file) throws Exception {\r\n Scanner sc = new Scanner(new File(file));\r\n String[] spl;\r\n String s;\r\n Candle[] candles = new Candle[32 * 24 * 60];\r\n int i = 0;\r\n while(sc.hasNextLine()){\r\n spl = sc.nextLine().split(\",\");\r\n candles[i] = new Candle(spl[0] + \" \" + spl[1], spl[2], spl[3], spl[4], spl[5]);\r\n i++;\r\n\r\n }\r\n Candle[] newCandles = new Candle[i];\r\n System.arraycopy(candles, 0, newCandles, 0, i);\r\n sc.close();\r\n return newCandles;\r\n \r\n }", "public void load() throws ClassNotFoundException, IOException;", "private void readFromFile(String path) throws ClassNotFoundException {\n\t\ttry {\n\t\t\tInputStream file = new FileInputStream(path);\n\t\t\tInputStream buffer = new BufferedInputStream(file);\n\t\t\tObjectInput input = new ObjectInputStream(buffer);\n\n\t\t\ttagList = (HashMap<String, Integer>) input.readObject();\n\t\t\tinput.close();\n\t\t} catch (IOException ex) {\n\t\t\tSystem.out.println(\"Cannot read from input.\");\n\t\t}\n\t}", "public void loadFile(File p_file) throws IOException;", "private void loadExpressionDataInBinaryFormat(String fileName, LoadLabels ll) throws IOException, ClassNotFoundException {\n this.fileName = fileName;\r\n File fileBinary = new File(fileName + \".dat\");\r\n BufferedInputStream in = null;\r\n int nrRowsThisBinaryFile = -1;\r\n int nrColsThisBinaryFile = -1;\r\n in = new BufferedInputStream(new FileInputStream(fileBinary));\r\n byte[] bytes = new byte[4];\r\n in.read(bytes, 0, 4);\r\n nrRowsThisBinaryFile = byteArrayToInt(bytes);\r\n in.read(bytes, 0, 4);\r\n nrColsThisBinaryFile = byteArrayToInt(bytes);\r\n \r\n if (rowsToInclude == null && colsToInclude == null) {\r\n //We want to load all the data:\r\n nrRows = nrRowsThisBinaryFile;\r\n nrCols = nrColsThisBinaryFile;\r\n rawData = new double[nrRows][nrCols];\r\n \r\n //Now load the row and column identifiers from files\r\n switch (ll) {\r\n case LOAD_BOTH:\r\n loadRowObjects(fileName);\r\n loadColumnObjects(fileName);\r\n break;\r\n case LOAD_ROWS:\r\n loadRowObjects(fileName);\r\n break;\r\n case LOAD_COLUMNS:\r\n loadColumnObjects(fileName);\r\n break;\r\n }\r\n \r\n byte[] buffer = new byte[nrCols * 8];\r\n long bits = 0;\r\n for (int row = 0; row < nrRows; row++) {\r\n in.read(buffer, 0, nrCols * 8);\r\n int bufferLoc = 0;\r\n for (int col = 0; col < nrCols; col++) {\r\n bits = (long) (0xff & buffer[bufferLoc + 7])\r\n | (long) (0xff & buffer[bufferLoc + 6]) << 8\r\n | (long) (0xff & buffer[bufferLoc + 5]) << 16\r\n | (long) (0xff & buffer[bufferLoc + 4]) << 24\r\n | (long) (0xff & buffer[bufferLoc + 3]) << 32\r\n | (long) (0xff & buffer[bufferLoc + 2]) << 40\r\n | (long) (0xff & buffer[bufferLoc + 1]) << 48\r\n | (long) (buffer[bufferLoc]) << 56;\r\n \r\n rawData[row][col] = Double.longBitsToDouble(bits);\r\n bufferLoc += 8;\r\n }\r\n }\r\n in.close();\r\n } else {\r\n \r\n //We want to confine the set of probes and samples to a subset. Deal with this in a different way.\r\n int[] rowSubsetIndex = loadRowObjects(fileName, nrRowsThisBinaryFile);\r\n int[] colSubsetIndex = loadColumnObjects(fileName, nrColsThisBinaryFile);\r\n \r\n //Now load the binary data:\r\n rawData = new double[nrRows][nrCols];\r\n byte[] buffer = new byte[nrColsThisBinaryFile * 8];\r\n long bits = 0;\r\n for (int row = 0; row < nrRowsThisBinaryFile; row++) {\r\n in.read(buffer, 0, nrColsThisBinaryFile * 8);\r\n int bufferLoc = 0;\r\n for (int col = 0; col < nrColsThisBinaryFile; col++) {\r\n bits = (long) (0xff & buffer[bufferLoc + 7])\r\n | (long) (0xff & buffer[bufferLoc + 6]) << 8\r\n | (long) (0xff & buffer[bufferLoc + 5]) << 16\r\n | (long) (0xff & buffer[bufferLoc + 4]) << 24\r\n | (long) (0xff & buffer[bufferLoc + 3]) << 32\r\n | (long) (0xff & buffer[bufferLoc + 2]) << 40\r\n | (long) (0xff & buffer[bufferLoc + 1]) << 48\r\n | (long) (buffer[bufferLoc]) << 56;\r\n \r\n int rowI = rowSubsetIndex[row];\r\n int colI = colSubsetIndex[col];\r\n if (rowI != -1 && colI != -1) {\r\n rawData[rowI][colI] = Double.longBitsToDouble(bits);\r\n }\r\n bufferLoc += 8;\r\n }\r\n }\r\n in.close();\r\n }\r\n recalculateHashMaps();\r\n LOGGER.log(Level.INFO, \"Binary file ''{0}'' has been loaded, nrRows: {1} nrCols: {2}\", new Object[]{fileName, nrRows, nrCols});\r\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic static ArrayList<Tweet> load(String fname) {\n\t\tArrayList<Tweet> tweets = new ArrayList<Tweet>();\n\t\n\t\ttry {\n\t\t FileInputStream fin = new FileInputStream(fname);\n\t\t ObjectInputStream ois = new ObjectInputStream(fin);\n\t\t tweets = (ArrayList<Tweet>) (ois.readObject());\n\t\t ois.close();\n\t\t} catch (FileNotFoundException ex) {\n\t\t ex.printStackTrace();\n\t\t} catch (IOException ioex) {\n\t\t ioex.printStackTrace();\n\t\t}\n\t\tcatch (ClassNotFoundException classex) {\n\t\t classex.printStackTrace();\n\t\t}\n\t\treturn tweets;\n }", "public void load() throws IOException, ClassNotFoundException {\n\t\ttry {\n\t\t\t// use buffering\n\t\t\tFile gamesInFile = new File(\"games.txt\");\n\t\t\tif (!gamesInFile.exists())\n\t\t\t\tSystem.out.println(\"First run\");\n\t\t\telse {\n\t\t\t\tInputStream file = new FileInputStream(gamesInFile);\n\t\t\t\tInputStream buffered = new BufferedInputStream(file);\n\t\t\t\tObjectInput input = new ObjectInputStream(buffered);\n\t\t\t\ttry {\n\t\t\t\t\t// deserialize the List\n\t\t\t\t\tArrayList<MancalaGame> gamesFromFile = (ArrayList<MancalaGame>) input.readObject();\n\t\t\t\t\tgames = gamesFromFile;\n\t\t\t\t} finally {\n\t\t\t\t\tinput.close();\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tSystem.out.println(\"Load successful\");\n\t\t}\n\t}", "public void loadMap(String filepath) {\n\n\t\ttry {\n\n\t\t\tInputStream in = getClass().getResourceAsStream(filepath);\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(in));\n\n\t\t\tnumCols = Integer.parseInt(br.readLine());\n\t\t\tnumRows = Integer.parseInt(br.readLine());\n\t\t\tmap = new int[numRows][numCols];\n\t\t\twidth = numCols * tileSize;\n\t\t\theight = numRows * tileSize;\n\n\t\t\tString delims = \"\\\\s+\";\n\t\t\tfor (int row = 0; row < numRows; row++) {\n\t\t\t\tString line = br.readLine();\n\t\t\t\tString[] tokens = line.split(delims);\n\t\t\t\tfor (int col = 0; col < numCols; col++) {\n\t\t\t\t\tmap[row][col] = Integer.parseInt(tokens[col]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "void tick(long ticksSinceStart);", "public MutableTextLabels loadOps(TextBase base,File file) throws IOException,FileNotFoundException\n\t{\n\t\tMutableTextLabels labels = new BasicTextLabels(base);\n\t\timportOps(labels,base,file);\n\t\treturn labels;\n\t}", "public void loadScoreFile() {\n try {\n inputStream = new ObjectInputStream(new FileInputStream(HIGHSCORE_FILE));\n scores = (ArrayList<Score>) inputStream.readObject();\n } catch (FileNotFoundException e) {\n } catch (IOException e) {\n } catch (ClassNotFoundException e) {\n } finally {\n try {\n if (outputStream != null) {\n outputStream.flush();\n outputStream.close();\n }\n } catch (IOException e) {\n }\n }\n }", "public void loadFromCsv(String filePath) throws Exception {\n\tBufferedReader br=new BufferedReader(new FileReader(filePath));\n\tString line=\"\";\n\tint i=0;\n\n\tline=br.readLine();\n\tthis.gen=Integer.parseInt(line);\n\t\n\twhile((line=br.readLine()) != null) {\n\t this.setBna(i,line);\n\t i++;\n\t}\n\tbr.close();\n }", "public void loadFromFile(final Context ctx) {\n\t\tString line, code, desc;\n\t\tDTC dtc;\n\t\ttry {\n\t\t\t// final FileInputStream fstream = new FileInputStream(pathname);\n\t\t\tfinal InputStream fstream = ctx.getResources().openRawResource(\n\t\t\t\t\tR.raw.dtc);\n\t\t\tfinal BufferedReader in = new BufferedReader(new InputStreamReader(\n\t\t\t\t\tfstream));\n\t\t\twhile (in.ready()) {\n\t\t\t\tline = in.readLine();\n\t\t\t\tcode = line.substring(0, line.indexOf(','));\n\t\t\t\tdesc = line.substring(line.indexOf(',') + 1);\n\t\t\t\tdtc = new DTC(code, desc);\n\t\t\t\tput(dtc.codeAsInt(), dtc);\n\t\t\t}\n\t\t\tin.close();\n\t\t} catch (final Exception e) {\n\t\t\tLog.e(TAG, \"Error reading the DTC codes from the CSV file\", e);\n\t\t}\n\t}", "private void loadTasks() {\n try {\n List<Task> tasks = Reader.readTasks(new File(TASKS_FILE));\n for (Task t1 : tasks) {\n todoList.addTask(t1);\n }\n } catch (IOException e) {\n System.err.println(\"No file exists\");\n }\n }", "TraceList read(File file) throws IOException;", "protected void loadFile(String s) {\n\t\tpush();\n\t\tfile.load(s, curves);\n\t\trecalculateCurves();\n\t\tpushNew();\n\t}", "public static void load() {\n }", "@Override\n\tpublic void load(final String filePath) {\n\t\tsuper.load(filePath);\n\t\ttry {\n\t\t\tfinal JCL_facade jcl = JCL_FacadeImpl.getInstance();\n\t\t\tfinal Object2DoubleMap<String> distances = new Object2DoubleOpenHashMap<>();\n\n\t\t\tBufferedReader in = new BufferedReader(new FileReader(filePath));\n\t\t\tString str = null;\n\n\t\t\tList<String> inputLimpos = new LinkedList<>();\n\n\t\t\tdouble lower = 0;\n\n\t\t\t// ler o arquivo\n\t\t\twhile ((str = in.readLine()) != null) {\n\t\t\t\tif (!str.trim().equals(\"EOF\")) {\n\t\t\t\t\tString[] inputDetalhes = str.split(\" \");\n\t\t\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\t\t\tfor (final String frag : inputDetalhes) {\n\t\t\t\t\t\tif (!frag.equals(\"\")) {\n\t\t\t\t\t\t\tsb.append(frag + \":\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tinputLimpos.add(sb.toString());\n\t\t\t\t\tsb = null;\n\t\t\t\t\tinputDetalhes = null;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tin.close();\n\t\t\tin = null;\n\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tfinal ObjectSet<String> vertices = (ObjectSet<String>) jcl.getValue(\"vertices\").getCorrectResult();\n\n\t\t\tdouble lowest = Double.MAX_VALUE;\n\t\t\t/*\n\t\t\t * transitar todo projeto para DOUBLE tirar todos floats para que aceite o\n\t\t\t * permutation\n\t\t\t */\n\t\t\t// montando distancias\n\t\t\tfor (final String umaEntrada : inputLimpos) {\n\t\t\t\tString[] umaEntradaDetalhe = umaEntrada.split(\":\");\n\t\t\t\tdouble menorD = Double.MAX_VALUE;\n\t\t\t\tdouble maiorD = Double.MIN_VALUE;\n\t\t\t\tvertices.add(\"$\" + umaEntradaDetalhe[0] + \"$\");\n\t\t\t\tfor (final String outraEntrada : inputLimpos) {\n\t\t\t\t\tString[] outraEntradaDetalhe = outraEntrada.split(\":\");\n\t\t\t\t\tif (!umaEntradaDetalhe[0].equals(outraEntradaDetalhe[0])) {\n\t\t\t\t\t\tfinal double dx = (Double.parseDouble(outraEntradaDetalhe[1])\n\t\t\t\t\t\t\t\t- Double.parseDouble(umaEntradaDetalhe[1]));\n\t\t\t\t\t\tfinal double dy = (Double.parseDouble(outraEntradaDetalhe[2])\n\t\t\t\t\t\t\t\t- Double.parseDouble(umaEntradaDetalhe[2]));\n\n\t\t\t\t\t\tfinal double d = Math.hypot(dx, dy);\n\n\t\t\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$\" + outraEntradaDetalhe[0] + \"$\", d);\n\n\t\t\t\t\t\tif (d < menorD) {\n\t\t\t\t\t\t\tmenorD = d;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (d > maiorD) {\n\t\t\t\t\t\t\tmaiorD = d;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\toutraEntradaDetalhe = null;\n\t\t\t\t}\n\n\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$shorterD$\", menorD);\n\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$longerD$\", maiorD);\n\n\t\t\t\tlower += menorD;\n\t\t\t\tif (lowest > menorD) {\n\t\t\t\t\tlowest = menorD;\n\t\t\t\t}\n\n\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$X$\", Float.parseFloat(umaEntradaDetalhe[1]));\n\t\t\t\tdistances.put(\"$\" + umaEntradaDetalhe[0] + \"$:$Y$\", Float.parseFloat(umaEntradaDetalhe[2]));\n\t\t\t\tumaEntradaDetalhe = null;\n\t\t\t}\n\n\t\t\tlower += lowest;\n\n\t\t\tinputLimpos.clear();\n\t\t\tinputLimpos = null;\n\n\t\t\tjcl.instantiateGlobalVar(\"numOfVertices\", vertices.size());\n\n\t\t\tjcl.setValueUnlocking(\"vertices\", vertices);\n\n\t\t\tjcl.setValueUnlocking(\"lower\", lower);\n\n\t\t\tJcldataAccess.instantiateVarInJCL(\"distances\", distances);\n\n\t\t\tSystem.out.println(vertices.toString());\n\n\t\t} catch (final Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "public ArrayList<Task> load() throws DukeException {\n ArrayList<Task> tasks = new ArrayList<>();\n try {\n File f = new File(filePath);\n if (f.exists()) {\n Scanner sc = new Scanner(f);\n while (sc.hasNext()) {\n String next = sc.nextLine();\n Task t = parseLine(next);\n tasks.add(t);\n }\n sc.close();\n } else {\n if (!f.getParentFile().exists()) {\n f.getParentFile().mkdir();\n }\n }\n f.createNewFile();\n } catch (IOException e) {\n throw new DukeException(\"Error retrieving/reading from data file, creating new file instead.\");\n }\n return tasks;\n }", "@Override\n public boolean load(String file) {\n try {\n FileInputStream streamIn = new FileInputStream(file);\n ObjectInputStream objectinputstream = new ObjectInputStream(streamIn);\n WGraph_Algo readCase = (WGraph_Algo) objectinputstream.readObject();\n this.ga=null;//initialize the graph\n this.ga=readCase.ga;//take the graph from readCase to this.ga\n }\n catch(Exception e) {\n e.printStackTrace();\n }\n return false;\n }", "public static void load()\n throws IOException, ClassNotFoundException {\n FileInputStream f_in = new\n FileInputStream (settingsFile);\n ObjectInputStream o_in = new\n ObjectInputStream(f_in);\n SettingsSaver loaded = (SettingsSaver) o_in.readObject();\n advModeUnlocked = loaded.set[0];\n LIM_NOTESPERLINE = loaded.set[1];\n LIM_96_MEASURES = loaded.set[2];\n LIM_VOLUME_LINE = loaded.set[3];\n LIM_LOWA = loaded.set[4];\n LIM_HIGHD = loaded.set[5];\n LOW_A_ON = loaded.set[6];\n NEG_TEMPO_FUN = loaded.set[7];\n LIM_TEMPO_GAPS = loaded.set[8];\n RESIZE_WIN = loaded.set[9];\n ADV_MODE = loaded.set[10];\n o_in.close();\n f_in.close();\n }", "public void stockLoad() {\n try {\n File file = new File(stockPath);\n Scanner scanner = new Scanner(file);\n while (scanner.hasNextLine()) {\n String data = scanner.nextLine();\n String[] userData = data.split(separator);\n Stock stock = new Stock();\n stock.setProductName(userData[0]);\n int stockCountToInt = Integer.parseInt(userData[1]);\n stock.setStockCount(stockCountToInt);\n float priceToFloat = Float.parseFloat(userData[2]);\n stock.setPrice(priceToFloat);\n stock.setBarcode(userData[3]);\n\n stocks.add(stock);\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }", "public boolean load(String file);", "public void loadData() {\n Path path= Paths.get(filename);\n Stream<String> lines;\n try {\n lines= Files.lines(path);\n lines.forEach(ln->{\n String[] s=ln.split(\";\");\n if(s.length==3){\n try {\n super.save(new Teme(Integer.parseInt(s[0]),Integer.parseInt(s[1]),s[2]));\n } catch (ValidationException e) {\n e.printStackTrace();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }else\n System.out.println(\"linie corupta in fisierul teme.txt\");});\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void readRacesFromFile(String racesFileName) {\n\n DateTimeFormatter formatter = DateTimeFormatter.ofPattern(\"dd.MM.yyyy\");\n\n URL url = Thread.currentThread().getContextClassLoader()\n .getResource(racesFileName);\n try (Stream<String> stream = Files.lines(Paths.get(url.getPath()))) {\n stream\n .skip(1)\n .map(s -> s.split(\";\"))\n .map(a -> new Race(Long.parseLong(a[0]), a[1], LocalDate.parse(a[2], formatter)))\n //.forEach(System.out::println);\n .forEach(em::persist);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "private static void loadGridPoints() throws IOException {\n\n\t\tString filename = \"Grid Point file Path\";\n\t\tCSVReader reader = new CSVReader(new FileReader(filename));\n\t\treader.readNext();\n\t\tString[] nextLine;\n\n\t\tint id;\n\t\tdouble x, y;\n\t\ttree = new STRtree();\n\t\tpoints = new HashMap<Integer, double[]>();\n\t\tEnvelope itemEnv;\n\t\twhile ((nextLine = reader.readNext()) != null) {\n\n\t\t\tid = Integer.valueOf(nextLine[0]);\n\t\t\tx = Double.valueOf(nextLine[1]);\n\t\t\ty = Double.valueOf(nextLine[2]);\n\t\t\tdouble[] point = { x, y };\n\t\t\tpoints.put(id, point);\n\t\t\titemEnv = new Envelope(x, x, y, y);\n\t\t\ttree.insert(itemEnv, id);\n\t\t}\n\t\treader.close();\n\t}", "Points(String filepath){\n readPointsFile(filepath); //dengan file points.txt\n }", "private void readFromFile(String filename) {\n\t\ttry {\n\t\t Scanner read = new Scanner(new File(filename));\n\t\t String line;\n\t\t int counter = 0;\n\t\t String temp;\n\t\t line = read.nextLine();\n\t\t temp = line.substring(0);\n\t\t height = convertToInt(temp);\n\n\t\t line = read.nextLine();\n\t\t temp = line.substring(0);\n\n\t\t length = convertToInt(temp);\n\t\t size = height*length;\n\t\t \n\t\t squares = new Square[size][size];\n\n\t\t while(read.hasNextLine()) {\n\t\t\t\tline = read.nextLine();\n\t\t \tfor (int i = 0; i < line.length(); i++) {\n\t\t \t temp = line.substring(i, i+1);\n\n\t\t \t if (temp.equals(\".\")) {\n\t\t \t\t\tsquares[counter][i] = new FindValue(0);\n\t\t \t } \n\t\t \t else {\n\t\t\t\t\t\tsquares[counter][i] = new PreFilled(convertToInt(temp));\n\t\t\t \t\t}\n\t\t \t}\n\t\t \tcounter++;\n\t\t }\n\t\t} catch(IOException e) {\n\t\t e.printStackTrace();\n\t\t}\n }", "public int Load(String filepath) throws IOException {\n \t\tint AddeCounter = 0;\n \t\tPath path = Paths.get(filepath);\n \t\ttry (Scanner scanner = new Scanner(path, ENCODING.name())) {\n \t\t\twhile (scanner.hasNextLine()) {\n \t\t\t\t// Read each line into the array list\n \t\t\t\tString line = scanner.nextLine();\n \t\t\t\tif (line != null && !line.isEmpty()) {\n \t\t\t\t\tJobs jobUnit = new Jobs(line);\n \t\t\t\t\tjobqueue.add(jobUnit);\n \t\t\t\t\tAddeCounter++;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn AddeCounter;\n \t}", "private void loadScheme(File file)\n\t{\n\t\tString name = file.getName();\n\n\t\ttry\n\t\t{\n\t\t\tBedrockScheme particle = BedrockScheme.parse(FileUtils.readFileToString(file, Charset.defaultCharset()));\n\n\t\t\tthis.presets.put(name.substring(0, name.indexOf(\".json\")), particle);\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void loadAlarms() {\n\n try {\n if (!Files.exists(Paths.get(alarmsFile))) {\n\n System.out.println(\"Alarms file not found attemping to create default\");\n Files.createFile(Paths.get(alarmsFile));\n\n } else {\n List<String> fileLines = Files.readAllLines(Paths.get(alarmsFile));\n\n for (int i = 0; i < fileLines.size() - 1; i += 4) {\n int hour = Integer.parseInt(fileLines.get(i));\n int minute = Integer.parseInt(fileLines.get(i + 1));\n int period = Integer.parseInt(fileLines.get(i + 2));\n String name = fileLines.get(i + 3);\n\n System.out.println(\"Adding new alarm from file. \" + name);\n addEntry(hour, minute, period, name);\n }\n }\n } catch (UnsupportedEncodingException ex) {\n Logger.getLogger(AlarmsEditPanel.class.getName()).log(Level.SEVERE, null, ex);\n } catch (FileNotFoundException ex) {\n Logger.getLogger(AlarmsEditPanel.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(AlarmsEditPanel.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "void loadFromFile() {\n\t\ttry {\n\t\t\tFile directory = GameApplication.getInstance().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS);\n\t\t\tFile source = new File(directory, FILE_NAME);\n\t\t\tMap<String, Scoreboard> scoreboards = new HashMap<String, Scoreboard>();\n\t\t\tif (source.exists()) {\n\t\t\t\tJsonReader reader = new JsonReader(new FileReader(source));\n\t\t\t\treader.beginArray();\n\t\t\t\twhile (reader.hasNext()) {\n\t\t\t\t\tScoreboard scoreboard = readScoreboard(reader);\n\t\t\t\t\tscoreboards.put(scoreboard.getName(), scoreboard);\n\t\t\t\t}\n\t\t\t\treader.endArray();\n\t\t\t\treader.close();\n\t\t\t} else {\n\t\t\t\tsource.createNewFile();\n\t\t\t}\n\t\t\tthis.scoreboards = scoreboards;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void readFromTxtFile(String filename){\n try{\n File graphFile = new File(filename); \n Scanner myReader = new Scanner(graphFile); \n parseFile(myReader);\n myReader.close();\n } \n catch(FileNotFoundException e){\n System.out.println(\"ERROR: DGraphEdges, readFromTxtFile: file not found.\");\n e.printStackTrace();\n } \n }", "private List<Task> getTasksFromFile() throws FileNotFoundException{\n List<Task> loadedTasks = new ArrayList<>();\n Ui a=new Ui();\n try {\n List<String> lines = getLine() ;\n for (String line : lines) {\n if (line.trim().isEmpty()) { //ignore empty lines\n continue;\n }\n loadedTasks.add(createTask(line)); //convert the line to a task and add to the list\n }\n System.out.println(\"File successfully loaded\");\n } catch (DukeException e1) {\n System.out.println(\"☹ OOPS!!! Problem encountered while loading data: \" +e1.getMessage());\n }\n return loadedTasks;\n }", "public static void Load(String filename) throws IOException {\n\t\tLineNumberReader lnr = new LineNumberReader(new FileReader(filename));\r\n\t\t linenumber = 0;\r\n\t\t while (lnr.readLine() != null){\r\n\t\t\t linenumber++;\r\n\t\t }\r\n lnr.close();\r\n \tarrr=new String[linenumber][5];\r\n\t\tarr=arrr;\r\n\t\tBufferedReader br=new BufferedReader(new FileReader(filename));\r\n\t\t Scanner sc1=new Scanner(br);\r\n\t\t String ss=sc1.nextLine();\r\n\t\t String[] str1 = ss.split(\",\") ;\r\n\t\t String r=str1[0];\r\n\t\t String t=str1[1];\r\n\t\t String[] str2 = r.split(\":\") ;\r\n\t\t round= Integer.parseInt(str2[1]);\r\n\t\t String[] str3 = t.split(\":\") ;\r\n\t\t who=Integer.parseInt(str3[1]);\r\n\t\t arr=new String[linenumber][5];\r\n\t\t int num=0;\r\n\t\t while(sc1.hasNextLine()) {\t\r\n\t\t\t int i=0;\r\n\t\t\t num++;\r\n\t\t\t String x=sc1.nextLine();\r\n\t\t\tString[] str = x.split(\",\") ;\r\n\t\t\twhile(i<5) {\r\n\t\t\t\tarr[num][i]=str[i];\r\n\t\t\t\ti++;\r\n\t\t\t }\r\n\t\t }\r\n\t\t int c=1;\r\n\t ch=new Character[linenumber];\r\n\r\n\t\t\twhile(c<(linenumber)) {\r\n\t\t\t\t\r\n\t\t\t\tch[c]=new Character(Integer.parseInt(arr[c][0]),Integer.parseInt(arr[c][1]),Integer.parseInt(arr[c][2]),Integer.parseInt(arr[c][3]),arr[c][4]);\t\t\t\t\t\t\t\r\n\t\t\t\tc++;\r\n\t\t\t}\t\r\n\t\t\r\n\t\t sc1.close();\r\n\t\t String file=\"Land.txt\";\r\n\t\t\tBufferedReader br2=new BufferedReader(new FileReader(file));\r\n\t\t\tland=new String[20][2];\r\n\t\t\tland2=new String[20][2];\r\n\t\t\tland=land2;\r\n\t\t\tScanner sc2=new Scanner(br2);\r\n\t\t\tString strr=sc2.nextLine();\r\n\t\t\tnum=0;\r\n\t\t\t while(sc2.hasNextLine()) {\t\r\n\t\t\t\t int i=0;\r\n\t\t\t\t num++;\r\n\t\t\t\t String x=sc2.nextLine();\t\t\t\r\n\t\t\t\tString[] str = x.split(\",\") ;\r\n\t\t\t\twhile(i<2) {\r\n\t\t\t\t\tland[num][i]=str[i];\r\n\t\t\t\t\ti++;\r\n\t\t\t\t }\t\t\t\r\n\t\t\t }\r\n\t\t\t\r\n\t\t\t String url = \"//localhost:3306/checkpoint?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT\";\r\n\t\t // String url=\"//140.127.220.220/\";\r\n\t\t // String dbname=\"CHECKPOINT\";\r\n\t\t\t Connection conn = null;\r\n\t\t try{\r\n\t\t conn = DriverManager.getConnection(protocol + url,username,passwd);\r\n\t\t Statement s = conn.createStatement();\r\n\t\t String sql = \"SELECT PLACE_NUMBER,LAND_PRICE,TOLLS FROM LAND\";\r\n\t\t rs=s.executeQuery(sql);\r\n\t\t p_number=new int[20];\r\n\t\t l_price=new int[20];\r\n\t\t tolls=new int[20];\r\n\t\t grid=0;\r\n\t\t while(rs.next()){\r\n\t\t \tgrid++;\r\n\t\t \tp_number[grid]=rs.getInt(\"PLACE_NUMBER\");\r\n\t\t \tl_price[grid]=rs.getInt(\"LAND_PRICE\");\r\n\t\t \ttolls[grid]=rs.getInt(\"TOLLS\");\t \t\t \t\r\n\t\t }\t\t \t\t \r\n\t\t rs.close();\r\n\t\t conn.close();\r\n\t\t } catch(SQLException err){\r\n\t\t System.err.println(\"SQL error.\");\r\n\t\t err.printStackTrace(System.err);\r\n\t\t System.exit(0);\r\n\t\t }\r\n\t\t\t Land=new Land[20];\r\n\t\t\t Land2=new Land[20];\r\n\t\t\t Land=Land2;\t\t\t \r\n\t\t \tfor(int i=1;i<=grid;i++) {\r\n\t\t \t\tLand[i]=new Land(p_number[i],Integer.parseInt(land[i][1]),l_price[i],tolls[i]);\t \t\t\r\n\t\t \t}\r\n\t\t\t sc2.close();\r\n\t}", "public Schedule loadSchedules(File file) {\n\n return readWrite.loadSchedules(file, this);\n }", "public void load() ;", "void load();", "void load();", "private static void fillDataset(Dataset d){\n try{\n\n BufferedReader in = new BufferedReader(new FileReader(\"src/points.txt\"));\n String str;\n while ((str = in.readLine()) != null){\n String[] tmp=str.split(\",\");\n d.addPoint(new Point(Double.parseDouble(tmp[0]), Double.parseDouble(tmp[1])));\n }\n in.close();\n }\n catch (IOException e){\n System.out.println(\"File Read Error\");\n }\n }", "public ArrayList<Item> loadItems(String filename) {\n ArrayList<Item> itemsList = new ArrayList<>();\n try {\n File file = new File(filename);\n BufferedReader reader= new BufferedReader(new InputStreamReader(new FileInputStream(file), \"UTF-8\"));\n String line= reader.readLine();\n while (line != null){\n String[] splitedLine = line.split(\"=\");\n String name = splitedLine[0];\n int weight = Integer.parseInt(splitedLine[1]) / 1000; // on convertit en tonnes\n itemsList.add(new Item(name,weight));\n line = reader.readLine();\n }\n reader.close(); //pour arreter la memoire tampon\n }\n catch(IOException e)\n {\n e.printStackTrace();\n }\n\n return itemsList;\n }", "public Spielsteuerung(Path file) {\n BufferedReader reader = null;\n try {\n Charset charset = Charset.forName(\"UTF-8\");\n reader = Files.newBufferedReader(file, charset);\n String zeile = null;\n long date = 0;\n boolean dateiKaputt = false;\n while ((zeile = reader.readLine()) != null && !dateiKaputt) {\n // Einlesen\n String[] data = zeile.split(\":\");\n String[] detail;\n int x, y;\n switch (data[0]) {\n case \"b\":\n breite = Integer.parseInt(data[1]);\n if (hoehe != 0 && breite != 0) {\n initVariables();\n }\n break;\n case \"h\":\n hoehe = Integer.parseInt(data[1]);\n if (hoehe != 0 && breite != 0) {\n initVariables();\n }\n break;\n case \"geld\":\n geld = Long.parseLong(data[1]);\n break;\n case \"bil\":\n bilanz = Integer.parseInt(data[1]);\n break;\n case \"depot\":\n depot = Integer.parseInt(data[1]);\n break;\n case \"w\":\n werkstatt = Integer.parseInt(data[1]);\n break;\n case \"date\":\n date = Long.parseLong(data[1]);\n break;\n case \"haus\":\n if (hoehe != 0 && breite != 0) {\n detail = data[1].split(\",\");\n x = Integer.parseInt(detail[1]);\n y = Integer.parseInt(detail[0]);\n teile[y][x] = new Haus();\n hauszahl++;\n } else {\n dateiKaputt = true;\n }\n break;\n case \"firma\":\n if (hoehe != 0 && breite != 0) {\n detail = data[1].split(\",\");\n x = Integer.parseInt(detail[1]);\n y = Integer.parseInt(detail[0]);\n teile[y][x] = new Firma();\n hauszahl++;\n } else {\n dateiKaputt = true;\n }\n break;\n case \"park\":\n if (hoehe != 0 && breite != 0) {\n detail = data[1].split(\",\");\n x = Integer.parseInt(detail[1]);\n y = Integer.parseInt(detail[0]);\n teile[y][x] = new Park();\n hauszahl++;\n } else {\n dateiKaputt = true;\n }\n break;\n case \"rh\":\n if (hoehe != 0 && breite != 0) {\n detail = data[1].split(\",\");\n x = Integer.parseInt(detail[1]);\n y = Integer.parseInt(detail[0]);\n teile[y][x] = new Rathaus();\n hauszahl++;\n } else {\n dateiKaputt = true;\n }\n break;\n case \"bhf\":\n if (hoehe != 0 && breite != 0) {\n // System.out.println(\"Bahnhof geladen!\");\n detail = data[1].split(\",\");\n x = Integer.parseInt(detail[1]);\n y = Integer.parseInt(detail[0]);\n bhfNamen.remove(bhfNamen.indexOf(detail[2]));\n intNeuerBahnhof(x, y, detail[2]);\n bahnhoefe[y][x].setEinsteigen(Integer.parseInt(detail[3]));\n bahnhoefe[y][x].setAussteigen(Integer.parseInt(detail[4]));\n bahnhoefe[y][x].setKasse(Integer.parseInt(detail[5]));\n } else {\n dateiKaputt = true;\n }\n break;\n case \"linie\":\n if (hoehe != 0 && breite != 0) {\n // System.out.println(\"Linie geladen!\");\n detail = data[1].split(\",\");\n int stelle = intNeueLinie(detail[0]);\n linien[stelle].setFarbe(new Color(Integer.parseInt(detail[1]), Integer.parseInt(detail[2]), Integer.parseInt(detail[3])));\n linien[stelle].setZuegeWieder(Integer.parseInt(detail[4]));\n linien[stelle].setGewinn(Integer.parseInt(detail[6]));\n // Bahnhöfe einfügen\n String bhfZeile = \"\";\n while (!(bhfZeile = reader.readLine()).equals(\"endeLinie\")) {\n // System.out.println(\"Bahnhof zu Linie geladen!\");\n String[] bhf = bhfZeile.split(\":\");\n if (bhf[0].equals(\"bzl\")) {\n String[] koord = bhf[1].split(\",\");\n linien[stelle].bahnhofWiederEinfuegen(bahnhoefe[Integer.parseInt(koord[0])][Integer.parseInt(koord[1])]);\n }\n }\n\n linien[stelle].setGruenesLicht(Boolean.parseBoolean(detail[5]));\n } else {\n dateiKaputt = true;\n }\n break;\n }\n }\n reader.close();\n\n if (hoehe == 0 || breite == 0) {\n dateiKaputt = true;\n }\n\n if (dateiKaputt) {\n JOptionPane.showMessageDialog(null, \"Dieser Spielstand enthält einen Fehler\", \"Fehlerhafter Spielstand!\", JOptionPane.WARNING_MESSAGE);\n System.exit(1);\n } else {\n strgTimer = new StrgTimer(this, new Date(date));\n timerS.scheduleAtFixedRate(strgTimer, 0, strgPause);\n }\n\n } catch (IOException ex) {\n System.err.println(\"Fehler beim Lesen der Datei!\");\n }\n }", "public void load(){\n Player temp;\n try{\n FileInputStream inputFile = new FileInputStream(\"./data.sec\");\n ObjectInputStream objectIn = new ObjectInputStream(inputFile);\n temp = (Player)objectIn.readObject();\n Arena.CUR_PLAYER = temp;\n objectIn.close();\n inputFile.close(); \n }\n catch(FileNotFoundException e ){\n System.err.print(\"data.sec not found\");\n }\n catch(IOException e){\n System.out.println(\"Error 201\");\n }\n catch(ClassNotFoundException e){\n System.out.println(\"Error 202\");\n }\n }", "private void load(Path fileName) throws IOException {\n try(BufferedReader reader = Files.newBufferedReader(fileName)) {\n String line = \"\";\n\n // Matches lines with the format:\n // key=value\n // where the key is any sequence of lowercase letters. (a to z)\n // where value may be any letters from a to z (case insensitive) 0 to 9 or the letters '-' and '.'.\n Pattern validLine = Pattern.compile(\"^(?<key>[a-z]+)=(?<value>[a-zA-Z0-9-.]+)$\");\n\n // Read the file line by line\n while((line = reader.readLine()) != null) {\n if(line.startsWith(\";\")) { // Ignore lines that start with ;\n continue;\n }\n\n // Remove any whitespace\n line = line.trim();\n\n // Continue if our line is empty\n if(\"\".equals(line)) {\n continue;\n }\n\n Matcher matcher = validLine.matcher(line);\n\n if(!matcher.matches() || matcher.groupCount() != 2) {\n System.err.println(\"Unable to parse line: \" + line);\n continue;\n }\n\n String key = matcher.group(\"key\");\n String value = matcher.group(\"value\");\n\n map.put(key, value);\n }\n }\n }", "@Test(expected = IllegalArgumentException.class)\n public void TestLoadErrorOne(){\n \tCountDownTimer s1 = new CountDownTimer(5, 59, 30);\n \t\n \ts1.load(\"file2\");\t\n }", "public void load(String filePath){\r\n File loadFile = new File(filePath);\r\n if (!loadFile.exists()){\r\n System.out.println(\"I failed. There are no saved games.\");\r\n return;\r\n }\r\n FileInputStream fis = null;\r\n ObjectInputStream in = null;\r\n try {\r\n fis = new FileInputStream(filePath);\r\n in = new ObjectInputStream(fis);\r\n long versionUID = (long) in.readObject();\r\n if (versionUID != this.serialVersionUID) {\r\n throw new UnsupportedClassVersionError(\"Version mismatch for save game!\");\r\n }\r\n this.p = (Character) in.readObject();\r\n this.map = (SpecialRoom[][]) in.readObject();\r\n\r\n } catch (FileNotFoundException ex){\r\n System.out.println(\"The saved game was not found!\");\r\n ex.printStackTrace();\r\n } catch (IOException ex) {\r\n System.out.println(\"There was an error reading your save game :(\");\r\n ex.printStackTrace();\r\n System.out.println(\")\");\r\n } catch (ClassNotFoundException ex) {\r\n System.out.println(\"The version of the save game is not compatible with this game!\");\r\n ex.printStackTrace();\r\n } catch (UnsupportedClassVersionError ex) {\r\n System.out.println(ex.getMessage());\r\n ex.printStackTrace();\r\n } catch (Exception ex) {\r\n System.out.println(\"An unknown error occurred!\");\r\n }\r\n\r\n }", "public abstract void load() throws IOException;", "@Override\n\tpublic Object load(String file) {\n\t\treturn null;\n\t}" ]
[ "0.71057314", "0.6176038", "0.6022164", "0.5732837", "0.5685404", "0.56670696", "0.55022866", "0.5469394", "0.5401758", "0.53991103", "0.5398615", "0.53931016", "0.5392613", "0.53297853", "0.53175575", "0.5312504", "0.5269253", "0.5260094", "0.5258074", "0.52481633", "0.524388", "0.5236135", "0.5207669", "0.51900023", "0.51784164", "0.5177288", "0.5158998", "0.5147073", "0.5126563", "0.5126388", "0.50987685", "0.50792146", "0.50711304", "0.5066736", "0.5065463", "0.5054877", "0.5040167", "0.50365686", "0.5023887", "0.5022126", "0.5021922", "0.5020766", "0.5019936", "0.5015609", "0.5014015", "0.5007301", "0.50060695", "0.5005334", "0.5004273", "0.4989622", "0.4984816", "0.4979428", "0.49768952", "0.49764872", "0.49704775", "0.49697256", "0.4964796", "0.49611896", "0.49544156", "0.4951328", "0.49380615", "0.49241796", "0.49076238", "0.49074206", "0.48975104", "0.48931357", "0.48875868", "0.48791355", "0.4844893", "0.48409155", "0.4840145", "0.48338872", "0.48294133", "0.48293012", "0.48246467", "0.48241606", "0.48184112", "0.48145863", "0.48082122", "0.47960576", "0.47938818", "0.47933942", "0.47925663", "0.47873983", "0.4782026", "0.47771007", "0.476902", "0.47630477", "0.4756105", "0.4752698", "0.4752698", "0.4748251", "0.4742475", "0.47405446", "0.47404242", "0.47360572", "0.4735284", "0.47316986", "0.47282028", "0.47230682" ]
0.63986313
1
Spring Data JPA repository for the LeLegalEntityTypes entity.
@SuppressWarnings("unused") @Repository public interface LeLegalEntityTypesRepository extends JpaRepository<LeLegalEntityTypes, Long> { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@SuppressWarnings(\"unused\")\n@Repository\npublic interface NonConformanceTypeRepository extends JpaRepository<NonConformanceType, Long> {\n\n}", "@Repository\npublic interface EnumTypeRepository extends BaseRepository<EnumTypeBean,Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface DsColumnTypesRepository extends JpaRepository<DsColumnTypes, Long>, JpaSpecificationExecutor<DsColumnTypes> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface DisabilityTypeRepository extends JpaRepository<DisabilityType, Long>, JpaSpecificationExecutor<DisabilityType> {\n}", "@Repository\r\npublic interface AccounterTypeService extends JpaRepository<AccounterType,Long>{\r\n AccounterType getByKind(String kind);\r\n}", "public interface SizeCostTypeRepository extends Repository<SizeCostType, Long> {\n}", "@Repository\npublic interface ClientTypeRepository extends JpaRepository<ClientType, Integer> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface DefItemRepository extends JpaRepository<DefItem, Long> {\n\n List<DefItem> findAllByTypeIdOrderByCode(Long typeId);\n\n List<DefItem> findAllByTypeCodeOrderByCode(EnmType enmType);\n\n\n}", "TypeRepository createTypeRepository();", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface DocumentRepository extends JpaRepository<Document, Long> {\n\n\tList<Document> findAllByTypeDocument(TypeDocument type);\n\n}", "public interface TypeRepositoryCustom extends JpaRepository<Type, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface PartnerTypeRepository extends JpaRepository<PartnerType, Long> {\n\n}", "public interface NodeTypeRepository extends CrudRepository<NodeType,Long> {\n}", "public interface LookupRepository extends JpaRepository<Lookup,Long> {\n\n @Query(value = \"select distinct discriminator from RULES_MANAGER.Lookup l\", nativeQuery = true)\n List<String> findAllTypes();\n\n @Query(value = \"select * from RULES_MANAGER.Lookup where discriminator = ?1 and reference_id = ?2 order by name\", nativeQuery = true)\n List<Lookup> findByTypeAndReferenceId(String type, Long referenceId);\n\n}", "public interface AdUnitDistrictRepository extends JpaRepository<AdUnitDistrict, Long> {\n\n \n}", "@Repository\npublic interface AlliesRepository extends CrudRepository<AlliesDO, Long> {\n\n}", "public interface MediaTypeRepository extends JpaRepository<MediaType, Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface PeopleRoleUserMappingRepository extends JpaRepository<PeopleRoleUserMapping,Long> {\n \n}", "public interface DlContTypeSetRepository extends JpaRepository<DlContTypeSet,Long> {\n\n @Query(\"select dlContTypeSet from DlContTypeSet dlContTypeSet where dlContTypeSet.name = :name\")\n Optional<DlContTypeSet> findOneByName(@Param(\"name\") String name);\n\n @Query(\"select dlContTypeSet from DlContTypeSet dlContTypeSet where dlContTypeSet.code = :code\")\n Optional<DlContTypeSet> findOneByCode(@Param(\"code\") String code);\n\n @Query(\"select dlContTypeSet from DlContTypeSet dlContTypeSet where dlContTypeSet.pStatus = 1 \")\n Page<DlContTypeSet> activecontenttypes(org.springframework.data.domain.Pageable pageable);\n\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface LevelRepository extends JpaRepository<Level,Long> {\n \n}", "@Repository\npublic interface DistrictCountryRepository extends JpaRepository<DistrictCountry, String> {\n}", "@Repository\npublic interface DistrictRepository extends JpaRepository<District, Long> {}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface ClassDurationRepository extends JpaRepository<ClassDuration, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface LevelDressageHisRepository extends JpaRepository<LevelDressageHis, Long> {\n\n}", "public interface StudyTypeRepository extends JpaRepository<StudyType,Long>{\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface AllergyRepository extends JpaRepository<Allergy, Long> {\n\n}", "@SuppressWarnings(\"unused\")\npublic interface DayOffTypeRepository extends JpaRepository<DayOffType,Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface HrmsActionDisciplinaryRepository extends JpaRepository<HrmsActionDisciplinary, Long> {\n\n}", "@Repository\npublic interface LandUriRepository extends CrudRepository<LandUri, Long>{\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface CaptureCollegeRepository extends JpaRepository<CaptureCollege, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface CategorieRessourcesRepository extends JpaRepository<CategorieRessources, Long> {\n}", "@Override\n public List<LoanTypes> getLoanTypes(){\n AbstractFactory aFactory = ProducerFactory.getProducer();\n LoanTypes aLoanType = aFactory.getLoaType();\n\n loanTypesRepository.findAll().forEach((x) -> {\n aLoanType.type = x.type;\n });\n\n List<LoanTypes> result = new ArrayList<>();\n result.add(aLoanType);\n return result;\n }", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface ListEffAxforceUcaseRepository extends JpaRepository<ListEffAxforceUcase, Long>, JpaSpecificationExecutor<ListEffAxforceUcase> {\n\n}", "@Repository\npublic interface ClClassificationSchemeConRepository extends AXBootJPAQueryDSLRepository<ClClassificationSchemeCon, ClClassificationSchemeCon.ClClassificationSchemeId>\n{\n\n}", "@SuppressWarnings(\"unused\")\npublic interface AllergyRepository extends JpaRepository<Allergy,String> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface ListingMailRepository extends JpaRepository<ListingMail, Long> {}", "public interface TypeQuestionRepository extends JpaRepository<TypeQuestion, Integer> {\n\n}", "@SuppressWarnings(\"unused\")\npublic interface TypeTrancheHoraireRepository extends JpaRepository<TypeTrancheHoraire,Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface OrganizationalUnitRepository extends JpaRepository<OrganizationalUnit, Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface AtApplicantsSchoolsRepository extends JpaRepository<AtApplicantsSchools, Long> {\n List<AtApplicantsSchools> findByIdApplicantId(Long id);\n AtApplicantsSchools findById(Long id);\n}", "public interface IssueCategoryRepository extends JpaRepository<IssueCategory,Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface SchemeRepository extends JpaRepository<Scheme,Long> {\n\n List<Scheme> findSchemeByDriver(Driver driver);\n\n}", "@Repository\npublic interface AhmsdttmMstclustypeDao extends JpaRepository<AhmsdttmMstclustype, Integer> {\n\n}", "@SuppressWarnings(\"unused\")\npublic interface EventTypeRepository extends JpaRepository<EventType,Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface WaPersonalAddressRepository extends JpaRepository<WaPersonalAddress, Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface EventLanguageRepository extends JpaRepository<EventLanguage, Long> {\n\t\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface RefGeoCommuneRepository extends JpaRepository<RefGeoCommune, Long> {\n}", "public interface SpecialityRepository extends CrudRepository<Speciality,Long> {\n\n}", "RepositoryType createRepositoryType();", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface OrganisationGroupsRepository extends JpaRepository<OrganisationGroups, Long> {\n\n}", "public interface RimWideRepository extends JpaRepository<RimWide, Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface RetencaoFonteRepository extends JpaRepository<RetencaoFonte, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\n@JaversSpringDataAuditable\npublic interface ReservoirCapacityRepository extends JpaRepository<ReservoirCapacity, Long> {\n\n}", "public interface AddressesRepository extends JpaRepository<Addresses,Long> {\n\n}", "public interface DeclarationTypeRefRepository extends JpaRepository<DeclarationTypeRef,Long> {\n\n List<DeclarationTypeRef> findAllByOrderByLabel();\n\n}", "@Repository\npublic interface CaseNoRepository extends JpaRepository<CaseNo, Long>{\n CaseNo findByCompanyId( long companyId);\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface HorarioDisponivelRepository extends JpaRepository<HorarioDisponivel, Long> {\n\n}", "public interface GoalRepository extends JpaRepository<Goal,Long> {\n\n}", "public interface DocketCodeRepository extends JpaRepository<DocketCode,Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface CsrpRepository extends JpaRepository<Csrp, Long> {\n\n}", "public interface HbzCostRepository extends BaseRepository<HbzCost, Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface CountriesRepository extends JpaRepository<Countries,Long> {\n \n}", "@Repository\npublic interface ProductCategoryRepository extends JpaRepository<ProductCategory, Integer> {\n List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList);\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface ContractDocumentEntryRowRepository extends JpaRepository<ContractDocumentEntryRow, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface ConfigAclRepository extends JpaRepository<ConfigAcl, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface PmCorMeasureStatesRepository extends JpaRepository<PmCorMeasureStates, Long> {\n PmCorMeasureStates findByCode(String code);\n\n}", "@Repository\npublic interface AuthorityRepository extends JpaRepository<Authority, String> {\n\n}", "public interface TariffRepository extends JpaRepository<Tariff, Long> {\n\n public Tariff findByName(TariffType name);\n\n public Tariff findByTariffId(Long tariffId);\n\n @Query(\"select t.name from Tariff t\")\n public List<TariffType> findAllNames();\n\n}", "public interface CurrencyRepository extends JpaRepository<Currency, Long> {\n\n}", "public interface RequirementRepository /*extends CrudRepository<Requirement, Long>*/ {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface MedicalRepository extends JpaRepository<Medical, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface LancheRepository extends JpaRepository<Lanche, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface SocialContactRepository extends JpaRepository<SocialContact, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface LocationsRepository extends JpaRepository<Locations, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface TauxMelangeRepository extends JpaRepository<TauxMelange, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface FestivalAllowancePaymentDtlRepository extends JpaRepository<FestivalAllowancePaymentDtl, Long>, JpaSpecificationExecutor<FestivalAllowancePaymentDtl> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface TipoObraRepository extends JpaRepository<TipoObra, Long> {\n}", "public interface AudienceRepository extends JpaRepository<Audience,Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface ChipsAdminRepository extends JpaRepository<ChipsAdmin, Long> {}", "@Repository\npublic interface AuthorityRepository extends JpaRepository<Authority, String>{\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface SlackAppRepository extends JpaRepository<SlackApp, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface FicheDeContactRepository extends JpaRepository<FicheDeContact, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface MaterialDeExameRepository extends JpaRepository<MaterialDeExame, Long> {\n}", "@RooJpaRepositoryCustom(entity = LoanItem.class)\npublic interface LoanItemRepositoryCustom {\n}", "public interface AdCreativeRespository extends JpaRepository<AdCreative,Long> {\n\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "public interface AuthorityRepository extends JpaRepository<Authority, String> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface DefAnswerRepository extends JpaRepository<DefAnswer, Long> {\n\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface MGuildRoulettePrizeRepository extends JpaRepository<MGuildRoulettePrize, Long>, JpaSpecificationExecutor<MGuildRoulettePrize> {\n\n}", "public interface GirosLinRepository extends JpaRepository<GirosLin,Long> {\n\n}", "@Repository\npublic interface InspectionOptionRepository extends JpaRepository<InspectionOption, Integer> {\n\n}", "public interface ShopperPersonRepository extends CrudRepository<ShopperPerson, Long> {\n}", "@SuppressWarnings(\"unused\")\n@Repository\npublic interface MunicipioRepository extends JpaRepository<Municipio, Long> {\n}", "@SuppressWarnings(\"unused\")\npublic interface AdresseRepository extends JpaRepository<Adresse,Long> {\n\n}" ]
[ "0.64948505", "0.64867127", "0.6361164", "0.6254648", "0.62381655", "0.61375034", "0.6125435", "0.6115796", "0.60981745", "0.6086434", "0.6069913", "0.60694987", "0.6040609", "0.599542", "0.5988133", "0.5931309", "0.589343", "0.5892162", "0.5891088", "0.58886695", "0.586387", "0.58413935", "0.58348316", "0.5832431", "0.58291453", "0.5821366", "0.58174086", "0.5811423", "0.57970417", "0.5787314", "0.5768567", "0.57515454", "0.57429147", "0.574096", "0.57350796", "0.57304895", "0.5727742", "0.572541", "0.5703367", "0.5690859", "0.5682584", "0.56674254", "0.56624335", "0.5660229", "0.5657546", "0.56563073", "0.5649648", "0.56476414", "0.5632143", "0.5625431", "0.5624162", "0.56200784", "0.5619194", "0.5610419", "0.5609462", "0.5606951", "0.5604633", "0.5598957", "0.55963373", "0.55898345", "0.5573068", "0.55673414", "0.556557", "0.55494857", "0.55494344", "0.5548811", "0.5545879", "0.5544148", "0.5543974", "0.554013", "0.55379575", "0.5536965", "0.55308825", "0.55298555", "0.5528599", "0.55285907", "0.5527703", "0.5523013", "0.5518179", "0.5515465", "0.5514723", "0.5510853", "0.5498556", "0.5497029", "0.54907167", "0.54907095", "0.54907095", "0.54907095", "0.54907095", "0.54907095", "0.54907095", "0.54907095", "0.54907095", "0.5490703", "0.549039", "0.5482444", "0.5481348", "0.54808813", "0.5474079", "0.54737" ]
0.7393279
0
interface: the size of output & nums is 4 & within 0~9; used[i] is initialized to false
private void backTrack(List<List<Integer>> output, List<Integer> curList, int[] nums, boolean[] used) { // base case: if (curList.size() == 4) { // assign the output output.add(new LinkedList(curList)); } else { // recursion for (int i = 0; i < 4; i++) { // cope with the duplicate if (used[i] || i > 0 && nums[i] == nums[i - 1] && !used[i - 1]) { continue; } used[i] = true; curList.add(nums[i]); // backTrack part backTrack(output, curList, nums, used); curList.remove(curList.size() - 1); used[i] = false; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) {\n\n pairsSum();\n\n printAllSubArrays();\n\n tripletZero();\n\n // int[][] sub = subsets();\n\n PairsSum sum = new PairsSum();\n int[] arr = { 10, 1, 2, 3, 4, 5, 6, 1 };\n boolean flag = sum.almostIncreasingSequence(arr);\n System.out.println(flag);\n\n String s = \"\";\n for (int i = 0; i < 100000; i++) {\n // s += \"CodefightsIsAwesome\";\n }\n long start = System.currentTimeMillis();\n // int k = subStr(s, \"IsA\");\n System.out.println(System.currentTimeMillis() - start);\n // System.out.println(k);\n\n String[] a = { \"aba\", \"aa\", \"ad\", \"vcd\", \"aba\" };\n String[] b = sum.allLongestStrings(a);\n System.out.println(Arrays.deepToString(b));\n\n List<String> al = new ArrayList<>();\n al.toArray();\n\n Map<Integer, Integer> map = new HashMap<>();\n Set<Integer> keySet = map.keySet();\n for (Integer integer : keySet) {\n\n }\n\n String st = reverseBracksStack(\"a(bc(de)f)g\");\n System.out.println(st);\n\n int[] A = { 1, 2, 3, 2, 2, 3, 3, 33 };\n int[] B = { 1, 2, 2, 2, 2, 3, 2, 33 };\n\n System.out.println(sum.isIPv4Address(\"2.2.34\"));\n\n Integer[] AR = { 5, 3, 6, 7, 9 };\n int h = sum.avoidObstacles(AR);\n System.out.println(h);\n\n int[][] image = { { 36, 0, 18, 9 }, { 27, 54, 9, 0 }, { 81, 63, 72, 45 } };\n int[][] im = { { 7, 4, 0, 1 }, { 5, 6, 2, 2 }, { 6, 10, 7, 8 }, { 1, 4, 2, 0 } };\n int[][] res = sum.boxBlur(im);\n\n for (int i = 0; i < res.length; i++) {\n for (int j = 0; j < res[0].length; j++) {\n System.out.print(res[i][j] + \" \");\n }\n System.out.println();\n }\n\n boolean[][] ms = { { true, false, false, true }, { false, false, true, false }, { true, true, false, true } };\n int[][] mines = sum.minesweeper(ms);\n for (int i = 0; i < mines.length; i++) {\n for (int j = 0; j < mines[0].length; j++) {\n System.out.print(mines[i][j] + \" \");\n }\n System.out.println();\n }\n\n System.out.println(sum.variableName(\"var_1__Int\"));\n\n System.out.println(sum.chessBoard());\n\n System.out.println(sum.depositProfit(100, 20, 170));\n\n String[] inputArray = { \"abc\", \"abx\", \"axx\", \"abx\", \"abc\" };\n System.out.println(sum.stringsRearrangement(inputArray));\n\n int[][] queens = { { 1, 1 }, { 3, 2 } };\n int[][] queries = { { 1, 1 }, { 0, 3 }, { 0, 4 }, { 3, 4 }, { 2, 0 }, { 4, 3 }, { 4, 0 } };\n boolean[] r = sum.queensUnderAttack(5, queens, queries);\n\n }", "public ArrayList<ArrayList<Integer>> fourSum(int[] num, int target) {\n int temp = 0;\n Arrays.sort(num);\n\n ArrayList<ArrayList<Integer>> a = new ArrayList<ArrayList<Integer>>();\n int [] s = new int [4];\n int total = 0;\n int current = -1;\n int i = 0;\n Arrays.fill(s, 0);\n HashMap<Long, Integer> m = new HashMap<Long, Integer>();\n \n \n if (num.length < 4) return a;\n \n while (i!=-1) {\n //increase the current pointer\n ++current;\n if (current > num.length-1) {\n --i;\n if (i >= 0) \n {\n current = s[i];\n total -= num[current];\n }\n }\n else if (total + num[current] > target || total + (4-i)*num[num.length-1] < target) {\n --i;\n if (i >= 0) \n {\n current = s[i];\n total -= num[current];\n }\n }\n else {\n //check if current number will work\n /*if (current == 0)\n {\n */\n if (i < 3) {s[i] = current; total += num[current]; ++i;}\n else if (num[current] + total == target) {\n //bingo one answer\n ArrayList<Integer> b = new ArrayList<Integer>();\n long c = num[s[0]]*num[s[1]]*num[s[2]]*num[current];\n long d = Math.abs((long)num[s[0]]*1000000000) \n + Math.abs((long)num[s[1]]*1000000)\n + Math.abs((long)num[s[2]]*1000)\n + Math.abs((long)num[current]);\n if (c < 0) d *= -1;\n if (!m.containsKey(d))\n {\n b.add(num[s[0]]);\n b.add(num[s[1]]);\n b.add(num[s[2]]);\n b.add(num[current]);\n a.add(b);\n m.put(d, 1);\n }\n }\n /*\n } \n else if (num[current] != num[current-1])\n {\n if (i < 2) {s[i] = current; total += num[current]; ++i;}\n else if (num[current] + total == 0) {\n //bingo one answer\n ArrayList<Integer> b = new ArrayList<Integer>();\n b.add(num[s[0]]);\n b.add(num[s[1]]);\n b.add(num[s[2]]);\n a.add(b);\n }\n }\n */\n }\n }\n return a;\n }", "public static int Main()\n\t{\n\t\tint[] num = new int[16];\n\t\tint i;\n\t\tint k;\n\t\tint j;\n\t\tint count;\n\t\tfor (;;) //????\n\t\t{\n\t\t\ti = -1; //?????i?count\n\t\t\tcount = 0;\n\t\t\tdo\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tnum[i] = Integer.parseInt(ConsoleInput.readToWhiteSpace(true));\n\t\t\t\tif (num[0] == -1) //?????????-1???\n\t\t\t\t{\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t} while (num[i] != 0); //????0??\n\t\t\tfor (j = 0 ; j <= i - 1 ; j++)\n\t\t\t{\n\t\t\t\tfor (k = j ; k <= i - 1 ; k++)\n\t\t\t\t{\n\t\t\t\t\tif ((num[j] == 2 * num[k]) || (num[j] * 2 == num[k])) //????\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++; //??\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.print(count);\n\t\t\tSystem.out.print(\"\\n\");\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tMain_001 obj=new Main_001();\n\t\tScanner scan=new Scanner(System.in);\n\t\tint total=scan.nextInt();\n\t\tint[] nums=new int[total];\n\t\tMap<Integer,Integer> map=new HashMap<Integer,Integer>();\n\t\tfor(int i=0;i<total;i++){\n\t\t\tnums[i]=scan.nextInt();\n\t\t\tif(obj.is_sushu(nums[i])){\n\t\t\t\tif(map.containsKey(nums[i])){\n\t\t\t\t\tmap.put(nums[i], map.get(nums[i])-1);\n\t\t\t\t}else\n\t\t\t\t\tmap.put(nums[i], -1);\n\t\t\t}\n\t\t\telse map.put(nums[i], 1);\n\t\t}\n\t\t\n\t\tfor(int i=0;i<total;i++){\n\t\t\tif(map.get(nums[i])!=1){\n\t\t\t\tif(map.get(nums[i])<-1){\n\t\t\t\t\tSystem.out.println(\"N\");\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int j=0;j<total;j++){\n\t\t\t\tif(j==i)\n\t\t\t\t\tcontinue;\n\t\t\t\tint tmp=0;\n\t\t\t\tif(nums[i]>nums[j])\n\t\t\t\t\ttmp=obj.gdc(nums[i], nums[j]);\n\t\t\t\telse tmp=obj.gdc(nums[j], nums[i]);\t\n\t\t\t\tif(tmp!=1){\n\t\t\t\t\tSystem.out.println(\"N\");\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"Y\");\n\t\tscan.close();\n\t}", "public static void main(String[] args) throws IOException {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tout = new PrintWriter(System.out);\r\n\t\tsc = new StringTokenizer(\"\");\r\n\t\twhile(true){\r\n\t\t\tn = nxtInt();\r\n\t\t\tif(n == 0)\r\n\t\t\t\tbreak;\r\n\t\t\tm = nxtInt();\r\n\t\t\tvis = new int[n];\r\n\t\t\tvisited = new boolean[n];\r\n\t\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\t\tgr[i] = new ArrayList<Integer>();\r\n\t\t\t\ttr[i] = new ArrayList<Integer>();\r\n\t\t\t\tvisited[i] = false;\r\n\t\t\t}\r\n\t\t\tint i = 0;\r\n\t\t\twhile(i < m){\r\n\t\t\t\tint f = nxtInt()-1;\r\n\t\t\t\tint to = nxtInt()-1;\r\n\t\t\t\tint p = nxtInt();\r\n\t\t\t\tgr[f].add(to);\r\n\t\t\t\ttr[to].add(f);\r\n\t\t\t\tif(p == 2){\r\n\t\t\t\t\tgr[to].add(f);\r\n\t\t\t\t\ttr[f].add(to);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif(check()){\r\n\t\t\t\tSystem.out.println(1);\r\n\t\t\t}else{\r\n\t\t\t\tSystem.out.println(0);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "public List<List<Integer>> fourSum_optimization(int[] nums, int target) {\n int len = nums.length;\n Arrays.sort(nums);\n if (len < 4)\n return Collections.emptyList();\n List<List<Integer>> arr = new ArrayList<>();\n\n for (int i = 0; i < len - 1; i++) {\n for (int j = i + 1; j < len - 1; j++) {\n int Left = j + 1;\n int Right = len - 1;\n int left_target_sum = target - nums[i] + nums[j];\n\n while (Left < Right) {\n int two_sum = nums[Left] + nums[Right];\n if (two_sum < left_target_sum)\n Left++;\n else if (two_sum > left_target_sum)\n Right--;\n else {\n List<Integer> arr2 = new ArrayList<>();\n if (left_target_sum + two_sum == target) {\n arr2.add(nums[i]);\n arr2.add(nums[j]);\n arr2.add(nums[Left]);\n arr2.add(nums[Right]);\n arr.add(arr2);\n }\n while (Left < Right && nums[Left] == arr2.get(2))\n ++Left;\n while (Left < Right && nums[Right] == arr2.get(3))\n --Right;\n }\n }\n while (i + 1 < len && nums[i + 1] == nums[i])\n ++i;\n while (j + 1 < len && nums[j + 1] == nums[j])\n ++j;\n }\n }\n\n return arr;\n }", "public List<List<Integer>> fourSum(int[] nums, int target) {\n\t\tList<List<Integer>> result = new ArrayList<List<Integer>>();\n\t\tif (nums == null || nums.length < 4) return result;\n\n\t\tArrays.sort(nums);\n\n\t\tfor (int w = 0; w < nums.length - 3; w++) { // < size - 3\n\t\t\tif (w == 0 || nums[w] != nums[w - 1]) {\n\t\t\t\tfor (int i = w + 1; i < nums.length - 2; i++) { // < size - 2\n\t\t\t\t\t// Enter in first iteration or no duplication.\n\t\t\t\t\tif (i == w + 1 || nums[i] != nums[i - 1]) { \n\t\t\t\t\t\tint j = i + 1;\n\t\t\t\t\t\tint k = nums.length - 1;\n\n\t\t\t\t\t\twhile (j < k) {\n\n\t\t\t\t\t\t\tif (nums[w] + nums[i] + nums[j] + nums[k] == target) {\n\t\t\t\t\t\t\t\tList<Integer> list = new ArrayList<Integer>();\n\t\t\t\t\t\t\t\tlist.add(nums[w]);\n\t\t\t\t\t\t\t\tlist.add(nums[i]);\n\t\t\t\t\t\t\t\tlist.add(nums[j]);\n\t\t\t\t\t\t\t\tlist.add(nums[k]);\n\n\t\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t\t\tk--;\n\n\t\t\t\t\t\t\t\twhile (j < k && nums[j] == nums[j - 1])\n\t\t\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t\t\twhile (j < k && nums[k] == nums[k + 1])\n\t\t\t\t\t\t\t\t\tk--;\n\n\t\t\t\t\t\t\t\tresult.add(list);\n\t\t\t\t\t\t\t} else if (nums[w] + nums[i] + nums[j] + nums[k] < target) {\n\t\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t\t} else { // >.\n\t\t\t\t\t\t\t\tk--;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "public static void main(String[] args){\n\n String [] myStings = { \"N\", \"10*N\", \"100*N\", \"1000*N\" };\n\n int [][][][][] myNumbers = {{},{},{},{},{} }; \n\n for (String i : myStings){\n\n System.out.println(i);\n }\n\n // System.out.println(\"N \\n\" ); \n for(int a = 1; a <= 1000; a = a*10){\n\n \n for(int b = 2; b <= 2000; b = b *10){\n\n \n for(int c = 3; c <= 3000; c = c *10){\n \n \n for(int d = 4; d <= 4000; d = d *10){\n \n \n for(int e = 5; e <= 5000; e = e *10){\n\n \n }\n \n }\n \n }\n \n }\n\n }\n\n \n\n////////////////////////////////////////////\n\n /** //\n\n\n String [] myStings = { \"N\", \"10*N\", \"100*N\", \"1000*N\" };\n\n for (String i : myStings){\n\n System.out.println(i);\n }\n\n System.out.println(\"N \\t\"+\"10*N \\t\"+\"100*n \\t\"+\"1000*N\");\n\n // System.out.println(\"N \\n\" );\n for(int a = 1; a <= 1000; a = a*10){\n \n System.out.println(a);\n\n }\n\n\n // System.out.println(\"10*N \\n\" );\n for(int b = 2; b <= 2000; b = b *10){\n\n System.out.println(b);\n\n }\n\n \n // System.out.println(\"10*N \\n\" );\n for(int c = 3; c <= 3000; c = c *10){\n\n System.out.println(c);\n\n }\n\n\n // System.out.println(\"100*N \\n\" );\n for(int d = 4; d <= 4000; d = d *10){\n\n System.out.println(d);\n\n }\n \n\n // System.out.println(\"1000*N \\n\" );\n for(int e = 5; e <= 5000; e = e *10){\n\n System.out.println(e);\n\n }\n */\n \n//////////////////////////\n /** \n \n System.out.println(\"N \\n\" ); \n\n for(int x = 1; x <= 5; x++){\n\n System.out.println(x);\n\n }\n\n System.out.println(\"10*N \\n\" );\n for(int y = 10; y <= 50; y = y + 10){\n\n System.out.println(y);\n\n }\n\n System.out.println(\"100*N \\n\" );\n for(int z = 100; z <= 500; z = z + 100){\n\n System.out.println(z);\n\n }\n \n System.out.println(\"1000*N \\n\" );\n for(int q = 1000; q <= 5000; q = q + 1000){\n\n System.out.println(q);\n\n } \n \n\n String [] myNumbers = { \"N\", \"N*10\", \"N*100\", \"N*1000\" };\n\n\n for(String x : myNumbers ){\n\n System.out.println(x + \"\\t\");\n\n\n for(int y = 10; y <= 50; y = y + 10){\n\n System.out.println(y);\n \n }\n\n \n \n }\n*/\n\n////////////////////////////\n /** \n\n int [][][][] myNumbers = { {}, {}, {}, {} };\n\n for(int x = 1; x <= 5; x++){\n\n System.out.println(x +\"\\n\");\n \n for(int y = 10; y <= 50; y = y + 10){\n\n System.out.println( y +\"\\t\");\n \n for(int z = 100; z <= 500; z = z + 100){\n\n System.out.println( z +\"\\t\");\n\n \n for(int q = 1000; q <= 5000; q = q + 1000){\n\n // System.out.println( myNumbers[x][y][z][q]);\n\n // System.out.println( q +\"\\n\");\n \n } \n \n // System.out.println( z +\"\\t\");\n \n }\n \n // System.out.println( y +\"\\t\");\n \n }\n\n // System.out.println(x +\"\\t\");\n }\n*/\n \n\n////////////////////////////////////\n\n\n // System.out.println(x +\"\\t\" + y+\"\\t\" + z +\"\\t\" + q); \n\n /** // System.out.println(x +\"\\t\" + y+\"\\t\" + z +\"\\t\" + q +\"\\n\");\n\n\n int [][][][] myNumbers = { {1,2,3,4,5}, {10, 20, 30, 40, 50}, {100, 200, 300, 400, 500}, {1000, 2000, 3000, 4000, 5000} };\n \n for(int x = 1; x <= myNumbers.length; ++x){\n\n // System.out.println(myNumbers[x] +\"\\n\");\n \n for(int y = 10; y <= myNumbers.length; ++y){\n\n // System.out.println( myNumbers[][y] +\"\\t\");\n \n for(int z = 100; z <= myNumbers.length; ++z){\n\n // System.out.println( myNumbers[][][z] +\"\\t\");\n\n \n for(int q = 1000; q <= myNumbers.length; ++q){\n\n System.out.println( myNumbers[x][y][z][q]);\n } \n \n \n }\n \n \n }\n\n \n }\n\n */\n }", "public StandardSolution (long[] nums){\n \t\tsequence = nums;\n \t\tpartitions = new boolean[sequence.length];\n \t\t\n \t\tRandom rand = new Random();\n \t\tfor (int i = 0; i < partitions.length; i++){\n \t\t\t// worry about seeing?\n \t\t\tpartitions[i] = rand.nextBoolean();\n \t\t}\n \t}", "public List<List<Integer>> fourSum_1(int[] nums, int target) \n {\n \tList<List<Integer>> result = new ArrayList<List<Integer>>();\n \tif(nums==null || nums.length<4) return result;\n \tArrays.sort(nums);\n \tfor(int i=0; i<nums.length-3; i++)\n \t{\n \t\tif(i!=0 && nums[i]==nums[i-1]) continue;\n \t\t//if(nums[i]>target) break; \n \t\t//Revisit!!! Why you cannot do this break here\n \t\tfor(int j=i+1; j<nums.length-2;j++)\n \t\t{\n \t\t\tif(j!=(i+1) && nums[j]==nums[j-1]) continue;\n \t\t\tint cur = nums[i]+nums[j];\n \t\t\t//if(cur>target) break;\n \t\t\t//Revisit!!! Why you cannot do this break here\n \t\t\t\n \t\t\tint k=j+1;\n \t\t\tint l = nums.length-1;\n \t\t\twhile(k<l)\n \t\t\t{\n \t\t\t\tif((cur+nums[k]+nums[l])==target)\n \t\t\t\t{\n \t\t\t\t\tList<Integer> newRes = new ArrayList<Integer>();\n \t\t\t\t\tnewRes.add(nums[i]);\n \t\t\t\t\tnewRes.add(nums[j]);\n \t\t\t\t\tnewRes.add(nums[k]);\n \t\t\t\t\tnewRes.add(nums[l]);\n \t\t\t\t\tresult.add(newRes);\n \t\t\t\t\tk++;\n \t\t\t\t\tl--;\n \t\t\t\t\twhile(k<l && nums[k]==nums[k-1]) k++;\n \t\t\t\t\twhile(k<l && nums[l]==nums[l+1]) l--;\n \t\t\t\t}\n \t\t\t\telse if((cur+nums[k]+nums[l])>target)\n \t\t\t\t{\n \t\t\t\t\tl--;\n \t\t\t\t\twhile(k<l && nums[l]==nums[l+1]) l--;\n \t\t\t\t}\n \t\t\t\telse\n \t\t\t\t{\n \t\t\t\t\tk++;\n \t\t\t\t\twhile(k<l && nums[k]==nums[k-1]) k++;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t}\n \treturn result;\n }", "public static void main(String[] args) throws IOException {\n\t\tbr = new BufferedReader(new FileReader(new File(\"input.txt\")));\r\n\t\tSystem.setOut(new PrintStream(new File(\"output.txt\")));\r\n\t\tint T = readInt();\r\n\t\t\r\n\t\tfor (int ind = 1; ind<=T; ind++) {\r\n\t\t\tSystem.out.print(\"Case #\" + ind + \": \");\r\n\t\t\t\r\n\t\t\tint N = readInt();\r\n\t\t\tint[] ar = readIntArr();\r\n\t\t\tfor (int i = 0; i < N; i++)ar[i]--;\r\n\t\t\tboolean used[] = new boolean[N];\r\n\t\t\tint ans = 0;\r\n\t\t\tint pairMax = 0;\r\n\t\t\tint cycleMax = 0;\r\n\t\t\tint cyclePair = 0;\r\n\t\t\tint pair = 0;\r\n\t\t\tfor (int i = 0; i < N; i++) {\r\n\t\t\t\tif (!used[i]) {\r\n\t\t\t\t\tList<Integer> list = new LinkedList<Integer>();\r\n\t\t\t\t\tlist.add(i);\r\n\t\t\t\t\tused[i] = true;\r\n\t\t\t\t\tint j = ar[i];\r\n\t\t\t\t\twhile(!list.contains(j) && !used[j]) {\r\n\t\t\t\t\t\tlist.add(j);\r\n\t\t\t\t\t\tused[j] = true;\r\n\t\t\t\t\t\tj = ar[j];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!list.contains(j))continue;\r\n\t\t\t\t\tif (list.size() == 2)pair++;\r\n\t\t\t\t\tboolean removed = false;\r\n\t\t\t\t\twhile(list.get(0) != j){list.remove(0);removed = true;}\r\n\t\t\t\t\tif (list.size() > 2 && list.size() > cycleMax) cycleMax = list.size();\r\n\t\t\t\t\tif (list.size() == 2) {\r\n\t\t\t\t\t\tint a = list.remove(0);\r\n\t\t\t\t\t\tint b = list.remove(0);\r\n\t\t\t\t\t\tint tmp = 2;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tboolean us[] = new boolean[N];\r\n\t\t\t\t\t\t\tus[a] = true;\r\n\t\t\t\t\t\t\tus[b] = true;\r\n\t\t\t\t\t\t\t//System.out.println(\" test \" + a + b);\r\n\t\t\t\t\t\t\tSet<Integer> set = new HashSet<Integer>();\r\n\t\t\t\t\t\t\tset.add(a);\r\n\t\t\t\t\t\t\twhile (true) {\r\n\t\t\t\t\t\t\t\tboolean found = false;\r\n\t\t\t\t\t\t\t\tSet<Integer> tSet = new HashSet<Integer>();\r\n\t\t\t\t\t\t\t\tfor (int ii = 0; ii < N; ii++) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tif (!us[ii] && set.contains(ar[ii])) {\r\n\t\t\t\t\t\t\t\t\t\tus[ii] = true;\r\n\t\t\t\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t\t\t\t\ttSet.add(ii);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (found)tmp++;\r\n\t\t\t\t\t\t\t\tif (!found)break;\r\n\t\t\t\t\t\t\t\tset.addAll(tSet);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tset = new HashSet<Integer>();\r\n\t\t\t\t\t\t\tset.add(b);\r\n\t\t\t\t\t\t\twhile (true) {\r\n\t\t\t\t\t\t\t\tboolean found = false;\r\n\t\t\t\t\t\t\t\tSet<Integer> tSet = new HashSet<Integer>();\r\n\t\t\t\t\t\t\t\tfor (int ii = 0; ii < N; ii++) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tif (!us[ii] && set.contains(ar[ii])) {\r\n\t\t\t\t\t\t\t\t\t\tus[ii] = true;\r\n\t\t\t\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t\t\t\t\ttSet.add(ii);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif(found)tmp++;\r\n\t\t\t\t\t\t\t\tif (!found)break;\r\n\t\t\t\t\t\t\t\tset.addAll(tSet);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//if (removed) {\r\n\t\t\t\t\t\t//\tif (tmp > cyclePair)cyclePair = tmp;\r\n\t\t\t\t\t\t//} else {\r\n\t\t\t\t\t\t pairMax += tmp;\r\n\t\t\t\t\t\t//}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//cyclePair += 2 * pair;\r\n\t\t\t//if (pair > 1) pairMax += 2 * (pair - 1);\r\n\t\t\tans = Math.max(cyclePair, pairMax);\r\n\t\t\tans = Math.max(cycleMax, ans);\r\n\t\t\tSystem.out.println(ans);\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\r\n\t}", "public static void main(String[] args) {\n Scanner kb = new Scanner(System.in);\n\n\n // Establish contact with user and the premise\n // Then, determine who the user is\n String userName;\n System.out.println(\"Hi, there! I need your help to do my homework. But, where are my manners, who am I speaking too?\");\n System.out.print(\"Your name: \");\n userName = kb.nextLine();\n System.out.println(\"Awesome. Hey, \" + userName + \" , I hope you are well, and thank you for agreeing to help. Let's begin!\");\n\n // ask for 5 numbers\n System.out.println(\"For homework, I need to run some tests on numbers. Can you give me five numbers?\");\n\n\n\n // All in one for loop #2\n int[] intArrayLoop = new int[5];\n int intSum = 0;\n int intProd = 1;\n// int scroll = 0;\n int maxNum = 0;\n int minNum = 1000000; // please someone tell me a better way to do this lmao\n // keep in mind, collections.max isn't an option in this case\n\n for (int i = 0; i < intArrayLoop.length; i++) {\n intArrayLoop[i] = kb.nextInt();\n }\n// for (int i = 0; i < intArrayLoop.length; i++) {\n// if(intArrayLoop[i] == intSum) {\n// scroll++;\n// }\n// }\n for (int ints : intArrayLoop) {\n intSum = intSum + ints;\n }\n for (int ints : intArrayLoop) {\n intProd = intProd * ints;\n }\n for (int ints : intArrayLoop) {\n if (ints > maxNum) {\n maxNum = ints;\n }\n }\n for (int ints : intArrayLoop) {\n if (ints < minNum) {\n minNum = ints;\n }\n }\n\n //Number call\n System.out.println(\"So, your sum should be: \" +intSum);\n System.out.println(\"Also, your product should be: \" +intProd);\n System.out.println(\"Hopefully max num: \" + maxNum);\n System.out.println(\"Hopefully min num: \" + minNum);\n\n // Car call\n HashMap<String, String> availableCars = CarMap.initCarStock();\n CarMap.customerQuery(availableCars);\n\n\n\n\n\n\n\n\n }", "int sizeOfScansArray();", "public List<List<Integer>> combinationSum2BetterMemory(int[] nums, int target) {\n List<List<Integer>> list = new ArrayList<>();\n Arrays.sort(nums);\n backtrack(list, new ArrayList<>(), nums, target, 0);\n return list;\n\n }", "public static void main(String[] args) {\n\t\tSystem.out.println(3423);\n\t\t\n\t\tlong startTime = System.nanoTime();\n\t\t\n\t\t\n\t\t\n\t\tlong [ ] nums = new long[Integer.MAX_VALUE >>5];\n\t\tfor (int i=0; i<nums.length; i++) {\n\t\t\tnums[i] = System.nanoTime();\n\t\t}\n\t\tfor (int i=0; i<nums.length; i++) {\n\t\t System.out.println(\tnums[i] );\n\t\t} \n\t\t\n\t\t\n\t\tlong endTime = System.nanoTime();\n\t\tSystem.out.println(\"Took \"+((double)(endTime - startTime)/1000/1000/1000) + \"s\");\n\t\tstartTime = System.nanoTime();\n\t\t\n\t\t\n\t\tint [ ] nums2 = new int[Integer.MAX_VALUE >> 5];\n\t//\tfor (int x: nums2) {System.out.println(x);}\n\t\t\n\t\t\n\t\tendTime = System.nanoTime();\n\t\tSystem.out.println(\"Took \"+((double)(endTime - startTime)/1000/1000/1000) + \"s\");\n\t\t\n\t\t\n\n\t}", "public static void main(String[] arrr){\n\t\tlong mod = 10000000011L;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tarr[i]=sc.nextInt();\n\t\t}\n\t\tlong total=0;\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\ttotal = (total+((long)Math.pow((countBit(arr[i])),(i+1))%mod))%mod;\n\t\t}\n\t\tSystem.out.println(total);\n\t}", "public static void main(String[] args) {\n\t\tint[] arr= {6,9,5,7,4};\r\n\t\t//int[] arr= {3,9,9,3,5,7,2};\r\n\t\t//int[] arr= {1,5,3,6,7,6,5};\r\n\t\tint[] tmp=solution(arr);\r\n\t\tfor(int i=0;i<tmp.length;i++)\r\n\t\t\tSystem.out.print(tmp[i]+\" \");\r\n\t}", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n//\t\tT = sc.nextInt();\n\t\tNN = sc.nextInt();\n\t\t\n\t\tfor(int i=1;i<=NN;i++){\n\t\t\tif(i==1000){\n\t\t\t\tSystem.out.print(i);\n\t\t\t}else{\n\t\t\t\t//\n\t\t\t\tarr = new int[3];\n//\t\t\t\tarr[0] = i/100;\t\t//100의 자리\n//\t\t\t\tarr[1] = i/10;\t\t//10의자리\n//\t\t\t\tarr[2] = i%100;\t\t//1의자리\n\t\t\t\tint N = 0;\n\t\t\t\tif(i>=0&&i<10){\n\t\t\t\t\tN=1;\n\t\t\t\t\tarr[0] = i;\n\t\t\t\t}else if(i>=10&&i<100){\n\t\t\t\t\tN=2;\n\t\t\t\t\tarr[1] = i%10;\n\t\t\t\t\tarr[0] = i/10;\n\t\t\t\t}else if(i>=100&&i<1000){\n\t\t\t\t\tN=3;\n\t\t\t\t\tarr[2] = (i%100)%10;\n\t\t\t\t\tarr[1] = (i%100)/10;\n\t\t\t\t\tarr[0] = i/100;\n\t\t\t\t}\n\t\t\t\tString ot = \"\";\n\t\t\t\tint state = 0;\n\t\t\t\tboolean flag = true;\n\t\t\t\t\n\t\t\t\tfor(int j=0;j<N;j++){\n\t\t\t\t\tif(arr[j]==3||arr[j]==6||arr[j]==9){\n\t\t\t\t\t\tot = ot+\"-\";\n\t\t\t\t\t\tflag = false;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tot = ot + arr[j];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(ot.equals(\"--\")||ot.equals(\"--=\")){\n\t\t\t\t\tSystem.out.print(ot);\n\t\t\t\t}else{\n\t\t\t\t\tif(!flag){\n\t\t\t\t\t\tSystem.out.print(\"-\");\n\t\t\t\t\t}else{\n\t\t\t\t\t\tSystem.out.print(ot);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(i!=(NN)){\n\t\t\t\t\tSystem.out.print(\" \");\n\t\t\t\t}else{\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n//\t\tfor(int t=0;t<T;t++){\n//\t\t\tarr = new int[10];\n//\t\t\tint MAX = 0;\n//\t\t\tfor(int i=0;i<10;i++){\n//\t\t\t\tarr[i] = sc.nextInt();\n//\t\t\t}\n//\t\t\tfor(int i=0;i<10;i++){\n//\t\t\t\tif(arr[i]%2==1){\n//\t\t\t\t\tMAX = MAX+arr[i];\n//\t\t\t\t}\n//\t\t\t}\t\t\t\n//\t\t\t\n//\t\t\tSystem.out.println(\"#\"+(t+1)+\" \"+MAX);\n//\t\t}\n\t}", "void solve() {\n num = new ArrayList<>();\n num.add(BigInteger.valueOf(4));\n for (int len = 2; len <= 100; len++)\n generate(\"4\", 1, len, false);\n Collections.sort(num);\n for (int tc = ii(); tc > 0; tc--) {\n long x = il();\n BigInteger X = BigInteger.valueOf(x);\n for (int i = 0; i < num.size(); i++) {\n if (num.get(i).mod(X).equals(BigInteger.ZERO)) {\n String z = num.get(i).toString();\n int end = z.lastIndexOf('4');\n int len = z.length();\n int a = 2 * (end+1);\n int b = len - end;\n out.println(a + b);\n break;\n }\n }\n }\n }", "public List<List<Integer>> fourSum_LeetCode(int[] nums, int target) {\n \tList<List<Integer>> res = new ArrayList<List<Integer>>();\n \tint len = nums.length;\n \tif(len < 4)\n \t return res;\n \t\n //Using the hashMap to store sum and corresponding 2 elements\n \tHashMap<Integer, Index> h = new HashMap<Integer, Index>();\n \t\n \tfor(int i = 0; i < len-1; i++) {\n \t\tfor(int j = i+1; j < len; j++) {\n \t\t\tint sum = nums[i] + nums[j];\n \t\t\tif(h.containsKey(target-sum)) {\n \t\t\t\t//then get the elements of the existing sum stored in hashmap\n \t\t\t\tIndex indx = h.get(target-sum);\n \t\t\t\tint exI = indx.getI();\n \t\t\t\tint exJ = indx.getJ();\n \t\t\t\tif(res.size() == 0) {\n \t\t\t\t\tList<Integer> l = new ArrayList<Integer>();\n\t \t\t\t\tl.add(exI);\n\t \t\t\t\tl.add(exJ);\n\t \t\t\t\tl.add(nums[i]);\n\t \t\t\t\tl.add(nums[j]);\n\t \t\t\t\tCollections.sort(l);\n\t \t\t\t\tres.add(l);\n \t\t\t\t} else {\n\t \t\t\t\tif((exI != nums[i]) && (exJ != nums[j])) {\n\t \t\t\t\t\tList<Integer> l = new ArrayList<Integer>();\n\t\t \t\t\t\tl.add(exI);\n\t\t \t\t\t\tl.add(exJ);\n\t\t \t\t\t\tl.add(nums[i]);\n\t\t \t\t\t\tl.add(nums[j]);\n\n\t\t \t\t\t\tCollections.sort(l);\n\t\t \t\t\t\tfor(List<Integer> ll : res) {\n\t\t \t\t\t\t\tif(!ll.equals(l))\n\t\t \t\t\t\t\t\tres.add(l);\n\t\t \t\t\t\t}\n\t\t \t\t\t\t\n\t \t\t\t\t}\n \t\t\t\t}\n \t\t\t} else\n \t\t\t\th.put(sum, new Index(nums[i], nums[j]));\n \t\t}\n \t}\n \treturn res;\n }", "private void discretization(int[] nums) {\n\t\tint[] sorted = nums.clone();\n\t\tArrays.sort(sorted);\n\t\tfor (int i = 0; i < nums.length; i++) {\n\t\t\tnums[i] = Arrays.binarySearch(sorted, nums[i]);\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tint nums[] = {-7,-3,2,3,11};\n\t\tint temp = 0;\n\t\tint output[] = new int [nums.length] ;\n\t\t\n\t\tfor(int i = 0 ; i < nums.length; i++) {\n\t\t\ttemp = nums[i] * nums[i]; \n\t\t\toutput[i] = temp;\n\t\t\t\n\t\t}\n\t\tArrays.sort(output);\n\t\t\n\t\n\tfor(int i = 0; i < output.length; i++) {\n\t\tSystem.out.println(output[i]);\n\t}\n\n}", "public static void main(String[] args) {\n\t\tArrays.fill(arr, 1);\n\t\tlong startTime = System.nanoTime();\n\t\t// Traverse till square root of MAX\n\t\t// Using logic similar to sieve of eratosthenes to\n\t\t// populate factor sum array\n\t\tint limit = (int)Math.sqrt(MAX);\n\t\tfor (int i = 2; i <= limit; ++i) {\n\t\t\tint j = i+i;\n\t\t\tint count = 2;\n\t\t\twhile (j <= MAX){\n\t\t\t\t// As we already add count (j/i) to the factor sum when adding i,\n\t\t\t\t// we don't add when i is equal to or greater than count\n\t\t\t\tif (i < count) {\n\t\t\t\t\t// Adding i and count (j/i) to the factor sum of j\n\t\t\t\t\tarr[j] += i;\n\t\t\t\t\tarr[j] += count;\n\t\t\t\t}\n\t\t\t\tj += i;\n\t\t\t\tcount++;\n\t\t\t} \n\t\t}\n\t\t\n\t\tint count = 0;\n\t\tSystem.out.println(\"The following are amicable numbers\");\n\t\tfor (int i = 2; i <= MAX; ++i) {\n\t\t\tint num = arr[i];\n\t\t\tif (num <= MAX && num > i) {\n\t\t\t\tif (arr[num] == i) {\n\t\t\t\t\tSystem.out.println(count+\": \"+i+\" and \"+num);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong endTime = System.nanoTime();\n\t\tdouble duration = timeInSec(endTime,startTime) ;\n\t\tSystem.out.println(\"Run time \" + duration + \" : secs\");\t\t\n\t}", "public List<List<Integer>> fourSum(int[] nums, int target) {\n HashSet<List<Integer>> set = new HashSet<>();\n Arrays.sort(nums);\n if (nums.length < 4)\n Collections.emptyList();\n for (int i = 0; i < nums.length - 1; i++) {\n for (int j = i + 1; j < nums.length - 1; j++) {\n\n int mid = j + 1;\n int high = nums.length - 1;\n\n while (mid < high) {\n int sum = nums[i] + nums[j] + nums[mid] + nums[high];\n if (sum == target) {\n List<Integer> arr2 = new ArrayList<>();\n arr2.add(nums[i]);\n arr2.add(nums[j]);\n arr2.add(nums[mid]);\n arr2.add(nums[high]);\n set.add(arr2);\n }\n if (sum < target)\n mid++;\n else\n high--;\n }\n }\n\n }\n // return new ArrayList(set);\n return Collections.emptyList();\n }", "public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int T = scanner.nextInt();\n assert T >=1;\n assert T<=100000;\n long []numArr = new long[T];\n for(int i=0; i<T; i++) {\n numArr[i] = scanner.nextLong ();\n assert numArr[i]>=1;\n assert numArr[i]<=1000000000;\n }\n\n for (long num : numArr) {\n int i=1;\n long sum=0;\n while(i*3<num) {\n sum +=i*3;\n if(i*5<num && i%3!=0)\n sum +=i*5;\n i++;\n }\n System.out.println(sum);\n }\n }", "public static void main(String args[]) throws IOException\n { \n int a[] = {1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}; \n int miss = getMissingNo(a,4); \n System.out.println(miss); \n \n BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n\t int t = Integer.parseInt(br.readLine()); \n\t while(t!=0)\n\t {\n\t t--;\n\t int nn=Integer.parseInt(br.readLine()); \n\t int n=nn-1;\n\t int arr[]=new int[n];\n\t \n \n // to read multiple integers line \n String line = br.readLine(); \n String[] strs = line.trim().split(\"\\\\s+\"); \n \n // array elements input \n for (int i = 0; i < n; i++) \n arr[i] = Integer.parseInt(strs[i]); \n\t \n\t \n\t int x1=arr[0];\n\t int x2=1;\n\t /* For xor of all the elements \n in array */\n\t for (int i = 1; i <= n; i++) {\n if(i != n)\n x1 = x1 ^ arr[i]; \n x2 = x2 ^ (i+1); \n \n }\n\t /*XOR of X1 and X2 gives the missing number */\n\t System.out.println(x1^x2);\n\t \n\t }\n\t }", "public static void main(String[] args) {\n int[] inputSize={100000,300000,500000,700000,900000,1100000,1300000,1500000,1700000,1900000,};\n for (int i = 0; i < inputSize.length; i++) {\n System.out.println(\"for array of size \"+inputSize[i]);\n pass(inputSize[i]);\n System.out.println(\"************************************************\");\n \n }\n \n //result list \n System.out.println(\"The result running time (in milli second) for the size inputs: \\n100k,300k,300k,500k,700k,900k,1.1M, 1.3M, 1.5M, 1.7M, 1.9M\");\n System.out.print(\"Insertion Sort: \");\n for(Long a: insertionList )\n {\n System.out.print( a +\" \");\n }\n System.out.print(\"\\nMerge Sort: \");\n \n for(Long b: mergeList )\n {\n System.out.print( b +\" \");\n }\n System.out.print(\"\\nQuick Sort: \");\n for(Long c: quickList )\n {\n System.out.print( c +\" \");\n }\n System.out.println(\"\");\n \n \n // printArray(arr); \n }", "@Override\r\n public long problem2() {\r\n ArrayList<String> arrList = new ArrayList<>();\r\n long start = System.currentTimeMillis(); \r\n for(int i = 0; i<1234567; i++){\r\n arrList.add(Integer.toString(i));\r\n }\r\n long end = System.currentTimeMillis(); \r\n return end - start; \r\n }", "public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tSystem.out.println(\"enter number of elements to add in the array\");\n\t\tint size = sc.nextInt();\n\t\tint[] array = new int[size];\n\t\tSystem.out.println(\"enter elements to add in the array\");\n\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tSystem.out.println();\n\t\tint count = 0;\n\t\tfor (int i = 0; i < array.length - 2; i++) {\n\t\t\tfor (int j = i + 1; j < array.length - 1; j++) {\n\t\t\t\tfor (int k = i + 2; k < array.length; k++) {\n\t\t\t\t\tif (array[i] + array[j] + array[k] == 0) {\n\t\t\t\t\t\tSystem.out.println(array[i] + \" \" + array[j] + \" \" + array[k]);\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"found \" + count + \" triplets that add up to zero\");\n\n\t}", "static int missingNumber(int[] nums) {\n int ret = 0;\n for(int i = 0; i < nums.length; i++) {\n ret ^= i;\n ret ^= nums[i];\n }\n return ret^=nums.length;\n }", "public int[] solver(int startPlayerId, int curplayer, int[][] oneP, int[][][] memory, int count) {\n\r\n int[][] one = oneP.clone(); // OnePlay Input\r\n int[] k; // onePlay points\r\n int j = curplayer;\r\n int[][][] m = memory.clone();\r\n int[] minCard = new int[3];\r\n int[] t;\r\n ArrayList<int[]> store = new ArrayList<>();\r\n minCard[2] = 100000;\r\n t = new int[3];\r\n for (int i = 0; i < 4; i++) { // 4 types of cards\r\n for (int l = 2; l < cardPerPlayer + 2; l++) {\r\n if (m[j][i][l] == 1 || m[j][i][l] == 2) {\r\n one[j][0] = i;\r\n one[j][1] = l;\r\n remove(new int[] { i, l }, m);\r\n if ((j + 1) % players != startPlayerId) {\r\n t = solver(startPlayerId, (j + 1) % players, one, m, count);\r\n one[(j + 1) % players][0] = t[0];\r\n one[(j + 1) % players][1] = t[1];\r\n }\r\n // } else if ((j + 2) % players != startPlayerId) {\r\n // t = solver(startPlayerId, (j + 2) % players, one, m, count);\r\n // one[(j + 1) % players][0] = t[0];\r\n // one[(j + 1) % players][1] = t[1];\r\n // } else if ((j + 3) % players != startPlayerId) {\r\n // t = solver(startPlayerId, (j + 3) % players, one, m, count);\r\n // one[(j + 1) % players][0] = t[0];\r\n // one[(j + 1) % players][1] = t[1];\r\n // }\r\n\r\n k = onePlay(one, startPlayerId);\r\n int curpoint = 0;\r\n if (count != cardPerPlayer - 1) { // cardPerPlayer - 1 = 12\r\n t = solver(k[0], k[0], new int[4][2], m, count++);\r\n curpoint = t[2];\r\n }\r\n\r\n if (k[0] == myID) {\r\n curpoint += k[1] + k[2] * 12;\r\n }\r\n store.add(new int[] { i, l, curpoint });\r\n if (curpoint < minCard[2]) {\r\n minCard[2] = curpoint;\r\n minCard[0] = i;\r\n minCard[1] = l;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return minCard;\r\n }", "public List<List<Integer>> threeSum(int[] nums) {\n Arrays.sort(nums);\n\n Set<List<Integer>> triplets = new HashSet<List<Integer>>();\n\n for (int i = 0; i < nums.length; i++) {\n // we choose the number at index i to pinpoint\n int a = nums[i];\n int deficit = 0 - a;\n\n // initialize our two pointers such that they're at either end of the\n // array and that they're not i\n int b = i == 0 ? 1 : 0;\n int c = i == nums.length - 1 ? nums.length - 2 : nums.length - 1;\n\n while (b < c) {\n // check if b and c add up to the deficit\n if (nums[b] + nums[c] == deficit) {\n // add it to the list\n List<Integer> triplet = new ArrayList<Integer>();\n\n triplet.add(a);\n triplet.add(nums[b]);\n triplet.add(nums[c]);\n\n Collections.sort(triplet);\n if (!triplets.contains(triplet)) {\n triplets.add(triplet);\n }\n\n\n // move pointer up and down\n c -= 1;\n if (c == i) {\n c -= 1;\n }\n\n b += 1;\n if (b == i) {\n b += 1;\n }\n } else if (nums[b] + nums[c] > deficit) {\n // if it's too large, bring top pointer down\n c -= 1;\n if (c == i) {\n c -= 1;\n }\n } else {\n // if it's too small, bring bottom pointer up\n b += 1;\n if (b == i) {\n b += 1;\n }\n }\n }\n }\n\n List<List<Integer>> last = new ArrayList<List<Integer>>(triplets);\n return last;\n }", "public static void main(String[] args) {\n\t\tScanner sf = new Scanner(System.in);\n\t\tint tot = sf.nextInt();\n\t\tint[] arr = new int[tot];\n\t\tint[] res_i = new int[tot];\n\t\tint[] res_d = new int[tot];\n\t\t\n\t\tfor (int i = 0; i < tot; i++) {\n\t\t\tarr[i] = sf.nextInt();\n\t\t\tres_i[i] = 1;\n\t\t\tres_d[i] = 1;\n\t\t}\n\t\tfinder(arr, res_i, 0);\n\t\tfinder_rev(arr, res_d,arr.length-1);\n\t\tint max = 0;\n\t\tfor (int i = 0; i < res_d.length; i++) {\n\t\t\t if(max<res_d[i]+res_i[i]-1) { max = res_d[i]+res_i[i]-1; }\n\t\t\t\t\t}\n\t\tSystem.out.println(max);\n\t\tsf.close();\n\t}", "public static void main(String[] args) {\n\n\t\tint a = 10000;\n\t\tint num = 325489;\n\t\tint [][] lst = new int[a][a];\n\t\tint x = a/4, y = a/4;\n\t\tfinal int x0 = x,y0 = y;\n\t\tint layer = 0,cnt =1;\n\t\twhile (cnt <= num)\n\t\t{\n\t\t\tif (cnt == (2*layer+1)*(2*layer+1))\n\t\t\t{\n\t\t\t\tlst[x][y] = cnt;\n\t\t\t\ty++;\n\t\t\t\tlayer++;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tfor (int j = 0 ; j < layer*2-1;j++)\n\t\t\t{\n\t\t\t\tlst[x][y] = cnt;\n\t\t\t\tx++;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tfor (int j = 0 ; j < layer * 2;j++)\n\t\t\t{\n\t\t\t\tlst[x][y] = cnt;\n\t\t\t\ty--;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tfor (int j = 0 ; j < layer * 2;j++)\n\t\t\t{\n\t\t\t\tlst[x][y] = cnt;\n\t\t\t\tx--;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tfor (int j = 0 ; j < layer * 2;j++)\n\t\t\t{\n\t\t\t\tlst[x][y] = cnt;\n\t\t\t\ty++;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tint finalX = findx(lst,num);\n\t\tint finalY = findy(lst,num);\n\t\tSystem.out.println(Math.abs(finalY - y) + (finalX - x));\n\t}", "public static void main(String[] args) {\n\t\tSystem.out.println(\"\"+(int)(Math.log(Integer.MAX_VALUE)/ Math.log(3)));\n//\t\tint[] arr = { 5, 3, 1, 2, 4 };\n\t\tint[] arr = ArrayUtils.buildIntArrayNoDup(6, 0,20);\n//\t\tint[] arr = ArrayUtils.generateIntArrayWithDup(6, 0,20);\n//\t\tint[] arr = { 3, 3, 7, 19, 16, 13 };\n\t\tprint(arr);\n\t\tSystem.out.println(\"\" + toStr(findNextRighClosestGreaterDis(arr)));\n\t}", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint arr[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\tint sum = sc.nextInt();\n\t\tHashMap<Integer,Integer> map = new HashMap<>();\n \t\tArrays.sort(arr);\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint temp = arr[i];\n\t\t\tint reqSum = sum-temp;\n\t\t\tarr[i]=0;\n\t\t\tint l=0;\n\t\t\tint r = n-1;\n\t\t\twhile(l<r) {\n\t\t\t\t//System.out.println(\"l \" + l + \" r \" + r + \" i = \"+ i);\n\t\t\t\tif(arr[l] + arr[r]==reqSum && arr[l]!=0 && arr[r]!=0 ) {\n\t\t\t\t\tint arr2[] = new int[3];\n\t\t\t\t\tarr2[0] = temp;\n\t\t\t\t\tarr2[1] = arr[l];\n\t\t\t\t\tarr2[2] = arr[r];\n\t\t\t\t\tif(map.containsKey(arr2[0]) || map.containsKey(arr2[1]) || map.containsKey(arr2[2])) {\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\tArrays.sort(arr2);\n\t\t\t\t\t\tSystem.out.println(arr2[0] + \" \" + arr2[1] + \" \" + arr2[2]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tl++;\n\t\t\t\t}else if(arr[l] + arr[r] < reqSum) {\n\t\t\t\t\tl++;\n\t\t\t\t\t\n\t\t\t\t}else {\n\t\t\t\t\tr--;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tarr[i] = temp;\t\n\t\t\tmap.put(arr[i], 1);\n\t\t}\n\t}", "public static void main(String[] args){\n\t\t\n\t\tfor (int i = 0; i<999999;i++) results.add(0);\t\n\n\t\tsetChain(1L);\n\t\tboolean switcher = true;\n\t\t//while switch=true ... and once chain length is added to, switch = false\n \t\tlong best = 0L;\n\t\tint index=0;\n\t\t\t\n\t\tfor (long j = 1L; j < 1000000L; j++) {\n\n\t\t\tsetCur((int)j);\n\n\t\t\tfindChain(j);//} catch(Exception e){System.out.println(\"stackOverFlow :D\");}\n\t\t\tif (getChain() > best) {best = getChain(); index=getCur();}\n\t\t\t//now store results for later use if we come across that number.\n\t\t\tresults.set(getCur()-1, (int)getChain());\t\n\t\t\tsetChain(1L); //reset\n\t\t\t/* \t\n\t\t\tswitcher=true;\n\t\t\tint i = j;\n\t\t\twhile (switcher) {\n\n\t\t\t\tif (i==1) {//results.add(chainLength); \n\t\t\t\t\tif (chainLength > best) { best=chainLength; index = j;}\n\t\t\t \tchainLength=1; switcher=false;}\n\t\n\t\t\t\telse { i=recurse(i); chainLength++; }\t\n\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t*/\n//\t\t }\n\t\t}\n\t\tSystem.out.println(index);\n\t}", "public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n ArrayList<Integer> A = new ArrayList();\n System.out.println(\"Enter the array of size \"+n+\"\\n\");\n for(int i =0;i<n;i++){\n Integer num = scan.nextInt();\n A.add(num);\n }\n Collections.sort(A);\n A.replaceAll(a-> a*a);\n boolean flag = checkPyTriplets(A,n);\n System.out.println(flag);\n }", "void runTime1() {\n\t\tint[]numList= {45,78,99};\n\t\tSystem.out.println(numList[5]);\n\t}", "public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n arr = new int[N];\n dp = new int[N][N];\n sizeList = new ArrayList<>();\n cutIndexArr = new int[N][N];\n\n// StringTokenizer st = new StringTokenizer(br.readLine());\n for(int i = 0; i < N; i++) {\n arr[i] = sc.nextInt();\n Arrays.fill(dp[i] , -1);\n }\n\n divide(0,N-1);\n\n System.out.println(dp[0][N-1]);\n\n int cnt = 1;\n int preNum = 0;\n int next = cutIndexArr[0][N-1];\n\n if(next == N-1) {\n sizeList.add(N);\n }\n else\n sizeList.add(next - preNum +1);\n\n while(next < N-1) {\n preNum = next;\n next = cutIndexArr[next+1][N-1];\n sizeList.add(next - preNum );\n cnt++;\n }\n\n System.out.println(cnt);\n\n for(int i = 0; i < sizeList.size(); i++) {\n System.out.print(sizeList.get(i) + \" \");\n }\n\n\n\n }", "static void billingCounter(int gifts[],int no_of_user){\n int gift_copy[]=gifts.clone();\n for(int pass=0; pass<no_of_user-1;pass++){\n int flag=0;\n for(int i=0;i<no_of_user-1-pass;i++){\n if(gift_copy[i]<gift_copy[i+1]){\n int temp=gift_copy[i];\n gift_copy[i]=gift_copy[i+1];\n gift_copy[i+1]=temp;\n flag=+1;\n }\n }\n if(flag==0){\n /* if flag becomes 0 means our array is now sorted so need to go further it is used to reduce the complexity */\n break;\n } \n }\n display(gifts,gift_copy,no_of_user); // calling the display function for displaying the output\n\n }", "public static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\tm=sc.nextInt();\n\t\tmap=new int[m][n];\n\t\tflag=new boolean[m][n];\n\t\t\n\t\tfor(int i=0;i<m;i++)\n\t\t\tfor(int j=0;j<n;j++){\n\t\t\t\tmap[i][j]=sc.nextInt();\n\t\t\t\tsum+=map[i][j];\n\t\t\t}\n\t\t\n\t\tif(sum%2!=0)\n\t\t\tSystem.out.println(0);\n\t\telse{\n\t\t\thalf=sum/2;\n\t\t\tdfs(0,0,1,0);\n\t\t\tSystem.out.println(count==100?0:count);\n\t\t}\n\t\t\n\t}", "public static void main(String[] args) throws ParseException, CloneNotSupportedException, IOException\n\t{\n\t\t\n\t\tint N = 5;\n\t\tint k = 3;\n\t\tint [] numbers = {6,1,2,3,7};\n\t\tList<Integer> oneCounts = new ArrayList<Integer>(N);\n\t\tfor(int i =0 ; i<N ;i++){\n\t\t\t\n\t\t\toneCounts.add(i, countOne(numbers[i])); \n\t\t}\n\t\tCollections.sort(oneCounts,new Comparator<Integer>(){\n\n\t\t\t@Override\n\t\t\tpublic int compare(Integer o1, Integer o2)\n\t\t\t{\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn (o2-o1);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t} );\n\t\tint result =0;\n\t\tfor(int j =0 ;j < k ;j++){\n\t\t\t\n\t\t\tresult = result + oneCounts.get(j);\n\t\t}\n\t\t\n \n\t\tSystem.out.println(result);\n\t\tSystem.out.println(1^9);\n\t}", "public static void main(String[] args){\n int n;int k;\n Scanner sc=new Scanner(System.in);\n n=sc.nextInt();\n k=sc.nextInt();\n int[] a=new int[n];\n int[] reMain=new int[k];\n int num=0;\n for(int i=0;i<k;i++){\n reMain[i]=0;\n }\n for(int i=0;i<n;i++){\n int d=sc.nextInt()%k;\n reMain[d]++;\n }\n int p=0;\n if(k%2==0)\n p=k/2;\n else p=(k+1)/2;\n for(int i=1;i<p;i++){\n if(reMain[i]>reMain[k-i])\n num+=reMain[i];\n else\n num+=reMain[k-i];\n \n }\n if(reMain[p]%2==1 && k%2==0)\n num++;\n if(k==2)\n num=reMain[1];\n \n \n System.out.println(num);\n\t}", "public static void main(String[] args) {\n\n int oldCapacity = 4;\n System.out.println(oldCapacity + (oldCapacity >> 1));\n\n /*Solution solution = new Solution();\n// System.out.println(solution.numRollsToTarget(2, 6, 7));\n\n int[] ints = solution.loudAndRich(new int[][]{\n *//* {1, 0},\n {2, 1},\n {3, 1},\n {3, 7},\n {4, 3},\n {5, 3},\n {6, 3}\n }, new int[]{3, 2, 5, 4, 6, 1, 7, 0});*//*\n\n }, new int[]{0, 1});\n Printer.print(ints);*/\n }", "public static void main(String[] args) {\n\t\t\r\n\t\tint[] arr = new int[]{10,9,3,7,4,1,0};\r\n\t\tList g = Arrays.asList(arr);\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t/*List arrayList = new ArrayList();\r\n\t\t//arrayList.\r\n\t\t\r\n\t\tArrays.sort(arr);*/\r\n\r\n // use add() method to add elements in the list\r\n\t\tArrayList<Integer> arrlist = new ArrayList<Integer>(8);\r\n arrlist.add(0);\r\n arrlist.add(25);\r\n arrlist.add(10);\r\n arrlist.add(15);\r\n \r\n \r\n //Logic for Least missing number\r\n for(int l=0;l<arrlist.size();l++){\r\n\t\t\tif(arrlist.contains(l)){\r\n\t\t\t\tcontinue;\r\n\t\t\t} else {\r\n\t\t\t\tSystem.out.println(\"value not present==\"+l);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n \r\n //Logic for Max missing number\r\n Collections.sort(arrlist,Collections.reverseOrder());\r\n System.out.println(arrlist);\r\n\r\n \r\n for(int b=arrlist.get(0);;b--){\r\n \t if(arrlist.contains(b)){\r\n \t\t continue;\r\n \t }else {\r\n\t\t\t\tSystem.out.println(\"value not present==\"+b);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n \t \r\n }\r\n \r\n //USING java 8 features\r\n //Remove empty strings \r\n List<String> strings = Arrays.asList(\"abc\", \"\", \"bc\", \"efg\", \"abcd\",\"\", \"jkl\");\r\n List<String> filtered = strings.stream().filter(string -> !string.isEmpty()).collect(Collectors.toList());\r\n System.out.println(\"String filtered list\"+filtered);\r\n \r\n //get list of unique squares\r\n List<Integer> numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);\r\n \r\n List<Integer> squaresList = numbers.stream().map( i -> i*i).distinct().collect(Collectors.toList());\r\n System.out.println(\"Uniue squreslist\"+squaresList);\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\r\n\t}", "public static void main(String[] args) {\n\t\n\t\tScanner scanner=new Scanner(System.in);\n\t\tint noOftestCases = scanner.nextInt();\n\t\t\n\t\tfor (int p = 0; p < noOftestCases; p++) {\n\t\t\tint buffer[]=new int[100001];\n\t\t\tint size = scanner.nextInt();\n\t\t\t//int x[]=new int[size];\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\tint temp=scanner.nextInt();\n\t\t\t\tbuffer[temp%100000]++;\n\t\t\t}\n\t\t\tint kSmallest = scanner.nextInt();\n\t\t\tint i=0;\n\t\t\twhile(kSmallest>0){\n\t\t\t\ti++;\n\t\t\t\tif(buffer[i]!=0)\n\t\t\t\t\tkSmallest-=buffer[i];\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(i);\n\t\t\t\n\t\t}\n\t}", "public static void main(String[] args){\n // To hold the nums input [array]\n int nums [] = {2,7,11,15};\n // input two {1, 3, 4, 11, 15, 7, 2};\n\n // To hold target (expected sum of two nums)\n int target = 9;\n\n //To return indices which is array[0,1]\n // (If we don't print Arrays.toString we will be given garbage)\n System.out.println(Arrays.toString(twoSums(nums, target)));\n\n sumArray(nums);\n }", "public static int Main()\n\t{\n\tint[] b = new int[12];\n\tint w;\n\tint i;\n\tint[] a = {13, 44, 72, 103, 133, 164, 194, 225, 256, 286, 317, 347};\n\tString tempVar = ConsoleInput.scanfRead();\n\tif (tempVar != null)\n\t{\n\t\tw = Integer.parseInt(tempVar);\n\t}\n\tfor (i = 0;i < 12;i++)\n\t{\n\t\tb[i] = a[i] % 7 - 1;\n\t\tb[i] = (b[i] + w) % 7;\n\t}\n\tfor (i = 0;i < 12;i++)\n\t{\n\t\tif (b[i] == 5)\n\t\t{\n\t\t\tSystem.out.printf(\"%d\\n\",i + 1);\n\t\t}\n\t}\n\treturn 0;\n\t}", "private int run() {\r\n int[] num = new int[13];\r\n boolean IsRun = false;\r\n int count = 0, index=0, combination=1;\r\n for (String aCard : Card) {\r\n switch (aCard.substring(0, 1)) {\r\n case \"A\":\r\n num[0]++;\r\n continue;\r\n case \"2\":\r\n num[1]++;\r\n continue;\r\n case \"3\":\r\n num[2]++;\r\n continue;\r\n case \"4\":\r\n num[3]++;\r\n continue;\r\n case \"5\":\r\n num[4]++;\r\n continue;\r\n case \"6\":\r\n num[5]++;\r\n continue;\r\n case \"7\":\r\n num[6]++;\r\n continue;\r\n case \"8\":\r\n num[7]++;\r\n continue;\r\n case \"9\":\r\n num[8]++;\r\n continue;\r\n case \"T\":\r\n num[9]++;\r\n continue;\r\n case \"J\":\r\n num[10]++;\r\n continue;\r\n case \"Q\":\r\n num[11]++;\r\n continue;\r\n case \"K\":\r\n num[12]++;\r\n }\r\n }\r\n\r\n for (int i = 1; i < 14; i++) {\r\n if (num[i-1]!=0){\r\n count++;\r\n index=i-1;\r\n }\r\n if (count>=3){\r\n IsRun=true;\r\n }\r\n if (i<13) {\r\n if (num[i] == 0 && IsRun) { //if there is a run already, break the recursion if the next num doesn't exist.\r\n break;\r\n }\r\n if (num[i] == 0 && !IsRun) {\r\n count = 0;\r\n index = 0;\r\n }\r\n }\r\n }\r\n\r\n if (IsRun){\r\n for (int i = index-count+1; i < index+1; i++) {\r\n combination*=num[i];\r\n }\r\n return combination*count;\r\n }\r\n return 0;\r\n }", "public static List<List<Integer>> combinationSumRepeatedlyUsed(int[] nums, int target) {\n List<List<Integer>> lists = new ArrayList<>();\n\n if (nums == null || nums.length == 0) {\n return lists;\n }\n\n List<Integer> currentList = new ArrayList<>();\n\n dfs(nums, 0, target, currentList, lists);\n\n return lists;\n }", "public static void main(String[] args) throws IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint tc = sc.nextInt();\n\n\t\tfor (int num = 1; num <= tc; num++) {\n\t\t\tint n = sc.nextInt();\n\t\t\tString str = \"\";\n\t\t\tint arr[] = new int[n];\n\t\t\tboolean flag = false;\n\t\t\tboolean visit[]=new boolean[1001];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = sc.nextInt();\n\t\t\t\tif (!flag && arr[i] == 0)\n\t\t\t\t\tflag = true;\n\t\t\t\tstr += arr[i];\n\t\t\t}\n\t\t\tif (flag) {\n\t\t\t\tint ans = 0;\n\t\t\t\tboolean p=false;\n\t\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\t\tfor (int j = 0; j + i <= n; j++) {\n\t\t\t\t\t\t\tint tmp = Integer.parseInt(str.substring(j, j + i));\n\t\t\t\t\t\t\tvisit[tmp]=true;\n\t\t\t\t\t}\n\t\t\t\t\tint amount=(int)Math.pow(10, i);\n\t\t\t\t\tfor(int k=0;k<amount;k++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(!visit[k])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tans=k;\n\t\t\t\t\t\t\tp=true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(p)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"#\" + num + \" \" + ans);\n\t\t\t} else\n\t\t\t\tSystem.out.println(\"#\" + num + \" \" + 0);\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tint arr[] = takeInput();\r\n\t\tint temp[] = new int[fact(arr.length)];\r\n\t\tint k = -1;\r\n\t\tint val = scn.nextInt(), ans = 0;\r\n\r\n\t\tif (arr.length > 0 && arr.length < 1000) {\r\n\t\t\tfor (int i = 0; i < arr.length; i++) {\r\n\t\t\t\tans = sumExceptthis(arr, arr[i], val, i);\r\n\t\t\t\tif (ans != -1) {\r\n\t\t\t\t\ttemp[++k] = (int) Math.min(arr[i], ans);\r\n\t\t\t\t\ttemp[++k] = (int) Math.max(arr[i], ans);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// System.out.println((int) Math.min(arr[i], ans) + \" and \" +\r\n\t\t\t\t// (int)Math.max(arr[i], ans));\r\n\t\t\t\t// System.out.println(arr[i] + \" and \" + ans);\r\n//\t\t\t\telse\r\n//\t\t\t\t\tSystem.out.println(\"sorry\");\r\n\r\n\t\t\t}\r\n\t\t\t// display(temp);\r\n\t\t\twork(temp);\r\n\t\t}\r\n\t}", "public static void main(String[] args) throws IOException {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tout = new PrintWriter(System.out);\r\n\t\tsc = new StringTokenizer(\"\");\r\n\t\tn = nxtInt();\r\n\t\tm = nxtInt();\r\n\t\tc0 = nxtInt();\r\n\t\td0 = nxtInt();\r\n\t\ta = new int[m];\r\n\t\tb = new int[m];\r\n\t\tc = new int[m];\r\n\t\td = new int[m];\r\n\t\tdp = new long[m+2][101][n+1];\r\n\t\tfor(long[][]ar:dp)\r\n\t\t\tfor(long[]arr:ar)\r\n\t\t\t\tArrays.fill(arr, -1);\r\n\t\tint i = 0;\r\n\t\twhile(i < m){\r\n\t\t\ta[i]= nxtInt();\r\n\t\t\tb[i]= nxtInt();\r\n\t\t\tc[i]= nxtInt();\r\n\t\t\td[i]= nxtInt();\r\n\t\t\ti++;\r\n\t\t}\r\n\t\tSystem.out.println(maxVal(0, n, a[0]));\r\n\r\n\t}", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] arr = new int[n];\n ArrayList<Integer> set = new ArrayList<>();\n for(int i=0;i<n;i++)\n {\n arr[i] = sc.nextInt();\n \n if(!set.contains(arr[i]))\n set.add(arr[i]);\n }\n \n HashMap<Integer,Integer> map = new HashMap<>();\n for(int i:arr)\n {\n if(map.containsKey(i))\n map.put(i,map.get(i)+1);\n else\n map.put(i,1);\n }\n \n for(int i:set)\n {\n System.out.println(i+\" : \"+map.get(i));\n }\n \n \n }", "public static void specialSets() {\n\t\tSystem.out.printf(\"%12s%15s%15s%10s%10s%10s%10s%n\",\"Size\",\"Range\",\"Pre-Sort Type\",\"Insertion\",\"Selectuon\",\"Quick\",\"Merge\");\n\t\tint[] array;\n\t\t//200K\n\t\tSystem.out.printf(\"%12d%15s%15s\",200000,\"1-200k\",\"N/A\");\n\t\tarray = generateArray(200000, 1, 200000);\n\t\tfourSorts(array);\n\t\tSystem.out.println();\n\t\t//Sorted array\n\t\tSystem.out.printf(\"%12d%15s%15s\",200000,\"1-200k\",\"Sorted\");\n\t\tfourSorts(array);\n\t\tSystem.out.println();\n\t\t//Reverse Sorted\n\t\tSystem.out.printf(\"%12d%15s%15s\",200000,\"1-200k\",\"Reverse Sorted\");\n\t\tint[] temp = new int[array.length];\n\t\tfor(int i = 0; i < array.length; i++) {\n\t\t\ttemp[i] = array[array.length -1 -i];\n\t\t}\n\t\tfourSorts(temp);\n\t\tSystem.out.println();\n\t\t//Range 1-20\n\t\tSystem.out.printf(\"%12d%15s%15s\",200000,\"1-20\",\"N/A\");\n\t\tarray = generateArray(200000, 1, 20);\n\t\tfourSorts(array);\n\t\tSystem.out.println();\n\t}", "int getBlockNumsCount();", "int getBlockNumsCount();", "public List<List<Integer>> fourSum(int[] nums, int target) {\n Arrays.sort(nums); // sort\n List<List<Integer>> res = new ArrayList<>();\n if (nums.length < 4) return res;\n\n for (int i = 0; i < nums.length - 3; i++) {\n if (i == 0 || (i > 0 && nums[i] != nums[i - 1])) { // dedupe\n int sum1 = target - nums[i];\n for (int j = i + 1; j < nums.length - 2; j++) {\n if (j == i + 1 || (j > i + 1 && nums[j] != nums[j - 1])) {\n int newTarget = sum1;\n int left = j + 1, right = nums.length - 1, sum2 = newTarget - nums[j];\n while (left < right) {\n if (nums[left] + nums[right] == sum2) {\n res.add(new ArrayList<>(Arrays.asList(nums[i],\n nums[j], nums[left], nums[right])));\n\n while (left < right && nums[left] == nums[left + 1])\n left++; // dedupe\n while (left < right && nums[right] == nums[right - 1])\n right--; // dedupe\n\n left++; right--;\n }\n else if (nums[left] + nums[right] < sum2)\n left++;\n else right--;\n }\n }\n }\n }\n }\n return res;\n }", "public static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\tint N = input.nextInt(), M = input.nextInt();\n\t\tint[] pre = new int[N + 1];\n\t\t// initialize\n\t\tfor (int i = 1; i <= N; i++) pre[i] = i; \n\t\tfor (int i = 1; i <= M; i++) {\n\t\t\tint a = input.nextInt();\n\t\t\tint b = input.nextInt();\n\t\t\tunion(pre, a, b);\n\t\t}\n\t\tSystem.out.println(Arrays.toString(pre));\n\t\tint res = 0;\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tfor (int j = i + 1; j <= N; j++) {\n\t\t\t\tif (pre[i] == pre[j]) ++res;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(res);\n\t\tinput.close();\n\t}", "public static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint t = scn.nextInt();\n\t\tfor(int i = 0; i<t; i++) {\n\t\t\tn = scn.nextInt();\n\t\t\tdistance = 0;\n\t\t\tdistancesum = 0;\n\t\t\tlist = new LinkedList[n+3];\n\t\t\tfor(int j = 1; j<=n+2; j++) {\n\t\t\t\tlist[j] = new LinkedList<>();\n\t\t\t}\n\t\t\tlist[1].add(scn.nextInt());\n\t\t\tlist[1].add(scn.nextInt());\n\t\t\tlist[n+2].add(scn.nextInt());\n\t\t\tlist[n+2].add(scn.nextInt());\n\t\t\t\n\t\t\tfor(int j = 2; j<n+2; j++) {\n\t\t\t\tlist[j].add(scn.nextInt());\n\t\t\t\tlist[j].add(scn.nextInt());\n\t\t\t}\n\t\t\t\n\t\t\tvisited = new boolean[n+2];\n\t\t\tcnt = 0;\n\t\t\tmin = 10000;\n\t\t\tfindLoot(list,2);\n\t\t\tSystem.out.println(\"#\"+(i+1)+\" \"+min);\n\t\t}\n\t\t\n\t}", "public int[] fix34(int[] nums) {\r\n\tint i=0; // O(1)\r\n while(i<nums.length && nums[i]!=3) // O(n)\r\n i++; // n+1\r\n int j=i; // O(1)\r\n while(j+1<nums.length && nums[j+1]!=4) // O(n)\r\n j++; // n+1\r\n while(i<nums.length){ // O(n)\r\n if(nums[i]==3){ // O(1)\r\n int temp=nums[i+1]; // O(1)\r\n nums[i+1]=nums[j+1]; //O(1)\r\n nums[j+1]=temp; // O(1)\r\n while(j+1<nums.length && nums[j+1] != 4) //O(n)\r\n j++; // n+1\r\n }\r\n i++; // n+1\r\n }\r\n return nums; //O(1)\r\n}", "public static void main(String[] args) {\n\t\tint[] arr = {5,5,3,3,3,2,5};\n\t\tint[] result = solution(arr);\n\t\tfor(int n : result) {\n\t\t\tSystem.out.print(n + \" \");\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tArrayList<Integer> primelist = sieve(7071);\n\t\tArrayList<Double> second = new ArrayList<Double>();\n\t\tfor(int one : primelist) \n\t\t\tsecond.add(Math.pow(one, 2));\n\t\tArrayList<Double> third = new ArrayList<Double>();\n\t\tprimelist = sieve(368);\n\t\tfor(int one : primelist)\n\t\t\tthird.add(Math.pow(one, 3));\n\t\tArrayList<Double> fourth = new ArrayList<Double>();\n\t\tprimelist = sieve(84);\n\t\tfor(int one : primelist)\n\t\t\tfourth.add(Math.pow(one, 4));\n\n\t\tArrayList<Double> possibilities = new ArrayList<Double>();\n\t\tfor (int k = fourth.size() - 1; k >=0 ; k--) {\n\t\t\tfor (int j = 0; j < third.size(); j++) {\n\t\t\t\tdouble sum = fourth.get(k) + third.get(j);\n\t\t\t\tif (sum > 50000000)\n\t\t\t\t\tbreak;\n\t\t\t\telse {\n\t\t\t\t\tfor (int i = 0; i < second.size(); i++) {\n\t\t\t\t\t\tdouble nextsum = sum + second.get(i);\n\t\t\t\t\t\tif (nextsum > 50000000)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// I am not sure whether it can be proved that the sum is unique.\n\t\t\t\t\t\t\tif (!possibilities.contains(nextsum))\n\t\t\t\t\t\t\t\tpossibilities.add(nextsum);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint totalcount = possibilities.size();\n\t\tSystem.out.println(totalcount);\n\t}", "public static void main(String[] args) {\r\n\t\t\t// TODO Auto-generated method stub\r\n\t\t\tdouble a=0;\r\n\t\t double b=2;\r\n\t\t\t double n=4;\r\n\t\t\t double s;\r\n\r\n\t\t\tfor(int i=0; i<=n-1;i++) {\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t s = a + Math.pow(2, i)*b;\r\n\t\t\t\t\t\r\n\t\t\t\t\tSystem.out.println(s);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor(int j=0;j<=n-1;j++)\r\n\t\t\t{\r\n\t\t\t\tint arr\r\n\t\t\t}\r\n\t\t\t\r\n\t}", "public static void main(String[] args) {\n\n int n = 20;\n int[] input = {0, 6, 0, 6, 4, 0, 6, 0, 6, 0, 4, 3, 0, 1, 5, 1, 2, 4, 2, 4};\n String[] inStr = {\"ab\", \"cd\", \"ef\", \"gh\", \"ij\", \"ab\", \"cd\", \"ef\", \"gh\", \"ij\", \"that\", \"be\", \"to\", \"be\", \"question\", \"or\", \"not\", \"is\", \"to\", \"the\"};\n int[] count = new int[100];\n for (int i = 0; i < n; i++) {\n// String line = in.nextLine();\n// String[] elem = line.split(\"\\\\s\");\n// System.out.println(elem[0]+\" - \"+elem[1]);\n// input[i] = Integer.parseInt(elem[0]);\n// inStr[i] = elem[1];\n// count[input[i]] ++;\n }\n\n for (int i = n / 2; i < input.length; i++)\n count[input[i]]++;\n\n// for (int i = 0; i < count.length; i++)\n// System.out.print(count[i]);\n// System.out.println();\n\n int printed = 0;\n int i = 0;\n StringBuffer buffer = new StringBuffer();\n while (count[i] > 0){\n// for (int i = 0; i < count.length; i++) {\n// for (Integer st : findIndex(input, i,count[i])) {\n// System.out.print(findStr(inStr, st) + \" \");\n for (String st : findIndex(input,inStr, i,count[i])) {\n // System.out.print( st + \" \");\n buffer.append(st+\" \");\n printed++;\n }\n i++;\n }\n for (int idx = printed; idx<n;idx++)\n buffer.append(\"- \");\n // System.out.print(\"- \");\n System.out.println(buffer);\n\n\n }", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint total = sc.nextInt();\n\t\tint lastAns = 0;\n\t\tList<List<Integer>> list = new ArrayList();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tlist.add(new ArrayList());\n\t\t}\n\t\tfor (int i = 0; i < total; i++) {\n\t\t\tint q = sc.nextInt();\n\t\t\tint x = sc.nextInt();\n\t\t\tint y = sc.nextInt();\n\t\t\tint seq = (x ^ lastAns) % N;\n\t\t\tList<Integer> seqList = list.get(seq);\n\t\t\t\n\t\t\tswitch (q) {\n\t\t\t\tcase 1:\n\t\t\t\t\tseqList.add(y);\n\t\t\t\t\tlist.set(seq, seqList);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tlastAns = seqList.get(y % seqList.size());\n\t\t\t\t\tSystem.out.println(lastAns);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t}", "static int gen(int n)\n{ \n int []S = new int [n + 1];\n \n S[0] = 0;\n if(n != 0)\n S[1] = 1;\n \n for (int i = 2; i <= n; i++)\n { \n \n // S(2 * n) = 4 * S(n)\n if (i % 2 == 0)\n S[i] = 4 * S[i / 2];\n \n // S(2 * n + 1) = 4 * S(n) + 1\n else\n S[i] = 4 * S[i/2] + 1;\n }\n \n return S[n];\n}", "int getBlockNums(int index);", "int getBlockNums(int index);", "private static int[] getSquersArray(int[] nums) {\n\t\tint[] seqNums = new int[nums.length];\n\t\tint i = 0;\n\t\tfor (int num : nums) {\n\t\t\tseqNums[i] = num * num;\n\t\t\ti++;\n\t\t}\n\t\treturn seqNums;\n\t}", "public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int size = in.nextInt();\n int[] a = new int[100];\n for (int i = 0; i < size; i++) {\n int j = in.nextInt();\n a[j] = a[j] + 1;\n }\n\n for(int n : a){\n System.out.print(n+\" \");\n }\n System.out.println(\"\");\n }", "public static void main(String[] args) {\n\t\tint a[], count = 1;\r\n\t\ta = make();\r\n\t\tboolean more = true;\r\n\t\twhile(more) {\r\n\t\t\tint ans = putans(count);\r\n\t\t\tmore = checkans(ans, a);\r\n\t\t\tcount++;\r\n\t\t}\r\n\t}", "public static void main(String[] args) throws IOException{\n Reader sc = new Reader();\n \n int n=sc.nextInt();\n int m=sc.nextInt();\n \n int ans[]=new int[n];\n \n for(int i=0;i<m;i++)\n {\n int l=sc.nextInt();\n int r=sc.nextInt();\n // indexing is 1 based.\n l--;\n r--;\n \n ans[l]++;\n if(r!=n-1)\n {\n ans[r+1]--;\n \n } \n \n }\n \n int s=0;\n int max=0;\n for(int i=0;i<n;i++)\n {\n s+=ans[i];\n ans[i]=s;\n if(s>max)\n {\n max=s;\n }\n }\n \n int brr[]=new int[max+1];\n for(int i=0;i<n;i++)\n {\n brr[ans[i]]++;\n \n }\n \n s=0;\n for(int i=max;i>=0;i--)\n {\n s+=brr[i];\n brr[i]=s;\n \n }\n \n int q=sc.nextInt();\n for(int i=0;i<q;i++)\n {\n int x=sc.nextInt();\n if(x>max)\n {\n System.out.println(0);\n }\n else\n \tSystem.out.println(brr[x]);\n }\n \n\t}", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tint a[] = {2,1,3,-4,-2};\n\t\t//int a[] = {1 ,2, 3, 7, 5};\n\t\tboolean found = false;\n\t\t\n\t\t//this will solve in o n^2\n\t\tfor(int i = 0 ; i < a.length ; i++){\n\t\t\tint sum = 0;\n\t\t\tfor(int j = i ; j< a.length ; j++){\n\t\t\t\tsum += a[j] ;\n\t\t\t\tif(sum == 0){\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(found)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\t// link : https://www.youtube.com/watch?v=PSpuM9cimxA&list=PLKKfKV1b9e8ps6dD3QA5KFfHdiWj9cB1s&index=49\n\t\tSystem.out.println(found + \" found\");\n\t\tfound = false;\n\t\t//solving with O of N with the help sets\n\t\t// x + 0 = y\n\t\tSet<Integer> set = new HashSet<>();\n\t\tint sum = 0;\n\t\tfor(int element : a){\n\t\t\tset.add(sum);\n\t\t\tsum += element;\n\t\t\tif(set.contains(sum)){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\tSystem.out.println(set);\n\t\t\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t\tfound = false;\n\t\t// when the sum of subarray is K\n\t\t\n\t\t//solving with O of N with the help sets\n\t\t//x + k = y >>>\n\t\tSet<Integer> set1 = new HashSet<>();\n\t\tint k = 12;\n\t\tint summ = 0;\n\t\tfor(int element : a){\n\t\t\tset1.add(summ);\n\t\t\tsumm += element;\n\t\t\tif(set1.contains(summ - k)){ // y - k = x(alredy presnt or not)\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(set1);\n\t\tSystem.out.println();\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t}", "public int singleNumberII(int[] nums) {\n int ans = 0;\n for (int i = 0; i < 32; i++) {\n int sum = 0;\n for (int j = 0; j < nums.length; j++) {\n if (((nums[j] >> i) & 1) == 1) {\n sum ++;\n sum %= 3;\n }\n }\n if (sum != 0) {\n ans |= sum << i;\n }\n }\n return ans;\n }", "public static void main(String [] args){\n\t\tArrayList<Integer> allNums = new ArrayList<>();\n\t\tfor(int i = 0; i < 10; i++){\n\t\t\tallNums.add(i);\n\t\t}\n\t\t//Make into one big number\n\t\t//Proceed to divide it to knock bits off the right hand side\n\t\tboolean miracleFound = false;\n\t\tString tempNum;\n\t\tlong miracleNum = 0;\n\t\twhile(!miracleFound){\n\t\t\t//Make A String from the List And analyse it\n\t\t\ttempNum = \"\";\n\t\t\tfor(int i = 0; i < allNums.size(); i++){\n\t\t\t\ttempNum = tempNum + allNums.get(i);\n\t\t\t\t//System.out.println(\"Tempnum is \" + tempNum + \" and i is \" + i);\n\t\t\t\tif(i > 0){\n\t\t\t\t\tmiracleNum = Long.valueOf(tempNum).longValue();\n\t\t\t\t\tif(miracleNum % (i+1) == 0){ //If it is divisible without remainders\n\t\t\t\t\t\tif((i+1) == 10){\n\t\t\t\t\t\t\tmiracleFound = true;\n\t\t\t\t\t\t\tSystem.out.println(\"Number \" + miracleNum + \" was a miracle number.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tSystem.out.println(miracleNum + \" % \" + (i+1) + \" is 0.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tCollections.shuffle(allNums);\n\t\t\t\t\t\ti = allNums.size();\n\t\t\t\t\t\tSystem.out.println(\"Number \" + miracleNum + \" was not a miracle number.\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tRandom random = new Random();\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n//\t\tSystem.out.print(n);\n\t\tint[] lotto = new int[6];\n\t\tString str = \"[\";\n\t\t\n\t\tfor(int i=0; i<n; i++) {\n\t\t\tfor(int j=0; j<6; j++) {\n\t\t\t\tlotto[i] = random.nextInt(45)+1;\n\t\t\t\tif (j == 5) {\n\t\t\t\t\tstr += String.valueOf(lotto[i])+\"\";\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tstr += String.valueOf(lotto[i])+\", \";\n\t\t\t\t}\n\t\t\t}\n\t\t\tstr += \"]\";\n\t\t\t\n\t\t\tSystem.out.println((i+1) + \"번째 : \" + str);\n\t\t\tstr = \"[\";\n\t\t}\n\t}", "private static int missingNumber(int[] nums) {\n\t\t// TODO Auto-generated method stub\n\t\tint sum = 0; \n\t\tint end = nums.length; \n\t\t\n for(int i=0; i<end; i++){\n sum += i;\n sum = sum - nums[i];\n }\n \n sum = sum + end; \n\t\t\t\t\n\t\treturn sum;\n\t}", "public static void main(String[] args) {\r\n Scanner sc= new Scanner(System.in);\r\n int n = sc.nextInt();\r\n int[] arr = new int[n];\r\n //getting all the numbers\r\n for(int i=0;i<n;i++)\r\n arr[i]=sc.nextInt();\r\n //assigning 0th element as unique\r\n int unique=0;\r\n unique=arr[0];\r\n for(int i=1;i<arr.length;i++)\r\n {\r\n unique^=arr[i];\r\n }\r\n System.out.println(unique);\r\n\r\n\t}", "public static void main(String[] args) throws Exception{\n // long time = System.currentTimeMillis();\n File file = new File(\"input.txt\");\n File data = new File(\"output.txt\");\n Scanner input = new Scanner(file);\n PrintWriter output = new PrintWriter(data);\n\n algo = input.next();\n bx = input.nextInt();\n by = input.nextInt();\n bz = input.nextInt();\n\n ops = new int[bx][by][bz][18];\n openState = new Node[bx][by][bz];\n closedState = new Node[bx][by][bz];\n\n sx = input.nextInt();\n sy = input.nextInt();\n sz = input.nextInt();\n\n gx = input.nextInt();\n gy = input.nextInt();\n gz = input.nextInt();\n\n int n = input.nextInt();\n input.nextLine(); // flush \\n buffer\n for (int i = 0; i < n; i++) {\n String s = input.nextLine();\n String[] paras = s.split(\"\\\\s+\");\n int tx = Integer.parseInt(paras[0]);\n int ty = Integer.parseInt(paras[1]);\n int tz = Integer.parseInt(paras[2]);\n for (int j = 3; j < paras.length; j++)\n ops[tx][ty][tz][j - 3] = Integer.parseInt(paras[j]);\n }\n List<int[]> ans = ucs();\n int sum = 0, cnt = ans.size();\n if (cnt == 0)\n output.println(\"FAIL\");\n else {\n for (int[] step : ans)\n sum += step[3];\n output.println(sum);\n output.println(cnt);\n for (int[] step : ans) {\n for (int i = 0; i < step.length; i++) {\n if (i == 0)\n output.print(step[i]);\n else\n output.print(\" \" + step[i]);\n }\n output.println();\n }\n }\n output.close();\n // System.out.println(\"finish time is \" + (System.currentTimeMillis() - time) / 1000D);\n }", "public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int s = in.nextInt();\n int[] ar = new int[s];\n for(int i=0;i<s;i++){\n ar[i]=in.nextInt();\n }\n// insertIntoSorted(ar);\n// insertionSortPart2(ar);\n System.out.println(countShifts(ar));\n }", "public static void getLeastNumbers_2(int[] input, int[] output) {\n int start = 0;\n int end = input.length - 1;\n int k = output.length;\n int index = partition(input, start, end);\n while(index != k - 1) {\n if(index > k - 1) {\n end = index - 1;\n index = partition(input, start, end);\n }\n else {\n start = index + 1;\n index = partition(input, start, end);\n }\n }\n \n for(int i = 0; i < k; ++i)\n output[i] = input[i];\n }", "public int[] a(int paramInt1, int paramInt2, int paramInt3, int paramInt4)\r\n/* 11: */ {\r\n/* 12:13 */ int i = paramInt1 - 1;\r\n/* 13:14 */ int j = paramInt2 - 1;\r\n/* 14:15 */ int k = paramInt3 + 2;\r\n/* 15:16 */ int m = paramInt4 + 2;\r\n/* 16:17 */ int[] arrayOfInt1 = this.a.a(i, j, k, m);\r\n/* 17: */ \r\n/* 18:19 */ int[] arrayOfInt2 = boy.a(paramInt3 * paramInt4);\r\n/* 19:20 */ for (int n = 0; n < paramInt4; n++) {\r\n/* 20:21 */ for (int i1 = 0; i1 < paramInt3; i1++)\r\n/* 21: */ {\r\n/* 22:22 */ int i2 = c(arrayOfInt1[(i1 + 0 + (n + 1) * k)]);\r\n/* 23:23 */ int i3 = c(arrayOfInt1[(i1 + 2 + (n + 1) * k)]);\r\n/* 24:24 */ int i4 = c(arrayOfInt1[(i1 + 1 + (n + 0) * k)]);\r\n/* 25:25 */ int i5 = c(arrayOfInt1[(i1 + 1 + (n + 2) * k)]);\r\n/* 26:26 */ int i6 = c(arrayOfInt1[(i1 + 1 + (n + 1) * k)]);\r\n/* 27:27 */ if ((i6 != i2) || (i6 != i4) || (i6 != i3) || (i6 != i5)) {\r\n/* 28:28 */ arrayOfInt2[(i1 + n * paramInt3)] = arm.w.az;\r\n/* 29: */ } else {\r\n/* 30:30 */ arrayOfInt2[(i1 + n * paramInt3)] = -1;\r\n/* 31: */ }\r\n/* 32: */ }\r\n/* 33: */ }\r\n/* 34:35 */ return arrayOfInt2;\r\n/* 35: */ }", "public static void main(String[] args) {\n StringBuilder result = new StringBuilder();\n Scanner sc = new Scanner(System.in);\n int testCaseCount = sc.nextInt();\n\n for(int t = 0; t < testCaseCount; t++) {\n int m = sc.nextInt();\n int n = sc.nextInt();\n int[][] grid = new int[m][n];\n gridData = new int[m][n];\n for (int i = 0; i < m; i++) {\n for(int j = 0; j < n; j++) { \n gridData[i][j] = Integer.MAX_VALUE;\n grid[i][j] = sc.nextInt();\n }\n }\n if (t != 0) {\n result.append(\"\\n\");\n }\n result.append(orangesRotting(grid));\n }\n// int[][] grid = {{2,1,1},{0,1,1},{1,0,1}};\n System.out.print(result);\n }", "public static int missingNumberBitManipulation(int[] nums) {\n if (nums == null || nums.length == 0) return -1;\n\n int missing = nums.length;\n for (int i = 0; i < nums.length; i++) {\n missing ^= i ^ nums[i];\n }\n return missing;\n }", "public static void main(String[] args)throws Exception {\n\t\tSystem.setIn(new FileInputStream(\"src/data/exam1695.txt\"));\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\t\r\n\t\tN = sc.nextInt();\r\n\t\tmap = new int[N][N];\r\n\t\tfor (int i = 0; i < N; i++) {\r\n\t\t\tString tmp = sc.next();\r\n\t\t\tchar ch[] = tmp.toCharArray();\r\n\t\t\tfor (int j = 0; j < ch.length; j++) {\r\n\t\t\t\tmap[i][j] = Integer.parseInt(String.valueOf(ch[j]));\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tfor (int i = 0; i < N; i++) {\r\n\t\t\tfor (int j = 0; j < N; j++) {\r\n\t\t\t\tif(map[i][j] == 1) {\r\n\t\t\t\t\tindex++;\r\n\t\t\t\t\tdfs(i, j, index+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tsize = new int[100];\r\n\t\tfor (int i = 0; i < N; i++) {\r\n\t\t\tfor (int j = 0; j < N; j++) {\r\n\t\t\t\tif(map[i][j] != 0) {\r\n\t\t\t\t\tsize[map[i][j]]++;\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(index);\r\n\t\tint tmp, mid;\r\n\t\tfor (int i = 0; i < size.length; i++) {\r\n\t\t\tmid = i;\r\n\t\t\tfor (int j = 0; j < size.length; j++) {\r\n\t\t\t\tif(size[mid] < size[j]) {\r\n\t\t\t\t\ttmp = size[mid];\r\n\t\t\t\t\tsize[mid] = size[j];\r\n\t\t\t\t\tsize[j] = tmp;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tfor (int i = 0; i < size.length; i++) {\r\n\t\t\tif(size[i] != 0) {\r\n\t\t\t\tSystem.out.println(size[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (int[] is : map) {\r\n\t\t\tSystem.out.println(Arrays.toString(is));\r\n\t\t}\r\n\t}", "public void calculateOutputs()\n {\n numberOfOutputs = outputs.size();\n }", "public int[] twoSum2(int[] nums, int target) {\n int max = nums[0];\n int min = max;\n // get rank\n for (int e : nums) {\n if (e > max) {\n max = e;\n }\n if (e < min) {\n min = e;\n }\n }\n // show up table\n Integer[] showUpMap = new Integer[max - min + 1];\n LinkedList[] indicesMap = new LinkedList[max - min + 1];\n for (int i = 0; i < nums.length; i++) {\n showUpMap[nums[i] - min] = 1;\n if (indicesMap[nums[i] - min] == null) {\n indicesMap[nums[i] - min] = new LinkedList<Integer>();\n }\n indicesMap[nums[i] - min].add(i);\n }\n System.out.println(Arrays.toString(showUpMap));\n System.out.println(Arrays.toString(indicesMap));\n for (int i = 0; i < showUpMap.length; i++) {\n boolean show = showUpMap[i] != null;\n if (show) {\n int a = i + min;\n int need = target - a;\n if (need - min < showUpMap.length &&\n showUpMap[need - min] != null) {\n int ai = (int) indicesMap[i].get(0);\n int bi = (int) indicesMap[need - min].get(0);\n if (ai == bi) {\n bi = (int) indicesMap[need - min].get(1);\n }\n return new int[]{ai, bi};\n }\n }\n }\n return null;\n }", "public static void main(String[] args) {\n\t\tint limit = eulerLimit + 1;\n\t\t\n\t\tnumbers = new boolean[limit + 1];\n\t\tArrays.fill(numbers, true);\n\t\t\n\t\tfor(int i = 2; i != -1; i = getNextFreeIndex(i)) {\n\t\t\tfor(int j = i * 2; j < numbers.length; j += i) {\n\t\t\t\tnumbers[j] = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong sum = 0;\n\t\tfor(int index = 2; index < numbers.length; index++) {\n\t\t\tif(numbers[index] == true) {\n\t\t\t\tif(index < eulerLimit) {\n\t\t\t\t\tsum += index;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Sum=\" + sum);\n\n\t}", "public static int solution(int[] nums){\n int slow = nums[0], fast = nums[nums[0]];\n while(slow != fast){\n slow = nums[slow];\n fast = nums[nums[fast]];\n }\n fast = 0;\n while(slow != fast){\n slow = nums[slow];\n fast = nums[fast];\n }\n return slow;\n }", "public static void main(String[] args) {\n\t\t\r\n\t\tint i, x=4,w=9,q;\r\n\t\tfor(i=-1;i<20;i+=3) {\r\n\t\t\tx++;\r\n\t\t\tfor(q=4;q<11;q++) {\r\n\t\t\t\tdo {\r\n\t\t\t\t\ti=+3;\r\n\t\t\t\t\tw=sizeof(i);\r\n\t\t\t\t\ti=x+w;\r\n\t\t\t\t\tx=w+i;\r\n\t\t\t\t\t\t\r\n\t\t\t\t} while (x<15);\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"x:\"+x+\"i:\"+i);\r\n\r\n\t}", "public static int Main()\n\t {\n\t\t int x;\n\t\t int j;\n\t\t int[] a = new int[16];\n\t\t x = Integer.parseInt(ConsoleInput.readToWhiteSpace(true));\n\t\t int i = 1;\n\t\t int k = 0;\n\t\t while (x != -1)\n\t\t {\n\t\t\ta[i] = x;\n\t\t\ti++;\n\t\t if (x != 0)\n\t\t {\n\t\t\t k = i;\n\t\t }\n\t\t\t else\n\t\t\t {\n\t\t\t\tint sum = 0;\n\t\t\t for (i = 1;i <= k;i++)\n\t\t\t {\n\t\t\t\t for (j = 1;j <= k ;j++)\n\t\t\t\t {\n\t\t\t\t if (a[i] == 2 * a[j])\n\t\t\t\t {\n\t\t\t\t\t sum++;\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t }\n\t\t\t\t\tSystem.out.print((sum - 1));\n\t\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\t\ti = 1;\n\t\t\t }\n\t\t\tx = Integer.parseInt(ConsoleInput.readToWhiteSpace(true));\n\t\t }\n\t\t\treturn 0;\n\t }", "public static void main(String[] args) {\n\t\tint nums[] = {0, 1, 0, 3, 12};\r\n\t\tsolution(nums);\r\n\t\tfor(int a:nums)\r\n\t\t\tSystem.out.println(a);\r\n\t}", "public static void main(String[] args){\n int[] nums = {10, 15, 3, 7};\n System.out.println(solution2(nums, 17));\n System.out.println(solution2(nums, 25));\n System.out.println(solution2(nums, 11));\n }", "public static void main(String[] args) {\n\t\tint[] nums1 = { 1,2,3,0,0,0 };\n\t\tint[] nums2 = { 2,5,6 };\n\t\tint n = 3, m = 3;\n\t\tint[] res = new int[n+m];\n\t\tint index = 0;\n\t\tint i,j;\n\t\tfor (i = 0, j = 0; i<m && j<n ;) {\n\n\t\t\tif (nums1[i] <= nums2[j]) {\n\t\t\t\tres[index] = nums1[i];\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse if (nums2[j] <nums1[i]) {\n\t\t\t\tres[index] = nums2[j];\n\t\t\t\tj++;\n\t\t\t}\n\n\t\t\tindex++;\n\t\t}\n//\t\tSystem.out.println(i);\n//\t\tSystem.out.println(j);\n\t\tif(i<m)\n\t\t{\n\t\t\tfor(int k = i ; k < m;k++)\n\t\t\t{\n\t\t\t\tres[index] = nums1[k];\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(j<n)\n\t\t{\n\t\t\tfor(int k = j ; k < n;k++)\n\t\t\t{\n\t\t\t\tres[index] = nums2[k];\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}\n\n\t\tfor (int l = 0; l < n + m; l++)\n\t\t{\n\t\t\tnums1[l] = res[l];\n\t\t\t//System.out.println(nums1[l]);\n\t\t\tSystem.out.println(res[l]);\n\t\t}\n\t\t\t\n\t}", "public int missingNumber(int[] nums) {\n \n int result = 0;\n \n for(int i = 0; i < nums.length; i++){\n //to make for loop goes continuously, we put XOR nums.length after the loop \n result ^= nums[i] ^ i;\n }\n \n //we do XOR nums.length(i.e. n) now\n \n return result^nums.length;\n }", "public static void main(String[] args) {\n\n\t\tScanner sc=new Scanner(System.in);\n\t\t\n\t\tint tc=sc.nextInt();\n\t\t\n\t\tfor (int t = 1; t <= tc; t++) {\n\t\t\tN=sc.nextInt();\n\t\t\tK=sc.nextInt();\n\t\t\tP=N/4;\n\t\t\tString input=sc.next();\n\t\t\t\n\t\t\tarray=input.toCharArray();\n\t\t\t\n\t\t\tTreeSet<Long> set=new TreeSet<>();\n\t\t\t\n\t\t\t\n\t\t\tfor (int i = 0; i < P; i++) {\n\t\t\t\tString str=new String(array);\n\t\t\t\t\n\t\t\t\tfor (int j =0; j < 4; j++) {\n//\t\t\t\t\tSystem.out.println(str.substring(j*P,j*P+P));\n//\t\t\t\t\tSystem.out.println(to10(str.substring(j*P,j*P+P)));\n\t\t\t\t\tset.add(to10(str.substring(j*P,j*P+P)));\n\t\t\t\t}\n//\t\t\t\tSystem.out.println();\n\t\t\t\tmoveArray();\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i <K-1; i++) {\n\t\t\t\t\n\t\t\t\tset.pollLast();\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(\"#\"+t+\" \"+set.pollLast());\n\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\r\n\t\tcreateArray(); \r\n\t\tSystem.out.println(\"\\n\"+\"* random array *\");\r\n\t\twriteArray(randomArray); \r\n\t\tsortedArray=sortedArray(randomArray);\r\n\t\tSystem.out.println(\"\\n\"+\"* sorted array *\");\r\n\t\twriteArray(sortedArray);\r\n\t\tSystem.out.println(\"\\n\"+\"plesae enter compre number \");\r\n\t\tk = scan.nextInt();\r\n\t\t//int test[] = { 1, 2, 3, 4, 5, 6, 7, 8 };\r\n\t\tfindPairSum(sortedArray, k);\r\n\t}", "public static void main(String[]args){\n\r\n int []arr = new int[100];\r\n int []arr2 = new int[50];\r\n int []arr3 = {1,2,3,4,5,6,7,8};\r\n int number = 5;\r\n LogicalOp op = new LogicalOp();\r\n// op.writeOnArray(arr);\r\n\r\n// arr2 = op.evenArray(arr2);\r\n// for(int i=0;i<arr2.length;i++)\r\n// System.out.println(arr2[i]);\r\n\r\n //System.out.println(\"Mean value: \"+op.meanValue(arr3));\r\n\r\n// String[] arrOfStr = {\"ana\",\"are\",\"mere\",\"pere\",\"mere\"};\r\n// String str = \"mere\";\r\n// System.out.println(op.isContaingString(arrOfStr,str));\r\n\r\n// System.out.println(op.findPosition(arr3,number));\r\n\r\n //op.displayLines();\r\n\r\n// int[]modifArr = op.modifiedArr(arr3,number);\r\n// for(int item: modifArr)\r\n// System.out.print(item+\" \");\r\n\r\n\r\n //System.out.println(\"Second minimum: \"+op.secondMin(arr3));\r\n\r\n int[] empty = new int[arr3.length];\r\n empty = op.populateArray(arr3,empty);\r\n for(int item:empty)\r\n System.out.print(item+\" \");\r\n\r\n\r\n\r\n }" ]
[ "0.596996", "0.58892065", "0.5856956", "0.5798264", "0.57815737", "0.5780085", "0.57763165", "0.57677317", "0.57599986", "0.57445943", "0.5719198", "0.56992173", "0.5699108", "0.5657415", "0.56268233", "0.5624544", "0.5619513", "0.5595805", "0.5590135", "0.55881846", "0.55835783", "0.55736405", "0.55709", "0.5565104", "0.55407643", "0.5517395", "0.5512523", "0.5505629", "0.5488329", "0.548491", "0.54820573", "0.54781514", "0.54715353", "0.54678494", "0.54627484", "0.5445299", "0.5432328", "0.5426958", "0.5426927", "0.5418132", "0.5416228", "0.5412045", "0.5409239", "0.5404888", "0.54029804", "0.54010916", "0.5400787", "0.5395323", "0.53942513", "0.5392274", "0.53890914", "0.5388995", "0.53854555", "0.5382237", "0.53786904", "0.53686905", "0.535773", "0.535773", "0.53558075", "0.5354828", "0.53456503", "0.53389364", "0.53347176", "0.53322625", "0.53275293", "0.532362", "0.5322366", "0.5321948", "0.53206253", "0.53206253", "0.53170514", "0.5316716", "0.5311166", "0.530681", "0.5304459", "0.52970093", "0.5294707", "0.52930737", "0.52914613", "0.5290091", "0.52883595", "0.5282857", "0.5282496", "0.52818495", "0.5277609", "0.5272024", "0.52706385", "0.5266109", "0.5264832", "0.5260387", "0.52565265", "0.5254621", "0.5252642", "0.52513325", "0.525027", "0.52500665", "0.5249842", "0.5249771", "0.5249192", "0.52476966" ]
0.63007885
0
2nd one the output is an int[] with length 2, the 1st index && the 2nd index
public List<Integer> minLength(int[] nums) { // find the 1st index int first = 0, last = nums.length - 1; for (int i = 0; i < nums.length - 1; i++) { if (nums[i] > nums[i + 1]) { first = i; break; } } // find the 2nd index for (int i = nums.length - 1; i > 0; i--) { if (nums[i] < nums[i - 1]) { last = i; break; } } // find the maximum & minimum int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE; for (int i = first; i <= last; i++) { max = Math.max(nums[i], max); min = Math.min(nums[i], min); } // find the true index for (int i = 0; i < first; i++) { if (nums[i] > min) { first = i; break; } } for (int i = nums.length - 1; i > last; i--) { if (nums[i] < max) { last = i; break; } } List<Integer> l = new LinkedList<>(); l.add(first); l.add(last); return l; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getElementArray2(int index)\n {\n return array2[index];\n }", "public abstract int[] toIntArray();", "int[] populateArray(int[] firstArr,int[] secondArr){\n\t\tlength = firstArr.length + secondArr.length; //Getting length of the resultant array\n\t\tresultArr = new int[length]; //set resultant array length\n\t\tfor(kCounter = 0 ; kCounter < length; kCounter++){\n\t\t\t//checking index of the array is even or odd\n\t\t\tif(kCounter % 2 == 0){\n\t\t\t\tresultArr[kCounter] = secondArr[iCounter]; //if position is even then add element to even index\n\t\t\t\tiCounter++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tresultArr[kCounter] = firstArr[jCounter]; //if position is odd then add element to odd index\n\t\t\t\tjCounter++;\n\t\t\t}\n\t\t}\n\t\treturn resultArr;\n\t}", "public static IntArrayStack[] returnTwo(){\n\t\t\n\t\t\n\t\tIntArrayStack output1 = new IntArrayStack(10);\n\t\tIntArrayStack output2 = new IntArrayStack(10);\n\t\t\n\t\toutput1.push(10);\n\t\toutput1.push(20);\n\t\t\n\t\toutput2.push(30);\n\t\toutput2.push(40);\n\t\t\n\t\tIntArrayStack[] output = new IntArrayStack[2];\n\t\toutput[0] = output1;\n\t\toutput[1] = output2;\n\t\t\n\t\treturn output;\n\t\t\n\t}", "int[] toArray();", "public int[] helper(int[] data) {\n if (data.length < 2) {\n return data;\n }\n int mid = data.length / 2;\n\n return merge(\n helper(Arrays.copyOfRange(data, 0, mid)),\n helper(Arrays.copyOfRange(data, mid , data.length)));\n }", "public static int[] array(int[] arr1, int[] arr2) {\n\n int[] arr3 = new int[arr1.length + arr2.length]; //now the length = 5\n int j = 0;//will represent indexes of 3rd array\n\n for (int each : arr1) { //1, 2, 3\n arr3[j++] = each;\n }\n\n for (int each : arr2) {\n arr3[j++] = each;\n }\n\n return arr3;\n }", "int[] getInts();", "int[] getGivenByOrder();", "public int[] toIntArray()\r\n {\r\n int[] a = new int[count];\r\n \r\n VectorItem<O> vi = first;\r\n \r\n for (int i=0;i<=count-1;i++)\r\n {\r\n a[i] = (Integer) vi.getObject();\r\n vi = vi.getNext();\r\n }\r\n\r\n return a; \r\n }", "public static void main(String[] args) {\n\t\tint arr1[] = {1, 3, 5};\n\t\tint arr2[] = {2, 3, 3};\n\t\tint a[] = merge(arr1, arr2);\n\t\tfor (int i = 0; i )\n\t\tSystem.out.println();\n\t}\n\t\n\tpublic static int[] merge (int arr1[], int arr2[]){\n\t\tint result[] = new int[arr1.length + arr2.length];\n\t\tint idex_arr1 = 0;\n\t\tint idex_arr2 = 0;\n\t\tint idex_result = 0;\n\t\t//index arr1 < index arr2, result [0] = arr1[0]\n\t\twhile (idex_arr1 < arr1.length || idex_arr2 < arr2.length)\n\t\t{\n\t\t\tif (idex_arr2 >= arr2.length)\n\t\t\t{\n\t\t\t\tresult[idex_result++] = arr1[idex_arr1++];\n\t\t\t}\n\t\t\telse if (idex_arr1 < arr1.length)\n\t\t\t{\n\t\t\t\tif (arr1[idex_arr1] < arr2[idex_arr2])\n\t\t\t\t\tresult[idex_result++] = arr1[idex_arr1++];\n\t\t\t\telse\n\t\t\t\t\tresult[idex_result++] = arr2[idex_arr2++];\n\t\t\t} else {\n\t\t\t\tresult[idex_result++] = arr2[idex_arr2++];\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "public static void main(String[] args){\n // To hold the nums input [array]\n int nums [] = {2,7,11,15};\n // input two {1, 3, 4, 11, 15, 7, 2};\n\n // To hold target (expected sum of two nums)\n int target = 9;\n\n //To return indices which is array[0,1]\n // (If we don't print Arrays.toString we will be given garbage)\n System.out.println(Arrays.toString(twoSums(nums, target)));\n\n sumArray(nums);\n }", "public int[] getIntList();", "public int[] increaseBy2(int[] arr) {\n return null;\n }", "public int getElementArray1(int index)\n {\n return array1[index];\n }", "public int[] toArray() \n {\n \treturn arrayCopy(state);\n }", "private static int[] generateArray(int i, int j) {\n int[] col = new int[j+1];\n for(int k = 0; k <= j; k++)\n {\n col[k] = (i+k)%Algo.x.length;\n } \n return col;\n }", "private static int[] oddNumbers(int i, int j) {\n\t\tint size = (j - i + 1) / 2 ;\n int[] a = new int[size];\n \n\t\tint l = 0;\n\t\twhile (i <= j) {\n\t\t\t//if (i % 2 != 0) {\n\t\t\tif ((1 & i) == 1) {\n\t\t\t\t//System.out.println(i);\n\t\t\t\ta[l] = i;\n\t\t\t\tl++;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\t\n\t\treturn a;\n\n\t}", "public int[] ArrayInverso1(int[] arr){\r\n\t\tint l=arr.length;\r\n\t\t\r\n\t\tint[] arr_inv = new int[l];\r\n\t\tfor (int i=0;i<l;i++)\r\n\t\tarr_inv[i]=arr[l-1-i];\r\n\t\treturn arr_inv;\r\n\t\t\r\n\t\t\r\n\t\r\n\t}", "Integer[] concatArrays(Integer[] array1, Integer[] array2);", "public int[] getIntArray() {\r\n\t\t\r\n\t\treturn (value.getIntArray());\r\n\t}", "public static void oddarray() {\n ArrayList<Integer> y = new ArrayList<Integer>();\n for (int i =1; i<256; i++){\n if (i%2 != 0){\n y.add(i);\n }\n }\n System.out.println(y);\n }", "@Override\n public int[] getInts(int index, int length) throws ArrayIndexOutOfBoundsException {\n if (length == 0) {\n return new int[0];\n }\n \n List<Value> values = array.getValues(index, length);\n int[] result = new int[values.size()];\n for (int i = 0; i < result.length; i++) {\n result[i] = ((IntegerValue)values.get(i)).intValue();\n }\n return result;\n }", "public int toArray(X[] A, int i);", "public static int[] twoToOne(int[][] two_board){\n int[] one_board = new int[24];\n int i=0;\n for(int row=0; row<ROW; row++){\n for(int column = 0; column < COLUMN; column++){\n one_board[i] = two_board[row][column];\n i++;\n }\n }\n return one_board;\n }", "static int [] twoSums(int [] num, int targets) {\n // Equation with variables: nums[i] + nums[j] == target (return the indices)\n // Visualize an array indices {0,1,2,3,4} my i = nums.length\n // Visualize another array J = i+1 {1,2,3,4};\n // nums [2,7,11,15];\n // NOTE: Visualize J = i + 1; When i=0, j will start at 1\n // The if statement is used to check if the condition matches the target\n\n for(int i=0; i < num.length; i++) {\n for(int j= i+1; j<num.length; j++) {\n if (num[i] + num[j] == targets){\n // return new int array because the return type is Array.toString\n return new int [] {i,j};\n }\n }\n }\n return null;\n }", "public int[] toArray() {\n return Arrays.copyOf(buffer, elementsCount);\n }", "static int[] findFirstTwoPositiveNumbersInARow(int... sourceNumbers) {\n return IntStream.of(sourceNumbers)\n .filter(x -> x > 0)\n .peek(x -> System.out.format(\"%d, \", x))\n .limit(2).toArray();\n }", "public static void main(String[] args) {\n int[][] array = {{1,3,6}, {5,6,7}};\n\n int[] a = array[1];\n int b = array[1][1];\n System.out.println(a[1]);\n System.out.println(b);\n }", "public Integer arrayOddNumbers(int[] arr4){\n\t\tArrayList<Integer> oddArray = new ArrayList<Integer>();\n\t\tfor(int f = 0; f < arr4.length; f++){\n\t\t\tif(arr4[f] % 2 == 1){\n\t\t\t\toddArray.add(arr4[f]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(oddArray);\n\t\treturn 0;\n\t}", "static int[] getFirstResultString(int[] array){\n int from = (n * (lineNumber-1));\n int[] rezultColumn = Arrays.copyOfRange(array, from, from + n);\n return rezultColumn;\n }", "@Override\n public int[] toArray() {\n int[] result = new int[size];\n Entry tmp = first;\n for (int i = 0; i < size; i++) {\n result[i] = tmp.value;\n tmp = tmp.next;\n }\n return result;\n }", "public int[] intersect(int[] nums1, int[] nums2) {\n int i = 0, j =0;\n int len1 = nums1.length;\n int len2 = nums2.length;\n\n List<Integer> output = new ArrayList<>();\n\n while(i < len1 && j < len2) {\n if(nums1[i] > nums1[j]) {\n j++;\n } else if (nums1[i] < nums1[j]) {\n i++;\n } else {\n output.add(nums1[i]);\n i++;\n j++;\n }\n }\n return output.stream().mapToInt(Integer:: intValue).toArray();\n }", "public Integer iterate(int[] arr1){\n\t\tfor(int b = 0; b < arr1.length; b++){\n\t\t\tSystem.out.println(arr1[b]);\n\t\t}\n\t\treturn 0;\n\t}", "public int[] twoSum2(int[] nums, int target) {\n int max = nums[0];\n int min = max;\n // get rank\n for (int e : nums) {\n if (e > max) {\n max = e;\n }\n if (e < min) {\n min = e;\n }\n }\n // show up table\n Integer[] showUpMap = new Integer[max - min + 1];\n LinkedList[] indicesMap = new LinkedList[max - min + 1];\n for (int i = 0; i < nums.length; i++) {\n showUpMap[nums[i] - min] = 1;\n if (indicesMap[nums[i] - min] == null) {\n indicesMap[nums[i] - min] = new LinkedList<Integer>();\n }\n indicesMap[nums[i] - min].add(i);\n }\n System.out.println(Arrays.toString(showUpMap));\n System.out.println(Arrays.toString(indicesMap));\n for (int i = 0; i < showUpMap.length; i++) {\n boolean show = showUpMap[i] != null;\n if (show) {\n int a = i + min;\n int need = target - a;\n if (need - min < showUpMap.length &&\n showUpMap[need - min] != null) {\n int ai = (int) indicesMap[i].get(0);\n int bi = (int) indicesMap[need - min].get(0);\n if (ai == bi) {\n bi = (int) indicesMap[need - min].get(1);\n }\n return new int[]{ai, bi};\n }\n }\n }\n return null;\n }", "private static int[] toIntArray(List<Integer> shorts) {\n int[] array = new int[shorts.size()];\n for (int i = 0; i < shorts.size(); i++)\n array[i] = shorts.get(i).shortValue();\n return array;\n }", "public native int[][] __int2dArrayMethod( long __swiftObject, int[][] arg );", "public static int[] twoSum(int[] nums, int target) {\n\n HashMap<Integer, Integer> complementsByIndex = new HashMap<>();\n for (int i = 0; i < nums.length; i++) {\n if (complementsByIndex.containsKey(nums[i])) {\n Integer complementIndex = complementsByIndex.get(nums[i]);\n return new int[]{complementIndex, i};\n } else\n complementsByIndex.put(target - nums[i], i);\n }\n\n return new int[]{};\n }", "public static void main(String[] args) {\n\t\tint[] intArr2= {11,12,13,14,15};\n\t\tint index=2;\n\t\tSystem.out.println(\"length of array is \"+intArr2.length);\n\t\t\n\t\tif(intArr2.length>index)\n\t\t{\n\t\t\t\n\t\t\tSystem.out.println(\"index found value is \\n\"+intArr2[index]);\n\t\t\tfor(int i=0;i<=index;i++)\n\t\t\t{\n\t\t\t\t System.out.println(\"values are \"+ intArr2[i]);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"index not found at\");\n\t\t}\n\t\t\n\t\t\n\t\n\t\t}", "public int [] covertirInt(String [] a) {\n\t\n\t\n\t int [] temporal = new int [a.length-1];\n\t\n\t\n\t for (int i =0; i<temporal.length;i++) {\n\t \n\t\t temporal[i]=Integer.parseInt(a[i+1]);\n\t }\n \n \n\t return temporal;\n\t\n}", "public int[] Version1(int[] seq){\n \n return seq;\n \n }", "public static void main(String[] args) { \n\t\t\n\t\tint[] numbers = new int[2] ; \n\t\t\n\t\tint[] nums1 = {1,45,32,10} ; \n\t\tint[] nums2 = {2,5,31} ; \n\t\t\n\t\tint[] numsOfNum[] = new int[2][];\n\t\tSystem.out.println( Arrays.deepToString(numsOfNum) );\n\t\t\n\t\tnumsOfNum[0] = nums1 ; \n\t\tnumsOfNum[1] = nums2 ; \n\t\t\n\t\tSystem.out.println( Arrays.deepToString(numsOfNum) );\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public int inputArray(int[] num) {\n\t\treturn sumEvenIndexes(num);\n\t}", "public int[] twoSum(int[] nums, int target) {\n // create a hashtable\n HashMap<Integer, Integer> hashMap = new HashMap<>();\n for (int i = 0; i < nums.length; i++) {\n // add the element plus corresponding index to the hashtable\n hashMap.put(nums[i], i);\n }\n for (int i = 0; i < nums.length; i++) {\n int compl = target - nums[i];\n // check if the complement exists in our hashtable && its value ins't the index corresponding to nums[i] i.e not a repeat of nums[i]\n if (hashMap.containsKey(compl) && hashMap.get(compl) != i) {\n return new int[] {i, hashMap.get(compl)};\n }\n }\n return new int[]{-1, -1};\n }", "private static int[] p2(int[] ar, int n) {\n int[] p2 = new int[n];\n Arrays.fill(p2, n);\n Stack<Integer> st = new Stack<>();\n for (int i = 0; i < n; i++) {\n while (st.size() != 0 && ar[i] < ar[st.peek()]) {\n p2[st.peek()] = i;\n st.pop();\n }\n st.push(i);\n }\n return p2;\n }", "@Override\r\n\t\t\tpublic int compare(int[] o1, int[] o2) {\n\t\t\t\treturn Integer.compare(o2[2], o1[2]);\r\n\t\t\t}", "public static int[] volteaArrayInt(int[]array) { \n \n int[] aux = new int [array.length];\n \n for(int i = 0 ; i < array.length; i++){\n aux[array.length - i - 1] = array[i];\n }\n return aux;\n }", "public int[] twoSum1(int[] nums, int target)\n\t{\n\t\tMap<Integer, Integer> map = new HashMap<>();\n\t\tfor(int i = 0 ; i< nums.length ; i++)\n\t\t{\n\t\t\tint compliment = target - nums[i];\n\t\t\tif(map.containsKey(compliment))\n\t\t\t{\n\t\t\t\treturn new int[] {map.get(compliment),i};\n\t\t\t}\n\t\t\t\n\t\t\tmap.put(nums[i], i);\n\t\t}\n\t\t\n\t\t\n\t\treturn null;\n\t}", "public int[] intersect1(int[] nums1, int[] nums2) {\n Map<Integer, Integer> map1 = createHashMap(nums1);\n List<Integer> intersect = new ArrayList<>();\n for(int a: nums2) {\n if(map1.containsKey(a)) {\n int val = map1.get(a);\n if(val == 1) {map1.remove(a);}\n else {map1.put(a, val-1);}\n intersect.add(a);\n }\n }\n return intersect.stream().mapToInt(x->x).toArray();\n }", "public static int[] getArray( int start, int end ) {\n int[] array = new int[ (end - start) + 1 ];\n for (int i = 0; i <= (end - start); i++) {\n array[i] = start + i;\n }\n return array;\n }", "private int[] getIntArray(int[][] histogram)\n {\n int[] histValues = new int[grid_size * BINS];\n int index = 0;\n for(int i = 0; i < histogram.length; i++)\n {\n for(int k = 0; k < histogram[i].length; k++)\n {\n histValues[index++] = histogram[i][k];\n }\n }\n\n return histValues;\n }", "public int[] twoSum(int[] numbers, int target) {\n if(numbers.length == 0){\n //empty array\n return new int[0];\n }\n HashMap<Integer,Integer> hashmapHelper = new HashMap<Integer,Integer>();\n for(int i = 0; i < numbers.length; i++){\n hashmapHelper.put(numbers[i],i+1);//put index value into hashtable\n }\n int i = 0;\n while(i<numbers.length){\n if(hashmapHelper.containsKey(target - numbers[i])){\n \n int index1 = i+1;\n int index2 = hashmapHelper.get(target - numbers[i]);\n if(index1 < index2){\n \tint[] index = {index1,index2};\n \treturn index;\n }\n else{\n int[] index = {index2,index1};\n return index;\n }\n }\n i++;\n }\n return new int[0];\n }", "public static int[] twoSum_2(int[] example, int target) {\n Map<Integer, Integer> map = new HashMap<>();\n for (int i = 0; i < example.length; i++) {\n map.put(example[i], i);\n }\n for (int i = 0; i < example.length; i++) {\n int complement = target - example[i];\n if (map.containsKey(complement) && map.get(complement) != i) {\n return new int[]{i, map.get(complement)};\n }\n }\n throw new IllegalArgumentException(\"No two sum solution\");\n }", "public int[][][] testIntArray(int[][][] in) throws java.rmi.RemoteException {\n for (int i=0; i < in.length; i++) {\n int[][] array2 = in[i];\n if (array2 != null)\n for (int j=0; j < array2.length; j++) {\n int[] array3 = array2[j];\n if (array3 != null)\n for (int k=0; k <array3.length; k++) {\n if (array3[k] == i + 10*j + 100*k)\n array3[k] += 1000;\n }\n }\n }\n return in;\n }", "public static int[] intiArray(int num){\n\t\tint[] numArray = new int[num];\n\t\tfor(int i = 0; i < num; i++){\n\t\t\tnumArray[i] = i+1;\n\t\t}\n\t\treturn numArray;\n\t}", "public int[] findAnyPairIndexesCoprime() {\n return findAnyPairIndexesCoprime(seq);\n }", "public static void main(String[] args) \r\n\t{\n\r\n\t\tint[] A = {1,5,8,7,3,6};\r\n\t\tint[] B = {2,9,4};\r\n\t\t\r\n\t\tList<Integer> list = Arrays.stream(A).boxed().collect(Collectors.toList());\r\n\t\tList<Integer> list2 = Arrays.stream(B).boxed().collect(Collectors.toList());\r\n\t\tList<Integer> combine = new ArrayList<>();\r\n\t\tcombine.addAll(list);\r\n\t\tcombine.addAll(list2);\r\n\t\t\r\n\t\tSystem.out.println(list);\r\n\t\tSystem.out.println(combine);\r\n\t\tCollections.sort(combine);\r\n\t\tSystem.out.println(combine);\r\n\t\r\n\t\tList<Integer> extractA = combine.subList(0, A.length);\r\n\t\tList<Integer> extractB = combine.subList(A.length, A.length+B.length);\r\n\t\t\r\n\t\tSystem.out.println(extractA);\r\n\t\tSystem.out.println(extractB);\r\n\t\t\r\n// second approch for integer to array\t\t\r\n\t\tint[] ints = {1, 2, 3};\r\n\t\tList<Integer> intList = new ArrayList<Integer>();\r\n\t\t\r\n\t\tfor (int i = 0; i < ints.length; i++) \r\n\t\t{\r\n\t\t\t intList.add(ints[i]);\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.println(intList);\r\n\t\t\r\n\t}", "public static int method2(int temp[]) {\r\n\r\n\t\tMap<Integer, Integer> map = new HashMap<Integer, Integer>();\r\n\r\n\t\tfor (int i = 0; i < temp.length; i++) {\r\n\t\t\tif (map.containsKey(temp[i])) {\r\n\t\t\t\tmap.put(temp[i], map.get(temp[i]) + 1);\r\n\t\t\t} else {\r\n\t\t\t\tmap.put(temp[i], 1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tIterator<Entry<Integer, Integer>> it = map.entrySet().iterator();\r\n\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tEntry<Integer, Integer> entry = it.next();\r\n\t\t\tint key = entry.getKey();\r\n\t\t\tint count = entry.getValue();\r\n\r\n\t\t\tif ((count % 2) != 0) {\r\n\t\t\t\treturn key;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\treturn -1;\r\n\t}", "public int[] twoSum(int[] nums, int target) {\n Map<Integer, Integer> temp = new HashMap<>();\n int sub;\n //loop the int array\n for(int i=0, len=nums.length; i<len; i++){\n //calculate the sub value\n sub = target - nums[i];\n if(temp.containsKey(sub)){ // if the map contains the sub value, then return the index value into new int array\n return new int[]{temp.get(sub), i};\n }\n //if the map not contains the sub values, then store data into map\n temp.put(nums[i], i);\n }\n return new int[]{};\n }", "public abstract int[] getInts(int paramInt1, int paramInt2, int paramInt3, int paramInt4);", "abstract int[] crossOver();", "private static int[] merge(int array1[], int array2[]) {\n\n\t\tint totalNumbers = array1.length + array2.length;\n\t\tint mergedArray[] = new int[totalNumbers];\n\n\t\tint pointerInArray1 = 0, pointerInArray2 = 0;\n\n\t\tfor (int i = 0; i < totalNumbers; i++) {\n\t\t\tif (pointerInArray1 >= array1.length) {\n\t\t\t\tmergedArray[i] = array2[pointerInArray2++];\n\t\t\t} else if (pointerInArray2 >= array2.length) {\n\t\t\t\tmergedArray[i] = array1[pointerInArray1++];\n\t\t\t} else if (array1[pointerInArray1] < array2[pointerInArray2]) {\n\t\t\t\tmergedArray[i] = array1[pointerInArray1++];\n\t\t\t} else {\n\t\t\t\tmergedArray[i] = array2[pointerInArray2++];\n\t\t\t}\n\t\t}\n\n\t\treturn mergedArray;\n\t}", "private static final int[] getPoint(int point) {\n int[] ret = new int[2];\n if (point >= firstPoint && point <= endPoint) {\n ret = getPoint(ruteData[point + 2]);//ruteData[point + 2]);\n }\n return ret;\n }", "public int[] twoSum(int[] numbers, int target) {\n int output [] = new int [2];\n for(int i = 0; i < numbers.length; i++){\n for(int j = 0; j < numbers.length; j++){\n if(i == j) continue;\n if (numbers[i] + numbers[j] == target){\n output[0] = i+1;\n output[1] = j+1;\n return output;\n }\n }\n }\n return null;\n \n }", "int getOtherIds(int index);", "private static int[] merge( int[] a, int[] b ) \n { \n\tint[] retArr = new int[a.length + b.length];\n\tint aCounter = 0;\n\tint bCounter = 0;\n\tint index = 0;\n while (aCounter < a.length && bCounter < b.length){\n\t if (a[aCounter] < b[bCounter]){\n\t\tretArr[index] = a[aCounter];\n\t\tindex++;\n\t\taCounter++;\n\t }\n\t else {\n\t\tretArr[index] = b[bCounter];\n\t\tindex++;\n\t\tbCounter++;\n\t }\n\t}\n\tif (aCounter < a.length){\n\t for (int x = aCounter; x < a.length; x++){\n\t\tretArr[index] = a[x];\n\t\tindex++;\n\t }\n\t}\n\telse if (bCounter < b.length){\n\t for (int x = bCounter; x < b.length; x++){\n\t\tretArr[index] = b[x];\n\t\tindex++;\n\t }\n\t}\n\tprintArray(retArr);\n\tSystem.out.println();\n\treturn retArr;\n }", "public static List<int[]> getArrays( int start, int end )\n {\n ArrayList<int[]> arrays = new ArrayList<int[]>( );\n for (int i = start; i <= end; i++ )\n {\n int[] arr = new int[1];\n arr[0] = i;\n arrays.add( arr );\n }\n \n return arrays;\n }", "public static int[] merge_v2(int[] arr1, int[] arr2) {\n\t\tif ((arr1 == null || arr1.length == 0) && (arr2 == null || arr2.length == 0)) {\n\t\t\treturn null;\n\t\t} else if (arr1 == null || arr1.length == 0) {\n\t\t\treturn Arrays.copyOf(arr2, arr2.length);\n\t\t} else if (arr2 == null || arr2.length == 0) {\n\t\t\treturn Arrays.copyOf(arr1, arr1.length);\n\t\t}\n\n\t\t// assuming arr1 and arr2 are null\n\t\tint pointer1 = 0;\n\t\tint pointer2 = 0;\n\t\tint[] result = new int[arr1.length + arr2.length];\n\n\t\tfor (int i = 0; i < result.length; i++) {\n\n\t\t\tif (pointer2 > arr2.length - 1) {\n\t\t\t\tresult[i] = arr1[pointer1];\n\t\t\t\tpointer1++;\n\t\t\t} else if ((pointer1 > arr1.length - 1) || (arr1[pointer1] > arr2[pointer2])) {\n\t\t\t\tresult[i] = arr2[pointer2];\n\t\t\t\tpointer2++;\n\t\t\t} else {\n\t\t\t\tresult[i] = arr1[pointer1];\n\t\t\t\tpointer1++;\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}", "private static List<Integer> getCommonElementsAlgo2(int [] arr1, int [] arr2) {\n\t\t\n\t\tList<Integer> duplicates = new ArrayList<>();\n\t\t\n\t\tHashtable<Integer, Integer> table = new Hashtable<>();\n\t\t\n\t\tfor (int i : arr1) {\n\t\t\tif (table.containsKey(i)) {\n\t\t\t\ttable.put(i, table.get(i) + 1);\n\t\t\t}\n\t\t\ttable.put(i, 1);\n\t\t}\n\t\t\n\t\tfor (int j : arr2) {\n\t\t\tif (table.containsKey(j)) {\n\t\t\t\tduplicates.add(j);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn duplicates;\n\t\t\n\t}", "public int[] twoSum2(int[] numbers, int target) {\n HashMap<Integer, Integer> hm = new HashMap<>();\n int[] result = null;\n for (int i = 0; i < numbers.length; i++) {\n if (hm.containsKey(target - numbers[i])) {\n int j = hm.get(target - numbers[i]);\n if (i != j) {\n result = new int[] {j + 1, i + 1};\n return result;\n }\n }\n hm.put(numbers[i], i);\n }\n return result;\n }", "public int[] numbers();", "public int[] reverseEvenIndices(int[] nums) { // score 6\n\n if (nums == null || nums.length == 0) {\n return null;\n }\n\n int start = 0;\n int end = nums.length - 1;\n\n if (end % 2 == 1) {\n end--;\n }\n\n while (start <= end) {\n if (start % 2 == 0 && end % 2 == 0) {\n swap(nums, start, end);\n }\n start++;\n end--;\n }\n return nums;\n }", "public void getTwoElements(int arr[], int n) {\r\n\t\t/*\r\n\t\t * Will hold xor of all elements and numbers from 1 to n\r\n\t\t */\r\n\t\tint xor1;\r\n\r\n\t\t/* Will have only single set bit of xor1 */\r\n\t\tint set_bit_no;\r\n\r\n\t\tint i, x = 0, y = 0;\r\n\r\n\t\txor1 = arr[0];\r\n\r\n\t\t/* Get the xor of all array elements */\r\n\t\tfor (i = 1; i < n; i++)\r\n\t\t\txor1 = xor1 ^ arr[i];\r\n\r\n\t\t/*\r\n\t\t * XOR the previous result with numbers from 1 to n\r\n\t\t */\r\n\t\tfor (i = 1; i <= n; i++)\r\n\t\t\txor1 = xor1 ^ i;\r\n\r\n\t\t/* Get the rightmost set bit in set_bit_no */\r\n\t\tset_bit_no = xor1 & ~(xor1 - 1);\r\n\r\n\t\t/*\r\n\t\t * Now divide elements in two sets by comparing rightmost set bit of xor1 with bit at same position in each\r\n\t\t * element. Also, get XORs of two sets. The two XORs are the output elements.The following two for loops serve\r\n\t\t * the purpose\r\n\t\t */\r\n\t\tfor (i = 0; i < n; i++) {\r\n\t\t\tif ((arr[i] & set_bit_no) != 0)\r\n\t\t\t\t/* arr[i] belongs to first set */\r\n\t\t\t\tx = x ^ arr[i];\r\n\r\n\t\t\telse\r\n\t\t\t\t/* arr[i] belongs to second set */\r\n\t\t\t\ty = y ^ arr[i];\r\n\t\t}\r\n\t\tfor (i = 1; i <= n; i++) {\r\n\t\t\tif ((i & set_bit_no) != 0)\r\n\t\t\t\t/* i belongs to first set */\r\n\t\t\t\tx = x ^ i;\r\n\r\n\t\t\telse\r\n\t\t\t\t/* i belongs to second set */\r\n\t\t\t\ty = y ^ i;\r\n\t\t}\r\n\r\n\t\t/* *x and *y hold the desired output elements */\r\n\t}", "public static int[] mergeArrays(int[] a1, int[] a2) {\n if (a1 == null || a1.length == 0) {\n if (a2 == null || a2.length == 0) {\n return new int[0];\n }\n return a2;\n }\n if (a2 == null || a2.length == 0) {\n return a1;\n }\n\n // Теперь работаем с массивами, где есть хотя бы 1 элемент.\n int[] a3 = new int[a1.length + a2.length];\n for (int index1 = 0, index2 = 0, index3 = 0; index3 < a3.length; ) {\n int minValue = a1[index1] < a2[index2] ? a1[index1] : a2[index2];\n // Работаем с первым массивом\n while (index1 < a1.length && minValue == a1[index1]) {\n a3[index3++] = a1[index1++];\n }\n if (index1 == a1.length) {\n // Первый массив закончился, сливаем хвост второго\n while (index2 < a2.length && index3 < a3.length) {\n a3[index3++] = a2[index2++];\n }\n return a3;\n }\n // Работаем со вторым массивом\n while (index2 < a2.length && minValue == a2[index2]) {\n a3[index3++] = a2[index2++];\n }\n if (index2 == a2.length) {\n // Второй массив закончился, сливаем хвост первого массива\n while (index1 < a1.length && index3 < a3.length) {\n a3[index3++] = a1[index1++];\n }\n return a3;\n }\n }\n return a3;\n }", "public int [] getResultArr() {\n return maskResultArray;\n }", "public int get_odd_occurences_optimal_v2(int[] a) {\n\t\tint result = 0;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tresult ^= i;\n\t\t}\n\t\treturn result;\n\t}", "@Test\n @IncludeIn(POSTGRESQL)\n public void array2() {\n Expression<int[]> expr = Expressions.template(int[].class, \"'{1,2,3}'::int[]\");\n int[] result = firstResult(expr);\n Assert.assertEquals(3, result.length);\n Assert.assertEquals(1, result[0]);\n Assert.assertEquals(2, result[1]);\n Assert.assertEquals(3, result[2]);\n }", "public static int[] reduce (int []n1) {\n\t\tfor (int i = 0; i < n1.length; i++) {\n\t\t\tif (n1[i] != 0) {\n\t\t\t\tif (i == 0) return copy(n1);\n\t\t\t\t\n\t\t\t\tint []newVal = new int[n1.length-i];\n\t\t\t\textract(newVal,0,n1,i,n1.length-i);\n\t\t\t\treturn newVal;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// just zero.\n\t\treturn new int[]{0};\n\t}", "public static void main(String[] args) {\n\t\tint [] array = {12, 45, 78, 60};\n\t\t\n\t\tint [] array2 = new int [array.length];\n\n\t\tfor(int i = 0; i < array.length; i++) {\n\t\t\tarray2[i] = array [i];\n\t\t\tSystem.out.print(array2[i] + (i == array.length - 1 ? \" \" : \", \"));\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tint [] firstArray = {3, 45, 78, 80}; // 0,1,2,3,\n\t\tint [] secondArray = {10, 8, 9, 50}; // 4,5,6,7;\n\t\t\n\t\tint [] thirdArray = new int [firstArray.length + secondArray.length];\n\t\t\n\t\tfor(int i = 0; i < thirdArray.length; i++) {\n\t\t\tif(i < firstArray.length) {\n\t\t\t\tthirdArray [i] = firstArray [i];\n\t\t\t} else {\n\t\t\t\tthirdArray [i] = secondArray [i - firstArray.length];\n\t\t\t}\n\t\t\tSystem.out.print(thirdArray[i] + (i == thirdArray.length - 1 ? \" \" : \", \"));\n\t\t}\n\t}", "public int[] twoSum(int[] nums, int target) {\n int max = nums[0];\n int min = max;\n // get rank\n for (int e : nums) {\n if (e > max) {\n max = e;\n }\n if (e < min) {\n min = e;\n }\n }\n // show up table\n Integer[] showUpMap = new Integer[max - min + 1];\n Integer[] indicesMap = new Integer[max - min + 1];\n for (int i = 0; i < nums.length; i++) {\n showUpMap[nums[i] - min] = 1;\n indicesMap[nums[i] - min] = i;\n }\n for (int i = 0; i < showUpMap.length; i++) {\n boolean show = showUpMap[i] == 1;\n if (show) {\n int a = i + min;\n int need = target - a;\n if (showUpMap[need - min] == 1) {\n return new int[] {indicesMap[i], indicesMap[need - min]};\n }\n }\n }\n return null;\n }", "public static int[] merge(int[] arr1, int[] arr2) {\n int[] arr = new int[arr1.length * 2];\n int count1 = 0;\n int count2 = 0;\n while (count1 + count2 < arr.length) {\n if (count2 == arr2.length) {\n arr[count1+count2] = arr1[count1];\n count1++;\n } else if (count1 == arr1.length) {\n arr[count2+count1] = arr2[count2];\n count2++;\n } else {\n if (arr1[count1] < arr2[count2]) {\n arr[count1+count2] = arr1[count1];\n count1++;\n } else {\n arr[count1+count2] = arr2[count2];\n count2++;\n }\n }\n }\n return arr;\n }", "@ZenCodeType.Caster\n @ZenCodeType.Method\n default int[] asIntArray() {\n \n return notSupportedCast(\"int[]\");\n }", "public static void main(String[] args){\n int[] a = new int[10];\n for(int i = 0; i < a.length; i++){\n a[i] = i;\n }\n\n int[] b = new int[a.length];\n\n for(int i=1; i <= b.length; i++){\n b[i-1] = a[a.length-1-i];\n }\n\n System.out.println(b);\n }", "static int[] mergeTwoSortedArrays(int a1[],int m,int a2[] ,int n)\r\n {\r\n int arr[]=new int[a1.length+a2.length];\r\n int i=0,j=0,k=0;\r\n while(i<m && j<n)\r\n {\r\n if(a1[i]<a2[j])\r\n {\r\n arr[k]=a1[i];\r\n i++;\r\n k++;\r\n }\r\n else\r\n {\r\n arr[k]=a2[j];\r\n j++;\r\n k++;\r\n }\r\n }\r\n while(i<m)\r\n {\r\n arr[k]=a1[i];\r\n i++;\r\n k++;\r\n }\r\n \r\n\r\n while(j<n)\r\n {\r\n arr[k]=a2[j];\r\n j++;\r\n k++;\r\n }\r\n \r\n System.out.println(i+\" \"+ j);\r\n return arr;\r\n }", "void findLeadrsInArray2(int[] a){\n\t\tint n = a.length;\n\t\tSystem.out.println(a[n-1]);\n\t\tint max = a[n-1];\n\t\tfor(int i = n-2; i>=0 ; i--){\n\t\t\tif(a[i] < max){\n\t\t\t\tmax = a[i];\n\t\t\t\tSystem.out.println(a[i]);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}", "public static int[] twoSum(int[] numbers, int target) {\n // Start typing your Java solution below\n // DO NOT write main() function\n int[] aux = new int[numbers.length];\n HashMap<Integer, Integer> valueToIndex = new HashMap<Integer, Integer>();\n for (int i = 0; i < numbers.length; i++) {\n valueToIndex.put(numbers[i], i);\n aux[i] = numbers[i];\n }\n \n int i = 0, j = numbers.length - 1;\n boolean found = false;\n \n Arrays.sort(aux);\n \n while (i != j) {\n if (aux[i] + aux[j] < target) i++;\n else if (aux[i] + aux[j] > target) j--;\n else {\n found = true;\n break;\n }\n }\n \n if (!found) return null;\n \n int[] result = new int[2];\n if (aux[i] == aux[j]) { /* Handle duplicates */\n int first = -1, second = -1;\n for (int k = 0; k < numbers.length; k++) {\n if (numbers[k] == aux[i]) {\n if (first == -1) {\n first = k;\n } else if (second == -1) {\n second = k;\n break;\n }\n }\n }\n result[0] = first + 1;\n result[1] = second + 1;\n return result;\n }\n \n \n if (valueToIndex.get(aux[i]) < valueToIndex.get(aux[j])) {\n result[0] = valueToIndex.get(aux[i]) + 1;\n result[1] = valueToIndex.get(aux[j]) + 1;\n } else {\n result[0] = valueToIndex.get(aux[j]) + 1;\n result[1] = valueToIndex.get(aux[i]) + 1;\n }\n return result;\n }", "public static void main(String[] args) {\n\t\t\r\n\t\tint[] arr1 = {2,4,6,8,10,12,13};\r\n\t\tint[] arr2 = {2,4,6,8,10,12};\r\n\t int n = arr2.length;\r\n\t \r\n\t System.out.println(\"Index is: \" + find(arr1, arr2, n));\r\n\r\n\t}", "public static int[] getIDs() {\n int[] res = new int[crossbows.length];\n for (int i = 0; i < crossbows.length; i++) {\n res[i] = (int)crossbows[i][0];\n }\n return res;\n }", "static int[] sortArray(int[] array) {\n if (array.length == 0) {\n return array;\n }\n\n //transform the array in a list which, in the end will hold sorted odds\n List<Integer> myList = new ArrayList<>(array.length);\n for (int i : array) {\n myList.add(i);\n }\n\n //i need a hash map for the evens so i can store them and their indexes\n Map<Integer, Integer> evensIndexes = new HashMap<>();\n //i need a new array to hold the result\n int[] result = new int[array.length];\n\n //put evens and their indexes in the hash map\n for (int i = 0; i < array.length; i++) {\n for (Integer x : myList) {\n if (x % 2 == 0 && x.equals(array[i])) {\n evensIndexes.put(i, x);\n }\n }\n }\n\n System.out.println(\"evensIndexes \" + evensIndexes);\n\n //sort the list and remove evens\n myList.sort(Integer::compareTo);\n\n for (Integer i : evensIndexes.values()) {\n myList.remove(i);\n }\n\n //put evens from the hash map into the result array\n for (int i = 0; i < result.length; i++) {\n for (Map.Entry<Integer, Integer> set : evensIndexes.entrySet()) {\n if (i == set.getKey()) {\n result[i] = set.getValue();\n break;\n }\n }\n }\n\n System.out.println(\"result after evens added \" + Arrays.toString(result));\n\n //use an iterator to get odd values from the list and add them in the result array\n Iterator<Integer> odd = myList.iterator();\n\n for (int i = 0; i < result.length; i++) {\n if (result[i] == 0 && array[i] != 0) {\n while (odd.hasNext()) {\n result[i] = odd.next();\n odd.remove();\n break;\n }\n }\n }\n\n return result;\n\n }", "@Override\n\t\t\tpublic int compare(int[] o1, int[] o2) {\n\t\t\t\treturn 0;\n\t\t\t}", "protected int[] readIntArray(BinaryDataReader dataReader) throws IOException\n\t{\n\t\tlong offset = ((long) this.value) & 0xffffffffL;\n\n\t\t// allocate memory for result\n\t\tint[] res = new int[this.count];\n\n\t\t// save pointer location\n\t\tlong saveLoc = dataReader.getFilePointer();\n\n\t\t// fill up array\n\t\tdataReader.seek(offset);\n\t\tfor (int c = 0; c < this.count; c++)\n\t\t{\n\t\t\tres[c] = dataReader.readInt();\n\t\t}\n\t\t\n\t\t// restore pointer and return result\n\t\tdataReader.seek(saveLoc);\n\t\treturn res;\n\t}", "int[] mo12208a(int i);", "private static int findDuplicateIdeaTwo(int[] array) {\n\t\tArrays.sort(array);\n\t\tfor (int i = 0; i < (array.length-1); i++) {\n\t\t\tif (array[i]==array[i+1]) {\n\t\t\t\treturn array[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"Not Found\");\n\t\treturn -1;\n\t}", "public static List<int[]> getArrays( List<int[]> inputs, int end ) {\n ArrayList<int[]> arrays = new ArrayList<int[]>( );\n for (int[] stArr : inputs)\n {\n if (stArr[stArr.length-1] < end )\n {\n List<int[]> newArrays = getArrays( stArr, end );\n arrays.addAll( newArrays );\n }\n }\n \n return arrays;\n }", "public int[] intersect(int[] nums1, int[] nums2) {\n if(nums2.length > nums1.length) return intersect(nums2,nums1);\n\n\n Map<Integer,Integer> hash = new HashMap<>();\n\n\n for(int j=0; j<nums1.length;j++){\n\n if(hash.containsKey(nums1[j])) hash.put(nums1[j], hash.get(nums1[j]) + 1);\n else hash.put(nums1[j], 1);\n\n }\n\n List<Integer> intersection = new ArrayList<>();\n\n for(int k=0;k<nums2.length;k++){\n\n int count = hash.getOrDefault(nums2[k],0);\n\n if(count > 0){\n intersection.add(nums2[k]);\n hash.put(nums2[k], hash.get(nums2[k]) - 1);\n }\n }\n\n\n int[] result = new int[intersection.size()];\n int count = 0;\n\n for(Integer i:intersection){\n result[count] = i;\n count++;\n }\n\n\n return result;\n\n\n }", "static public int[] toArray(IntArray array){\r\n final int[] result = new int[array.getLength()];\r\n for (int i = 0; i < array.getLength(); i++) {\r\n result[i] = array.getData(i);\r\n }\r\n return result;\r\n }", "public static List<int[]> getArrays( int[] arr, int end )\n {\n ArrayList<int[]> arrays = new ArrayList<int[]>( );\n int last = arr[ arr.length - 1 ];\n\n for (int lastVal = last + 1; lastVal <= end; lastVal++ )\n {\n int[] newArray = new int[ arr.length + 1 ];\n System.arraycopy( arr, 0, newArray, 0, arr.length );\n newArray[ arr.length ] = lastVal;\n arrays.add( newArray );\n }\n \n return arrays;\n }", "public static int[] twoSum(int[] nums, int target) {\n HashMap<Integer, Integer> map = new HashMap<>();\n\n //initialize map with first entry of array\n int[] resultPair = {0,0};\n map.put(nums[0], 0);\n int index = 1;\n\n while (index < nums.length) {\n\n int complement = target - nums[index];\n if(map.containsKey(complement)) {\n resultPair[0] = map.get(complement);\n resultPair[1] = index;\n }\n\n map.put(nums[index], index);\n index++;\n }\n return resultPair;\n }", "public static int[] volteaArrayInt(int array[]) {\n int aux[] = new int[array.length];\n int cont = aux.length;\n for (int n : array) {\n aux[--cont] = n;\n }\n return aux;\n }", "public int[] toIntArray(){\n int[] array = new int[getSeq().size()];\n for (int i = 0; i < array.length; i++) {\n char c = Character.toUpperCase(getSeq().get(i));\n array[i] = Sequence.convert(c);\n }\n return array;\n }", "public static void main(String[] args) {\n\t\tint []arr1= {12,13,44};\r\n\t\tint []arr2= {44,45,47,50};\r\n\t\tint i,j;\r\n\t\tint count=0;\r\n\t\t\r\n\t\tint []merge=new int[arr1.length+arr2.length];\r\n\t\tfor(i=0;i<arr1.length;i++)\r\n\t\t{\r\n\t\t\tmerge[i]=arr1[i];\r\n\t\t\tcount++;\r\n\t\t}\r\n\t\t\tfor(i=0;i<arr2.length;i++)\r\n\t\t\t{\r\n\t\t\t\tmerge[count++]=arr2[i];\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tfor(i=0;i<merge.length;i++)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\" \" +merge[i]);\r\n\t\t\t}\r\n\t\t\r\n\r\n\t}" ]
[ "0.6856582", "0.6787082", "0.67004085", "0.66918", "0.6559547", "0.6379492", "0.63710386", "0.6364984", "0.621051", "0.6200098", "0.61859757", "0.6184905", "0.6183265", "0.6176095", "0.6136535", "0.6111022", "0.60868824", "0.60861325", "0.604685", "0.6021218", "0.6017415", "0.600285", "0.59902245", "0.59748846", "0.59713274", "0.59666413", "0.59586275", "0.59580123", "0.5946954", "0.59443367", "0.5919291", "0.59147704", "0.58841133", "0.58766216", "0.58679897", "0.5862966", "0.58589923", "0.5858592", "0.5851052", "0.58410484", "0.58409405", "0.5838924", "0.5835877", "0.58329654", "0.58254683", "0.5822371", "0.5816252", "0.58128786", "0.5809659", "0.5803565", "0.5796124", "0.5794573", "0.57917595", "0.579153", "0.57854843", "0.57818687", "0.57816577", "0.5779868", "0.5777675", "0.5774638", "0.5763096", "0.57596576", "0.57560116", "0.5752218", "0.5748932", "0.57441974", "0.5730125", "0.5729539", "0.5720004", "0.5719729", "0.57138205", "0.57117325", "0.56910557", "0.56884605", "0.5687081", "0.567166", "0.5670845", "0.5670016", "0.566696", "0.56626034", "0.56605417", "0.5656924", "0.56545746", "0.56485176", "0.5646819", "0.5642126", "0.56406575", "0.5640446", "0.56346434", "0.56342983", "0.5632322", "0.5630651", "0.5629819", "0.5629123", "0.5628887", "0.56230366", "0.5622309", "0.56221795", "0.5618107", "0.56167126", "0.56161225" ]
0.0
-1
Initialize the population to a given size.
public void initPop(int num) { if (num % 2 == 1) { num -= 1; } this.individuals = new AI[num]; for (int i = 0; i < num; i++) this.individuals[i] = new AI(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void initialize(int size);", "public void initialize(int size) {\n setMaxSize(size);\n }", "protected Population<T, K> initializePopulation(int size, Class<K> clazz)\n\t\t\tthrows InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {\n\t\tPopulation<T, K> pop = new Population<>(size, fitnessCalc);\n\t\tpop.initialize(clazz);\n\t\treturn pop;\n\t}", "private void initializePopulation() {\n // reset the population\n population = new ArrayList<Genotype>();\n\n // set the population to an array of random genotypes\n for (int i = 0; i < populationSize; i++) {\n population.add(new Genotype(chromosomeSize));\n }\n\n // evaluate the population\n // evaluatePopulation();\n }", "public void initializePopulation(){\n\t\t// create the population\n\t\tfor(int i = 0; i < POPULATION_SIZE; i++){\n\t\t\t// get a random length for the building sequence\n\t\t\tint randArraySize = randomGenerator.nextInt(possiblePieces.length-1)+1;\n\t\t\t\n\t\t\tBuildingPiece[] pieceSequence = new BuildingPiece[randArraySize];\n\t\t\tfor(int j = 0; j < randArraySize; j++){\n\t\t\t\t// get a random possible piece and insert it into the sequence\n\t\t\t\tint randIndex = randomGenerator.nextInt(possiblePieces.length);\n\t\t\t\tpieceSequence[j] = possiblePieces[randIndex];\n\t\t\t}\n\t\t\t\n\t\t\t/* add a new number sequence with the newly created \n\t\t\t * sequence from the input */\n\t\t\tpopulation.add(new Building(pieceSequence, generation, possiblePieces));\n\t\t}\n\t}", "public void setPopSize(int i){\n if (i < 2){\n throw new IllegalArgumentException(\"The population size must be at least 2.\");\n }\n if (i < randGenes){\n throw new IllegalArgumentException(\"The population size must be greater than the number of random genes per generation.\");\n }\n populationSize = i;\n }", "SolutionPopulation initialise(ArrayList<City> cities, int populationSize);", "void init(int size) {\n int numOfElements = size / MAX_BITS;\n if (size % MAX_BITS > 0)\n numOfElements++;\n\n values = new long[numOfElements];\n }", "public void setPopulationSize(int m){\n\t\tsetParameters(m, type1Size, sampleSize);\n\t}", "@Override\r\n\tpublic void initialize() {\n\t\tRandom randomGenerator = new Random();\r\n\t\tthis.size = Helper.getRandomInRange(1, 9, randomGenerator);\r\n\t\tif (this.size % 2 == 0)\r\n\t\t\tthis.size--;\r\n\t}", "public Population(int size, ArrayList<Individual> KIS){\n this.size = size;\n this.individuals = KIS;\n }", "protected void initializePopulation () {\n\t\tfor (int i = 0; i < this.speciesSize; i++) {\n\t\t\tthis.detectors.add(DetectorFactory.makeDetector(this.featuresLength, this.typeBias, this.generalityBias));\n\t\t}\n\t}", "public population(int size, boolean initial) {\n tours = new tour[size];\n for (int i = 0; i < tours.length; i++) {\n\t tour newTour = new tour();\n newTour.path();\n savetour(i, newTour);\n }\n }", "private void initWithSize(int size) {\r\n this.size = size;\r\n if (size == 0) {\r\n size = 1; //Prevents memory allocation problem on GPU\r\n }\r\n\r\n normalX = new double[size];\r\n normalY = new double[size];\r\n normalZ = new double[size];\r\n\r\n vertexAX = new double[size];\r\n vertexAY = new double[size];\r\n vertexAZ = new double[size];\r\n\r\n edgeBAX = new double[size];\r\n edgeBAY = new double[size];\r\n edgeBAZ = new double[size];\r\n\r\n edgeCAX = new double[size];\r\n edgeCAY = new double[size];\r\n edgeCAZ = new double[size];\r\n\r\n centerX = new double[size];\r\n centerY = new double[size];\r\n centerZ = new double[size];\r\n\r\n area = new double[size];\r\n }", "public void setSize(int size) {\n\t members = size;\n\t}", "public int getPopulationSize(){\n\t\treturn populationSize;\n\t}", "private void set_size(int size)\r\n\t{\r\n\t\tthis.size = size;\r\n\t}", "public void setSize(Integer size) {\n this.size = size;\n }", "void assignSize (int size) {\n array = new int[size];\n }", "public static LinkedHashMap<BitVector, Double> initializePopulation(int bitVectorSize) {\r\n\r\n\t\tLinkedHashMap<BitVector, Double> population = new LinkedHashMap<>();\r\n\r\n\t\twhile (population.size() < (minPopSize + maxPopSize) / 2) {\r\n\t\t\tBitVector b = new BitVector(bitVectorSize);\r\n\t\t\tb.randomize(rand);\r\n\t\t\tpopulation.put(b, function.valueAt(b));\r\n\t\t}\r\n\r\n\t\treturn population;\r\n\t}", "public Board(int size) {\n initialize(size, null);\n }", "private int[][] generateInitialPopulation(int binCt, int binSize, int pkgCt, int populationSize) {\n\t\tint[][] population = new int[populationSize][pkgCt];\n\t\tfor (int i = 0; i < populationSize; i++) {\n\t\t\tfor (int j = 0; j < pkgCt; j++) {\n\t\t\t\tpopulation[i][j] = rand.nextInt(binCt);\n\t\t\t}\n\t\t}\n\t\treturn population;\n\t}", "@Override protected List<String> initialize(int size){\n container.clear();\n container.addAll(Arrays.asList(Generated.array(String.class, new RandomGenerator.String(), size)));\n return container;\n }", "public void initialize() {\n grow(0);\n }", "public void initialiseNewRandomPopulation(Random rnd) {\n\t\tthis.population = new ArrayList<Individual>();\n\t\tfor (int i = 0; i < this.popSize; i++) {\t\t\t\t\t//FOR ALL DESIRED POPULATION SIZE\n\t\t\tdouble[] randomValues = new double[DIMENSIONS];\t\t\t//INITIATE RANDOM X ARRAY WITH CORRECT DIMENSIONS\n\t\t\tfor (int j = 0; j < DIMENSIONS; j++) {\t\t\t\t\t//CREATE RANDOM X VALUES\n\t\t\t\trandomValues[j] = -5 + rnd.nextDouble() * 10;\t\t//ASSIGN VALUES TO EACH POSITION IN ARRAY\n\t\t\t}\n\t\t\tIndividual newInd = new Individual(randomValues);\t\t//CREATE NEW INDIVIDUAL WITH RANDOM X VALUES\n\t\t\tthis.population.add(newInd);\t\t\t\t\t\t\t//ADD INDIVIDUAL TO POPULATION\n\t\t}\n\t}", "public void setSize(int size){\n this.size = size;\n }", "public void setSize(int size) {\r\n this.size = size;\r\n }", "public void setSize(int size) {\r\n _size = size;\r\n }", "public void setSize(int size) {\n this.size = size;\n }", "public void setSize(int size) {\n this.size = size;\n }", "public void setSize(int size) {\n\t\tthis.size = size;\n\t}", "public void setSize(int size) {\n\t\tthis.size = size;\n\t}", "public void setSize(int size) {\n\t\tthis.size = size;\n\t}", "public void setSize(int size) {\n\t\tthis.size = size;\n\t}", "public void setSize(int size) {\n\t\tdist = new double[size];\n\t\tprev = new Node[size];\n\t\tready = new boolean[size];\n\t}", "public Board(int size, Piece[][] initConfig) {\n initialize(size, initConfig);\n }", "public void setSize(int size) {\n\t\t _size = size;\n\t}", "public Stack(int size) {\n stack = new Object[size];\n minStackSize = size;\n top = -1;\n }", "public void setSize(int size) {\n this.size = size;\n }", "public FeasibleInitialization(Problem problem, int populationSize) {\r\n super(problem, populationSize);\r\n }", "public ShoeInventory(int size)\r\n\t{\r\n\t\tif(size == 0)\r\n\t\t\tSystem.out.println(\"Cannot set array to size 0.\"); \r\n\t\telse\r\n\t\t{\r\n\t\t\tcounter = 0;\r\n\t\t\tarraySize = size;\r\n\t\t\ttypeArray = new ShoeType[arraySize];\r\n\t\t}\r\n\t}", "public stackTesting(int size){\n\t\tMaxSize = size;\n\t\tStack = new int[MaxSize];\n\t\tStackTop = -1;\n\t}", "public IntPriorityQueue(int size) {\n initialize(size);\n }", "public Population(int populationSize, boolean initialize, boolean selfCreation) {\r\n\t tours = new Tour[populationSize]; \r\n\t if (initialize) {\t\r\n\t \tif(selfCreation==false) {\r\n\t\t \tfor (int i = 0; i < populationSize; i++) {\t\t\t\t \r\n\t\t Tour newTour = new Tour();\r\n\t\t newTour.generateIndividual();\r\n\t\t saveTour(i, newTour);\t\t\t\t\t\t\t\t\t \r\n\t\t }\r\n\t \t}\r\n\t \telse {\r\n\t \t\tString path=\"C:\\\\Users\\\\BADai\\\\git\\\\BachelorThesis\\\\BA\\\\src\\\\Tour.txt\";\r\n\t \t\treadFile rf = new readFile();\r\n\t \t\tTour t= new Tour(rf.readTour(path));\r\n\t \t\tsaveTour(0,t);\r\n\t \t\tfor(int a=0; a<t.tourSize();a++) {\r\n\t \t\t\tAll_Cities.addCity(t.getCity(a));\r\n\t \t\t}\r\n\t \t\tD_Matrix.startCity=All_Cities.getCity(0);\r\n\t \t}\r\n\t }\r\n\t\r\n\t }", "public AgileSet(double initialCurrentSize) {\n currentSize = initialCurrentSize;\n }", "public static void setHotelSize(int size) {\r\n\t\tfor(int count = 0;count< size; count++) {\r\n\t\t\thotel_size.add(count + 1);\r\n\t\t}\r\n\t}", "public TSPChromosome(int size) {\t\n\t\tfor(int g=0; g<size; g++){\n\t\t\tgenes.add(new Integer(-1));\n\t\t}\n\t\tinit();\n\t}", "public void setSize(int _size)\r\n {\r\n size = _size;\r\n }", "public void setSize(int size){\n n = size;\n //makes new array and changes the toSort array\n randomArray(n);\n toSort = origArray.clone();\n }", "public CellQueue(int size) {\n\t\tif (size <= 0) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Initial size must be greater than 0\");\n\t\t}\n\t\tmanyItems = 0;\n\t\tdata = new Cell[size];\n\t}", "public void setToInitialState(int dimension, int numberOfEmptySlots);", "public MyStack(int size) {\n\t\ttopNode = null;\n\t\tMAX_SIZE = size;\n\t\tnodeCount = 0;\n\t}", "BigONotation(int size) {\n\t\tarraySize = size;\n\t\ttheArray = new int[size];\n\t}", "void init() {\r\n \tfor (int i=0; i<SIZE; i++) {\r\n \t\tfor (int j=0; j<LEN; j++) {\r\n \t\t\tif (rnd.nextDouble() < 0.5)\r\n \t\t\t\toldpop[i][j] = 0;\r\n \t\t\telse\r\n \t\t\t\toldpop[i][j] = 1;\r\n \t\t}\r\n \t}\r\n \tfor (int j=0; j<LEN; j++) {\r\n \t\tcbest[j] = oldpop[0][j];\r\n \t}\r\n\t\tbest = fitness(0);\r\n }", "public void genPopulation(int howMany)\r\n/* 30: */ {\r\n/* 31:54 */ this.pop.removeAllElements();\r\n/* 32:55 */ for (int i = 0; i < howMany; i++)\r\n/* 33: */ {\r\n/* 34:61 */ int[] clusterV = g.genRandomClusterSize();\r\n/* 35:62 */ Cluster c = new Cluster(g, clusterV);\r\n/* 36:63 */ this.pop.addElement(c);\r\n/* 37: */ }\r\n/* 38: */ }", "public Population(int capacity) {\r\n Validate.positive(capacity, \"capacity\");\r\n this.capacity = capacity;\r\n }", "public MySet(int size) {\n table = (HashNode<E>[]) new HashNode[size];\n }", "public void setSize(int size);", "public void initializeComboSize() {\n\t\tsizeOptions.clear();\n\t\tfor (int i = 0; i < restaurant.getSizes().size(); i++) {\n\t\t\tif (restaurant.getSizes().get(i) != null) {\n\t\t\t\tsizeOptions.add(restaurant.getSizes().get(i));\n\t\t\t}\n\t\t}\n\t\tComboSize.setItems(sizeOptions);\n\t}", "public IntegerList(int size)\n {\n list = new int[size];\n }", "public ArrayList<Population> InitializePopulations (int NumberOfPopulations, int NumberOfAgents){\n \n ArrayList<Population> PopulationsList = new ArrayList();\n \n if(NumberOfPopulations == 1){\n \n PopulationsList.add(InitSinglePopulation(NumberOfAgents));\n \n }else{\n \n for(int i = 0; i < NumberOfPopulations; i++){ \n double temp = rand.nextDouble();\n PopulationsList.add(InitSinglePopulation(i, NumberOfAgents, temp));\n }\n \n }\n \n \n return PopulationsList;\n }", "private static List<Cell> initiatePopulation(int required_population_size)\n {\n List<Cell> population = new ArrayList<Cell>(); //Define an arraylist to hold the initial population of cells\n int[][][] diploid_genome = newEmptyDeploidGenome();\n int cell_generation = newest_generation + 1, last_div = -1;\n \n //Set the label status of all DNA strands in the genome to unlabelled\n for(int chromosome_count = 0; chromosome_count < diploid_genome.length; chromosome_count++)\n {\n for(int homologous_pair_count= 0; homologous_pair_count < diploid_genome[chromosome_count].length; homologous_pair_count++)\n {\n for(int dna_strand_count = 0; dna_strand_count < diploid_genome[chromosome_count][homologous_pair_count].length; dna_strand_count++)\n {\n diploid_genome[chromosome_count][homologous_pair_count][dna_strand_count] = STRAND_UNLABELLED; //Set each DNA strand to unlabelled\n }\n }\n }\n \n // !****!Create the starting population of cells, all as generation 0!****!\n for (int counter = 0; counter < required_population_size; counter++)\n {\n int cell_id = counter;\n population.add(new Cell(cell_id, cell_generation, last_div, CAN_DIVIDE, diploid_genome)); // Create a new Cell object with the following values.\n id_of_last_created_cell = cell_id; // Track the id of the last created cell\n }// for\n newest_generation++;\n return population;\n }", "public Stacked(int size){\n this.size = size;\n count = 0;\n expand = 5;\n stackArray = (E[]) new Object[size];\n }", "public void setSize(int size){\n\t\tthis.shipSize = size;\n\t}", "public void setPopulation(int population) {\n\n this.population = population;\n }", "public Main() {\n this(DEFAULT_SIZE);\n }", "public Main() {\n this(DEFAULT_SIZE);\n }", "public void setPopulation(int population) {\n this.population = population;\n }", "public int getPopulationSize()\n\t{\n\t\treturn individuals.length;\n\t}", "public void init(int expectedSize) {\n Preconditions.checkArgument(expectedSize >= 0, \"Initial capacity must be non-negative\");\n this.modCount = Math.max(1, expectedSize);\n }", "public GoLBoard(GoLInitializer myInitializer, int boardSize)\n\t{\n \tmyGoLCell = myInitializer.getCellArray();\n \tsetSize = boardSize;\n\t}", "public NavStack(int size) {\n super();\n maxSize = size;\n }", "public void setpopulation(int population) {\n this.population = population;\n }", "public IntList(int size){\n\t\tprime = new ArrayList<Integer>(size);\n\t}", "public void setSize(int size) {\n\tthis.sizeNumber = sizeNumber;\r\n}", "@Override\n protected List<String> initialize(int size) {\n String[] ia = Generated.array(String.class,\n new RandomGenerator.String(), size);\n return Arrays.asList(ia);\n }", "public LeetCode346(int size) {\n this.maxSize = size;\n }", "public PriorityQueue(int size) {\n nodes = new Vector(size);\n }", "public Sudoku(int size){\n\t\tthis.size = size;\n\t\tnumbers = new int[size*size][size*size];\n\t\tfixedNumbers = new boolean[size*size][size*size];\n\t\t// create sudoku which is yet to be initialized and set them unfixed\n\t\t// (all numbers are zero)\n\t\tfor (int i = 0; i < size*size; i++){\n\t\t\tfor (int j = 0; j < size*size; j++){\n\t\t\t\tnumbers[i][j] = 0;\n\t\t\t}\n\t\t}\n\t}", "BusinessLogic(int size)\r\n\t{\r\n\t\tthis.size = size;\r\n\t\tgenerator = new Random();\r\n\t\tnumbers = new ArrayList<Integer>();\r\n\t}", "public void setSampleSize(int n){\n\t\tsetParameters(populationSize, type1Size, n);\n\t}", "public int[] initializingArray(int size) {\n\t\tint [] array = createArrays(size);\n\t\tfor(int i = 0;i < array.length; i++) {\n\t\t\tarray[i] = rand.nextInt(10);\n\t\t}\n\t\treturn array;\n\t}", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }", "public int Init(int sz){\n\tsize = sz ;\n\tnumber = new int[sz] ;\n\t\n\tnumber[0] = 20 ;\n\tnumber[1] = 7 ; \n\tnumber[2] = 12 ;\n\tnumber[3] = 18 ;\n\tnumber[4] = 2 ; \n\tnumber[5] = 11 ;\n\tnumber[6] = 6 ; \n\tnumber[7] = 9 ; \n\tnumber[8] = 19 ; \n\tnumber[9] = 5 ;\n\t\n\treturn 0 ;\t\n }" ]
[ "0.80612284", "0.788445", "0.7155392", "0.70816094", "0.70364577", "0.6847475", "0.67395294", "0.6686304", "0.65351367", "0.64826185", "0.6414945", "0.64097136", "0.63949496", "0.63369197", "0.63187104", "0.63039213", "0.6295424", "0.6279839", "0.6277455", "0.6265489", "0.626362", "0.6254053", "0.6207649", "0.6200146", "0.6199888", "0.6192823", "0.6189084", "0.6185967", "0.6177051", "0.6177051", "0.6163274", "0.6163274", "0.6163274", "0.6163274", "0.61579484", "0.6152", "0.61428183", "0.6117041", "0.61112636", "0.6089185", "0.60880774", "0.60794336", "0.6046728", "0.6045454", "0.6039523", "0.6025605", "0.60213125", "0.6017927", "0.6001395", "0.6000323", "0.59841555", "0.5965514", "0.5957598", "0.59529746", "0.5949543", "0.59470016", "0.59362113", "0.5929532", "0.59240896", "0.5915708", "0.5915205", "0.59137046", "0.5897269", "0.58957833", "0.5893912", "0.5884228", "0.5884228", "0.588235", "0.58790225", "0.587469", "0.5857875", "0.5853593", "0.58382946", "0.5836115", "0.582137", "0.5812731", "0.5808934", "0.5806443", "0.5801359", "0.57949567", "0.5790134", "0.5784385", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604", "0.57783604" ]
0.0
-1
Splits the population to perform tournaments in parallel.
public void split(int cores) { int counter = 0; this.container = new AI[cores][POPULATION_SIZE / cores]; for (AI ai : this.individuals) { ai.fitness = 0; } for (int x = 0; x < cores; x++) { for (int y = 0; y < POPULATION_SIZE / cores; y++) { this.container[x][y] = this.individuals[counter]; counter++; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void runTournament() {\n\t\t//ArrayList<Gene> tournament = new ArrayList<Gene>();\n\t\tPriorityQueue<Gene> tournament = new PriorityQueue<Gene>(Collections.reverseOrder());\n\t\tint numContenders = (int)(FRAC_IN_TOURNAMENT * geneNumber);\n\t\tSet<Integer> chosenOnes = new HashSet<Integer>();\n\t\t\n\t\twhile(chosenOnes.size() < numContenders) {\n\t\t\tint randIndex = (int) (Math.random() * geneNumber);\n\t\t\tchosenOnes.add(randIndex);\n\t\t}\n\t\tfor(int i : chosenOnes){\n\t\t\ttournament.add(genepool.get(i));\n\t\t}\n\t\t//int firstIndex = getMax(tournament, -1);\n\t\t//int secondIndex = getMax(tournament, firstIndex);\n\t\t//Gene parent1 = tournament.get(firstIndex);\n\t\t//Gene parent2 = tournament.get(secondIndex);\n\t\tGene parent1 = tournament.poll();\n\t\tGene parent2 = tournament.poll();\n\t\t// Create a new gene from the 2 fittest genes\n\t\tGene newGene = parent1.waCrossover(parent2);\n\t\t\n\t\t// Calculate fitness for the new gene\n\t\tPlayerSkeleton.runGames(numGames, newGene);\n\t\toffspringPool.add(newGene);\n\t}", "public void runGeneticAlgo() {\n\t\tint offspringLimit = (int)(OFFSPRING_POOL_LIMIT * geneNumber);\n\t\tint factor = (int) Math.pow(10, String.valueOf(offspringLimit).length() - 1);\n\t\twhile(offspringPool.size() < offspringLimit) {\n\t\t\trunTournament();\n\t\t\tif(offspringPool.size() % factor == 0) {\n\t\t\t\tSystem.out.println(\"Finished \" + offspringPool.size() + \" tournaments\");\n\t\t\t}\n\t\t}\n\t\tsortPool();\n\t\tArrayList<Gene> newGenepool = new ArrayList<Gene>(genepool.subList(0, geneNumber - offspringLimit));\n\t\tnewGenepool.addAll(offspringPool);\n\t\tgenepool = newGenepool;\n\t\toffspringPool = new ArrayList<Gene>();\n\t}", "public void tournamentWithElitism(){\n\t\tEvolvable spring[] = new Evolvable[populationSize];\n\t\t\n\t\t//elite individuals go directly to new population\n\t\tfor (int i = 0; i < SNSLearningAgent.elitism; i++){\n\t\t\tspring[i] = population[i];\t\n\t\t}\n\t\t\n\t\t//other individuals are selected via tournament\n\t\tfor (int i = SNSLearningAgent.elitism; i < populationSize; i+=2) {\n\t\t\t//parents selected via tournament\n\t\t\tint p1 = tournament(SNSLearningAgent.tournamentSize);\t\n\t\t\tint p2 = tournament(SNSLearningAgent.tournamentSize);\n\t\t\twhile(p1 == p2)\tp2 = tournament(SNSLearningAgent.tournamentSize);\n\t\t\t\n\t\t\t//performs crossover if probability is matched\n\t\t\tif(R.nextFloat() < SNSLearningAgent.crossoverProb){\n\t\t\t\tif (crossBehavior.equals(\"freeSplitCross\")){\n\t\t\t\t\tint point = R.nextInt(SNSAgent.DNA_LENGTH);\n\t\t\t\t\t\n\t\t\t\t\tspring[i] = cross(population[p1], population[p2], point);\n\t\t\t\t\tif (i+1 < populationSize) spring[i+1] = cross(population[p2], population[p1], point);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tspring[i] = cross(population[p1], population[p2]);\n\t\t\t\t\tif (i+1 < populationSize) spring[i+1] = cross(population[p2], population[p1]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\tspring[i] = population[p1];\n\t\t\t\tif (i+1 < populationSize) spring[i+1] = population[p2];\n\t\t\t}\n\t\t\t\n\t\t\t//performs mutation if probability is reached\n\t\t\tif(R.nextFloat() < SNSLearningAgent.mutationProb){\n\t\t\t\tspring[i].mutate();\n\t\t\t}\n\t\t\tif(i+1 < populationSize && R.nextFloat() < SNSLearningAgent.mutationProb){\n\t\t\t\tspring[i+1].mutate();\n\t\t\t}\n\t }\n\t\t\n\t\t//replaces old population with the new one\n\t\tfor(int i = 1; i < populationSize; i++) {\n\t\t\tpopulation[i] = spring[i];\n\t\t}\n\t}", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "@Override\r\n\tpublic List<GridTask<LinPackResult>> split() {\r\n\t\tList<GridTask<LinPackResult>> list = new ArrayList<GridTask<LinPackResult>>();\r\n\t\tfor (int i=0; i < tasks; i++) {\r\n\t\t\tlist.add(new LinPackTask(cycles));\r\n\t\t}\r\n\t\t\r\n\t\tsw = new StopWatch();\r\n\t\t\r\n\t\tsw.start();\r\n\t\t\r\n\t\treturn list;\r\n\t}", "private void crossover() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < pop_size; i++) { // go through population\r\n\r\n int a = new Random().nextInt(this.pop_size);\r\n int b = new Random().nextInt(this.pop_size);\r\n\r\n int split_point = new Random().nextInt(this.gene_size);\r\n\r\n float[] p1_genes = this.parent_population.getPopulation()[a].getGenes();\r\n float[] p2_genes = this.parent_population.getPopulation()[b].getGenes();\r\n\r\n float[] c1_genes = new float[gene_size];\r\n float[] c2_genes = new float[gene_size];\r\n\r\n for (int j = 0; j < gene_size; j++) {\r\n\r\n if (j < split_point) {\r\n c1_genes[j] = p1_genes[j];\r\n c2_genes[j] = p2_genes[j];\r\n } else {\r\n c2_genes[j] = p1_genes[j];\r\n c1_genes[j] = p2_genes[j];\r\n }\r\n }\r\n individual child1 = new individual(c1_genes, solutions, output);\r\n individual child2 = new individual(c2_genes, solutions, output);\r\n\r\n if (child1.getFitness() > child2.getFitness()) {\r\n temp_pop[i] = child1;\r\n } else {\r\n temp_pop[i] = child2;\r\n }\r\n }\r\n this.offspring_population.setPopulation(temp_pop);\r\n this.offspring_population.update_population();\r\n }", "public void generatePopulation() {\n\t\t\n\t\tif (SCType.getScLayers() <= 2)\n\t\t\tLogger.logError(\"To few supply chain layers, minimum of 3 required:\" + SCType.getScLayers());\n\t\t\n\t\tArrayList<CountryAgent> countryAgents = SU.getObjectsAll(CountryAgent.class);\t\t\n\t\tfor (CountryAgent country : countryAgents) {\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.PRODUCER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_PRODUCERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.PRODUCER);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.INTERNATIONAL)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_INTERNATIONALS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.INTERNATIONAL);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.WHOLESALER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_WHOLESALERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.WHOLESALER);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.RETAIL)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_RETAILERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.RETAIL);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.CONSUMER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_CONSUMERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.CONSUMER);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Set possible new suppliers and clients\n\t\tfor (BaseAgent agent : SU.getObjectsAll(BaseAgent.class)) {\n\t\t\tagent.setPossibleNewSuppliersAndClients();\n\t\t}\n\t\t\n\t\tSU.getDataCollector().addAllCurrentStock();\n\t}", "public void iterate()\n\t{\n\t\tfor (int p = 0; p < parasites.length; p++)\n\t\t\tpFitnesses[p][1] = 0;\n\t\t\n\t\ttry\n\t\t{\t// calculate fitnesses against other population\n\t\t\texecutor.invokeAll(tasks);\n\t\t\t// calculate fitness against hall of fame individuals\n\t\t\texecutor.invokeAll(hofTasks);\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tSystem.out.println(\"Something bad happened...\");\n\t\t\tSystem.exit(-1);\n\t\t}\n\t\n\t\tArrays.sort(hFitnesses,new ArrayComparator(1,false));\n\t\tArrays.sort(pFitnesses,new ArrayComparator(1,false));\n\t\t\n\t\tint bestIndex = (int)pFitnesses[0][0];\n\t\tint size = parHOF.length;\n\t\t\n\t\tparHOF[generations%size]=new NeuralPlayer(-1,\"HOF P\",(BasicNetwork)parasites[(int)bestIndex].net.clone());\n\t\tbestIndex = (int)hFitnesses[0][0];\n\t\thostHOF[generations%size]=new NeuralPlayer(1,\"HOF H\",(BasicNetwork)hosts[(int)bestIndex].net.clone());\n\t\t\n\t\tint matePopIndex = (int)(matingPer*popSize)+1;\n\t\tRandom indexG = new Random();\n\t\t// allow top percentage to breed and replace bottom 2*percentage\n\t\t// leave everyone else alone\n\t\tfor (int i = 0; i < popSize*2*matingPer; i++)\n\t\t{\n\t\t\tint pInd1 = indexG.nextInt(matePopIndex);\n\t\t\tint pInd2 = indexG.nextInt(matePopIndex);\n\t\t\tNeuralPlayer p1 = hosts[(int)hFitnesses[pInd1][0]];\n\t\t\tNeuralPlayer p2 = hosts[(int)hFitnesses[pInd2][0]];\n\t\t\tNeuralPlayer child = hosts[(int)hFitnesses[popSize - 1 - i][0]];\n\t\t\tmate(p1, p2,child);\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < popSize*2*matingPer; i++)\n\t\t{\n\t\t\tint pInd1 = indexG.nextInt(matePopIndex);\n\t\t\tint pInd2 = indexG.nextInt(matePopIndex);\n\t\t\tNeuralPlayer p1 = parasites[(int)pFitnesses[pInd1][0]];\n\t\t\tNeuralPlayer p2 = parasites[(int)pFitnesses[pInd2][0]];\n\t\t\tNeuralPlayer child = parasites[(int)pFitnesses[popSize - 1 - i][0]];\n\t\t\tmate(p1, p2,child);\n\t\t}\n\t\t// mutate everyone except top percentage (matingPer)\n\t\tfor (int i = 0; i < popSize*3*matingPer; i++)\n\t\t{\n\t\t\tmutate(parasites[(int)pFitnesses[popSize - 1 - i][0]]);\n\t\t\tmutate(hosts[(int)hFitnesses[popSize - 1 - i][0]]);\n\t\t}\n\t\t\n\t\tgenerations+=1;\n\t\t// every now and then reseed the population with a good individual\n\t\tif (generations%50 == 0)\n\t\t{\n\t\t\thosts[indexG.nextInt(hosts.length)].net = (BasicNetwork)allTimeBestHost.net.clone();\n\t\t\tparasites[indexG.nextInt(parasites.length)].net = (BasicNetwork)allTimeBestPara.net.clone();\n\t\t}\n\t\t\t\n\t}", "@Override\n @Transactional\n public int joinFinishedMiBranches(int bulkSize) {\n PageRequest pageRequest = PageRequest.of(0, bulkSize);\n List<SuspendedExecution> suspendedExecutions = suspendedExecutionsRepository.findUnmergedSuspendedExecutions(of(MULTI_INSTANCE, PARALLEL_LOOP), pageRequest);\n\n return joinMiBranchesAndSendToQueue(suspendedExecutions);\n }", "@Split\n public List<InputMapper> split(@PartitionSize final long bundles) {\n\t\tfinal List<InputMapper> partitions = new ArrayList<>();\n\t final Collection<Member> members = new ArrayList<>();\n\t long current = 0;\n\t for (final Map.Entry<Member, Future<Long>> entries : getSizeByMembers().entrySet()) {\n\t final long memberSize = getFutureValue(entries.getValue());\n\t if (members.isEmpty()) {\n\t members.add(entries.getKey());\n\t current += memberSize;\n\t } else if (current + memberSize > bundles) {\n\t partitions.add(\n\t new InputMapper(configuration, jsonFactory, jsonb, service, toIdentifiers(members)));\n\t // reset current iteration\n\t members.clear();\n\t current = 0;\n\t }\n\t }\n\t if (!members.isEmpty()) {\n\t partitions.add(new InputMapper(configuration, jsonFactory, jsonb, service, toIdentifiers(members)));\n\t }\n\n\t if (partitions.isEmpty()) { // just execute this if no plan (= no distribution)\n\t partitions.add(this);\n\t }\n\t return partitions;\n }", "private Vector step(){\n// System.out.println();\n// System.out.println(generationCount);\n// System.out.println(\"The Population is:\");\n// System.out.println(population);\n \n //DETERMINE WHO SURVIVES INTO NEXT GENERATION\n Vector nextGeneration = surviveType.run(population, fitnessArray);\n\n //DO THE CROSSOVER PROCESS\n //WHILE THE NEXT GENERATION ISN'T FULL\n while (nextGeneration.size() < (populationSize - randGenes)){\n //FIND PARENTS\n Gene parentOne, parentTwo;\n do {\n Gene[] parents = selectType.run(population, fitnessArray);\n parentOne = parents[0];\n parentTwo = parents[1];\n } while (selectPairs && (! closeEnough(parentOne, parentTwo)));\n //ADD CHILDREN\n Gene[] kids = crossType.children(parentOne, parentTwo);\n\n nextGeneration.add(kids[0]);\n if (nextGeneration.size() < (populationSize - randGenes)){\n nextGeneration.add(kids[1]);\n }\n }\n //ADD RANDOM GENES TO THE POPULATION\n while (nextGeneration.size() < populationSize){\n nextGeneration.add(initializer.createRandomGene(fitnessFunction, minRadius, maxRadius));\n }\n //MUTATE THE NEXT GENERATION\n for (int j = 0; j < populationSize; j++){\n if (Math.random() < mutationProb){\n nextGeneration.set(j, mutationType.run((Gene) nextGeneration.get(j)));\n }\n }\n\n //COMPUTE FITNESSES AND RELOCATE IF NECESSARY\n Gene bestGene = (Gene) nextGeneration.get(0);\n int bestX = 0;\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n while (relocationType.move(bannedList, next)){\n Gene newGene = initializer.createRandomGene(fitnessFunction, minRadius, maxRadius);\n next = newGene;\n nextGeneration.set(x, next);\n }\n fitnessArray[x] = next.getFitness();\n\n //FOR THE PURPOSES OF UPDATING THE BANNED LIST\n if (next.getFitness() > bestGene.getFitness()){\n bestGene = next;\n bestX = x;\n }\n } //End for (int x = 0;...\n\n Arrays.sort(fitnessArray);\n\n //UPDATE THE BANNED LIST BY ADDING THE BEST GENE IN THE NEXT GENERATION IF IT'S ABOVE minAccepted AND CONTAINS MORE THAN minPoints POINTS\n if (useList){\n if ((generationCount >= firstAdd) &&\n (solutionCounter >= countNum) &&\n (bestGene.getFitness() >= minAccepted) &&\n (bestGene.getCount() >= minPoints)){\n solutionCounter = 0;\n// System.out.println(bestGene);\n Gene bestClone = new Gene (bestGene.getMajorAxisRadius(), //THIS KLUDGE IS DONE B/C .clone() IS\n bestGene.getMinorAxisRadius(), //PROTECTED, AND I CAN'T UNPROTECT IT.\n bestGene.getX(), //I USE A CLONED GENE TO PREVENT A MUTATION\n bestGene.getY(), //IN THE NEXT GENERATION FROM ALTERING bannedList\n bestGene.getOrientation(),\n bestGene.getFunction());\n bannedList = relocationType.updateBannedList(bannedList, bestClone);\n\n\n //IF NECESSARY, UPDATE THE SOLUTION LIST BY ADDING ALL CLUSTERS WITH MORE THAN minPoints POINTS AND A FITNESS OF AT LEAST minAccepted\n if (returnAllSolutions){\n for (int i = 0; i < populationSize; i++){\n Gene next = (Gene) nextGeneration.get(i);\n if ((next.getFitness() >= minAccepted) && (next.getCount() >= minPoints)){\n solutionList.add(next);\n }\n }//End for (int i = 0...\n } else {\n solutionList = bannedList;\n } //End if (returnAllSolutions){...}else{\n } //End if (generationCount > 4...\n } //End if (useList){\n\n generationCount = generationCount + 1;\n solutionCounter = solutionCounter + 1;\n\n //IF AVOIDING CONVERGENCE, AND IT HAS CONVERGED, START OVER WITH RANDOM GENES\n\n double bestFitness = bestGene.getFitness();\n double medianFitness = roundToHundredths((double) fitnessArray[(int) Math.floor(populationSize / 2)]);\n\n// System.out.println(bestFitness);\n// System.out.println(medianFitness);\n\n if ((antiConvergence) &&\n ((bestFitness - medianFitness) < (0.01 * bestFitness)) &&\n (generationCount > firstAdd)){\n nextGeneration = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n// System.out.println(\"EXPLODED CONVERGENCE!\");\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n fitnessArray[x] = next.getFitness();\n }\n Arrays.sort(fitnessArray);\n }\n\n return nextGeneration;\n }", "private void run() {\n //Create the store object\n Store store = new Store();\n\n //Populate the array of people\n for (int i = 0; i < 20; i++) {\n people.add(new Viewer(store));\n if (i < 6) { //Add buyers\n people.add(new Buyer(store));\n }\n }\n\n //Make a thread pool according to the size of people\n this.threadPoolExecutor =\n (ThreadPoolExecutor) Executors.newFixedThreadPool(people.size());\n\n //Start the life of every person\n for (Person person : this.people) {\n threadPoolExecutor.execute(person);\n }\n }", "@Override\n @Transactional\n public int joinFinishedSplits(int bulkSize) {\n PageRequest pageRequest = PageRequest.of(0, bulkSize);\n List<SuspendedExecution> suspendedExecutions = suspendedExecutionsRepository.findFinishedSuspendedExecutions(of(PARALLEL, NON_BLOCKING), pageRequest);\n\n return joinAndSendToQueue(suspendedExecutions);\n }", "public void startParallelBombing() {\n\t\tint x = _count;\n\t\t_active = true;\n\t\twhile (_active && x-- > 0) {\n\t\t\tparallelBomb(_count - x);\n\t\t}\n\t\t_active = false;\n\t}", "protected void SelectTournament() {\n\t // Torneo.length -> tournament size\n\t // if (tournament size == 2) then BinaryTournament\n this.setRanking();\n\t \n\t for (int i=0; i<this.PopLength; i++) {\n\t Torneo[0] = Randint(0,this.PopLength-1);\n\t int mejor_torneo=Torneo[0];\n\t \n\t for (int j=1; j<Torneo.length; j++) {\n\t boolean repetido= false;\n\t do {\n\t Torneo[j] = Randint(0,this.PopLength-1);\n\t repetido=false;\n\t int k=0;\n\t while ((k<j) && (!repetido))\n\t if (Torneo[j]==Torneo[k])\n\t repetido=true;\n\t else\n\t k++;\n\t } while (repetido);\n\t \n\t if (OLDevaluation[Torneo[j]] < OLDevaluation[mejor_torneo])\n\t mejor_torneo=Torneo[j];\n\t }\n\t sample[i] = mejor_torneo;\n\t }\n\t // Se crea la nueva poblacion\n\t for (int n=0; n<this.PopLength; n++) {\n\t int kk=sample[n];\n\t for (int m=0; m<this.NbGenes; m++) {\n\t NEWpopulation[n][m]= OLDpopulation[kk][m];\n\t }\n\t NEWevaluation[n]= OLDevaluation[kk];\n\t NEWevalIndex[n]= OLDevalIndex[kk];\n\t }\n }", "public void genPopulation(int howMany)\r\n/* 30: */ {\r\n/* 31:54 */ this.pop.removeAllElements();\r\n/* 32:55 */ for (int i = 0; i < howMany; i++)\r\n/* 33: */ {\r\n/* 34:61 */ int[] clusterV = g.genRandomClusterSize();\r\n/* 35:62 */ Cluster c = new Cluster(g, clusterV);\r\n/* 36:63 */ this.pop.addElement(c);\r\n/* 37: */ }\r\n/* 38: */ }", "@Override\n\tpublic Object[] splitTasks() {\n\t\tif (tasks == null) {\n\t\t\tSystem.out.println(\"There are \"+taskNum +\" tasks, and handled by \"+clientsNum+\" clients\");\n\t\t}\t\t\n\t\ttasks = new SimpleTask[clientsNum];\n\t\ttq = taskNum / clientsNum;\n//\t\tbatchSize = tq;\n\t\tint left = taskNum - tq * clientsNum;\n\t\t\n\t\tfor (int i = 0; i < tasks.length; i++) {\n\t\t\tint l = 0;\n\t\t\tif (left >= i+1) {\n\t\t\t\tl = 1;\n\t\t\t}\n\t\t\tif (i == 0) {\n\t\t\t\ttasks[i] = new SimpleTask(1, tq + l, batchSize);\n\t\t\t} else {\n\t\t\t\ttasks[i] = new SimpleTask(\n\t\t\t\t\t\ttasks[i - 1].getEnd()+ 1, tasks[i - 1].getEnd() + tq + l, batchSize);\n\t\t\t}\t\t\t\n\t\t}\n//\t\tSystem.out.println(\"done .\"+clientsNum);\n\t\tthis.srvQ2QLSTM.getCfg().getQlSTMConfigurator().setMBSize(batchSize);\n\t\tthis.srvQ2QLSTM.getCfg().getAlSTMConfigurator().setMBSize(batchSize);\t\t\n\t\treturn tasks;\n\t}", "public void splitTeams()\r\n\t{\r\n\t\tfor (Mitarbeiter m : mitarbeiter.values())\r\n\t\t{\r\n\t\t\tint test = m.getAzvMonat().firstEntry().getValue().getITeam();\r\n\t\t\t\r\n\t\t\tswitch (test)\r\n\t\t\t{\r\n\t\t\tcase 1:\r\n\t\t\tteam1.put(m.getPersonalNR(), m);\t\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 2:\r\n\t\t\tteam2.put(m.getPersonalNR(), m);\t\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 3:\r\n\t\t\tteam3.put(m.getPersonalNR(), m);\t\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tdefault:\r\n\t\t\tteam4.put(m.getPersonalNR(), m);\r\n\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t// Für den einfacheren späteren Zugriff werden die Teams in eine seperate Liste gepackt:\t\r\n\tteams.put(1, team1);\r\n\tteams.put(2, team2);\r\n\tteams.put(3, team3);\r\n\tteams.put(4, team4);\r\n\t\r\n\tsetGesamtsummeProzentanteile();\t\r\n\t}", "public void reproduce(){\n\t\t// sort the population from strongest to weakest\n\t\tCollections.sort(population);\n\t\tCollections.reverse(population);\n\t\t\n\t\tfor(int i = 0; i < (int)(POPULATION_SIZE*POPULATION_ACTION_PERCENT); i+=2){\n\t\t\t\n\t\t\t// get two random indexes for reproduction based on the exponential function\n\t\t\t// (1/1000) * (randInt)^2 = index\n\t\t\t// this function favors sequences with higher fitness scores\n\t\t\tint randIndex1 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\tint randIndex2 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\t\n\t\t\trandIndex1 = (int) (Math.pow(randIndex1, 2) / 1000);\n\t\t\trandIndex2 = (int) (Math.pow(randIndex2, 2) / 1000);\n\t\t\t\n\t\t\t// get two pieces\n\t\t\tBuildingPiece[] array1 = population.get(randIndex1).getList();\n\t\t\tBuildingPiece[] array2 = population.get(randIndex2).getList();\n\t\t\t\n\t\t\t// find a splicing point\n\t\t\tint splicePoint = findSplicingPoint(array1, array2);\n\t\t\t\n\t\t\t// generate two new arrays based on the splicing point\n\t\t\tBuildingPiece[] newArray1 = generateNewArray(array1, array2, splicePoint);\n\t\t\tBuildingPiece[] newArray2 = generateNewArray(array2, array1, splicePoint);\n\t\t\t\n\t\t\t// make new buildings with the new arrays\n\t\t\tBuilding bp1 = new Building(newArray1, generation, possiblePieces);\n\t\t\tBuilding bp2 = new Building(newArray2, generation, possiblePieces);\n\t\t\t\n\t\t\t// mutate the new building sequences\n\t\t\tmutateArray(bp1);\n\t\t\tmutateArray(bp2);\n\t\t\t\n\t\t\t// add them into the population\n\t\t\tpopulation.add(randIndex1, bp1);\n\t\t\tpopulation.add(randIndex2, bp2);\n\t\t}\n\t}", "public void startPopulateWorkers(){\r\n\t\tArrayList<Thread> threads = new ArrayList<Thread>();\r\n\t\t\r\n\t\t//Create threads\r\n\t\tfor(int i = 0; i < pts.length; i++){\r\n\t\t\tthreads.add(new Thread(pts[i]));\r\n\t\t\tthreads.get(i).start();\r\n\t\t}\r\n\t\t\r\n\t\t//Wait for threads to finish\r\n\t\tfor(int i = 0; i < pts.length; i++){\r\n\t\t\ttry {\r\n\t\t\t\tthreads.get(i).join();\r\n\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\tthrow new RuntimeException(e.getMessage());\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\r\n protected void compute() {\r\n //if count != 0 || splitA.length == 1 then go, else for loop to make splitA.length subtasks to run splitArrayB and then they all call mergeAB\r\n if(global_count == 0){\r\n splitArrayB();\r\n }\r\n if(global_count != 0 || splitA.length == 1){\r\n mergeAB();\r\n }\r\n else{\r\n List<ConcurrentMerge> subtasks = new ArrayList<>();\r\n ConcurrentMerge temp;\r\n for(int i = 0; i < splitA.length; i++){\r\n global_count++;\r\n temp = new ConcurrentMerge(A, B, splitA, splitB, C, global_count);\r\n subtasks.add(temp);\r\n }\r\n invokeAll(subtasks);\r\n }\r\n }", "private void runExperiments()\n {\n for (int i = 0; i < count; i++)\n {\n Percolation experiment = new Percolation(size);\n int openCount = 0;\n StdRandom.setSeed(System.currentTimeMillis());\n while (!experiment.percolates())\n {\n int x = StdRandom.uniform(1, size+1);\n int y = StdRandom.uniform(1, size+1);\n if (!experiment.isOpen(x, y))\n {\n experiment.open(x, y);\n openCount++;\n }\n } \n open[i] = (double) openCount / (size * size);\n }\n }", "@ForgeSubscribe\n public void performChunkSpawning(PopulateChunkEvent.Populate event) {\n if (event.type == PopulateChunkEvent.Populate.EventType.ICE\n && event.world.getGameRules().getGameRuleBooleanValue(\"doCustomMobSpawning\")) {\n int k = event.chunkX * 16;\n int l = event.chunkZ * 16;\n Iterator<CreatureType> iterator = JustAnotherSpawner.worldSettings().creatureTypeRegistry()\n .getCreatureTypes();\n BiomeGenBase spawnBiome = event.world.getBiomeGenForCoords(k + 16, l + 16);\n \n if (spawnBiome == null || blacklist.isBlacklisted(spawnBiome)) {\n return;\n }\n \n while (iterator.hasNext()) {\n CreatureType creatureType = iterator.next();\n if (creatureType.chunkSpawning) {\n CustomSpawner.performWorldGenSpawning(event.world, creatureType, spawnBiome, k + 8, l + 8, 16, 16,\n event.world.rand);\n }\n }\n }\n }", "public void campaign() {\r\n for (int i = 0; i < this.parties.length; i++) {\r\n while (this.parties[i].makeAction(this.constituencies, this.acts)) {}\r\n }\r\n }", "public static void main(String[] args) {\n City city = new City(60, 200);\n\n City city2 = new City(180, 200);\n\n City city3 = new City(80, 180);\n City city4 = new City(140, 180);\n\n City city5 = new City(20, 160);\n\n City city6 = new City(100, 160);\n\n City city7 = new City(200, 160);\n\n City city8 = new City(140, 140);\n\n City city9 = new City(40, 120);\n\n City city10 = new City(100, 120);\n\n City city11 = new City(180, 100);\n\n City city12 = new City(60, 80);\n\n City city13 = new City(120, 80);\n City city14 = new City(180, 60);\n City city15 = new City(20, 40);\n\n City city16 = new City(100, 40);\n\n City city17 = new City(200, 40);\n City city18 = new City(20, 20);\n\n City city19 = new City(60, 20);\n City city20 = new City(160, 20);\n List<City> list=new ArrayList<City>();\n list.add(city);list.add(city2);\n list.add(city3);\n list.add(city4);\n list.add(city5);\n list.add(city6);\n list.add(city7);\n list.add(city8);\n list.add(city9);\n list.add(city10);\n list.add(city11);\n list.add(city12);\n list.add(city13);\n list.add(city14);\n list.add(city15);\n list.add(city16);\n list.add(city17);\n list.add(city18);\n list.add(city19);\n list.add(city20);\n\n // Initialize population\n Population pop = new Population(100, true,list);\n System.out.println(\"Initial distance: \" + pop.getBestTour().getDistance());\n\n // Evolve population for 100 generations\n pop = Ga.evolvePopulation(pop);\n for (int i = 0; i < 500; i++) {\n pop = Ga.evolvePopulation(pop);\n System.out.println(\"第\"+i+\"代\"+pop.getBestTour().getDistance());\n }\n\n // Print final results\n System.out.println(\"Finished\");\n System.out.println(\"Final distance: \" + pop.getBestTour().getDistance());\n System.out.println(\"Solution:\");\n System.out.println(pop.getBestTour());\n }", "protected abstract void splitBAMs();", "public void generateOffspringPopulation() throws JMException{\n\n offspringPopulation_ = new SolutionSet[problemSet_.size()];\n\n for (int task = 0; task < problemSet_.size(); task++){\n offspringPopulation_[task] = new SolutionSet(populationSize_);\n if (crossover_.getClass() == SBXCrossover.class){\n Solution[] parents = new Solution[2];\n for (int i = 0; i < (populationSize_); i++) {\n // obtain parents\n parents = (Solution[]) selection_.execute(population_[task]);\n\n Solution[] offSpring = (Solution[]) crossover_\n .execute(parents);\n mutation_.execute(offSpring[0]);\n problemSet_.get(task).evaluate(offSpring[0]);\n problemSet_.get(task).evaluateConstraints(offSpring[0]);\n offspringPopulation_[task].add(offSpring[0]);\n } // for\n }\n else if (crossover_.getClass() == EGG.class){\n\n int[] permutation = new int[populationSize_];\n Utils.randomPermutation(permutation, populationSize_);\n etmo.util.Ranking ranking = new etmo.util.Ranking(population_[task]);\n SolutionSet front = ranking.getSubfront(0);\n\n front.Suppress();\n SolutionSet KP = null;\n if(front.size()> problemSet_.get(task).getNumberOfObjectives())\n KP = findingKneePoint(front, task);\n if(KP == null){\n KP = population_[task];\n }\n\n for (int i = 0; i < (populationSize_); i++) {\n // obtain parents\n int n = permutation[i];\n // STEP 2.1. Mating selection\n int r1,r2;\n r1 = PseudoRandom.randInt(0, KP.size() - 1);\n do {\n r2 = PseudoRandom.randInt(0, KP.size() - 1);\n } while (r2==r1);\n // STEP 2.2. Reproduction\n Solution child;\n Solution[] parents = new Solution[3];\n\n// 加入迁移:\n double tranRand = PseudoRandom.randDouble();\n if (tranRand <= 0.1){\n parents[1] = population_[PseudoRandom.randInt(0, problemSet_.size() - 1)].get(PseudoRandom.randInt(0, populationSize_ - 1));\n parents[2] = population_[PseudoRandom.randInt(0, problemSet_.size() - 1)].get(PseudoRandom.randInt(0, populationSize_ - 1));\n parents[0] = population_[task].get(n);\n child = (Solution) crossover_.execute(parents);\n\n mutation_.execute(child);\n\n problemSet_.get(task).evaluate(child);\n problemSet_.get(task).evaluateConstraints(child);\n offspringPopulation_[task].add(child);\n }\n\n\n\n else {\n parents[1] = KP.get(r1);\n parents[2] = KP.get(r2);\n parents[0] = population_[task].get(n);\n child = (Solution) crossover_.execute(parents);\n\n mutation_.execute(child);\n\n problemSet_.get(task).evaluate(child);\n problemSet_.get(task).evaluateConstraints(child);\n offspringPopulation_[task].add(child);\n }\n\n\n } // for\n }\n\n }\n\n\n\n\n }", "public MyPacMan optimise(List<double[]> dimensionList){\n for(int i = 0; i < POPULATION_SIZE; i++){\r\n MyPacMan individual = new MyPacMan(dimensionList);\r\n population.add(individual);\r\n \r\n } \r\n \r\n // try more than one iteration \r\n for(int iterationCount = 0; iterationCount < ITERATION_NO; iterationCount++){\r\n \r\n System.out.println(\"Iterazione n°: \" + Integer.toString(iterationCount));\r\n \r\n if(iterationCount%10 == 0 || iterationCount == ITERATION_NO-1){\r\n try {\r\n pw = new PrintWriter(new File(\"data/popoluation_\" + Integer.toString(iterationCount) +\".csv\"));\r\n } catch (FileNotFoundException ex) {\r\n \r\n } \r\n \r\n \r\n for(int n = 0; n < dimensionList.size(); n++){ \r\n pw.write(\"v\" + Integer.toString(n));\r\n pw.write(\",\");\r\n }\r\n \r\n pw.write(\"fValue\");\r\n\r\n pw.write(\"\\n\");\r\n \r\n for (MyPacMan individual : population) {\r\n pw.write(individual.toString());\r\n pw.write(\",\");\r\n pw.write(Double.toString(fitFunction(individual)));\r\n pw.write(\"\\n\");\r\n }\r\n \r\n pw.flush();\r\n }\r\n \r\n int loop = 0;\r\n \r\n // main loop for evolution\r\n while(loop < population.size()){ \r\n\r\n MyPacMan original = null;\r\n MyPacMan candidate = null;\r\n boolean boundsHappy;\r\n\r\n do{\r\n boundsHappy = true;\r\n // pick an agent from the the population\r\n int x = loop;\r\n int a,b,c = -1;\r\n\r\n // pick three random agents from the population\r\n // make sure that they are not identical to selected agent from\r\n // the population \r\n\r\n do{\r\n a = random.nextInt(population.size());\r\n }while(x == a);\r\n do{\r\n b = random.nextInt(population.size());\r\n }while(b==x || b==a);\r\n do{\r\n c = random.nextInt(population.size());\r\n }while(c == x || c == a || c == b);\r\n\r\n // create three agent individuals\r\n MyPacMan individual1 = population.get(a);\r\n MyPacMan individual2 = population.get(b);\r\n MyPacMan individual3 = population.get(c);\r\n\r\n // create a noisy random candidate\r\n MyPacMan noisyRandomCandicate = new MyPacMan(dimensionList);\r\n\r\n // mutation process\r\n // if an element of the trial parameter vector is\r\n // found to violate the bounds after mutation and crossover, it is reset in such a way that the bounds\r\n // are respected (with the specific protocol depending on the implementation)\r\n for(int n = 0; n < dimensionList.size(); n++){ \r\n noisyRandomCandicate.dataValue[n] = (individual1.dataValue[n] + DIFFERENTIAL_WEIGHT * (individual2.dataValue[n] - individual3.dataValue[n])); \r\n } \r\n\r\n // Create a trial candicate \r\n original = population.get(x);\r\n candidate = new MyPacMan(dimensionList);\r\n\r\n // copy values from original agent to the candidate agent\r\n for(int n = 0; n < dimensionList.size(); n++){ \r\n candidate.dataValue[n] = original.dataValue[n];\r\n } \r\n\r\n // crossver process with the selected individual\r\n // pick a random dimension, which defintely takes the value from the noisy random candidate\r\n int R = random.nextInt(dimensionList.size());\r\n\r\n for(int n = 0; n < dimensionList.size(); n++){\r\n\r\n double crossoverProbability = random.nextDouble();\r\n\r\n if(crossoverProbability < CROSSOVER_PROBABILITY || n == R){\r\n candidate.dataValue[n] = noisyRandomCandicate.dataValue[n];\r\n }\r\n\r\n }\r\n\r\n // check here if the trial candiate satisfies bounds for each value\r\n for(int n = 0; n < dimensionList.size(); n++){ \r\n if(candidate.dataValue[n] < dimensionList.get(n)[0] || candidate.dataValue[n] > dimensionList.get(n)[1]){\r\n boundsHappy = false;\r\n }\r\n }\r\n\r\n }while(boundsHappy == false);\r\n\r\n //see if the candidate is better than original, if so replace it\r\n if(fitFunction(original) < fitFunction(candidate)){\r\n population.remove(original);\r\n population.add(candidate); \r\n }\r\n loop++;\r\n } \r\n }\r\n \r\n MyPacMan bestFitness = new MyPacMan(dimensionList);\r\n \r\n // selecting the final best agent from the the population\r\n for(int i = 0; i < population.size(); i++){\r\n MyPacMan individual = population.get(i);\r\n \r\n if(fitFunction(bestFitness) < fitFunction(individual)){\r\n \r\n try {\r\n bestFitness = (MyPacMan) individual.clone();\r\n } catch (CloneNotSupportedException ex) {\r\n \r\n }\r\n }\r\n }\r\n \r\n System.out.println(\"Fitness migliore: \" + fitFunction(bestFitness));\r\n return bestFitness;\r\n }", "private void createInitialPopulation() throws InterruptedException, TimeoutException {\n\n\t\tProteinDatabase ident = new ProteinDatabase();\n\t\tident.parseInput(\"proteins.fasta\");\n\t\tList<Protein> database = ident.getDatabase();\n\n\t\tfor (Protein data : database) {\n\t\t\tdata.setExperimental(es);\n\t\t}\n\n\t\tList<Protein> candidates = new ArrayList<Protein>();\n\t\tfor (Protein p : database)\n\t\t{\n\t\t\tTheoreticalSpectrum theoreticalSpectrum = new TheoreticalSpectrum(p.getAminoAcidsequence());\n\t\t\tif (Math.abs(parentMass - theoreticalSpectrum.getParentMass()) <= parentMassThreshold) {\n\t\t\t\tcandidates.add(p);\n\t\t\t}\n\t\t}\n\n\t\trunInitialFitnessCalculations(candidates);\n\n\t\tCollections.sort(candidates, new ProteinFitnessComparator());\n\t\tdebug(candidates, 0);\n\n\n\t\tpopulation = new ArrayList<Protein>(populationSize);\n\n\t\tpopulationActualSize = 0;\n\t\tfor (Protein p : candidates)\n\t\t{\n\t\t\tpopulation.add(p);\n\t\t\tpopulationActualSize++;\n\t\t\tif (populationActualSize == populationSize)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public void saveAll(Population p) {\r\n\t\tfor(int index=0;index<p.populationSize();index++) {\r\n\t\t\t tours[index]=p.getTour(index);\r\n\t\t}\r\n\t\t\r\n\t }", "protected void divideWorkersBySkill() {\n ResourcePool myResourcePool;\n\n for (Person person : this.getPersons()) {\n myResourcePool = this.getResourcePools().get(person.getSkill());\n\n // Create the pool if no other workers have yet been discovered with this skill\n if (myResourcePool == null) {\n myResourcePool = new ResourcePool(new ArrayList<>(), person.getSkill(),\n this.getName());\n this.getResourcePools().put(person.getSkill(), myResourcePool);\n }\n\n myResourcePool.addPerson(person);\n }\n }", "private static void mating() {\n\t\tint getRand = 0;\n\t\tint parentA = 0;\n\t\tint parentB = 0;\n\t\tint newIndex1 = 0;\n\t\tint newIndex2 = 0;\n\t\tChromosome newChromo1 = null;\n\t\tChromosome newChromo2 = null;\n\n\t\tfor (int i = 0; i < OFFSPRING_PER_GENERATION; i++) {\n\t\t\tparentA = chooseParent();\n\t\t\t// Test probability of mating.\n\t\t\tgetRand = getRandomNumber(0, 100);\n\t\t\tif (getRand <= MATING_PROBABILITY * 100) {\n\t\t\t\tparentB = chooseParent(parentA);\n\t\t\t\tnewChromo1 = new Chromosome();\n\t\t\t\tnewChromo2 = new Chromosome();\n\t\t\t\tpopulation.add(newChromo1);\n\t\t\t\tnewIndex1 = population.indexOf(newChromo1);\n\t\t\t\tpopulation.add(newChromo2);\n\t\t\t\tnewIndex2 = population.indexOf(newChromo2);\n\n\t\t\t\t// Choose either, or both of these:\n\t\t\t\tpartiallyMappedCrossover(parentA, parentB, newIndex1, newIndex2);\n\t\t\t\t// positionBasedCrossover(parentA, parentB, newIndex1, newIndex2);\n\n\t\t\t\tif (childCount - 1 == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex1, 1);\n\t\t\t\t} else if (childCount == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex2, 1);\n\t\t\t\t}\n\n\t\t\t\tpopulation.get(newIndex1).computeConflicts();\n\t\t\t\tpopulation.get(newIndex2).computeConflicts();\n\n\t\t\t\tchildCount += 2;\n\n\t\t\t\t// Schedule next mutation.\n\t\t\t\tif (childCount % (int) Math.round(1.0 / MUTATION_RATE) == 0) {\n\t\t\t\t\tnextMutation = childCount + getRandomNumber(0, (int) Math.round(1.0 / MUTATION_RATE));\n\t\t\t\t}\n\t\t\t}\n\t\t} // i\n\t\treturn;\n\t}", "public void run() {\n String[] instruments = getInstrumentIds();\n String[] parties = getPartyIds();\n String[] venues = getVenueIds();\n //TradeMapStore tms = new TradeMapStore();\n\n\n while(true) {\n Trade trade = new Trade();\n trade.setTradeId(UUID.randomUUID().toString());\n logger.info(\"Generating Trade with Id \"+trade.getTradeId());\n trade.setAltTradeIds(new HashMap<String, String>());\n trade.setExecutionVenueDimId(getVenue(venues));\n trade.setTradeTransactionType(TradeTransactionTypeEnum.NEW);\n trade.setSecondaryTradeTypeEnum(TradeTypeEnum.WAP_TRADE);\n trade.setCurrencyPair(CurrencyPairEnum.EURUSD);\n trade.setInstrumentDimId(getInstrument(instruments));\n trade.setCounterPartyDimId(getCounterParty(parties));\n trade.setMarketId(getVenue(venues));\n trade.setOriginalTradeDate(new DateTime(new Date()));\n trade.setPrice(getPrice());\n trade.setQuantity(getSize());\n HashMap<String, Party> partyHashMap = new HashMap<String, Party>();\n trade.setParties(partyHashMap);\n trade.setTradeType(TradeTypeEnum.REGULAR_TRADE);\n logger.info(\"Inserting Trade: \"+trade.toJSON());\n trades.put(trade.getTradeId(),trade);\n\n logger.info(\"TradeLoader Having a snooze\");\n try {\n Thread.sleep(current().nextInt(10, 100));\n }\n catch(InterruptedException e){\n logger.error(\"Error while sleeping\");\n }\n }\n\n }", "public static void generatePopulation() {\n population = setupArray(POP_SIZE, NUM_RULES, GENE_SIZE, COND_LEN);\n\n for (Individual individual : population) {\n for (int i = 0; i < individual.getGene().length; i++) {\n individual.gene[i] = bits.get(new Random().nextInt(2));\n }\n individual.generateRulebase();\n }\n }", "public void reproduce(int generation, IPopulation pop, List<ISpecies> sorted_species) {\n\t\tfor(ISpecies specie : sorted_species){\r\n\r\n\t\t\tList<IOrganism> organisms = specie.getOrganisms();\r\n\r\n\t\t\t// outside the species\r\n\t\t\tint orgnum = 0;\r\n\r\n\t\t\tIOrganism mom = null;\r\n\t\t\tIOrganism baby = null;\r\n\t\t\tIGenome new_genome = null;\r\n\t\t\tIOrganism _organism = null;\r\n\t\t\tIOrganism _dad = null;\r\n\r\n\t\t\tif (specie.getExpectedOffspring() > 0 && organisms.size() == 0)\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// elements for this species\r\n\t\t\tint poolsize = organisms.size() - 1;\r\n\r\n\t\t\t// the champion of the 'this' species is the first element of the species;\r\n\t\t\tIOrganism thechamp = organisms.get(0);\r\n\t\t\tboolean champ_done = false; // Flag the preservation of the champion\r\n\r\n\t\t\t// Create the designated number of offspring for the Species one at a time.\r\n\t\t\tfor (int count = 0; count < specie.getExpectedOffspring(); count++) {\r\n\r\n\t\t\t\t// If we have a super_champ (Population champion), finish off some special clones.\r\n\t\t\t\tif (thechamp.getSuperChampOffspring() > 0) {\r\n\r\n\t\t\t\t\t// save in mom current champ;\r\n\t\t\t\t\tmom = thechamp;\r\n\t\t\t\t\t// create a new genome from this copy\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tif ((thechamp.getSuperChampOffspring()) > 1) {\r\n\t\t\t\t\t\tif (RandomUtils.randomDouble() < .8 || evolutionParameters.getDoubleParameter(MUTATE_ADD_LINK_PROB) == 0.0)\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateLinkWeight(new_genome, evolutionParameters.getDoubleParameter(WEIGHT_MUT_POWER), 1.0, MutationType.GAUSSIAN);\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t// Sometimes we add a link to a superchamp\r\n\t\t\t\t\t\t\tnew_genome.generatePhenotype(generation);\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateAddLink(new_genome,pop);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\tthechamp.incrementSuperChampOffspring();\r\n\t\t\t\t} // end population champ\r\n\r\n\t\t\t\t// If we have a Species champion, just clone it\r\n\t\t\t\telse if ((!champ_done) && (specie.getExpectedOffspring() > 5)) {\r\n\t\t\t\t\tmom = thechamp; // Mom is the champ\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation); // Baby is\r\n\t\t\t\t\t// just like mommy\r\n\t\t\t\t\tchamp_done = true;\r\n\r\n\t\t\t\t} else if (RandomUtils.randomDouble() < evolutionParameters.getDoubleParameter(MUTATE_ONLY_PROB) || poolsize == 1) {\r\n\r\n\t\t\t\t\t// Choose the random parent\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\r\n\t\t\t\t\t// Do the mutation depending on probabilities of various mutations\r\n\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\t// Otherwise we should mate\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Choose the random mom\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\r\n\t\t\t\t\t// save in mom\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\t// Choose random dad...\r\n\t\t\t\t\t// Mate within Species\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(INTERSPECIES_MATE_RATE)) {\r\n\t\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\t\t_dad = _organism;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Mate outside Species\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// save current species\r\n\t\t\t\t\t\tISpecies randspecies = specie;\r\n\t\t\t\t\t\t// Select a random species\r\n\t\t\t\t\t\tint giveup = 0;\r\n\t\t\t\t\t\t// Give up if you can't find a different Species\r\n\t\t\t\t\t\twhile ((randspecies == specie) && (giveup < 5)) {\r\n\r\n\t\t\t\t\t\t\t// Choose a random species tending towards better species\r\n\t\t\t\t\t\t\tdouble randmult = Math.min(1.0, RandomUtils.randomGaussian() / 4);\r\n\r\n\t\t\t\t\t\t\t// This tends to select better species\r\n\t\t\t\t\t\t\tint sp_ext = Math.max(0, (int) Math.floor((randmult * (sorted_species.size() - 1.0)) + 0.5));\r\n\t\t\t\t\t\t\trandspecies = sorted_species.get(sp_ext);\r\n\t\t\t\t\t\t\t++giveup;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t_dad = randspecies.getOrganisms().get(0);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tnew_genome = evolutionStrategy.getCrossoverStrategy().performCrossover(mom,_dad,count);\r\n\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(MATE_ONLY_PROB) || \r\n\t\t\t\t\t\t\t_dad.getGenome().getId() == mom.getGenome().getId() || \r\n\t\t\t\t\t\t\t_dad.getGenome().compatibility(mom.getGenome()) == 0.0) {\r\n\r\n\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\t} \r\n\t\t\t\t\t// end block of prob\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\r\n\t\t\t\t\t// Create the baby without mutating first\r\n\t\t\t\t\telse \r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\tevolutionStrategy.getSpeciationStrategy().addOrganismToSpecies(pop, baby);\r\n\t\t\t} // end offspring cycle\r\n\t\t}\r\n\t}", "public static Population evolvePopulation(Population pop) {\n Population newPopulation = new Population(pop.populationSize(), false);\n\n // Keep our best individual if elitism is enabled\n int elitismOffset = 0;\n if (elitism) {\n newPopulation.saveTour(0, pop.getFittest());\n elitismOffset = 1;\n }\n\n // Crossover population\n // Loop over the new population's size and create individuals from\n // Current population\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n // Select parents\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n\n\n\n\n Tour[] temp_a = roullet( newPopulation);\n if( temp_a == null )\n {\n System.out.println(\"no a\");\n //r//eturn temp;\n }\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n Tour parent1 = temp_a[0];\n Tour parent2 = temp_a[1];\n\n\n\n\n\n\n\n\n // Crossover parents\n Tour child = crossover(parent1, parent2);\n // Add child to new population\n newPopulation.saveTour(i, child);\n }\n\n // Mutate the new population a bit to add some new genetic material\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n mutate(newPopulation.getTour(i));\n }\n\n return newPopulation;\n }", "public static void runGeneration(){\r\n adjust = generationSize*generation;\r\n //Send out the ants to their start points\r\n for (int i = generationSize -1; i>0; i--) {\r\n colony.get(i + adjust).startPositions(sets);\r\n }\r\n //initialises the latch with a counter for each ant in a generation\r\n latch = new CountDownLatch(generationSize);\r\n //move the ants out until they have found a valid solution or seen all nodes\r\n //create a new thread for each ant in the generation\r\n for (int i = 0; i<generationSize;i++) {\r\n Generation temp = new Generation(i);\r\n //starts the new thread\r\n temp.start();\r\n }\r\n try {\r\n //wait until all the ants in a generation have completed their paths\r\n latch.await();\r\n }\r\n catch(Exception e)\r\n {\r\n System.out.println(\"error in latch.await\");\r\n }\r\n\r\n //Create the pheremone trail\r\n for (int i = 0; i<generationSize;i++) {\r\n Ant a = colony.get(i + adjust);\r\n for (Integer k: a.Path) {\r\n pheremones.set(k, pheremones.get(k) + 1);\r\n visited.set(k, visited.get(k) + 1);\r\n }\r\n }\r\n\r\n generation++;\r\n //degrade the pheremone trail\r\n if(generation > 1){\r\n for (int i = 0; i < pheremones.size(); i++){\r\n pheremones.set(i, pheremones.get(i) - degrade);\r\n if (pheremones.get(i) < 0) pheremones.set(i, 0);\r\n }\r\n }\r\n\r\n }", "@GetMapping(\"/splitBatchJob\")\n public String splitBatchJob() {\n try {\n JobParameters parameters = new JobParametersBuilder()\n .addString(\"JobId\", \"1\") //mengirim parameter ke job\n .toJobParameters();\n jobLauncher.run(splitImportDataPesertaFromCsv, parameters);\n\n } catch (Exception ex) {\n logger.error(\"ERROR LAUNCH importDataPesertaFromCsvJob : \", ex.getMessage(), ex);\n return \"ERROR LAUNCH importDataPesertaFromCsvJob : \" + ex.getMessage();\n }\n return \"JOB DONE !!\";\n }", "@Override\n\tpublic void execute()\n\t{\n\t\tSortedSet<String> active_agent_ids = sim.getactiveParticipantIdSet(\"group\");\n\t\tIterator<String> iter = active_agent_ids.iterator();\n\t\tString name;\n\t\tupdateLoanPlayers(active_agent_ids, iter);\n\n\t\tif (en.getRoundsPassed() == rounds)\n\t\t{\n\t\t\tdata.add(\n\t\t\t\t\t\t\t\" ==== Cycle \" + sim.getTime() + \" Begins (\" + en.getRoundsPassed() + ':' + en.getCurrentTurnType() + \") ==== \");\n\t\t\tdata.add(\n\t\t\t\t\t\t\t\"************************************************************************************************************ \");\n\t\t\tfor (Map.Entry<String, PoliticalGroup> entry : p_players.entrySet())\n\t\t\t{\n\t\t\t\twhile (iter.hasNext())\n\t\t\t\t{\n\t\t\t\t\tString id = iter.next();\n\t\t\t\t\tif (p_players.get(id) != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tname = p_players.get(id).getDataModel().getName();\n\t\t\t\t\t\tdata.add(\n\t\t\t\t\t\t\t\t\t\t\"===============================\" + name + \"===============================\");\n\t\t\t\t\t\tdata.add(\n\t\t\t\t\t\t\t\t\t\t\"Group population: \" + p_players.get(id).getDataModel().getMemberList().size());\n\t\t\t\t\t\tdata.add(\n\t\t\t\t\t\t\t\t\t\t\"Current reserve: \" + p_players.get(id).getDataModel().getCurrentReservedFood());\n\t\t\t\t\t\tdata.add(\"Greediness: \" + PoliticalGroup.getGreediness(p_players.get(\n\t\t\t\t\t\t\t\t\t\tid).getDataModel()));\n\t\t\t\t\t\tdata.add(\"++++++LOAN HISTORY OF THIS GROUP++++++\");\n\n\t\t\t\t\t\t//Display debtors / loans given\n\t\t\t\t\t\tdata.add(\"Debtors History-------------------------------\");\n\t\t\t\t\t\tMap<String, List<Tuple<Double, Double>>> loansGiven = PoliticalGroup.getLoansGiven(p_players.get(\n\t\t\t\t\t\t\t\t\t\tid).getDataModel());\n\t\t\t\t\t\tif (loansGiven != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSet<String> debtors = loansGiven.keySet();\n\t\t\t\t\t\t\tfor (String deb : debtors)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tString gname;\n\t\t\t\t\t\t\t\tif (PublicEnvironmentConnection.getInstance().getGroupById(deb) == null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tgname = \"A DEAD GROUP\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tgname = PublicEnvironmentConnection.getInstance().getGroupById(\n\t\t\t\t\t\t\t\t\t\t\t\t\tdeb).getName();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdata.add(\"---->Debtor: \" + gname + \" has been given: \" + loansGiven.get(\n\t\t\t\t\t\t\t\t\t\t\t\tdeb).size() + \" loans from this group!\");\n\t\t\t\t\t\t\t\tdouble amountBorrowed = 0;\n\t\t\t\t\t\t\t\tfor (Tuple<Double, Double> t : loansGiven.get(deb))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tamountBorrowed += t.getKey() * (1 + t.getValue());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdata.add(\n\t\t\t\t\t\t\t\t\t\t\t\t\" This debtor has borrowed \" + amountBorrowed + \" units of food\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata.add(\"No loans given at the moment!\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdata.add(\"Creditors History-------------------------------\");\n\t\t\t\t\t\t//Display debtors / loans given\n\t\t\t\t\t\tMap<String, List<Tuple<Double, Double>>> loansTaken = PoliticalGroup.getLoansTaken(p_players.get(\n\t\t\t\t\t\t\t\t\t\tid).getDataModel());\n\t\t\t\t\t\tif (loansTaken != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSet<String> creditors = loansTaken.keySet();\n\t\t\t\t\t\t\tfor (String cred : creditors)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tString gname;\n\t\t\t\t\t\t\t\tif (PublicEnvironmentConnection.getInstance().getGroupById(cred) == null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tgname = \"A DEAD GROUP\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tgname = PublicEnvironmentConnection.getInstance().getGroupById(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcred).getName();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdata.add(\"---->Creditor: \" + gname + \" has given this group: \" + loansTaken.get(\n\t\t\t\t\t\t\t\t\t\t\t\tcred).size() + \" loans!\");\n\t\t\t\t\t\t\t\tdouble amountBorrowed = 0;\n\t\t\t\t\t\t\t\tfor (Tuple<Double, Double> t : loansTaken.get(cred))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tamountBorrowed += t.getKey() * (1 + t.getValue());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdata.add(\n\t\t\t\t\t\t\t\t\t\t\t\t\" This group has been given \" + amountBorrowed + \" units of food from this creditor\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata.add(\"No loans taken at the moment!\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdata.add(\" \");\n\t\t\t\titer = active_agent_ids.iterator();\n\t\t\t}\n\t\t\trounds++;\n\t\t}\n\t}", "@Override\r\n public void generateTasks() {\r\n int tasks = Integer.parseInt(this.getProperty(\"numTask\", \"1000\"));\r\n setNumOfTasks(tasks);\r\n //TODO:fixed port here !!!! need to change!!!\r\n serverPort = Integer.parseInt(this.getProperty(\"reqServerPort\", \"5560\")); \r\n PROC_MAX = Integer.parseInt(this.getProperty(\"reqServerMaxConcurrentClients\",\"10\"));\r\n location = this.getProperty(\"location\", \"rutgers\");\r\n energyplusPropertyFile = this.getProperty(\"energyplusTemplate\", \"energyplus.property\");\r\n \r\n winnerTakeAll = Boolean.parseBoolean(this.getProperty(\"winnerTakeAll\",\"true\"));\r\n jobDistributionMap = new HashMap<Integer,Integer>();\r\n copyJobDistributionMap = new HashMap<Integer,Integer>();\r\n //System.out.println(\"energyplusPropertyFile:\"+energyplusPropertyFile);\r\n \r\n initInfoSystem();\r\n initDistributionSystem();\r\n startFedServer();\r\n }", "private void PrepareAll(TweetPreprocessor tweetPreprocessor, String Datasetpath) throws IOException\n\t{\n\t\tCSVParser parser = new CSVParser(new FileReader(Datasetpath),CSVFormat.EXCEL.withFirstRecordAsHeader());\n\n\t\tExecutorService threadpool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());\n\t\tfinal ConcurrentHashMap<String, String> txtHashMap = new ConcurrentHashMap<>();\n\t\tfinal ConcurrentHashMap<String, String> featHashMap = new ConcurrentHashMap<>();\n\t\tfinal ConcurrentHashMap<String, String> compHashMap = new ConcurrentHashMap<>();\n\t\tfinal ConcurrentHashMap<String, String> lexHashMap = new ConcurrentHashMap<>();\n\n\t\tint count = 0;\n\t\tfor (CSVRecord record : parser.getRecords())\n\t\t{\n\t\t\tSystem.out.println(\"Adding Task = \" + count);\n\t\t\tint finalCount = count;\n\n\t\t\tif (count == 17000)\n\t\t\t\tbreak;\n\t\t\tthreadpool.execute(() ->\n\t\t\t{\n\t\t\t\tSystem.out.println(\"Current Executing task : \" + finalCount);\n\t\t\t\tInstance tweet = new Instance(record.get(\"event\"),record.get(\"target\"),null,null);\n\t\t\t\tInstance[] preparedinstances = tweetPreprocessor.startProc(tweet);\n\n\t\t\t\ttxtHashMap.put(preparedinstances[0].getData().toString(), record.get(\"target\"));\n\t\t\t\tfeatHashMap.put(preparedinstances[1].getData().toString(), record.get(\"target\"));\n\t\t\t\tcompHashMap.put(preparedinstances[2].getData().toString(), record.get(\"target\"));\n\t\t\t\tlexHashMap.put(preparedinstances[3].getData().toString(), record.get(\"target\"));\n\t\t\t});\n\t\t\tcount++;\n\t\t}\n\t\t//Initiates an orderly shutdown in which previously submitted tasks are executed,\n //but no new tasks will be accepted\n\t\tthreadpool.shutdown();\n\n\t\twhile (!threadpool.isTerminated());\n\t\tSystem.out.println(\"ThreadPool is shutdown ..\");\n\n\t\ttry (BufferedWriter writer1 = new BufferedWriter(new FileWriter(Dataset + \"data_text.csv\"));\n\t\t\t BufferedWriter writer2 = new BufferedWriter(new FileWriter(Dataset + \"data_feature.csv\"));\n\t\t\t BufferedWriter writer3 = new BufferedWriter(new FileWriter(Dataset + \"data_complex.csv\"));\n\t\t\t BufferedWriter writer4 = new BufferedWriter(new FileWriter(Dataset + \"data_lexicon.csv\")))\n\t\t{\n\t\t\tfor (String tweet : txtHashMap.keySet())\n\t\t\t\twriter1.write(txtHashMap.get(tweet) + \",\" + tweet + \"\\n\");\n\t\t\tfor (String tweet : compHashMap.keySet())\n\t\t\t\twriter3.write(compHashMap.get(tweet) + \",\" + tweet + \"\\n\");\n\t\t\tfor (String tweet : lexHashMap.keySet())\n\t\t\t\twriter4.write(lexHashMap.get(tweet) + \",\" + tweet + \"\\n\");\n\t\t\tfor (String tweet : featHashMap.keySet())\n\t\t\t\twriter2.write(featHashMap.get(tweet) + \",\" + tweet + \"\\n\");\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void tournamentSelect(Individual[] individulas) {\n int length = individulas.length;\n int p1, p2;\n Individual[] array = setupArray(length, NUM_RULES, GENE_SIZE, COND_LEN);\n for (int i = 0; i < individulas.length; i++) {\n p1 = new Random().nextInt(length);\n p2 = new Random().nextInt(length);\n\n if (individulas[p1].getFitness() >= individulas[p2].getFitness()) {\n array[i] = new Individual(individulas[p1]);\n } else {\n array[i] = new Individual(individulas[p2]);\n }\n }\n\n matingPool = Arrays.copyOf(array, length);\n }", "public population(int size, boolean initial) {\n tours = new tour[size];\n for (int i = 0; i < tours.length; i++) {\n\t tour newTour = new tour();\n newTour.path();\n savetour(i, newTour);\n }\n }", "public static void main(String[] args) {\n Trip diving = new Trip(\"ScubaDiving\", new Money(2000.00, Currency.GBP),\n new HashSet<Gear>(Arrays.asList(Gear.BCD, Gear.DIVING_SUITS)),\n LocalDate.of(2021, 5, 3),\n new HashSet<Qualification>(Arrays.asList(Qualification.PADI_ADVANCED_OPEN_WATER)));\n\n // trip 2 - freediving trip\n // price per person\n Trip freeDiving = new Trip(\"FreeDiving\",\n new Money(500.00, Currency.GBP),\n new HashSet<Gear>(Arrays.asList(Gear.FREEDIVING_FINS, Gear.FREEDIVING_WET_SUITS, Gear.FREEDIVING_MASK)),\n LocalDate.of(2021, 8, 18),\n new HashSet<Qualification>(Arrays.asList(Qualification.AIDA_2)));\n\n // Lynn person detail\n Person lynn = new Person(\"Lynn\",\n new HashSet<Gear>(Arrays.asList(Gear.BCD, Gear.DIVING_SUITS)),\n new Money(2000.00, Currency.GBP),\n new HashSet<LocalDate>(Arrays.asList(LocalDate.of(2021, 5, 1), LocalDate.of(2021, 5, 2),\n LocalDate.of(2021, 5, 3))),\n new HashSet<Qualification>(Arrays.asList(Qualification.PADI_ADVANCED_OPEN_WATER, Qualification.PADI_OPEN_WATER)));\n\n // Tao person detail\n Person tao = new Person(\"TAO\",\n new HashSet<Gear>(Arrays.asList(Gear.BCD, Gear.DIVING_SUITS, Gear.FREEDIVING_MASK, Gear.FREEDIVING_WET_SUITS, Gear.FREEDIVING_FINS)),\n new Money(10000.00, Currency.GBP),\n new HashSet<LocalDate>(Arrays.asList(LocalDate.of(2021, 8, 18), LocalDate.of(2021, 5, 2),\n LocalDate.of(2021, 5, 3))),\n new HashSet<Qualification>(Arrays.asList(Qualification.PADI_ADVANCED_OPEN_WATER, Qualification.PADI_OPEN_WATER, Qualification.AIDA_2, Qualification.AIDA_3)));\n\n HashSet<Person> persons = new HashSet<>();\n HashSet<Trip> trips = new HashSet<>();\n\n persons.add(lynn);\n persons.add(tao);\n trips.add(diving);\n trips.add(freeDiving);\n\n// findTrip(persons, trips);\n\n Trip tripToGo = tripWithMaxPersons(persons, trips);\n\n System.out.println(\"Trip to go: \" + tripToGo.getName());\n System.out.println(\"=================================\");\n\n\n HashMap<Trip, HashSet<Person>> tripsAndPersons = findWhoReady(persons, trips);\n for(Trip trip: tripsAndPersons.keySet()){\n System.out.println(\"Trip \" + trip.getName() + \" ready: \" );\n HashSet<Person> personPerTrip = tripsAndPersons.get(trip);\n for(Person person: personPerTrip) {\n System.out.println(person.getName());\n }\n System.out.println(\"-------------------------------\");\n\n }\n\n\n // currency EURO\n // exchange rate?\n\n\n\n }", "@Override\n protected void compute() {\n\n if(this.workLoad > 16){\n System.out.println(\"Splitting Workload :: \"+this.workLoad);\n List<MyRecursiveAction> subTasks = new ArrayList<>();\n subTasks.addAll(createSubTasks());\n\n subTasks.forEach(tasks -> {\n tasks.fork();\n });\n }else{\n System.out.println(\"Doing Workload myself :: \"+this.workLoad);\n }\n }", "public static void mutation(Individual[] individuals) {\n for (int i = 0; i < POP_SIZE; i++) {\n for (int j = 0; j < GENE_SIZE; j++) {\n double randomNum = Math.random();\n if (randomNum < MUTATION_RATE) {\n randomNum = Math.random();\n ArrayList<String> bitsList = (ArrayList<String>) bits.clone();\n for (int g = 0; g < bitsList.size(); g++) {\n if (individuals[i].gene[j].equals(bitsList.get(g))) {\n String bit = bitsList.get(g);\n bitsList.remove(g);\n int index;\n if (randomNum < 0.5) {\n index = 0;\n } else {\n index = 1;\n }\n individuals[i].gene[j] = bitsList.get(new Random().nextInt(2));\n bitsList.add(bit);\n }\n }\n }\n }\n individuals[i].generateRulebase();\n }\n matingPool = Arrays.copyOf(individuals, individuals.length);\n }", "public void generateIndividual() {\n // Loop through all our destination cities and add them to our tour\n for (int cityIndex = 0; cityIndex < TourManager.numberOfCities(); cityIndex++) {\n setCity(cityIndex, TourManager.getCity(cityIndex));\n }\n // Randomly reorder the tour\n Collections.shuffle(tour);\n }", "public void run() {\r\n for(int i = group; i < 64; i += 4) {\r\n if(!m_teams[i].isOut()) {\r\n setSurvivingTeam(m_teams[i]);\r\n return;\r\n }\r\n }\r\n\r\n m_botAction.sendArenaMessage(\"No one won for Base \" + (group + 1));\r\n }", "private void creationLooper(String meal_id, String[] r_ids) throws InterruptedException {\n int count = 1;\n for(String recipe : r_ids) {\n Thread.sleep(500);\n createMeal(meal_id,recipe,count);\n count++;\n }\n }", "public static Map<Id,List<Tuple<Id,AgentId2PlannedDepartureTimeMapData>>> getAgentId2PlannedPTDepartureTimeMap(Population pop, Set<Id<Person>> agentIds){\n\n//\t\tAgentId2PlannedDepartureTimeMap.log.setLevel(AgentId2PlannedDepartureTimeMap.logLevel);\n\t\tMap<Id, List<Tuple<Id, AgentId2PlannedDepartureTimeMapData>>> agentId2PlannedDepartureMap = new TreeMap<Id, List<Tuple<Id, AgentId2PlannedDepartureTimeMapData>>>();\n\n\t\tfor (Person person : pop.getPersons().values()) {\n\t\t\tif(agentIds.contains(person.getId())){\n\n\t\t\t\t// person in set, so do something\n\n\t\t\t\tList<Tuple<Id, AgentId2PlannedDepartureTimeMapData>> plannedDepartureList = new ArrayList<Tuple<Id, AgentId2PlannedDepartureTimeMapData>>();\n\t\t\t\tagentId2PlannedDepartureMap.put(person.getId(), plannedDepartureList);\n\n\t\t\t\tPlan plan = person.getSelectedPlan();\n\t\t\t\tdouble runningTime = 0.0;\n\t\t\t\tboolean firstActDone = false;\n\t\t\t\tfor (PlanElement pE : plan.getPlanElements()) {\n\n\t\t\t\t\tif(pE instanceof Activity){\n\t\t\t\t\t\tActivity act = (Activity) pE;\n\n\t\t\t\t\t\tif(!firstActDone){\n\t\t\t\t\t\t\trunningTime = act.getEndTime().seconds();\n\t\t\t\t\t\t\tfirstActDone = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(act.getMaximumDuration().isUndefined()){\n\t\t\t\t\t\t\t\trunningTime += act.getMaximumDuration().seconds();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trunningTime = act.getEndTime().seconds();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(pE instanceof Leg){\n\n\t\t\t\t\t\tLeg leg = (Leg) pE;\n\n\t\t\t\t\t\tif(leg.getMode() == TransportMode.pt){\n\t\t\t\t\t\t\t// it's the start of a new pt leg, report it\n\t\t\t\t\t\t\tif (leg.getRoute() instanceof TransitPassengerRoute){\n\t\t\t\t\t\t\t\tTransitPassengerRoute route = (TransitPassengerRoute) leg.getRoute();\n\t\t\t\t\t\t\t\tplannedDepartureList.add(new Tuple<Id, AgentId2PlannedDepartureTimeMapData>(route.getAccessStopId(), new AgentId2PlannedDepartureTimeMapData(route.getAccessStopId(), runningTime, route.getLineId(), route.getRouteId())));\n\t\t\t\t\t\t\t} else if (leg.getRoute() != null) {\n\t\t\t\t\t\t\t\tlog.warn(\"unknown route description found - only know to handle ExperimentalTransitRoute, got \" + leg.getRoute().getClass().getCanonicalName());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// add the legs travel time\n\t\t\t\t\t\tif(leg.getTravelTime().isUndefined()){\n\t\t\t\t\t\t\tlog.debug(\"Undefined travel time found\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trunningTime += leg.getTravelTime().seconds();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn agentId2PlannedDepartureMap;\n\t}", "public Population InitSinglePopulation\n (int PopulationID, int NumberOfAgents, double MixedStrategy){\n \n MultiPopulation TempPopulation = new MultiPopulation();\n\n TempPopulation.setPopulationID(PopulationID);\n TempPopulation.setInitMixedStrategy(MixedStrategy);\n\n for(int j = 0; j < NumberOfAgents; j++){\n\n double TempDraw = rand.nextDouble();\n boolean TempAction = (TempDraw < MixedStrategy) ? true : false;\n MultiPopulationAgent TempAgentM = \n new MultiPopulationAgent(j,PopulationID,TempAction);\n \n TempPopulation.AgentList.add(TempAgentM);\n \n }\n \n TempPopulation.setActionList();\n return TempPopulation;\n }", "private void processData()\n\t{\n\t\tfor(String people :guestList)\n\t\t{\n\t\t\t\n\t\t\tString[] guestInfo = people.split(\",\");\n\t\t\tif(guestInfo[inviterIndex].equals(\"Adam\"))\n\t\t\t{\n\t\t\t\t//Adam invited friends list\n\t\t\t\tGuest guest = new Guest(guestInfo[guestIndex],Integer.valueOf(guestInfo[candyBroughtIndex]),Integer.valueOf(guestInfo[candyConsumedIndex]));\n\t\t\t\tint result =Integer.valueOf(guestInfo[candyBroughtIndex]) - Integer.valueOf(guestInfo[candyConsumedIndex]);\n\t\t\t\tguest.setInviter(\"Adam\");\n\t\t\t\tguest.setLeftOver(result);\n\t\t\t\tboolean isInvited = (result >= 0)? true : false;\n\t\t\t\tguest.setInvited(isInvited);\n\t\t\t\tguestMapList.put(guestInfo[guestIndex], guest);\n\t\t\t}else if(!guestMapList.isEmpty())\n\t\t\t{\n\t\t\t\tif(guestMapList.containsKey(guestInfo[inviterIndex]))\n\t\t\t\t{\n\t\t\t\t\tGuest inviter = guestMapList.get(guestInfo[inviterIndex]);\n\t\t\t\t\tif(Integer.valueOf(guestInfo[candyBroughtIndex])+inviter.getLeftOver()>0)\n\t\t\t\t\t{\n\t\t\t\t\t\tGuest guest = new Guest(guestInfo[guestIndex],Integer.valueOf(guestInfo[candyBroughtIndex]),Integer.valueOf(guestInfo[candyConsumedIndex]));\n\t\t\t\t\t\tint result =inviter.getLeftOver() + Integer.valueOf(guestInfo[candyBroughtIndex]) - Integer.valueOf(guestInfo[candyConsumedIndex]);\n\t\t\t\t\t\tguest.setLeftOver(result);\n\t\t\t\t\t\tguest.setInviter(inviter.getName());\n\t\t\t\t\t\t\n\t\t\t\t\t\tboolean isInvited = (result >= 0)? true : false;\n\t\t\t\t\t\tguest.setInvited(isInvited);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(inviter.getInviter().equals(\"Adam\")){\n\t\t\t\t\t\t//update inviter information\n\t\t\t\t\t\t\tinviter.setLeftOver(result);\n\t\t\t\t\t\t\tinviter.setInvited(isInvited);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tinviter.setNextGuest(guest);\n\t\t\t\t\t\tguestMapList.put(inviter.getName(), inviter);\n\t\t\t\t\t\t\n\t\t\t\t\t\t//add new guest to hashmap\n\t\t\t\t\t\tguestMapList.put(guestInfo[guestIndex], guest);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "private void divideTo3(Habitat habitat, Pool pool) {\n\t\tboolean found=false;\r\n\t\t\r\n\t\t// from two pools of size 4 construct 3 pools with 3,3 and 2 users\r\n\t\t\r\n\t\t//pool2.addUser(pool.getListOfUsers().get(0));\r\n\t\t//pool.removeUser(pool.getListOfUsers().get(0));\r\n\t\tPoolUtilities.setPool(pool);\r\n\t\tCollections.sort(habitat.getSivs(), PoolUtilities.ComparatorGC);\r\n\t\tfor(int i=0;i<habitat.getSivs().size() && !found ;i++)\r\n\t\t{\r\n\t\t\tif((habitat.getSivs().get(i).getListOfUsers().size()>3) && habitat.getSivs().get(i) != pool)\r\n\t\t\t{\r\n\t\t\t\tfor(int j=0;j<habitat.getSivs().get(i).getListOfUsers().size() && !found;j++)\r\n\t\t\t\t{\r\n\t\t\t\t\t//int randomNum = rand.nextInt(habitat.getSivs().get(i).getListOfUsers().size());\r\n\t\t\t\t\tfor(int k=0;k<pool.getListOfUsers().size() && !found;k++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint numU1,numU2;\r\n\t\t\t\t\t\tnumU1 = habitat.getSivs().get(i).getListOfUsers().get(j).getNumUser();\r\n\t\t\t\t\t\tnumU2 = pool.getListOfUsers().get(k).getNumUser();\r\n\t\t\t\t\t\tif(Utilisateurs.getAuthorizedUsers()[numU1][numU2]==1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tPool pool2 = new Pool();\r\n\t\t\t\t\t\t\tpool2.addUser(habitat.getSivs().get(i).getListOfUsers().get(j));\r\n\t\t\t\t\t\t\tpool2.addUser(pool.getListOfUsers().get(k));\r\n\t\t\t\t\t\t\tif(pool2.buildRoutes())\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tpool.removeUser(pool.getListOfUsers().get(k));\r\n\t\t\t\t\t\t\t\thabitat.getSivs().get(i).removeUser(habitat.getSivs().get(i).getListOfUsers().get(j));\r\n\t\t\t\t\t\t\t\thabitat.getSivs().get(i).buildRoutes();\r\n\t\t\t\t\t\t\t\tpool.buildRoutes();\r\n\t\t\t\t\t\t\t\thabitat.addPool(pool2);\r\n\t\t\t\t\t\t\t\tfound=true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//pool2.addUser(user);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}", "private IndividualGroupList adaptativeSplitIntoGroups(List<Individual> individuals) \n {\n int individualCount = individuals.size();\n\n IndividualGroupList groups = new IndividualGroupList();\n IndividualGroup group = new IndividualGroup();\n int currentGroupSize = 8;\n \n for (int i = 0; i < individualCount; i++)\n {\n Individual individual = individuals.get(i);\n\n int individualGroupSize = getGroupSize(individual.getPositiveProbability());\n\n if (individualGroupSize != currentGroupSize || group.countIndividuals() == currentGroupSize)\n {\n groups.add(group);\n group = new IndividualGroup();\n currentGroupSize = individualGroupSize;\n }\n\n group.add(individual);\n }\n\n if (group.countIndividuals() > 0)\n groups.add(group);\n \n return groups;\n }", "public void startSimulation(){\n Enumeration enumAgents = agents.elements();\n\n while (enumAgents.hasMoreElements()) {\n ProcessData data = (ProcessData) enumAgents.nextElement();\n createThreadFor(data.agent).start();\n }\n }", "private void createCommunalPlaces(int populationSize) {\n int nHospitals = populationSize / PopulationParameters.get().buildingDistribution.populationToHospitalsRatio;\n int nSchools = populationSize / PopulationParameters.get().buildingDistribution.populationToSchoolsRatio;\n int nShops = populationSize / PopulationParameters.get().buildingDistribution.populationToShopsRatio;\n int nOffices = populationSize / PopulationParameters.get().buildingDistribution.populationToOfficesRatio;\n int nConstructionSites = populationSize / PopulationParameters.get().buildingDistribution.populationToConstructionSitesRatio;\n int nNurseries = populationSize / PopulationParameters.get().buildingDistribution.populationToNurseriesRatio;\n int nRestaurants = populationSize / PopulationParameters.get().buildingDistribution.populationToRestaurantsRatio;\n int nCareHomes = populationSize / PopulationParameters.get().buildingDistribution.populationToCareHomesRatio;\n\n createNHospitals(nHospitals);\n createNSchools(nSchools);\n createNShops(nShops);\n createNOffices(nOffices);\n createNConstructionSites(nConstructionSites);\n createNNurseries(nNurseries);\n createNRestaurants(nRestaurants);\n createNCareHomes(nCareHomes);\n\n LOGGER.info(\"Total number of communal places = {}\", getCommunalPlaces().size());\n }", "@Given(\"^I have multiple trips in Journeys$\")\n public void iHaveMultipleTripsInJourneys() throws Throwable {\n throw new PendingException();\n }", "private ArrayList<Chromosome> selectParentsTournament() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n ArrayList<Chromosome> matingPool = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n\n // Run tournaments to select parents - for each parent\n for (int parentIdx = 0; parentIdx < Defines.crossoverParentCt; parentIdx++) {\n\n // Run tournaments - get random contestants (run.getPaTournamentSize())\n for (int tournIdx = 0; tournIdx < Defines.tournamentSize; tournIdx++) {\n int contestantID = Defines.randNum(0, this.chromosomes.size() - 1);\n matingPool.add(this.chromosomes.get(contestantID));\n }\n Collections.sort(matingPool);\n parents.add(matingPool.get(0));\n }\n\n return parents;\n }", "@Override\n public void runSimulation() throws Exception {\n // Call a method that initializes the barrier\n // synchronizers and assigns them to the Beings.\n // TODO -- you fill in here.\n \n\n // Call a method that uses the common fork-join pool to run a\n // pool of threads that represent the Beings in this\n // simulation.\n // TODO -- you fill in here.\n \n }", "@Override\n public void run() {\n if (nearMe.size() < HelperConstants.MAX_BYZANTINE_USERS + 1) {\n // If there are less nearby neighbors than required, there is no need to ask for proofs\n return;\n }\n\n for (GridUser gridUser: nearMe) {\n int targetPort = Utils.getListenerServicePortFromId(gridUser.getId());\n\n Thread t = new Thread(() -> sendRecordAndReceive(myRequest, gridUser, targetPort));\n t.start();\n ongoingProofRequests.add(t);\n }\n\n try {\n for (Thread t: ongoingProofRequests) {\n t.join();\n }\n } catch (InterruptedException e) {\n e.printStackTrace();\n for (Thread t: ongoingProofRequests) t.interrupt();\n }\n }", "private void createAllGames() {\n\t\t// Create a melee game for each melee arena\n\t\tmeleeArenaManager.loadArenas();\n\t\tmeleeArenaManager.getArenas().forEach(meleeArena -> {\n\t\t\tMeleeGame game = new MeleeGame(meleeArena);\n\t\t\tmeleeGameManager.addGame(meleeArena.getName(), game, new PerMapLegacyLobby(game, PlayerProfile::restore, Melee.MELEE_CHAT_PREFIX));\n\t\t});\n\t\t\n\t\t// Create a rabbit game for each rabbit arena\n\t\trabbitArenaManager.loadArenas();\n\t\trabbitArenaManager.getArenas().forEach(rabbitArena -> {\n\t\t\tRabbitGame game = new RabbitGame(rabbitArena);\n\t\t\trabbitGameManager.addGame(rabbitArena.getName(), game, new PerMapLegacyLobby(game, PlayerProfile::restore, Melee.RABBIT_CHAT_PREFIX));\n\t\t});\n\t\t\n\t\t// Log out what games were created\n\t\tString meleeGamesList = meleeGameManager.getGamesList().stream()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .map(game -> game.getArena().getName())\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .collect(Collectors.joining(\", \"));\n\t\tgetLogger().info(\"Created Melee Games for arenas : \" + meleeGamesList);\n\n\t\tString rabbitGamesList = rabbitGameManager.getGamesList().stream()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .map(game -> game.getArena().getName())\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t .collect(Collectors.joining(\", \"));\n\t\tgetLogger().info(\"Created Rabbit Games for arenas : \" + rabbitGamesList);\n\t}", "public ArrayList<Population> InitializePopulations (int NumberOfPopulations, int NumberOfAgents){\n \n ArrayList<Population> PopulationsList = new ArrayList();\n \n if(NumberOfPopulations == 1){\n \n PopulationsList.add(InitSinglePopulation(NumberOfAgents));\n \n }else{\n \n for(int i = 0; i < NumberOfPopulations; i++){ \n double temp = rand.nextDouble();\n PopulationsList.add(InitSinglePopulation(i, NumberOfAgents, temp));\n }\n \n }\n \n \n return PopulationsList;\n }", "public static void main(String[] args) {\n\t\tForkJoinPool core = ForkJoinPool.commonPool() ;\n\t\tSystem.out.println(core.getParallelism());\n\t\t\n\t\t// Paralle() on a stream\n\t\tStream stream =Stream.of(\"Shobhit\",\"Mahesh\",\"Suresh\",\"Anand\",\"Andrew\");\n\t\tStream.of(\"Shobhit\",\"Mahesh\",\"Suresh\",\"Anand\",\"Andrew\").forEach(System.out::println);\n\t\tSystem.out.println(\"------\");\n\t\tStream.of(\"Shobhit\",\"Mahesh\",\"Suresh\",\"Anand\",\"Andrew\").parallel().forEach(System.out::println);\n\t\tSystem.out.println(\"------\");\n\t\t//2 .Use ParallelStream method at a collector \n\t\tArrays.asList(\"Shobhit\",\"Mahesh\",\"Suresh\",\"Anand\",\"Andrew\").parallelStream().forEach(System.out::println);\n\t\tSystem.out.println(\"------\");\n\t\t//3.Range method\n\t\tIntStream.rangeClosed(0, 10).forEach(System.out::println);\n\t\tSystem.out.println(\"------\");\n\t\tIntStream.rangeClosed(0, 10).parallel().forEach(System.out::println);\n\t\t//Print in Alaphabetical order\n\t\t//System.out.println(getArrayList());\n\t\tgetArrayList().stream().forEach(System.out::println);\n\t\tgetArrayList().parallelStream().forEach(System.out::println);\n\t\t//Check stream is running in Parallel Mode :-isParallel() Method is there\n\t\tIntStream s1=IntStream.rangeClosed(1,10);\n\t\tSystem.out.println(s1.isParallel()); // to check whether stream is running paralllel or not\n\t\tIntStream s2=IntStream.rangeClosed(1,10);s2.parallel();\n\t\tSystem.out.println(s2.isParallel());\n\t}", "private static void generateWorld(){\n for(int i = 0; i < SIZE*SIZE; i++){\n new Chunk();\n }\n }", "public static void main(String[] args) {\n String fileName = \"data1.txt\";\n \n \n //Load the data from the dataset file\n dataSet = getDataSet(fileName);\n \n //Setting up the output file\n String outputFileName = \"\";\n if (fileName.indexOf(\".\") > 0) {\n outputFileName = fileName.substring(0, fileName.lastIndexOf(\".\"));\n }\n \n createFile(outputFileName+\".csv\");\n \n //log the time the algorithm started\n long startTime = System.currentTimeMillis();\n \n //Placeholder of the fittest individual\n fittestIndividual = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n fittestIndividual.generateRulebase(); \n \n //Setup the mating pool\n matingPool = setupArray(POP_SIZE, NUM_RULES, GENE_SIZE, COND_LEN);\n \n //used to run the GA multiple times without doing it manually\n //set to 1 because we want to run the GA once\n for (int a = 0; a < 1; a++) {\n currentBest = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n currentBest.generateRulebase();\n\n //Generate a population\n generatePopulation();\n\n //Initial calculation of the fitness\n calculateFitness(population);\n\n for (int i = 0; i < GENERATION; i++) {\n average = 0; //reset the average\n currentBestArray[i] = currentBest.getFitness();\n \n tournamentSelect(population);\n\n //Calculate the fitness of the mating pool\n calculateFitness(matingPool);\n\n //Perfrom crossover on the mating pool\n crossover(matingPool);\n\n //Mutation\n mutation(matingPool);\n\n //Calculate the fitness of the mating pool\n calculateFitness(matingPool);\n\n //Evaluate the current population\n for (Individual individual : matingPool) {\n if (individual.getFitness() > currentBest.getFitness()) {\n currentBest = new Individual(individual);\n }\n average = average + individual.getFitness();\n }\n \n\n //Replace the population with the new generation\n for (int j = 0; j < POP_SIZE; j++) {\n population[j] = new Individual(matingPool[j]);\n }\n \n averageArray[i] = average / POP_SIZE;\n }\n \n //Check whether the current best is fitter than the global fittest individual\n if (currentBest.fitness > fittestIndividual.fitness) {\n fittestIndividual = new Individual(currentBest);\n //copy the fittest individuals performance\n fittestArray = Arrays.copyOf(currentBestArray, currentBestArray.length);\n }\n }\n\n System.out.println(\"Best fitness generated for the dataset: \" + fittestIndividual.fitness);\n \n //output the rules\n printRules(fittestIndividual.getRulebase());\n \n //Save the performance data into the output file\n for (int i = 0; i < fittestArray.length; i++) {\n addToFile(i, fittestArray[i], averageArray[i]);\n }\n \n //close the file\n close();\n \n //Evaluate the fitness agaisnt the dataset\n calculateFitness(fittestIndividual);\n double accuracyPercentage = ((double) 100 / dataSet.size()) * fittestIndividual.fitness;\n System.out.format(\"%.2f%% accuracy on the datase set.\\n\", accuracyPercentage);\n \n //Log the duration it took\n long duration = System.currentTimeMillis() - startTime;\n System.out.println(\"Completed in \" + String.format(\"%02d min, %02d.%02d sec\",\n TimeUnit.MILLISECONDS.toMinutes(duration),\n TimeUnit.MILLISECONDS.toSeconds(duration)\n - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)),\n TimeUnit.MILLISECONDS.toMillis(duration) - TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(duration))\n ));\n }", "public static List<Future<Result>> createEnergyJobs(List<List<Rotamer>> rotamerSpace, Peptide startingPeptide, Set<RotamerPair> incompatiblePairs,\n ConcurrentHashMap<Rotamer,Double> tempMap1, ConcurrentHashMap<RotamerPair,Double> tempMap2,\n AtomicDouble backboneEnergy)\n {\n //System.out.println(new Date());\n //System.out.print(\"Preparing to create energy jobs...\");\n\n // create all glycine peptide\n Peptide templatePeptide = startingPeptide;\n ProtoAminoAcid glycine = ProtoAminoAcidDatabase.getTemplate(\"standard_glycine\");\n for (Residue residue : templatePeptide.sequence)\n {\n if ( residue.isHairpin )\n continue;\n templatePeptide = SidechainMutator.mutateSidechain(templatePeptide, residue, glycine);\n }\n\n // create jobs\n //System.out.print(\"single rotamer jobs...\");\n List<Future<Result>> futures = new ArrayList<>(); \n \n // create rotamer jobs\n // we minimize the amount of work by going across each row of rotamers\n // that is, we take the first rotamer at each position and make a peptide\n // then we go down the list, skipping positions where there aren't enough rotamers\n // incompatibles should not be an issue because those interactions will be ignored\n int maxIndex = 0;\n for (List<Rotamer> list : rotamerSpace)\n {\n if ( list.size() - 1 > maxIndex )\n maxIndex = list.size() -1;\n }\n\n for (int i=0; i <= maxIndex; i++)\n {\n List<Rotamer> theseRotamers = new LinkedList<>();\n for (List<Rotamer> list : rotamerSpace) \n {\n if ( i < list.size() )\n theseRotamers.add( list.get(i) );\n }\n ImmutableList<Rotamer> theseRotamers2 = ImmutableList.copyOf(theseRotamers);\n RotamerEnergyJob job = new RotamerEnergyJob(templatePeptide, theseRotamers2, theseRotamers2, tempMap1, backboneEnergy);\n Future<Result> f = GeneralThreadService.submit(job);\n futures.add(f);\n }\n\n // create rotamer pair jobs\n // we save time by just computing the interactions between the rotamers without the backbone present\n //System.out.println(new Date());\n //System.out.println(\"rotamer pair jobs...\");\n AStarEnergyCalculator.PairIterator iterator = new AStarEnergyCalculator.PairIterator(rotamerSpace, 1000);\n int count = 0;\n while (iterator.hasNext())\n {\n count++;\n LinkedListMultimap<Rotamer,Rotamer> thisBatch = iterator.next();\n RotamerPairEnergyJob job = new RotamerPairEnergyJob(templatePeptide, incompatiblePairs, thisBatch, tempMap2);\n Future<Result> f = GeneralThreadService.submit(job);\n futures.add(f);\n //System.out.printf(\"%d jobs created \\r\", count);\n }\n //System.out.println(\"\\nAll jobs created.\");\n return futures;\n }", "static void test1() {\n\n System.out.println( \"Begin test1. ===============================\\n\" );\n\n Thread init = Thread.currentThread(); // init spawns the Mogwais\n\n // Create a GremlinsBridge of capacity 3.\n GremlinsBridge gBridge = new GremlinsBridge( 3 );\n\n int delay = 1000;\n\n // Create the Mogwais and store them in an array.\n Thread peds[] = {\n new Mogwai( \"Al\", 3, SIDE_ONE, gBridge ),\n new Mogwai( \"Bob\", 2, SIDE_ONE, gBridge ),\n new Mogwai( \"Cathy\", 2, SIDE_TWO, gBridge ),\n new Mogwai( \"Doris\", 3, SIDE_TWO, gBridge ),\n new Mogwai( \"Edith\", 3, SIDE_ONE, gBridge ),\n new Mogwai( \"Fred\", 2, SIDE_TWO, gBridge ),\n };\n\n for ( int j = 0; j < peds.length; ++j ) {\n // Run them by calling their start() method.\n try {\n peds[j].start();\n init.sleep( delay ); // delay start of next mogwai\n }\n catch ( InterruptedException e ) {\n System.err.println( \"Abort. Unexpected thread interruption.\" );\n }\n }\n // Now, the test must give the mogwai time to finish their crossings.\n for ( int j = 0; j < peds.length; ++j ) {\n try {\n peds[j].join(); // wait for next mogwai to finish\n }\n catch ( InterruptedException e ) {\n System.err.println( \"Abort. Unexpected thread interruption.\" );\n }\n }\n\n System.out.println( \"\\n=============================== End test1.\" );\n }", "public int produce(int min, int max, int start, int subpopulation, Individual[] inds, ec.EvolutionState state, int thread)\n/* */ {\n/* 27 */ int n = this.sources[0].produce(min, max, start, subpopulation, inds, state, thread);\n/* */ \n/* */ \n/* */ \n/* 31 */ if (!state.random[thread].nextBoolean(this.likelihood)) {\n/* 32 */ return reproduce(n, start, subpopulation, inds, state, thread, false);\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* 38 */ if (!(this.sources[0] instanceof ec.BreedingPipeline)) {\n/* 39 */ for (int q = start; q < n + start; q++) {\n/* 40 */ inds[q] = ((Individual)inds[q].clone());\n/* */ }\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 48 */ if (!(inds[start] instanceof TestCaseCandidate))\n/* 49 */ state.output.fatal(\"OurMutatorPipeline didn't get an Chromosome.The offending individual is in subpopulation \" + \n/* 50 */ subpopulation + \" and it's:\" + inds[start]);\n/* 51 */ ChromosomeSpecies species = (ChromosomeSpecies)inds[start].species;\n/* */ \n/* */ \n/* */ \n/* 55 */ for (int q = start; q < n + start; q++)\n/* */ {\n/* 57 */ TestCaseCandidate i = (TestCaseCandidate)inds[q];\n/* 58 */ double mutp = 1.0D / i.getGenes().size();\n/* */ \n/* 60 */ double[] propa = new double[i.getGenes().size()];\n/* 61 */ for (int x = 0; x < i.getGenes().size(); x++)\n/* 62 */ propa[x] = mutp;\n/* 63 */ for (int x = 0; x < i.getGenes().size(); x++) {\n/* 64 */ if (state.random[thread].nextBoolean(propa[x]))\n/* */ {\n/* */ \n/* 67 */ ((csbst.generators.AbsractGenerator)i.getGenes().get(x)).mutate();\n/* */ }\n/* */ }\n/* */ \n/* 71 */ i.evaluated = false;\n/* */ }\n/* */ \n/* 74 */ return n;\n/* */ }", "public static void main (String[] args){\n Fork[] fork = new Fork[5];\n Philosopher[] philosophers = new Philosopher[5];\n State state = new State();\n\n //CREATING FORKS FOR EVERY PHILOSOPHER\n for (int i = 0; i < 5; i++){\n fork[i] = new Fork();\n }\n\n //CREATING A PHILOSOPHER AS WELL AS THEIR THREAD AND PRINT THAT THEY START OUT BY THINKING\n for ( int i = 0; i < 5; i++){\n philosophers[i] = new Philosopher(i, fork[i], fork[(i+4) % 5], state);\n Thread philnum = new Thread(philosophers[i]);\n //int phil = i + 1;\n System.out.println(\"Philosopher \" + (i+1) + \" is thinking\");\n philnum.start();\n }\n\n }", "private void modifyIndividuals(){\n for(AbstractBehaviour behaviour: entityBehaviours){\n JSONObject jsonPop = null;\n GeneticInterface gi = interfaceMap.get(behaviour);\n try {\n jsonPop = gi.receiveNewPopulation();\n } catch (IOException e) {\n e.printStackTrace();\n }\n for(String key: jsonPop.keySet()){\n JSONArray funArray = jsonPop.getJSONObject(key).getJSONArray(\"functions\");\n List<Function> functions = new LinkedList<>();\n for(int a = 0; a <funArray.length(); a++){\n String tree = funArray.getString(a);\n Function functionTree = Node.treeFromString(tree, behaviour.getNumberOfInputs());\n functions.add(functionTree);\n }\n behaviour.setEntityByName(key, functions);\n }\n behaviour.resetEntities();\n }\n }", "public static void fullSimulation(Plant[] array, Herbivore[] herbArray, Carnivore[] carnArray, int runTime){\r\n // if we want to generate new organisms during the simulation, we'll need to \r\n // keep track of the array number tally. to do this we'll introduce \r\n // new variables to keep a running tally\r\n int runningTally = startingPlants;\r\n int herbTally = startingHerbivores;\r\n int carnTally = startingCarnivores;\r\n // we'll need to keep track of how many organisms are added on a given \r\n // day, but in order to prevent unjustified exponential growth, this \r\n // variable needs to reset to 0 at the beginning of a day\r\n int dailyAddition = 0;\r\n int dailyHerbivores = 0;\r\n int dailyCarnivores = 0;\r\n // now we'll actually run our simulation for the full length of its\r\n // run time, only retrieving organism data after the simulation is complete\r\n for(int simRun = 0; simRun < runTime; simRun++){\r\n // if we add the runningTally inside the day event for loop, we'll get an error \r\n // thrown every time, so we'll add to the tally outside of the for loop\r\n runningTally = runningTally + dailyAddition;\r\n herbTally = herbTally + dailyHerbivores;\r\n carnTally = carnTally + dailyCarnivores;\r\n // reseting daily addition so we aren't repeatedly adding the same plants\r\n // over and over again\r\n dailyAddition = 0;\r\n dailyHerbivores = 0;\r\n dailyCarnivores = 0;\r\n // this for loop represents a single day's events\r\n // going with total organism count let's all organisms run through their day, even\r\n // if there are different numbers of plants, herbivores, and carnivores\r\n for (int dp = 0; dp < totalCreatures; dp++){\r\n // we repeat the for loop so we can include a break statement such that\r\n // if the for loop iteration cap exceeds the plant total, which it\r\n // almost surely will, we can break out of the loop without breaking \r\n // out of the daily loop, letting the day complete for all organisms\r\n for(int vp = 1; vp == 1; vp++){\r\n if(dp >= runningTally){\r\n break;\r\n } else {\r\n array[dp].dayPass();\r\n boolean makeMore = array[dp].reproduce(reproductionEnergy);\r\n if(makeMore){\r\n array[(runningTally + dailyAddition)] = new Plant();\r\n totalPlants += 1;\r\n totalCreatures += 1;\r\n array[(runningTally + dailyAddition)].getLocation();\r\n array[(runningTally + dailyAddition)].shaded();\r\n if(array[(runningTally + dailyAddition)].inShade()){\r\n shadedPlant += 1;\r\n } // close makeMore loop\r\n dailyAddition += 1;\r\n }\r\n }\r\n }\r\n for(int hp = 1; hp == 1; hp++){\r\n if(dp >= herbTally){\r\n break;\r\n } else {\r\n totalPlantsEaten = totalPlantsEaten + herbArray[dp].dayWalk(herbivoreSpeed, array, runningTally);\r\n boolean makeMoreHerbs = herbArray[dp].reproduce();\r\n if(makeMoreHerbs){\r\n herbArray[(herbTally + dailyHerbivores)] = new Herbivore();\r\n totalHerbivores += 1;\r\n totalCreatures += 1;\r\n herbArray[(herbTally + dailyHerbivores)].getX();\r\n herbArray[(herbTally + dailyHerbivores)].getY();\r\n dailyHerbivores += 1;\r\n } // close makeMoreHerbs loop\r\n boolean starved = herbArray[dp].starvation();\r\n if(starved){\r\n totalHerbivoreStarved += 1;\r\n }\r\n }\r\n }\r\n for(int cp = 1; cp == 1; cp++){\r\n if(dp >= carnTally){\r\n break;\r\n } else {\r\n totalHerbivoreEaten = totalHerbivoreEaten + carnArray[dp].dayHunt(carnivoreSpeed, herbArray, herbTally);\r\n boolean makeMoreCarns = carnArray[dp].reproduce();\r\n if(makeMoreCarns){\r\n carnArray[(carnTally + dailyCarnivores)] = new Carnivore();\r\n totalCarnivores += 1;\r\n totalCreatures += 1;\r\n carnArray[(carnTally + dailyCarnivores)].getX();\r\n carnArray[(carnTally + dailyCarnivores)].getY();\r\n dailyCarnivores += 1;\r\n } // close makeMoreHerbs loop\r\n boolean starved = carnArray[dp].starvation();\r\n if(starved){\r\n totalCarnivoreStarved += 1;\r\n }\r\n }\r\n }\r\n } // closes single day loop\r\n System.out.println(\" \");\r\n System.out.println(\"Day \" + (simRun + 1) + \" ended.\");\r\n System.out.println(\"Total Plants: \" + totalPlants);\r\n System.out.println(\"Total Herbivores: \" + totalHerbivores);\r\n System.out.println(\"Total Carnivores: \" + totalCarnivores);\r\n System.out.println(\"Total Organisms: \" + totalCreatures);\r\n } // closes full sim run loop\r\n // now that the simulation is complete, we get the data on each of \r\n // our plants\r\n output();\r\n // and the stats for our herbivores\r\n \r\n }", "public ArrayList<Tour> doSelection(Population population) {\n double totalFitness = 0;\n for(Tour tour : population.getTourList()){\n totalFitness = totalFitness + tour.getFitness();\n }\n\n //sort tours by relative fitness\n SortedMap<Double, Tour> totalFitnessRelativity = new TreeMap<>();\n for(Tour tour: population.getTourList()){\n double key = tour.getFitness()/totalFitness;\n totalFitnessRelativity.put(key, tour);\n }\n\n //put tours on a number bar\n SortedMap<Double, Tour> numberBar = new TreeMap<>();\n double previousProbability = 0;\n for(Map.Entry<Double, Tour> entry : totalFitnessRelativity.entrySet()){\n double currentProbability = previousProbability + entry.getKey();\n numberBar.put(currentProbability, entry.getValue());\n previousProbability = currentProbability;\n }\n\n //choose a tour randomly according to how near it is to\n ArrayList<Tour> rouletteWheelOrder = new ArrayList<>();\n do{\n double randomNumber = new random.MersenneTwisterFast().nextDouble(0, numberBar.lastKey());\n for(Map.Entry<Double, Tour> numberBarSection : numberBar.entrySet()){\n if(randomNumber <= numberBarSection.getKey() && !rouletteWheelOrder.contains(numberBarSection.getValue())){\n rouletteWheelOrder.add(numberBarSection.getValue());\n break;\n }\n }\n } while(rouletteWheelOrder.size() != population.getTourList().size());\n return rouletteWheelOrder;\n }", "public static void main(String[] args) {\n\t\tfinal int COUNT =5;\n\t\tForkBuffer forkBuffer = new ForkBuffer(COUNT);\n\t\tPhilosopher philospher[]=new Philosopher[COUNT];\n\t\t\n\t\tfor(int i =0; i < COUNT; ++i){\n\t\t\tphilospher[i]= new Philosopher(i, forkBuffer, COUNT);\n\t\t\tphilospher[i].start();\n\t\t}\n\t}", "private static void farmMachines()\n {\n List<Automat> johnDeere = new ArrayList<Automat>();\n johnDeere.add(new SaeMaschine());\n johnDeere.add(new GiessMaschine());\n johnDeere.add(new ErnteMaschine());\n\n // Jemand muss nun endlich arbeiten\n System.out.println(\"Ja, jetzt wird wieder in die Hände gespuckt\\n\" +\n \"Wir steigern das Bruttosozialprodukt\\n\" +\n \"Ja, ja, ja, jetzt wird wieder in die Hände gespuckt\\n\");\n\n new Thread(() -> {\n for( Automat automat : johnDeere )\n {\n automat.arbeiten(maisFeld);\n if( automat instanceof SaeMaschine )\n {\n new SaeMaschine().arbeiten(maisFeld, \"Mais\");\n System.out.println(\"Maiskölbchen nach Arbeit: \" + maisFeld.size());\n }\n }\n }).start();\n\n new Thread(() -> {\n for( Automat automat : johnDeere )\n {\n automat.arbeiten(weizenFeld);\n if( automat instanceof SaeMaschine )\n {\n new SaeMaschine().arbeiten(weizenFeld, \"Weizen\");\n System.out.println(\"Weizenhalme nach Arbeit: \" + weizenFeld.size());\n }\n }\n }).start();\n }", "public void split(){\n\t\tamountOfShares = amountOfShares*2;\n\t}", "public static void evaluateGroupedProblemForm( EvolutionState state, boolean returnIndividuals,\n DataInputStream dataIn, DataOutputStream dataOut )\n {\n int numInds = -1;\n boolean countVictoriesOnly = false;\n Subpopulation[] subPop = null;\n \n try\n {\n numInds = dataIn.readInt();\n subPop = new Subpopulation[numInds];\n for(int x=0;x<numInds;x++)\n {\n int subPopNum = dataIn.readInt();\n // Here we need to know the subpopulation number so as to create the\n // correct type of subpopulation in order to create the correct type\n // of individual.\n if( state.population == null )\n state.population = new Population();\n if( state.population.subpops == null )\n state.population.subpops = new Subpopulation[subPopNum+1];\n if( state.population.subpops.length <= subPopNum )\n {\n Subpopulation[] temp = state.population.subpops;\n state.population.subpops = new Subpopulation[subPopNum+1];\n System.arraycopy( temp, 0, state.population.subpops, 0, temp.length );\n }\n if( state.population.subpops[subPopNum] == null )\n {\n Parameter param = new Parameter(P_SUBPOP).push(\"\" + subPopNum);\n subPop[x] = \n (Subpopulation)(state.parameters.getInstanceForParameterEq(\n param,null,\n Subpopulation.class));\n // Setup the subpopulation so that it is in a valid state.\n subPop[x].setup(state, param);\n state.population.subpops[subPopNum] = subPop[x];\n }\n else\n subPop[x] = state.population.subpops[subPopNum];\n }\n countVictoriesOnly = dataIn.readBoolean();\n }\n catch (IOException e)\n {\n state.output.fatal(\"Unable to read the subpopulation number from the master:\\n\"+e);\n }\n \n // Read the individuals from the stream\n Individual inds[] = new Individual[numInds];\n boolean updateFitness[] = new boolean[numInds];\n try\n {\n for(int i=0;i<inds.length;++i)\n {\n inds[i] = subPop[i].species.newIndividual( state, dataIn );\n updateFitness[i] = dataIn.readBoolean();\n }\n }\n catch (IOException e)\n {\n state.output.fatal(\"Unable to read individual from master.\");\n }\n \n // Evaluate the individual\n // TODO Check to make sure the real problem is an instance of GroupedProblemForm\n ((GroupedProblemForm)(state.evaluator.p_problem)).evaluate( state, inds, updateFitness, countVictoriesOnly, 0 );\n \n try\n {\n // Return the evaluated individual to the master\n // just write evaluated and fitness\n for(int i=0;i<inds.length;i++)\n {\n dataOut.writeByte(returnIndividuals ? V_INDIVIDUAL : (updateFitness[i] ? V_FITNESS : V_NOTHING));\n if (returnIndividuals)\n {\n inds[i].writeIndividual(state, dataOut);\n }\n else if (updateFitness[i])\n {\n dataOut.writeBoolean(inds[i].evaluated);\n inds[i].fitness.writeFitness(state,dataOut);\n }\n }\n dataOut.flush();\n }\n catch( IOException e ) { state.output.fatal(\"Caught fatal IOException\\n\"+e ); }\n }", "private List<BulkLoadElementTO> populateBulkLoadElementTO( int numElements ) {\n List<BulkLoadElementTO> lTOList = new ArrayList<BulkLoadElementTO>();\n\n for ( int i = 0; i < numElements; i++ ) {\n lTOList.add( new BulkLoadElementTO( i, WAREHOUSE_STOCK_LEVEL, QUEUED, \"\", C0, C1, C2 ) );\n }\n\n return lTOList;\n\n }", "static void test0() {\n\n System.out.println( \"Begin test0. ===============================\\n\" );\n\n Thread init = Thread.currentThread(); // init spawns the Mogwais\n\n // Create a GremlinsBridge of capacity 3.\n GremlinsBridge gremlinBridge = new GremlinsBridge( 3 );\n\n // Set an optional, test delay to stagger the start of each mogwai.\n int delay = 4000;\n\n // Create the Mogwais and store them in an array.\n Thread peds[] = {\n new Mogwai( \"Al\", 3, SIDE_ONE, gremlinBridge ),\n new Mogwai( \"Bob\", 4, SIDE_TWO, gremlinBridge ),\n };\n\n for ( int j = 0; j < peds.length; ++j ) {\n // Run them by calling their start() method.\n try {\n peds[j].start();\n init.sleep( delay );\n }\n catch ( InterruptedException e ) {\n System.err.println( \"Abort. Unexpected thread interruption.\" );\n break;\n }\n }\n // Now, the test must give the mogwai time to finish their crossings.\n for ( int j = 0; j < peds.length; ++j ) {\n try {\n peds[j].join();\n }\n catch ( InterruptedException e ) {\n System.err.println( \"Abort. Unexpected thread interruption.\" );\n break;\n }\n }\n System.out.println( \"\\n=============================== End test0.\" );\n return;\n }", "public void runExploration() {\n List<Queue<String>> smallSkierQueues = partitionQueue(skierQueue);\n List<Queue<String>> smallLiftQueues = partitionQueue(liftQueue);\n List<Queue<String>> smallhourQueues = partitionQueue(hourQueue);\n\n // run threads here\n long startTime = System.nanoTime();\n for(int i = 0; i < 8; i++) {\n SmallSkierThread runSmallSkier = new SmallSkierThread(smallSkierQueues.get(i));\n SmallLiftThread runSmallLift = new SmallLiftThread(smallLiftQueues.get(i));\n SmallHourThread runSmallHour = new SmallHourThread(smallhourQueues.get(i));\n runSmallSkier.start();\n runSmallHour.start();\n runSmallLift.start();\n }\n // -> Aggregate results here\n // ...\n // ...\n // ...\n // <- End aggregation\n long endTime = System.nanoTime();\n long duration = endTime - startTime;\n System.out.println(\"Concurrent Solution Runtime: \" + duration/1000f + \" microseconds\");\n }", "public static void main(String[] args) {\n ExecutorService executorService = Executors.newFixedThreadPool(50);\n for (int i = 0; i < 50; i++) {\n executorService.execute(() -> {\n//\t\t writeAttributesByType(\"D:\\\\myDailyDemo\\\\test_spring_hibernate\\\\src\\\\main\\\\resources\\\\yml\\\\test.yml\",\"PEOPLE\",map.clone());\n LinkedHashMap<String, Object> china = loadData(\"china\", \"C:\\\\myDailyDemo\\\\test_spring_hibernate\\\\src\\\\main\\\\resources\\\\yml\\\\test.yml\");\n System.out.println(china );\n });\n executorService.execute(() -> {\n LinkedHashMap<String, Object> people = loadData(\"people\", \"C:\\\\myDailyDemo\\\\test_spring_hibernate\\\\src\\\\main\\\\resources\\\\yml\\\\test.yml\");\n System.out.println(people );\n });\n }\n// ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);\n }", "public void initializePopulation(){\n\t\t// create the population\n\t\tfor(int i = 0; i < POPULATION_SIZE; i++){\n\t\t\t// get a random length for the building sequence\n\t\t\tint randArraySize = randomGenerator.nextInt(possiblePieces.length-1)+1;\n\t\t\t\n\t\t\tBuildingPiece[] pieceSequence = new BuildingPiece[randArraySize];\n\t\t\tfor(int j = 0; j < randArraySize; j++){\n\t\t\t\t// get a random possible piece and insert it into the sequence\n\t\t\t\tint randIndex = randomGenerator.nextInt(possiblePieces.length);\n\t\t\t\tpieceSequence[j] = possiblePieces[randIndex];\n\t\t\t}\n\t\t\t\n\t\t\t/* add a new number sequence with the newly created \n\t\t\t * sequence from the input */\n\t\t\tpopulation.add(new Building(pieceSequence, generation, possiblePieces));\n\t\t}\n\t}", "public Vector run(){\n generationCount = 0;\n solutionList = new Vector();\n bannedList = new Vector();\n solutionCounter = 0;\n whenToHalt.init();\n //INITIALIZE THE POPULATION\n\n population = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n fitnessArray = new double[populationSize];\n //COMPUTE FITNESSES\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) population.get(x);\n fitnessArray[x] = next.getFitness();\n }\n\n Arrays.sort(fitnessArray);\n\n while (! stop()){\n //RUN THROUGH THE GENERATIONS\n population = step();\n }\n\n if (useList){\n return solutionList;\n } else {\n return population;\n }\n }", "public static void worldTimeStep() {\n\t\t//System.out.println(\"Time Step: \" + count);\n\t\tcount = count + 1;\n\t for (Critter A : Critter.population){\n\t if(A.energy<=0){\n\t\t\t\tA.isAlive = false;\n }\n else if(A.energy>0){\n\t A.isAlive=true;\n A.doTimeStep();\n if(A.energy<0){\n\t\t\t\t\tA.isAlive = false;\n\t\t\t\t}\n }\n\n }\n\t\tfor (Iterator<Critter> iterator = Critter.population.iterator(); iterator.hasNext();){\n\t\t\tCritter tmp = iterator.next();\n\t\t\tif (tmp.isAlive == false){\n\t\t\t\titerator.remove();\n\t\t\t}\n\t\t}\n\n encounters2();\n\n\t\tfor (Iterator<Critter> iterator = Critter.population.iterator(); iterator.hasNext();){\n\t\t\tCritter tmp = iterator.next();\n\t\t\tif (tmp.isAlive == false){\n\t\t\t\titerator.remove();\n\t\t\t}\n\t\t}\n\n\t\tmapCheck();\n\t\t// we have add reproduction\n\n\t\t// we have to add algae\n\t\tfor (int i = 0; i < Params.refresh_algae_count; i = i + 1){\n\t\t\t//Algae child = new Algae();\n\t\t\t//child.setEnergy(Params.start_energy);\n\t\t\t//makecritter takes care of anything\n\t\t\ttry{\n\t\t\t\tmakeCritter(\"Algae\");\n\t\t\t}\n\t\t\tcatch(InvalidCritterException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\t//deduct rest energy\n\t\tfor (Critter A : Critter.population){\n\t\t\tA.energy = A.getEnergy() - Params.rest_energy_cost;\n\t\t\tif(A.getEnergy()<=0){\n\t\t\t\tA.isAlive=false;\n\t\t\t}\n\t\t}\n\t\tfor (Iterator<Critter> iterator = Critter.population.iterator(); iterator.hasNext();){\n\t\t\tCritter tmp = iterator.next();\n\t\t\tif (tmp.isAlive == false){\n\t\t\t\titerator.remove();\n\t\t\t}\n\t\t}\n\t\t//babies add\n\t\tfor(Critter b: babies){\n\t\t\tb.isAlive=true;\n\t\t\tpopulation.add(b);\n\t\t}\n\t\t//not sure if this removes everything\n\t\tbabies.clear();\n\t}", "@Override\r\n public void run() {\r\n while(true){\r\n // para cada peça necessária para um agente montar um produto faça\r\n for(Peca peca: pecasNecessarias){\r\n System.out.println(\"\\nRetirar Peça: \"+peca.getNome());\r\n // retira peça do estoque\r\n int pecasEmEstoque = estoque.retirarPecas(peca, peca.getQuantidadeEmEstoque());\r\n // se não há peças em estoque atraza a produção e ela para\r\n if(pecasEmEstoque <= 0) {\r\n System.exit(0);\r\n }\r\n if(ConfigAgents.TEMPO_MONGAGEM > 0) { // desativa simulação se valor 0 ou negativo\r\n try {\r\n // simulação do agente montando o produto com a peça\r\n sleep(ConfigAgents.TEMPO_MONGAGEM);\r\n } catch (InterruptedException ex) {\r\n Logger.getLogger(AgenteLinhaDeProducao.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n }\r\n }\r\n }", "private void addCopiesToPool(Establishment[] establishments, int numPlayers){\n for(Establishment c : establishments){\n c.setNumCopies(numPlayers);\n }\n }", "@Override\n public IndividualGroupList splitIndividualsIntoGroups(List<Individual> individuals) \n {\n sortByPositiveProbability(individuals);\n return adaptativeSplitIntoGroups(individuals);\n }", "private void startUpPhase()\n\t{\n\t\tmap.distributeCountries(); /* Randomly split the countries between the players */\n\t\tArrayList<Player> remainingPlayers = new ArrayList<Player>(map.players);\n\t\t\n\t\tdo \n\t\t{\n\t\t\tIterator<Player> i = remainingPlayers.iterator();\n\t\t\t\n\t\t\twhile (i.hasNext()) \n\t\t\t{\n\t\t\t\tPlayer p = i.next();\n\t\t\t\tif(p.getArmies() == 0) \n\t\t\t\t{\n\t\t\t\t\ti.remove();\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\tp.placeOneArmy();\n\t\t\t\t}\n\t\t\t}\n\t\t}while(remainingPlayers.size() != 0);\n\t}", "public void setUp() throws Exception {\n\n processDefinition = new ProcessDefinition();\n\n processDefinition.setProcessVariables(new ProcessVariable[]{\n ProcessVariable.forName(\"var1\"),\n ProcessVariable.forName(\"var2\")\n });\n\n Activity theLastJoinActivity = null;\n\n\n for(int i=1; i<20; i++) {\n Activity a1 = new DefaultActivity();\n\n // a1.setQueuingEnabled(true);\n\n if(i == 7 || i==1){\n a1 = new GatewayActivity();\n }\n\n a1.setTracingTag(\"a\" + i);\n processDefinition.addChildActivity(a1);\n\n if(i==7){\n theLastJoinActivity = a1;\n }\n }\n\n {\n Transition t1 = new Transition();\n t1.setSource(\"a9\");\n t1.setTarget(\"a1\");\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a10\");\n t1.setTarget(\"a9\");\n\n processDefinition.addTransition(t1);\n }\n\n {\n Transition t1 = new Transition();\n t1.setSource(\"a1\");\n t1.setTarget(\"a2\");\n t1.setCondition(new Evaluate(\"var1\", \"==\", \"true\"));\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a1\");\n t1.setTarget(\"a5\");\n t1.setCondition(new Evaluate(\"var2\", \"==\", \"true\"));\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a2\");\n t1.setTarget(\"a3\");\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a2\");\n t1.setTarget(\"a4\");\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a5\");\n t1.setTarget(\"a6\");\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a6\");\n t1.setTarget(\"a4\");\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a3\");\n t1.setTarget(\"a7\");\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a4\");\n t1.setTarget(\"a7\");\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a7\");\n t1.setTarget(\"a11\");\n\n processDefinition.addTransition(t1);\n }\n {\n Transition t1 = new Transition();\n t1.setSource(\"a11\");\n t1.setTarget(\"a12\");\n\n processDefinition.addTransition(t1);\n }\n\n processDefinition.afterDeserialization();\n\n ProcessInstance.USE_CLASS = DefaultProcessInstance.class;\n\n\n }", "protected static void creatingSimulationStats(int situation) {\n // Clearing previous simulation results.\n TrainStation.clearSimulationTrainQueues();\n\n // Getting the Waiting Room from the DataBase.\n Passenger[][] waitingRoomDB = Methods.readingDB();\n\n // Declaring a waiting Room to run the simulation on.\n Passenger[][] waitingRoom = new Passenger[2][42];\n\n // Running the simulation twice.\n for (int simulation = 1; simulation < 3; simulation++) {\n\n // Declaring and initializing a SimulationPassengerQueue[] to store simulation results.\n SimulationPassengerQueue[] trainQueues = new SimulationPassengerQueue[simulation];\n for (int i = 0; i < simulation; i++) {\n trainQueues[i] = new SimulationPassengerQueue();\n }\n\n // Initializing Waiting room for the simulation.\n for(int train = 0; train < waitingRoom.length; train++) {\n System.arraycopy(waitingRoomDB[train], 0, waitingRoom[train], 0, waitingRoomDB[train].length);\n }\n\n // Getting the Waiting room trainQueue.\n PassengerQueue trainQueue = TrainStation.getTrainQueue();\n\n for (int train = 0; train < 2; train++) {\n // Making the waiting room equal to the TrainStation.waitingRoom if its selected.\n if (situation == 0) {\n for (int passenger = 0; passenger < trainQueue.getQueueLength(train); passenger++) {\n String seatNumberTQ = trainQueue.getQueueArray(train)[passenger].getSeatNumber();\n if (waitingRoom[train][seatNumberConverter(seatNumberTQ)] != null) {\n if (waitingRoom[train][seatNumberConverter(seatNumberTQ)].getSeatNumber().equalsIgnoreCase(seatNumberTQ)) {\n waitingRoom[train][seatNumberConverter(seatNumberTQ)] = null;\n }\n }\n }\n }\n\n // Initializing the group number.\n int groupNumber = 0;\n // Running the simulation till the waiting room finishes.\n while (Methods.waitingRoomSize(train, waitingRoom) > 0) {\n // Increasing the group number.\n groupNumber++;\n\n // Declaring random.\n Random random = new Random();\n\n // Getting number rof passengers for the current group.\n int maxSelect = Methods.creatingMaxWQSelect(train, waitingRoom);\n\n // Creating a array for the Group and Populating it.\n SimulationPassenger[] passengersGroup = new SimulationPassenger[maxSelect];\n for (int select = 0; select < maxSelect; select++) {\n // Getting the current Waiting room without any null elements.\n Passenger[] sortedWaitingRoom = Methods.sortingWaitingRoom(train, waitingRoom);\n\n // Selecting a Passenger Randomly to the Group.\n int selection;\n do {\n selection = random.nextInt(sortedWaitingRoom.length);\n } while (sortedWaitingRoom[selection] == null);\n\n // Adding the selected passenger to the group.\n passengersGroup[select] = new SimulationPassenger(sortedWaitingRoom[selection], maxSelect, groupNumber);\n // Deleteing the added passenger from the waiting room.\n waitingRoom[train][Methods.seatNumberConverter(passengersGroup[select].getSeatNumber())] = null;\n }\n\n // Sorting the Group to according to the seat number (because passengers board according to the seat number).\n SimulationPassenger temp;\n for (int i = 0; i < passengersGroup.length; i++) {\n for (int j = i + 1; j < passengersGroup.length; j++) {\n if (passengersGroup[j].getSeatNumber().compareTo(passengersGroup[i].getSeatNumber()) < 0) {\n temp = passengersGroup[i];\n passengersGroup[i] = passengersGroup[j];\n passengersGroup[j] = temp;\n }\n }\n }\n\n // Selecting the Queue 2 if the Queue 1 is longer than Queue 2\n boolean isTQ2Selected = false;\n if (simulation == 2) {\n isTQ2Selected = trainQueues[0].getQueueLength(train) > trainQueues[1].getQueueLength(train);\n }\n\n // Initializing waiting time for a group.\n int secondsWaited = 0;\n // Adding every passenger in group to trainQueue.\n for (int passenger = 0; passenger < maxSelect; passenger++) {\n // Adding each passengers waiting time to the Queue waiting time.\n secondsWaited += passengersGroup[passenger].getSecondsInQueue();\n // Setting the waiting time in queue to each passenger.\n passengersGroup[passenger].setWaitingTime(secondsWaited);\n\n // Adding passengers to the Queue.\n if (isTQ2Selected) {\n trainQueues[1].add(passengersGroup[passenger], train);\n } else {\n trainQueues[0].add(passengersGroup[passenger], train);\n }\n\n }\n }\n }\n // Storing the simulation report.\n TrainStation.addToSimulationTrainQueues(trainQueues);\n }\n }", "private static void runCalculations()\n {\n // TODO Create two different empty concurrent histograms\n\n // Create a sleep time simulator, it will sleep for 10 milliseconds in each call\n BaseSyncOpSimulator syncOpSimulator = new SyncOpSimulSleep(10);\n\n // List of threads\n List<Runner> runners = new LinkedList<>();\n\n // Create the threads and start them\n for (int i = 0; i < NUM_THREADS; i ++)\n {\n // TODO Pass the proper histograms\n final Runner runner = new Runner(syncOpSimulator, null, null);\n runners.add(runner);\n new Thread(runner).start();\n }\n\n // Wait for runners to finish\n runners.forEach(Runner::waitToFinish);\n\n // TODO Show the percentile distribution of the latency calculation of each executeOp call for all threads\n }", "public void stepPopulation(int day){\r\n\t\tthis.resetComps();\r\n\t\tthis.resetPool();\r\n\t\tfor(int i = 0; i < this.getnVillages(); i++){\r\n\t\t\tVillage curr = this.vVillages[i];\r\n\t\t\tcurr.stepVillage(day);\r\n\t\t\tthis.incrementComps(curr.getComps());\r\n\t\t\tthis.updatePool(curr.getMarketPool());\r\n\t\t}\t\t\r\n\t}", "public void step(SimState simState) {\n if (state.agents.length > 0 && state.agents[0] instanceof EquitableAgent) {\n boolean shouldGenTasks = true;\n for(int i = 0; i < state.numAgents; i++) {\n EquitableAgent a = (EquitableAgent)state.agents[i];\n if (!EquitablePartitions.nearlyEqual(a.getRateInMyPolygon(), 1.0 / state.numAgents, .05)) {\n shouldGenTasks = false;\n }\n }\n if(shouldGenTasks) {\n generateTasks();\n }else if (state.schedule.getSteps() == 30000) {\n EquitableAgent a = (EquitableAgent)state.agents[0];\n a.setEp(null);\n }\n }else {\n generateTasks();\n }\n }", "private void mutate() {\n\t\tfor (int i = 0; i < population; ++i) {\n\t\t\tpopulationArray.set(i, populationArray.get(i).generateNeighbor());\n\t\t}\n\t}", "private void distribute() {\n\t\t\tfor (Entry<String, List<String>> r : groups.entrySet()) {\n\t\t\t\tRandom random = new Random();\n\t\t\t\tint randomIndex = random.nextInt(r.getValue().size());\n\t\t\t\tdistribution.put(r.getKey(), r.getValue().get(randomIndex));\n\t\t\t}\n\t\t}", "private static ArrayList<Integer> runSingleThread(Integer from, Integer to, PrimeStrategyEnum primeStrategyEnum) throws InterruptedException {\n PrimeStrategyThread primeStrategyThread = primeStrategiesThreadSwitch(primeStrategyEnum+\" single thread\", from, to, primeStrategyEnum);\n primeStrategyThread.start();\n primeStrategyThread.join();\n return primeStrategyThread.getPrimes();\n }", "@Override\n\tpublic void run() {\n\t\tMPMergeSortTest.MPParallelRandomGen(start, end, r, data);\n\n\t}", "private void initialisePools() {\r\n Integer[] bigPoolInts = {25, 50, 75, 100};\r\n Integer[] smallPoolInts = {1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10};\r\n bigPool = new ArrayList<Integer>( Arrays.asList(bigPoolInts) );\r\n smallPool = new ArrayList<Integer>(Arrays.asList(smallPoolInts));\r\n //mix them up\r\n Collections.shuffle( bigPool );\r\n Collections.shuffle( smallPool );\r\n }", "public static void makeGrid (Species map[][], int numSheepStart, int numWolfStart, int numPlantStart, int sheepHealth, int plantHealth, int wolfHealth, int plantSpawnRate) {\n \n // Declare coordinates to randomly spawn species\n int y = 0;\n int x = 0;\n \n // Initialise plants\n Plant plant;\n \n // Spawn plants\n for (int i = 0; i < numPlantStart; i++) {\n \n // Choose random coordinates to spawn\n y = (int)(Math.random() * map[0].length); \n x = (int)(Math.random() * map.length);\n \n // Checks for an empty space\n if (map[y][x] == null) { \n \n // Choose a random plant (50% chance healthy, 25% poisonous or energizing)\n int plantChoice = (int) Math.ceil(Math.random() * 100);\n \n // Create the new plants\n if ((plantChoice <= 100) && (plantChoice >= 50)) {\n plant = new HealthyPlant(plantHealth, x, y, plantSpawnRate);\n } else if ((plantChoice < 50) && (plantChoice >= 25)) {\n plant = new EnergizingPlant(plantHealth, x, y, plantSpawnRate);\n } else {\n plant = new PoisonousPlant(plantHealth, x, y, plantSpawnRate);\n }\n \n // Set plant coordinates\n plant.setX(x);\n plant.setY(y);\n map[y][x] = plant;\n \n // No space\n } else { \n i -= 1;\n }\n \n }\n \n // Spawn sheep\n for (int i = 0; i < numSheepStart; i++) { \n \n // Choose random coordinates to spawn\n y = (int)(Math.random() * map[0].length); \n x = (int)(Math.random() * map.length);\n \n // Checks for an empty space\n if (map[y][x] == null) {\n \n // Create new sheep\n Sheep sheep = new Sheep(sheepHealth, x, y, 5); \n \n // Set sheep coordinates\n sheep.setX(x);\n sheep.setY(y);\n map[y][x] = sheep;\n \n // No space\n } else { \n i -= 1; \n }\n \n }\n \n // Spawn wolves\n for (int i = 0; i < numWolfStart; i++) { \n \n // Choose random coordinates to spawn\n y = (int)(Math.random() * map[0].length); \n x = (int)(Math.random() * map.length);\n \n // Checks for an empty space\n if (map[y][x] == null) { \n \n // Create new wolf\n Wolf wolf = new Wolf(wolfHealth, x, y, 5); \n \n // Set wolf coordinates\n wolf.setX(x);\n wolf.setY(y);\n map[y][x] = wolf; \n \n // No space\n } else { \n i -= 1; \n }\n }\n \n }", "public static void runAGeneration() {\n //Breeds Population until max population size for genetic drift\n breedAll();\n\n //Genocides Population by fitness\n genocide();\n\n System.out.println(\"\\nPopulation: \");\n\n //prints population\n printPopulation();\n }", "private void sendToNodes(Sm.RetrieveChunkResponse chunkResponse, ArrayList<Sm.StorageNode> toSend) {\n\n System.out.println(\"Nodes to send to: \" + toSend);\n\n if (toSend.size() != 0) {\n EventLoopGroup workerGroup = new NioEventLoopGroup();\n PatrolMessagePipeline pipeline = new PatrolMessagePipeline();\n Bootstrap bootstrap = new Bootstrap()\n .group(workerGroup)\n .channel(NioSocketChannel.class)\n .option(ChannelOption.SO_KEEPALIVE, true)\n .handler(pipeline);\n\n// for (Sm.StorageNode node: toSend) {\n\n //create StoreChunkRequest\n Sm.StoreChunk chunk = Sm.StoreChunk.newBuilder()\n .setFileName(chunkResponse.getFilename())\n .setChunkId(chunkResponse.getChunkId())\n .setChunkSize(chunkResponse.getChunkSize())\n .setData(chunkResponse.getData())\n .setChunkName(chunkResponse.getChunkName())\n .build();\n\n Sm.StorageNodes nodes = Sm.StorageNodes.newBuilder()\n .addAllNodeList(toSend)\n .build();\n\n Sm.StorageNode primary = toSend.get(0);\n System.out.println(\"Primary: \" + primary.getIp());\n System.out.println(\"Primary: \" + primary.getPort());\n\n //Connect to the first replica\n ChannelFuture cf = bootstrap.connect(primary.getIp(), primary.getPort());\n cf.syncUninterruptibly();\n\n //Prepare Request & Wrap\n Sm.StoreChunkRequest request = Sm.StoreChunkRequest.newBuilder()\n .setChunk(chunk)\n .setNodes(nodes)\n .build();\n\n Sm.StorageMessageWrapper msgWrapper = Sm.StorageMessageWrapper.newBuilder()\n .setScRequest(request)\n .build();\n\n //Send\n Channel chan = cf.channel();\n PatrolInboundHandler handler = chan.pipeline().get(PatrolInboundHandler.class);\n Sm.StorageMessageWrapper response = handler.request(msgWrapper);\n\n if (response.getScResponse().getSuccess()) {\n System.out.println(\"StoreChunk successful?: \" + response.getScResponse().getSuccess());\n Controller.getInstance().updateReplicasAndChunkNames(toSend, chunk.getChunkName());\n }\n\n workerGroup.shutdownGracefully();\n }\n }" ]
[ "0.59466666", "0.59140044", "0.57112324", "0.55646116", "0.5556625", "0.5417826", "0.5340843", "0.53397864", "0.53011924", "0.52485156", "0.5227569", "0.5216509", "0.51801413", "0.5095126", "0.5085087", "0.5062935", "0.50570434", "0.50481296", "0.5041226", "0.5028944", "0.50118387", "0.5011095", "0.49709433", "0.49603328", "0.495253", "0.49421144", "0.49334002", "0.4890762", "0.4881655", "0.48706636", "0.48409554", "0.48388702", "0.48366776", "0.48358417", "0.48239115", "0.4813121", "0.48110944", "0.4802163", "0.47952566", "0.47952193", "0.4789489", "0.47817236", "0.47681826", "0.476534", "0.47634497", "0.47523278", "0.47478208", "0.47438106", "0.4735647", "0.47194213", "0.4719259", "0.4716711", "0.47097996", "0.47056344", "0.4704213", "0.46990827", "0.46960774", "0.46915066", "0.46882436", "0.468711", "0.46811503", "0.46800172", "0.46790436", "0.46706992", "0.46699637", "0.46600273", "0.46593642", "0.4653938", "0.4632601", "0.46325824", "0.46307865", "0.46301246", "0.46293932", "0.46245962", "0.46152776", "0.4613398", "0.46072802", "0.4590149", "0.45872608", "0.45811936", "0.4579442", "0.4577688", "0.4572966", "0.45728934", "0.45649585", "0.45515543", "0.45483482", "0.45462355", "0.45451298", "0.454191", "0.4534116", "0.45271483", "0.45259237", "0.45234954", "0.45205197", "0.45189345", "0.45111004", "0.45091727", "0.45081478", "0.45078725" ]
0.52533156
9
Shuffles the population of individuals
public void shufflePop() { for (int i = 0; i < this.individuals.length; i += 2) { double random = Math.random(); int rand = (int) (this.individuals.length * random); AI temp = individuals[0]; this.individuals[0] = individuals[rand]; this.individuals[rand] = temp; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void shuffle() {\n\t\tCollections.shuffle(inds);\n\t}", "public void shuffle() {\n\t\tCollections.shuffle(Shoe);\n\t}", "public void shuffle();", "public void shuffle() {\n for (int i = size - 1; i > 0; i--) {\n swap(i, (int)(Math.random() * (i + 1)));\n }\n }", "public void shuffle(){\n\t\t\n\t\tArrayList<Boolean> used = new ArrayList<Boolean>();\n\t\tArrayList<Integer> copyStones = new ArrayList<Integer>();\n\t\tfor(int e = 0; e < gameStones.size(); e++){\n\t\t\tcopyStones.add(gameStones.get(e));\n\t\t\tused.add(false);\n\t\t}\n\t\tfor(int e : copyStones){\n\t\t\tchar l = stoneChars.get(e);\n\t\t\tboolean placed = false;\t\t\n\t\t\twhile(!placed){\n\t\t\t\tint randNumber = (int) (Math.random() * 7);\n\t\t\t\tif(!used.get(randNumber)){\n\t\t\t\t\tgameStones.set(randNumber, e);\n\t\t\t\t\tstoneLetters.set(randNumber, l);\n\t\t\t\t\tused.set(randNumber, true);\n\t\t\t\t\tplaced = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "void shuffle();", "void shuffle();", "public void shuffle() {\n Collections.shuffle((List<Nummer>) this.albumNummers);\n }", "void genPermute() {\n\t\tpermute = new ArrayList<Integer>();\n\t\tfor(int idx = 0; idx < dim(); idx++)\n\t\t\tpermute.add(idx);\n\t\tjava.util.Collections.shuffle(permute);\n\t}", "public void shuffle()\n\t{\n\t\tHashSet<Integer> usedRandoms = new HashSet<Integer>();\n\t\tthis.currentCard = 0;\n\t\tint i= 0;\n\t\twhile (i < deck.length)\n\t\t{\n\t\t\tint another = this.rand.nextInt(NUMBER_OF_CARDS);\n\t\t\tif(!usedRandoms.contains(another))\n\t\t\t{\n\t\t\t\tCard temp = this.deck[i];\n\t\t\t\tthis.deck[i] = this.deck[another];\n\t\t\t\tthis.deck[another] = temp;\n\t\t\t\ti++;\n\t\t\t\tusedRandoms.add(another);\n\t\t\t}\n\t\t}\n\t}", "public void shuffle() {\r\n\t\tCollections.shuffle(cards);\r\n\t\t// : Shuffle with random seed each time, then we can save the seed\r\n\t\t// Collections.shuffle(cards, new Random(10));\r\n\t}", "public void shuffle() {\n\t\tCollections.shuffle(Arrays.asList(reel));\n\t}", "public void shuffle() {\n\t\tRandom randIndex = new Random();\n\t\tint size = cards.size();\n\t\t\n\t\tfor(int shuffles = 1; shuffles <= 20; ++shuffles)\n\t\t\tfor (int i = 0; i < size; i++) \n\t\t\t\tCollections.swap(cards, i, randIndex.nextInt(size));\n\t\t\n\t}", "private void shuffle(ArrayList<Product> dataSet) {\n\t\tfor (int i = 0; i < dataSet.size(); i++) {\n\t\t\tint k = rand(0, i);\n\t\t\tProduct temp = dataSet.get(k);\n\t\t\tdataSet.set(k, dataSet.get(i));\n\t\t\tdataSet.set(i, temp);\n\t\t}\t\n\t}", "public void shuffle() {\r\n for ( int i = deck.size()-1; i > 0; i-- ) {\r\n int rand = (int)(Math.random()*(i+1));\r\n SpoonsCard temp = deck.get(i);\r\n deck.set(i, deck.get(rand));\r\n deck.set(rand, temp);\r\n }\r\n cardsUsed = 0;\r\n }", "public void Shuffle() {\n\t\tCollections.shuffle(cards);\n\t}", "public void shuffle() {\n Collections.shuffle(this);\n }", "public void shuffle()\r\n/* 18: */ {\r\n/* 19:41 */ for (int i = 0; i < this.pop.size(); i++)\r\n/* 20: */ {\r\n/* 21:43 */ Cluster c = (Cluster)this.pop.elementAt(i);\r\n/* 22:44 */ g.setClusters(c.getClusterVector());\r\n/* 23:45 */ g.shuffleClusters();\r\n/* 24:46 */ c.setClusterVector(g.getClusters());\r\n/* 25:47 */ c.setConverged(false);\r\n/* 26: */ }\r\n/* 27: */ }", "public abstract void shuffled();", "public int[] shuffle() {\r\n if (nums == null) return nums;\r\n int tmp = 0;\r\n \r\n int[] newNums = nums.clone();\r\n \r\n for (int i=1; i<newNums.length; i++) {\r\n int selectPos = rd.nextInt(i+1);\r\n tmp = newNums[i];\r\n newNums[i] = newNums[selectPos];\r\n newNums[selectPos] = tmp;\r\n }\r\n \r\n return newNums;\r\n }", "public void shuffle()\n {\n Collections.shuffle(artefacts);\n }", "public void shuffle(){\r\n Collections.shuffle(cards);\r\n }", "@Override\n public void shuffle() {\n System.out.println(\"shuffling the shoe...\");\n Collections.shuffle(this.cards);\n }", "public void shuffle() {\r\n\t\tCollections.shuffle(cards);\r\n\t}", "public int[] shuffle() {\n int[] result = reset();\n\n Random rand = new Random();\n for (int i = 0; i < result.length; i++) {\n int j = rand.nextInt(result.length - i) + i;\n int tmp = result[i];\n result[i] = result[j];\n result[j] = tmp;\n }\n return result;\n }", "public void shuffleDeck() {\n for (int i = 0; i < TOTAL_NUMBER_OF_CARDS - 1; i++) {\n Random r = new Random();\n int x = r.nextInt(TOTAL_NUMBER_OF_CARDS);\n Card y = deck.get(x);\n deck.set(x, deck.get(i));\n deck.set(i, y);\n }\n }", "public void shuffle() {\n\t\tCollections.shuffle(cards);\n\t}", "public void spreadShuffle()\r\n {\r\n List<Card> shuffledDeck = new ArrayList<Card>();\r\n List<Card> tempDeck = null;\r\n for (int i = 0; i < SHUFFLE_COUNT; i++) {\r\n while (cards.size() > 0)\r\n {\r\n shuffledDeck.add( drawRandom() );\r\n }\r\n tempDeck = cards;\r\n cards = shuffledDeck;\r\n tempDeck.clear();\r\n shuffledDeck = tempDeck;\r\n }\r\n }", "public static void populate() {\n for (int i = 1; i <= 15; i++) {\n B.add(i);\n Collections.shuffle(B);\n\n }\n for (int i = 16; i <= 30; i++) {\n I.add(i);\n Collections.shuffle(I);\n }\n for (int n = 31; n <= 45; n++) {\n N.add(n);\n Collections.shuffle(N);\n }\n for (int g = 46; g <= 60; g++) {\n G.add(g);\n Collections.shuffle(G);\n }\n for (int o = 61; o <= 75; o++) {\n O.add(o);\n Collections.shuffle(O);\n }\n\n for (int i = 1; i <= 75; i++) {\n roll.add(i); // adds the numbers in the check list\n }\n }", "public void shuffle(){\n Collections.shuffle(this.deckOfCards);\n }", "public void shuffleDeck() {\n\t\tint numberOfShuffles = (int) ( Math.random() * 4 + 1 ) ;\n\t\tCard temp;\n\t\t\n\t\tfor( int j = 0; j < numberOfShuffles; j++ ) {\n\t\t\tfor( int i = 0; i < deck.length; i++ ) {\n\t\t\t\tint randSwitchNum = (int) (Math.random() * 52);\n\t\t\t\ttemp = deck[i];\n\t\t\t\tdeck[i] = deck[randSwitchNum];\n\t\t\t\tdeck[randSwitchNum] = temp;\n\t\t\t}\n\t\t}\t\n\t}", "public int[] shuffle() {\r\n int max = nums.length - 1;\r\n for (int i = 0; i < nums.length; i++) {\r\n int index = new Random().nextInt(max)%(max - i + 1) + i;\r\n int tmp = nums[i];\r\n nums[i] = nums[index];\r\n nums[index] = tmp;\r\n }\r\n return nums;\r\n }", "public int[] shuffle() {\n int[] shuffle = nums.clone();\n for(int i = 0; i < shuffle.length; i++){\n int index = random.nextInt(i + 1);\n swap(shuffle,i,index);\n }\n return shuffle;\n }", "public int[] shuffle() {\n for (int i = nums.length - 1; i >= 0; i--) {\n swap(i, rnd.nextInt(i + 1));\n }\n \n return nums;\n }", "public void shuffle(){ \n \n Collections.shuffle(cardDeck);\n /*Random rand = new Random();\n for(int i = 0 ; i < 110 ; i++){\n int firstCard = rand.nextInt(110);\n int secondCard = rand.nextInt(110);\n Collections.swap(cardDeck,firstCard,secondCard);\n }*/\n }", "public int[] shuffle() {\n int i = random.nextInt(nums.length);\n int j = random.nextInt(nums.length);\n swap(temp, i , j);\n return temp;\n }", "public void shuffle()\r\n\t{\r\n\t\tCollections.shuffle(_tiles);\r\n\t}", "public void shuffle() {\n Collections.shuffle(this.plateau);\n }", "private void shuffleOrder() {\n\t\t// Simple shuffle: swap each piece with some other one\n\t\tfor (int i = 0; i < order.size(); i++) {\n\t\t\tint j = (int) (Math.random() * order.size());\n\t\t\tInteger pi = order.get(i);\n\t\t\torder.set(i, order.get(j));\n\t\t\torder.set(j, pi);\n\t\t}\n\t}", "public void shuffleCards() {\n Collections.shuffle(suspectCards);\n Collections.shuffle(weaponCards);\n Collections.shuffle(roomCards);\n\n }", "public void shuffle() {\n\t\tfor (int i = deck.length - 1; i > 0; i--) {\n\t\t\tint rand = (int) (Math.random() * (i + 1));\n\t\t\tCard temp = deck[i];\n\t\t\tdeck[i] = deck[rand];\n\t\t\tdeck[rand] = temp;\n\t\t}\n\t\tcardsUsed = 0;\n\t}", "private int[] shuffle() {\n int len = data_random.length;\n Random rand = new Random();\n for (int i = 0; i < len; i++) {\n int r = rand.nextInt(len);\n int temp = data_random[i];\n data_random[i] = data_random[r];\n data_random[r]=temp;\n }\n return data_random;\n }", "public void shuffle()\r\n\t{\r\n\t\tRandom rand = ThreadLocalRandom.current();\r\n\t\t\r\n\t\tfor (int i = topCard; i > 0; i--)\r\n\t\t{\r\n\t\t\tint index = rand.nextInt(i + 1);\r\n\t\t\tString temp = cards[index];\r\n\t\t\tcards[index] = cards[i];\r\n\t\t\tcards[i] = temp;\r\n\t\t}\r\n\t}", "public void shuffle()\n\t{\n\t\tCollections.shuffle(card);\n\t}", "public int[] shuffle() {\n int[] res = new int[nums.length];\n int r;\n for (int i = 0; i < nums.length; i++) {\n r = random.nextInt(i + 1);\n res[i] = res[r];\n res[r] = nums[i];\n }\n\n\n return res;\n }", "public void shuffle(){\n Collections.shuffle(Arrays.asList(this.deck));\n }", "public void shuffle() {\n\t\tfor (int i = 51; i > 0; i--) {\n\t\t\tint rand = (int) (Math.random() * (i + 1));\n\t\t\tint temp = deck[i];\n\t\t\tdeck[i] = deck[rand];\n\t\t\tdeck[rand] = temp;\n\t\t}\n\t\tcurrentPosition = 0;\n\t}", "public void shuffle() {\r\n for (int i = 0; i < this.numCards; i++) {\r\n int spot = (int) (Math.random() * ((this.numCards - 1) - i + 1) + i);\r\n Card temp = cards[i];\r\n cards[i] = cards[spot];\r\n cards[spot] = temp;\r\n\r\n\r\n }\r\n }", "public void shuffle() {\n for (int i = 0; i < this.cards.length ; i++ ) {\n double x = Math.floor(Math.random() * ((double)this.cards.length - (double)0)) + (double)0;\n Card temp = this.cards[i];\n this.cards[i]= this.cards[(int)x];\n this.cards[(int)x]= temp;\n }\n }", "public void shuffle() {\n\t\tfor (int i = 0; i < cards.size(); i++){\n\t\t\t//exchange card i with the random card from i to cards.size() - 1\n\t\t\tint j = Randoms.randomIntInRange(i, cards.size() - 1);\n\t\t\tT c1 = cards.get(i);\n\t\t\tT c2 = cards.get(j);\n\t\t\tcards.set(i, c2);\n\t\t\tcards.set(j, c1);\n\t\t}\n\t}", "public void shuffle() {\n List<Card> shuffledCards = new ArrayList<>(52);\n while (cards.size() > 0) {\n int index = random.nextInt(cards.size());\n shuffledCards.add(cards.remove(index));\n }\n cards = shuffledCards;\n }", "public void shuffle() {\n Collections.shuffle(deck);\n }", "public void shuffle() {\n Collections.shuffle(deck);\n }", "public void scramble(){\r\n for (int i = 0; i < data.length / 2; i++){\r\n int randomIndex1 = (int)(Math.random()*(data.length - 1));\r\n int randomIndex2 = (int)(Math.random()*(data.length - 1));\r\n swap(randomIndex1, randomIndex2);\r\n }\r\n }", "public int[] shuffle() {\n if (nums == null) {\n return null;\n }\n int[] a = nums.clone();\n for (int j = 1; j < a.length; j++) {\n // 类似蓄水池采样算法\n // i == j -> 1/(1+j)\n // j != j -> (1 - 1/(1+j)) * (1/j) = 1/(1/j)\n int i = random.nextInt(j + 1);\n swap(a, i, j);\n }\n return a;\n }", "public void premesaj() {\r\n Collections.shuffle(kup);\r\n }", "void shuffle() {\r\n cards.addAll(dealtCards);\r\n dealtCards.removeAll(dealtCards);\r\n Collections.shuffle(cards);\r\n System.out.println(\"Shuffled cards\" + cards);\r\n }", "public void shuffle () {\n this.lives = 6;\n this.attempts.clear();\n this.victory = false;\n this.lose = false;\n Random r = new Random ();\n this._word = _dictionary[r.nextInt(_dictionary.length)];\n // this._word = _dictionary[2]; // Testing purposes\n this.hint.setLength(0);\n for (int i = 0; i < _word.length(); i++) {\n this.hint.append(\"_ \");\n } \n }", "public int[] shuffle() {\r\n\t\t\tRandom r = new Random();\r\n\t\t\tint[] shuffle = new int[this.nums.length];\r\n\t\t\tint i = 0;\r\n\t\t\tMap<Integer, Boolean> map = new HashMap<Integer, Boolean>();\r\n\t\t\twhile (i < this.nums.length) {\r\n\t\t\t\tint count = r.nextInt(this.nums.length);\r\n\t\t\t\tif (map.get(count) != null && map.get(count)) {\r\n\t\t\t\t} else {\r\n\t\t\t\t\tshuffle[i] = this.nums[count];\r\n\t\t\t\t\ti++;\r\n\t\t\t\t\tmap.put(count, true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn shuffle;\r\n\t\t}", "public static int[] shuffle() {\n Random random = new Random();\n for (int i = 0; i < len; i++) {\n int j = random.nextInt(len);\n int temp = nums[i];\n nums[i] = nums[j];\n nums[j] = temp;\n }\n return nums;\n }", "@Override\n\tpublic void shuffleDeck() {\n\t\tfor(int i = 0; i < 1000000; i++) {\n\t\t\tint randomStelle1 = (int) (Math.random() * 32);\n\t\t\tint randomStelle2 = (int) (Math.random() * 32);\n\t\t\tPlayingCard copy = aktuellesDeck[randomStelle1];\n\t\t\taktuellesDeck[randomStelle1] = aktuellesDeck[randomStelle2];\n\t\t\taktuellesDeck[randomStelle2] = copy;\n\t\t}\n\t}", "private void randomizePuzzle() {\n\t\t// Choose random puzzles, shuffle the options.\n\t\tthis.puzzle = BarrowsPuzzleData.PUZZLES[(int) (Math.random() * BarrowsPuzzleData.PUZZLES.length)];\n\t\tthis.shuffledOptions = shuffleIntArray(puzzle.getOptions());\n\t}", "void shuffleDeck() {\n\t\tfor(int index = 0; index < this.getNumberOfCards(); index++) {\n\t\t\tint randomNumber = index + (int)(Math.random() * (this.getNumberOfCards() - index));\n\t\t\tCard temp = this.cardsInDeck[randomNumber];\n\t\t\tthis.cardsInDeck[randomNumber] = this.cardsInDeck[index];\n\t\t\tthis.cardsInDeck[index] = temp;\n\t\t}\n\t}", "public void genPopulation(int howMany)\r\n/* 30: */ {\r\n/* 31:54 */ this.pop.removeAllElements();\r\n/* 32:55 */ for (int i = 0; i < howMany; i++)\r\n/* 33: */ {\r\n/* 34:61 */ int[] clusterV = g.genRandomClusterSize();\r\n/* 35:62 */ Cluster c = new Cluster(g, clusterV);\r\n/* 36:63 */ this.pop.addElement(c);\r\n/* 37: */ }\r\n/* 38: */ }", "public void shuffle() {\n\t\tRandom random = new Random();\n\t\tint dealtCards = this.dealtCards.get();\n\t\tfor (int i = dealtCards; i < Deck.DECK_SIZE; i++) {\n\t\t\t// Obtain random position for available cards.\n\t\t\tint randomNumber = dealtCards + random.nextInt((Deck.DECK_SIZE - dealtCards));\n Card tempCard = cards.get(i);\n // Swap cards position.\n cards.set(i, cards.get(randomNumber));\n cards.set(randomNumber, tempCard);\n }\n\t}", "public void randomize(){\r\n\t\tfor(int i = 0;i<this.myQuestions.size();i++){\r\n\t\t\tthis.myQuestions.get(i).randomize();\r\n\t\t}\r\n\t\tCollections.shuffle(this.myQuestions);\r\n\t}", "public void shuffle(){\r\n int randomPos;\r\n //for each card in the deck\r\n for(int i=0; i<52; i++){\r\n randomPos = getRandomPos(i);\r\n exchangeCards(i, randomPos);\r\n }\r\n topCardIndex = 0;\r\n\t}", "public int[] shuffle() {\n int[] shuffle = new int[nums.length];\n int[] clone = nums.clone();\n int last = clone.length - 1;\n for(int i = 0; i < clone.length; i++){\n int index = random.nextInt(last + 1);\n shuffle[i] = clone[index];\n clone[index] = clone[last--];\n }\n return shuffle;\n }", "public int[] shuffle() {\n\t\tRandom r = new Random();\n\t\tfor (int i = 0; i < this.nums.length; i++) {\n\t\t\tint index = r.nextInt(this.nums.length);\n\t\t\tif (i != index) {\n\t\t\t\tnums[i] = nums[i] ^ nums[index];\n\t\t\t\tnums[index] = nums[i] ^ nums[index];\n\t\t\t\tnums[i] = nums[i] ^ nums[index];\n\t\t\t}\n\t\t}\n\t\treturn nums;\n\t}", "@Override\n public void randomize(int randomSeed) {\n Random rand = new Random(randomSeed);\n for(int j = size - 1; j > 0; j --){\n int randIndex = rand.nextInt(j);\n \n int [] tmp = data[randIndex];\n data[randIndex] = data[j];\n data[j] = tmp;\n \n int tmpl = labels[randIndex];\n labels[randIndex] = labels[j];\n labels[j] = tmpl;\n \n float tmpw = weights[randIndex];\n weights[randIndex] = weights[j];\n weights[j] = tmpw;\n }\n }", "public void shuffle() {\n Random rand = new Random();\n for(int i = 0; i < deck.length; i++) {\n // get random index past current index\n int randomVal = i + rand.nextInt(deck.length - i);\n // swaps randomly selected card with card at index i\n Card swap = deck[randomVal];\n deck[randomVal] = deck[i];\n deck[i] = swap;\n }\n }", "public static void shuffle(int data[]) {\n\n }", "public void shuffle()\r\n {\r\n Collections.shuffle(cards);\r\n top = NUMCARDS - 1;\r\n }", "public void shuffle() {\n\t\t\n\t\tRandom random = new Random();\n\t\tint position;\n\t\t\n\t\tfor(int i = 0; i < 200 * dimension; i++) {\n\t\t\tposition = random.nextInt(numTiles - 1);\n\t\t\tif(isValidMove(position)) {\n\t\t\t\tmakeMove(position);\n\t\t\t}\n\t\t}\n\t\t\n\t\tnumMoves = 0;\n\t}", "public void shuffleItems() {\n LoadProducts(idCategory);\n }", "public void shuffle(){\n //After shuffling dealing starts at deck[0] again\n currentCard = 0;\n //for each card , pick another random card and swap them\n for(int first = 0; first < deck.length; first++){\n int second = randomNumbers.nextInt(NUMBER_OF_CARDS);\n\n //Swap Method to swap current card with randomly selected card\n Card temp = deck[first];\n deck[first] = deck[second];\n deck[second] = temp;\n }\n }", "public static void shuffle(int[] a) {\r\n int N = a.length;\r\n for (int i = 0; i < N; i++) {\r\n int r = i + uniform(N-i); // between i and N-1\r\n int temp = a[i];\r\n a[i] = a[r];\r\n a[r] = temp;\r\n }\r\n }", "public void generateRandomQuestions(){\r\n numberHolder = new ArrayList<>(NUMBER_OF_QUESTIONS);\r\n for (int i = 0; i < NUMBER_OF_QUESTIONS; i++)\r\n numberHolder.add(i);\r\n\r\n Collections.shuffle(numberHolder);\r\n System.out.println(numberHolder);\r\n\r\n }", "public void shuffle(){\n\n // resetting the int counters\n nextCard = 0;\n nextDiscardedPlace = 0;\n discardPile = new PlayingCard[Constants.DECK_SIZE];\n\n PlayingCard temp = null;\n Random rand = new Random();\n\n for(int i = 0; i < MAX_SHUFFLE; i++) {\n int pos1 = rand.nextInt(Constants.DECK_SIZE);\n int pos2 = rand.nextInt(Constants.DECK_SIZE);\n\n temp = deck[pos1];\n deck[pos1] = deck[pos2];\n deck[pos2] = temp;\n }\n }", "public void hinduShuffle()\r\n {\r\n List<Card> cut = new ArrayList<Card>();\r\n List<Card> cut2 = new ArrayList<Card>();\r\n List<Card> shuffledDeck = new ArrayList<Card>();\r\n int cutPoint = 0;\r\n int cutPoint2 = 0;\r\n for (int x = 0; x < SHUFFLE_COUNT; x++) {\r\n cutPoint = rand.nextInt( cards.size()-1 );\r\n cutPoint2 = rand.nextInt( cards.size() - cutPoint ) + cutPoint;\r\n for (int i = 0; i < cutPoint; i++) {\r\n cut.add(draw());\r\n }\r\n for (int i = cutPoint2; i < cards.size(); i++) {\r\n cut2.add(draw());\r\n }\r\n for (int i = 0; i < cut.size(); i++) {\r\n shuffledDeck.add(cut.remove(0));\r\n }\r\n for (int i = 0; i < cards.size(); i++) {\r\n shuffledDeck.add(cards.remove(0));\r\n }\r\n for (int i = 0; i < cut2.size(); i++) {\r\n shuffledDeck.add(cut2.remove(0));\r\n }\r\n cut = cards;\r\n cut.clear();\r\n cut2.clear();\r\n cards = shuffledDeck;\r\n }\r\n }", "public void shuffle() {\n deck.clear();\n deck.addAll(allCards);\n Collections.shuffle(deck, new Random(System.nanoTime()));\n }", "public static void shuffle( int[] a ) {\n int N = a.length;\n \n for ( int i = 0; i < N; i++ ) {\n int r = i + uniform( N - i ); // between i and N-1\n int temp = a[i];\n a[i] = a[r];\n a[r] = temp;\n }\n }", "public int[] shuffle() {\n int[] random = new int[nums.length];\n for (int i = 0; i < nums.length; i++) {\n // generate a random between 0 ~ i\n int r = (int)(Math.random() * (i + 1));\n random[i] = random[r];\n random[r] = nums[i];\n }\n return random;\n }", "public void shuffle(int numShuffles)\n { \n Card tempCard;\n int switchOne, switchTwo;\n\n for (int i=0; i<numCards; i++){\n switchOne = rand.nextInt(numCards);\n switchTwo = rand.nextInt(numCards);\n\n tempCard = cardAry[switchOne];\n cardAry[switchOne] = cardAry[switchTwo];\n cardAry[switchTwo] = tempCard; \n }\n\n if(cardAry.length > 1 && cardAry.length <=5 && isSorted()==true)\n shuffle(2);\n }", "public void shuffle() {\n\t\t\t/*\n\t\t\t * This is very different from the sort method because:\n\t\t\t * @ we decant the cards into an array list;\n\t\t\t * @ we use a library function to do the work;\n\t\t\t * The implementation you write for the sort method should\n\t\t\t * have *neither* of these characteristics.\n\t\t\t */\n\t\t\tList<Card> cards = new ArrayList<Card>();\n\t\t\twhile (!isEmpty()) {\n\t\t\t\tcards.add(draw());\n\t\t\t}\n\t\t\tCollections.shuffle(cards);\n\t\t\tfor (Card c: cards) {\n\t\t\t\tadd(c);\n\t\t\t}\n\t\t}", "public static void shuffle(int[] tab, int iter, boolean mixup){\n\n for (int i = 0; i < iter; i++) {\n for (int j = 0; j < tab.length; j++) {\n int new_rand_index = (int) Math.floor(Math.random() * tab.length);\n if (new_rand_index != j) {\n // swap the value\n int temp = tab[new_rand_index];\n tab[new_rand_index] = tab[j];\n tab[j] = temp;\n\n }\n }\n }\n\n for (int i = 0; i < tab.length; i++) {\n if (Math.random() > 0.1 && mixup){\n tab[i] = tab[i] + (int) Math.floor(Math.random() * 3);\n }\n \n }\n\n }", "private static void scrambleArray(int[] a, boolean randomize) {\n\t\tfor (int k = 0; k < a.length; k++)\n\t\t\ta[k] = k;\n\t\tif (randomize) // use unpredictable random shuffle\n\t\t{\n\t\t\tRandom gen = new Random();\n\t\t\tfor (int k = 0; k < a.length; k++) {\n\t\t\t\tswap(a, k, gen.nextInt(a.length));\n\t\t\t}\n\t\t} else // use repeatable math formula for shuffle\n\t\t{\n\t\t\tint cell = (int) (a.length * 3.14159) % a.length;\n\t\t\tfor (int k = 0; k < a.length; k++) {\n\t\t\t\tswap(a, k, cell);\n\t\t\t\tcell = (int) (cell * 3.14159) % a.length;\n\t\t\t}\n\t\t}\n\n\t}", "public void shuffleDeck() {\n\t\tCollections.shuffle(deck);\n\t}", "private List<Integer> generateRandom() {\n Integer[] randArr = new Integer[numCols*numRows];\n\n int start = 0;\n int end;\n for(int i = 0; i < myStateMap.size(); i++) {\n int amt = myStateMap.get(i).getAmount();\n end = amt + start;\n for(int j = start; j < end; j++) {\n if(end > randArr.length) {\n break;\n }\n randArr[j] = myStateMap.get(i).getType();\n }\n start = end;\n }\n\n List<Integer> arr = new ArrayList<>(Arrays.asList(randArr));\n Collections.shuffle(arr);\n return arr;\n }", "public static void generatePopulation() {\n population = setupArray(POP_SIZE, NUM_RULES, GENE_SIZE, COND_LEN);\n\n for (Individual individual : population) {\n for (int i = 0; i < individual.getGene().length; i++) {\n individual.gene[i] = bits.get(new Random().nextInt(2));\n }\n individual.generateRulebase();\n }\n }", "public void Shuffle() {\n int i = 0;\n while (i < 52) {\n int rando = (int) (5.0 * (Math.random()));\n Cards temp = deck[rando];\n deck[rando] = deck[i];\n deck[i] = temp;\n i++;\n }\n\n Arrays.stream(deck).forEach(c -> System.out.format(\"%s,\",c));\n }", "private void shuffleAndGiveCards() {\n\n List<Card> tmpDeck= new ArrayList<Card>(deck); \n Collections.shuffle(tmpDeck, shuffleRng);\n \n for (int i=0; i<players.size(); ++i) {\n int startIndex= Jass.HAND_SIZE*i; //So for player 0 the startIndex will be 0, for player2 9, etc...\n int endIndex = Jass.HAND_SIZE*(i+1); //So for player 1 the endIndex will be 9, for player2 18, etc...\n\n CardSet hand= CardSet.of(tmpDeck.subList(startIndex, endIndex));\n PlayerId player = PlayerId.ALL.get(i);\n\n players.get(player).updateHand(hand);\n handsOfCards.put(player, hand); \n }\n }", "public void initialiseNewRandomPopulation(Random rnd) {\n\t\tthis.population = new ArrayList<Individual>();\n\t\tfor (int i = 0; i < this.popSize; i++) {\t\t\t\t\t//FOR ALL DESIRED POPULATION SIZE\n\t\t\tdouble[] randomValues = new double[DIMENSIONS];\t\t\t//INITIATE RANDOM X ARRAY WITH CORRECT DIMENSIONS\n\t\t\tfor (int j = 0; j < DIMENSIONS; j++) {\t\t\t\t\t//CREATE RANDOM X VALUES\n\t\t\t\trandomValues[j] = -5 + rnd.nextDouble() * 10;\t\t//ASSIGN VALUES TO EACH POSITION IN ARRAY\n\t\t\t}\n\t\t\tIndividual newInd = new Individual(randomValues);\t\t//CREATE NEW INDIVIDUAL WITH RANDOM X VALUES\n\t\t\tthis.population.add(newInd);\t\t\t\t\t\t\t//ADD INDIVIDUAL TO POPULATION\n\t\t}\n\t}", "public static void mutation(Individual[] individuals) {\n for (int i = 0; i < POP_SIZE; i++) {\n for (int j = 0; j < GENE_SIZE; j++) {\n double randomNum = Math.random();\n if (randomNum < MUTATION_RATE) {\n randomNum = Math.random();\n ArrayList<String> bitsList = (ArrayList<String>) bits.clone();\n for (int g = 0; g < bitsList.size(); g++) {\n if (individuals[i].gene[j].equals(bitsList.get(g))) {\n String bit = bitsList.get(g);\n bitsList.remove(g);\n int index;\n if (randomNum < 0.5) {\n index = 0;\n } else {\n index = 1;\n }\n individuals[i].gene[j] = bitsList.get(new Random().nextInt(2));\n bitsList.add(bit);\n }\n }\n }\n }\n individuals[i].generateRulebase();\n }\n matingPool = Arrays.copyOf(individuals, individuals.length);\n }", "public void mixSalad() {\n Collections.shuffle(list);\n System.out.println(\"\\nSalad is ready.\");\n }", "public void shuffleDeck() {\n\t\tCollections.shuffle(this.deck);\n\t}", "public void RandomizeTheDeck() {\r\n ArrayList<ArrayList<Card>> alalCopy = new ArrayList<>();\r\n int i, iRand;\r\n Random rand = new Random();\r\n \r\n // remove deck to the copy\r\n for( i=0; i<104; i++) {\r\n alalCopy.add( alalSets.get(i) );\r\n }\r\n alalSets.clear();\r\n \r\n // randomly copy them back as copy size gets smaller\r\n for( i=104; i>0; i-- ) {\r\n iRand = (int)rand.nextInt(i);\r\n alalSets.add( alalCopy.remove(iRand) );\r\n }\r\n }", "private void shuffleDeck()\r\n {\n cardList = new ArrayList<Card>(deck);\r\n // shuffle the deck of cards using the ArrayList\r\n Collections.shuffle(getCardList());\r\n // convert it back to a HashSet\r\n deck = new HashSet<Card>(getCardList());\r\n }", "public static void shuffle(String[] arrayList){\n int num=arrayList.length; \n for(int j=0;j<60;j++){ // the number of shuffling>50 times, so I choose 60 times\n for(int i=0;i<num;i++){ \n int index=(int)(Math.random()*num);\n //Swap the position of elements in the array at that index with the first element\n String temp=arrayList[i]; \n arrayList[i]=arrayList[index];\n arrayList[index]=temp;\n }}}", "public Deck randomShuffle(){\n\t\tshuffleOnceRandom();\n\t\tshuffleOnceRandom();\n\t\treturn ourDeck;\n\t}" ]
[ "0.7232591", "0.7203722", "0.7149267", "0.71347934", "0.70139325", "0.6978778", "0.6978778", "0.6948495", "0.69216585", "0.69182235", "0.6866473", "0.68206525", "0.68183744", "0.68170977", "0.6770376", "0.67638075", "0.6758994", "0.67560863", "0.67509615", "0.67401594", "0.6707482", "0.66945004", "0.6678963", "0.6661934", "0.664379", "0.6637491", "0.66229194", "0.660388", "0.6596994", "0.6589703", "0.657922", "0.6545791", "0.6538007", "0.653448", "0.65185046", "0.65102386", "0.6501014", "0.64995664", "0.64789", "0.64786094", "0.6478528", "0.64705557", "0.6460655", "0.64564276", "0.6438253", "0.6434991", "0.64336956", "0.64238495", "0.6417567", "0.64021766", "0.6395266", "0.63946885", "0.63946885", "0.6385492", "0.63718075", "0.636859", "0.6360178", "0.6343551", "0.63427794", "0.6320052", "0.6316081", "0.63145447", "0.6313775", "0.6302315", "0.6300293", "0.6297959", "0.6277313", "0.62707025", "0.6261369", "0.62445706", "0.62417084", "0.6235573", "0.6232473", "0.62011826", "0.6196798", "0.6194914", "0.61894655", "0.6173005", "0.6168042", "0.6165621", "0.6141969", "0.61351365", "0.6131011", "0.61263824", "0.61182916", "0.6113988", "0.61080116", "0.61055315", "0.61029816", "0.60958207", "0.6083897", "0.6074922", "0.60485107", "0.60463554", "0.6043211", "0.60341054", "0.6013582", "0.60109663", "0.6006109", "0.5992177" ]
0.7360559
0
Passes a new array of individuals back to the population class.
public void updatePop(AI[] arr) { this.individuals = arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void mutate() {\n\t\tfor (int i = 0; i < population; ++i) {\n\t\t\tpopulationArray.set(i, populationArray.get(i).generateNeighbor());\n\t\t}\n\t}", "public static void mutation(Individual[] individuals) {\n for (int i = 0; i < POP_SIZE; i++) {\n for (int j = 0; j < GENE_SIZE; j++) {\n double randomNum = Math.random();\n if (randomNum < MUTATION_RATE) {\n randomNum = Math.random();\n ArrayList<String> bitsList = (ArrayList<String>) bits.clone();\n for (int g = 0; g < bitsList.size(); g++) {\n if (individuals[i].gene[j].equals(bitsList.get(g))) {\n String bit = bitsList.get(g);\n bitsList.remove(g);\n int index;\n if (randomNum < 0.5) {\n index = 0;\n } else {\n index = 1;\n }\n individuals[i].gene[j] = bitsList.get(new Random().nextInt(2));\n bitsList.add(bit);\n }\n }\n }\n }\n individuals[i].generateRulebase();\n }\n matingPool = Arrays.copyOf(individuals, individuals.length);\n }", "protected Population(Infrastructure infra)\n\t\t{\tinds = new Individual[NUMBER_INDIVIDUALS];\n\t\t\tfor(int i=0;i<NUMBER_INDIVIDUALS;i++)\n\t\t\t\tinds[i] = new Individual(infra);\n\t\t\tthis_ind = 0;\n\t\t\tthis_gen = 0;\n\t\t}", "public void setPop(ArrayList<Bacteria> newPop){\n inds = newPop;\n }", "private void mutate(float probability) {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n float temp_genes[] = this.offspring_population.getPopulation()[i].getGenes();\r\n\r\n // mutation can now mutate wild cards\r\n for (int j = 0; j < temp_genes.length; j++) {\r\n float k = new Random().nextFloat();\r\n\r\n if (k <= probability) {\r\n float temp = new Random().nextFloat();\r\n temp_genes[j] = temp; // add a float between 0-1 // just mutate a new float\r\n }\r\n }\r\n individual child = new individual(temp_genes, solutions, output);\r\n temp_pop[i] = child;\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "public abstract ArrayList<Inhabitant> reproduce(ArrayList<Cell> toBeBorn);", "public ArrayList<Integer> makeIndividual();", "public static Population evolvePopulation(Population pop) {\n Population newPopulation = new Population(pop.populationSize(), false);\n\n // Keep our best individual if elitism is enabled\n int elitismOffset = 0;\n if (elitism) {\n newPopulation.saveTour(0, pop.getFittest());\n elitismOffset = 1;\n }\n\n // Crossover population\n // Loop over the new population's size and create individuals from\n // Current population\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n // Select parents\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n\n\n\n\n Tour[] temp_a = roullet( newPopulation);\n if( temp_a == null )\n {\n System.out.println(\"no a\");\n //r//eturn temp;\n }\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n Tour parent1 = temp_a[0];\n Tour parent2 = temp_a[1];\n\n\n\n\n\n\n\n\n // Crossover parents\n Tour child = crossover(parent1, parent2);\n // Add child to new population\n newPopulation.saveTour(i, child);\n }\n\n // Mutate the new population a bit to add some new genetic material\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n mutate(newPopulation.getTour(i));\n }\n\n return newPopulation;\n }", "public static void generatePopulation() {\n population = setupArray(POP_SIZE, NUM_RULES, GENE_SIZE, COND_LEN);\n\n for (Individual individual : population) {\n for (int i = 0; i < individual.getGene().length; i++) {\n individual.gene[i] = bits.get(new Random().nextInt(2));\n }\n individual.generateRulebase();\n }\n }", "Population<T> operate(Population<T> population);", "private void populate()\n\t{\n\t\tages = new int[] { 15, 18, 16, 16, 15, 16 }; \n\t}", "public void initialiseNewRandomPopulation(Random rnd) {\n\t\tthis.population = new ArrayList<Individual>();\n\t\tfor (int i = 0; i < this.popSize; i++) {\t\t\t\t\t//FOR ALL DESIRED POPULATION SIZE\n\t\t\tdouble[] randomValues = new double[DIMENSIONS];\t\t\t//INITIATE RANDOM X ARRAY WITH CORRECT DIMENSIONS\n\t\t\tfor (int j = 0; j < DIMENSIONS; j++) {\t\t\t\t\t//CREATE RANDOM X VALUES\n\t\t\t\trandomValues[j] = -5 + rnd.nextDouble() * 10;\t\t//ASSIGN VALUES TO EACH POSITION IN ARRAY\n\t\t\t}\n\t\t\tIndividual newInd = new Individual(randomValues);\t\t//CREATE NEW INDIVIDUAL WITH RANDOM X VALUES\n\t\t\tthis.population.add(newInd);\t\t\t\t\t\t\t//ADD INDIVIDUAL TO POPULATION\n\t\t}\n\t}", "public void setPopulation(int population) {\n this.population = population;\n }", "private void initializePopulation() {\n // reset the population\n population = new ArrayList<Genotype>();\n\n // set the population to an array of random genotypes\n for (int i = 0; i < populationSize; i++) {\n population.add(new Genotype(chromosomeSize));\n }\n\n // evaluate the population\n // evaluatePopulation();\n }", "public void genPopulation(int howMany)\r\n/* 30: */ {\r\n/* 31:54 */ this.pop.removeAllElements();\r\n/* 32:55 */ for (int i = 0; i < howMany; i++)\r\n/* 33: */ {\r\n/* 34:61 */ int[] clusterV = g.genRandomClusterSize();\r\n/* 35:62 */ Cluster c = new Cluster(g, clusterV);\r\n/* 36:63 */ this.pop.addElement(c);\r\n/* 37: */ }\r\n/* 38: */ }", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "public static void evaluateGroupedProblemForm( EvolutionState state, boolean returnIndividuals,\n DataInputStream dataIn, DataOutputStream dataOut )\n {\n int numInds = -1;\n boolean countVictoriesOnly = false;\n Subpopulation[] subPop = null;\n \n try\n {\n numInds = dataIn.readInt();\n subPop = new Subpopulation[numInds];\n for(int x=0;x<numInds;x++)\n {\n int subPopNum = dataIn.readInt();\n // Here we need to know the subpopulation number so as to create the\n // correct type of subpopulation in order to create the correct type\n // of individual.\n if( state.population == null )\n state.population = new Population();\n if( state.population.subpops == null )\n state.population.subpops = new Subpopulation[subPopNum+1];\n if( state.population.subpops.length <= subPopNum )\n {\n Subpopulation[] temp = state.population.subpops;\n state.population.subpops = new Subpopulation[subPopNum+1];\n System.arraycopy( temp, 0, state.population.subpops, 0, temp.length );\n }\n if( state.population.subpops[subPopNum] == null )\n {\n Parameter param = new Parameter(P_SUBPOP).push(\"\" + subPopNum);\n subPop[x] = \n (Subpopulation)(state.parameters.getInstanceForParameterEq(\n param,null,\n Subpopulation.class));\n // Setup the subpopulation so that it is in a valid state.\n subPop[x].setup(state, param);\n state.population.subpops[subPopNum] = subPop[x];\n }\n else\n subPop[x] = state.population.subpops[subPopNum];\n }\n countVictoriesOnly = dataIn.readBoolean();\n }\n catch (IOException e)\n {\n state.output.fatal(\"Unable to read the subpopulation number from the master:\\n\"+e);\n }\n \n // Read the individuals from the stream\n Individual inds[] = new Individual[numInds];\n boolean updateFitness[] = new boolean[numInds];\n try\n {\n for(int i=0;i<inds.length;++i)\n {\n inds[i] = subPop[i].species.newIndividual( state, dataIn );\n updateFitness[i] = dataIn.readBoolean();\n }\n }\n catch (IOException e)\n {\n state.output.fatal(\"Unable to read individual from master.\");\n }\n \n // Evaluate the individual\n // TODO Check to make sure the real problem is an instance of GroupedProblemForm\n ((GroupedProblemForm)(state.evaluator.p_problem)).evaluate( state, inds, updateFitness, countVictoriesOnly, 0 );\n \n try\n {\n // Return the evaluated individual to the master\n // just write evaluated and fitness\n for(int i=0;i<inds.length;i++)\n {\n dataOut.writeByte(returnIndividuals ? V_INDIVIDUAL : (updateFitness[i] ? V_FITNESS : V_NOTHING));\n if (returnIndividuals)\n {\n inds[i].writeIndividual(state, dataOut);\n }\n else if (updateFitness[i])\n {\n dataOut.writeBoolean(inds[i].evaluated);\n inds[i].fitness.writeFitness(state,dataOut);\n }\n }\n dataOut.flush();\n }\n catch( IOException e ) { state.output.fatal(\"Caught fatal IOException\\n\"+e ); }\n }", "public void setPopulation(int population) {\n\n this.population = population;\n }", "public abstract Animal[] createGeneration (int count, Animal[] lastGeneration);", "public void setpopulation(int population) {\n this.population = population;\n }", "@Override\n\tpublic Population evolvePopulation(Population pop) {\n\t\tSortingIndividual baseIndiv = (SortingIndividual) pop.individuals[0];\n\t\tPopulation newPopulation = new SortingPopulation(pop.size(), baseIndiv.getBase(), false);\n\t\n\t\t// Keep our best individual\n\t\tif (elitism) {\n\t\t\tnewPopulation.saveIndividual(0, pop.getFittest());\n\t\t}\n\n\t\t// Crossover population\n\t\tint elitismOffset;\n\t\tif (elitism) {\n\t\t\telitismOffset = 1;\n\t\t} else {\n\t\t\telitismOffset = 0;\n\t\t}\n\t\t// Loop over the population size and create new individuals with\n\t\t// crossover\n\t\tfor (int i = elitismOffset; i < pop.size(); i++) {\n\t\t\tIndividual indiv1 = tournamentSelection(pop);\n\t\t\tIndividual indiv2 = tournamentSelection(pop);\n\t\t\tIndividual newIndiv = crossover(indiv1, indiv2);\n\t\t\tnewPopulation.saveIndividual(i, newIndiv);\n\t\t}\n\n\t\t// Mutate population\n\t\tfor (int i = elitismOffset; i < newPopulation.size(); i++) {\n\t\t\tmutate(newPopulation.getIndividual(i));\n\t\t}\n\n\t\treturn newPopulation;\n\t}", "public Population(int size, ArrayList<Individual> KIS){\n this.size = size;\n this.individuals = KIS;\n }", "private void crossover() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < pop_size; i++) { // go through population\r\n\r\n int a = new Random().nextInt(this.pop_size);\r\n int b = new Random().nextInt(this.pop_size);\r\n\r\n int split_point = new Random().nextInt(this.gene_size);\r\n\r\n float[] p1_genes = this.parent_population.getPopulation()[a].getGenes();\r\n float[] p2_genes = this.parent_population.getPopulation()[b].getGenes();\r\n\r\n float[] c1_genes = new float[gene_size];\r\n float[] c2_genes = new float[gene_size];\r\n\r\n for (int j = 0; j < gene_size; j++) {\r\n\r\n if (j < split_point) {\r\n c1_genes[j] = p1_genes[j];\r\n c2_genes[j] = p2_genes[j];\r\n } else {\r\n c2_genes[j] = p1_genes[j];\r\n c1_genes[j] = p2_genes[j];\r\n }\r\n }\r\n individual child1 = new individual(c1_genes, solutions, output);\r\n individual child2 = new individual(c2_genes, solutions, output);\r\n\r\n if (child1.getFitness() > child2.getFitness()) {\r\n temp_pop[i] = child1;\r\n } else {\r\n temp_pop[i] = child2;\r\n }\r\n }\r\n this.offspring_population.setPopulation(temp_pop);\r\n this.offspring_population.update_population();\r\n }", "public Individual[] getMigrationCandidates(Individual[] currentPopulation, int migrationCount);", "RoachPopulation(int initial)\n {\n roaches = initial;\n }", "public void reproduce(){\n\t\t// sort the population from strongest to weakest\n\t\tCollections.sort(population);\n\t\tCollections.reverse(population);\n\t\t\n\t\tfor(int i = 0; i < (int)(POPULATION_SIZE*POPULATION_ACTION_PERCENT); i+=2){\n\t\t\t\n\t\t\t// get two random indexes for reproduction based on the exponential function\n\t\t\t// (1/1000) * (randInt)^2 = index\n\t\t\t// this function favors sequences with higher fitness scores\n\t\t\tint randIndex1 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\tint randIndex2 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\t\n\t\t\trandIndex1 = (int) (Math.pow(randIndex1, 2) / 1000);\n\t\t\trandIndex2 = (int) (Math.pow(randIndex2, 2) / 1000);\n\t\t\t\n\t\t\t// get two pieces\n\t\t\tBuildingPiece[] array1 = population.get(randIndex1).getList();\n\t\t\tBuildingPiece[] array2 = population.get(randIndex2).getList();\n\t\t\t\n\t\t\t// find a splicing point\n\t\t\tint splicePoint = findSplicingPoint(array1, array2);\n\t\t\t\n\t\t\t// generate two new arrays based on the splicing point\n\t\t\tBuildingPiece[] newArray1 = generateNewArray(array1, array2, splicePoint);\n\t\t\tBuildingPiece[] newArray2 = generateNewArray(array2, array1, splicePoint);\n\t\t\t\n\t\t\t// make new buildings with the new arrays\n\t\t\tBuilding bp1 = new Building(newArray1, generation, possiblePieces);\n\t\t\tBuilding bp2 = new Building(newArray2, generation, possiblePieces);\n\t\t\t\n\t\t\t// mutate the new building sequences\n\t\t\tmutateArray(bp1);\n\t\t\tmutateArray(bp2);\n\t\t\t\n\t\t\t// add them into the population\n\t\t\tpopulation.add(randIndex1, bp1);\n\t\t\tpopulation.add(randIndex2, bp2);\n\t\t}\n\t}", "public void shufflePop() {\n\t\tfor (int i = 0; i < this.individuals.length; i += 2) {\n\t\t\tdouble random = Math.random();\n\t\t\tint rand = (int) (this.individuals.length * random);\n\n\t\t\tAI temp = individuals[0];\n\t\t\tthis.individuals[0] = individuals[rand];\n\t\t\tthis.individuals[rand] = temp;\n\t\t}\n\t}", "public void setPopulation(Integer population) {\n this.population = population;\n }", "public int getPopulationSize()\n\t{\n\t\treturn individuals.length;\n\t}", "private void modifyIndividuals(){\n for(AbstractBehaviour behaviour: entityBehaviours){\n JSONObject jsonPop = null;\n GeneticInterface gi = interfaceMap.get(behaviour);\n try {\n jsonPop = gi.receiveNewPopulation();\n } catch (IOException e) {\n e.printStackTrace();\n }\n for(String key: jsonPop.keySet()){\n JSONArray funArray = jsonPop.getJSONObject(key).getJSONArray(\"functions\");\n List<Function> functions = new LinkedList<>();\n for(int a = 0; a <funArray.length(); a++){\n String tree = funArray.getString(a);\n Function functionTree = Node.treeFromString(tree, behaviour.getNumberOfInputs());\n functions.add(functionTree);\n }\n behaviour.setEntityByName(key, functions);\n }\n behaviour.resetEntities();\n }\n }", "public void tournamentWithElitism(){\n\t\tEvolvable spring[] = new Evolvable[populationSize];\n\t\t\n\t\t//elite individuals go directly to new population\n\t\tfor (int i = 0; i < SNSLearningAgent.elitism; i++){\n\t\t\tspring[i] = population[i];\t\n\t\t}\n\t\t\n\t\t//other individuals are selected via tournament\n\t\tfor (int i = SNSLearningAgent.elitism; i < populationSize; i+=2) {\n\t\t\t//parents selected via tournament\n\t\t\tint p1 = tournament(SNSLearningAgent.tournamentSize);\t\n\t\t\tint p2 = tournament(SNSLearningAgent.tournamentSize);\n\t\t\twhile(p1 == p2)\tp2 = tournament(SNSLearningAgent.tournamentSize);\n\t\t\t\n\t\t\t//performs crossover if probability is matched\n\t\t\tif(R.nextFloat() < SNSLearningAgent.crossoverProb){\n\t\t\t\tif (crossBehavior.equals(\"freeSplitCross\")){\n\t\t\t\t\tint point = R.nextInt(SNSAgent.DNA_LENGTH);\n\t\t\t\t\t\n\t\t\t\t\tspring[i] = cross(population[p1], population[p2], point);\n\t\t\t\t\tif (i+1 < populationSize) spring[i+1] = cross(population[p2], population[p1], point);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tspring[i] = cross(population[p1], population[p2]);\n\t\t\t\t\tif (i+1 < populationSize) spring[i+1] = cross(population[p2], population[p1]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\tspring[i] = population[p1];\n\t\t\t\tif (i+1 < populationSize) spring[i+1] = population[p2];\n\t\t\t}\n\t\t\t\n\t\t\t//performs mutation if probability is reached\n\t\t\tif(R.nextFloat() < SNSLearningAgent.mutationProb){\n\t\t\t\tspring[i].mutate();\n\t\t\t}\n\t\t\tif(i+1 < populationSize && R.nextFloat() < SNSLearningAgent.mutationProb){\n\t\t\t\tspring[i+1].mutate();\n\t\t\t}\n\t }\n\t\t\n\t\t//replaces old population with the new one\n\t\tfor(int i = 1; i < populationSize; i++) {\n\t\t\tpopulation[i] = spring[i];\n\t\t}\n\t}", "public population(int size, boolean initial) {\n tours = new tour[size];\n for (int i = 0; i < tours.length; i++) {\n\t tour newTour = new tour();\n newTour.path();\n savetour(i, newTour);\n }\n }", "private static void test1(Person p, int x, int[] arr) {\r\n\t\tString name = p.getFirstName();\r\n\t\tname = \"Original\";\r\n\t}", "protected Individual(float[] _genes)\n\t\t{\tgenes = _genes;\n\t\t\tcreateMe();\n\t\t\twait = 0;\n\t\t\tmove = 0;\n\t\t}", "private static void test2(Person p, int x, int[] arr) {\r\n\t\tString name = \"original\";\r\n\t\tp.setFirstName(name);\r\n\t}", "Individual createIndividual();", "public Population mutatePopulation(Population population, List<FogDevice> fogDevices, List<? extends Cloudlet> cloudletList) {\n\n // Loop over current population by fitness\n for (int populationIndex = 1; populationIndex < population.size(); populationIndex++) {\n // if the current individual is selected to mutation phase\n if (this.mutationRate > Math.random()) {\n Individual individual = population.getFittest(populationIndex);\n individual = this.mutateIndividual(individual);\n }\n }\n // Return mutated population\n return population;\n }", "@Override\n public Individual selectIndividual(Population population, Individual individual, MersenneTwister rnd, ExperimentalData expData, Statistics stats) {\n List<Integer> indexIndividuals = new ArrayList<>();\n Integer bigger = -1;\n double[] outputs = expData.getDataset(Utils.DatasetType.TRAINING).getOutputs();\n int index = identifyCloserIndividual(population, individual, outputs, indexIndividuals, bigger, rnd);\n getStatisticsDim(individual, population.get(index), stats, outputs);\n return population.get(index);\n }", "Chromosome from(List<Chromosome> population);", "public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub);", "protected void initializePopulation () {\n\t\tfor (int i = 0; i < this.speciesSize; i++) {\n\t\t\tthis.detectors.add(DetectorFactory.makeDetector(this.featuresLength, this.typeBias, this.generalityBias));\n\t\t}\n\t}", "public ArrayList<Individual> getSortedPopulation(){\n ArrayList<Individual> sortedIndividuals = new ArrayList<Individual>();\n\n for(Individual individual: individuals){\n int indexToadd = 0;\n\n if(sortedIndividuals.isEmpty()){\n sortedIndividuals.add(individual);\n }\n else {\n for(Individual sortedIndividual : sortedIndividuals){\n if(individual.getFitness() > sortedIndividual.getFitness()){\n indexToadd = sortedIndividuals.indexOf(sortedIndividual);\n break;\n }\n }\n if(indexToadd == 0 ){\n sortedIndividuals.add(individual);\n }\n else {\n sortedIndividuals.add(indexToadd,individual);\n }\n }\n }\n return sortedIndividuals;\n }", "public void initializePopulation(){\n\t\t// create the population\n\t\tfor(int i = 0; i < POPULATION_SIZE; i++){\n\t\t\t// get a random length for the building sequence\n\t\t\tint randArraySize = randomGenerator.nextInt(possiblePieces.length-1)+1;\n\t\t\t\n\t\t\tBuildingPiece[] pieceSequence = new BuildingPiece[randArraySize];\n\t\t\tfor(int j = 0; j < randArraySize; j++){\n\t\t\t\t// get a random possible piece and insert it into the sequence\n\t\t\t\tint randIndex = randomGenerator.nextInt(possiblePieces.length);\n\t\t\t\tpieceSequence[j] = possiblePieces[randIndex];\n\t\t\t}\n\t\t\t\n\t\t\t/* add a new number sequence with the newly created \n\t\t\t * sequence from the input */\n\t\t\tpopulation.add(new Building(pieceSequence, generation, possiblePieces));\n\t\t}\n\t}", "public Population breedPopulation(EvolutionState state)\r\n {\n if( previousPopulation != null )\r\n {\r\n if( previousPopulation.subpops.length != state.population.subpops.length )\r\n state.output.fatal( \"The current population should have the same number of subpopulations as the previous population.\" );\r\n for( int i = 0 ; i < previousPopulation.subpops.length ; i++ )\r\n {\r\n if( state.population.subpops[i].individuals.length != previousPopulation.subpops[i].individuals.length )\r\n state.output.fatal( \"Subpopulation \" + i + \" should have the same number of individuals in all generations.\" );\r\n for( int j = 0 ; j < state.population.subpops[i].individuals.length ; j++ )\r\n if( previousPopulation.subpops[i].individuals[j].fitness.betterThan( state.population.subpops[i].individuals[j].fitness ) )\r\n state.population.subpops[i].individuals[j] = previousPopulation.subpops[i].individuals[j];\r\n }\r\n previousPopulation = null;\r\n }\r\n\r\n // prepare the breeder (some global statistics might need to be computed here)\r\n prepareDEBreeder(state);\r\n\r\n // create the new population\r\n Population newpop = (Population) state.population.emptyClone();\r\n\r\n // breed the children\r\n for( int subpop = 0 ; subpop < state.population.subpops.length ; subpop++ )\r\n {\r\n if (state.population.subpops[subpop].individuals.length < 4) // Magic number, sorry. createIndividual() requires at least 4 individuals in the pop\r\n state.output.fatal(\"Subpopulation \" + subpop + \" has fewer than four individuals, and so cannot be used with DEBreeder.\");\r\n \r\n Individual[] inds = state.population.subpops[subpop].individuals;\r\n for( int i = 0 ; i < inds.length ; i++ )\r\n {\r\n newpop.subpops[subpop].individuals[i] = createIndividual( state, subpop, inds, i, 0); // unthreaded for now\r\n }\r\n }\r\n\r\n // store the current population for competition with the new children\r\n previousPopulation = state.population;\r\n return newpop;\r\n }", "public void evalPopulation(Population population, City cities[]) {\n\t\tdouble totalPopulationFitness = 0;\n\t\tfor (Individual individual : population.getIndividuals()) {\n\t\t\ttotalPopulationFitness += this.calcFitness(individual, cities);\n\t\t}\n\n\t\tdouble avgFitness = totalPopulationFitness / population.size();\n\n\t\tpopulation.setAverageFitness(avgFitness);\n\t}", "public void moveInPopulation()\n\t{\n\t\tsynchronized (this) {\n\t\tcurrentState.moveInPopulation();\n\t\t}\n\t}", "@Override\n\tpublic void ispisiPopulaciju(IVector[] populacija) {\n\n\t}", "public void reproduce(int generation, IPopulation pop, List<ISpecies> sorted_species) {\n\t\tfor(ISpecies specie : sorted_species){\r\n\r\n\t\t\tList<IOrganism> organisms = specie.getOrganisms();\r\n\r\n\t\t\t// outside the species\r\n\t\t\tint orgnum = 0;\r\n\r\n\t\t\tIOrganism mom = null;\r\n\t\t\tIOrganism baby = null;\r\n\t\t\tIGenome new_genome = null;\r\n\t\t\tIOrganism _organism = null;\r\n\t\t\tIOrganism _dad = null;\r\n\r\n\t\t\tif (specie.getExpectedOffspring() > 0 && organisms.size() == 0)\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// elements for this species\r\n\t\t\tint poolsize = organisms.size() - 1;\r\n\r\n\t\t\t// the champion of the 'this' species is the first element of the species;\r\n\t\t\tIOrganism thechamp = organisms.get(0);\r\n\t\t\tboolean champ_done = false; // Flag the preservation of the champion\r\n\r\n\t\t\t// Create the designated number of offspring for the Species one at a time.\r\n\t\t\tfor (int count = 0; count < specie.getExpectedOffspring(); count++) {\r\n\r\n\t\t\t\t// If we have a super_champ (Population champion), finish off some special clones.\r\n\t\t\t\tif (thechamp.getSuperChampOffspring() > 0) {\r\n\r\n\t\t\t\t\t// save in mom current champ;\r\n\t\t\t\t\tmom = thechamp;\r\n\t\t\t\t\t// create a new genome from this copy\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tif ((thechamp.getSuperChampOffspring()) > 1) {\r\n\t\t\t\t\t\tif (RandomUtils.randomDouble() < .8 || evolutionParameters.getDoubleParameter(MUTATE_ADD_LINK_PROB) == 0.0)\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateLinkWeight(new_genome, evolutionParameters.getDoubleParameter(WEIGHT_MUT_POWER), 1.0, MutationType.GAUSSIAN);\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t// Sometimes we add a link to a superchamp\r\n\t\t\t\t\t\t\tnew_genome.generatePhenotype(generation);\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateAddLink(new_genome,pop);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\tthechamp.incrementSuperChampOffspring();\r\n\t\t\t\t} // end population champ\r\n\r\n\t\t\t\t// If we have a Species champion, just clone it\r\n\t\t\t\telse if ((!champ_done) && (specie.getExpectedOffspring() > 5)) {\r\n\t\t\t\t\tmom = thechamp; // Mom is the champ\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation); // Baby is\r\n\t\t\t\t\t// just like mommy\r\n\t\t\t\t\tchamp_done = true;\r\n\r\n\t\t\t\t} else if (RandomUtils.randomDouble() < evolutionParameters.getDoubleParameter(MUTATE_ONLY_PROB) || poolsize == 1) {\r\n\r\n\t\t\t\t\t// Choose the random parent\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\r\n\t\t\t\t\t// Do the mutation depending on probabilities of various mutations\r\n\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\t// Otherwise we should mate\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Choose the random mom\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\r\n\t\t\t\t\t// save in mom\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\t// Choose random dad...\r\n\t\t\t\t\t// Mate within Species\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(INTERSPECIES_MATE_RATE)) {\r\n\t\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\t\t_dad = _organism;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Mate outside Species\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// save current species\r\n\t\t\t\t\t\tISpecies randspecies = specie;\r\n\t\t\t\t\t\t// Select a random species\r\n\t\t\t\t\t\tint giveup = 0;\r\n\t\t\t\t\t\t// Give up if you can't find a different Species\r\n\t\t\t\t\t\twhile ((randspecies == specie) && (giveup < 5)) {\r\n\r\n\t\t\t\t\t\t\t// Choose a random species tending towards better species\r\n\t\t\t\t\t\t\tdouble randmult = Math.min(1.0, RandomUtils.randomGaussian() / 4);\r\n\r\n\t\t\t\t\t\t\t// This tends to select better species\r\n\t\t\t\t\t\t\tint sp_ext = Math.max(0, (int) Math.floor((randmult * (sorted_species.size() - 1.0)) + 0.5));\r\n\t\t\t\t\t\t\trandspecies = sorted_species.get(sp_ext);\r\n\t\t\t\t\t\t\t++giveup;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t_dad = randspecies.getOrganisms().get(0);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tnew_genome = evolutionStrategy.getCrossoverStrategy().performCrossover(mom,_dad,count);\r\n\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(MATE_ONLY_PROB) || \r\n\t\t\t\t\t\t\t_dad.getGenome().getId() == mom.getGenome().getId() || \r\n\t\t\t\t\t\t\t_dad.getGenome().compatibility(mom.getGenome()) == 0.0) {\r\n\r\n\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\t} \r\n\t\t\t\t\t// end block of prob\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\r\n\t\t\t\t\t// Create the baby without mutating first\r\n\t\t\t\t\telse \r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\tevolutionStrategy.getSpeciationStrategy().addOrganismToSpecies(pop, baby);\r\n\t\t\t} // end offspring cycle\r\n\t\t}\r\n\t}", "public Population(int indivCount) {\n this.indivCount = indivCount;\n layers = new ArrayList<>();\n individuals = new Individual[indivCount];\n }", "public AIAssign2(){\n \n Scanner console = new Scanner(System.in);\n \n System.out.print(\"Input population size \");\n popsize = console.nextInt();\n \n System.out.print(\"Input tournament size \");\n tournysize = console.nextInt();\n \n System.out.print(\"Input crossover chance (%) \");\n crossprob = console.nextDouble();\n \n System.out.print(\"Input mutation chance (%) \");\n mutaprob = console.nextDouble();\n \n System.out.print(\"Input max generation size \");\n maxgen = console.nextInt();\n \n System.out.print(\"Input problem width \");\n width = console.nextInt();\n \n System.out.print(\"Input problem height \");\n height = console.nextInt();\n \n System.out.print(\"Input start location x-1 \");\n startx = console.nextInt();\n \n System.out.print(\"Input start location y-1 \");\n starty = console.nextInt();\n \n System.out.print(\"Input seed value \");\n seed = console.nextLong();\n \n Random rnd = new Random(seed);\n \n population = new int[popsize][height*width];\n population2 = new int[popsize][height*width];\n popfitness = new int[popsize];\n \n for (int i = 0 ; i<popsize ; i++){\n for (int j = 0 ; j<population[0].length ; j++){\n population[i][j] = (rnd.nextInt(4));\n }\n }\n Print(population);\n \n //the generation loop\n for (int gen = 0 ; gen < maxgen ; gen++){\n \n //fitness of individuals is stored\n int btemp = 0;\n for (int i = 0 ; i < popsize ; i++){\n \n problem = new char[width][height];\n problem[startx][starty] = 'S';\n \n popfitness[i] = Fitness(population[i], problem, startx, starty, 0);\n \n if (popfitness[i] > btemp){ btemp = popfitness[i];}\n }\n bestavg = bestavg + btemp;\n \n String line=\"\";\n int avg=0;\n for (int i = 0 ; i < popsize ; i++){\n line = line + \"[\" + popfitness[i] + \"] \"; \n avg = avg + popfitness[i];\n }\n avg = avg/popsize;\n avgavg = avgavg + avg;\n bestavg = bestavg / (gen+1);\n avgavg = avgavg / (gen+1);\n System.out.println(\"Gen: \"+gen + \" Fitness: \"+ line + \" Avg: \"+ avg + \" BestAvg: \" + bestavg + \" AvgAvg: \" + avgavg);\n bestavg = bestavg * (gen+1);\n avgavg = avgavg * (gen+1);\n \n //Tournament selection\n for (int i = 0 ; i < popsize ; i++){\n int best = 0; \n int rand = (int)(rnd.nextInt(popsize));\n best = rand;\n \n for (int k = 0 ; k < tournysize ; k++){\n if (popfitness[rand] > popfitness[best]){\n best = rand;\n }\n \n rand = (int)(rnd.nextInt(popsize));\n }\n population2[i] = Copy(population[best]); \n }\n \n //single-focus-flip and block exchange mutations\n for (int i = 0 ; i < popsize-1 ; i++){\n if (crossprob > rnd.nextInt(100)){\n int temp; \n for (int a = 0 ; a < 5 ; a++){\n temp = population2[i][a];\n population2[i][a] = population2[i+1][a];\n population2[i+1][a] = temp;\n }\n }\n }\n \n for (int i = 0 ; i < popsize ; i++){\n if (mutaprob > rnd.nextInt(200)){\n int temp = (int) (rnd.nextInt(population2[0].length)); \n population2[i][temp] = (int)(rnd.nextInt(4));\n }\n else if (mutaprob > rnd.nextInt(200)){\n for (int j = 0 ; j < population2[0].length/2 ; j++){\n int temp = population2[i][j];\n population2[i][j] = population2[i][population2[0].length-1-j];\n population2[i][population2[0].length-1-j] = temp;\n }\n }\n }\n \n population = population2;\n population2 = new int[popsize][population[0].length];\n \n }\n \n bestavg = bestavg / maxgen;\n avgavg = avgavg / maxgen;\n Print(population);\n System.out.println(\"Best Avg: \" + bestavg + \" Average of Avg: \" + avgavg);\n }", "void TruncPopulation(double percent){\n\t\t\tint i,j,t, numIndiviadual;\n\t\t\tnode[] _nm;\n\t\t \tint[] Sort=new int[poplen];\t \t\n\t\t \n\t\t \tfor(i=0; i<poplen; i++)\t{\n\t\t \t\tSort[i]=i;\t \t\t\n\t\t \t}\n\t\t \t\t \n\t\t \t// Sort giam dam\n\t\t \tfor(i=0; i<poplen-1; i++)\t{\n\t\t \t\tfor(j=i+1; j<poplen; j++){\t \t\t\n\t\t \t\t\tif(oldpop[Sort[i]].size<oldpop[Sort[j]].size){\n\t\t \t\t\t\tt=Sort[i];\n\t\t \t\t\t\tSort[i]=Sort[j];\n\t\t \t\t\t\tSort[j]=t;\n\t\t \t\t\t}\n\t\t \t\t}\n\t\t \t\t\n\t\t \t}\n\t\t\t\n\t\t \tnumIndiviadual=(int)(poplen*percent);\n\t\t \t\n//\t\t \tSystem.out.println(numIndiviadual);\n\t\t \t\n\t\t\tfor(i = 0; i < numIndiviadual; i++){\n\t\t\t\tindividual[] m_individual=new individual[1];\n\t\t\t\tint[] _mt=new int[1];\n\t\t\t\t_nm=new node[1];\n//\t\t\t\tSystem.out.println(\"Trước+\"+oldpop[i].size);\n\t\t\t\tif(this.TruncateTreeGrow(oldpop[Sort[i]], m_individual,_mt,_nm)==TRUE){\t\n\t\t\t\t\t\n\t\t\t\toldpop[Sort[i]]=new individual();\n\t\t\t\toldpop[Sort[i]].CopyIndividual(m_individual[0], TRUE);\t\t\t\n\t\t\t\toldpop[Sort[i]].evaluated=FALSE;\n//\t\t\t\tSystem.out.println(\"Sau+\"+oldpop[i].size);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}", "public PopulatedPlace(String zip, String town, String state,\n\t\t\t double latitude, double longitude, int population){\n\tsuper(zip, town, state, latitude, longitude);\n\tthis.population = population;\n }", "public void modifyFitness(Population population) {\n // prepare the calculation\n double[][] data = new double[population.size()][];\n for (int i = 0; i < data.length; i++) {\n data[i] = ((AbstractEAIndividual)population.get(i)).getFitness();\n }\n double min = Double.POSITIVE_INFINITY, fitnessSharing;\n double[] result = new double[data.length];\n AbstractEAIndividual tmpIndy;\n\n for (int x = 0; x < data[0].length; x++) {\n for (int i = 0; i < data.length; i++) data[i][x] = -data[i][x];\n for (int i = 0; i < data.length; i++) {\n if (data[i][x] < min) min = data[i][x];\n }\n\n for (int i = 0; i < data.length; i++) {\n // This will cause the worst individual to have no chance of being selected\n // also note that if all individual achieve equal fitness the sum will be zero\n result[i] = data[i][x] -min + 0.1;\n }\n\n for (int i = 0; i < population.size(); i++) {\n tmpIndy = (AbstractEAIndividual)population.get(i);\n fitnessSharing = 0;\n for (int j = 0; j < population.size(); j++) {\n if (this.m_SharingDistance < this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))) {\n fitnessSharing += 1 - (this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))/this.m_SharingDistance);\n }\n }\n result[i] = result[i]/fitnessSharing;\n }\n\n for (int i = 0; i < population.size(); i++) {\n ((AbstractEAIndividual)population.get(i)).SetFitness(x, result[i]);\n }\n }\n }", "public ArrayRegister(int size) {\r\n persons = new Person[size];\r\n count = 0;\r\n }", "private PMCGenotype[] advanceGeneration()\n\t{\n\t\tPMCGenotype[] newPop = new PMCGenotype[population.length];\n\t\tPMCGenotype[] parents = selectParents();\n\t\tArrayList<PMCGenotype> candidates = new ArrayList<PMCGenotype>();\n\n\t\t// Add the current population to the list of candidates.\n\t\tfor (PMCGenotype pmcg : population)\n\t\t{\n\t\t\tcandidates.add(pmcg);\n\t\t}\n\n\t\t// For each parent, generate a number of mutations (children), calculate their fitness\n\t\t// and add them to the list of candidates.\n\t\tint childrenPerParent = this.childrenPerGeneration / this.parentsToSelect;\n\t\tfor (PMCGenotype p : parents)\n\t\t{\n\t\t\tfor (int i = 0; i < childrenPerParent; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = PMCGenotype.mutate(p, r);\n\t\t\t\tpmcg.setFitness(fitness(pmcg, this.trials));\n\t\t\t\tcandidates.add(pmcg);\n\t\t\t}\n\t\t}\n\n\t\t// Find candidate with the best fitness and add it to the new population.\n\t\t// Repeat this until the new population size matches the previous population size.\n\t\tint candidatesChosen = 0;\n\t\twhile (candidatesChosen < this.population.length)\n\t\t{\n\t\t\tint numberOfRemainingCandidates = candidates.size();\n\t\t\tdouble currentBestFitnessScore = 0;\n\t\t\tint currentBestFitnessScoreIndex = 0;\n\n\t\t\tfor (int i = 0; i < numberOfRemainingCandidates; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = candidates.get(i);\n\t\t\t\tif (pmcg.getFitness() > currentBestFitnessScore)\n\t\t\t\t{\n\t\t\t\t\tcurrentBestFitnessScore = pmcg.getFitness();\n\t\t\t\t\tcurrentBestFitnessScoreIndex = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewPop[candidatesChosen] = candidates.get(currentBestFitnessScoreIndex);\n\t\t\tcandidatesChosen++;\n\n\t\t\tcandidates.remove(currentBestFitnessScoreIndex);\n\t\t}\n\n\t\treturn newPop;\n\t}", "@Override\n\t// Select individuals for crossover\n\tprotected Individual tournamentSelection(Population pop) {\n\t\tSortingIndividual baseIndiv = (SortingIndividual) pop.individuals[0];\n\t\tPopulation tournament = new SortingPopulation(tournamentSize, baseIndiv.getBase(), false);\n\t\t// For each place in the tournament get a random individual\n\t\tfor (int i = 0; i < tournamentSize; i++) {\n\t\t\tint randomId = (int) (Math.random() * pop.size());\n\t\t\ttournament.saveIndividual(i, pop.getIndividual(randomId));\n\t\t}\n\t\t// Get the fittest\n\t\tIndividual fittest = tournament.getFittest();\n\t\treturn fittest;\n\t}", "public void createSelectedPopulation(Population previousPopulation, int populationSize, double perc) {\n\t\t\n\t\tint intendedSize = (int)(populationSize * perc/100);\n\t\tSystem.out.println(\"intended size: \" + intendedSize ) ;\n\t\tint currentSize = 0;\n\t\tint randomPopulationSize;\n\t\tSolution mutant;\n\t\tList<ArrayList<String>> added = new ArrayList<ArrayList<String>>();\n\n\t\t\n\t\t//copy solutions from the previous population until the cloning factor is bigger than 1\n\t\tfor(Solution solution : previousPopulation.getPopulation()) {\n\t\t\tif(solution.getCloningFactor() < 1.0) break;\n\t\t\t\n\t\t\t//add as many clones of the current solution\n\t\t\t//as indicates the cloning factor\n\t\t\t//eg. if cloning factor is 2 -> 3 copies of this solution will go to the next population\n\t\t\tfor(int i = 0; i <= (int) solution.getCloningFactor(); i++) {\n\t\t\t\t//if we get a complete population by cloning the solution from the previous population\n\t\t\t\t//leave the method\n\t\t\t\tif(currentSize == intendedSize) break;\n\t\t\t\t\n\t\t\t\t//we create a mutation of each clone\n\t\t\t\t//if mutation is less efficient or already exists in the population we discard it\n\t\t\t\tmutant = new Solution(solution.getFrequencyRelations(), solution.getCabinets());\n\t\t\t\tArrayList<String> mutantSol = solution.mutate();\n\t\t\t\tmutant.setPossibleSolution(mutantSol);\n\t\t\t\tmutant.setPath(mutant.countPath(mutant.getPossibleSolution()));\n\t\t\t\t\n\t\t\t\t//System.out.println(\"M: \" + mutantSol + \" \" + mutant.getPath() );\n\t\t\t//\tSystem.out.println(\"S: \" + solution.getPossibleSolution() + \" \" + solution.getPath() );\n\n\n\t\t\t\tif(mutant.getPath() >= solution.getPath() || added.contains(mutant.getPossibleSolution()) ) {\n\t\t\t\t\tpopulation.add(solution);\n\t\t\t\t\tadded.add(solution.getPossibleSolution());\n\t\t\t\t\t//System.out.println(\"original\");\n\t\t\t\t}else {\n\t\t\t\t\tpopulation.add(mutant);\n\t\t\t\t\tadded.add(mutant.getPossibleSolution());\n\t\t\t\t\t//System.out.println(\"mutant\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\tcurrentSize++;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//count the number of random solutions that should be added\n\t\tif(currentSize <= populationSize) {\n\t\t\t randomPopulationSize = populationSize - currentSize;\n\t\t}else return;\n\t\t\n\t\t//create random solutions and add them to the population \n\t\t//until the wished size is reached\n\t\tcreateRandomPopulation(previousPopulation.getCabinetArrangement(), randomPopulationSize);\n\t\t\t\n\t}", "private int[] getElite(int[][] population) {\n\t\tfloat[] fitnesses = new float[population.length];\n\n\t\tfor (int i = 0; i < population.length; i++) {\n\t\t\tfitnesses[i] = getFitness(population[i]);\n\t\t\tif (fitnesses[i] < eliteFitness) {\n\t\t\t\tSystem.out.println(getFitness(eliteChromosome) + \" old\" + getFitness(population[i]) + \" new\");\n\t\t\t\teliteFitness = fitnesses[i];\n\t\t\t\teliteChromosome = population[i];\n\t\t\t}\n\t\t}\n\t\treturn eliteChromosome;\n\t}", "private void setPersonsInPool(ArrayList<Person> personsInPool) {\n this.personsInPool = personsInPool;\n }", "public void initPop(int num) {\n\t\tif (num % 2 == 1) {\n\t\t\tnum -= 1;\n\t\t}\n\t\tthis.individuals = new AI[num];\n\t\tfor (int i = 0; i < num; i++)\n\t\t\tthis.individuals[i] = new AI();\n\t}", "private void populateData() {\r\n\t\tfor(int i = 0; i < this.incomeRanges.length; i++) {\r\n\t\t\tthis.addData(new Data(incomeRanges[i], 0), true);\r\n\t\t}\t// end for\r\n\t}", "public GAIndividual()\n {\n m_fitness = 0;\n m_genome = new ArrayList<Integer>();\n }", "private void sortPopulation() {\n println(\"sortPopulation()\", 1);\n //population_size = population.size();\n for(int i = 1; i < population_size; i++) {\n \n //current is the one we're going to put in the right place\n Individual current = population[i];\n double current_fitness = current.getFitness();\n \n //Test to see if current's fitness is better than the previous one; if so, then it's out of order\n double last_fitness = population[i - 1].getFitness();\n \n //if(current_fitness < last_fitness) {\n if(population[i].isLessThan(population[i - 1])) {\n \n println(population[i].getFitness() + \" < \" + population[i - 1].getFitness(), 5);\n //Now, search from the beginning to see where it goes\n int j = 0;\n //System.out.print(\"j = \" + Integer.toString(j) + \" \");\n //while(current_fitness >= population[j].getFitness() && j < population_size - 1) {\n while(population[j].isLessThanOrEqual(population[i]) && j < population_size - 1) {\n j++;\n //System.out.print(\"j = \" + Integer.toString(j) + \" \");\n }\n //We've found the correct place\n Individual temp = new Individual();\n temp = population[i];\n for(int q = i; q > j; q--) {\n population[q] = population[q - 1];\n //System.out.print(\"q = \" + Integer.toString(q) + \" \");\n }\n population[j] = temp;\n }\n }\n }", "public List<SGenome> Epoch(List<SGenome> old_pop){\n m_vecPop = old_pop;\n\n //reset the appropriate variables\n Reset();\n\n //sort the population (for scaling and elitism)\n Collections.sort(m_vecPop);\n\n //calculate best, worst, average and total fitness\n CalculateBestWorstAvTot();\n\n //create a temporary vector to store new chromosones\n List <SGenome> vecNewPop = new ArrayList<>();\n\n //Now to add a little elitism we shall add in some copies of the\n //fittest genomes. Make sure we add an EVEN number or the roulette\n //wheel sampling will crash\n if ((CParams.iNumCopiesElite * CParams.iNumElite % 2)==0)\n {\n GrabNBest(CParams.iNumElite, CParams.iNumCopiesElite, vecNewPop);\n }\n\n\n //now we enter the GA loop\n\n //repeat until a new population is generated\n while (vecNewPop.size() < m_iPopSize)\n {\n //grab two chromosones\n SGenome mum = GetChromoRoulette();\n SGenome dad = GetChromoRoulette();\n\n //create some offspring via crossover\n List<Double> baby1 = new ArrayList<>();\n List<Double> baby2 = new ArrayList<>();\n\n CrossoverAtSplits(mum.vecWeights, dad.vecWeights, baby1, baby2);\n\n //now we mutate\n Mutate(baby1);\n Mutate(baby2);\n\n //now copy into vecNewPop population\n vecNewPop.add( new SGenome(baby1, 0) );\n vecNewPop.add( new SGenome(baby2, 0) );\n }\n\n //finished so assign new pop back into m_vecPop\n m_vecPop = vecNewPop;\n //FitnessScaleRank();\n return m_vecPop;\n }", "public IndividualHolder (GAIndividual i) {\n individual = i;\n }", "public void setPoputlation (double population) { n.setPopulation(population); }", "public Population evolve()\r\n {\r\n\tArrayList<Chromosome> tempPop = \r\n\t new ArrayList<Chromosome>(chromos.size());\r\n\tChromosome u;\r\n\tChromosome v;\r\n\r\n\tfor(int i = 0; i < chromos.size()/2; i++)\r\n\t {\r\n\t\tu = selectParent();\r\n\t\tv = selectParent();\r\n\t\t\r\n\t\t//System.out.println(\"*****Parent 1 : \\n\" + v);\r\n\t\t\r\n Chromosome c1 = u.child(v);\r\n Chromosome c2 = v.child(u);\r\n\t\ttempPop.add(c1);\r\n\t\ttempPop.add(c2);\r\n\t\t\r\n //System.out.println(\"****Generated new child: \\n\" + c1);\r\n\t }\t \r\n\t\r\n\t// if needed, add in the code for keeping the best chromosome\r\n\tPopulation pop = new Population(tempPop, selMethod, selPara, \r\n\t\t\t\t\tcrossMethod, crossPara, mutMethod, mutPara, \r\n\t\t\t\t\treplaceMethod, replacePara, powerStep, tourStep, ff);\r\n\r\n\tif(replaceMethod == ELITISM)\r\n\t {\r\n\t\tpop.remove(worstChromoIndex);\r\n\t\tpop.add(bestChromo.clone());\r\n\t\tpop.initialize();\r\n\t }\r\n\r\n\tgeneration++;\r\n\treturn pop;\r\n }", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "public Population(ArrayList<Chromosome> c, int selMethod, int selPara, \r\n\t\t int crossMethod, double crossPara, int mutMethod,\r\n\t\t double mutPara, int replaceMethod, int replacePara,\r\n\t\t double powerStep, double tourStep, FitnessFunction fitnessFunction)\r\n {\r\n\tthis(selMethod, selPara, crossMethod, crossPara, mutMethod, mutPara, \r\n\t replaceMethod, replacePara, powerStep, tourStep, fitnessFunction);\r\n\r\n\tchromos = c;\r\n\r\n\tinitialize();\r\n }", "public void sortArray(){\n\t\tfor (int i=0; i<population.length;i++){\n\n\t\t\tfor (int j=0; j<population.length-i-1;j++){\n\n\t\t\t\tif(population[j].computeFitness()>population[j+1].computeFitness()) {\n\t\t\t\t\t//swap their positions in the array\n\t\t\t\t\tChromosome temp1 = population[j];\n\t\t\t\t\tpopulation[j] = population[j+1];\n\t\t\t\t\tpopulation[j+1] = temp1;\n\t\t\t\t}//end if\n\n\t\t\t}//end j for\n\n\t\t}//end i for\n\t}", "public void seedPeopleInfections(\n Int2ObjectMap<InfectionState> personStates,\n Int2ObjectMap<IntSet> peopleByLocation\n ) {\n IntSet animalKeys = startLocations.getLocationsByPeopleId().keySet();\n for (int animalID : animalKeys) {\n personStates.put(animalID, InfectionState.SUSCEPTIBLE);\n }\n NationalSampler ns = nsf.build(peopleByLocation);\n IntSet sampledSeeds = ns.getSampledPeople();\n for (int personID : sampledSeeds) {\n AgeClass ageClass = peopleAgeClasses.get(personID);\n //Get what age group the person is in\n switch (ageClass) {\n case YOUNG:\n personStates.put(personID, EXPOSED_YOUNG);\n break;\n case ADULT:\n personStates.put(personID, EXPOSED_ADULT);\n break;\n case ELDERLY:\n personStates.put(personID, EXPOSED_ELDERLY);\n break;\n default:\n throw new UnsupportedOperationException(\"Age class not known- for recovered event\");\n }\n }\n }", "public void printArray(){\n\n\t\tfor (int i=0;i<1;i++){\n\n\t\t\tfor (int j=0;j<population[i].getLength();j++){\n\n\t\t\t\tSystem.out.println(\"X\" + j + \": \" + population[i].getX(j) + \" \" + \"Y\"+ j + \": \" + population[i].getY(j));\n\t\t\t\tSystem.out.println();\n\n\t\t\t}//end j\n\n\t\t\tSystem.out.println(\"The duplicate count is: \" + population[i].duplicateCheck());\n\t\t\tSystem.out.println(\"The fitness is \" + population[i].computeFitness());\n\t\t\t//population[i].computeFitness();\n\n\t\t}//end i\n\n\t}", "public static void main(String[] args) {\n\t\tint [] Num = {1,2,3,4,5};\n\t\tint [] newNum = new int[10];\n//\t\tfor(int i=0;i<Num.length;i++) {\n//\t\t\tnewNum[i] = Num[i];\n//\t\t}\n//\t\tnewNum = Num;\n\t\tSystem.arraycopy(Num,0, newNum,0,Num.length);\n\t\tSystem.out.println(newNum);\n\t}", "private static void fixPopulation() {\r\n \t//get a copy of the population hash map\r\n \tHashMap<String, ArrayList<Critter>> copy = new HashMap<String, ArrayList<Critter>>(population);\r\n \tIterator<String> populationIterator = copy.keySet().iterator();\r\n \twhile (populationIterator.hasNext()) { \r\n String pos = populationIterator.next();\r\n ArrayList<Critter> critterList = copy.get(pos);\r\n //clear the key if there is no more critters in that space\r\n if(critterList.size() == 0 || critterList == null) {\r\n \tpopulation.remove(pos);\r\n }\r\n \t}\r\n }", "@Override\n public TestingSet createTestingSet(int individuals) \n {\n return TestingSet.createSingleTrialForAllIndividuals(individuals);\n }", "SolutionPopulation initialise(ArrayList<City> cities, int populationSize);", "private static Set<Chromosome> mutatePopulation(Set<Chromosome> population, double mutationRate) {\n Set<Chromosome> mutatedChromosomes = new HashSet<>(population);\n\n for (Chromosome path : mutatedChromosomes) {\n double mutationProbability = ThreadLocalRandom.current().nextDouble();\n if (mutationProbability > (1-mutationRate)) {\n // mutate the path using the RSM mutation operator\n mutateRoute(path);\n // indicate that the fitness of this path needs to be recalculated\n path.fitness = -1;\n }\n }\n\n // The set will most probably include certain chromosomes which are already present in the set of children\n // however, given that both are sets, any duplicates will be discarded\n return mutatedChromosomes;\n }", "public void reveal(GameState pState, int[] pSpecies, Deadline pDue) {\n int score = 0;\n\n boolean[] newObs = {false, false, false, false, false, false};\n for (int i = 0; i < pSpecies.length; i++) {\n\n int currentSpecies = pSpecies[i];\n if (currentSpecies == guess[i]) {\n score++;\n }\n System.err.println(\"Bird num \" + i + \" : \" + speciesName(currentSpecies));\n Bird currentBird = pState.getBird(i);\n\n for (int j = 0; j < currentBird.getSeqLength(); j++) {\n if (currentBird.wasAlive(j)) {\n newObs[currentSpecies] = true;\n listObs.get(currentSpecies).add(currentBird.getObservation(j));\n }\n }\n\n }\n for (int i = 0; i < nbSpecies; i++) {\n int size = listObs.get(i).size();\n if (size >= 70 && newObs[i] && size <= 1000) {\n\n double[][] observationsMatrix = new double[size][1];\n for (int z = 0; z < size; z++) {\n observationsMatrix[z][0] = listObs.get(i).get(z);\n }\n int nbStates;\n int nbIterations = 50;\n\n if (size <= 100) {\n nbStates = 2;\n } else if (size <= 300) {\n nbStates = 3;\n } else {\n nbStates = 4;\n }\n\n HMMOfBirdSpecies newHMMOfBirdSpecies = new HMMOfBirdSpecies(transitionMatrixInit(nbStates), emissionMatrixInit(nbStates, nbTypesObservations), piMatrixInit(nbStates));\n newHMMOfBirdSpecies.BaumWelchAlgorithm(observationsMatrix, nbIterations);\n newHMMOfBirdSpecies.setTrained(true);\n\n listHMM[i] = newHMMOfBirdSpecies;\n\n }\n }\n\n System.err.println(\"Result : \" + score + \"/\" + pSpecies.length);\n }", "public Population(int popSize, String[] studet_ids, int groupSize, \r\n\t\t int initPop, int selMethod, int selPara, \r\n\t\t int crossMethod, double crossPara, int mutMethod,\r\n\t\t double mutPara, int replaceMethod, int replacePara,\r\n\t\t double powerStep, double tourStep, FitnessFunction fitnessFunction)\r\n {\r\n\tthis(selMethod, selPara, crossMethod, crossPara, mutMethod, mutPara, \r\n\t replaceMethod, replacePara, powerStep, tourStep, fitnessFunction);\r\n\r\n\tchromos = new ArrayList<Chromosome>();\r\n\tfor(int i = 0; i < popSize; i++)\r\n\t chromos.add(new Chromosome(studet_ids, groupSize, crossMethod,\r\n\t\t\t\t crossPara, mutMethod, mutPara, initPop, ff));\r\n\tinitialize();\r\n }", "private int insertForciblyIntoPopulation(Individual new_child) {\n int position = insertIntoPopulation(new_child);\n if( position == population_size) {\n population[population_size - 1] = new_child;\n position = population_size - 1;\n }\n return position;\n }", "public Population InitSinglePopulation\n (int PopulationID, int NumberOfAgents, double MixedStrategy){\n \n MultiPopulation TempPopulation = new MultiPopulation();\n\n TempPopulation.setPopulationID(PopulationID);\n TempPopulation.setInitMixedStrategy(MixedStrategy);\n\n for(int j = 0; j < NumberOfAgents; j++){\n\n double TempDraw = rand.nextDouble();\n boolean TempAction = (TempDraw < MixedStrategy) ? true : false;\n MultiPopulationAgent TempAgentM = \n new MultiPopulationAgent(j,PopulationID,TempAction);\n \n TempPopulation.AgentList.add(TempAgentM);\n \n }\n \n TempPopulation.setActionList();\n return TempPopulation;\n }", "@Override\n public void updateAppearance(ArrayList<Individual> population, GeneticAlgorithm GA) {\n HashSet<Individual> a = new HashSet<>();\n a.addAll(population);\n ArrayList<Individual> toProcess = new ArrayList<>();\n toProcess.addAll(a);\n\n // All individuals in population are present in the previous population. The remaining, not.\n for (Individual ind : toProcess) {\n ArrayDeque<Boolean> values = appearance.get(ind);\n if (values != null) {\n // the indivual was previously added. Update the structure\n values.addFirst(Boolean.TRUE);\n if (values.size() > maxTime) {\n values.removeLast();\n }\n } else {\n // new Individual. Add it to the hashmap\n ArrayDeque<Boolean> toAdd = new ArrayDeque<>(maxTime);\n toAdd.add(Boolean.TRUE);\n appearance.put(ind, toAdd);\n }\n }\n\n // Now, the remaining individuals in the hashmap does not appear in this timestamp. Update it.\n Set<Individual> notPresent = appearance.keySet();\n //notPresent.removeAll(population);\n\n for (Individual ind : notPresent) {\n if (!population.contains(ind)) {\n ArrayDeque<Boolean> values = appearance.get(ind);\n values.addFirst(Boolean.FALSE);\n if (values.size() > maxTime) {\n values.removeLast();\n }\n }\n }\n }", "void ComputeFitness(){\n\t\tint i, pos;\n\t\t// individual t;\n\t\tdouble min, sum = 0, sumSize = 0, tm;\n\t\t// First Compute Raw fitness\n\t\tfor(i = 0; i < poplen; i++)\n\t\t{\n\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t}\n\t\t\t\n\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t}\n\t\t//tim individual co fitness be nhat\n\t\tmin = oldpop[0].fitness;\n\t\tpos = 0;\n\t\tsum = oldpop[0].fitness;\n\t\tsumSize = oldpop[0].size;\n\t\t\n\t\tfor(i = 1; i < poplen; i++) {\n\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\tmin = oldpop[i].fitness;\n\t\t\t\tpos = i;\n\t\t\t}\n\t\t\tsum += oldpop[i].fitness;\n\t\t\tsumSize += oldpop[i].size;\n//\t\t\tpopSize[gen][i]= oldpop[i].size;\n\t\t}\n\t\t// copy the best and average\n\t\tbestcurrent[gen] = new individual();\n\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n\t\taverage[gen] = sum /poplen;\n\t\taverageSize[gen] = sumSize /poplen;\n\t\t// Third Compute Adjusted fitness\n\t\tAdjustFitness();\n\t\t// Finally Compute nomarlized fitness\n \t\tNormalizeFitness();\n\t}", "public void updatePopulation() {\r\n this.usedPopulation = Integer.parseInt(data.driver.findElement(By.id(\"pop_current_label\")).getText());\r\n this.maxPopulation = Integer.parseInt(data.driver.findElement(By.id(\"pop_max_label\")).getText());\r\n }", "private static List<Cell> initiatePopulation(int required_population_size)\n {\n List<Cell> population = new ArrayList<Cell>(); //Define an arraylist to hold the initial population of cells\n int[][][] diploid_genome = newEmptyDeploidGenome();\n int cell_generation = newest_generation + 1, last_div = -1;\n \n //Set the label status of all DNA strands in the genome to unlabelled\n for(int chromosome_count = 0; chromosome_count < diploid_genome.length; chromosome_count++)\n {\n for(int homologous_pair_count= 0; homologous_pair_count < diploid_genome[chromosome_count].length; homologous_pair_count++)\n {\n for(int dna_strand_count = 0; dna_strand_count < diploid_genome[chromosome_count][homologous_pair_count].length; dna_strand_count++)\n {\n diploid_genome[chromosome_count][homologous_pair_count][dna_strand_count] = STRAND_UNLABELLED; //Set each DNA strand to unlabelled\n }\n }\n }\n \n // !****!Create the starting population of cells, all as generation 0!****!\n for (int counter = 0; counter < required_population_size; counter++)\n {\n int cell_id = counter;\n population.add(new Cell(cell_id, cell_generation, last_div, CAN_DIVIDE, diploid_genome)); // Create a new Cell object with the following values.\n id_of_last_created_cell = cell_id; // Track the id of the last created cell\n }// for\n newest_generation++;\n return population;\n }", "@Override\n\tpublic void setStartPopulation(List<BitString> seedPopulation) {\n\t\t\n\t}", "public static void crossover(Individual[] parent) {\n Individual[] children = new Individual[POP_SIZE];\n for (int i = 0; i < POP_SIZE; i += 2) {\n Individual child1 = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n child1.generateRulebase();\n Individual child2 = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n child2.generateRulebase();\n\n int crossOverPoint = new Random().nextInt(GENE_SIZE);\n for (int j = 0; j < crossOverPoint; j++) {\n child1.gene[j] = parent[i].gene[j];\n child2.gene[j] = parent[i + 1].gene[j];\n }\n\n for (int j = crossOverPoint; j < GENE_SIZE; j++) {\n child1.gene[j] = parent[i + 1].gene[j];\n child2.gene[j] = parent[i].gene[j];\n }\n\n child1.generateRulebase();\n child2.generateRulebase();\n children[i] = new Individual(child1);\n children[i + 1] = new Individual(child2);\n }\n\n matingPool = Arrays.copyOf(children, parent.length);\n }", "public int mutateGene(int gene);", "public ArrayList<Population> InitializePopulations (int NumberOfPopulations, int NumberOfAgents){\n \n ArrayList<Population> PopulationsList = new ArrayList();\n \n if(NumberOfPopulations == 1){\n \n PopulationsList.add(InitSinglePopulation(NumberOfAgents));\n \n }else{\n \n for(int i = 0; i < NumberOfPopulations; i++){ \n double temp = rand.nextDouble();\n PopulationsList.add(InitSinglePopulation(i, NumberOfAgents, temp));\n }\n \n }\n \n \n return PopulationsList;\n }", "public static void tournamentSelect(Individual[] individulas) {\n int length = individulas.length;\n int p1, p2;\n Individual[] array = setupArray(length, NUM_RULES, GENE_SIZE, COND_LEN);\n for (int i = 0; i < individulas.length; i++) {\n p1 = new Random().nextInt(length);\n p2 = new Random().nextInt(length);\n\n if (individulas[p1].getFitness() >= individulas[p2].getFitness()) {\n array[i] = new Individual(individulas[p1]);\n } else {\n array[i] = new Individual(individulas[p2]);\n }\n }\n\n matingPool = Arrays.copyOf(array, length);\n }", "private Vector step(){\n// System.out.println();\n// System.out.println(generationCount);\n// System.out.println(\"The Population is:\");\n// System.out.println(population);\n \n //DETERMINE WHO SURVIVES INTO NEXT GENERATION\n Vector nextGeneration = surviveType.run(population, fitnessArray);\n\n //DO THE CROSSOVER PROCESS\n //WHILE THE NEXT GENERATION ISN'T FULL\n while (nextGeneration.size() < (populationSize - randGenes)){\n //FIND PARENTS\n Gene parentOne, parentTwo;\n do {\n Gene[] parents = selectType.run(population, fitnessArray);\n parentOne = parents[0];\n parentTwo = parents[1];\n } while (selectPairs && (! closeEnough(parentOne, parentTwo)));\n //ADD CHILDREN\n Gene[] kids = crossType.children(parentOne, parentTwo);\n\n nextGeneration.add(kids[0]);\n if (nextGeneration.size() < (populationSize - randGenes)){\n nextGeneration.add(kids[1]);\n }\n }\n //ADD RANDOM GENES TO THE POPULATION\n while (nextGeneration.size() < populationSize){\n nextGeneration.add(initializer.createRandomGene(fitnessFunction, minRadius, maxRadius));\n }\n //MUTATE THE NEXT GENERATION\n for (int j = 0; j < populationSize; j++){\n if (Math.random() < mutationProb){\n nextGeneration.set(j, mutationType.run((Gene) nextGeneration.get(j)));\n }\n }\n\n //COMPUTE FITNESSES AND RELOCATE IF NECESSARY\n Gene bestGene = (Gene) nextGeneration.get(0);\n int bestX = 0;\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n while (relocationType.move(bannedList, next)){\n Gene newGene = initializer.createRandomGene(fitnessFunction, minRadius, maxRadius);\n next = newGene;\n nextGeneration.set(x, next);\n }\n fitnessArray[x] = next.getFitness();\n\n //FOR THE PURPOSES OF UPDATING THE BANNED LIST\n if (next.getFitness() > bestGene.getFitness()){\n bestGene = next;\n bestX = x;\n }\n } //End for (int x = 0;...\n\n Arrays.sort(fitnessArray);\n\n //UPDATE THE BANNED LIST BY ADDING THE BEST GENE IN THE NEXT GENERATION IF IT'S ABOVE minAccepted AND CONTAINS MORE THAN minPoints POINTS\n if (useList){\n if ((generationCount >= firstAdd) &&\n (solutionCounter >= countNum) &&\n (bestGene.getFitness() >= minAccepted) &&\n (bestGene.getCount() >= minPoints)){\n solutionCounter = 0;\n// System.out.println(bestGene);\n Gene bestClone = new Gene (bestGene.getMajorAxisRadius(), //THIS KLUDGE IS DONE B/C .clone() IS\n bestGene.getMinorAxisRadius(), //PROTECTED, AND I CAN'T UNPROTECT IT.\n bestGene.getX(), //I USE A CLONED GENE TO PREVENT A MUTATION\n bestGene.getY(), //IN THE NEXT GENERATION FROM ALTERING bannedList\n bestGene.getOrientation(),\n bestGene.getFunction());\n bannedList = relocationType.updateBannedList(bannedList, bestClone);\n\n\n //IF NECESSARY, UPDATE THE SOLUTION LIST BY ADDING ALL CLUSTERS WITH MORE THAN minPoints POINTS AND A FITNESS OF AT LEAST minAccepted\n if (returnAllSolutions){\n for (int i = 0; i < populationSize; i++){\n Gene next = (Gene) nextGeneration.get(i);\n if ((next.getFitness() >= minAccepted) && (next.getCount() >= minPoints)){\n solutionList.add(next);\n }\n }//End for (int i = 0...\n } else {\n solutionList = bannedList;\n } //End if (returnAllSolutions){...}else{\n } //End if (generationCount > 4...\n } //End if (useList){\n\n generationCount = generationCount + 1;\n solutionCounter = solutionCounter + 1;\n\n //IF AVOIDING CONVERGENCE, AND IT HAS CONVERGED, START OVER WITH RANDOM GENES\n\n double bestFitness = bestGene.getFitness();\n double medianFitness = roundToHundredths((double) fitnessArray[(int) Math.floor(populationSize / 2)]);\n\n// System.out.println(bestFitness);\n// System.out.println(medianFitness);\n\n if ((antiConvergence) &&\n ((bestFitness - medianFitness) < (0.01 * bestFitness)) &&\n (generationCount > firstAdd)){\n nextGeneration = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n// System.out.println(\"EXPLODED CONVERGENCE!\");\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n fitnessArray[x] = next.getFitness();\n }\n Arrays.sort(fitnessArray);\n }\n\n return nextGeneration;\n }", "public void sell_all() {\n\t\tfor(int i = 0; i<identifiedArray.length;i++) {\n\t\t\tif(identifiedArray[i]!=null) {\n\t\t\t\tsell(i);\n\t\t\t}\n\t\t}\n\t}", "public static void test(Person s, int x, int[] arr) {\r\n\t\t\r\n\t\ts.setFirstName(\"geoff\");\r\n\t\tx = 5;\r\n\t\tarr = new int[3]; \r\n\t\tarr[0] = 1;\r\n\t\tarr[1] = 2;\r\n\t\tarr[2] = 3;\r\n\t}", "protected void onChange_InitPopulation() {\n onChange_InitPopulation_xjal( InitPopulation );\n }", "private List<Individual> createBadIndividuals(int generationSize) {\n\t\tIndividualFactory factory = new ArcherFactory();\n\t\tList<Individual> list = new ArrayList<Individual>();\n\t\tfor (int i = 0; i < generationSize; i++) {\n\t\t\tlist.add(factory.createIndividual(getBadCombination()));\n\t\t}\n\t\treturn list;\n\t}", "public void parsePopulation(ArrayList<Entity> players){\n for (int i = 0; i < players.size(); i++) {\n players.get(i).getComponent(PlayerComponent.class).setStudent(students.get(i));\n students.get(i).setPlayer(players.get(i));\n students.get(i).setIdNum(i);\n }\n }", "public int produce(int min, int max, int start, int subpopulation, Individual[] inds, ec.EvolutionState state, int thread)\n/* */ {\n/* 27 */ int n = this.sources[0].produce(min, max, start, subpopulation, inds, state, thread);\n/* */ \n/* */ \n/* */ \n/* 31 */ if (!state.random[thread].nextBoolean(this.likelihood)) {\n/* 32 */ return reproduce(n, start, subpopulation, inds, state, thread, false);\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* 38 */ if (!(this.sources[0] instanceof ec.BreedingPipeline)) {\n/* 39 */ for (int q = start; q < n + start; q++) {\n/* 40 */ inds[q] = ((Individual)inds[q].clone());\n/* */ }\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 48 */ if (!(inds[start] instanceof TestCaseCandidate))\n/* 49 */ state.output.fatal(\"OurMutatorPipeline didn't get an Chromosome.The offending individual is in subpopulation \" + \n/* 50 */ subpopulation + \" and it's:\" + inds[start]);\n/* 51 */ ChromosomeSpecies species = (ChromosomeSpecies)inds[start].species;\n/* */ \n/* */ \n/* */ \n/* 55 */ for (int q = start; q < n + start; q++)\n/* */ {\n/* 57 */ TestCaseCandidate i = (TestCaseCandidate)inds[q];\n/* 58 */ double mutp = 1.0D / i.getGenes().size();\n/* */ \n/* 60 */ double[] propa = new double[i.getGenes().size()];\n/* 61 */ for (int x = 0; x < i.getGenes().size(); x++)\n/* 62 */ propa[x] = mutp;\n/* 63 */ for (int x = 0; x < i.getGenes().size(); x++) {\n/* 64 */ if (state.random[thread].nextBoolean(propa[x]))\n/* */ {\n/* */ \n/* 67 */ ((csbst.generators.AbsractGenerator)i.getGenes().get(x)).mutate();\n/* */ }\n/* */ }\n/* */ \n/* 71 */ i.evaluated = false;\n/* */ }\n/* */ \n/* 74 */ return n;\n/* */ }", "public int getPopulation() {\n return population;\n }", "@Override\n public void migrate(OccupiedLocations ols) {\n for (Population pop:ols.copyList()) {\n setCoordinate(pop.getCoordinate());\n\n Population migrating_pop = pop.collectMigrants(getRate());\n if (migrating_pop.getSize() > 0) {\n migrating_pop.setCoordinate(getPicker().pick());\n migrating_pop.setResource(0.0);\n\n // alter *actual* populations\n ols.addOrMix(migrating_pop);\n }\n }\n }", "public static int [] population() {\n \n // Declare int array containing plants, sheep, wolves population, and number of turns respectively\n int [] numCounter = new int [] {0, 0, 0, 0};\n \n // Check map for species\n for (int y = 0; y < map[0].length; y++) {\n for (int x = 0; x < map.length; x++) {\n \n // Find the number of plants and add one to the count each time a plant is found\n if (map[y][x] instanceof Plant) {\n numCounter[0] += 1;\n \n // Find the number of sheep and add one to the count each time a sheep is found\n } else if (map[y][x] instanceof Sheep) {\n numCounter[1] += 1;\n \n // Find the number of wolves and add one to the count each time a wolf is found\n } else if (map[y][x] instanceof Wolf) {\n numCounter[2] += 1;\n }\n \n }\n }\n \n // Add a turn\n numCounter[3] += 1;\n \n // Return the int array with population of each species\n return numCounter;\n \n }" ]
[ "0.67229044", "0.6248145", "0.5905208", "0.5889598", "0.58775777", "0.5854645", "0.58531517", "0.57672745", "0.57405597", "0.5691604", "0.56440836", "0.56304306", "0.55587363", "0.5546325", "0.55397624", "0.5538765", "0.5525868", "0.5522139", "0.5509016", "0.5506633", "0.55006343", "0.54991674", "0.54888356", "0.5487584", "0.5425949", "0.5421795", "0.5404157", "0.5389349", "0.53844744", "0.5375631", "0.53506535", "0.5350476", "0.5333992", "0.53310204", "0.5328672", "0.5314097", "0.5271792", "0.52642214", "0.52535844", "0.5239247", "0.5228877", "0.5217648", "0.5198889", "0.51755714", "0.51540416", "0.51400226", "0.5124406", "0.5124388", "0.51243585", "0.5117957", "0.51121974", "0.5109853", "0.5109769", "0.51067615", "0.5094245", "0.5090313", "0.5081967", "0.5074239", "0.5069612", "0.5065354", "0.50571305", "0.5054344", "0.505409", "0.50511", "0.5039245", "0.5037521", "0.5033581", "0.5026194", "0.5007871", "0.49994314", "0.49864992", "0.49770397", "0.49725854", "0.49594027", "0.4957975", "0.49567905", "0.4947754", "0.49388736", "0.49335888", "0.4927611", "0.49270067", "0.49215987", "0.49199745", "0.4919118", "0.49182206", "0.4899343", "0.4895205", "0.48941702", "0.4887295", "0.4884207", "0.48839256", "0.48750004", "0.48657465", "0.48616752", "0.48588476", "0.4851571", "0.48487502", "0.48440439", "0.48385942", "0.48370484" ]
0.67893356
0
Prints a given individual to designated file.
public void printToFile(AI input) { try { // Create file FileWriter fstream = new FileWriter(FILENAME); BufferedWriter out = new BufferedWriter(fstream); out.write(input.toString() + "\n"); // Close the output stream out.close(); } catch (Exception e) { // Catch exception if any System.err.println("Error: " + e.getMessage()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void printToFile() {\n\t\t\n\t}", "public void print() {\n\t\tSystem.out.println(\"ONOMA IDIOKTITH: \" + fname);\n\t\tSystem.out.println(\"EPWNYMO IDIOKTITH: \" + lname);\n\t\tSystem.out.println(\"DIEUTHINSH FARMAKEIOU: \" + address);\n\t\tSystem.out.println(\"THLEFWNO FARMAKEIOU: \" + telephone);\n\t\tSystem.out.println();\n\t}", "public void printPopulationToFile(int i) throws IOException {\n\t\tFileWriter fstream;\n\t\tBufferedWriter out;\n\n\t\tFile f = new File(FILENAME);\n\t\tif (!f.isFile()) {\n\t\t\ttry { // Create file\n\t\t\t\tfstream = new FileWriter(FILENAME);\n\t\t\t\tout = new BufferedWriter(fstream);\n\t\t\t\tout.write(\"Generation: \" + i + \"\\r\\n\");\n\n\t\t\t\tfor (AI ai : this.individuals) {\n\t\t\t\t\tout.write(ai.toString() + \"\\r\\n\");\n\t\t\t\t}\n\t\t\t\t// Close the output stream\n\t\t\t\tout.close();\n\t\t\t} catch (Exception e) { // Catch exception if any\n\t\t\t\tSystem.err.println(\"Error: \" + e.getMessage());\n\t\t\t}\n\t\t} else {\n\t\t\ttry { // append to file if file already exists\n\t\t\t\tfstream = new FileWriter(FILENAME, true);\n\t\t\t\tout = new BufferedWriter(fstream);\n\t\t\t\tout.write(\"Generation: \" + i + \"\\r\\n\");\n\t\t\t\tfor (AI ai : this.individuals) {\n\t\t\t\t\tout.write(ai.toString() + \"\\r\\n\");\n\t\t\t\t}\n\t\t\t\tout.close();\n\t\t\t} catch (Exception e) {\n\t\t\t\tSystem.err.println(\"Error: \" + e.getMessage());\n\t\t\t}\n\t\t}\n\t}", "public void recordOrder(){\n PrintWriter output = null;\n try{\n output = \n new PrintWriter(new FileOutputStream(\"record.txt\", true));\n }\n catch(Exception e){//throws exception\n System.out.println(\"File not found\");\n System.exit(0);\n }\n output.println(Coffee);//prints in file contents of Coffee\n output.close();//closes file\n }", "public void print() {\n System.out.println(\"Person of name \" + name);\n }", "abstract void print(String fileName);", "public void recordOrder(){ \n PrintWriter output = null;\n try{\n output = \n new PrintWriter(new FileOutputStream(\"record.txt\", true));\n }\n catch(Exception e){\n System.out.println(\"File not found\");\n System.exit(0);\n }\n output.println(Tea);//writes into the file contents of String Tea\n output.close();//closes file\n }", "void print(String fileName)\n\t{\n\t\t//Get the reference of the head of the Linked list\n\t\tNode ref = head;\n\t\t\n\t\t//Print the elements and also write them into a file if the head is initialized\n\t\tif(ref != null)\n\t\t{\n\t\t\ttry \n\t\t\t{\n\t\t\t\t//Create a file output.txt\n\t\t\t\tPrintWriter writer = new PrintWriter(fileName);\n\t\t\t\t\n\t\t\t\t//Traverse till the end of the Linked List \n\t\t\t\twhile(ref != null)\n\t\t\t\t{\n\t\t\t\t\tref = ref.next;\n\t\t\t\t\tif(ref != null)\n\t\t\t\t\t{\n\t\t\t\t\t\t//Print the elements and also write them into a file\n\t\t\t\t\t\tSystem.out.print(ref.value + \" \");\n\t\t\t\t\t\twriter.print(ref.value + \" \");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Close the file\n\t\t\t\twriter.close();\n\t\t\t} \n\t\t\tcatch (FileNotFoundException e) \n\t\t\t{\n\t\t\t\t//Printing the Stack Trace if an exception has occurred\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}", "public static void main(String[] args) throws java.io.IOException {\n\t\tPrintWriter pw = new PrintWriter (new FileWriter(\"writefile\"));\r\n\t\tSystem.out.print(\"Please enter Phone Number: \");\r\n\t\tphoneNumber=input.next();\r\n\t\tSystem.out.print(\"Please enter Contact Name: \");\r\n\t\tcontactName=input.next();\r\n\t\tSystem.out.println(\"Name: \" + contactName + \"\\tNumber: \" + phoneNumber);\r\n\t\tSystem.out.println(\"Starting printing to text file...\");\r\n\t\tpw.println(\"Name: \" + contactName + \" <Number: \" + phoneNumber);\r\n\t\tpw.close();\r\n\t\t\r\n\r\n\t}", "public void print() {\n\t\tSystem.out.println(name + \" -- \" + rating + \" -- \" + phoneNumber);\n\t}", "public void print ()\n\t{\n\t\tSystem.out.println(\"Polyhedron File Name: \" + FileName);\n\t\tSystem.out.println(\"Object active: \" + Boolean.toString(isActive()));\n\t\tprintCoordinates();\n\t}", "public static void fileBanner(PrintWriter fout){\n \tfout.println(\"*******************************************\");\n \tfout.println(\"Name:\t\tsveinson\");\n \tfout.println(\"Class:\t\tCS20S\");\n \tfout.println(\"Assignment:\tAx Qy\");\n \tfout.println(\"*******************************************\"); \n }", "public void print() {\n System.out.println(\"Nome: \" + nome);\n System.out.println(\"Telefone: \" + telefone);\n }", "public void print() {\r\n\t\tSystem.out.print(getUID());\r\n\t\tSystem.out.print(getTITLE());\r\n\t\tSystem.out.print(getNOOFCOPIES());\r\n\t}", "public static void printOut(Talkable p) {\n System.out.println(p.getName() + \" says=\" + p.talk());\n outFile.fileWrite(p.getName() + \"|\" + p.talk());\n }", "@Override\n\n\t\t\t\tpublic void actionPerformed(ActionEvent e) {\n\n\t\t\t\t\tint id = Integer.parseInt((String) pidDropDown.getSelectedItem());\n\n\t\t\t\t\t// go through the Player array list,\n\n\t\t\t\t\t// print the details of the selected Player to a file.\n\t\t\t\t\tfor (Patient p : plist) {\n\n\t\t\t\t\t\tif (id == p.id) {\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tPrintWriter fw = new PrintWriter(\"patient.txt\");\n\t\t\t\t\t\t\t\tfw.write(p.toString());\n\n\t\t\t\t\t\t\t\tfw.close();\n\t\t\t\t\t\t\t} catch (Exception ec) {\n\n\t\t\t\t\t\t\t\tSystem.out.println(\" \" + ec);\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}", "public static void outputRecord() {\r\n System.out.println(\"First Name: Len\");\r\n System.out.println(\"Last Name: Payne\");\r\n System.out.println(\"College: Lambton College\");\r\n }", "public void printFile() {\n\t\t\n\t\tfor(String[] line_i: linesArray) {\n\t\t\tSystem.out.println( Arrays.toString(line_i) );\n\t\t}\n\t}", "public void printToFile(Path filename) {\n\t\t\n\t\tlock.lockRead();\n\t\ttry{\n//\t\t\t create a new file if it is not existed; \n//\t\t\t otherwise delete previous one and create a new one.\n\t\t\tif(!Files.exists(filename)){\n\t\t\t\ttry {\n\t\t\t\t\tFiles.createFile(filename);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttry {\n\t\t\t\t\tFiles.delete(filename);\n\t\t\t\t\tFiles.createFile(filename);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(String hotelId : hotelMap.keySet()){\n\t\t\t\tString output = this.toString(hotelId);\n\t\t\t\t\t\t\t\n\t\t\t\t// start of the hotel.\n\t\t\t\tString emptyLine = \"\\n\";\n\t\t\t\tString ast = \"********************\";\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\tFiles.write(filename, emptyLine.getBytes(), StandardOpenOption.APPEND);\n\t\t\t\t\tFiles.write(filename, ast.getBytes(), StandardOpenOption.APPEND);\n\t\t\t\t\tFiles.write(filename, emptyLine.getBytes(), StandardOpenOption.APPEND);\n\t\t\t\t} catch (IOException e1) {\n\t\t\t\t\te1.printStackTrace();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttry{\n\t\t\t\t\tFiles.write(filename, output.getBytes(), StandardOpenOption.APPEND);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinally{\n\t\t\tlock.unlockRead();\n\t\t}\n\t\t\t\n\t}", "public void printDetails()\n {\n System.out.println(\"Name: \" + foreName + \" \"\n + lastName + \"\\nEmail: \" + emailAddress);\n }", "public static void printRecord(int i) {\r\n\t\ttry {\r\n\t\t\tStudent tempRecord = studRecs.get(i);\r\n\t\t\tSystem.out.println(\"Printing information for student \" + i);\r\n\t\t\tSystem.out.println(\"Student ID: \" + tempRecord.getStudentID());\r\n\t\t\tSystem.out.println(\"First Name: \" + tempRecord.getFirstName());\r\n\t\t\tSystem.out.println(\"Last Name: \" + tempRecord.getLastName());\r\n\t\t\tSystem.out.println(\"Street Address: \" + tempRecord.getStreetAddress());\r\n\t\t\tSystem.out.println(\"City: \" + tempRecord.getCity());\r\n\t\t\tSystem.out.println(\"Province: \" + tempRecord.getProvince());\r\n\t\t\tSystem.out.println(\"Postal Code: \" + tempRecord.getPostalCode());\r\n\t\t\tSystem.out.println(\"Phone Number: \" + tempRecord.getPhoneNumber());\r\n\t\t\tSystem.out.println(\"Birth Date: \" + tempRecord.getBirthDate());\r\n\t\t} catch (IndexOutOfBoundsException e) {\r\n\t\t\tSystem.out.println(\"Invalid student!\");\r\n\t\t}\r\n\t}", "public void writeToFile(PrintWriter ofile1)\n {\n if(ofile1 != null)\n {\n ofile1.println(this.plainDataToString());\n }\n \n return;\n \n }", "@Override\r\n public void display(PrintWriter out) {\r\n if (this.nrBasic > 0) {\r\n out.println(\"Basic\");\r\n } else {\r\n super.display(out);\r\n }\r\n }", "public void writeOut(PrintWriter pw){}", "void print(String fileName)\n\t{\n\t\t//Print the elements and also write them into a file if the array is initialized\n\t\tif(inputArray != null)\n\t\t{\n\t\t\ttry \n\t\t\t{\n\t\t\t\t//Create a file output.txt\n\t\t\t\tPrintWriter writer = new PrintWriter(fileName);\n\t\t\t\tfor(int i=0; i < inputArray.length; i++)\n\t\t\t\t{\n\t\t\t\t\t//Print the elements and also write them into a file\n\t\t\t\t\tSystem.out.print(inputArray[i] + \" \");\n\t\t\t\t\twriter.print(inputArray[i] + \" \");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Close the file\n\t\t\t\twriter.close();\n\t\t\t} \n\t\t\tcatch (FileNotFoundException e) \n\t\t\t{\n\t\t\t\t//Printing the Stack Trace if an exception has occurred\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}", "private void bookPrinter(String name, String book) throws IOException\n {\n try\n {\n PrintWriter p = new PrintWriter (new BufferedWriter (new FileWriter (\"LibraryCards\\\\\"+name+\".txt\", true)));\n p.println(book.trim());\n p.println(DoDate.display()); //Prints the date to the Library Card\n\n p.close();\n }\n catch (Exception e)\n {\n System.out.println(\"Sorry. There was an error in registering your book.\");\n }\n }", "public void print()\n {\n System.out.println(name + \"\\n\");\n for(int iterator = 0; iterator < bookList.size() ; iterator++)\n {\n System.out.println((iterator+1) +\". \" + bookList.get(iterator).getTitle()+\" by \" +bookList.get(iterator).getAuthor()); \n }\n }", "public void outputToStream(PrintWriter dos) throws IOException {\n dos.println(fileName);\n if (lineNos != null) {\n dos.println(lineNos.length);\n for (int i = 0; i < lineNos.length; ++i) {\n dos.println(lineNos[i]);\n }\n }\n }", "public static void printFancyTitle() {\n System.out.println();\n System.out.println( \"Hello, Program 04\");\n Scanner scanner;\n try {\n File f = new File( \"fancy_title.txt\");\n scanner = new Scanner( f);\n } catch( Exception exc) {\n return;\n }\n\n System.out.println( \"by\");\n String s;\n while( scanner.hasNextLine()) {\n s = scanner.nextLine();\n System.out.println( s);\n }\n scanner.close();\n System.out.println();\n }", "public void writeFile()\n\t{\n\t\t//Printwriter object\n\t\tPrintWriter writer = FileUtils.openToWrite(\"TobaccoUse.txt\");\n\t\twriter.print(\"Year, State, Abbreviation, Percentage of Tobacco Use\\n\");\n\t\tfor(int i = 0; i < tobacco.size(); i++)\n\t\t{\n\t\t\tStateTobacco state = tobacco.get(i);\n\t\t\tString name = state.getState();\n\t\t\tString abbr = state.getAbbreviation();\n\t\t\tdouble percent = state.getPercentUse();\n\t\t\tint year = state.getYear();\n\t\t\twriter.print(\"\"+ year + \", \" + name + \", \" + abbr + \", \" + percent + \"\\n\");\n\t\t} \n\t\twriter.close(); //closes printwriter object\n\t}", "public void printDataToFile(){\n\ttry {\n\t File file = new File(\"media/gameOutput.txt\");\n \n\t // if file doesnt exists, then create it\n\t if (!file.exists()) {\n\t\tfile.createNewFile();\n\t }\n \n\t FileWriter fw = new FileWriter(file.getAbsoluteFile());\n\t BufferedWriter bw = new BufferedWriter(fw);\n\t bw.write(printString);\n\t bw.close();\n\t} catch (IOException e) {\n\t e.printStackTrace();\n\t}\n }", "public void printDetailedPlayer(Player player);", "public void printInformation() {\n\n System.out.println(\"Name: \" + name);\n System.out.println(\"Weight: \" + weight);\n System.out.println(\"Shape: \" + shape);\n System.out.println(\"Color: \" + color);\n }", "public void print()\r\n {\n if (getOccupants().length != 0)\r\n {\r\n \t// will use the print method in the person class\r\n getOccupants()[0].print();\r\n }\r\n else if (this.explored)\r\n {\r\n System.out.print(\"[ H ]\");\r\n }\r\n else\r\n {\r\n System.out.print(\"[ ]\");\r\n }\r\n\r\n }", "public static void fileWriterPrinter(String fileName, Object printLine) throws NumberFormatException, IOException {\n // Create File:\n\t\t\t\tFile f = new File(Common.testOutputFileDir + fileName);\t\t\t\t \n\t\t\t // Write or add a String line into File:\t\n\t\t\t FileWriter fw = new FileWriter(f,true);\n\t\t\t PrintWriter pw = new PrintWriter(fw);\n\t\t\t pw.println(printLine);\n\t\t\t pw.close();\n\t\t\t // System Out Print Line:\n\t\t\t fileWriterPrinter(printLine);\n\t\t\t}", "public void print()\n {\n System.out.println();\n System.out.println(\"Ticket to \" + destination +\n \" Price : \" + price + \" pence \" + \n \" Issued \" + issueDateTime);\n System.out.println();\n }", "public static void main(String[] args) throws IOException {\n PrintWriter outputFile = new PrintWriter(\"ResultFile.txt\");\n\n outputFile.println(\"Line 1\");\n outputFile.println(\"Line 2\");\n outputFile.println(\"Line 3\");\n outputFile.println(\"Line 4\");\n\n\n outputFile.close();\n\n }", "public static void printData(IOService fileIO) {\n if (fileIO.equals(IOService.FILE_IO)) {\n new EmployeePayrollFileIOService().printDataFromFile();\n }\n }", "static void printAndWrite(String s, FileWriter fw) {\r\n\t\tSystem.out.print(s);\r\n\t\ttry {\r\n\t\t\tfw.write(s);\r\n\t\t\tfw.flush();\r\n\t\t}\r\n\t\tcatch (Exception e) {\r\n\t\t\tSystem.out.println(\"An error occurred.\");\r\n\t\t\tSystem.exit(-1);\r\n\t\t}\r\n\t}", "public void print() {\r\n System.out.print( getPlayer1Id() + \", \" );\r\n System.out.print( getPlayer2Id() + \", \");\r\n System.out.print(getDateYear() + \"-\" + getDateMonth() + \"-\" + getDateDay() + \", \");\r\n System.out.print( getTournament() + \", \");\r\n System.out.print(score + \", \");\r\n System.out.print(\"Winner: \" + winner);\r\n System.out.println();\r\n }", "void printFile(String path) {\n try {\n String[] readFileOutPut = readFile(path);\n for (int i = 0; i < readFileOutPut.length;i++) System.out.println(readFileOutPut[i]);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public static void printFileName(String filename) {\n System.out.println(\"\\n\" + filename + \":\");\n }", "public void printer() throws Exception{\n File outputFile = new File(\"output.txt\");\n FileOutputStream is = new FileOutputStream(outputFile);\n OutputStreamWriter osw = new OutputStreamWriter(is);\n Writer w = new BufferedWriter(osw);\n w.write(this.result());\n w.close();\n }", "private static void outputResult(Person curPerson, String outputFile) throws FileNotFoundException {\n\t\tArrayList<String> route = new ArrayList<String>();\n\t\tPrintWriter out = new PrintWriter(outputFile);\n\t\t//store the names of the persons on the route in reverse order \n\t\twhile(!curPerson.getName().equals(\"Alice\")) {\n\t\t\troute.add(curPerson.getName());\n\t\t\tcurPerson = curPerson.getRoute();\n\t\t}\n\t\tout.print(curPerson.getName() + \"-\");\n\t\t\n\t\tfor(int i = route.size() - 1; i > 0; i--) {\n\t\t\tout.print(route.get(i) + \"-\");\n\t\t}\n\t\tout.print(route.get(0));\n\t\t\n\t\tout.close();\n\t}", "public void writePlayerFile(String fileName)\r\n\t{\r\n\t\tPrintWriter fileWrite;\r\n\t\ttry\r\n\t\t{\r\n\t\t\tfileWrite = new PrintWriter(new FileOutputStream(fileName));\r\n\t\t\tfileWrite.println(\"Name \" + name);\r\n\t\t\tfileWrite.println(\"HP \" + hp);\r\n\t\t\tfileWrite.println(\"Strength \" + strength);\r\n\t\t\tfileWrite.println(\"Speed \" + speed);\r\n\t\t\tfileWrite.println(\"Weapon \" + weapon);\r\n\t\t\tfileWrite.close();\r\n\t\t}\r\n\t\tcatch(IOException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(e.getMessage());\r\n\t\t}\r\n\t}", "public void exportTo(PrintWriter pw, Animator animator) {\n // 1. write out the info contained in the ancestor\n // note: this ends without a space\n super.exportTo(pw, animator);\n Put put = (Put) animator;\n\n // 2. write out the new cell content\n pw.print(\" entering \\\"\");\n pw.print(PTText.escapeText(put.getContent()));\n\n // 3. write out the cell number\n pw.print(\"\\\" into cell \");\n pw.print(put.getCell());\n\n // 5. write out the used IDs\n int[] IDs = put.exportIDs();\n pw.print(\" using IDs \");\n pw.print(IDs[0]);\n pw.print(\" \");\n pw.println(IDs[1]);\n }", "private void printCustomer(PrintStream ps){\n// ps.println(\"ID, FirstName, Last Name, Number of bank account\");\n for(Customer customer: customers){\n ps.println(customer.getId()+ \", \" + customer.getFirstName() + \" \" + customer.getLastName());\n for(String accountNumber: customer.getAccountNumbers()){\n ps.println(\"\\t\" + customer.getAccount(accountNumber));\n }\n }\n }", "public void save(PrintWriter pw) {\n\t\tpw.println(color);\n\t\tpw.println(name);\n\t\tpw.println(diceValue);\n\t\tpw.println(diceTossed);\n\t\tfor(int i = 1; i<=4; i++)\n\t\t\tif(hasPawn(i))\n\t\t\t\tpw.println(pawns[i-1].getPosition());\n\t\t\telse\n\t\t\t\tpw.println(0);\n\t}", "private void printFile(Products print, String ufilename) {\n\t\tFile file = new File(\"output\"+File.separator+ufilename+fileId+\".xml\"); \n\t\tSystem.out.println(\"Exporting : \"+ file);\n\t\tJAXBContext jaxbContext;\n\t\ttry {\n\t\t\tjaxbContext = JAXBContext.newInstance(Products.class); \n\t\t\tMarshaller jaxbMarshaller = jaxbContext.createMarshaller();\n\t\t\tjaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);\n\t\t\tjaxbMarshaller.setProperty(\"com.sun.xml.internal.bind.xmlHeaders\", \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\n\t\t\tjaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);\n\t\t\tjaxbMarshaller.marshal(print, file); // prints the file\n\t\t\t// \t\t jaxbMarshaller.marshal(products, System.out);\n\t\t} catch (JAXBException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void print(String toBeWritten)\n\t\t{ pw.print(getIndentString() + toBeWritten); }", "@Override\n\tpublic void print() {\n\t\tSystem.out.print(\"\\nMSc. student:\\n\");\n\t\tsuper.print();\n\t}", "void printToFile() throws IOException {\n\t\tBufferedWriter writer = new BufferedWriter( new FileWriter(\"Provider_Directory.txt\") );\n\t\twriter.write(\"PROVIDER DIRECTORY:\");\n\t\tfor (int i = 0; i < services.size(); i++) {\n\t\t\tString service = services.get(i).getServiceName() + \" (\" + services.get(i).getServiceNumber() + \") for $\" + services.get(i).getServiceFee();\n\t\t\twriter.write(\"\\t\");\n\t\t\twriter.write(service);\n\t\t}\n\t\twriter.close();\n\t}", "public void dump(PrintWriter pw) {\n dump(pw, true);\n }", "public void printAuthor()\n {\n System.out.println(\"by: \" + author);\n }", "public void printData() {\n\t\ttry {\n\t\t\tFiles.lines(new File(PAYROLL_FILE_NAME).toPath())\n\t\t\t.forEach(System.out::println); \n\t\t}catch(IOException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void writeToFile(RandomAccessFile fio) {\n try {\n fio.writeInt(number);\n fio.writeUTF(name);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "void display() {\r\n\t\tSystem.out.println(id + \" \" + name);\r\n\t}", "public static void fileWriterPrinter(String path, String fileName, Object printLine) throws NumberFormatException, IOException {\n // Create File:\n\t\t\t\tFile f = new File(path + fileName);\t\t \n\t\t\t // Write or add a String line into File:\t\n\t\t\t FileWriter fw = new FileWriter(f,true);\n\t\t\t PrintWriter pw = new PrintWriter(fw);\n\t\t\t pw.println(printLine);\n\t\t\t pw.close();\n\t\t\t // System Out Print Line:\n\t\t\t fileWriterPrinter(printLine);\n\t\t\t}", "public void save() {\n\t\tWriteFile data = new WriteFile( this.name + \".txt\" );\n\t\ttry {\n\t\t\t data.writeToFile(this.toString());\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tSystem.out.println(\"Couldn't print to file\");\n\t\t}\n\t}", "protected void print(Object s) throws IOException {\n out.write(Convert.escapeUnicode(s.toString()));\n }", "public void print()\n\t{\n\t\tif(gameObj[1].size() > 0)\n\t\t{\n\t\t\tSystem.out.println(\"*********************Player Info*******************************\");\n\t\t\tSystem.out.println(\"[Lives: \" + lives + \"][Score: \" + score + \n\t\t\t\t\t\t\t\"][Time: \" + gameTime + \"]\");\n\t\t\tSystem.out.println(\"*********************Player Info*******************************\");\n\t\t}else\n\t\t\tSystem.out.println(\"Spawn a player ship to view game info\");\n\t}", "void printEmployeeDetail(){\n\t\tSystem.out.println(\"First name: \" + firstName);\n\t\tSystem.out.println(\"Last name: \" + lastName);\n\t\tSystem.out.println(\"Age: \" + age);\n\t\tSystem.out.println(\"Salary: \" + salary);\n\t\tSystem.out.println(firstName + \" has \" + car.color + \" \" + car.model + \" it's VIN is \" + car.VIN + \" and it is make year is \" + car.year );\n\t\t\n\t}", "public void info() {\r\n System.out.println(\" Name: \" + name + \" Facility: \" + facility + \" Floor: \" + floor + \" Covid: \"\r\n + positive + \" Age: \" + age + \" ID: \" + id);\r\n }", "private void outputfile() {\n\n ConnectDB dbconnect = new ConnectDB();\n\n try {\n PrintWriter writer = new PrintWriter(\"memberoutput.txt\");\n\n try {\n dbconnect.pst = dbconnect.con.prepareStatement(\"select * from members\");\n dbconnect.rs = dbconnect.pst.executeQuery();\n\n while (dbconnect.rs.next()) {\n writer.println(dbconnect.rs.getString(1) + \",\"\n + dbconnect.rs.getString(2) + \",\"\n + dbconnect.rs.getString(3) + \",\"\n + dbconnect.rs.getString(4) + \",\"\n + dbconnect.rs.getString(5) + \",\"\n + dbconnect.rs.getString(6) + \",\"\n + dbconnect.rs.getString(7) + \",\"\n + dbconnect.rs.getString(8) + \",\"\n + dbconnect.rs.getString(9));\n }\n\n writer.flush();\n } catch (SQLException e) {\n // TODO Auto-generated catch block\n }\n writer.close();\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n JOptionPane.showMessageDialog(null, \"File exported\");\n }", "public void writeCustomerDetails (String firstName, String lastName, int mobile, String email, String deliveryAddressNumber, String deliveryAddress)\r\n\t{\r\n\t\ttry \r\n\t\t{\r\n\t\t\tPrintWriter out = new PrintWriter(new FileWriter(\"customersWhoPurchased.txt\", true));\r\n\t\t\tout.println(\"First Name: \" +firstName);\t\t\t\r\n\t\t\tout.println(\"Last Name: \" +lastName);\r\n\t\t\tout.println(\"Mobile number: \" +mobile);\r\n\t\t\tout.println(\"Email: \" +email);\r\n\t\t\tout.println(\"Devliery address: \" +deliveryAddressNumber+ \" \" +deliveryAddress);\r\n\t\t\tout.println(\" \");\r\n\t\t\tout.close();\r\n\t\t}\r\n\t\tcatch(FileNotFoundException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Error: Cannot open file for writing\");\r\n\t\t}\r\n\t\tcatch(IOException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Error: Cannot write to file\");\r\n\t\t}\r\n\t}", "public static void printPerson(String navn, String alder, String by){\n\t\tSystem.out.println(\"Du har registrert personen: \" + navn + \" som er \" + alder + \"aar, fra \" + by);\n\t}", "public void print(Object o) {\n\t\tsynchronized (out) {\n\t\t\tout.print(o);\n\t\t\tout.flush();\n\t\t}\n\t}", "public static void main(String[] args) {\r\n\t\tPrintWriter writer = null;\r\n\t\ttry {\r\n\t\t\twriter = new PrintWriter(\"FILE NAME.txt\", \"UTF-8\");\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (UnsupportedEncodingException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\twriter.println(\"The first line\");\r\n\t\twriter.println(\"The second line\");\r\n\t\twriter.close();\r\n\r\n\t}", "@Override\n\tpublic void print() {\n System.out.println(\"Leaf [isbn=\"+number+\", title=\"+title+\"]\");\n\t}", "public void printCard(String name, String number, String age, String grade, \n\t\t\tString country, String bio, String filepath) {\n\t\tPDFCreator p = new PDFCreator(name,number,age,grade,country,bio,filepath);\n\t}", "void dump() {\n\t\tSystem.out.print(\"I am: \" + (territoryID));\n\t\tSystem.out.print(\"\\tNeighbour of:\");\n\n\t}", "private static void writeToFileEmployees() throws IOException {\n FileWriter write = new FileWriter(path2, append);\n PrintWriter print_line = new PrintWriter(write);\n for (int i = 0; i < RegisteredEmployees.listOfEmployees.size(); i++) {\n ArrayList<Integer> list = RegisteredEmployees.getEmployeeList();\n Integer ID = list.get(i);\n textLine = String.valueOf(ID);\n print_line.printf(\"%s\" + \"%n\", textLine);\n }\n print_line.close();\n }", "public static void fileWriterPrinter() throws NumberFormatException, IOException {\n // Create File:\n\t\t\t\tFile f = new File(Common.testOutputFileDir + \"print.log\");\t\t\t\t \n\t\t\t // Write or add a String line into File:\t\n\t\t\t FileWriter fw = new FileWriter(f,true);\n\t\t\t PrintWriter pw = new PrintWriter(fw);\n\t\t\t pw.println();\n\t\t\t pw.close();\n\t\t\t // System Out Print Line:\n\t\t\t // if (printLine instanceof String) {}\n\t\t\t // if (printLine instanceof Integer) {}\n\t\t\t // if (printLine instanceof Long) {}\n\t\t\t // if (printLine instanceof Boolean) {}\n\t\t\t // if (printLine instanceof Double) {}\n\t\t\t System.out.print(\"\\n\");\t\t \n\t\t\t}", "public void print()\n {\n System.out.println(\"Course: \" + title + \" \" + codeNumber);\n \n module1.print();\n module2.print();\n module3.print();\n module4.print();\n \n System.out.println(\"Final mark: \" + finalMark + \".\");\n }", "public static void main(String[] args) throws FileNotFoundException {\n\t PrintStream o = new PrintStream(new File(\"KittenAddress.txt\"));\n\t PrintStream console = System.out;\n\t \n\t System.setOut(o);\n\t System.out.println(\"LIST OF ADDRESSES: \" + \"\\n\" + \"--------------------\");\n\t \n\t // print address list into KittenAddress.txt\n\t\tReadExcel kittenAddressList = new ReadExcel();\n\t\tkittenAddressList.printer();\n\t\tSystem.setOut(console);\n\t \n\t \n\t\n\t}", "public void print() {\n\t\tfor(String subj : subjects) {\n\t\t\tSystem.out.println(subj);\n\t\t}\n\t\tSystem.out.println(\"==========\");\n\t\t\n\t\tfor(StudentMarks ssm : studMarks) {\n\t\t\tSystem.out.println(ssm.student);\n\t\t\tfor(Byte m : ssm.marks) {\n\t\t\t\tSystem.out.print(m + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "void display() {\n System.out.println(id + \" \" + name);\n }", "public void printDetails()\n {\n super.printDetails();\n System.out.println(\"The author is \" + author + \" and the isbn is \" + isbn); \n }", "void display()\n\t {\n\t\t System.out.println(\"Student ID: \"+id);\n\t\t System.out.println(\"Student Name: \"+name);\n\t\t System.out.println();\n\t }", "private static StringBuilder prettyPrintHeadlineCSV(\r\n\t\t\tCollection<DSEIndividual> individuals, StringBuilder output, List<Criterion> criterionsToSave) {\r\n\t\tif (individuals.size() > 0){\r\n\t\t\tDSEIndividual i = individuals.iterator().next();\r\n\t\t\t\r\n\t\t\toutput = printObjectives(criterionsToSave,output);\r\n\t\t\r\n\t\t\toutput = determineAndPrintConfidenceIntervalHeadline(output, i.getObjectives(), criterionsToSave);\r\n\t\t\r\n\t\t\toutput.append(Opt4JStarter.getProblem().toString());\r\n\t\t\r\n\t\t\toutput = printUtilisationHeadline(i,output);\r\n\t\t\t\r\n\t\t\toutput.append(\"Candidate ID;\");\r\n\t\t\r\n\t\t\toutput.append(\"\\n\");\r\n\t\t}\r\n\t\treturn output; \r\n\t}", "void printFleet(ConsolePrinter printer);", "public void printString() {\n\t\tSystem.out.println(name);\n\t\t\n\t\t\n\t}", "public void print() {\r\n Person tmp = saf.get(0);\r\n System.out.println(\"Person name : \" + tmp.getName() +\r\n \" Entering time : \" + tmp.getTime() +\r\n \" Waiting time : \" + tmp.getExitTime());\r\n }", "private void printInfo() {\n System.out.println(\"\\nThis program reads the file lab4.dat and \" +\n \"inserts the elements into a linked list in non descending \"\n + \"order.\\n\" + \"The contents of the linked list are then \" +\n \"displayed to the user in column form.\\n\");\n }", "public void printStudentInfo(){\r\n System.out.println(\"Name: \" + getName());\r\n System.out.println(\"Student Id: \" + getId());\r\n printMarks();\r\n System.out.println(\"\\nAverage \" + getAverage() + \"%\");\r\n printNumberOfCoursesInEachLetterGradeCategory();\r\n }", "public abstract void saveToFile(PrintWriter out);", "@Override\n\t\tpublic void print() {\n\n\t\t}", "void put(){\n System.out.print(name + \" from \" + address + \". \");\n }", "public void print();", "public void print();", "public void print();", "public void print();", "public void println(Object o) throws IOException {\n\t\tprint(o);\n\t\toutputStream.write('\\n');\n\t}", "@Override\n\tpublic void printBook(Book book) {\n\t\t\n\t\tSystem.out.println(book);\n\t\t\n\t}", "public static void println(String toPrint)\n {\n System.out.println(toPrint);\n }", "public void printCustomerDetails()\r\n {\r\n System.out.println(title + \" \" + firstName + \" \" \r\n + lastName + \"\\n\" +getAddress() \r\n + \"\\nCard Number: \" + cardNumber \r\n + \"\\nPoints available: \" + points);\r\n }", "@Override\n\tpublic void print(String tab, FileWriter fw) {\n\t\tSystem.out.println(tab + \"LiteralExpression: \" + number.toString());\n\t\ttry {\n\t\t\tfw.write(tab + \"LiteralExpression: \" + number.toString());\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void printUser() {\n\t\tSystem.out.println(\"First name: \" + this.firstname);\n\t\tSystem.out.println(\"Last name: \" + this.lastname);\n\t\tSystem.out.println(\"Age: \" + this.age);\n\t\tSystem.out.println(\"Email: \" + this.email);\n\t\tSystem.out.println(\"Gender: \" + this.gender);\n\t\tSystem.out.println(\"City: \" + this.city);\n\t\tSystem.out.println(\"State: \" + this.state + \"\\n\");\n\t}", "static void recordProcess() {\n try {\n PrintWriter output = new PrintWriter(new FileWriter(file, true));\n output.print(huLuWaList.size() + \" \");\n lock.lock();\n for (Creature creature : huLuWaList) {\n output.print(creature.getCreatureName() + \" \" + creature.getX() + \" \" + creature.getY()+\" \");\n }\n output.print(enemyList.size() + \" \");\n for (Creature creature : enemyList) {\n output.print(creature.getCreatureName() + \" \" + creature.getX() + \" \" + creature.getY()+\" \");\n }\n output.println();\n output.close();\n lock.unlock();\n }catch (Exception ex){\n System.out.println(ex);\n }\n }", "public void writeStaffEntry(String firstName, String lastName, String userName)\r\n\t{\r\n\t\ttry \r\n\t\t{\r\n\t\t\tPrintWriter out = new PrintWriter(new FileWriter(\"StaffEntryRecords.txt\", true));\r\n\t\t\tout.println(\"First Name: \" +firstName);\r\n\t\t\tout.println(\"Last Name: \" +lastName);\r\n\t\t\tout.println(\"Username: \" +userName);\r\n\t\t\tout.println(\" \");\r\n\t\t\tout.close();\r\n\t\t}\r\n\t\tcatch(FileNotFoundException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Error: Cannot open file for writing\");\r\n\t\t}\r\n\t\tcatch(IOException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Error: Cannot write to file\");\r\n\t\t}\r\n\t}" ]
[ "0.6240942", "0.6217596", "0.6150162", "0.61186254", "0.60831606", "0.59919333", "0.5918538", "0.58806294", "0.5880196", "0.5867689", "0.5865128", "0.58497703", "0.5806006", "0.5778152", "0.5768145", "0.5766208", "0.57214826", "0.57019055", "0.5685769", "0.56767124", "0.5652724", "0.5649575", "0.5646153", "0.56319577", "0.56168526", "0.55514723", "0.55377907", "0.5533717", "0.5532098", "0.55096334", "0.54910994", "0.54744047", "0.54578793", "0.54543245", "0.5451183", "0.54465705", "0.5446337", "0.54377824", "0.5437019", "0.5434069", "0.54327136", "0.542804", "0.54217094", "0.54195887", "0.5407059", "0.54046196", "0.54034305", "0.53991", "0.53928155", "0.53927624", "0.5386488", "0.5379805", "0.5375482", "0.53732574", "0.5364016", "0.53627473", "0.5348863", "0.53483087", "0.5348176", "0.53449225", "0.5338642", "0.533778", "0.5337485", "0.5332068", "0.53281325", "0.53235835", "0.53213793", "0.5314201", "0.531398", "0.5311288", "0.5299747", "0.5297794", "0.52970415", "0.5284434", "0.5283822", "0.5283061", "0.5278333", "0.52687806", "0.5267472", "0.52672166", "0.5264539", "0.52609396", "0.5260546", "0.52583975", "0.5258092", "0.5252348", "0.52378565", "0.5226199", "0.52225167", "0.52225167", "0.52225167", "0.52225167", "0.5220984", "0.5217174", "0.52145636", "0.521391", "0.52088743", "0.5201983", "0.52009887", "0.5196563" ]
0.5942277
6
Prints the population of every generation to a file titled by designated filename. Might be computationally expensive.
public void printPopulationToFile(int i) throws IOException { FileWriter fstream; BufferedWriter out; File f = new File(FILENAME); if (!f.isFile()) { try { // Create file fstream = new FileWriter(FILENAME); out = new BufferedWriter(fstream); out.write("Generation: " + i + "\r\n"); for (AI ai : this.individuals) { out.write(ai.toString() + "\r\n"); } // Close the output stream out.close(); } catch (Exception e) { // Catch exception if any System.err.println("Error: " + e.getMessage()); } } else { try { // append to file if file already exists fstream = new FileWriter(FILENAME, true); out = new BufferedWriter(fstream); out.write("Generation: " + i + "\r\n"); for (AI ai : this.individuals) { out.write(ai.toString() + "\r\n"); } out.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void toFile(String filename) {\n\t\tsortPool();\n\t\ttry (BufferedWriter bw = new BufferedWriter(new FileWriter(filename))) {\n\t\t\tfor(int i = 0; i < genepool.size(); i++) {\n\t\t\t\tbw.write(genepool.get(i).toWrite());\n\t\t\t\tbw.newLine();\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public abstract void outputGrid(String filename)\r\n throws FileNotFoundException, IOException;", "public void printToFile(Path filename) {\n\t\t\n\t\tlock.lockRead();\n\t\ttry{\n//\t\t\t create a new file if it is not existed; \n//\t\t\t otherwise delete previous one and create a new one.\n\t\t\tif(!Files.exists(filename)){\n\t\t\t\ttry {\n\t\t\t\t\tFiles.createFile(filename);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttry {\n\t\t\t\t\tFiles.delete(filename);\n\t\t\t\t\tFiles.createFile(filename);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(String hotelId : hotelMap.keySet()){\n\t\t\t\tString output = this.toString(hotelId);\n\t\t\t\t\t\t\t\n\t\t\t\t// start of the hotel.\n\t\t\t\tString emptyLine = \"\\n\";\n\t\t\t\tString ast = \"********************\";\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\tFiles.write(filename, emptyLine.getBytes(), StandardOpenOption.APPEND);\n\t\t\t\t\tFiles.write(filename, ast.getBytes(), StandardOpenOption.APPEND);\n\t\t\t\t\tFiles.write(filename, emptyLine.getBytes(), StandardOpenOption.APPEND);\n\t\t\t\t} catch (IOException e1) {\n\t\t\t\t\te1.printStackTrace();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttry{\n\t\t\t\t\tFiles.write(filename, output.getBytes(), StandardOpenOption.APPEND);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinally{\n\t\t\tlock.unlockRead();\n\t\t}\n\t\t\t\n\t}", "public void generateDotFile(String filename) {\n\t\ttry {\n\t\t\tPrintWriter out = new PrintWriter(filename);\n\t\t\tout.println(\"digraph Heap {\\n\\tnode [shape=record]\\n\");\n\n\t\t\tfor (int i = 0; i < currentSize; i++) {\n\t\t\t\tout.println(\"\\tnode\" + i + \" [label = \\\"<f0> |<f1> \" + array[i] + \"|<f2> \\\"]\");\n\t\t\t\tif (((i * 2) + 1) < currentSize)\n\t\t\t\t\tout.println(\"\\tnode\" + i + \":f0 -> node\" + ((i * 2) + 1) + \":f1\");\n\t\t\t\tif (((i * 2) + 2) < currentSize)\n\t\t\t\t\tout.println(\"\\tnode\" + i + \":f2 -> node\" + ((i * 2) + 2) + \":f1\");\n\t\t\t}\n\n\t\t\tout.println(\"}\");\n\t\t\tout.close();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tSystem.out.println(e);\n\t\t}\n\t}", "public static void print(String filename) {\n // create a file writer\n UTF8FileUtility.createWriter(filename);\n // create a string buffer for storing the text\n StringBuilder sBuffer = new StringBuilder();\n int numTokens = 0;\n int freq = 0;\n for (String token : UNIGRAM.keySet()) {\n freq = UNIGRAM.get(token);\n numTokens += freq;\n sBuffer.append(token).append('\\t').append(freq).append(\"\\n\");\n }\n // write the string buffer to the file\n UTF8FileUtility.write(sBuffer.toString());\n // close the writer\n UTF8FileUtility.closeWriter();\n System.err.println(\"# of tokens = \" + numTokens);\n System.err.println(\"# of unigrams = \" + UNIGRAM.size());\n }", "public void printFile() {\n\t\t\n\t\tfor(String[] line_i: linesArray) {\n\t\t\tSystem.out.println( Arrays.toString(line_i) );\n\t\t}\n\t}", "public void playGame() {\n\t\tint generations = 1;\n\t\treadFromFile();\n\t\twhile (generations <= numGens) {\n\t\t\tgetNeighbors();\n\t\t\tsetNextGeneration();\n\t\t\tgenerations += 1;\n\t\t}\n\t\toutputToFile();\n\t}", "public void render(String filename) throws FileNotFoundException {\r\n int pix_h, pix_w;\r\n pix_h = (int) window.getPix_h();\r\n pix_w = (int) window.getPix_w();\r\n \r\n Pixel[][] grid = new Pixel[pix_h][pix_w];\r\n \r\n for(int i = 0; i < pix_h; i++) {\r\n for(int j = 0; j < pix_w; j++) {\r\n \r\n Point p = window.getDelta_h().const_mult(j).vec_add(window.getDelta_w().const_mult(i)).point_add(window.getUl());\r\n Vec d = p.point_sub(window.getEye()).normalize();\r\n Ray r = new Ray(d, window.getEye());\r\n Color c = ray_trace(r);\r\n \r\n grid[i][j] = new Pixel(p, c);\r\n }\r\n }\r\n \r\n try(\r\n PrintWriter toFile = new PrintWriter(filename);\r\n ){\r\n toFile.println(\"P3\");\r\n toFile.println(pix_w + \" \" + pix_h);\r\n toFile.println(255);\r\n \r\n for(int i = 0; i < pix_h; i++) {\r\n int k = 0;\r\n for(int j = 0; j < pix_w; j++) {\r\n if(k>10) {\r\n toFile.println();\r\n k = 0;\r\n }\r\n toFile.print(\r\n (int) Math.ceil(grid[i][j].getColor().getR()*255) + \" \" +\r\n (int) Math.ceil(grid[i][j].getColor().getG()*255) + \" \" +\r\n (int) Math.ceil(grid[i][j].getColor().getB()*255) + \" \");\r\n k++;\r\n }\r\n \r\n }\r\n \r\n }\r\n \r\n }", "public void writeNextGeneration() {\n System.out.println(\"generation \" + generation);\n for (int i = 0; i < currentPopulation; i++) {\n System.out.println(((Genome) genomes.get(i)).toString());\n }\n\n System.out.println(\"generation #\" + generation + \", Hit the enter key to continue...\\n\");\n try {\n\t\t\tThread.sleep(60);\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n /*\n try {\n System.in.read();\n } catch (Exception e) {\n e.printStackTrace();\n }\n */\n }", "private static void printToFile(FrequencyCounter<Integer> freqCounter, ArrayList<Pair<Integer, Float>> plot) {\r\n\t\tPrintWriter writer;\r\n\t\ttry {\r\n\t\t\tString fName = \"experimentalResults\" + File.separator + \"results\" + freqCounter.getname() + \".txt\";\r\n\t\t\twriter = new PrintWriter(new File(fName));\r\n\t\t\tfor (Pair<Integer, Float> p : plot)\r\n\t\t\t\twriter.println(p);\r\n\r\n\t\t\twriter.close();\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public static void main(String args[]) throws IOException {\n\t\tProcessData ged = new ProcessData(); \r\n\t\tged.readFile(\"My Family.ged\"); \r\n\t\t\r\n\t\t// output result for sprint 1, sprint 2, sprint 3 and sprint 4 to output.txt file\r\n\t\tVector<String> s = new Vector<String>();\r\n\t\t\r\n\t\t// get the individuals data\r\n\t\ts.add(\"Individuals Info:\");\r\n\t\ts.addAll(ged.print_individual());\r\n\t\tPrintWriter writer = new PrintWriter(\"Output.txt\", \"UTF-8\");\r\n\t\twhile(s.size()>0)\r\n\t\t{\r\n\t\t writer.write(s.firstElement());\r\n\t\t writer.println();\r\n\t\t s.removeElementAt(0);\r\n\t\t}\r\n\t\ts.add(\"\");\r\n\t\ts.add(\"\");\r\n\t\ts.add(\"\");\r\n\t\t\r\n\t\t// get the family data\r\n\t\ts.add(\"Family Info\");\r\n\t\ts.addAll(ged.print_family());\r\n\t\twhile(s.size()>0)\r\n\t\t{\r\n\t\t writer.write(s.firstElement());\r\n\t\t writer.println();\r\n\t\t s.removeElementAt(0);\r\n\t\t}\t\t\t\r\n\t\tSystem.out.println(\"Result is printed to Output.txt file.\");\r\n\t\twriter.close();\t\t\r\n\t}", "static public void writeNamedGraph(Graph G, String file) {\n\t\ttry {\n\t\t\tPrintWriter out = new PrintWriter(file);\n\t\t\tout.println(G.numNodes());\n\t\t\tfor (int i = 0; i < G.numNodes(); i++)\n\t\t\t\tout.println(G.getName(i));\n\t\t\tfor (int i = 0; i < G.numNodes(); i++) {\n\t\t\t\tArrayList<Pair<Integer, Double>> P = G.adjacentNodes(i);\n\t\t\t\tfor (Pair<Integer, Double> j : P) {\n\t\t\t\t\tif (i < j.first) {\n\t\t\t\t\t\tout.println(G.getName(i) + \" \" + G.getName(j.first) + \" \" + j.second);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tout.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void printEdgeSet(Graph<V, Pair<V>> g, String filename)\r\n\t{\n\t\tPrintWriter writer = null;\r\n\t\ttry {\r\n\t\t\twriter = new PrintWriter(filename, \"UTF-8\");\r\n\t\t} catch (FileNotFoundException | UnsupportedEncodingException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\tfor (Pair<V> e :g.getEdges())\r\n\t\t{\r\n\t\t\t\r\n\t\t\twriter.println(e.getFirst() + \"\\t\" + e.getSecond());\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\twriter.close();\r\n\t\t\r\n\t\t\r\n\t}", "void print(String fileName)\n\t{\n\t\t//Print the elements and also write them into a file if the array is initialized\n\t\tif(inputArray != null)\n\t\t{\n\t\t\ttry \n\t\t\t{\n\t\t\t\t//Create a file output.txt\n\t\t\t\tPrintWriter writer = new PrintWriter(fileName);\n\t\t\t\tfor(int i=0; i < inputArray.length; i++)\n\t\t\t\t{\n\t\t\t\t\t//Print the elements and also write them into a file\n\t\t\t\t\tSystem.out.print(inputArray[i] + \" \");\n\t\t\t\t\twriter.print(inputArray[i] + \" \");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Close the file\n\t\t\t\twriter.close();\n\t\t\t} \n\t\t\tcatch (FileNotFoundException e) \n\t\t\t{\n\t\t\t\t//Printing the Stack Trace if an exception has occurred\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}", "void startFile() {\n writeToFile(defaultScore);\n for (int i = 0; i < 5; i++) {\n writeToFile(readFromFile() + defaultScore);\n }\n }", "public static void main(String[] args) throws IOException {\n\t\tint numSets = 10000;//10000;//500\r\n\t\tint numElements = 1000;//1000; //50\r\n\t\t\r\n//\t\tint[] betas = {2, 4, 8, 16, 32};\r\n//\t\tString[] probfiles = {\"scpnrg1.txt\", \"scpnrg2.txt\", \"scpnrg5.txt\"};\r\n//\t\tString[] probfiles = {\"scpnrh1.txt\", \"scpnrh3.txt\", \"scpnrh5.txt\"};\r\n\t\tint[] betas = {5};\r\n\t\tString[] probfiles = {\"scpnrg1.txt\", \"scpnrg5.txt\"};\r\n\t\tint numTimesRun = 1;\r\n\t\tint runningTime = 10;\r\n\t\tPrintWriter printWriter = new PrintWriter(new File(\"tuning_testIII.csv\"));\r\n\t\tfor(String dataset: probfiles){\r\n\t\t\tStringBuilder stringBuilder = new StringBuilder();\r\n\t\t\tfor(int beta: betas){\r\n\t\t\t\tfor(int i =0 ; i<numTimesRun; i++){\r\n\t\t\t\tDataObject data = new DataObject((\"src/\" + dataset), numSets);\r\n\t\t\t\tGRASP1 grasp = new GRASP1(numElements, numSets, data.getSets());\r\n\t\t\t\tint solution = grasp.run(runningTime, beta);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tstringBuilder.append(\"Profiles: \" + \";\" + dataset + \";\");\r\n\t\t\t\tstringBuilder.append(\"The beta value: \" + \";\" + beta + \";\");\r\n\t\t\t\tstringBuilder.append(\"ItrationCount\" + \";\" + grasp.itrationCount + \";\");\r\n\t\t\t\tstringBuilder.append(\"Solution value: \" + \";\" + solution + \"\\n\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprintWriter.write(stringBuilder.toString());\r\n\t\t}\r\n\t\tprintWriter.close();\r\n\t\tSystem.out.println(\"done!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\");\r\n\r\n\t}", "public static void main(String[] args) throws IOException {\n\t\tint p = 8;\n\t\t// r is the fraction of the population to be replaced by Crossover at\n\t\t// each step\n//\t\tdouble r = Double.valueOf(8).doubleValue();\n\t\tdouble r = 8;\n\t\t// m is the rate of mutation\n//\t\tdouble m = Double.valueOf(8).doubleValue();\n\t\tdouble m = 8;\n\n\t\t// Write into files...\n\t\tFile outputFile = new File(\"testGA.txt\");\n\t\tFileWriter out = new FileWriter(outputFile);\n\n\t\t////////////////////////\n\t\tp = 33;\n\t\tr = 0.6;\n\t\tm = 0.1;\n\n\t\t// Report the population size, crossover rate and mutation rate\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"Learning the 8-queens problem with a Genetic Algorithm\");\n\t\tSystem.out.println(\"Population Size: \" + p);\n\t\tSystem.out.println(\"Crossover Rate: \" + r);\n\t\tSystem.out.println(\"Mutation Rate: \" + m);\n\t\tSystem.out.println();\n\t\tout.write(\"Parameters are p=\" + p + \", \" + \"r=\" + r + \" and m=\" + m + \"\\r\");\n\n\t\t// The genetic algorithm\n\t\tint iterationNum = 0;\n\t\tHypothesis bestIndividual;\n\t\tint bestFitness;\n\t\tdouble aveFitness;\n\t\t// Randomly generate initial population\n\t\tGA algorithm = new GA(p, r, m);\n\t\t// For each individual compute fitness\n\t\talgorithm.computeFitness();\n\t\t// Get the best individual\n\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\tbestFitness = bestIndividual.getFitness();\n\t\taveFitness = algorithm.computeAveFitness();\n\t\t// Iterate till we get the very best individual\n\t\twhile (bestFitness != 0) {\n\t\t\t// Select the very best members of the population to survive\n\t\t\talgorithm.select();\n\t\t\t// Make the best members reproduce themselves\n\t\t\talgorithm.crossover();\n\t\t\t// Add some mutations to new population\n\t\t\talgorithm.mutate();\n\t\t\t// The successor population becomes the current population\n\t\t\talgorithm.setNextGeneration();\n\t\t\t// For each individual compute fitness\n\t\t\talgorithm.computeFitness();\n\t\t\t// Get the best individual\n\t\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\t\tbestFitness = bestIndividual.getFitness();\n\t\t\taveFitness = algorithm.computeAveFitness();\n\t\t\t// Report best results to the user at every five iterations\n\t\t\tif (iterationNum % 5 == 0) {\n\t\t\t\tSystem.out.println(\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness\n\t\t\t\t\t\t+ \" Average Fitness \" + aveFitness);\n\t\t\t\tSystem.out.println(\"Best solution: \" + bestIndividual.toString());\n\t\t\t\tSystem.out.println();\n\t\t\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\t\t}\n\t\t\titerationNum++;\n\t\t}\n\t\tSystem.out.println(\n\t\t\t\t\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness + \" Average Fitness \" + aveFitness);\n\t\tSystem.out.println(\"Solution is \" + bestIndividual.toString());\n\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\tout.close();\n\t}", "private void outputToFile() {\n\t\tPath filePath = Paths.get(outputFile);\n\n\t\ttry (BufferedWriter writer = Files.newBufferedWriter(filePath,\n\t\t\t\tCharset.forName(\"UTF-8\"));) {\n\t\t\tRowIterator iterator = currentGen.iterateRows();\n\t\t\twhile (iterator.hasNext()) {\n\t\t\t\tElemIterator elem = iterator.next();\n\t\t\t\twhile (elem.hasNext()) {\n\t\t\t\t\tMatrixElem mElem = elem.next();\n\t\t\t\t\twriter.write(mElem.rowIndex() + \",\" + mElem.columnIndex());\n\t\t\t\t\twriter.newLine();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Unable to write to the provided file\");\n\t\t}\n\n\t}", "public void print()\n\t{\n\t\tminGenes = Integer.MAX_VALUE;\n\t\tmaxGenes = 0;\n\t\tcreatureGenesQty = 0;\n\t\tfor (Creature creature : creatures)\n\t\t{\n\t\t\tminGenes = (minGenes > creature.getGenotype().size()) ? creature\n\t\t\t\t\t.getGenotype().size() : minGenes;\n\t\t\tmaxGenes = (maxGenes < creature.getGenotype().size()) ? creature\n\t\t\t\t\t.getGenotype().size() : maxGenes;\n\t\t\tcreatureGenesQty += creature.getGenotype().size();\n\t\t\t//creature.print();\n\t\t\tSystem.out.println(\"--------------------------\");\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"--------------------------\");\n\t\t}\n\t\tavgGenes = creatureGenesQty / ((float) size());\n\n\t\t// add some statistics\n\t\tSystem.out.println(\"Population size: \" + size());\n\t\tSystem.out.println(\"Minimum number of genes: \" + minGenes);\n\t\tSystem.out.println(\"Average number of genes: \" + avgGenes);\n\t\tSystem.out.println(\"Maximum number of genes: \" + maxGenes);\n\t\tCreatureLog.info(String.valueOf(size()) + \"\\t\" + avgGenes + \"\\t\" + minGenes + \"\\t\" +maxGenes);\n\n\t}", "public void generate(File file) throws IOException;", "public void doPrintGenes(Chromo X, FileWriter output) throws java.io.IOException\n {\n Hwrite.right(\"\", 5, output);\n\n for (int i = 0; i < Parameters.numGenes; i++)\n {\n Hwrite.right(X.getGeneAlpha(i), 1, output);\n }\n output.write(\" RawFitness\");\n output.write(\"\\n \");\n for (int i = 0; i < Parameters.numGenes; i++)\n {\n Hwrite.right(X.getPosIntGeneValue(i), 1, output);\n }\n Hwrite.right((int) X.rawFitness, 13, output);\n output.write(\"\\n\\n\");\n return;\n }", "public static void generateCostTable(int n, String fileName) \r\n\tthrows FileNotFoundException {\r\n\t\tPrintStream output = new PrintStream(new File(fileName));\r\n\t\t\r\n\t\tfor(int i = 0; i < n; i++) {\r\n\t\t\tfor(int j = 0; j < n; j++) {\r\n\t\t\t\tif(i > j) {\r\n\t\t\t\t\toutput.print(\"NA\\t\");\r\n\t\t\t\t}\r\n\t\t\t\telse if(i == j) {\r\n\t\t\t\t\toutput.print(0 + \"\\t\");\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// randCost between 1 inclusive and MAX_COST inclusive\r\n\t\t\t\t\tint randCost = (new Random().nextInt(MAX_COST)) + 1; \r\n\t\t\t\t\toutput.print(randCost + \"\\t\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\toutput.println();\r\n\t\t}\r\n\t\t\r\n\t\toutput.close();\r\n\t}", "public void generateAndwriteToFile() {\n List<GeneratedJavaFile> gjfs = generate();\n if (gjfs == null || gjfs.size() == 0) {\n return;\n }\n for (GeneratedJavaFile gjf : gjfs) {\n writeToFile(gjf);\n }\n }", "@Override\n\tpublic void printToFile() {\n\t\t\n\t}", "public void save()\r\n {\r\n \tfc=new JFileChooser();\r\n\t fc.setCurrentDirectory(new File(\"\"));\r\n\t if(fc.showSaveDialog(this)==JFileChooser.APPROVE_OPTION)\r\n\t \t//Try-Catch Block\r\n\t try\r\n\t {\r\n\t pw=new PrintWriter(new FileWriter(fc.getSelectedFile()+\".txt\")); //Print to the user-selected file\r\n\t\t \tfor(Organism o: e.getTree()) //IN PROGESS\r\n\t\t \t{\r\n\t\t\t\t\tint[] genes=o.getGenes(); //Getting genes from \r\n\t\t\t\t\tfor(int i=0; i<genes.length; i++)\r\n\t\t\t\t\t\tpw.print(genes[i]+\" \"); //Print each gene value in a line\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tpw.println(); //Starts printing on a new line\r\n\t\t\t\t}\r\n\t\t\t\tpw.close(); //Closes the File\r\n\t }\r\n\t catch (Exception ex) //Catch Any Exception\r\n\t {\r\n\t ex.printStackTrace();\r\n\t }\r\n }", "private void _generate() {\n System.out.println(\"Started...\");\n try {\n log_ = new PrintStream(new FileOutputStream(System.getProperty(\"user.dir\") +\n \"\\\\\" + LOG_FILE));\n //writer_.start(); \n\t for (int i = 0; i < instances_[CS_C_UNIV].num; i++) {\n\t _generateUniv(i + startIndex_);\n\t }\n \n //writer_.end();\n log_.close();\n }\n catch (IOException e) {\n System.out.println(\"Failed to create log file!\");\n }\n System.out.println(\"Completed!\");\n }", "public void writeToCsv(String fileName) throws Exception {\n\tFileWriter writer=new FileWriter(fileName);\n\n\twriter.append(Integer.toString(this.gen));\n\twriter.append('\\n');\n\n\tfor(int i=0;i<popSize;i++) {\n\t writer.append(getBna(i));\n\t writer.append('\\n');\n\t}\n\twriter.close();\n }", "private void outputToFile(String filename) throws FileNotFoundException, IOException {\n\t\tBufferedWriter writer = new BufferedWriter(\n\t\t\t\tnew FileWriter(filename+\".tmp\"));\n\t\twriter.write(VERIFY_STRING + \"\\n\");\n\n\t\t// output automata info\n\t\twriter.write(machine.getName() + \"\\n\");\n\t\twriter.write(machine.getType() + \"\\n\");\n\n\t\t// output state info\n\t\tfor (State state : machine.getStates()) {\n\t\t\twriter.write(\"STATE\\n\");\n\t\t\twriter.write(state.getName() + \"\\n\");\n\t\t\twriter.write(state.isAccept() + \" \" + state.isStart() + \" \" + \n\t\t\t\t\tstate.getID() + \" \" + state.getGraphic().getX() + \" \" + \n\t\t\t\t\tstate.getGraphic().getY() + \"\\n\");\n\n\t\t\t// output transitions\n\t\t\tfor (Transition t : state.getTransitions())\n\t\t\t\twriter.write(t.getID() + \" \" + t.getInput() + \" \" + \n\t\t\t\t\t\tt.getNext().getID() + \"\\n\");\n\t\t}\n\t\twriter.close();\n\t}", "public static void main(String[] args) throws IOException\n {\n \n // Declare Variables \n int count = 0;\n \n // PrintWriter class to create and open new file\n PrintWriter outputFile = new PrintWriter(\"NumbersJamesM.txt\"); \n \n // For loop to add 1 to the number each time\n for (count = 1; count <= 10; count++) // Initilize count to 1,\n { // Run until count is more than 10\n // After each loop add 1 to count. \n \n outputFile.println(count); // Output current count number to outputFile\n \n } \n \n // Close the file \n outputFile.close();\n \n }", "abstract void print(String fileName);", "static public void writeGraph(Graph G, String file) {\n\t\ttry {\n\t\t\tPrintWriter out = new PrintWriter(file);\n\t\t\tout.println(G.numNodes());\n\t\t\tfor (int i = 0; i < G.numNodes(); i++) {\n\t\t\t\tArrayList<Pair<Integer, Double>> P = G.adjacentNodes(i);\n\t\t\t\tfor (Pair<Integer, Double> j : P) {\n\t\t\t\t\tif (i < j.first) {\n\t\t\t\t\t\tout.println(i + \" \" + j.first + \" \" + j.second);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tout.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void cmdGenVCG(String filename) throws NoSystemException {\n MSystem system = system();\n PrintWriter out = null;\n try {\n if (filename == null)\n out = new PrintWriter(System.out);\n else {\n out = new PrintWriter(new BufferedWriter(new FileWriter(\n filename)));\n }\n ModelToGraph.write(out, system.model());\n } catch (IOException ex) {\n Log.error(ex.getMessage());\n } finally {\n if (out != null) {\n out.flush();\n if (filename != null)\n out.close();\n }\n }\n }", "public void printSaving(File savingsFile){\n clearFile(savingsFile);\n try{\n BufferedWriter output = new BufferedWriter(new FileWriter(savingsFile,true));\n output.write(\"Using HuffmanCompressor saves \"+ ((Integer)(savings)).toString()+\" \"+\"bits\");\n output.close();\n }\n catch(IOException e){\n System.out.println(\"IOException\");\n }\n }", "public void populationToCSV() {\n\t\tfor (RSolution<?> sol : population) {\n\t\t\tString line = this.getName() + ',' + this.getProblem().getName() + ',' + sol.objectiveToCSV();\n\t\t\tnew FileUtils().solutionDumpToCSV(line);\n\t\t}\n\t}", "public void print() {\n\t\t\n\t\tfor(Solution sol : population) {\n\t\t\tSystem.out.println(sol.getPossibleSolution() + \" \" + sol.getPath());\n\t\t}\n\t}", "void createReport() {\n\n // report about purple flowers\n println(\"\\nPurple flower distribution: \");\n for (int i = 0; i < 6; i++) {\n println(i + (i==5?\"+\":\"\") + \": \" + numPurpleFlowers[i]);\n }\n // report about missing treasures\n println(\"Missing treasure count: \" + missingTreasureCount);\n\n println(\"\\nGenerated \" + caveGenCount + \" sublevels.\");\n println(\"Total run time: \" + (System.currentTimeMillis()-startTime)/1000.0 + \"s\");\n\n out.close();\n }", "public void write(String outputFileName) throws IOException {\n FileWriter fileWriter = new FileWriter(outputFileName);\n\n for (int i = 1; i < grid.length - 1; i++) {\n for (int j = 1; j < grid[i].length - 1; j++) {\n fileWriter.write(grid[i][j].toString() + \" \");\n fileWriter.flush();\n }\n fileWriter.write(\"\\n\");\n }\n // TODO\n //\n // 1. Open the file.\n //\n // 2. Write to the file. The five life forms are represented by characters\n // B, E, F, G, R. Leave one blank space in between. Examples are given in\n // the project description.\n //\n // 3. Close the file.\n\n }", "public static void printPopulation() {\n printPopulation(false);\n }", "public void generatePopulation(String filePathAndName) {\n\t\t\n\t\tList<String> dataAll = SU.readFile(filePathAndName);\n\t\tList<String> dataAgents = new ArrayList<String>();\n\t\tList<String> dataStock = new ArrayList<String>();\n\t\tList<String> dataRelations = new ArrayList<String>();\n\t\t\n\t\tint typeOfData = -1;\n\t\tfor (String datum : dataAll) {\n\t\t\tif (!datum.startsWith(\"%\")) {\n\t\t\t\tswitch(typeOfData) {\n\t\t\t\tcase 0:\tdataAgents.add(datum); break;\n\t\t\t\tcase 1: dataStock.add(datum); break;\n\t\t\t\tcase 2: dataRelations.add(datum); break;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttypeOfData = Integer.parseInt(datum.substring(1,2));\n\t\t\t}\n\t\t}\n\t\t\n\t\tgenerateAgents(dataAgents);\n\t\tgenerateStock(dataStock);\n\t\tgenerateRelations(dataRelations);\n\t\t\n\t\tSU.getDataCollector().addAllCurrentStock();\n\t}", "public void GeneticAlgorithm (TableVar Variables, TableDat Examples, String nFile) {\r\n\r\n String contents;\r\n\r\n // Creates and initialices the population\r\n poblac = new Population(long_poblacion, Variables.getNVars(), RulesRep, Variables);\r\n poblac.RndInitPop (Variables);\r\n\r\n // Creates the populations \"Inter\" and \"Des\" to aply the genetic operations\r\n Inter = new Population(long_poblacion, Variables.getNVars(), RulesRep, Variables);\r\n Des = new Population(2*long_poblacion, Variables.getNVars(), RulesRep, Variables);\r\n \r\n // Inicialisation of variables\r\n Trials = 0;\r\n Gen = 0;\r\n\r\n // Evaluation of the individuals of the initial population\r\n Trials+=poblac.evalPop (this, Variables, Examples, false);\r\n \r\n // Increments the generation number\r\n Gen++; \r\n \r\n // General cycle of the genetic algorithm\r\n do {\r\n // Selection by Baker method\r\n if(RulesRep.compareTo(\"CAN\")==0)\r\n SelectCAN (Variables);\r\n else SelectDNF (Variables);\r\n\r\n // Crossover\r\n descendientes = 0;\r\n if(RulesRep.compareTo(\"CAN\")==0)\r\n MultipointCrossoverCAN (Variables);\r\n else MultipointCrossoverDNF (Variables);\r\n descendientes = 2;\r\n \r\n // Mutation\r\n if(RulesRep.compareTo(\"CAN\")==0)\r\n MutationCAN (Variables);\r\n else MutationDNF (Variables);\r\n\r\n // Reproduction\r\n if(RulesRep.compareTo(\"CAN\")==0)\r\n SteadyStepReproductionCAN(Variables);\r\n else SteadyStepReproductionDNF(Variables);\r\n\r\n // Evaluation of the new population\r\n Trials+=poblac.evalPop (this, Variables, Examples, false);\r\n\r\n // Next generation\r\n Gen++;\r\n\r\n // GA finishes when the number of evaluations is reached\r\n } while (Trials <= n_eval); \r\n\r\n contents = \" # \" + (Gen-1) + \" generations, \" + Trials + \" evaluations\\n\";\r\n Files.addToFile(nFile, contents);\r\n \r\n }", "public static void main(String[] args) { // generate new json files\n \t// All directories to pull from\n \t\n \tArrayList<List<List<Integer>>> levels = new ArrayList<List<List<Integer>>>();\n \tfor(int i = 1;i<=10;i++) {\n \t\tif (i != 9) {\n \t\t\tmaxX=0;\n \t\t\tmaxY=0;\n \t\t\tvisited.clear();\n \t\t\tenemyNumber=-1;\n \t\t\tenemyString = null;\n \t\t\tbossString = null;\n \t\t\tList<List<Integer>> level = convertMMLVtoInt(MegaManVGLCUtil.MEGAMAN_MMLV_PATH+\"MegaManLevel\"+i+\".mmlv\");\n \t\t\tlevels.add(level);\n \t\t\t//MegaManVGLCUtil.printLevel(level);\n \t\t}\n\t\t}\n \tSystem.out.println(\"Read \"+levels.size()+\" levels.\");\n\n \t\n \toutputOneGAN(levels, \"NoWater9\"); \n \toutputSevenGAN(levels, \"NoWater9\");\n \t//File testFile = new File(\"data\\\\VGLC\\\\MegaMan\\\\MegaManOneGANNoWater9.json\");\n \t//showJsonContents(testFile);\n }", "private void cmdGenMM(String filename) throws NoSystemException {\n MSystem system = system();\n PrintWriter out = null;\n try {\n if (filename == null)\n out = new PrintWriter(System.out);\n else {\n out = new PrintWriter(new BufferedWriter(new FileWriter(\n filename)));\n }\n MMVisitor v = new MMInstanceGenerator(out);\n system.model().processWithVisitor(v);\n } catch (IOException ex) {\n Log.error(ex.getMessage());\n } finally {\n if (out != null) {\n out.flush();\n if (filename != null)\n out.close();\n }\n }\n }", "void setOutput(String filename) throws FileNotFoundException{\n\t\tSystem.out.println(\"Created file: \" + filename);\t\n\t\ttry {\n\t\t\tout = new PrintStream(new FileOutputStream(filename));\n\t\t\tSystem.setOut(out);\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void printOut()\n\t{\n\t\t//int dms[];\n\t\t//int deg, min, sec;\n\t\t//double\tdd;\n\t\ttime = new Date();\t\n\n//\t\tif (GeoDis_GUI.outputfile == null)\n\t\tif (!printToFile)\n\t\t{\t\t\n\t\t\tGeoDis_GUI.outWindow();\n\t\t\toutfile = new TextOutputStream(GeoDis_GUI.outdoc);\n\t\t\t//outfile = Console.out;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//File outputfile = GeoDis_GUI.outputfile;\n\t\t\t//outfilename = GeoDis_GUI.outputfile.getPath();\n\t\t\toutfile = new TextOutputStream(GeoDis.outfilename);\n\t\t\tif(GeoDis.outfilename.endsWith(\".gdout\")){\n\t\t\t\tMediator.setGeoDisOutputFile(GeoDis.outfilename);\n\t\t\t} else {\n\t\t\t\t// Unsafe assumption\n\t\t\t\tMediator.setGeoDisOutputFile_MatrixFormat(GeoDis.outfilename);\n\t\t\t}\n\t\t}\t\n\n\t\toutfile.print(\"Differentiating population structure from history - \" + PROGRAM_NAME);\n\t\toutfile.print(\" \" + VERSION_NUMBER);\n\t\toutfile.print(\"\\n(c) Copyright, 1999-2006 David Posada and Alan Templeton\");\n\t\toutfile.print(\"\\nContact: David Posada, University of Vigo, Spain ([email protected])\");\n\t\t//outfile.print(\"\\nUniversity of Vigo\");\n\t\t//outfile.print(\"\\[email protected]\");\n\t\toutfile.print(\"\\n________________________________________________________________________\\n\\n\");\n\t\toutfile.print(\"Input file: \" + infilename);\n\t\toutfile.print(dataName);\n\t\toutfile.print(\"\\n\\n\" + time.toString());\n\n\t\tif (doingDistances)\n\t\toutfile.print(\"\\n\\nCalculations from USER-defined distances\");\n\n\n\t\tfor(k=0; k<numClades; k++)\n\t\t{\n\n\t\t\toutfile.print(\"\\n\\n\\n\\n\\nPERMUTATION ANALYSIS OF \" + clad[k].cladeName);\n\t\t\toutfile.print(\"\\n BASED ON \" + GeoDis.numPermutations + \" RESAMPLES\");\n\t\t\toutfile.println(\"\\n\\n\\nPART I. PERMUTATIONAL CONTINGENCY TEST:\");\n\n\t\t\tif(clad[k].numSubClades != 1) \n\t\t\t{\n\t\t\t\toutfile.print(\"\\n\\n OBSERVED CHI-SQUARE STATISTIC = \");\n\t\t\t\toutfile.printf(\"%10.4f\",clad[k].obsChi);\n\t\t\t\toutfile.print(\"\\n\\n THE PROBABILITY OF A RANDOM CHI-SQUARE BEING GREATER THAN\");\n\t\t\t\toutfile.print(\"\\n OR EQUAL TO THE OBSERVED CHI-SQUARE = \");\n\t\t\t\toutfile.printf(\"%10.4f\",clad[k].chiPvalue);\n\t\t\t}\t\t\n\n\t\t\telse\n\t\t\t\toutfile.println(\"\\nNO. OF CLADES = 1, CHI-SQUARE N.A.\");\n\t\t\t \n\n\t\t\toutfile.println(\"\\n\\n\\nPART II. GEOGRAPHIC DISTANCE ANALYSIS:\");\n\n\t\t\t// print geographical centers\n\t\t\t\n\t\n\t\t\tif (usingDecimalDegrees)\n\t\t\t{\n\t\t\t\toutfile.print(\"\\nGEOGRAPHICAL CENTERS LATITUDE LONGITUDE\");\n\t\t\t\toutfile.printf(\"\\n%16s\", clad[k].cladeName);\n\t\t\t\toutfile.printf(\"%16.4f\", clad[k].meanLatNest / D2R);\n\t\t\t\toutfile.printf(\"%16.4f\", clad[k].meanLonNest / D2R);\n\t\t\t\tfor(i = 0; i < clad[k].numSubClades; i++)\n\t\t\t\t{\n\t\t\t\t\toutfile.printf(\"\\n%16s\", clad[k].subCladeName[i]);\n\t\t\t\t\toutfile.printf(\"%16.4f\", clad[k].meanLatitude[i] / D2R);\n\t\t\t\t\toutfile.printf(\"%16.4f\", clad[k].meanLongitude[i] / D2R);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (!doingDistances)\n\t\t\t{\n\t\t\t\toutfile.print(\"\\nGEOGRAPHICAL CENTERS LATITUDE LONGITUDE\");\n\t\t\t\toutfile.printf(\"\\n%16s\", clad[k].cladeName);\n\n\t\t\t\tint dms[] = DDtoDMS (clad[k].meanLatNest / D2R);\n\t\t\t\toutfile.printf(\" % 4d\"+ \" \", dms[0]);\n\t\t\t\toutfile.printf(\"%02d\" + \"'\", dms[1]);\n\t\t\t\toutfile.printf(\"%02d\" +\"\\\"\", dms[2]);\n\t\t\t\t/*outfile.printf(\"(%6.4f)\", clad[k].meanLatNest / D2R);*/\n\n\t\t\t\tdms = DDtoDMS (clad[k].meanLonNest / D2R);\n\t\t\t\toutfile.printf(\" % 4d\"+ \" \", dms[0]);\n\t\t\t\toutfile.printf(\"%02d\" + \"'\", dms[1]);\n\t\t\t\toutfile.printf(\"%02d\" +\"\\\"\", dms[2]);\n\t\t\t\t/*outfile.printf(\"(%6.4f)\", clad[k].meanLonNest / D2R);*/\n\n\t\t\t\tfor(i = 0; i < clad[k].numSubClades; i++)\n\t\t\t\t{\n\t\t\t\t\toutfile.printf(\"\\n%16s\", clad[k].subCladeName[i]);\n\t\t\n\t\t\t\t\tdms = DDtoDMS (clad[k].meanLatitude[i] / D2R);\n\t\t\t\t\toutfile.printf(\" % 4d\"+ \" \", dms[0]);\n\t\t\t\t\toutfile.printf(\"%02d\" + \"'\", dms[1]);\n\t\t\t\t\toutfile.printf(\"%02d\" +\"\\\"\", dms[2]);\n\t\t\t\t\t/* outfile.printf(\"(%6.4f)\", clad[k].meanLatitude[i] / D2R);*/\n\n\t\t\t\t\tdms = DDtoDMS (clad[k].meanLongitude[i] / D2R);\n\t\t\t\t\toutfile.printf(\" % 4d\"+ \" \", dms[0]);\n\t\t\t\t\toutfile.printf(\"%02d\" + \"'\", dms[1]);\n\t\t\t\t\toutfile.printf(\"%02d\" +\"\\\"\", dms[2]);\n\t\t\t\t\t/*outfile.printf(\"(%6.4f)\", clad[k].meanLongitude[i] / D2R);*/\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor(i = 0; i < clad[k].numSubClades; i++)\n\t\t\t{\n\n\t\t\t\toutfile.print(\"\\n\\nCLADE \" + clad[k].subCladeName[i] + \" (\" + clad[k].subCladePosition[i] + \")\");\t\t\t\t\t\t\n\t\t\t\toutfile.print(\"\\n TYPE OF DISTANCE DISTANCE PROB.<= PROB.>=\");\n\n\t\t\t\tif(clad[k].numSubClades == 1)\n\t\t\t\t{\n\t\t\t\t\toutfile.print(\"\\n WITHIN CLADE \");\n\t\t\t\t\toutfile.printf(\"%12.4f\",clad[k].Dc[i]);\n\t\t\t\t\toutfile.print(\"N.A N.A\");\n\t\t\t\t\toutfile.print(\"\\n NESTED CLADE \");\n\t\t\t\t\toutfile.printf(\"%12.4f\",clad[k].Dn[i]);\n\t\t\t\t\toutfile.print(\"N.A N.A\");\n\t\t\t\t}\t\n\t\t\t\telse\n\t\t\t\t{\t\n\t\t\t\t\toutfile.print(\"\\n WITHIN CLADE \");\n\t\t\t\t\toutfile.printf(\"%12.4f\",clad[k].Dc[i]);\n\t\t\t\t\toutfile.print(\" \");\n\t\t\t\t\toutfile.printf(\"%10.4f\",clad[k].DcPvalue[i][0]);\n\t\t\t\t\toutfile.print(\" \");\n\t\t\t\t\toutfile.printf(\"%10.4f\",clad[k].DcPvalue[i][1]);\n\t\t\t\t\t\n\n\t\t\t\t\toutfile.print(\"\\n NESTED CLADE \");\n\t\t\t\t\toutfile.printf(\"%12.4f\",clad[k].Dn[i]);\n\t\t\t\t\toutfile.print(\" \");\n\t\t\t\t\toutfile.printf(\"%10.4f\",clad[k].DnPvalue[i][0]);\n\t\t\t\t\toutfile.print(\" \");\n\t\t\t\t\toutfile.printf(\"%10.4f\",clad[k].DnPvalue[i][1]);\n\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tif(GeoDis.weights)\n\t\t\t{\n\t\t\t\toutfile.print(\"\\n\\n\\nCORRELATIONS OF DISTANCES WITH OUTGROUP WEIGHTS:\\n\");\n\t\t\t\toutfile.print(\"\\n TYPE OF DISTANCE CORR. COEF. PROB.<= PROB.>=\");\n\n\t\t\t\tif(clad[k].numSubClades == 1)\n\t\t\t\t\toutfile.print(\" N.A. -- ONLY 1 CLADE IN NESTING GROUP\");\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\n\t\t\t\t\tif(clad[k].corrDcWeights == NA)\n\t\t\t\t\t\toutfile.print(\"\\n FROM CLADE MIDPT. -- N.A. -- NO DISTANCE OR WEIGHT VARIATION\");\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\toutfile.print(\"\\n FROM CLADE MIDPT. \");\n\t\t\t\t\t\toutfile.printf(\"%12.4f\",clad[k].corrDcWeights);\n\t\t\t\t\t\toutfile.print(\" \");\n\t\t\t\t\t\toutfile.printf(\"%10.4f\",clad[k].corrDcWPvalue[0]);\n\t\t\t\t\t\toutfile.print(\" \");\n\t\t\t\t\t\toutfile.printf(\"%10.4f\",clad[k].corrDcWPvalue[1]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(clad[k].corrDnWeights == NA)\n\t\t\t\t\t\toutfile.print(\"\\n FROM NESTING MIDPT. -- N.A. -- NO DISTANCE OR WEIGHT VARIATION\");\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\toutfile.print(\"\\n FROM NESTING MIDPT.\");\n\t\t\t\t\t\toutfile.printf(\"%12.4f\",clad[k].corrDnWeights);\n\t\t\t\t\t\toutfile.print(\" \");\n\t\t\t\t\t\toutfile.printf(\"%10.4f\",clad[k].corrDnWPvalue[0]);\n\t\t\t\t\t\toutfile.print(\" \");\n\t\t\t\t\t\toutfile.printf(\"%10.4f\",clad[k].corrDnWPvalue[1]);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\n\n\t\t\tif(clad[k].check == (double) clad[k].numSubClades || clad[k].check == 0)\n\t\t\t\t outfile.print(\"\\n\\n\\nNO INTERIOR/TIP CLADES EXIST IN THIS GROUP\"); \n\t\t\telse\n\t\t\t{\n\t\t\t\toutfile.print(\"\\n\\n\\nPART III. TEST OF INTERIOR VS. TIP CLADES:\");\n\t\t\t\toutfile.print(\"\\n\\n TYPE OF DISTANCE I-T DISTANCE PROB.<= PROB.>=\");\n\t\t\t\toutfile.print(\"\\n WITHIN CLADE \");\n\t\t\t\toutfile.printf(\"%12.4f\",clad[k].tipIntDistance);\n\t\t\t\toutfile.print(\" \");\n\t\t\t\toutfile.printf(\" %10.4f\",clad[k].ITcPvalue[0]);\n\t\t\t\toutfile.print(\" \");\n\t\t\t\toutfile.printf(\" %10.4f\",clad[k].ITcPvalue[1]);\n\n\t\t\t\toutfile.print(\"\\n NESTED CLADE \");\n\t\t\t\toutfile.printf(\"%12.4f\",clad[k].tipIntDisNested);\n\t\t\t\toutfile.print(\" \");\n\t\t\t\toutfile.printf(\" %10.4f\",clad[k].ITnPvalue[0]);\n\t\t\t\toutfile.print(\" \");\n\t\t\t\toutfile.printf(\" %10.4f\",clad[k].ITnPvalue[1]);\n\t\t\t}\n\n\t\t} // 1 clade loop\n\t\n\t\tlong total_time = end-start;\n\t\tdouble seconds = (double) total_time / 1000.0;\n\t\t//long minutes = seconds / 60;\n\t\toutfile.print(\"\\n\\n\\n** ANALYSIS FINISHED **\\nIt took \");\n\t\t//outfile.printf(\"%5d\", minutes);\n\t\t//outfile.print(\" minutes\\n\");\n\t\toutfile.printf(\"%5.4f\", seconds);\n\t\toutfile.print(\" seconds.\\n\");\n\n\t\t\n\t\toutfile.close();\n\t\t//System.err.println(\"\\nDONE Printing out\");\n\n\t}", "public void generate(PSGenerator gen) throws IOException {\n/* 146 */ if (this.resources == null || this.resources.size() == 0) {\n/* */ return;\n/* */ }\n/* 149 */ StringBuffer sb = new StringBuffer();\n/* 150 */ sb.append(\"%%\").append(getName()).append(\": \");\n/* 151 */ boolean first = true;\n/* 152 */ Iterator<PSResource> i = this.resources.iterator();\n/* 153 */ while (i.hasNext()) {\n/* 154 */ if (!first) {\n/* 155 */ gen.writeln(sb.toString());\n/* 156 */ sb.setLength(0);\n/* 157 */ sb.append(\"%%+ \");\n/* */ } \n/* 159 */ PSResource res = i.next();\n/* 160 */ sb.append(res.getResourceSpecification());\n/* 161 */ first = false;\n/* */ } \n/* 163 */ gen.writeln(sb.toString());\n/* */ }", "private void writeCheckpoint(String filename) {\n File file = new File(checkpointDir, filename);\n try {\n geneticProgram.savePopulation(new FileOutputStream(file));\n } catch (FileNotFoundException e) {\n log.log(Level.WARNING, \"Exception in dump\", e);\n }\n }", "public static void main(String[] args) throws Exception {\n FileOutputStream file = new FileOutputStream(\"randoms.txt\");\n PrintWriter output = new PrintWriter(file);\n\n //write 100 random numbers to the file\n\n\n\n\n //open the file for input\n\n\n\n\n //print the sorted array on the screen\n\n\n\n}", "public void printToXML() {\n String fileString = \"outputDisposal.xml\";\n //Creating the path object of the file\n Path filePath = Paths.get(fileString);\n if (Files.notExists(filePath)) {\n try {\n Files.createFile(filePath);\n } catch (IOException e1) {\n\n e1.printStackTrace();\n }\n }\n //Converting the path object to file to use in the FileWriter constructor \n File newFile = filePath.toFile();\n\n /*\n Typical try-with-resources block that features three streams: FileWriter,BufferedWriter and PrintWriter.\n The FileWriter object connects the file tho the stream.\n The BufferedWriter object \n */\n try ( PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(newFile)))) {\n for (PickUp pck : pickups) {\n out.print(pck);\n }\n\n } catch (IOException e) {\n System.err.println(e);\n }\n\n }", "private void outputResults()\n{\n try {\n PrintWriter pw = new PrintWriter(new FileWriter(output_file));\n pw.println(total_documents);\n for (Map.Entry<String,Integer> ent : document_counts.entrySet()) {\n String wd = ent.getKey();\n int ct = ent.getValue();\n pw.println(ct + \" \" + wd);\n }\n pw.println(START_KGRAMS);\n pw.println(total_kdocuments);\n for (Map.Entry<String,Integer> ent : kgram_counts.entrySet()) {\n String wd = ent.getKey();\n int ct = ent.getValue();\n pw.println(ct + \" \" + wd);\n } \n pw.close();\n }\n catch (IOException e) {\n IvyLog.logE(\"SWIFT\",\"Problem generating output\",e);\n }\n}", "public void printDataToFile(){\n\ttry {\n\t File file = new File(\"media/gameOutput.txt\");\n \n\t // if file doesnt exists, then create it\n\t if (!file.exists()) {\n\t\tfile.createNewFile();\n\t }\n \n\t FileWriter fw = new FileWriter(file.getAbsoluteFile());\n\t BufferedWriter bw = new BufferedWriter(fw);\n\t bw.write(printString);\n\t bw.close();\n\t} catch (IOException e) {\n\t e.printStackTrace();\n\t}\n }", "public void printArray(){\n\n\t\tfor (int i=0;i<1;i++){\n\n\t\t\tfor (int j=0;j<population[i].getLength();j++){\n\n\t\t\t\tSystem.out.println(\"X\" + j + \": \" + population[i].getX(j) + \" \" + \"Y\"+ j + \": \" + population[i].getY(j));\n\t\t\t\tSystem.out.println();\n\n\t\t\t}//end j\n\n\t\t\tSystem.out.println(\"The duplicate count is: \" + population[i].duplicateCheck());\n\t\t\tSystem.out.println(\"The fitness is \" + population[i].computeFitness());\n\t\t\t//population[i].computeFitness();\n\n\t\t}//end i\n\n\t}", "void print(String fileName)\n\t{\n\t\t//Get the reference of the head of the Linked list\n\t\tNode ref = head;\n\t\t\n\t\t//Print the elements and also write them into a file if the head is initialized\n\t\tif(ref != null)\n\t\t{\n\t\t\ttry \n\t\t\t{\n\t\t\t\t//Create a file output.txt\n\t\t\t\tPrintWriter writer = new PrintWriter(fileName);\n\t\t\t\t\n\t\t\t\t//Traverse till the end of the Linked List \n\t\t\t\twhile(ref != null)\n\t\t\t\t{\n\t\t\t\t\tref = ref.next;\n\t\t\t\t\tif(ref != null)\n\t\t\t\t\t{\n\t\t\t\t\t\t//Print the elements and also write them into a file\n\t\t\t\t\t\tSystem.out.print(ref.value + \" \");\n\t\t\t\t\t\twriter.print(ref.value + \" \");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Close the file\n\t\t\t\twriter.close();\n\t\t\t} \n\t\t\tcatch (FileNotFoundException e) \n\t\t\t{\n\t\t\t\t//Printing the Stack Trace if an exception has occurred\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}", "public void displayToFile(){\n String data = \"\";\n try{\n FileWriter fstream = new FileWriter(\"output.txt\", true);\n BufferedWriter out = new BufferedWriter(fstream);\n\n for (int i=0 ; i<40; i++) {\n for (int j=0; j<146 ;j++ ){\n if (board.getCharacter(j,i) == '0') {\n data += '-';\n } else {\n data += board.getCharacter(j,i);\n }\n }\n out.write(data);\n data = \"\";\n }\t\n out.close();\n } catch (Exception e){\n System.err.println(\"Error: \" + e.getMessage());\n }\n }", "public void outputToFile(String filemame)\n {\n }", "private static void writeStatistics(String name) throws IOException {\n fileWriter = new BufferedWriter(new FileWriter(PATH + \"/uid/\" + name));\n fileWriter.write(\"Number of Nodes total: \" + globalVertexCount);\n fileWriter.newLine();\n fileWriter.write(\"Number of Edges total: \" + globalEdgeCount);\n fileWriter.newLine();\n fileWriter.write(\"######################################\");\n fileWriter.newLine();\n fileWriter.write(\"Nodes counted:\");\n fileWriter.newLine();\n for (Map.Entry<String, Long> entry : counterMapNodes.entrySet()) {\n fileWriter\n .write(entry.getKey().replace(\"_0.csv\", \"\") + \": \" + entry.getValue());\n fileWriter.newLine();\n }\n fileWriter.write(\"######################################\");\n fileWriter.newLine();\n fileWriter.write(\"Edges counted:\");\n fileWriter.newLine();\n for (Map.Entry<String, Long> entry : counterMapEdges.entrySet()) {\n fileWriter\n .write(entry.getKey().replace(\"_0.csv\", \"\") + \": \" + entry.getValue());\n fileWriter.newLine();\n }\n fileWriter.close();\n }", "public void writeFile()\n\t{\n\t\t//Printwriter object\n\t\tPrintWriter writer = FileUtils.openToWrite(\"TobaccoUse.txt\");\n\t\twriter.print(\"Year, State, Abbreviation, Percentage of Tobacco Use\\n\");\n\t\tfor(int i = 0; i < tobacco.size(); i++)\n\t\t{\n\t\t\tStateTobacco state = tobacco.get(i);\n\t\t\tString name = state.getState();\n\t\t\tString abbr = state.getAbbreviation();\n\t\t\tdouble percent = state.getPercentUse();\n\t\t\tint year = state.getYear();\n\t\t\twriter.print(\"\"+ year + \", \" + name + \", \" + abbr + \", \" + percent + \"\\n\");\n\t\t} \n\t\twriter.close(); //closes printwriter object\n\t}", "public static void main(String args[]) {\n double zoomLevel = 3;\n int iternumber = 100;\n for (int i = 0; i < 10; i++) {\n String fileName = \"Test\"+i+\".ppm\";\n Fractal.makeImage(-1.45,0,1000,zoomLevel,fileName,iternumber);\n zoomLevel = zoomLevel/10;\n iternumber += 100;\n }\n }", "public static void outputNames(ArrayList<String> names) throws IOException {\n\n //Open filewriter for output file\n FileWriter output = new FileWriter(\"exercise41_output.txt\");\n\n // Write default text for output file for how many names there are\n output.write(\"Total of \" + names.size() + \" names\\n\");\n output.write(\"-----------------\\n\");\n\n // Write names in file\n for (String i : names) {\n output.write(i + \"\\n\");\n }\n\n //Close the filewriter\n output.close();\n }", "public void writeGridToFile(int[][] writtenGrid) throws IOException {\n StringBuilder sb = new StringBuilder();\n int count = 0;\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n sb.append(count).append(\",\").append(writtenGrid[i][j]).append(\"\\n\");\n count++;\n }\n }\n try {\n FileWriter fw = new FileWriter(\"grid.txt\");\n fw.write(sb.toString());\n fw.close();\n } catch (IOException e) {\n System.out.println(\"An error occurred.\");\n e.printStackTrace();\n }\n }", "private void outputfile() {\n\n ConnectDB dbconnect = new ConnectDB();\n\n try {\n PrintWriter writer = new PrintWriter(\"memberoutput.txt\");\n\n try {\n dbconnect.pst = dbconnect.con.prepareStatement(\"select * from members\");\n dbconnect.rs = dbconnect.pst.executeQuery();\n\n while (dbconnect.rs.next()) {\n writer.println(dbconnect.rs.getString(1) + \",\"\n + dbconnect.rs.getString(2) + \",\"\n + dbconnect.rs.getString(3) + \",\"\n + dbconnect.rs.getString(4) + \",\"\n + dbconnect.rs.getString(5) + \",\"\n + dbconnect.rs.getString(6) + \",\"\n + dbconnect.rs.getString(7) + \",\"\n + dbconnect.rs.getString(8) + \",\"\n + dbconnect.rs.getString(9));\n }\n\n writer.flush();\n } catch (SQLException e) {\n // TODO Auto-generated catch block\n }\n writer.close();\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n JOptionPane.showMessageDialog(null, \"File exported\");\n }", "public static void printPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n System.out.println(chromosome);\n }\n }", "private void outputFile() {\n // Define output file name\n Scanner sc = new Scanner(System.in);\n System.out.println(\"What do you want to call this file?\");\n String name = sc.nextLine();\n\n // Output to file\n Path outputFile = Paths.get(\"submissions/\" + name + \".java\");\n try {\n Files.write(outputFile, imports);\n if (imports.size() > 0)\n Files.write(outputFile, Collections.singletonList(\"\"), StandardOpenOption.APPEND);\n Files.write(outputFile, lines, StandardOpenOption.APPEND);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "public void doTheStuff (String filename) throws FileNotFoundException {\n\tScanner in = new Scanner (new File (filename));\n\tint numberOfCases = in.nextInt();\n\tfor (int caseNumber = 1; caseNumber <= numberOfCases; caseNumber++) {\n\t\tSystem.out.print (\"Case #\"+caseNumber+\": \");\n\t\tsolve(in);\n\t}\n}", "public void sortByPopulation()\r\n {\r\n PrintWriter output;\r\n int max, t0;\r\n String t1;\r\n \r\n //Selection sort\r\n for(int i = 0; i<population.length;i++) //loops through\r\n {\r\n max = i; //Assume first element is max\r\n for(int x = i + 1;x<population.length;x++) //loops through the rest\r\n {\r\n if(population[x] >population[max]) //sets new max if a subsequent element is bigger\r\n { \r\n max = x;\r\n }\r\n }\r\n //change the positions\r\n t0 = population[i];\r\n population[i] = population[max];\r\n population[max] = t0;\r\n t1 = countries[i];\r\n countries[i] = countries[max];\r\n countries[max] = t1;\r\n }\r\n \r\n try\r\n {\r\n output = new PrintWriter (new FileWriter (\"sortedByPopulation.txt\")); //saves\r\n \r\n //prints to the file\r\n for (int x = 0 ; x <population.length ; x++)\r\n output.printf(\"%-1s \\t\\t\\t\\t %,d %n\", countries[x], population[x]);\r\n output.close (); //closes stream\r\n }\r\n catch (IOException e)\r\n {\r\n JOptionPane.showMessageDialog (null, \"Something went wrong with the input or output operations!\"); //error message\r\n }\r\n }", "@Override\n public void makeOutPutData(File file) {\n\n prepareHtmlDataList();\n\n PrintWriter pw = null;\n int cnt = 0;\n\n try {\n pw = new PrintWriter(new FileOutputStream(file, true));\n\n pw.println(\"******************** MainData info ********************\");\n pw.println(\"startLoggingTime : \"\n + ALTHelper\n .DateToString(ALTHelper\n .getTimeStartedBefore(1000)));\n pw.println(\"endLoggingTime : \"\n + ALTHelper\n .DateToString(ALTHelper\n .getTimeLaunched()));\n\n pw.println(\"\");\n\n pw.println(\"******************** Launched info ********************\");\n\n // should implement\n\n pw.println(\"\");\n\n pw.println(\"******************** gc info (top5) sorted by total_time ********************\");\n\n // -----------------------\n\n pw.println(String.format(\"%-20s\", \"time\")\n + String.format(\"%-10s\", \"PID\")\n + String.format(\"%-15s\", \"GC_cause\")\n + String.format(\"%-12s\", \"freedObject\")\n + String.format(\"%-10s\", \"freedByte\")\n + String.format(\"%-13s\", \"freedLObject\")\n + String.format(\"%-11s\", \"freedLByte\")\n + String.format(\"%-13s\", \"percent_free\")\n + String.format(\"%-18s\", \"current_heap_size\")\n + String.format(\"%-13s\", \"total_memory\")\n + String.format(\"%-11s\", \"pause_time\")\n + String.format(\"%-11s\", \"Total_time\"));\n\n ArrayList<GCData> totalTimeList = (ArrayList<GCData>)getGCDataList()\n .clone();\n Collections.sort(totalTimeList, new GCDataComparator(\n GCDataComparator.DataSortType.TOTAL_TIME));\n\n for (GCData gc : totalTimeList) {\n\n if (cnt >= 5)\n break;\n\n pw.println(String.format(\"%-20s\",\n ALTHelper.DateToString(gc.valutOfdate))\n + String.format(\"%-10s\", gc.PID)\n + String.format(\"%-15s\", gc.GC_cause)\n + String.format(\"%-12s\", gc.freedObject)\n + String.format(\"%-10s\", gc.freedByte)\n + String.format(\"%-13s\", gc.freedLObject)\n + String.format(\"%-11s\", gc.freedLByte)\n + String.format(\"%-13s\", gc.percent_free)\n + String.format(\"%-18s\", gc.current_heap_size)\n + String.format(\"%-13s\", gc.total_memory)\n + String.format(\"%-11s\", gc.pause_time)\n + String.format(\"%-11s\", gc.Total_time));\n cnt++;\n }\n\n pw.println(\"\");\n\n // -----------------------\n\n pw.println(\"******************** gc info sorted by date ********************\");\n\n pw.println(String.format(\"GC Total count : %5s\", getGCDataList()\n .size() + \" times\"));\n\n pw.println(String.format(\"%-20s\", \"time\")\n + String.format(\"%-10s\", \"processName\")\n + String.format(\"%-15s\", \"GC_cause\")\n + String.format(\"%-12s\", \"freedObject\")\n + String.format(\"%-10s\", \"freedByte\")\n + String.format(\"%-13s\", \"freedLObject\")\n + String.format(\"%-11s\", \"freedLByte\")\n + String.format(\"%-13s\", \"percent_free\")\n + String.format(\"%-18s\", \"current_heap_size\")\n + String.format(\"%-13s\", \"total_memory\")\n + String.format(\"%-11s\", \"pause_time\")\n + String.format(\"%-11s\", \"Total_time\"));\n\n for (GCData gc : getGCDataList()) {\n pw.println(String.format(\"%-20s\",\n ALTHelper.DateToString(gc.valutOfdate))\n + String.format(\"%-10s\", gc.PID)\n + String.format(\"%-15s\", gc.GC_cause)\n + String.format(\"%-12s\", gc.freedObject)\n + String.format(\"%-10s\", gc.freedByte)\n + String.format(\"%-13s\", gc.freedLObject)\n + String.format(\"%-11s\", gc.freedLByte)\n + String.format(\"%-13s\", gc.percent_free)\n + String.format(\"%-18s\", gc.current_heap_size)\n + String.format(\"%-13s\", gc.total_memory)\n + String.format(\"%-11s\", gc.pause_time)\n + String.format(\"%-11s\", gc.Total_time));\n }\n pw.println(\"\");\n\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n } finally {\n if (pw != null)\n pw.close();\n }\n }", "public void generateDemoData() {\n for (int values = 0; values < votersAmt.size(); values++) {\n int n = votersAmt.get(values),\n m = candidatesAmt.get(values);\n for (int game = 1; game <= 20; game++) {\n try {\n String gameContent = \"\";\n for (int i = 0; i < n; i++) {\n // Mapping values so that voters can vote each candidate strictly once.\n List<String> candidatesPerVoter = new ArrayList<String>();\n for (int j = 0; j < m; j++) {\n int x = ThreadLocalRandom.current().nextInt(1, m);\n while (candidatesPerVoter.contains(\"C\"+x)) x = ThreadLocalRandom.current().nextInt(1, m + 1);\n candidatesPerVoter.add(\"C\" + x);\n }\n for (String candidate : candidatesPerVoter) {\n gameContent += (candidate + \" \");\n }\n if (i < n - 1) gameContent += \"\\n\";\n }\n\n String writingPolicy = \"plurality\";\n PrintWriter pw1 = new PrintWriter(outputDataRepository + \"/game\" + game + \"_\" + n + \"_\" + m + \"_\" + writingPolicy + \"_results.txt\");\n pw1.write(writingPolicy + \"\\n\" + gameContent); pw1.flush(); pw1.close();\n\n writingPolicy = \"borda\";\n PrintWriter pw2 = new PrintWriter(outputDataRepository + \"/game\" + game + \"_\" + n + \"_\" + m + \"_\" + writingPolicy + \"_results.txt\");\n pw2.write(writingPolicy + \"\\n\" + gameContent); pw2.flush(); pw2.close();\n } catch (FileNotFoundException exc) {\n System.err.println(\"Error writing file to disk; please check relevant permissions.\");\n exc.printStackTrace();\n }\n }\n }\n }", "void printAssociations(HashMap<BitSet, Integer> allAssociations){\n try{\n boolean firstLine = true;\n FileWriter fw = new FileWriter(this.outputFilePath);\n \n for(Map.Entry<BitSet, Integer> entry : allAssociations.entrySet()){\n BitSet bs = entry.getKey();\n if(firstLine)\n firstLine = false;\n else\n fw.write(\"\\n\");\n \n for(int i=0; i<bs.length() ; i++){\n if(bs.get(i))\n fw.write(intToStrItem.get(frequentItemListSetLenOne.get(i).getKey())+\" \");\n }\n\n fw.write(\"(\" + entry.getValue() +\")\");\n }\n \n fw.close();\n }\n catch(Exception e){\n e.printStackTrace();\n }\n }", "@Override\n public void saveSolutions() {save solutions in unfolded format in a separate files for each solution (At this time, we have just one solution)\n // The result will print in 3 rows and each row have 4 columns:\n //\n // row1 --> col2\n // row2 --> col1 clo2 col3 col4\n // row2 --> clo2\n //\n //Example (of red cube):\n //\n // oo o\n // ooo\n // ooooo\n // ooo\n // oo\n // o o oo oo oo o\n //oooo ooooo ooo oooo\n // oooo ooo ooooo oooo\n //oooo ooooo ooo oooo\n // o o o oo o\n // o oo\n // oooo\n // oooo\n // oooo\n // oo oo\n //\n String directory = \"output\";\n File dir = new File(directory);\n if (!dir.exists()) dir.mkdirs();\n AtomicInteger counter = new AtomicInteger(1);\n solutions.forEach((number, solutionPuzzle) -> {\n StringBuilder rowStringValue1 = generateRowStringValue(null, solutionPuzzle.getTopPuzzlePiece(), null, null);\n StringBuilder rowStringValue2 = generateRowStringValue(solutionPuzzle.getLeftPuzzlePiece(), solutionPuzzle.getFrontPuzzlePiece(), solutionPuzzle.getRightPuzzlePiece(), solutionPuzzle.getBackPuzzlePiece());\n StringBuilder rowStringValue3 = generateRowStringValue(null, solutionPuzzle.getBottomPuzzlePiece(), null, null);\n Path path = Paths.get(directory + \"/solution\" + counter.getAndIncrement() + \".txt\");\n try (BufferedWriter writer = Files.newBufferedWriter(path)) {\n writer.write(rowStringValue1.append(rowStringValue2).append(rowStringValue3).toString());\n } catch (IOException e) {\n e.printStackTrace();\n }\n });\n\n }", "public void outputByCols(String filename) throws IOException {\n BufferedWriter colsWriter = new BufferedWriter(new FileWriter(new File(filename)));\n for (int k = 0; k < this.numCols; k++) {\n int j = 0;\n for (int member : this.getColumn(k)) {\n if (j > 0) {\n colsWriter.write(\" \");\n }\n j++;\n colsWriter.write(Integer.toString(member + 1)); // Add 1 to get back 1-indexing\n }\n colsWriter.newLine();\n }\n colsWriter.close();\n }", "public void writeGraph (String outputFileName) {\n\t\ttry\r\n\t\t{\r\n\t\t\tFileOutputStream fileOutputStream = new FileOutputStream(outputFileName);\r\n\t\t\tBufferedOutputStream bufferedOutputStream = new BufferedOutputStream(\r\n\t\t\t\t\tfileOutputStream);\r\n\t\t\tPrintStream printStream = new PrintStream(bufferedOutputStream);\r\n\r\n\r\n\t\t\tfor(Integer i : adjacencyMatrix.keySet())\r\n\t\t\t{\r\n\t\t\t\tfor(Integer j : adjacencyMatrix.get(i))\r\n\t\t\t\t{\r\n\t\t\t\t\tprintStream.println(i+\",\"+j);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprintStream.close();\r\n\t\t} \r\n\t\tcatch (IOException e) {\r\n\t\t\tSystem.out.println(\"ERROR: An io exception occurred while writing file \"+outputFileName);\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t\tcatch ( Exception e ){\r\n\t\t\tSystem.out.println(e.toString());\r\n\t\t\tSystem.out.println(\"ERROR: An exception occurred while writing file\");\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t}", "private void writeToFile(){\n try(BufferedWriter br = new BufferedWriter(new FileWriter(filename))){\n for(Teme x:getAll())\n br.write(x.toString()+\"\\n\");\n br.close();\n }catch (IOException e){\n e.printStackTrace();\n }\n }", "private void updateFile() {\n\t\tPrintWriter outfile;\n\t\ttry {\n\t\t\toutfile = new PrintWriter(new BufferedWriter(new FileWriter(\"stats.txt\")));\n\t\t\toutfile.println(\"15\"); // this is the number\n\t\t\tfor (Integer i : storeInfo) {\n\t\t\t\toutfile.println(i); // we overwrite the existing files\n\t\t\t}\n\t\t\tfor (String s : charBought) {\n\t\t\t\toutfile.println(s); // overwrite the character\n\t\t\t}\n\t\t\tfor (String s : miscBought) {\n\t\t\t\toutfile.println(s);\n\t\t\t}\n\t\t\toutfile.close();\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tSystem.out.println(ex);\n\t\t}\n\t}", "public void printResults(String fileName) {\n\t\ttry {\n\t\t\tPrintWriter writer = new PrintWriter(fileName, \"UTF-8\");\n\t\t\tfor (int i = 0; i < results.size(); i++) {\n\t\t\t\twriter.println(results.get(i).toString());\n\t\t\t}\n\n\t\t\twriter.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.err.println(\"Error while writing to output file\");\n\t\t} finally {\n\t\t\t/*try {\n\t\t\t\twriter.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tSystem.err.println(\"Error while reading input file\");\n\t\t\t}*/\n\t\t}\t\t\n\t}", "public static void runAGeneration() {\n //Breeds Population until max population size for genetic drift\n breedAll();\n\n //Genocides Population by fitness\n genocide();\n\n System.out.println(\"\\nPopulation: \");\n\n //prints population\n printPopulation();\n }", "public static void main(String args[])throws FileNotFoundException {\n PrintStream diskWriter = new PrintStream(new File(\"please.txt\"));\n\n\n int numbers=0;\n Random myRandom = new Random();\n numbers = myRandom.nextInt(10)+1;\n diskWriter.println(numbers);\n System.out.println(numbers);\n\n\n numbers = myRandom.nextInt(10)+1;\n diskWriter.println(numbers);\n System.out.println(numbers);\n //numbers = myRandom.nextInt(10)+1;\n //diskWriter.println(numbers);\n //System.out.println(diskScanner.next());\n\n //numbers = myRandom.nextInt(10)+1;\n //diskWriter.println(numbers);\n // System.out.println(diskScanner.next());\n\n //numbers = myRandom.nextInt(10)+1;\n //diskWriter.println(numbers);\n // System.out.println(diskScanner.next());\n\n //numbers = myRandom.nextInt(10)+1;\n //diskWriter.println(numbers);\n //System.out.println(diskScanner.next());\n\n // numbers = myRandom.nextInt(10)+1;\n //diskWriter.println(numbers);\n //System.out.println(diskScanner.next());\n\n // numbers = myRandom.nextInt(10)+1;\n // diskWriter.println(numbers);\n // System.out.println(diskScanner.next());\n\n }", "public static void main(String[] args) throws IOException\n\t{\n\n\t\tMap<String, Double> pvals = getBestPValues();\n\t\tBufferedWriter writer = Files.newBufferedWriter(Paths.get(\"/home/babur/Documents/mutex/TCGA/PanCan/RankedGenes.txt\"));\n\t\twriter.write(\"Gene\\tMutSig\");\n\t\tpvals.keySet().stream().sorted((g1, g2) -> pvals.get(g1).compareTo(pvals.get(g2))).forEach(g ->\n\t\t\tFileUtil.lnwrite(g + \"\\t\" + pvals.get(g), writer));\n\t\twriter.close();\n\t}", "private static void printSortedArray(String outputFileName) {\n try {\n File output = new File(outputFileName);\n BufferedWriter writer = new BufferedWriter(new FileWriter(output));\n for(int i = 0; i < array.length; i++) {\n writer.write(array[i] + \"\\n\");\n }\n writer.close();\n }\n catch(IOException e){\n System.out.println(\"File Error\");\n }\n }", "public void savePoints(String fileName)\n {\n try\n {\n FileWriter filePointer = new FileWriter(fileName, false); \n PrintWriter output = new PrintWriter(filePointer);\n for (int i = 0; i < nPoints; i++) {\n \n\t Point p = new Point((Point) ensemblePoints.elementAt(i));\n \n String line = (char)(i+65) + \" \" + p.x + \" \" + p.y;\n output.println(line);\n \n \n }\n output.close();\n }\n catch(IOException exp)\n {\n exp.printStackTrace();\n }\n }", "public void print ()\n\t{\n\t\tSystem.out.println(\"Polyhedron File Name: \" + FileName);\n\t\tSystem.out.println(\"Object active: \" + Boolean.toString(isActive()));\n\t\tprintCoordinates();\n\t}", "public void printFilenames(){\n\t\tSystem.out.println(\"\\nAgent list of files: \" + this.filenames.size());\n\t\tfor(int i = 0;i<filenames.size();i++){\n\t\t\tSystem.out.println(i+1+ \") \" + filenames.get(i));\n\t\t}\n\t\tSystem.out.println(\"\");\n\t}", "private void export() {\n print(\"Outputting Instructions to file ... \");\n\n // Generate instructions right now\n List<Instruction> instructions = new ArrayList<Instruction>();\n convertToInstructions(instructions, shape);\n\n // Verify Instructions\n if (instructions == null || instructions.size() == 0) {\n println(\"failed\\nNo instructions!\");\n return;\n }\n\n // Prepare the output file\n output = createWriter(\"output/instructions.txt\");\n \n // TODO: Write configuration information to the file\n \n\n // Write all the Instructions to the file\n for (int i = 0; i < instructions.size(); i++) {\n Instruction instruction = instructions.get(i);\n output.println(instruction.toString());\n }\n\n // Finish the file\n output.flush();\n output.close();\n\n println(\"done\");\n }", "public void writeDot(String filename)\t{\n\t\ttry {\n\t\t\t// PrintWriter(FileWriter) will write output to a file\n\t\t\tPrintWriter output = new PrintWriter(new FileWriter(filename));\n\n\t\t\t// Set up the dot graph and properties\n\t\t\toutput.println(\"digraph BST {\");\n\t\t\toutput.println(\"node [shape=record]\");\n\n\t\t\tif(root != null) {\n\t\t\t\twriteDotRecursive(root, output);\n\t\t\t}\n\t\t\t// Close the graph\n\t\t\toutput.println(\"}\");\n\t\t\toutput.close();\n\t\t}\n\t\tcatch(Exception e){e.printStackTrace();\n\t\t}\n\t}", "void save(int generation) {\n File file = new File(\"network.dat\");\n try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)))) {\n out.write(String.valueOf(generation) + \"\\n\");\n for (float v : weightLayer1)\n out.write(String.valueOf(v) + \"\\n\");\n for (float v : weightLayer2)\n out.write(String.valueOf(v) + \"\\n\");\n out.flush();\n out.close();\n JOptionPane.showMessageDialog(null, \"The Neural Network was saved!\", \"Success\", JOptionPane.INFORMATION_MESSAGE);\n } catch (Exception e) {\n JOptionPane.showMessageDialog(null, \"The Neural Network could not be saved:\\n\" + e.getLocalizedMessage(), \"Error\", JOptionPane.ERROR_MESSAGE);\n }\n }", "private void printFile(Products print, String ufilename) {\n\t\tFile file = new File(\"output\"+File.separator+ufilename+fileId+\".xml\"); \n\t\tSystem.out.println(\"Exporting : \"+ file);\n\t\tJAXBContext jaxbContext;\n\t\ttry {\n\t\t\tjaxbContext = JAXBContext.newInstance(Products.class); \n\t\t\tMarshaller jaxbMarshaller = jaxbContext.createMarshaller();\n\t\t\tjaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);\n\t\t\tjaxbMarshaller.setProperty(\"com.sun.xml.internal.bind.xmlHeaders\", \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\n\t\t\tjaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);\n\t\t\tjaxbMarshaller.marshal(print, file); // prints the file\n\t\t\t// \t\t jaxbMarshaller.marshal(products, System.out);\n\t\t} catch (JAXBException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private static void generateForSingleFile() throws IOException {\n\t\tBufferedWriter out = new BufferedWriter(new FileWriter(singlePatternPath+ filename));\n\t\t\n\t\tIterator iter = countOne.entrySet().iterator();\n\t\twhile(iter.hasNext()) {\n\t\t\tMap.Entry entry = (Entry) iter.next();\n\t\t\tInteger value = (Integer) entry.getValue();\n\t\t\tSequencePair key = (SequencePair) entry.getKey();//System.out.println(\"current\" + \"[\" + key.firstSeq +\":\"+key.secondSeq +\"]\" + \" ; \"+ value);\n\t\t\tout.write(\"[\" + key.firstSeq + \":\" + key.secondSeq + \"]\" +\":\" +value + \"\\n\");\n\t\t}\n\t\tif(out!=null)\n\t\t\tout.close();\n\t\t\n\t\t\n\t\tBufferedWriter out1 = new BufferedWriter(new FileWriter(newSinglePatternPath+filename));\n\t\titer = countTwo.entrySet().iterator();\n\t\twhile(iter.hasNext()) {\n\t\t\tMap.Entry entry = (Entry) iter.next();\n\t\t\tInteger value = (Integer) entry.getValue();\n\t\t\tSequencePair key = (SequencePair) entry.getKey();//System.out.println(\"current\" + \"[\" + key.firstSeq +\":\"+key.secondSeq +\"]\" + \" ; \"+ value);\n\t\t\tout1.write(\"[\" + key.firstSeq + \":\" + key.secondSeq + \"]\" +\":\" +value + \"\\n\");\n\t\t}\n\t\t \n\t\tif(out1!=null)\n\t\t\tout1.close();\n\t}", "private void writeFinalReports() {\n\t\tSystem.out.println(\"Printing data to output files ...\");\n\t\twritePropertyData();\n\t\twriteClassData();\n\t\tSystem.out.println(\"Finished printing data.\");\n\t}", "public void toFile (String nameFile)\n {\n //definir dados\n int i, j;\n int lin;\n int col;\n FILE arquivo;\n\n //obter dimensoes\n lin = lines();\n col = columns();\n\n //verificar se as dimensoes sao validas\n if( lin <= 0 || col <= 0 )\n {\n IO.println(\"ERRO: Tamanho(s) invalido(s). \");\n } //end\n else\n {\n //verificar se tabela e' valida\n if( table == null )\n {\n IO.println(\"ERRO: Matriz invalida. \" );\n } //end\n else\n {\n arquivo = new FILE(FILE.OUTPUT, nameFile);\n arquivo.println(\"\"+ lin);\n arquivo.println(\"\"+ col);\n\n //pecorre para preencher a matriz\n for( i = 0; i < lin; i++)\n {\n for(j = 0; j < col; j++)\n {\n arquivo.println(\"\" + table[ i ][ j ]);\n } //end repetir\n } //end repetir\n //fechar arquivo (indispensavel)\n arquivo.close();\n } //end se\n } //end se\n }", "public void writeFile(String s) {\n\t\ttry\n\t\t{\t\t\t \n\t\t\tPrintWriter writer = new PrintWriter(s, \"UTF-8\");\n\t\t\twriter.println(\"digraph G{\");\n\t\t\tint u;\n\t\t\tint n = vertices();\n\t\t\tfor (u = 0; u < n; u++) {\n\t\t\t for (Edge e: next(u)) {\n\t\t\t \twriter.println(e.from + \"->\" + e.to + \"[label=\\\"\" + e.cost + \"\\\"];\");\n\t\t\t }\n\t\t\t}\n\t\t\twriter.println(\"}\");\n\t\t\twriter.close();\n\t\t} catch (IOException e) {\n\t\t\t\n\t\t}\t\t\t\t\t\t\n }", "public void printBestIndividual() {\n\t\tSystem.out.println(\"Finalizing\");\n\t\tQuoridorBoard board;\n\t\tfor (int t = 0; t < (Math.log(individuals.length) / Math.log(2)); t++) {\n\t\t\tfor (int i = 0; i < individuals.length - 1; i++) {\n\t\t\t\tif (individuals[i].fitness == t) {\n\t\t\t\t\tfor (int j = i + 1; j < individuals.length; j++) {\n\t\t\t\t\t\tif (individuals[j].fitness == t) {\n\t\t\t\t\t\t\tboard = new QuoridorBoard(individuals[i],\n\t\t\t\t\t\t\t\t\tindividuals[j]);\n\t\t\t\t\t\t\tboard.play();\n\t\t\t\t\t\t\tif (board.getWinner() != null) {\n\t\t\t\t\t\t\t\tAI winner = board.getWinner();\n\t\t\t\t\t\t\t\tAI loser = board.getLoser();\n\t\t\t\t\t\t\t\twinner.fitness++;\n\t\t\t\t\t\t\t\tindividuals[i] = winner;\n\t\t\t\t\t\t\t\tindividuals[j] = loser;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tFileWriter fstream = new FileWriter(\"evoOutput.txt\");\n\t\t\tBufferedWriter out = new BufferedWriter(fstream);\n\t\t\tint max1 = 0;\n\t\t\tint max2 = 0;\n\t\t\tAI best1 = new AI();\n\t\t\tAI best2 = new AI();\n\t\t\tfor (AI ai : individuals) {\n\t\t\t\tif (ai.fitness > max1) {\n\t\t\t\t\tmax1 = ai.fitness;\n\t\t\t\t\tbest1 = ai.clone();\n\t\t\t\t} else if (ai.fitness > max2) {\n\t\t\t\t\tmax2 = ai.fitness;\n\t\t\t\t\tbest2 = ai.clone();\n\t\t\t\t}\n\t\t\t}\n\t\t\tout.write(best1.outputString() + \"\\r\\n\" + best2.outputString()\n\t\t\t\t\t+ \"\\r\\n\");\n\t\t\tout.close();\n\t\t\tSystem.out.println(\"Done\");\n\t\t} catch (Exception e) {\n\t\t\tSystem.err.println(\"Error: \" + e.getMessage());\n\t\t}\n\t}", "public static Individual run(int number) {\n\n //Initialize logging of the run\n\n DetailsLogger.startNewLog(detailsLogPrefix + \".\" + number + \".xml\");\n DetailsLogger.logParams(prop);\n\n //Set the rng seed\n\n RandomNumberGenerator.getInstance().reseed(number);\n\n //Create new population\n Population pop = new Population();\n pop.setPopulationSize(popSize);\n pop.setSampleIndividual(new BooleanIndividual(dimension));\n pop.createRandomInitialPopulation();\n\n\n //Set the options for the evolutionary algorithm\n EvolutionaryAlgorithm ea = new EvolutionaryAlgorithm();\n ea.setCPUCores(cpu_cores);\n ea.setFitnessFunction(new ExampleFitnessFunction());\n ea.addMatingSelector(new RouletteWheelSelector());\n ea.addOperator(new OnePtXOver(xoverProb));\n ea.addOperator(new BitFlipMutation(mutProb, mutProbPerBit));\n\n //Run the algorithm\n\n try {\n OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(fitnessFilePrefix + \".\" + number));\n OutputStreamWriter progOut = new OutputStreamWriter(new FileOutputStream(objectiveFilePrefix + \".\" + number));\n\n for (int i = 0; i < maxGen; i++) {\n\n //Make one generation\n ea.evolve(pop);\n ArrayList<Individual> sorted = pop.getSortedIndividuals();\n //Log the best individual to console.\n System.out.println(\"fitness: \" + sorted.get(0).getFitnessValue() + \" \" + sorted.get(0));\n\n //Add population statistics to the logs\n StatsLogger.logFitness(pop, out);\n StatsLogger.logObjective(pop, progOut);\n }\n\n OutputStreamWriter bestOut = new OutputStreamWriter(new FileOutputStream(bestPrefix + \".\" + number));\n\n Individual bestInd = pop.getSortedIndividuals().get(0);\n bestOut.write(bestInd.toString());\n\n out.close();\n progOut.close();\n bestOut.close();\n\n DetailsLogger.writeLog();\n\n return bestInd;\n } catch (Exception e) {\n e.printStackTrace();\n }\n return null;\n }", "public void writeToFile() {\n try {\n // stworz plik\n File file = new File(\"../Alice.ids\");\n // stworz bufor zapisu do pliku\n FileWriter fileWriter = new FileWriter(file);\n for(int i = 0; i < identificationNumbers.length; i++) {\n for(int j = 0; j < identificationNumbers[i].length; j++)\n fileWriter.write(Integer.toString(identificationNumbers[i][j]));\n\t\t\t fileWriter.write(\"\\n\");\n }\n\t\t\tfileWriter.flush();\n\t\t\tfileWriter.close();\n } catch(Exception e) {\n e.printStackTrace();\n }\n }", "public void printGraph(File file) throws OrccException {\r\n \t\ttry {\r\n \t\t\tOutputStream out = new FileOutputStream(file);\r\n \t\t\tDOTExporter<State, UniqueEdge> exporter = new DOTExporter<State, UniqueEdge>(\r\n \t\t\t\t\tnew StringNameProvider<State>(), null,\r\n \t\t\t\t\tnew StringEdgeNameProvider<UniqueEdge>());\r\n \t\t\texporter.export(new OutputStreamWriter(out), getGraph());\r\n \t\t} catch (IOException e) {\r\n \t\t\tthrow new OrccException(\"I/O error\", e);\r\n \t\t}\r\n \t}", "public void writeGraphToFile (String fileName) throws IOException {\r\n int[][] childs = new int[getNumV()*getNumV()][getNumV()];\r\n for(int i =0; i< getNumV(); i++)\r\n for(int j =0; j< getNumV(); j++)\r\n childs[i][j] = -1;\r\n\r\n boolean[] visited = new boolean[getNumV()];\r\n for (int i=0; i<getNumV(); i++)\r\n visited[i] = false;\r\n\r\n for(int vertex = 0; vertex<getNumV(); vertex++) {\r\n Queue<Integer> theQueue = new LinkedList<Integer>();\r\n theQueue.offer(vertex);\r\n while (!theQueue.isEmpty()) {\r\n int current = theQueue.remove();\r\n visited[current] = true;\r\n Iterator<Edge> itr = edgeIterator(current);\r\n while (itr.hasNext()) {\r\n Edge edge = itr.next();\r\n int neighbor = edge.getDest();\r\n\r\n if(!visited[neighbor])\r\n theQueue.offer(neighbor);\r\n\r\n childs[current][neighbor] = 1;\r\n }\r\n }\r\n }\r\n\r\n File file = new File(fileName);\r\n FileWriter fW = new FileWriter(file);\r\n BufferedWriter bW = new BufferedWriter(fW);\r\n String s = \"\";\r\n s += getNumV();\r\n bW.write(s.toString());\r\n bW.write(\"\\n\");\r\n\r\n for(int i= 0; i<getNumV(); i++){\r\n for(int j = 0; j < getNumV(); j++){\r\n if(childs[i][j] == 1){\r\n s = \"\";\r\n s += i;\r\n s += \" \";\r\n s += j;\r\n s += \"\\n\";\r\n bW.write(s.toString());\r\n }\r\n }\r\n }\r\n bW.close();\r\n }", "public void toFile(String filename) {\n\t\tString serialized = Serializer.serializeLevelPack(this);\n\t\tSerializer.writeToFile(filename, serialized.getBytes());\n\t}", "public void printAll() {\r\n\t\t\t\t\r\n\t\tSystem.out.println(\"################\");\r\n\t\tSystem.out.println(\"Filename:\" +getFileName());\r\n\t\tSystem.out.println(\"Creation Date:\" +getCreationDate());\r\n\t\tSystem.out.println(\"Genre:\" +getGenre());\r\n\t\tSystem.out.println(\"Month:\" +getMonth());\r\n\t\tSystem.out.println(\"Plot:\" +getPlot());\r\n\t\tSystem.out.println(\"New Folder Name:\" + getNewFolder());\r\n\t\tSystem.out.println(\"New Thumbnail File Name:\" +getNewThumbnailName());\r\n\t\tSystem.out.println(\"New File Name:\" +getNewFilename());\r\n\t\tSystem.out.println(\"Season:\" +getSeason());\r\n\t\tSystem.out.println(\"Episode:\" +getEpisode());\r\n\t\tSystem.out.println(\"Selected:\" +getSelectEdit());\r\n\t\tSystem.out.println(\"Title:\" +getTitle());\r\n\t\tSystem.out.println(\"Year:\" +getYear());\r\n\t\tSystem.out.println(\"Remarks:\" +getRemarks());\r\n\t\tSystem.out.println(\"################\");\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "public static void PrintAllProperties(String output_filename, ArrayList<Apartment> apartments, ArrayList<House> houses, ArrayList<Villa> villas) {\n String output_information = \"\";\n\n String apartment_title = (\"********************************************************Apartment Information********************************************************\");\n System.out.println(apartment_title);\n for (Apartment a : apartments) {\n String apartments_information = (\"Register Number:\" + a.getRegister_number() + \" PropertyId:\"+ a.getPropertyID() +\" Owner name:\" + a.getOwner_name() + \" Address: \" + a.getPostal_address() + \" Cost/day(€):\"\n + a.getRental_cost_per_day() + \" Number of Storey:\" + a.getStorey_number() + \" Number of Beds:\"\n + a.getNumber_of_beds());\n System.out.println(apartments_information);\n output_information += apartment_title+ \"\\n\" + apartments_information + \"\\n\";\n }\n System.out.println();\n\n String house_title = (\"********************************************************House Information********************************************************\");\n System.out.println(house_title);\n for (House h : houses) {\n String houses_information = (\"Register Number:\" + h.getRegister_number() + \" PropertyId:\"+ h.getPropertyID() + \" Owner name:\" + h.getOwner_name() + \" Address: \" + h.getPostal_address() + \" Cost/day(€):\"\n + h.getRental_cost_per_day() + \" Number of Storey:\" + h.getNumber_of_storeys() + \" Clearing Fees(€):\"\n + h.getClearing_fees());\n System.out.println(houses_information);\n output_information += house_title + \"\\n\"+ houses_information + \"\\n\";\n }\n System.out.println();\n\n String villas_title = (\"***********************************************************Villa Information***********************************************************\");\n System.out.println(villas_title);\n for (Villa v : villas) {\n String villas_information = (\"Register Number:\" + v.getRegister_number() + \" PropertyId:\"+ v.getPropertyID() + \" Owner name:\" + v.getOwner_name() + \" Address: \" + v.getPostal_address() + \" Cost/day(€):\"\n + v.getRental_cost_per_day() + \" Luxury Tax/day(€):\" + v.getLuxury_tax_per_day() + \" Room Service/day(€):\"\n + v.getRoom_service_cost_per_day());\n System.out.println(villas_information);\n output_information += villas_title + \"\\n\" + villas_information + \"\\n\";\n }\n System.out.println();\n\n try{\n PrintWriter myOutFile = new PrintWriter(output_filename);\n myOutFile.write(output_information);\n myOutFile.close();\n }\n catch(Exception ex){\n System.out.println(\"exception\" +ex.getMessage()+\"caught\");\n }\n }", "public static void Save(String filename) throws IOException {\n\t\tFileWriter fw=new FileWriter(filename);\r\n\t\tround=A1063307_GUI.round;\r\n\t\twho=A1063307_GUI.who2;\r\n\t\tfw.write(\"Round:\"+round+\",Turn:\"+who+\"\\n\");\r\n\t\tint t2=1;\r\n\t\twhile(t2<(linenumber)) {\r\n\t\t\tint zz=0;\r\n\t\t\twhile(zz<5) {\r\n\t\t\t\tif(zz==0) {\t\t\r\n\t\t\t\t\tch[t2].location=ch[t2].location%20;\r\n\t\t\t\t fw.write(Integer.toString(ch[t2].location)+\",\");\r\n\t\t\t\t}\r\n\t\t\t\telse if(zz==1){\r\n\t\t\t\t fw.write(Integer.toString(ch[t2].CHARACTER_NUMBER)+\",\");\r\n\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\telse if(zz==2){\r\n\t\t\t\t\tfw.write(Integer.toString(ch[t2].money)+\",\");\r\n\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t else if(zz==3){\r\n\t\t\t \tfw.write(Integer.toString(ch[t2].status)+\",\");\r\n\t\t\t \r\n\t\t\t \t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tfw.write(ch[t2].IMAGE_FILENAME);\t\t\t\t\r\n\t\t\t\t\t }\r\n\t\t\t\tzz++;\r\n\t\t\t}\r\n\t\t\tfw.write(\"\\n\");\r\n\t\t\tt2++;\r\n\t\t}\r\n\t\tfw.close();\r\n\t\tFileWriter fw1=new FileWriter(\"Land.txt\");\r\n\t\tfw1.write(\"LOCATION_NUMBER, owner\\n\");\r\n\t\tfor(int i=1;i<17;i++) {\r\n\t\t\tfw1.write(Land[i].PLACE_NUMBER+\",\"+Land[i].owner+\"\\n\");\r\n\t\t}\r\n\t\tfw1.close();\r\n\t}", "public static void createFile(String name)\n {\n file = new File(name);\n try\n {\n if(file.exists())\n {\n file.delete();\n file.createNewFile();\n }else file.createNewFile();\n \n fileWriter = new FileWriter(file);\n fileWriter.append(\"Generation, \");\n fileWriter.append(\"Fitness, \");\n fileWriter.append(\"Average\\n\");\n \n }catch (IOException e) \n {\n System.out.println(e);\n }\n \n }", "private void print(List<String> list, int fileNum, String dir){\n\n //controlling existance of results directory\n File resDir = new File(dir+\"/A_results/\");\n resDir.mkdir();\n\n try {\n PrintWriter resWriter = new PrintWriter(dir+\"/A_results/result\"+fileNum+\".\"+writeExtention, \"UTF-8\");\n for(String s : list) {\n resWriter.println(s);\n resWriter.flush();\n }\n\n resWriter.close();\n } catch (FileNotFoundException | UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n }", "protected void displayPopulation() {\n \n /**/println(\"\\nDisplaying population:\", 0);\n for(int i = 0; i < population_size; i++) {\n println(\"i = \" + i, 1);\n if(population[i] == null) {\n //System.exit(0);\n }\n displayChromosome(population[i], 0);\n }\n }" ]
[ "0.7024915", "0.6673083", "0.6471239", "0.6422034", "0.6411737", "0.61551553", "0.61059797", "0.59406614", "0.59298736", "0.5927084", "0.5920488", "0.5905651", "0.58804584", "0.5858048", "0.58388495", "0.5832265", "0.5830726", "0.58191675", "0.58149254", "0.5811971", "0.58111054", "0.5807694", "0.5792694", "0.57916903", "0.57911867", "0.5777791", "0.5751392", "0.57380795", "0.57209665", "0.5703749", "0.56837577", "0.56834644", "0.56745744", "0.5672399", "0.56609166", "0.56364113", "0.5628678", "0.56070036", "0.5602874", "0.55962306", "0.5569251", "0.55613524", "0.55535984", "0.5552966", "0.5552411", "0.55452275", "0.553655", "0.55328923", "0.5525339", "0.55245924", "0.5517572", "0.55171466", "0.551006", "0.55006427", "0.54960364", "0.5477833", "0.54751444", "0.54738873", "0.5465121", "0.54639775", "0.5461815", "0.5454691", "0.5452451", "0.54484284", "0.5447481", "0.54474133", "0.5438948", "0.5429789", "0.5427138", "0.5421557", "0.540886", "0.5392573", "0.5386354", "0.5386318", "0.5382211", "0.5373276", "0.53695023", "0.536748", "0.53611547", "0.5356995", "0.53554857", "0.5353221", "0.5352597", "0.5352124", "0.5344857", "0.5325837", "0.5316374", "0.53141624", "0.53128576", "0.5308621", "0.5305558", "0.53044295", "0.5294829", "0.52923954", "0.5290181", "0.52884096", "0.52879596", "0.52820307", "0.5270027", "0.526413" ]
0.78238404
0
Since many of the individuals in population have same fitness, we will perform one more tournament.
public void printBestIndividual() { System.out.println("Finalizing"); QuoridorBoard board; for (int t = 0; t < (Math.log(individuals.length) / Math.log(2)); t++) { for (int i = 0; i < individuals.length - 1; i++) { if (individuals[i].fitness == t) { for (int j = i + 1; j < individuals.length; j++) { if (individuals[j].fitness == t) { board = new QuoridorBoard(individuals[i], individuals[j]); board.play(); if (board.getWinner() != null) { AI winner = board.getWinner(); AI loser = board.getLoser(); winner.fitness++; individuals[i] = winner; individuals[j] = loser; } break; } } } } } try { FileWriter fstream = new FileWriter("evoOutput.txt"); BufferedWriter out = new BufferedWriter(fstream); int max1 = 0; int max2 = 0; AI best1 = new AI(); AI best2 = new AI(); for (AI ai : individuals) { if (ai.fitness > max1) { max1 = ai.fitness; best1 = ai.clone(); } else if (ai.fitness > max2) { max2 = ai.fitness; best2 = ai.clone(); } } out.write(best1.outputString() + "\r\n" + best2.outputString() + "\r\n"); out.close(); System.out.println("Done"); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void runTournament() {\n\t\t//ArrayList<Gene> tournament = new ArrayList<Gene>();\n\t\tPriorityQueue<Gene> tournament = new PriorityQueue<Gene>(Collections.reverseOrder());\n\t\tint numContenders = (int)(FRAC_IN_TOURNAMENT * geneNumber);\n\t\tSet<Integer> chosenOnes = new HashSet<Integer>();\n\t\t\n\t\twhile(chosenOnes.size() < numContenders) {\n\t\t\tint randIndex = (int) (Math.random() * geneNumber);\n\t\t\tchosenOnes.add(randIndex);\n\t\t}\n\t\tfor(int i : chosenOnes){\n\t\t\ttournament.add(genepool.get(i));\n\t\t}\n\t\t//int firstIndex = getMax(tournament, -1);\n\t\t//int secondIndex = getMax(tournament, firstIndex);\n\t\t//Gene parent1 = tournament.get(firstIndex);\n\t\t//Gene parent2 = tournament.get(secondIndex);\n\t\tGene parent1 = tournament.poll();\n\t\tGene parent2 = tournament.poll();\n\t\t// Create a new gene from the 2 fittest genes\n\t\tGene newGene = parent1.waCrossover(parent2);\n\t\t\n\t\t// Calculate fitness for the new gene\n\t\tPlayerSkeleton.runGames(numGames, newGene);\n\t\toffspringPool.add(newGene);\n\t}", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "protected void SelectTournament() {\n\t // Torneo.length -> tournament size\n\t // if (tournament size == 2) then BinaryTournament\n this.setRanking();\n\t \n\t for (int i=0; i<this.PopLength; i++) {\n\t Torneo[0] = Randint(0,this.PopLength-1);\n\t int mejor_torneo=Torneo[0];\n\t \n\t for (int j=1; j<Torneo.length; j++) {\n\t boolean repetido= false;\n\t do {\n\t Torneo[j] = Randint(0,this.PopLength-1);\n\t repetido=false;\n\t int k=0;\n\t while ((k<j) && (!repetido))\n\t if (Torneo[j]==Torneo[k])\n\t repetido=true;\n\t else\n\t k++;\n\t } while (repetido);\n\t \n\t if (OLDevaluation[Torneo[j]] < OLDevaluation[mejor_torneo])\n\t mejor_torneo=Torneo[j];\n\t }\n\t sample[i] = mejor_torneo;\n\t }\n\t // Se crea la nueva poblacion\n\t for (int n=0; n<this.PopLength; n++) {\n\t int kk=sample[n];\n\t for (int m=0; m<this.NbGenes; m++) {\n\t NEWpopulation[n][m]= OLDpopulation[kk][m];\n\t }\n\t NEWevaluation[n]= OLDevaluation[kk];\n\t NEWevalIndex[n]= OLDevalIndex[kk];\n\t }\n }", "private int tournament()\r\n {\r\n\tint out = spinTheWheel();\r\n\tdouble max = ff.evaluate(chromos.get(out),generation());\r\n\tdouble temp_fitness = 0;\r\n\tint temp_index = 0;\r\n\r\n\tfor(int i = 0; i < selPara - 1 + tourStep*generation(); i++)\r\n\t {\r\n\t\ttemp_index = spinTheWheel();\r\n\t\ttemp_fitness = ff.evaluate(chromos.get(temp_index),generation());\r\n\t\tif(temp_fitness > max)\r\n\t\t {\r\n\t\t\tmax = temp_fitness;\r\n\t\t\tout = temp_index;\r\n\t\t }\r\n\t }\r\n\treturn out;\r\n }", "public int tournament(int size) {\n\t\t\n\t\tint best = 0;\n\t\tfloat bestFitness = Float.NEGATIVE_INFINITY;\n\t\t\n\t\t//selects the best individual from randomly sampled tournament participants\n\t\tfor(int i = 0; i < size; i++){\n\t\t\tint index = R.nextInt(populationSize);\n\t\t\tif(fitness[index] > bestFitness){\n\t\t\t\tbestFitness = fitness[index];\n\t\t\t\tbest = index;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn best;\n\t}", "private static Tour tournamentSelection(Population pop) {\n // Create a tournament population\n Population tournament = new Population(tournamentSize, false);\n // For each place in the tournament get a random candidate tour and\n // add it\n for (int i = 0; i < tournamentSize; i++) {\n int randomId = (int) (Math.random() * pop.populationSize());\n tournament.saveTour(i, pop.getTour(randomId));\n }\n // Get the fittest tour\n Tour fittest = tournament.getFittest();\n return fittest;\n }", "public void tournamentWithElitism(){\n\t\tEvolvable spring[] = new Evolvable[populationSize];\n\t\t\n\t\t//elite individuals go directly to new population\n\t\tfor (int i = 0; i < SNSLearningAgent.elitism; i++){\n\t\t\tspring[i] = population[i];\t\n\t\t}\n\t\t\n\t\t//other individuals are selected via tournament\n\t\tfor (int i = SNSLearningAgent.elitism; i < populationSize; i+=2) {\n\t\t\t//parents selected via tournament\n\t\t\tint p1 = tournament(SNSLearningAgent.tournamentSize);\t\n\t\t\tint p2 = tournament(SNSLearningAgent.tournamentSize);\n\t\t\twhile(p1 == p2)\tp2 = tournament(SNSLearningAgent.tournamentSize);\n\t\t\t\n\t\t\t//performs crossover if probability is matched\n\t\t\tif(R.nextFloat() < SNSLearningAgent.crossoverProb){\n\t\t\t\tif (crossBehavior.equals(\"freeSplitCross\")){\n\t\t\t\t\tint point = R.nextInt(SNSAgent.DNA_LENGTH);\n\t\t\t\t\t\n\t\t\t\t\tspring[i] = cross(population[p1], population[p2], point);\n\t\t\t\t\tif (i+1 < populationSize) spring[i+1] = cross(population[p2], population[p1], point);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tspring[i] = cross(population[p1], population[p2]);\n\t\t\t\t\tif (i+1 < populationSize) spring[i+1] = cross(population[p2], population[p1]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\tspring[i] = population[p1];\n\t\t\t\tif (i+1 < populationSize) spring[i+1] = population[p2];\n\t\t\t}\n\t\t\t\n\t\t\t//performs mutation if probability is reached\n\t\t\tif(R.nextFloat() < SNSLearningAgent.mutationProb){\n\t\t\t\tspring[i].mutate();\n\t\t\t}\n\t\t\tif(i+1 < populationSize && R.nextFloat() < SNSLearningAgent.mutationProb){\n\t\t\t\tspring[i+1].mutate();\n\t\t\t}\n\t }\n\t\t\n\t\t//replaces old population with the new one\n\t\tfor(int i = 1; i < populationSize; i++) {\n\t\t\tpopulation[i] = spring[i];\n\t\t}\n\t}", "@Override\n\t// Select individuals for crossover\n\tprotected Individual tournamentSelection(Population pop) {\n\t\tSortingIndividual baseIndiv = (SortingIndividual) pop.individuals[0];\n\t\tPopulation tournament = new SortingPopulation(tournamentSize, baseIndiv.getBase(), false);\n\t\t// For each place in the tournament get a random individual\n\t\tfor (int i = 0; i < tournamentSize; i++) {\n\t\t\tint randomId = (int) (Math.random() * pop.size());\n\t\t\ttournament.saveIndividual(i, pop.getIndividual(randomId));\n\t\t}\n\t\t// Get the fittest\n\t\tIndividual fittest = tournament.getFittest();\n\t\treturn fittest;\n\t}", "public static Population evolvePopulation(Population pop) {\n Population newPopulation = new Population(pop.populationSize(), false);\n\n // Keep our best individual if elitism is enabled\n int elitismOffset = 0;\n if (elitism) {\n newPopulation.saveTour(0, pop.getFittest());\n elitismOffset = 1;\n }\n\n // Crossover population\n // Loop over the new population's size and create individuals from\n // Current population\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n // Select parents\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n\n\n\n\n Tour[] temp_a = roullet( newPopulation);\n if( temp_a == null )\n {\n System.out.println(\"no a\");\n //r//eturn temp;\n }\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n Tour parent1 = temp_a[0];\n Tour parent2 = temp_a[1];\n\n\n\n\n\n\n\n\n // Crossover parents\n Tour child = crossover(parent1, parent2);\n // Add child to new population\n newPopulation.saveTour(i, child);\n }\n\n // Mutate the new population a bit to add some new genetic material\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n mutate(newPopulation.getTour(i));\n }\n\n return newPopulation;\n }", "private Vector step(){\n// System.out.println();\n// System.out.println(generationCount);\n// System.out.println(\"The Population is:\");\n// System.out.println(population);\n \n //DETERMINE WHO SURVIVES INTO NEXT GENERATION\n Vector nextGeneration = surviveType.run(population, fitnessArray);\n\n //DO THE CROSSOVER PROCESS\n //WHILE THE NEXT GENERATION ISN'T FULL\n while (nextGeneration.size() < (populationSize - randGenes)){\n //FIND PARENTS\n Gene parentOne, parentTwo;\n do {\n Gene[] parents = selectType.run(population, fitnessArray);\n parentOne = parents[0];\n parentTwo = parents[1];\n } while (selectPairs && (! closeEnough(parentOne, parentTwo)));\n //ADD CHILDREN\n Gene[] kids = crossType.children(parentOne, parentTwo);\n\n nextGeneration.add(kids[0]);\n if (nextGeneration.size() < (populationSize - randGenes)){\n nextGeneration.add(kids[1]);\n }\n }\n //ADD RANDOM GENES TO THE POPULATION\n while (nextGeneration.size() < populationSize){\n nextGeneration.add(initializer.createRandomGene(fitnessFunction, minRadius, maxRadius));\n }\n //MUTATE THE NEXT GENERATION\n for (int j = 0; j < populationSize; j++){\n if (Math.random() < mutationProb){\n nextGeneration.set(j, mutationType.run((Gene) nextGeneration.get(j)));\n }\n }\n\n //COMPUTE FITNESSES AND RELOCATE IF NECESSARY\n Gene bestGene = (Gene) nextGeneration.get(0);\n int bestX = 0;\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n while (relocationType.move(bannedList, next)){\n Gene newGene = initializer.createRandomGene(fitnessFunction, minRadius, maxRadius);\n next = newGene;\n nextGeneration.set(x, next);\n }\n fitnessArray[x] = next.getFitness();\n\n //FOR THE PURPOSES OF UPDATING THE BANNED LIST\n if (next.getFitness() > bestGene.getFitness()){\n bestGene = next;\n bestX = x;\n }\n } //End for (int x = 0;...\n\n Arrays.sort(fitnessArray);\n\n //UPDATE THE BANNED LIST BY ADDING THE BEST GENE IN THE NEXT GENERATION IF IT'S ABOVE minAccepted AND CONTAINS MORE THAN minPoints POINTS\n if (useList){\n if ((generationCount >= firstAdd) &&\n (solutionCounter >= countNum) &&\n (bestGene.getFitness() >= minAccepted) &&\n (bestGene.getCount() >= minPoints)){\n solutionCounter = 0;\n// System.out.println(bestGene);\n Gene bestClone = new Gene (bestGene.getMajorAxisRadius(), //THIS KLUDGE IS DONE B/C .clone() IS\n bestGene.getMinorAxisRadius(), //PROTECTED, AND I CAN'T UNPROTECT IT.\n bestGene.getX(), //I USE A CLONED GENE TO PREVENT A MUTATION\n bestGene.getY(), //IN THE NEXT GENERATION FROM ALTERING bannedList\n bestGene.getOrientation(),\n bestGene.getFunction());\n bannedList = relocationType.updateBannedList(bannedList, bestClone);\n\n\n //IF NECESSARY, UPDATE THE SOLUTION LIST BY ADDING ALL CLUSTERS WITH MORE THAN minPoints POINTS AND A FITNESS OF AT LEAST minAccepted\n if (returnAllSolutions){\n for (int i = 0; i < populationSize; i++){\n Gene next = (Gene) nextGeneration.get(i);\n if ((next.getFitness() >= minAccepted) && (next.getCount() >= minPoints)){\n solutionList.add(next);\n }\n }//End for (int i = 0...\n } else {\n solutionList = bannedList;\n } //End if (returnAllSolutions){...}else{\n } //End if (generationCount > 4...\n } //End if (useList){\n\n generationCount = generationCount + 1;\n solutionCounter = solutionCounter + 1;\n\n //IF AVOIDING CONVERGENCE, AND IT HAS CONVERGED, START OVER WITH RANDOM GENES\n\n double bestFitness = bestGene.getFitness();\n double medianFitness = roundToHundredths((double) fitnessArray[(int) Math.floor(populationSize / 2)]);\n\n// System.out.println(bestFitness);\n// System.out.println(medianFitness);\n\n if ((antiConvergence) &&\n ((bestFitness - medianFitness) < (0.01 * bestFitness)) &&\n (generationCount > firstAdd)){\n nextGeneration = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n// System.out.println(\"EXPLODED CONVERGENCE!\");\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n fitnessArray[x] = next.getFitness();\n }\n Arrays.sort(fitnessArray);\n }\n\n return nextGeneration;\n }", "public void modifyFitness(Population population) {\n // prepare the calculation\n double[][] data = new double[population.size()][];\n for (int i = 0; i < data.length; i++) {\n data[i] = ((AbstractEAIndividual)population.get(i)).getFitness();\n }\n double min = Double.POSITIVE_INFINITY, fitnessSharing;\n double[] result = new double[data.length];\n AbstractEAIndividual tmpIndy;\n\n for (int x = 0; x < data[0].length; x++) {\n for (int i = 0; i < data.length; i++) data[i][x] = -data[i][x];\n for (int i = 0; i < data.length; i++) {\n if (data[i][x] < min) min = data[i][x];\n }\n\n for (int i = 0; i < data.length; i++) {\n // This will cause the worst individual to have no chance of being selected\n // also note that if all individual achieve equal fitness the sum will be zero\n result[i] = data[i][x] -min + 0.1;\n }\n\n for (int i = 0; i < population.size(); i++) {\n tmpIndy = (AbstractEAIndividual)population.get(i);\n fitnessSharing = 0;\n for (int j = 0; j < population.size(); j++) {\n if (this.m_SharingDistance < this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))) {\n fitnessSharing += 1 - (this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))/this.m_SharingDistance);\n }\n }\n result[i] = result[i]/fitnessSharing;\n }\n\n for (int i = 0; i < population.size(); i++) {\n ((AbstractEAIndividual)population.get(i)).SetFitness(x, result[i]);\n }\n }\n }", "public void runGeneticAlgo() {\n\t\tint offspringLimit = (int)(OFFSPRING_POOL_LIMIT * geneNumber);\n\t\tint factor = (int) Math.pow(10, String.valueOf(offspringLimit).length() - 1);\n\t\twhile(offspringPool.size() < offspringLimit) {\n\t\t\trunTournament();\n\t\t\tif(offspringPool.size() % factor == 0) {\n\t\t\t\tSystem.out.println(\"Finished \" + offspringPool.size() + \" tournaments\");\n\t\t\t}\n\t\t}\n\t\tsortPool();\n\t\tArrayList<Gene> newGenepool = new ArrayList<Gene>(genepool.subList(0, geneNumber - offspringLimit));\n\t\tnewGenepool.addAll(offspringPool);\n\t\tgenepool = newGenepool;\n\t\toffspringPool = new ArrayList<Gene>();\n\t}", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "public AIAssign2(){\n \n Scanner console = new Scanner(System.in);\n \n System.out.print(\"Input population size \");\n popsize = console.nextInt();\n \n System.out.print(\"Input tournament size \");\n tournysize = console.nextInt();\n \n System.out.print(\"Input crossover chance (%) \");\n crossprob = console.nextDouble();\n \n System.out.print(\"Input mutation chance (%) \");\n mutaprob = console.nextDouble();\n \n System.out.print(\"Input max generation size \");\n maxgen = console.nextInt();\n \n System.out.print(\"Input problem width \");\n width = console.nextInt();\n \n System.out.print(\"Input problem height \");\n height = console.nextInt();\n \n System.out.print(\"Input start location x-1 \");\n startx = console.nextInt();\n \n System.out.print(\"Input start location y-1 \");\n starty = console.nextInt();\n \n System.out.print(\"Input seed value \");\n seed = console.nextLong();\n \n Random rnd = new Random(seed);\n \n population = new int[popsize][height*width];\n population2 = new int[popsize][height*width];\n popfitness = new int[popsize];\n \n for (int i = 0 ; i<popsize ; i++){\n for (int j = 0 ; j<population[0].length ; j++){\n population[i][j] = (rnd.nextInt(4));\n }\n }\n Print(population);\n \n //the generation loop\n for (int gen = 0 ; gen < maxgen ; gen++){\n \n //fitness of individuals is stored\n int btemp = 0;\n for (int i = 0 ; i < popsize ; i++){\n \n problem = new char[width][height];\n problem[startx][starty] = 'S';\n \n popfitness[i] = Fitness(population[i], problem, startx, starty, 0);\n \n if (popfitness[i] > btemp){ btemp = popfitness[i];}\n }\n bestavg = bestavg + btemp;\n \n String line=\"\";\n int avg=0;\n for (int i = 0 ; i < popsize ; i++){\n line = line + \"[\" + popfitness[i] + \"] \"; \n avg = avg + popfitness[i];\n }\n avg = avg/popsize;\n avgavg = avgavg + avg;\n bestavg = bestavg / (gen+1);\n avgavg = avgavg / (gen+1);\n System.out.println(\"Gen: \"+gen + \" Fitness: \"+ line + \" Avg: \"+ avg + \" BestAvg: \" + bestavg + \" AvgAvg: \" + avgavg);\n bestavg = bestavg * (gen+1);\n avgavg = avgavg * (gen+1);\n \n //Tournament selection\n for (int i = 0 ; i < popsize ; i++){\n int best = 0; \n int rand = (int)(rnd.nextInt(popsize));\n best = rand;\n \n for (int k = 0 ; k < tournysize ; k++){\n if (popfitness[rand] > popfitness[best]){\n best = rand;\n }\n \n rand = (int)(rnd.nextInt(popsize));\n }\n population2[i] = Copy(population[best]); \n }\n \n //single-focus-flip and block exchange mutations\n for (int i = 0 ; i < popsize-1 ; i++){\n if (crossprob > rnd.nextInt(100)){\n int temp; \n for (int a = 0 ; a < 5 ; a++){\n temp = population2[i][a];\n population2[i][a] = population2[i+1][a];\n population2[i+1][a] = temp;\n }\n }\n }\n \n for (int i = 0 ; i < popsize ; i++){\n if (mutaprob > rnd.nextInt(200)){\n int temp = (int) (rnd.nextInt(population2[0].length)); \n population2[i][temp] = (int)(rnd.nextInt(4));\n }\n else if (mutaprob > rnd.nextInt(200)){\n for (int j = 0 ; j < population2[0].length/2 ; j++){\n int temp = population2[i][j];\n population2[i][j] = population2[i][population2[0].length-1-j];\n population2[i][population2[0].length-1-j] = temp;\n }\n }\n }\n \n population = population2;\n population2 = new int[popsize][population[0].length];\n \n }\n \n bestavg = bestavg / maxgen;\n avgavg = avgavg / maxgen;\n Print(population);\n System.out.println(\"Best Avg: \" + bestavg + \" Average of Avg: \" + avgavg);\n }", "public static void main(String[] args) {\n String fileName = \"data1.txt\";\n \n \n //Load the data from the dataset file\n dataSet = getDataSet(fileName);\n \n //Setting up the output file\n String outputFileName = \"\";\n if (fileName.indexOf(\".\") > 0) {\n outputFileName = fileName.substring(0, fileName.lastIndexOf(\".\"));\n }\n \n createFile(outputFileName+\".csv\");\n \n //log the time the algorithm started\n long startTime = System.currentTimeMillis();\n \n //Placeholder of the fittest individual\n fittestIndividual = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n fittestIndividual.generateRulebase(); \n \n //Setup the mating pool\n matingPool = setupArray(POP_SIZE, NUM_RULES, GENE_SIZE, COND_LEN);\n \n //used to run the GA multiple times without doing it manually\n //set to 1 because we want to run the GA once\n for (int a = 0; a < 1; a++) {\n currentBest = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n currentBest.generateRulebase();\n\n //Generate a population\n generatePopulation();\n\n //Initial calculation of the fitness\n calculateFitness(population);\n\n for (int i = 0; i < GENERATION; i++) {\n average = 0; //reset the average\n currentBestArray[i] = currentBest.getFitness();\n \n tournamentSelect(population);\n\n //Calculate the fitness of the mating pool\n calculateFitness(matingPool);\n\n //Perfrom crossover on the mating pool\n crossover(matingPool);\n\n //Mutation\n mutation(matingPool);\n\n //Calculate the fitness of the mating pool\n calculateFitness(matingPool);\n\n //Evaluate the current population\n for (Individual individual : matingPool) {\n if (individual.getFitness() > currentBest.getFitness()) {\n currentBest = new Individual(individual);\n }\n average = average + individual.getFitness();\n }\n \n\n //Replace the population with the new generation\n for (int j = 0; j < POP_SIZE; j++) {\n population[j] = new Individual(matingPool[j]);\n }\n \n averageArray[i] = average / POP_SIZE;\n }\n \n //Check whether the current best is fitter than the global fittest individual\n if (currentBest.fitness > fittestIndividual.fitness) {\n fittestIndividual = new Individual(currentBest);\n //copy the fittest individuals performance\n fittestArray = Arrays.copyOf(currentBestArray, currentBestArray.length);\n }\n }\n\n System.out.println(\"Best fitness generated for the dataset: \" + fittestIndividual.fitness);\n \n //output the rules\n printRules(fittestIndividual.getRulebase());\n \n //Save the performance data into the output file\n for (int i = 0; i < fittestArray.length; i++) {\n addToFile(i, fittestArray[i], averageArray[i]);\n }\n \n //close the file\n close();\n \n //Evaluate the fitness agaisnt the dataset\n calculateFitness(fittestIndividual);\n double accuracyPercentage = ((double) 100 / dataSet.size()) * fittestIndividual.fitness;\n System.out.format(\"%.2f%% accuracy on the datase set.\\n\", accuracyPercentage);\n \n //Log the duration it took\n long duration = System.currentTimeMillis() - startTime;\n System.out.println(\"Completed in \" + String.format(\"%02d min, %02d.%02d sec\",\n TimeUnit.MILLISECONDS.toMinutes(duration),\n TimeUnit.MILLISECONDS.toSeconds(duration)\n - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)),\n TimeUnit.MILLISECONDS.toMillis(duration) - TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(duration))\n ));\n }", "int tournament() {\r\n \tint ch1,ch2;\r\n\t\tch1 = (int)Math.floor(Math.random()*SIZE);\r\n\t\tdo {\r\n\t\t\tch2 = (int)Math.floor(Math.random()*SIZE);\r\n\t\t} while (ch1==ch2);\r\n\t\tif (fit[ch1]<fit[ch2]) return ch1;\r\n\t\telse return ch2;\r\n }", "protected void evolve()\n\t\t{\tif(this_gen < NUMBER_GENERATIONS) {\n\t\t\t\t// Create a new generation.\n\t\t\t\tfloat avg_fit=Float.MIN_VALUE, max_fit=Float.MIN_VALUE, sum_fit=0;\n\t\t\t\tfloat tot_wait=0, avg_wait=0, tot_move=0, avg_move=0;\n\n\t\t\t\tfor(int i=0;i<NUMBER_INDIVIDUALS;i++) {\n\t\t\t\t\tfloat fit = calcFitness(inds[i]);\n\t\t\t\t\tinds[i].setFitness(fit);\n\t\t\t\t\tsum_fit\t += fit;\n\t\t\t\t\tmax_fit = fit>max_fit ? fit : max_fit;\n\t\t\t\t\ttot_wait += inds[i].getWait();\n\t\t\t\t\ttot_move += inds[i].getMove();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tavg_wait = tot_wait/NUMBER_INDIVIDUALS;\n\t\t\t\tavg_move = tot_move/NUMBER_INDIVIDUALS;\n\t\t\t\tavg_fit = sum_fit/NUMBER_INDIVIDUALS;\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"Stats of prev. gen: (a-wait,a-move)=(\"+avg_wait+\",\"+avg_move+\")\"+\" (a-fit,mx-fit)=(\"+avg_fit+\",\"+max_fit+\")\");\n\t\t\t\tSystem.out.println(\"Evolving...\");\n\t\t\t\t\n\t\t\t\t// Sorts the current Individual-array on fitness, descending\n\t\t\t\tinds = sortIndsArr(inds);\n\t\t\t\t\n\t\t\t\tint num_mating = (int) Math.floor(NUMBER_INDIVIDUALS*(1-ELITISM_FACTOR));\n\t\t\t\tint num_elitism = (int) Math.ceil(NUMBER_INDIVIDUALS*ELITISM_FACTOR);\n\t\t\t\tif(num_mating%2!=0) {\n\t\t\t\t\tnum_mating--;\n\t\t\t\t\tnum_elitism++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tIndividual[] newInds = new Individual[NUMBER_INDIVIDUALS];\n\t\t\t\t\n\t\t\t\t// Tournament selection\n\t\t\t\tfor(int i=0;i<num_mating;i+=2) {\n\t\t\t\t\tIndividual mamma=null, pappa=null;\n\t\t\t\t\tfloat chn_mum = random.nextFloat();\n\t\t\t\t\tfloat chn_pap = random.nextFloat();\n\t\t\t\t\tfloat fit_mum, sum_fit2=0, sum_fit3=0;\n\t\t\t\t\tint index_mum = -1;\n\t\t\t\t\t\n\t\t\t\t\tfor(int j=0;j<NUMBER_INDIVIDUALS;j++) {\n\t\t\t\t\t\tsum_fit2 += (inds[j].getFitness()/sum_fit);\n\t\t\t\t\t\tif(chn_mum <= sum_fit2) {\n\t\t\t\t\t\t\tmamma = inds[j];\n\t\t\t\t\t\t\tindex_mum = j;\n\t\t\t\t\t\t\tfit_mum = mamma.getFitness();\n\t\t\t\t\t\t\tsum_fit2 = sum_fit-fit_mum;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfor(int j=0;j<NUMBER_INDIVIDUALS;j++) {\n\t\t\t\t\t\tif(j!=index_mum) {\n\t\t\t\t\t\t\tsum_fit3 += (inds[j].getFitness()/sum_fit2);\n\t\t\t\t\t\t\tif(chn_pap <= sum_fit3) {\n\t\t\t\t\t\t\t\tpappa = inds[j];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//System.out.println(\"Mating...: \"+mamma.getFitness()+\",\"+pappa.getFitness());\n\t\t\t\t\tIndividual[] kids = mate(mamma, pappa);\n\t\t\t\t\tnewInds[i]\t= kids[0];\n\t\t\t\t\tnewInds[i+1]= kids[1];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Elitism\n\t\t\t\tfor(int i=0;i<num_elitism;i++) {\n\t\t\t\t\tnewInds[i+num_mating] = inds[i];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tinds = newInds;\t\t\t\t\t\t\t\t\n\t\t\t\tthis_gen++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"Done with evolving\");\n\t\t\t\t// set the best individual as the ruling champ?\n\t\t\t\t// do nothing\n\t\t\t\treturn;\n\t\t\t}\n\t\t}", "public void iterate()\n\t{\n\t\tfor (int p = 0; p < parasites.length; p++)\n\t\t\tpFitnesses[p][1] = 0;\n\t\t\n\t\ttry\n\t\t{\t// calculate fitnesses against other population\n\t\t\texecutor.invokeAll(tasks);\n\t\t\t// calculate fitness against hall of fame individuals\n\t\t\texecutor.invokeAll(hofTasks);\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tSystem.out.println(\"Something bad happened...\");\n\t\t\tSystem.exit(-1);\n\t\t}\n\t\n\t\tArrays.sort(hFitnesses,new ArrayComparator(1,false));\n\t\tArrays.sort(pFitnesses,new ArrayComparator(1,false));\n\t\t\n\t\tint bestIndex = (int)pFitnesses[0][0];\n\t\tint size = parHOF.length;\n\t\t\n\t\tparHOF[generations%size]=new NeuralPlayer(-1,\"HOF P\",(BasicNetwork)parasites[(int)bestIndex].net.clone());\n\t\tbestIndex = (int)hFitnesses[0][0];\n\t\thostHOF[generations%size]=new NeuralPlayer(1,\"HOF H\",(BasicNetwork)hosts[(int)bestIndex].net.clone());\n\t\t\n\t\tint matePopIndex = (int)(matingPer*popSize)+1;\n\t\tRandom indexG = new Random();\n\t\t// allow top percentage to breed and replace bottom 2*percentage\n\t\t// leave everyone else alone\n\t\tfor (int i = 0; i < popSize*2*matingPer; i++)\n\t\t{\n\t\t\tint pInd1 = indexG.nextInt(matePopIndex);\n\t\t\tint pInd2 = indexG.nextInt(matePopIndex);\n\t\t\tNeuralPlayer p1 = hosts[(int)hFitnesses[pInd1][0]];\n\t\t\tNeuralPlayer p2 = hosts[(int)hFitnesses[pInd2][0]];\n\t\t\tNeuralPlayer child = hosts[(int)hFitnesses[popSize - 1 - i][0]];\n\t\t\tmate(p1, p2,child);\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < popSize*2*matingPer; i++)\n\t\t{\n\t\t\tint pInd1 = indexG.nextInt(matePopIndex);\n\t\t\tint pInd2 = indexG.nextInt(matePopIndex);\n\t\t\tNeuralPlayer p1 = parasites[(int)pFitnesses[pInd1][0]];\n\t\t\tNeuralPlayer p2 = parasites[(int)pFitnesses[pInd2][0]];\n\t\t\tNeuralPlayer child = parasites[(int)pFitnesses[popSize - 1 - i][0]];\n\t\t\tmate(p1, p2,child);\n\t\t}\n\t\t// mutate everyone except top percentage (matingPer)\n\t\tfor (int i = 0; i < popSize*3*matingPer; i++)\n\t\t{\n\t\t\tmutate(parasites[(int)pFitnesses[popSize - 1 - i][0]]);\n\t\t\tmutate(hosts[(int)hFitnesses[popSize - 1 - i][0]]);\n\t\t}\n\t\t\n\t\tgenerations+=1;\n\t\t// every now and then reseed the population with a good individual\n\t\tif (generations%50 == 0)\n\t\t{\n\t\t\thosts[indexG.nextInt(hosts.length)].net = (BasicNetwork)allTimeBestHost.net.clone();\n\t\t\tparasites[indexG.nextInt(parasites.length)].net = (BasicNetwork)allTimeBestPara.net.clone();\n\t\t}\n\t\t\t\n\t}", "private void calculateFitness() {\n\t\tint day1=this.getNumberOfHours()*this.getNumberOfClasses();\n\t\tint day2=2*day1;\n\t\tint day3=3*day1;\n\t\tint day4=4*day1;\n\t\tint day5=5*day1;\n\t\tTeacher_lesson temp=null;\n\t\t//day 1//\n\t\tHashSet<Integer> closedSet=new HashSet<Integer>();\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<day1;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day1;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\n\t\t\n\t\t\n\t\t\n\t\t//day2//\n\t\tclosedSet.clear();;\n\t\t\n\t\tfor(int i=day1;i<day2;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day2;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day3//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day2;i<day3;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day3;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//day4//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day3;i<day4;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day4;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\t\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day5//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day4;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t\t\t\n\t\t}\n\t\t\t/*if(temp.get_td_hour()<0){this.fitness=this.fitness-100;}//adunato na ginei giati o ka8igitis exei parapanw wres apo oti mporei na kanei//\n\t\t\t\telse if (temp.get_td_hour()==0){this.fitness=this.fitness-2;}//meiwnoume giati o ka8igitis 8a epivarin8ei oles tou tis wres thn idia mera//\n\t\t\t\telse{++this.fitness;}//kalh prosegisi*/\n\t\t}\n\t\t//*********************END OF DAILY EVALUATION*****************************//\n\t\t\n\t\t//**********************START OF WEEKLY EVALUATION************************//\n\t\t\n\t\tclosedSet.clear();\n\t\t\n\t int \t_weeklyhours = 1;\n\t \n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tif(!closedSet.contains(this.genes[i])){\n\t\t\t\t\n\t\t\t\n\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\t\t++_weeklyhours; }\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t/*if(_weeklyhours>temp.get_tw_hour()){\n\t\t\t\tthis.fitness=this.fitness-100 ; //adunato na kanei parapanw wres ma8hma//\n\t\t\t}else\n\t\t\t\t{++this.fitness;}*/\n\t\t\tif(_weeklyhours<temp.get_tw_hour()){++this.fitness;}\n\t\t\tclosedSet.add(this.genes[i]);}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//*************END OF WEEKLY EVALUATION**********//\n\t\n\t\t//**START OF LESSON EVALUATION***//\n\t\tArraylistLesson set=new ArraylistLesson();\n\t\tclass_lid templ=null;\n\t\tTeacher_lesson tempj=null;\n\t\tint lid=0;\n\t\tString _class;\n\t\tint _classhours=1;\n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tlid=temp.get_lid();\n\t\t\t_class=temp.get_class();\n\t\t\ttempl=new class_lid(lid,_class);\n\t\t\tif(!set.contains(templ)){\n\t\t\t\t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\t\ttempj=getdata(this.genes[j]);{\n\t\t\t\t\t\tif(tempj!=null){\n\t\t\t\t\t\t\tif(temp.get_tid()==tempj.get_tid()){\n\t\t\t\t\t\t\t\tif(temp.get_lid()==tempj.get_lid()&&temp.get_class().equalsIgnoreCase(tempj.get_class())){\n\t\t\t\t\t\t\t\t\t++_classhours;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\tint hours;\n\t\t\t\thours=temp.get_lhours();\n\t\t\t\n\t\tif(_classhours==hours){\n\t\t\t++this.fitness;\n\t\t}\n\t\tset.add(templ);\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t}", "void ComputeFitness(){\n\t\tint i, pos;\n\t\t// individual t;\n\t\tdouble min, sum = 0, sumSize = 0, tm;\n\t\t// First Compute Raw fitness\n\t\tfor(i = 0; i < poplen; i++)\n\t\t{\n\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t}\n\t\t\t\n\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t}\n\t\t//tim individual co fitness be nhat\n\t\tmin = oldpop[0].fitness;\n\t\tpos = 0;\n\t\tsum = oldpop[0].fitness;\n\t\tsumSize = oldpop[0].size;\n\t\t\n\t\tfor(i = 1; i < poplen; i++) {\n\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\tmin = oldpop[i].fitness;\n\t\t\t\tpos = i;\n\t\t\t}\n\t\t\tsum += oldpop[i].fitness;\n\t\t\tsumSize += oldpop[i].size;\n//\t\t\tpopSize[gen][i]= oldpop[i].size;\n\t\t}\n\t\t// copy the best and average\n\t\tbestcurrent[gen] = new individual();\n\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n\t\taverage[gen] = sum /poplen;\n\t\taverageSize[gen] = sumSize /poplen;\n\t\t// Third Compute Adjusted fitness\n\t\tAdjustFitness();\n\t\t// Finally Compute nomarlized fitness\n \t\tNormalizeFitness();\n\t}", "public ArrayList<Tour> doSelection(Population population) {\n double totalFitness = 0;\n for(Tour tour : population.getTourList()){\n totalFitness = totalFitness + tour.getFitness();\n }\n\n //sort tours by relative fitness\n SortedMap<Double, Tour> totalFitnessRelativity = new TreeMap<>();\n for(Tour tour: population.getTourList()){\n double key = tour.getFitness()/totalFitness;\n totalFitnessRelativity.put(key, tour);\n }\n\n //put tours on a number bar\n SortedMap<Double, Tour> numberBar = new TreeMap<>();\n double previousProbability = 0;\n for(Map.Entry<Double, Tour> entry : totalFitnessRelativity.entrySet()){\n double currentProbability = previousProbability + entry.getKey();\n numberBar.put(currentProbability, entry.getValue());\n previousProbability = currentProbability;\n }\n\n //choose a tour randomly according to how near it is to\n ArrayList<Tour> rouletteWheelOrder = new ArrayList<>();\n do{\n double randomNumber = new random.MersenneTwisterFast().nextDouble(0, numberBar.lastKey());\n for(Map.Entry<Double, Tour> numberBarSection : numberBar.entrySet()){\n if(randomNumber <= numberBarSection.getKey() && !rouletteWheelOrder.contains(numberBarSection.getValue())){\n rouletteWheelOrder.add(numberBarSection.getValue());\n break;\n }\n }\n } while(rouletteWheelOrder.size() != population.getTourList().size());\n return rouletteWheelOrder;\n }", "public void calcularFitness() {\n double fit = 0;\r\n for (int x=0; x < this.genotipo.length;x++){\r\n if (x!=this.genotipo.length-1){\r\n fit+=distancias[this.genotipo[x]][this.genotipo[x+1]];\r\n }else{\r\n fit+=distancias[this.genotipo[x]][this.genotipo[0]];\r\n }\r\n }\r\n this.fitness = fit;\r\n }", "public void incrementFitness()\n {\n this.fitness++;\n }", "public static void calculateFitness(StrategyPool sp)\r\n\t{\r\n\t\tfor(int i = 0; i<sp.pool.size() ; i++)\r\n\t\t{\r\n\t\t\tfor(int j = 0; j <sp.pool.size() ; j++)\r\n\t\t\t{\r\n\t\t\t\tif(i == j)\r\n\t\t\t\t\t; //do nothing\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n//\t\t\t\t\tSystem.out.println(\"Playing Strategy \" +i +\" against \" +j );\r\n\t\t\t\t\tStrategy p1 = sp.pool.get(i);\r\n\t\t\t\t\tStrategy p2 = sp.pool.get(j);\r\n\t\t\t\t\tint winner = 0;\r\n\t\t\t\t\tfor(int k = 0; k<1000 ; k++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\twinner = new Game().play(p1,p2);\r\n\t\t\t\t\t\t\tif(winner == 0)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tp1.addDrawCount();\r\n\t\t\t\t\t\t\t\tp2.addDrawCount();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if(winner == 1)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tp1.addWinCount();\r\n\t\t\t\t\t\t\t\tp2.addLostCount();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if(winner ==2)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tp1.addLostCount();\r\n\t\t\t\t\t\t\t\tp2.addWinCount();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t//switch positions\r\n\t\t\t\t\tp2 = sp.pool.get(i);\r\n\t\t\t\t\tp1 = sp.pool.get(j);\r\n\r\n//\t\t\t\t\tSystem.out.println(\"Playing Strategy \" +j +\" against \" +i );\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(int k = 0; k<1000 ; k++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\twinner = new Game().play(p1,p2);\r\n\t\t\t\t\t\tif(winner == 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tp1.addDrawCount();\r\n\t\t\t\t\t\t\tp2.addDrawCount();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(winner == 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tp1.addWinCount();\r\n\t\t\t\t\t\t\tp2.addLostCount();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(winner ==2)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tp1.addLostCount();\r\n\t\t\t\t\t\t\tp2.addWinCount();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void tournamentSelect(Individual[] individulas) {\n int length = individulas.length;\n int p1, p2;\n Individual[] array = setupArray(length, NUM_RULES, GENE_SIZE, COND_LEN);\n for (int i = 0; i < individulas.length; i++) {\n p1 = new Random().nextInt(length);\n p2 = new Random().nextInt(length);\n\n if (individulas[p1].getFitness() >= individulas[p2].getFitness()) {\n array[i] = new Individual(individulas[p1]);\n } else {\n array[i] = new Individual(individulas[p2]);\n }\n }\n\n matingPool = Arrays.copyOf(array, length);\n }", "public void evolve_enviroment() {\r\n\r\n // this.main_population.update_population();\r\n // get the indices of the best individual in the main population\r\n int main_pop_best = this.main_population.getBest_indices();\r\n\r\n // create a new individua with the genes of the best individual\r\n this.pop_best = new individual(this.main_population.getPopulation()[main_pop_best].getGenes(), solutions, output); // best individual in population\r\n\r\n // perform selection, crossover and mutation\r\n this.roulette_selection();\r\n this.crossover();\r\n this.mutate(this.prob);\r\n this.tournament_selection(); // survivor selection\r\n\r\n // find the indices of the worst individual and replace it with the best from the last generation\r\n this.main_population.setIndividual(pop_best, this.main_population.find_Worst_indicies());\r\n this.main_population.update_population();\r\n\r\n }", "@Override\n public void evaluate(Solution solution) throws JMException {\n\n int[] tour = new int[numberOfNodes + 1];\n int firstCity = ((Permutation) solution.getDecisionVariables()[0]).vector_[0];\n int lastCity = ((Permutation) solution.getDecisionVariables()[0]).vector_[numberOfNodes - 1];\n\n double fitness1_td = 0.0;\n\n // Calculate fitness 1 - total distance\n for (int i = 0; i < numberOfNodes - 1; i++) {\n int x = ((Permutation) solution.getDecisionVariables()[0]).vector_[i];\n int y = ((Permutation) solution.getDecisionVariables()[0]).vector_[i+1];\n\n tour[i] = x;\n tour[i+1] = y;\n\n fitness1_td += calDistances(x, y);\n }\n // generate tour with same start city and end city\n tour[numberOfNodes] = tour[0];\n\n fitness1_td += calDistances(firstCity, lastCity);\n\n\n // Correctness check: does the tour start and end in the same city\n if(tour[0] != tour[tour.length - 1]) {\n System.err.println(\"ERROR: The last city must be the same as the first city\");\n System.exit(1);\n }\n\n /*for (int i = 0; i < tour.length; i++) {\n System.out.print(tour[i] + \" \");\n }*/\n //System.out.println(\"\\n\" + tour.length);\n\n // Calculate fitness 2 - objective value of a given tour\n ArrayInt z = (ArrayInt) solution.getDecisionVariables()[1];\n //System.out.println(z.getLength());\n\n double fitness2_ob;\n double wc = 0.0;\n double ft = 0.0;\n double fp = 0.0;\n\n //the following is used for a different interpretation of \"packingPlan\"\n int itemsPerCity = z.getLength() / (tour.length - 2);\n //System.out.println(itemsPerCity);\n\n for (int i = 0; i < tour.length - 1; i++) {\n\n int currentCityTEMP = tour[i];\n // what's the current city? --> but the items start at city 2 in the TTP file, so I have to take another 1 off!\n int currentCity = currentCityTEMP - 1;\n\n if (i > 0) {\n\n if (currentCity == -1) {\n // No items in city 1\n wc += 0.0;\n fp += 0.0;\n\n } else {\n\n for (int itemNumber = 0; itemNumber < itemsPerCity; itemNumber++) {\n\n int indexOfPackingPlan = (i-1) * itemsPerCity + itemNumber;\n // what is the next item's index in items-array?\n int itemIndex = currentCity + itemNumber * (numberOfNodes - 1);\n //System.out.println(\"i: \" + i);\n\n if (z.getValue(indexOfPackingPlan) == 1) {\n // pack item\n //System.out.println(itemIndex);\n int currentWC = items[itemIndex][2];\n wc += currentWC;\n\n int currentFP = items[itemIndex][1];\n fp += currentFP;\n }\n }\n\n }\n\n int h = (i+1) % (tour.length-1); //h: next tour city index\n //System.out.println(\"h: \" + h);\n long distance = calDistances(i, h);\n // compute the adjusted (effective) distance\n ft += (distance / (1 - wc * (maxSpeed - minSpeed) / capacityOfKnapsack));\n }\n }\n\n wendUsed = wc;\n wend = capacityOfKnapsack - wc;\n fitness2_ob = fp - ft * rentingRatio;\n\n solution.setObjective(0, fitness1_td);\n solution.setObjective(1, -fitness2_ob); // Convert from maximum objective value to minimum objective value\n }", "public void evaluatePopulation() {\n // reset the total fitness score\n totalFitness = 0;\n\n for (int i = 0; i < populationSize; i++) {\n population.get(i).setRawFitness(\n FeederCollection.getFeeders().get(i).GetFitness());\n totalFitness += population.get(i).getRawFitness();\n }\n\n // set the normalized fitness for each population member\n for (Genotype g : population) {\n // normalized fitness = raw fitness / total fitness\n g.setNormalizedFitness((g.getRawFitness() / totalFitness));\n }\n\n // sort the popoulation\n Collections.sort(population, Genotype.FitnessOrder);\n\n highFitnesses.add(population.get(0).getRawFitness());\n avgFitnesses.add(totalFitness / population.size());\n\n\n }", "private PMCGenotype[] advanceGeneration()\n\t{\n\t\tPMCGenotype[] newPop = new PMCGenotype[population.length];\n\t\tPMCGenotype[] parents = selectParents();\n\t\tArrayList<PMCGenotype> candidates = new ArrayList<PMCGenotype>();\n\n\t\t// Add the current population to the list of candidates.\n\t\tfor (PMCGenotype pmcg : population)\n\t\t{\n\t\t\tcandidates.add(pmcg);\n\t\t}\n\n\t\t// For each parent, generate a number of mutations (children), calculate their fitness\n\t\t// and add them to the list of candidates.\n\t\tint childrenPerParent = this.childrenPerGeneration / this.parentsToSelect;\n\t\tfor (PMCGenotype p : parents)\n\t\t{\n\t\t\tfor (int i = 0; i < childrenPerParent; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = PMCGenotype.mutate(p, r);\n\t\t\t\tpmcg.setFitness(fitness(pmcg, this.trials));\n\t\t\t\tcandidates.add(pmcg);\n\t\t\t}\n\t\t}\n\n\t\t// Find candidate with the best fitness and add it to the new population.\n\t\t// Repeat this until the new population size matches the previous population size.\n\t\tint candidatesChosen = 0;\n\t\twhile (candidatesChosen < this.population.length)\n\t\t{\n\t\t\tint numberOfRemainingCandidates = candidates.size();\n\t\t\tdouble currentBestFitnessScore = 0;\n\t\t\tint currentBestFitnessScoreIndex = 0;\n\n\t\t\tfor (int i = 0; i < numberOfRemainingCandidates; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = candidates.get(i);\n\t\t\t\tif (pmcg.getFitness() > currentBestFitnessScore)\n\t\t\t\t{\n\t\t\t\t\tcurrentBestFitnessScore = pmcg.getFitness();\n\t\t\t\t\tcurrentBestFitnessScoreIndex = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewPop[candidatesChosen] = candidates.get(currentBestFitnessScoreIndex);\n\t\t\tcandidatesChosen++;\n\n\t\t\tcandidates.remove(currentBestFitnessScoreIndex);\n\t\t}\n\n\t\treturn newPop;\n\t}", "void calculateFitness() {\n if (reachedGoal) {\n fitness = 1d / 16d + 8192d / (genome.step * genome.step);\n } else {\n double d = position.distance(Game.Setup.goal);\n fitness = 1d / (d * d);\n }\n }", "public static void calculateFitness(Individual[] individuals) {\n for (Individual individual : individuals) {\n individual.fitness = 0;\n for (int i = 0; i < dataSet.size(); i++) {\n for (Rule rule : individual.rulebase) {\n boolean match = true;\n int[] data = dataSet.get(i).getVariables();\n\n for (int j = 0; j < data.length; j++) {\n\n String variable = String.valueOf(data[j]);\n //String variable = \"\" + data[j];\n String[] rulebase = rule.cond;\n\n if ((rulebase[j].equals(variable) != true) && (rulebase[j].equals(\"#\") != true)) {\n match = false;\n }\n }\n\n if (match) {\n String output = String.valueOf(dataSet.get(i).getOutput());\n if (rule.output.equals(output)) {\n individual.fitness++;\n }\n break;\n }\n }\n }\n }\n }", "@Override\n\tpublic Population evolvePopulation(Population pop) {\n\t\tSortingIndividual baseIndiv = (SortingIndividual) pop.individuals[0];\n\t\tPopulation newPopulation = new SortingPopulation(pop.size(), baseIndiv.getBase(), false);\n\t\n\t\t// Keep our best individual\n\t\tif (elitism) {\n\t\t\tnewPopulation.saveIndividual(0, pop.getFittest());\n\t\t}\n\n\t\t// Crossover population\n\t\tint elitismOffset;\n\t\tif (elitism) {\n\t\t\telitismOffset = 1;\n\t\t} else {\n\t\t\telitismOffset = 0;\n\t\t}\n\t\t// Loop over the population size and create new individuals with\n\t\t// crossover\n\t\tfor (int i = elitismOffset; i < pop.size(); i++) {\n\t\t\tIndividual indiv1 = tournamentSelection(pop);\n\t\t\tIndividual indiv2 = tournamentSelection(pop);\n\t\t\tIndividual newIndiv = crossover(indiv1, indiv2);\n\t\t\tnewPopulation.saveIndividual(i, newIndiv);\n\t\t}\n\n\t\t// Mutate population\n\t\tfor (int i = elitismOffset; i < newPopulation.size(); i++) {\n\t\t\tmutate(newPopulation.getIndividual(i));\n\t\t}\n\n\t\treturn newPopulation;\n\t}", "public Genotype rouletteSelection() {\n // get a number between 0 and 1 to compare against\n double slice = rnd.nextDouble();\n // keep track of the cumulative fitness\n double cumulativeFitness = 0;\n\n // loop through the population to pick a mate\n for (Genotype g : population) {\n // increment the cumulative fitness with the member's normalized fitness\n cumulativeFitness += g.getNormalizedFitness();\n // if the cumulative fitness is greater than the random number,\n if (cumulativeFitness > slice) {\n // select the member for mating\n return g;\n }\n }\n\n // if no members are chosen, pick the one with the highest fitness score\n return population.get(0);\n }", "public static void main(String[] args) {\n City city = new City(60, 200);\n\n City city2 = new City(180, 200);\n\n City city3 = new City(80, 180);\n City city4 = new City(140, 180);\n\n City city5 = new City(20, 160);\n\n City city6 = new City(100, 160);\n\n City city7 = new City(200, 160);\n\n City city8 = new City(140, 140);\n\n City city9 = new City(40, 120);\n\n City city10 = new City(100, 120);\n\n City city11 = new City(180, 100);\n\n City city12 = new City(60, 80);\n\n City city13 = new City(120, 80);\n City city14 = new City(180, 60);\n City city15 = new City(20, 40);\n\n City city16 = new City(100, 40);\n\n City city17 = new City(200, 40);\n City city18 = new City(20, 20);\n\n City city19 = new City(60, 20);\n City city20 = new City(160, 20);\n List<City> list=new ArrayList<City>();\n list.add(city);list.add(city2);\n list.add(city3);\n list.add(city4);\n list.add(city5);\n list.add(city6);\n list.add(city7);\n list.add(city8);\n list.add(city9);\n list.add(city10);\n list.add(city11);\n list.add(city12);\n list.add(city13);\n list.add(city14);\n list.add(city15);\n list.add(city16);\n list.add(city17);\n list.add(city18);\n list.add(city19);\n list.add(city20);\n\n // Initialize population\n Population pop = new Population(100, true,list);\n System.out.println(\"Initial distance: \" + pop.getBestTour().getDistance());\n\n // Evolve population for 100 generations\n pop = Ga.evolvePopulation(pop);\n for (int i = 0; i < 500; i++) {\n pop = Ga.evolvePopulation(pop);\n System.out.println(\"第\"+i+\"代\"+pop.getBestTour().getDistance());\n }\n\n // Print final results\n System.out.println(\"Finished\");\n System.out.println(\"Final distance: \" + pop.getBestTour().getDistance());\n System.out.println(\"Solution:\");\n System.out.println(pop.getBestTour());\n }", "public static void GA(ArrayList<City> cities){\n int pathLength = cities.size();\n // the number of chromosomes which will be generated\n int populationSize = 100;\n // the number of chromosomes that will be generated from crossover as a percentage of the population\n double crossoverRate = 0.8;\n // the number of chromosomes that will be generated from crossover\n int crossoverSize = (int) (populationSize * crossoverRate);\n // the probability that a chromosome can have a random mutation\n double mutationRate = 0.05;\n // the number of generations\n int generations = 5000;\n\n // Initialising the distance matrix using the initialiseDistanceMatrix method\n initialiseDistanceMatrix(cities);\n\n // Generating the Initial Population\n ArrayList<Chromosome> population = generatePopulation(cities, pathLength, populationSize);\n\n // The following is done for each generation of the population\n for (int i = 0; i < generations; i++) {\n // calculating the fitness of every chromosome in the current generation\n calculateFitnessOfPopulation(population);\n // sort the population so that the chromosomes with the highest fitness are at the start of the list\n Collections.sort(population);\n // call the method which performs crossover on the population\n Set<Chromosome> children = crossoverPopulation(population, populationSize, crossoverSize);\n // carry out mutation on the children of the current population\n children.addAll( mutatePopulation(children, mutationRate) );\n\n // evolve the population\n population.addAll(children);\n ArrayList<Chromosome> currentGeneration = new ArrayList<>(population);\n ArrayList<Chromosome> nextGeneration = evolvePopulation(currentGeneration, populationSize, cities, pathLength);\n population = new ArrayList<>(nextGeneration);\n }\n\n // find the fittest chromosome\n Chromosome fittestChromosome = population.get(0);\n double maxFitness = population.get(0).fitness;\n for (Chromosome c : population) {\n if (c.fitness > maxFitness) {\n maxFitness = c.fitness;\n fittestChromosome = c;\n }\n }\n // display the path and distance of the fittest chromosome\n System.out.println(fittestChromosome.getPath());\n System.out.println(\"Total Route Distance: \" + routeDistance(fittestChromosome));\n\n //printPopulation(population);\n }", "private static void getFitness() {\n\t\tint popSize = population.size();\n\t\tChromosome thisChromo = null;\n\t\tdouble bestScore = 0;\n\t\tdouble worstScore = 0;\n\n\t\t// The worst score would be the one with the highest energy, best would be\n\t\t// lowest.\n\t\tworstScore = population.get(maximum()).conflicts();\n\n\t\t// Convert to a weighted percentage.\n\t\tbestScore = worstScore - population.get(minimum()).conflicts();\n\n\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\tthisChromo = population.get(i);\n\t\t\tthisChromo.fitness((worstScore - thisChromo.conflicts()) * 100.0 / bestScore);\n\t\t}\n\n\t\treturn;\n\t}", "private void runAlgorithm(){\n fitness = new ArrayList<Double>(); \n \n int iter = 0;\n \n // While temperature higher than absolute temperature\n this.temperature = getCurrentTemperature(0);\n while(this.temperature > this.p_absoluteTemperature && iter < 100000){\n //while(!stopCriterionMet()){\n // Select next state\n //for(int i=0;i<20;i++){\n int count = 0;\n boolean selected = false;\n while(!selected){\n Problem.ProblemState next = nextState();\n if(isStateSelected(next)){\n selected = true;\n this.state = next;\n }\n \n count++;\n if(count == 10) break;\n }\n //}\n \n // Sample data\n double fvalue = this.state.getFitnessValue();\n this.fitness.add(new Double(fvalue));\n \n iter = iter + 1;\n \n // Lower temperature\n this.temperature = getCurrentTemperature(iter);\n }\n \n this.n_iter = iter;\n return;\n }", "public Vector run(){\n generationCount = 0;\n solutionList = new Vector();\n bannedList = new Vector();\n solutionCounter = 0;\n whenToHalt.init();\n //INITIALIZE THE POPULATION\n\n population = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n fitnessArray = new double[populationSize];\n //COMPUTE FITNESSES\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) population.get(x);\n fitnessArray[x] = next.getFitness();\n }\n\n Arrays.sort(fitnessArray);\n\n while (! stop()){\n //RUN THROUGH THE GENERATIONS\n population = step();\n }\n\n if (useList){\n return solutionList;\n } else {\n return population;\n }\n }", "private void crossover() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < pop_size; i++) { // go through population\r\n\r\n int a = new Random().nextInt(this.pop_size);\r\n int b = new Random().nextInt(this.pop_size);\r\n\r\n int split_point = new Random().nextInt(this.gene_size);\r\n\r\n float[] p1_genes = this.parent_population.getPopulation()[a].getGenes();\r\n float[] p2_genes = this.parent_population.getPopulation()[b].getGenes();\r\n\r\n float[] c1_genes = new float[gene_size];\r\n float[] c2_genes = new float[gene_size];\r\n\r\n for (int j = 0; j < gene_size; j++) {\r\n\r\n if (j < split_point) {\r\n c1_genes[j] = p1_genes[j];\r\n c2_genes[j] = p2_genes[j];\r\n } else {\r\n c2_genes[j] = p1_genes[j];\r\n c1_genes[j] = p2_genes[j];\r\n }\r\n }\r\n individual child1 = new individual(c1_genes, solutions, output);\r\n individual child2 = new individual(c2_genes, solutions, output);\r\n\r\n if (child1.getFitness() > child2.getFitness()) {\r\n temp_pop[i] = child1;\r\n } else {\r\n temp_pop[i] = child2;\r\n }\r\n }\r\n this.offspring_population.setPopulation(temp_pop);\r\n this.offspring_population.update_population();\r\n }", "public static void calculateFitness(Individual individual) {\n individual.fitness = 0;\n for (int i = 0; i < dataSet.size(); i++) {\n\n for (Rule rule : individual.rulebase) {\n boolean match = true;\n int[] data = dataSet.get(i).getVariables();\n\n for (int j = 0; j < data.length; j++) {\n\n String variable = String.valueOf(data[j]);\n //String variable = \"\" + data[j];\n String[] rulebase = rule.cond;\n\n if ((rulebase[j].equals(variable) != true) && (rulebase[j].equals(\"#\") != true)) {\n match = false;\n }\n }\n\n if (match) {\n String output = String.valueOf(dataSet.get(i).getOutput());\n if (rule.output.equals(output)) {\n individual.fitness++;\n }\n break;\n }\n }\n }\n }", "public Tournament(){\n simplePlayer = new SimpleFakeGinRummyPlayer(new ParamList(new double[]{}));\n\n knockOnGinPlayer = new EnsembleHandEvalPlayer(ParamList.getRandomParamList(1), new DeadwoodHandEvaluator());\n knockOnGinPlayer.setKnockDecider(new KnockOnGinKnockDecider() );\n knockOnGinPlayer.setDrawDecider(new MeldOnlyDrawDecider());\n\n ExperimentalRuns.fixTwoStageKnockDecider101();\n // paramOfTunedTwoStagePlayer.set(ParamList.TS_KNOCK_THRESHOLD_EARLY, 0);\n // paramOfTunedTwoStagePlayer.set(ParamList.TS_KNOCK_THRESHOLD_LATE, 0);\n // paramOfTunedTwoStagePlayer.set(ParamList.TS_KNOCK_MIDDLE, 6);\n ParamList.setFixedValue(ParamList.TS_DRAW_MIDDLE, 14);\n ParamList paramOfTunedTwoStagePlayer = ParamList.getRandomParamList(1);\n System.out.println(paramOfTunedTwoStagePlayer);\n tunedTwoStagePlayer = new IndexEnsembleHandEvalPlayer(paramOfTunedTwoStagePlayer, new DeadwoodHandEvaluator());\n tunedTwoStagePlayer.setKnockDecider(new TwoStageKnockDecider(paramOfTunedTwoStagePlayer) );\n tunedTwoStagePlayer.setDrawDecider(new MeldOnlyDrawDecider());\n tunedTwoStagePlayer.setDrawDecider(new TwoStageDrawDecider(paramOfTunedTwoStagePlayer));\n\n resultSimpleVsKnockGin = 0;\n resultKnockGinVsTwoStage = 0;\n resultTwoStageVsSimple = 0;\n\n numGamePerPair = 2000;\n\n }", "public static void main(String[] args) throws IOException {\n\t\tint p = 8;\n\t\t// r is the fraction of the population to be replaced by Crossover at\n\t\t// each step\n//\t\tdouble r = Double.valueOf(8).doubleValue();\n\t\tdouble r = 8;\n\t\t// m is the rate of mutation\n//\t\tdouble m = Double.valueOf(8).doubleValue();\n\t\tdouble m = 8;\n\n\t\t// Write into files...\n\t\tFile outputFile = new File(\"testGA.txt\");\n\t\tFileWriter out = new FileWriter(outputFile);\n\n\t\t////////////////////////\n\t\tp = 33;\n\t\tr = 0.6;\n\t\tm = 0.1;\n\n\t\t// Report the population size, crossover rate and mutation rate\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"Learning the 8-queens problem with a Genetic Algorithm\");\n\t\tSystem.out.println(\"Population Size: \" + p);\n\t\tSystem.out.println(\"Crossover Rate: \" + r);\n\t\tSystem.out.println(\"Mutation Rate: \" + m);\n\t\tSystem.out.println();\n\t\tout.write(\"Parameters are p=\" + p + \", \" + \"r=\" + r + \" and m=\" + m + \"\\r\");\n\n\t\t// The genetic algorithm\n\t\tint iterationNum = 0;\n\t\tHypothesis bestIndividual;\n\t\tint bestFitness;\n\t\tdouble aveFitness;\n\t\t// Randomly generate initial population\n\t\tGA algorithm = new GA(p, r, m);\n\t\t// For each individual compute fitness\n\t\talgorithm.computeFitness();\n\t\t// Get the best individual\n\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\tbestFitness = bestIndividual.getFitness();\n\t\taveFitness = algorithm.computeAveFitness();\n\t\t// Iterate till we get the very best individual\n\t\twhile (bestFitness != 0) {\n\t\t\t// Select the very best members of the population to survive\n\t\t\talgorithm.select();\n\t\t\t// Make the best members reproduce themselves\n\t\t\talgorithm.crossover();\n\t\t\t// Add some mutations to new population\n\t\t\talgorithm.mutate();\n\t\t\t// The successor population becomes the current population\n\t\t\talgorithm.setNextGeneration();\n\t\t\t// For each individual compute fitness\n\t\t\talgorithm.computeFitness();\n\t\t\t// Get the best individual\n\t\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\t\tbestFitness = bestIndividual.getFitness();\n\t\t\taveFitness = algorithm.computeAveFitness();\n\t\t\t// Report best results to the user at every five iterations\n\t\t\tif (iterationNum % 5 == 0) {\n\t\t\t\tSystem.out.println(\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness\n\t\t\t\t\t\t+ \" Average Fitness \" + aveFitness);\n\t\t\t\tSystem.out.println(\"Best solution: \" + bestIndividual.toString());\n\t\t\t\tSystem.out.println();\n\t\t\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\t\t}\n\t\t\titerationNum++;\n\t\t}\n\t\tSystem.out.println(\n\t\t\t\t\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness + \" Average Fitness \" + aveFitness);\n\t\tSystem.out.println(\"Solution is \" + bestIndividual.toString());\n\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\tout.close();\n\t}", "public void generateIndividual() {\n // Loop through all our destination cities and add them to our tour\n for (int cityIndex = 0; cityIndex < TourManager.numberOfCities(); cityIndex++) {\n setCity(cityIndex, TourManager.getCity(cityIndex));\n }\n // Randomly reorder the tour\n Collections.shuffle(tour);\n }", "public void fitnessFunction()\n\t{\n\t\t\n\t}", "static double[] evolveWeights() throws Exception {\n\t\t// Create a random initial population\n\t\tRandom r = new Random();\n\t\t// Matrix is a two dimensional array, populationSize are rows, Genes are columns\n\t\tMatrix population = new Matrix(populationSize, numberofGenes);\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\t// returns elements(genes) of every row\n\t\t\t// Think of every row as a seperate chromosome of parent\n\t\t\tdouble[] chromosome = population.row(i);\n\t\t\t// create every gene for each chrosome in the population\n\t\t\tfor (int j = 0; j < chromosome.length; j++) {\n\t\t\t\tdouble gene = 0.03 * r.nextGaussian();\n\t\t\t\tchromosome[j] = gene;\n\t\t\t}\n\t\t}\n\n\t\tint generationNum = 0;\n\t\t// do battle with chromosomes until winning condition is found\n\t\t// Controller.doBattleNoGui(new ReflexAgent(), new\n\t\t// NeuralAgent(population.row(0)))\n\t\twhile (Controller.doBattleNoGui(new ReflexAgent(), new NeuralAgent(population.row(0))) != -1) {\n\n\t\t\tSystem.out.println(\"Generation \" + (generationNum));\n\n\t\t\tint mightLive = r.nextInt(100);\n\n\t\t\tif (generationNum == 10)\n\t\t\t\tmutationRate -= 0.01;\n\t\t\tif (generationNum == 20)\n\t\t\t\tmutationRate -= 0.02;\n\t\t\tif (generationNum == 30)\n\t\t\t\tmutationRate -= 0.02;\n\n\t\t\t// Mutate the genes of the current population\n\t\t\tfor (int y = 0; y < populationSize; y++) {\n\t\t\t\tfor (int x = 0; x < numberofGenes; x++) {\n\t\t\t\t\tif (Math.random() <= mutationRate) {\n\t\t\t\t\t\tpopulation.changeGene(x, y, r.nextGaussian());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Make random number of battles\n\t\t\tfor (int i = 0; i < 40; i++) {\n\t\t\t\t// Create two teams with two random chromosomes from the population\n\t\t\t\tint soldier_a = r.nextInt(population.rows());\n\t\t\t\tint soldier_b = r.nextInt(population.rows());\n\n\t\t\t\t// Ensure that both teams don't have the same chromosome\n\t\t\t\tif (soldier_a == soldier_b)\n\t\t\t\t\tsoldier_b = r.nextInt(population.rows());\n\n\t\t\t\t// Do Battle between teams and select winner\n\t\t\t\tif (Controller.doBattleNoGui(new NeuralAgent(population.row(soldier_a)),\n\t\t\t\t\t\tnew NeuralAgent(population.row(soldier_b))) == 1) {\n\t\t\t\t\t// Chooses if the winner survives\n\t\t\t\t\tif (mightLive < winnerSurvivalRate)\n\t\t\t\t\t\tpopulation.removeRow(soldier_b);\n\t\t\t\t\telse\n\t\t\t\t\t\tpopulation.removeRow(soldier_a);\n\t\t\t\t}\n\n\t\t\t\telse if (Controller.doBattleNoGui(new NeuralAgent(population.row(soldier_a)),\n\t\t\t\t\t\tnew NeuralAgent(population.row(soldier_b))) == -1) {\n\t\t\t\t\t// Chooses if the winner survives\n\t\t\t\t\tif (mightLive < winnerSurvivalRate)\n\t\t\t\t\t\tpopulation.removeRow(soldier_a);\n\t\t\t\t\telse\n\t\t\t\t\t\tpopulation.removeRow(soldier_b);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Reproduce for the population (This is where the magic happens)\n\t\t\t// int currentPopulation = population.rows();\n\t\t\twhile (population.rows() < 100) {\n\t\t\t\t// Retrieve random parent\n\t\t\t\tint parentID = r.nextInt(population.rows());\n\t\t\t\tdouble[] parent = population.row(parentID);\n\t\t\t\tint[] potentialPartners = new int[10];\n\t\t\t\tint abs_min_value = Integer.MIN_VALUE;\n\t\t\t\tBoolean foundpartner = false;\n\t\t\t\tint partner = 0;\n\n\t\t\t\tfor (int i = 0; i < potentialPartners.length; i++) {\n\t\t\t\t\tint potentialPartnerID = r.nextInt(population.rows());\n\t\t\t\t\tif (parentID == potentialPartnerID)\n\t\t\t\t\t\tpotentialPartnerID = r.nextInt(population.rows());\n\t\t\t\t\tpotentialPartners[i] = potentialPartnerID;\n\t\t\t\t}\n\n\t\t\t\tfor (int i = 0; i < potentialPartners.length; i++) // Finding most compatiable parent #2.\n\t\t\t\t{\n\t\t\t\t\tint compatiablity = similarities(parent, population.row(potentialPartners[i]));\n\t\t\t\t\tif (compatiablity > abs_min_value) {\n\t\t\t\t\t\tpartner = potentialPartners[i];\n\t\t\t\t\t\tfoundpartner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (foundpartner == false)\n\t\t\t\t\tpartner = r.nextInt(population.rows());\n\n\t\t\t\tdouble[] secondParent = population.row(partner);\n\t\t\t\tdouble[] newChild = population.newRow();\n\t\t\t\tint splitpoint = r.nextInt((int) numberofGenes / 4);\n\n\t\t\t\tfor (int i = 0; i < splitpoint; i++) // logic to a for loop and two if statements\n\t\t\t\t\tnewChild[i] = parent[i];\n\t\t\t\tfor (int i = splitpoint; i < numberofGenes; i++)\n\t\t\t\t\tnewChild[i] = secondParent[i];\n\n\t\t\t\t// for (int i = 0; i < population.rows(); i++) {\n\t\t\t\t// if (Controller.doBattleNoGui(new ReflexAgent(), new\n\t\t\t\t// NeuralAgent(population.row(i))) == -1) {\n\t\t\t\t// population.row(i) = population.newRow();\n\t\t\t\t// numOfWins++;\n\t\t\t\t// } else { }\n\n\t\t\t\t// Test for the best in the given population\n\t\t\t\t// win_Collection.add(numOfWins);\n\t\t\t\t// printWeights(population.row(0));\n\n\t\t\t}\n\t\t\tgenerationNum++;\n\t\t\tfor (int i = 0; i < population.rows(); i++) {\n\t\t\t\tif (Controller.doBattleNoGui(new ReflexAgent(), new NeuralAgent(population.row(i))) == -1) {\n\t\t\t\t\tnumOfWins++;\n\t\t\t\t\t// population.row(i) = population.newRow();\n\t\t\t\t} else {\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(\"Number of Winners: \" + numOfWins);\n\t\t\tnumOfWins = 0;\n\n\t\t}\n\t\tprintWeights(population.row(0));\n\t\treturn population.row(0);\n\t}", "public Tours fittestTour(){\r\n\t\tTours fittest = tours[0];\r\n\t\t// Loops through indivuals to find best\r\n\t\tfor (int i = 1; i < sizePop(); i++){\r\n\t\t\tif(fittest.fitnessGet() <= tourGet(i).fitnessGet()){\r\n\t\t\t\tfittest = tourGet(i);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn fittest;\r\n\t}", "public interface GAIndividual\r\n{\r\n public void mutate(double rate);\r\n public GAIndividual directReproduce();\r\n public GAIndividual reproduce( GAIndividual i );\r\n \r\n public int getFitness();\r\n public void setFitness ( int fitness );\r\n public void setRoulette (int start, int finish);\r\n public boolean hasRouletteNumber (int winner);\r\n public String toString();\r\n}", "public void evaluate()\r\n {\r\n\tdouble max = ff.evaluate(chromos.get(0),generation());\r\n\tdouble min = max;\r\n\tdouble sum = 0;\r\n\tint max_i = 0;\r\n\tint min_i = 0;\r\n\r\n\tdouble temp = 0;\r\n\r\n\tfor(int i = 0; i < chromos.size(); i++)\r\n\t {\r\n\t\ttemp = ff.evaluate(chromos.get(i),generation());\r\n\t\tif(temp > max)\r\n\t\t {\r\n\t\t\tmax = temp;\r\n\t\t\tmax_i = i;\r\n\t\t }\r\n\r\n\t\tif(temp < min)\r\n\t\t {\r\n\t\t\tmin = temp;\r\n\t\t\tmin_i = i;\r\n\t\t }\r\n\t\tsum += temp;\r\n\t }\r\n\r\n\tbestFitness = max;\r\n\taverageFitness = sum/chromos.size();\r\n\tworstFitness = min;\r\n\tbestChromoIndex = max_i;;\r\n\tworstChromoIndex = min_i;\r\n\tbestChromo = chromos.get(max_i);\r\n\tworstChromo = chromos.get(min_i);\r\n\t\r\n\tevaluated = true;\r\n }", "public void run() {\n PopulationFGA<Integer> poblacionActual = new PopulationFGA<>(funcionBorn,\n funcionFitness,\n problema.getDimension(),\n 1);\n poblacionActual.incializa(200);\n while(!condTerminacion.conditionReached(poblacionActual)) {\n System.out.println(\"Generacion Actual: \" + poblacionActual.getGeneracion());\n poblacionActual = iteration(poblacionActual);\n }\n ArrayList<IndividualFGA<Integer>> individuos = poblacionActual.generaIndividuos();\n IndividualFGA<Integer> mejor = individuos.get(0);\n for (IndividualFGA<Integer> e : individuos) {\n if (mejor.getFitness() <= e.getFitness())\n mejor = e;\n }\n System.out.println(\"Mejor solucion \" + '\\n' + mejor.toString());\n //System.out.println(\"Fitness \" + mejor.getFitness());\n int dim = problema.getDimension();\n int costo = 0;\n int obj1;\n int obj2;\n Phenotype<Integer> fenotipo = mejor.getRepActual();\n for (int i = 0; i < (dim - 1); i++) {\n obj1 = fenotipo.getAllele(i).intValue() - 1;\n for (int j = i + 1; j < dim; j++) {\n obj2 =fenotipo.getAllele(j).intValue() - 1; \n costo = costo + problema.getDistanciaEntre(i,j) * problema.getFlujoEntre(obj1,obj2);\n }\n }\n System.out.println(\"Costo de la solucion: \" + costo);\n\n }", "public Individual getFittest(){\n Individual fittest = individuals.get(0);\n for (Individual individual: individuals){\n if(fittest.equals(individual)){\n continue;\n }\n else if(fittest.getFitness() < individual.getFitness()){\n fittest = individual;\n }\n }\n return fittest;\n }", "private void sortPopulation() {\n println(\"sortPopulation()\", 1);\n //population_size = population.size();\n for(int i = 1; i < population_size; i++) {\n \n //current is the one we're going to put in the right place\n Individual current = population[i];\n double current_fitness = current.getFitness();\n \n //Test to see if current's fitness is better than the previous one; if so, then it's out of order\n double last_fitness = population[i - 1].getFitness();\n \n //if(current_fitness < last_fitness) {\n if(population[i].isLessThan(population[i - 1])) {\n \n println(population[i].getFitness() + \" < \" + population[i - 1].getFitness(), 5);\n //Now, search from the beginning to see where it goes\n int j = 0;\n //System.out.print(\"j = \" + Integer.toString(j) + \" \");\n //while(current_fitness >= population[j].getFitness() && j < population_size - 1) {\n while(population[j].isLessThanOrEqual(population[i]) && j < population_size - 1) {\n j++;\n //System.out.print(\"j = \" + Integer.toString(j) + \" \");\n }\n //We've found the correct place\n Individual temp = new Individual();\n temp = population[i];\n for(int q = i; q > j; q--) {\n population[q] = population[q - 1];\n //System.out.print(\"q = \" + Integer.toString(q) + \" \");\n }\n population[j] = temp;\n }\n }\n }", "public static Individual run(int number) {\n\n //Initialize logging of the run\n\n DetailsLogger.startNewLog(detailsLogPrefix + \".\" + number + \".xml\");\n DetailsLogger.logParams(prop);\n\n //Set the rng seed\n\n RandomNumberGenerator.getInstance().reseed(number);\n\n //Create new population\n Population pop = new Population();\n pop.setPopulationSize(popSize);\n pop.setSampleIndividual(new BooleanIndividual(dimension));\n pop.createRandomInitialPopulation();\n\n\n //Set the options for the evolutionary algorithm\n EvolutionaryAlgorithm ea = new EvolutionaryAlgorithm();\n ea.setCPUCores(cpu_cores);\n ea.setFitnessFunction(new ExampleFitnessFunction());\n ea.addMatingSelector(new RouletteWheelSelector());\n ea.addOperator(new OnePtXOver(xoverProb));\n ea.addOperator(new BitFlipMutation(mutProb, mutProbPerBit));\n\n //Run the algorithm\n\n try {\n OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(fitnessFilePrefix + \".\" + number));\n OutputStreamWriter progOut = new OutputStreamWriter(new FileOutputStream(objectiveFilePrefix + \".\" + number));\n\n for (int i = 0; i < maxGen; i++) {\n\n //Make one generation\n ea.evolve(pop);\n ArrayList<Individual> sorted = pop.getSortedIndividuals();\n //Log the best individual to console.\n System.out.println(\"fitness: \" + sorted.get(0).getFitnessValue() + \" \" + sorted.get(0));\n\n //Add population statistics to the logs\n StatsLogger.logFitness(pop, out);\n StatsLogger.logObjective(pop, progOut);\n }\n\n OutputStreamWriter bestOut = new OutputStreamWriter(new FileOutputStream(bestPrefix + \".\" + number));\n\n Individual bestInd = pop.getSortedIndividuals().get(0);\n bestOut.write(bestInd.toString());\n\n out.close();\n progOut.close();\n bestOut.close();\n\n DetailsLogger.writeLog();\n\n return bestInd;\n } catch (Exception e) {\n e.printStackTrace();\n }\n return null;\n }", "@Test\n\tpublic void testGA() {\n\t\tGenetic ga = new Genetic(100, 500, 10, SelectionType.TOURNAMENT , 0.6, 0.1);\n\t\tOptimumSolution os = ga.run();\n\t\tSystem.out.println(os.getSolution());\n\t}", "<T> GeneticResult<T> train(List<Chromosome<T>> chromosomes){\n\t\tGeneticResult<T> bestFit = maxFitness(chromosomes, 0);\n\t\tfor(int i = 0; i < totalBreedings; i++){\n\t\t\tif(bestFit.getFitness() > sufficientFitness){ break ;}\n\t\t\tchromosomes = breedNewGeneration(chromosomes);\n\t\t\tbestFit = maxFitness(chromosomes, i);\n\t\t}\n\t\treturn bestFit;\n\t}", "void ComputeFitnessBefore(){\n\t\t\t\tint i, pos;\n\t\t\t\t// individual t;\n\t\t\t\tdouble min, sum = 0, tm;\n\t\t\t\t// First Compute Raw fitness\n\t\t\t\tfor(i = 0; i < poplen; i++)\n\t\t\t\t{\n\t\t\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t\t\t}\n\t\t\t\t//tim individual co fitness be nhat\n\t\t\t\tmin = oldpop[0].fitness;\t\t\t\n\t\t\t\tsum = oldpop[0].fitness;\t\t\t\n\t\t\t\t\n\t\t\t\tfor(i = 1; i < poplen; i++) {\n\t\t\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\t\t\tmin = oldpop[i].fitness;\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tsum += oldpop[i].fitness;\t\t\t\t\n\t\t\t\t}\n\t\t\t\t// copy the best and average\n//\t\t\t\tbestBeforeFitness[gen]=min;\n//\t\t\t\tavgBeforeFitness[gen]=sum/poplen;\n//\t\t\t\tbestcurrent[gen] = new individual();\n//\t\t\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n//\t\t\t\taverage[gen] = sum /poplen;\t\t\t\n\t\t\t\t\n\t\t\t}", "private void EvalFitness(){\r\n _FitVal=0;\r\n for(int i=0; i<7;i++)\r\n for(int j=i+1;j<8;j++){\r\n if( _Data[i]==_Data[j]) _FitVal++;\r\n if(j-i==Math.abs(_Data[i]-_Data[j])) _FitVal++;\r\n }\r\n }", "public static void mutation(Individual[] individuals) {\n for (int i = 0; i < POP_SIZE; i++) {\n for (int j = 0; j < GENE_SIZE; j++) {\n double randomNum = Math.random();\n if (randomNum < MUTATION_RATE) {\n randomNum = Math.random();\n ArrayList<String> bitsList = (ArrayList<String>) bits.clone();\n for (int g = 0; g < bitsList.size(); g++) {\n if (individuals[i].gene[j].equals(bitsList.get(g))) {\n String bit = bitsList.get(g);\n bitsList.remove(g);\n int index;\n if (randomNum < 0.5) {\n index = 0;\n } else {\n index = 1;\n }\n individuals[i].gene[j] = bitsList.get(new Random().nextInt(2));\n bitsList.add(bit);\n }\n }\n }\n }\n individuals[i].generateRulebase();\n }\n matingPool = Arrays.copyOf(individuals, individuals.length);\n }", "public void generateIndividual() {\n ordering.add(1);\n ordering.add(2);\n ordering.add(3);\n ordering.add(3);\n ordering.add(5);\n ordering.add(6);\n ordering.add(6);\n ordering.add(1);\n\n numKingdoms = cost.length;\n\t\tfor(int i = 0; i < ordering.size() - 1; i++) {\n\t\t\t//if ith is the same as i+1th, it's conquered\n\t\t\tif(ordering.get(i) == ordering.get(i+1)) {\n\t\t\t\tconquered.add(ordering.get(i));\n\t\t\t}\n\t\t}\n\n\t}", "private static void mating() {\n\t\tint getRand = 0;\n\t\tint parentA = 0;\n\t\tint parentB = 0;\n\t\tint newIndex1 = 0;\n\t\tint newIndex2 = 0;\n\t\tChromosome newChromo1 = null;\n\t\tChromosome newChromo2 = null;\n\n\t\tfor (int i = 0; i < OFFSPRING_PER_GENERATION; i++) {\n\t\t\tparentA = chooseParent();\n\t\t\t// Test probability of mating.\n\t\t\tgetRand = getRandomNumber(0, 100);\n\t\t\tif (getRand <= MATING_PROBABILITY * 100) {\n\t\t\t\tparentB = chooseParent(parentA);\n\t\t\t\tnewChromo1 = new Chromosome();\n\t\t\t\tnewChromo2 = new Chromosome();\n\t\t\t\tpopulation.add(newChromo1);\n\t\t\t\tnewIndex1 = population.indexOf(newChromo1);\n\t\t\t\tpopulation.add(newChromo2);\n\t\t\t\tnewIndex2 = population.indexOf(newChromo2);\n\n\t\t\t\t// Choose either, or both of these:\n\t\t\t\tpartiallyMappedCrossover(parentA, parentB, newIndex1, newIndex2);\n\t\t\t\t// positionBasedCrossover(parentA, parentB, newIndex1, newIndex2);\n\n\t\t\t\tif (childCount - 1 == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex1, 1);\n\t\t\t\t} else if (childCount == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex2, 1);\n\t\t\t\t}\n\n\t\t\t\tpopulation.get(newIndex1).computeConflicts();\n\t\t\t\tpopulation.get(newIndex2).computeConflicts();\n\n\t\t\t\tchildCount += 2;\n\n\t\t\t\t// Schedule next mutation.\n\t\t\t\tif (childCount % (int) Math.round(1.0 / MUTATION_RATE) == 0) {\n\t\t\t\t\tnextMutation = childCount + getRandomNumber(0, (int) Math.round(1.0 / MUTATION_RATE));\n\t\t\t\t}\n\t\t\t}\n\t\t} // i\n\t\treturn;\n\t}", "public NeuralPlayer[] bestIndividual(boolean recalculate)\n\t{\n\t\tif (recalculate)\n\t\t{\n\t\t\tCollection<Callable<Integer>> tasks = new ArrayList<Callable<Integer>>(numThreads);\n\t\t\t\n\t\t\tfor (int i = 0 ; i < hosts.length; i+=partition)\n\t\t\t{\n\t\t\t\tCallable<Integer> worker = new fitnessCalculator(i,Math.min(i+partition,hosts.length),true);\n\t\t\t\ttasks.add(worker);\n\t\t\t}\n\t\t\ttry\n\t\t\t{\n\t\t\t\texecutor.invokeAll(tasks);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tSystem.out.println(\"Something bad happened...\");\n\t\t\t\tSystem.exit(-1);\n\t\t\t}\n\t\t\tArrays.sort(hRandFitnesses,new ArrayComparator(1,false));\n\t\t\tArrays.sort(pRandFitnesses,new ArrayComparator(1,false));\n\t\t\tdouble bestScore = hRandFitnesses[0][1];\n\t\t\tdouble bestIndex = hRandFitnesses[0][0];\n\t\t\t\n\t\t\tif (bestScore >= bestHost)\n\t\t\t{\n\t\t\t\tif (bestScore == 100)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"WE HAVE A PERFECT HOST\");\n\t\t\t\t\tSystem.out.println(\"WE HAVE A PERFECT HOST\");\n\t\t\t\t\tReversiBoard b = new ReversiBoard(boardSize);\n\t\t\t\t\tRandomPlayer r = new RandomPlayer(-1, \"Mr Random\");\n\t\t\t\t\tGame gg = new Game(hosts[(int)bestIndex],r,b);\n\t\t\t\t\tdouble score1 = gg.playGames(1000,false)[0];\n\t\t\t\t\t\n\t\t\t\t\tgg = new Game(allTimeBestHost,r,b);\n\t\t\t\t\tdouble score2 = gg.playGames(1000,false)[0];\n\t\t\t\t\t\n\t\t\t\t\tif (score1 >= score2)\n\t\t\t\t\t{\n\t\t\t\t\t\tbestHost = bestScore;\n\t\t\t\t\t\tallTimeBestHost = new NeuralPlayer(1,\"Da best H\",(BasicNetwork)hosts[(int)bestIndex].net.clone());\n\t\t\t\t\t}\n\t\t\t\t\tperfectHosts.add(new NeuralPlayer(1,\"A good H\",(BasicNetwork)hosts[(int)bestIndex].net.clone()));\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbestHost = bestScore;\n\t\t\t\t\tallTimeBestHost = new NeuralPlayer(1,\"Da best H\",(BasicNetwork)hosts[(int)bestIndex].net.clone());\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tbestScore = pRandFitnesses[0][1];\n\t\t\tbestIndex = pRandFitnesses[0][0];\n\t\t\t\n\t\t\tif (bestScore >= bestPara)\n\t\t\t{\n\t\t\t\tif (bestScore == 100)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"WE HAVE A PERFECT PARASITE\");\n\t\t\t\t\tSystem.out.println(\"WE HAVE A PERFECT PARASITE\");\n\t\t\t\t\tReversiBoard b = new ReversiBoard(boardSize);\n\t\t\t\t\tRandomPlayer r = new RandomPlayer(1, \"Mr Random\");\n\t\t\t\t\tGame gg = new Game(r,parasites[(int)bestIndex],b);\n\t\t\t\t\tdouble score1 = gg.playGames(1000,false)[1];\n\t\t\t\t\t\n\t\t\t\t\tgg = new Game(allTimeBestPara,r,b);\n\t\t\t\t\tdouble score2 = gg.playGames(1000,false)[1];\n\t\t\t\t\t\n\t\t\t\t\tif (score1 >= score2)\n\t\t\t\t\t{\n\t\t\t\t\t\tbestPara = bestScore;\n\t\t\t\t\t\tallTimeBestPara = new NeuralPlayer(-1,\"Da best P\",(BasicNetwork)parasites[(int)bestIndex].net.clone());\n\t\t\t\t\t}\n\t\t\t\t\tperfectParasites.add(new NeuralPlayer(-1,\"A good P\",(BasicNetwork)parasites[(int)bestIndex].net.clone()));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbestPara = bestScore;\n\t\t\t\t\tallTimeBestPara = new NeuralPlayer(-1,\"Da best P\",(BasicNetwork)parasites[(int)bestIndex].net.clone());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tNeuralPlayer[] result = {allTimeBestHost,allTimeBestPara};\n\t\treturn result;\n\t}", "public List<Map.Entry<Chromosome, BigDecimal>> Tournament()\r\n\t{\n\t\tint parentsAdded=0;\r\n\t\tList<Map.Entry<Chromosome, BigDecimal>> listParents= new ArrayList();\r\n\t\tList<Map.Entry<Chromosome, BigDecimal>> listCandidates = new ArrayList<Map.Entry<Chromosome, BigDecimal>>(p.getChromosomes().entrySet());\r\n\t\twhile(parentsAdded<ConfigurationsGA.SIZE_PARENTSFORCROSSOVER)\r\n\t\t{\r\n\t\t\t//here we randomize the list in order to select k random elements for the tournament\r\n\t\t\tCollections.shuffle(listCandidates);\r\n\t\t\tMap.Entry<Chromosome, BigDecimal> best=null;\r\n\r\n\t\t\tfor(int i=0; i<ConfigurationsGA.K_TOURNMENT; i++)\r\n\t\t\t{\r\n\r\n\t\t\t\tif(best==null || listCandidates.get(i).getValue().intValue()>best.getValue().intValue())\r\n\t\t\t\t{\r\n\t\t\t\t\tbest=listCandidates.get(i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//here we add the champion as a parent\r\n\t\t\tlistParents.add(best);\r\n\t\t\tparentsAdded++;\r\n\t\t}\r\n\t\treturn listParents;\r\n\t}", "public static void playTournament(\n\t\t ArrayList<MazePlayer> players,\n\t\t int width, int depth, \n\t\t int reps, int steps) {\n\t System.out.println(\"Playing tournament!\");\n\n\t int[][] winners = new int[players.size()][players.size()];\n\t for (MazePlayer p1:players)\n\t\t for (MazePlayer p2:players)\n\t\t if (!p1.equals(p2))\n\t\t for (int k=0;k<reps;k++){\n\t\t\t MazeGame g = new MazeGame(width,depth);\n\t\t\t g.addPlayer(p1);\n\t\t\t g.addPlayer(p2);\n\n\t\t\t for(int i=0;i<steps;i++){\n\t\t\t\t\tif (MazeGame.debugging) System.out.println(\"\\n\\n************\\nround \"+i);\n\t\t\t\t\tif (MazeGame.debugging) System.out.println(g.theBoard.drawBoard(g.playerPosition,g.jewelPosition));\n\t\t\t\t for (MazePlayer p: g.player.values()){\n\t\t\t\t\t\t Direction d = p.nextMove(g.playerPosition,g.jewelPosition,g.theBoard);\n\t\t\t\t\t\t g.movePlayer(p,d);\n\t\t\t\t\t }\n\t\t\t }\n\t\t\t int scoreDiff = g.score.get(p1.name)-g.score.get(p2.name);\n\t\t\t System.out.println(p1.name+\" vs \"+p2.name+\" = \"+scoreDiff);\n\t\t\t if (scoreDiff>0){\n\t\t\t\t winners[players.indexOf(p1)][players.indexOf(p2)] += 1;\n\t\t\t }\n\t\t\t else {\n\t\t\t\t winners[players.indexOf(p2)][players.indexOf(p1)] += 1;\t\t\t \n\t\t\t }\n\t\t }\n\t System.out.println(\"Results\");\n\t for (int i=0;i<players.size();i++){\n\t\t int sum=0;\n\t\t for(int j=0;j<players.size();j++){\n\t\t\t sum += winners[i][j];\n\t\t\t System.out.print(\"\\t\"+winners[i][j]);\n\t\t }\n\t\t System.out.println(\"\\t\"+sum+\"\\t\"+players.get(i).name);\n\t }\n\t for (int j=0;j<players.size();j++){\n\t\t int losses=0;\n\t\t for (int i=0;i<players.size();i++) {\n\t\t\t losses += winners[i][j];\n\t\t }\n\t\t System.out.print(\"\\t\"+losses);\n\t }\n\t System.out.println();\n }", "private static double fitness(PMCGenotype gene, int trials)\n\t{\n\t\tController<MOVE> btc = new PacManBTController(decode(gene));\n\t\treturn runExperiment(btc, ghostController, trials);\n\t}", "private void mutate(float probability) {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n float temp_genes[] = this.offspring_population.getPopulation()[i].getGenes();\r\n\r\n // mutation can now mutate wild cards\r\n for (int j = 0; j < temp_genes.length; j++) {\r\n float k = new Random().nextFloat();\r\n\r\n if (k <= probability) {\r\n float temp = new Random().nextFloat();\r\n temp_genes[j] = temp; // add a float between 0-1 // just mutate a new float\r\n }\r\n }\r\n individual child = new individual(temp_genes, solutions, output);\r\n temp_pop[i] = child;\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "public void reproduce(){\n\t\t// sort the population from strongest to weakest\n\t\tCollections.sort(population);\n\t\tCollections.reverse(population);\n\t\t\n\t\tfor(int i = 0; i < (int)(POPULATION_SIZE*POPULATION_ACTION_PERCENT); i+=2){\n\t\t\t\n\t\t\t// get two random indexes for reproduction based on the exponential function\n\t\t\t// (1/1000) * (randInt)^2 = index\n\t\t\t// this function favors sequences with higher fitness scores\n\t\t\tint randIndex1 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\tint randIndex2 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\t\n\t\t\trandIndex1 = (int) (Math.pow(randIndex1, 2) / 1000);\n\t\t\trandIndex2 = (int) (Math.pow(randIndex2, 2) / 1000);\n\t\t\t\n\t\t\t// get two pieces\n\t\t\tBuildingPiece[] array1 = population.get(randIndex1).getList();\n\t\t\tBuildingPiece[] array2 = population.get(randIndex2).getList();\n\t\t\t\n\t\t\t// find a splicing point\n\t\t\tint splicePoint = findSplicingPoint(array1, array2);\n\t\t\t\n\t\t\t// generate two new arrays based on the splicing point\n\t\t\tBuildingPiece[] newArray1 = generateNewArray(array1, array2, splicePoint);\n\t\t\tBuildingPiece[] newArray2 = generateNewArray(array2, array1, splicePoint);\n\t\t\t\n\t\t\t// make new buildings with the new arrays\n\t\t\tBuilding bp1 = new Building(newArray1, generation, possiblePieces);\n\t\t\tBuilding bp2 = new Building(newArray2, generation, possiblePieces);\n\t\t\t\n\t\t\t// mutate the new building sequences\n\t\t\tmutateArray(bp1);\n\t\t\tmutateArray(bp2);\n\t\t\t\n\t\t\t// add them into the population\n\t\t\tpopulation.add(randIndex1, bp1);\n\t\t\tpopulation.add(randIndex2, bp2);\n\t\t}\n\t}", "@Test\r\n\tpublic void executeFortification() {\r\n\r\n\t\tHashMap<String, ArrayList<String>> fortificationScenarios = playerOne.getStrategyType()\r\n\t\t\t\t.getFortificationScenarios();\r\n\r\n\t\tHashMap<String, Integer> armiesPerPotentialFortificationSourceCountry = new HashMap<String, Integer>();\r\n\r\n\t\t// Print all the options out for the player to see and choose from\r\n\t\tfor (String keySourceCountry : fortificationScenarios.keySet()) {\r\n\t\t\tarmiesPerPotentialFortificationSourceCountry.put(keySourceCountry,\r\n\t\t\t\t\tplayerOne.getStrategyType().gameData.gameMap.getCountry(keySourceCountry).getCountryArmyCount());\r\n\t\t}\r\n\r\n\t\tArrayList<String> sourceCountries = new ArrayList<String>(fortificationScenarios.keySet());\r\n\t\tString randomSourceCountry = sourceCountries.get(random.nextInt(sourceCountries.size()));\r\n\r\n\t\tArrayList<String> correspondingDestinationCountries = fortificationScenarios.get(randomSourceCountry);\r\n\t\tString randomCorrespondingDestinationCountry = correspondingDestinationCountries\r\n\t\t\t\t.get(random.nextInt(correspondingDestinationCountries.size()));\r\n\r\n\t\tInteger possibleNumOfArmyRange = armiesPerPotentialFortificationSourceCountry.get(randomSourceCountry) - 1;\r\n\t\tInteger randomNumberOfArmiesToMove = 0;\r\n\r\n\t\twhile (randomNumberOfArmiesToMove == 0) {\r\n\t\t\trandomNumberOfArmiesToMove = random.nextInt(possibleNumOfArmyRange + 1);\r\n\t\t}\r\n\r\n\t\tInteger sourceCountryArmyCountBeforeFortification = playerOne.getStrategyType().gameData.gameMap\r\n\t\t\t\t.getCountry(randomSourceCountry).getCountryArmyCount();\r\n\t\tInteger correspondingDestinationCountryArmyCountBeforeFortification = playerOne\r\n\t\t\t\t.getStrategyType().gameData.gameMap.getCountry(randomCorrespondingDestinationCountry)\r\n\t\t\t\t\t\t.getCountryArmyCount();\r\n\r\n\t\tInteger sourceCountryArmyCountAfterFortification = sourceCountryArmyCountBeforeFortification\r\n\t\t\t\t- randomNumberOfArmiesToMove;\r\n\r\n\t\tInteger correspondingDestinationCountryArmyCountAfterFortification = correspondingDestinationCountryArmyCountBeforeFortification\r\n\t\t\t\t+ randomNumberOfArmiesToMove;\r\n\r\n\t\tplayerOne.getStrategyType().executeFortification();\r\n\r\n\t\tassertEquals(sourceCountryArmyCountAfterFortification,\r\n\t\t\t\tplayerOne.getStrategyType().gameData.gameMap.getCountry(randomSourceCountry).getCountryArmyCount());\r\n\t\tassertEquals(correspondingDestinationCountryArmyCountAfterFortification,\r\n\t\t\t\tplayerOne.getStrategyType().gameData.gameMap.getCountry(randomCorrespondingDestinationCountry)\r\n\t\t\t\t\t\t.getCountryArmyCount());\r\n\r\n\t}", "@Test\r\n\tpublic void executeReinforcement() {\r\n\r\n\t\tInteger reinforcementArmy = playerOne.getStrategyType().calculateReinforcementArmy();\r\n\r\n\t\tHashSet<String> countriesOwned = playerOne.getStrategyType().gameData.gameMap\r\n\t\t\t\t.getConqueredCountries(playerOne.getStrategyType().getPlayerID());\r\n\r\n\t\tArrayList<String> countriesOwnedList = new ArrayList<>(countriesOwned);\r\n\r\n\t\tHashMap<String, Integer> expectedArmyCountPerCountryAfterReinforcement = new HashMap<>();\r\n\r\n\t\tfor (String country : countriesOwnedList) {\r\n\t\t\texpectedArmyCountPerCountryAfterReinforcement.put(country,\r\n\t\t\t\t\tplayerOne.getStrategyType().gameData.gameMap.getCountry(country).getCountryArmyCount());\r\n\t\t}\r\n\r\n\t\twhile (reinforcementArmy > 0) {\r\n\r\n\t\t\tInteger randomReinforcementCount = 0;\r\n\t\t\tInteger randomCountryIndex = random.nextInt(countriesOwnedList.size());\r\n\r\n\t\t\tString randomCountry = countriesOwnedList.get(randomCountryIndex);\r\n\r\n\t\t\twhile (randomReinforcementCount == 0) {\r\n\t\t\t\trandomReinforcementCount = random.nextInt(reinforcementArmy + 1);\r\n\t\t\t}\r\n\r\n\t\t\tInteger randomCountryArmyCountBeforeFortification = expectedArmyCountPerCountryAfterReinforcement\r\n\t\t\t\t\t.get(randomCountry);\r\n\r\n\t\t\tInteger randomCountryArmyCountAfterFortification = randomCountryArmyCountBeforeFortification\r\n\t\t\t\t\t+ randomReinforcementCount;\r\n\r\n\t\t\texpectedArmyCountPerCountryAfterReinforcement.put(randomCountry, randomCountryArmyCountAfterFortification);\r\n\r\n\t\t\treinforcementArmy -= randomReinforcementCount;\r\n\r\n\t\t}\r\n\r\n\t\tplayerOne.getStrategyType().executeReinforcement();\r\n\r\n\t\tHashMap<String, Integer> actualArmyCountPerCountryAfterReinforcement = new HashMap<>();\r\n\r\n\t\tfor (String country : countriesOwnedList) {\r\n\t\t\tactualArmyCountPerCountryAfterReinforcement.put(country,\r\n\t\t\t\t\tplayerOne.getStrategyType().gameData.gameMap.getCountry(country).getCountryArmyCount());\r\n\t\t}\r\n\r\n\t\tassertEquals(actualArmyCountPerCountryAfterReinforcement, expectedArmyCountPerCountryAfterReinforcement);\r\n\t\t// assertTrue(strongerCountryAfterReinforcement >\r\n\t\t// strongerCountryBeforeReinforcement);\r\n\r\n\t}", "public double fitness()\n/* */ {\n/* 40 */ return 1.0D / (1.0D + this.distance);\n/* */ }", "private int copyFitnessValuesToFitnessTable(IGANsgaPopulation pop,\r\n FitnessTable ft) {\r\n int size = pop.size();\r\n int numObj = pop.getNumObjectives();\r\n int numRankZero = 0;\r\n for (int j = 0; j < size; j++) {\r\n IGANsgaSolution sol = (IGANsgaSolution) pop.getMember(j);\r\n if (sol.getRank() == 0) {\r\n numRankZero++;\r\n }\r\n for (int k = 0; k < numObj; k++) {\r\n ft.setFitnessValue(sol.getObjective(k), j, k);\r\n }\r\n }\r\n return numRankZero;\r\n }", "public MyPacMan optimise(List<double[]> dimensionList){\n for(int i = 0; i < POPULATION_SIZE; i++){\r\n MyPacMan individual = new MyPacMan(dimensionList);\r\n population.add(individual);\r\n \r\n } \r\n \r\n // try more than one iteration \r\n for(int iterationCount = 0; iterationCount < ITERATION_NO; iterationCount++){\r\n \r\n System.out.println(\"Iterazione n°: \" + Integer.toString(iterationCount));\r\n \r\n if(iterationCount%10 == 0 || iterationCount == ITERATION_NO-1){\r\n try {\r\n pw = new PrintWriter(new File(\"data/popoluation_\" + Integer.toString(iterationCount) +\".csv\"));\r\n } catch (FileNotFoundException ex) {\r\n \r\n } \r\n \r\n \r\n for(int n = 0; n < dimensionList.size(); n++){ \r\n pw.write(\"v\" + Integer.toString(n));\r\n pw.write(\",\");\r\n }\r\n \r\n pw.write(\"fValue\");\r\n\r\n pw.write(\"\\n\");\r\n \r\n for (MyPacMan individual : population) {\r\n pw.write(individual.toString());\r\n pw.write(\",\");\r\n pw.write(Double.toString(fitFunction(individual)));\r\n pw.write(\"\\n\");\r\n }\r\n \r\n pw.flush();\r\n }\r\n \r\n int loop = 0;\r\n \r\n // main loop for evolution\r\n while(loop < population.size()){ \r\n\r\n MyPacMan original = null;\r\n MyPacMan candidate = null;\r\n boolean boundsHappy;\r\n\r\n do{\r\n boundsHappy = true;\r\n // pick an agent from the the population\r\n int x = loop;\r\n int a,b,c = -1;\r\n\r\n // pick three random agents from the population\r\n // make sure that they are not identical to selected agent from\r\n // the population \r\n\r\n do{\r\n a = random.nextInt(population.size());\r\n }while(x == a);\r\n do{\r\n b = random.nextInt(population.size());\r\n }while(b==x || b==a);\r\n do{\r\n c = random.nextInt(population.size());\r\n }while(c == x || c == a || c == b);\r\n\r\n // create three agent individuals\r\n MyPacMan individual1 = population.get(a);\r\n MyPacMan individual2 = population.get(b);\r\n MyPacMan individual3 = population.get(c);\r\n\r\n // create a noisy random candidate\r\n MyPacMan noisyRandomCandicate = new MyPacMan(dimensionList);\r\n\r\n // mutation process\r\n // if an element of the trial parameter vector is\r\n // found to violate the bounds after mutation and crossover, it is reset in such a way that the bounds\r\n // are respected (with the specific protocol depending on the implementation)\r\n for(int n = 0; n < dimensionList.size(); n++){ \r\n noisyRandomCandicate.dataValue[n] = (individual1.dataValue[n] + DIFFERENTIAL_WEIGHT * (individual2.dataValue[n] - individual3.dataValue[n])); \r\n } \r\n\r\n // Create a trial candicate \r\n original = population.get(x);\r\n candidate = new MyPacMan(dimensionList);\r\n\r\n // copy values from original agent to the candidate agent\r\n for(int n = 0; n < dimensionList.size(); n++){ \r\n candidate.dataValue[n] = original.dataValue[n];\r\n } \r\n\r\n // crossver process with the selected individual\r\n // pick a random dimension, which defintely takes the value from the noisy random candidate\r\n int R = random.nextInt(dimensionList.size());\r\n\r\n for(int n = 0; n < dimensionList.size(); n++){\r\n\r\n double crossoverProbability = random.nextDouble();\r\n\r\n if(crossoverProbability < CROSSOVER_PROBABILITY || n == R){\r\n candidate.dataValue[n] = noisyRandomCandicate.dataValue[n];\r\n }\r\n\r\n }\r\n\r\n // check here if the trial candiate satisfies bounds for each value\r\n for(int n = 0; n < dimensionList.size(); n++){ \r\n if(candidate.dataValue[n] < dimensionList.get(n)[0] || candidate.dataValue[n] > dimensionList.get(n)[1]){\r\n boundsHappy = false;\r\n }\r\n }\r\n\r\n }while(boundsHappy == false);\r\n\r\n //see if the candidate is better than original, if so replace it\r\n if(fitFunction(original) < fitFunction(candidate)){\r\n population.remove(original);\r\n population.add(candidate); \r\n }\r\n loop++;\r\n } \r\n }\r\n \r\n MyPacMan bestFitness = new MyPacMan(dimensionList);\r\n \r\n // selecting the final best agent from the the population\r\n for(int i = 0; i < population.size(); i++){\r\n MyPacMan individual = population.get(i);\r\n \r\n if(fitFunction(bestFitness) < fitFunction(individual)){\r\n \r\n try {\r\n bestFitness = (MyPacMan) individual.clone();\r\n } catch (CloneNotSupportedException ex) {\r\n \r\n }\r\n }\r\n }\r\n \r\n System.out.println(\"Fitness migliore: \" + fitFunction(bestFitness));\r\n return bestFitness;\r\n }", "private static Population getBestPossibleParettoOfAGS(){\n int numberOfRounds = 10;\n Population allFrontsMembers = new Population();\n\n NSGAII nsgaii = new NSGAII();\n SPEA2 spea2 = new SPEA2();\n AEMMT aemmt = new AEMMT();\n AEMMD aemmd = new AEMMD();\n MOEAD moead = new MOEAD();\n\n ProblemKnapsackFromFile problem = new ProblemKnapsackFromFile(macPathGetProblemFrom);\n progressBar = new ProgressBar((double) numberOfRounds);\n\n for (int i = 0; i < numberOfRounds; i++) {\n\n Parameters.NUMBER_OF_GENERATIONS = problem.items.size() < 100? 100 : 200;\n\n System.out.println(\"NSGAII\");\n nsgaii.runAlgorithm(problem);\n allFrontsMembers.population.addAll(nsgaii.paretto.membersAtThisFront);\n\n System.out.println(\"SPEA2\");\n spea2.runAlgorithm(problem);\n allFrontsMembers.population.addAll(spea2.paretto.membersAtThisFront);\n\n //moead.runAlgorithm(problem);\n //allFrontsMembers.population.addAll( moead.pareto.membersAtThisFront);\n\n Parameters.NUMBER_OF_GENERATIONS = 15000;\n System.out.println(\"AEMMT\");\n aemmt.runAlgorithm(problem);\n allFrontsMembers.population.addAll(aemmt.paretto.membersAtThisFront);\n\n System.out.println(\"AEMMD\");\n aemmd.runAlgorithm(problem);\n allFrontsMembers.population.addAll(aemmd.paretto.membersAtThisFront);\n\n progressBar.addJobDone();\n\n allFrontsMembers.fastNonDominatedSort();\n Problem.removeSimilar(allFrontsMembers.fronts.allFronts.get(0),problem);\n allFrontsMembers.population = allFrontsMembers.fronts.allFronts.get(0).membersAtThisFront;\n }\n\n problem.printResolutionMessage();\n //Printer.printBinaryMembers(allFrontsMembers);\n System.out.println(\"ALL FRONTS SIZE: \"+allFrontsMembers.population.size());\n\n return allFrontsMembers;\n }", "public static void mutate(Chromosome chrome) {\n \n // Loop through tour cities\n for(int rosterNursePos1=0; rosterNursePos1 < chrome.ChromosomeRowSize(); rosterNursePos1++){\n for (int rosterDayPos1=0; rosterDayPos1<chrome.chromosomeColumnCount();rosterDayPos1++){\n if(RosterManager.isPreviousShift(chrome.getShift(rosterNursePos1, rosterDayPos1))==false || RosterManager.isNextShift(chrome.getShift(rosterNursePos1, rosterDayPos1))==false || chrome.getShift(rosterNursePos1, rosterDayPos1).getHours()!=0 ){\n if(Math.random() < mutationRate){\n // Get a second random position in the tour\n int rosterNursePos2= rosterNursePos1;\n int rosterDayPos2 = returnValidPos(rosterNursePos2, randomizeShiftGeneration(chrome), chrome );\n\n // Get the cities at target position in tour\n Gene gene1 = chrome.retrieveGene(rosterNursePos1, rosterDayPos1);\n Gene gene2 = chrome.retrieveGene(rosterNursePos2, rosterDayPos2);\n\n // Swap them around\n chrome.saveGene(rosterNursePos1, rosterDayPos1, gene2);\n chrome.saveGene(rosterNursePos2, rosterDayPos2, gene1);\n \n }\n \n \n } \n // Apply mutation rate\n \n }\n \n }\n \n \n }", "public Population evolve()\r\n {\r\n\tArrayList<Chromosome> tempPop = \r\n\t new ArrayList<Chromosome>(chromos.size());\r\n\tChromosome u;\r\n\tChromosome v;\r\n\r\n\tfor(int i = 0; i < chromos.size()/2; i++)\r\n\t {\r\n\t\tu = selectParent();\r\n\t\tv = selectParent();\r\n\t\t\r\n\t\t//System.out.println(\"*****Parent 1 : \\n\" + v);\r\n\t\t\r\n Chromosome c1 = u.child(v);\r\n Chromosome c2 = v.child(u);\r\n\t\ttempPop.add(c1);\r\n\t\ttempPop.add(c2);\r\n\t\t\r\n //System.out.println(\"****Generated new child: \\n\" + c1);\r\n\t }\t \r\n\t\r\n\t// if needed, add in the code for keeping the best chromosome\r\n\tPopulation pop = new Population(tempPop, selMethod, selPara, \r\n\t\t\t\t\tcrossMethod, crossPara, mutMethod, mutPara, \r\n\t\t\t\t\treplaceMethod, replacePara, powerStep, tourStep, ff);\r\n\r\n\tif(replaceMethod == ELITISM)\r\n\t {\r\n\t\tpop.remove(worstChromoIndex);\r\n\t\tpop.add(bestChromo.clone());\r\n\t\tpop.initialize();\r\n\t }\r\n\r\n\tgeneration++;\r\n\treturn pop;\r\n }", "public static void runAGeneration() {\n //Breeds Population until max population size for genetic drift\n breedAll();\n\n //Genocides Population by fitness\n genocide();\n\n System.out.println(\"\\nPopulation: \");\n\n //prints population\n printPopulation();\n }", "@Override\n\tpublic Solution<TTPVariable> run(SingleObjectiveThiefProblem thief, IEvaluator evaluator, MyRandom rand) {\n\t\tTTPVariable var = TTPVariable.create(new TourOptimalFactory(thief).next(rand), Pack.empty());\n\t\tSolution<TTPVariable> currentBest = thief.evaluate(var);\n\t\t\n\n\t\twhile (evaluator.hasNext()) {\n\n\t\t\t// now take the tour and optimize packing plan\n\t\t\tSolution<Pack> nextPack = optPack(thief, evaluator, rand, currentBest.getVariable().getTour(), currentBest.getVariable().getPack());\n\t\t\t\n\t\t\tSolution<Tour> nextTour = optTour(thief, evaluator, rand, currentBest.getVariable().getTour(), nextPack.getVariable());\n\t\t\t\n\t\t\tTTPVariable next = TTPVariable.create(nextTour.getVariable(), nextPack.getVariable());\n\t\t\tSolution<TTPVariable> s = thief.evaluate(next);\n\t\t\t\n\t\t\t//System.out.println(nextPack);\n\t\t\t//System.out.println(currentBest);\n\t\t\t//System.out.println(\"----------------\");\n\t\t\t\n\t\t\t// update the best found solution\n\t\t\tif (SolutionDominator.isDominating(s, currentBest)) {\n\t\t\t\tcurrentBest = s;\n\t\t\t\t//System.out.println(\"YES\");\n\t\t\t}\n\t\t\tevaluator.notify(currentBest);\n\n\t\t}\n\n\t\treturn currentBest;\n\t}", "public void reproduce(int generation, IPopulation pop, List<ISpecies> sorted_species) {\n\t\tfor(ISpecies specie : sorted_species){\r\n\r\n\t\t\tList<IOrganism> organisms = specie.getOrganisms();\r\n\r\n\t\t\t// outside the species\r\n\t\t\tint orgnum = 0;\r\n\r\n\t\t\tIOrganism mom = null;\r\n\t\t\tIOrganism baby = null;\r\n\t\t\tIGenome new_genome = null;\r\n\t\t\tIOrganism _organism = null;\r\n\t\t\tIOrganism _dad = null;\r\n\r\n\t\t\tif (specie.getExpectedOffspring() > 0 && organisms.size() == 0)\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// elements for this species\r\n\t\t\tint poolsize = organisms.size() - 1;\r\n\r\n\t\t\t// the champion of the 'this' species is the first element of the species;\r\n\t\t\tIOrganism thechamp = organisms.get(0);\r\n\t\t\tboolean champ_done = false; // Flag the preservation of the champion\r\n\r\n\t\t\t// Create the designated number of offspring for the Species one at a time.\r\n\t\t\tfor (int count = 0; count < specie.getExpectedOffspring(); count++) {\r\n\r\n\t\t\t\t// If we have a super_champ (Population champion), finish off some special clones.\r\n\t\t\t\tif (thechamp.getSuperChampOffspring() > 0) {\r\n\r\n\t\t\t\t\t// save in mom current champ;\r\n\t\t\t\t\tmom = thechamp;\r\n\t\t\t\t\t// create a new genome from this copy\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tif ((thechamp.getSuperChampOffspring()) > 1) {\r\n\t\t\t\t\t\tif (RandomUtils.randomDouble() < .8 || evolutionParameters.getDoubleParameter(MUTATE_ADD_LINK_PROB) == 0.0)\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateLinkWeight(new_genome, evolutionParameters.getDoubleParameter(WEIGHT_MUT_POWER), 1.0, MutationType.GAUSSIAN);\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t// Sometimes we add a link to a superchamp\r\n\t\t\t\t\t\t\tnew_genome.generatePhenotype(generation);\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateAddLink(new_genome,pop);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\tthechamp.incrementSuperChampOffspring();\r\n\t\t\t\t} // end population champ\r\n\r\n\t\t\t\t// If we have a Species champion, just clone it\r\n\t\t\t\telse if ((!champ_done) && (specie.getExpectedOffspring() > 5)) {\r\n\t\t\t\t\tmom = thechamp; // Mom is the champ\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation); // Baby is\r\n\t\t\t\t\t// just like mommy\r\n\t\t\t\t\tchamp_done = true;\r\n\r\n\t\t\t\t} else if (RandomUtils.randomDouble() < evolutionParameters.getDoubleParameter(MUTATE_ONLY_PROB) || poolsize == 1) {\r\n\r\n\t\t\t\t\t// Choose the random parent\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\r\n\t\t\t\t\t// Do the mutation depending on probabilities of various mutations\r\n\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\t// Otherwise we should mate\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Choose the random mom\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\r\n\t\t\t\t\t// save in mom\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\t// Choose random dad...\r\n\t\t\t\t\t// Mate within Species\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(INTERSPECIES_MATE_RATE)) {\r\n\t\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\t\t_dad = _organism;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Mate outside Species\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// save current species\r\n\t\t\t\t\t\tISpecies randspecies = specie;\r\n\t\t\t\t\t\t// Select a random species\r\n\t\t\t\t\t\tint giveup = 0;\r\n\t\t\t\t\t\t// Give up if you can't find a different Species\r\n\t\t\t\t\t\twhile ((randspecies == specie) && (giveup < 5)) {\r\n\r\n\t\t\t\t\t\t\t// Choose a random species tending towards better species\r\n\t\t\t\t\t\t\tdouble randmult = Math.min(1.0, RandomUtils.randomGaussian() / 4);\r\n\r\n\t\t\t\t\t\t\t// This tends to select better species\r\n\t\t\t\t\t\t\tint sp_ext = Math.max(0, (int) Math.floor((randmult * (sorted_species.size() - 1.0)) + 0.5));\r\n\t\t\t\t\t\t\trandspecies = sorted_species.get(sp_ext);\r\n\t\t\t\t\t\t\t++giveup;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t_dad = randspecies.getOrganisms().get(0);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tnew_genome = evolutionStrategy.getCrossoverStrategy().performCrossover(mom,_dad,count);\r\n\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(MATE_ONLY_PROB) || \r\n\t\t\t\t\t\t\t_dad.getGenome().getId() == mom.getGenome().getId() || \r\n\t\t\t\t\t\t\t_dad.getGenome().compatibility(mom.getGenome()) == 0.0) {\r\n\r\n\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\t} \r\n\t\t\t\t\t// end block of prob\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\r\n\t\t\t\t\t// Create the baby without mutating first\r\n\t\t\t\t\telse \r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\tevolutionStrategy.getSpeciationStrategy().addOrganismToSpecies(pop, baby);\r\n\t\t\t} // end offspring cycle\r\n\t\t}\r\n\t}", "public void evaluate() {\n for (Chromosome chromo : chromosomes) {\n double chromoGH = chromo.getTotalGH();\n if (chromo.isValid()) {\n this.validChromosomes++;\n if (chromoGH > this.getBestScore()) {\n this.bestScore = chromoGH;\n this.setBestChromo(chromo);\n }\n }\n //Log.debugMsg(chromo.getTotalGH().toString());\n// this.map.put(chromoGH, chromo);\n }\n }", "public void generateNextGeneration() {\n int neighbours;\n int minimum = Integer.parseInt(PreferencesActivity\n .getMinimumVariable(this._context));\n int maximum = Integer.parseInt(PreferencesActivity\n .getMaximumVariable(this._context));\n int spawn = Integer.parseInt(PreferencesActivity\n .getSpawnVariable(this._context));\n\n minimum = 2;\n maximum = 3;\n spawn = 3;\n\n int[][] nextGenerationLifeGrid = new int[HEIGHT][WIDTH];\n\n\n\n for (int h = 0; h < HEIGHT; h++) {\n for (int w = 0; w < WIDTH; w++) {\n neighbours = calculateNeighbours(h, w);\n\n\n if (_lifeGrid[h][w] != 0) {\n if ((neighbours >= minimum) && (neighbours <= maximum)) {\n nextGenerationLifeGrid[h][w] = neighbours;\n }\n\n } else {\n if (neighbours == spawn) {\n nextGenerationLifeGrid[h][w] = spawn;\n\n }\n }\n\n }\n\n }\n\n copyGrid(nextGenerationLifeGrid, _lifeGrid);\n\n }", "public void incrementFitnessBy2()\n {\n this.fitness=this.fitness+2;\n }", "private static void mutate(Tour tour) {\n // Loop through tour cities\n for(int tourPos1=0; tourPos1 < tour.tourSize(); tourPos1++){\n // Apply mutation rate\n if(Math.random() < mutationRate){\n // Get a second random position in the tour\n int tourPos2 = (int) (tour.tourSize() * Math.random());\n\n // Get the cities at target position in tour\n City city1 = tour.getCity(tourPos1);\n City city2 = tour.getCity(tourPos2);\n\n // Swap them around\n tour.setCity(tourPos2, city1);\n tour.setCity(tourPos1, city2);\n }\n }\n }", "public ChesspairingTournament generateNextRound(ChesspairingTournament tournament) {\n\t\tthis.mTournament = tournament;\n\t\tthis.mTournament.setParringSummary(Tools.buildParringStarted());\n\t\t// more tan 1 players\n\t\tif (mTournament.getPlayers().size() < 2) {\n\t\t\tthrow new IllegalStateException(\"Please ad at least 2 players or more\");\n\t\t}\n\n\t\t// more rounds than totalRounds? For the moment I do not want to deal\n\t\t// with this use case\n\t\tif (mTournament.getTotalRounds() <= mTournament.getRounds().size()) {\n\t\t\tthrow new IllegalStateException(\"You are trying to generate more rounds than totalRounds\");\n\t\t}\n\n\t\tboolean validationOk = validateOrder();\n\t\tif (!validationOk) {\n\t\t\treturn mTournament;\n\t\t}\n\n\t\tList<ChesspairingRound> rounds = this.mTournament.getRounds();\n\t\tif (rounds.size() <= 0) {\n\t\t\tgenerateFirstRound();\n\t\t\treturn this.mTournament;\n\t\t}\n\n\t\t// make sure that the next round can be generated\n\t\tif (!canIGenerateNextRound()) {\n\t\t\tmTournament.getParringSummary().setShortMessage(PairingSummary.PARRING_NOT_OK);\n\t\t\tmTournament.getParringSummary().setLongMessage(\"You can not generate the next round!\");\n\t\t\treturn mTournament;\n\t\t}\n\n\t\tint roundNumber = mTournament.getRounds().size();\n\t\tcomputeInitialTournamentState(roundNumber);\n\n\t\tcomputeNextRound(roundNumber + 1);\n\t\t// order games points,elo,index\n\n\t\tList<ChesspairingGame> games = this.generatedRound.getGames();\n\t\t// index\n\t\t// the smallest index first\n\t\tCollections.sort(games, new Comparator<ChesspairingGame>() {\n\t\t\t@Override\n\t\t\tpublic int compare(ChesspairingGame o1, ChesspairingGame o2) {\n\t\t\t\tint indexO1 = getHighestIndex(o1);\n\t\t\t\tint indexO2 = getHighestIndex(o2);\n\t\t\t\treturn Integer.compare(indexO1, indexO2);\n\t\t\t}\n\t\t});\n\n\t\t// the highest elo first\n\t\tCollections.sort(games, new Comparator<ChesspairingGame>() {\n\t\t\t@Override\n\t\t\tpublic int compare(ChesspairingGame o1, ChesspairingGame o2) {\n\t\t\t\tint eloO1 = getHighestElo(o1);\n\t\t\t\tint eloO2 = getHighestElo(o2);\n\t\t\t\t// the highest value should be ordered first so wee multiply by\n\t\t\t\t// -1\n\t\t\t\treturn -1 * Integer.compare(eloO1, eloO2);\n\t\t\t}\n\t\t});\n\n\t\t// the highest points first\n\t\tCollections.sort(games, new Comparator<ChesspairingGame>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(ChesspairingGame o1, ChesspairingGame o2) {\n\t\t\t\tDouble pointsO1 = getHighestPoints(o1);\n\t\t\t\tDouble pointsO2 = getHighestPoints(o2);\n\t\t\t\treturn -1 * Double.compare(pointsO1, pointsO2);\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * number the games\n\t\t */\n\t\tint i = 1;\n\t\tfor (ChesspairingGame game : games) {\n\t\t\tgame.setTableNumber(i++);\n\t\t}\n\t\t//if buy game ad this game also to the games list\n\t\tif (this.buyGame != null){\n\t\t\tthis.buyGame.setTableNumber(i);\n\t\t\tgames.add(this.buyGame);\n\t\t}\n\t\t// add the generated round to the tournament\n\t\tthis.setRound(this.generatedRound);\n\t\treturn this.mTournament;\n\t}", "public int fitness() {\n\t\t//System.out.println(\"/!\\\\ WARNING: Full fitness() called!\");\n\t\tint fitness = 0;\n\t\tint fitnessCases = (int) Math.pow(2, circuit.order);\n\t\tfor (int i=0; i<fitnessCases; i++) {\n\t\t\tValuation v = new Valuation(i, circuit.order);\n\t\t\tboolean actualOutput = tree.evaluate(v);\n\t\t\tboolean correctOutput = v.correctOutput();\n\t\t\t\n\t\t\tif (actualOutput == correctOutput) fitness++;\n\t\t}\n\t\t\n\t\tthis.fitness = fitness;\n\t\tthis.fitnessCases = null;\n\t\t\n\t\treturn fitness;\n\t}", "private void phaseOne(){\r\n\r\n\t\twhile (allNodes.size() < endSize){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//Pick a random node from allNodes\r\n\t\t\t\tint idx = random.nextInt(allNodes.size());\r\n\t\t\t\tNode node = allNodes.get(idx);\r\n\r\n\t\t\t\t//Get all relationships of node\t\t\t\t\r\n\t\t\t\tIterable<Relationship> ite = node.getRelationships(Direction.BOTH);\r\n\t\t\t\tList<Relationship> tempRels = new ArrayList<Relationship>();\r\n\r\n\t\t\t\t//Pick one of the relationships uniformly at random.\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\ttempRels.add(rel);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tidx = random.nextInt(tempRels.size());\r\n\t\t\t\tRelationship rel = tempRels.get(idx);\r\n\t\t\t\tNode neighbour = rel.getOtherNode(node);\r\n\r\n\t\t\t\t//Add the neighbour to allNodes\r\n\t\t\t\tif (!allNodes.contains(neighbour)){\r\n\t\t\t\t\tallNodes.add(neighbour);\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttx.success();\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t\t//If reached here, then phase one completed successfully.\r\n\t\treturn;\r\n\t}", "private void getTeam() {\n Set<Integer> set = getRandomNumberSet();\n // clear new team list each time to allow for serial clicks on \"Generate New Random Team\"\n team.clear();\n for (Integer i : set) {\n getPokemon(i);\n }\n }", "@Override\n public int compareTo(Individual individual) {\n return individual.getFitness() - this.getFitness() ;\n }", "private void mutate() {\n\t\tfor (int i = 0; i < population; ++i) {\n\t\t\tpopulationArray.set(i, populationArray.get(i).generateNeighbor());\n\t\t}\n\t}", "@Override\r\n\t\t\tpublic void populationUpdate(PopulationData<? extends Solution> data) {\n//\t\t\t\tbuffer.append(data.getPopulationSize());\r\n//\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tdouble fit = data.getBestCandidateFitness();\r\n//\t\t\t\tSystem.out.println(fit);\r\n\t\t\t\tbuffer.delete(0, buffer.length());\r\n\t\t\t\tbuffer.append(fit);\r\n//\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tif (Run10FastExternalizer.initialFitness.getDbl() == -1.0) {\r\n\t\t\t\t\tRun10FastExternalizer.initialFitness.setDbl(fit);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (fit == 0.0){\r\n\t\t\t\t\tArrayList<Student> studentsCopy = new ArrayList<>();\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (Student student: students){\r\n\t\t\t\t\t\tstudentsCopy.add(student.clone());\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (Student student: studentsCopy){\r\n\t\t\t\t\t\tstudent.register(data.getBestCandidate().getBlocks());\r\n//\t\t\t\t\t\tSystem.out.println(student.getSchedule());\r\n//\t\t\t\t\t\tbuffer.append(student.getSchedule().toString());\r\n//\t\t\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\t\tsb.append(student.getSchedule().toString());\r\n\t\t\t\t\t\tsb.append(\"\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tsuperValue = sb.toString();\r\n\t\t\t\t}\r\n\t\t\t}", "public void doRawFitness(Chromo[] member, int index)\n {\n\n member[index].rawFitness = 0;\n int numGames = Parameters.numGames;\n Strategy player1, player2;\n IteratedPD ipd;\n \n for (int i = 0; i < Parameters.popSize; i++)\n {\n player1 = followStrategy(member[index].chromo);\n player2 = followStrategy(member[i].chromo);\n ipd = new IteratedPD(player1, player2);\n\n ipd.runSteps(numGames);\n \n member[index].rawFitness += ipd.player1Score();\n }\n }", "public void setFitness(float fitness)\r\n\t{\r\n\t\tthis.fitness = fitness;\r\n\t}", "@Override\n public Individual selectIndividual(Population population, Individual individual, MersenneTwister rnd, ExperimentalData expData, Statistics stats) {\n List<Integer> indexIndividuals = new ArrayList<>();\n Integer bigger = -1;\n double[] outputs = expData.getDataset(Utils.DatasetType.TRAINING).getOutputs();\n int index = identifyCloserIndividual(population, individual, outputs, indexIndividuals, bigger, rnd);\n getStatisticsDim(individual, population.get(index), stats, outputs);\n return population.get(index);\n }", "public void setNextGeneration() {\n // create a temporary population\n ArrayList<Genotype> tempPopulation = new ArrayList<Genotype>();\n\n // select mates\n while (tempPopulation.size() < populationSize) {\n tempPopulation.add(Genotype.Mate(rouletteSelection(),\n rouletteSelection(), crossoverProbability));\n }\n }", "private static Set<Chromosome> mutatePopulation(Set<Chromosome> population, double mutationRate) {\n Set<Chromosome> mutatedChromosomes = new HashSet<>(population);\n\n for (Chromosome path : mutatedChromosomes) {\n double mutationProbability = ThreadLocalRandom.current().nextDouble();\n if (mutationProbability > (1-mutationRate)) {\n // mutate the path using the RSM mutation operator\n mutateRoute(path);\n // indicate that the fitness of this path needs to be recalculated\n path.fitness = -1;\n }\n }\n\n // The set will most probably include certain chromosomes which are already present in the set of children\n // however, given that both are sets, any duplicates will be discarded\n return mutatedChromosomes;\n }", "private void generateFirstRound() {\n\t\tif (this.mTournament.getRounds().size() > 0) {\n\t\t\tthrow new IllegalStateException(\"Tournament allready contains round 1\");\n\t\t}\n\n\t\tCollections.sort(mTournament.getPlayers(), new ByEloReverce());\n\t\tList<ChesspairingGame> games = new ArrayList<>();\n\t\tList<ChesspairingPlayer> players = mTournament.getPlayers();\n\t\tint count = 0;\n\t\tChesspairingGame game = new ChesspairingGame();\n\t\tgame.setTableNumber(0);\n\t\tfor (ChesspairingPlayer player : players) {\n\t\t\tcount++;\n\t\t\tif (count % 2 == 1) {\n\t\t\t\tint tableNumber = game.getTableNumber() + 1;\n\t\t\t\tgame = new ChesspairingGame();\n\t\t\t\tgame.setTableNumber(tableNumber);\n\t\t\t\tgame.setWhitePlayer(player);\n\t\t\t\tif (count == players.size()) {\n\t\t\t\t\tgame.setResult(ChesspairingResult.BYE);\n\t\t\t\t\tgames.add(game);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tgame.setBlackPlayer(player);\n\t\t\t\tgame.setResult(ChesspairingResult.NOT_DECIDED);\n\t\t\t\tgames.add(game);\n\t\t\t}\n\t\t}\n\t\tChesspairingRound round = new ChesspairingRound();\n\t\tround.setRoundNumber(1);\n\t\tround.setGames(games);\n\n\t\t// is the first round so wee can create all new data\n\t\tList<ChesspairingRound> rounds = new ArrayList<>();\n\n\t\t// add the round\n\t\trounds.add(round);\n\n\t\t// and wee set the rounds\n\t\tmTournament.setRounds(rounds);\n\n\t\tPairingSummary firstRoundOk = new PairingSummary();\n\t\tfirstRoundOk.setShortMessage(PairingSummary.PARRING_OK);\n\t\tfirstRoundOk.setLongMessage(\"First round was generated\");\n\t\tmTournament.setParringSummary(firstRoundOk);\n\t}", "public Scenario generate() {\n\n //generate random number of Passenger(all human)\n ArrayList liPsg = new ArrayList();\n int totalNumOfPsg = (int) (rd.nextDouble() * PassengerCountMax + PassengerCountMin); //at least one Psg\n for (int i = 0; i < totalNumOfPsg; i++) {\n liPsg.add(getRandomPerson());\n }\n //System.out.println(\"PassengerNum= \"+totalNumOfPsg);\n\n\n //generate random number of Pedestrians(with Max 5) & allocate person+animal randomly(human+animal)\n ArrayList liPdt = new ArrayList();\n int totalNumOfPdst = (int) (rd.nextDouble() * PedestrianCountMax + PedestrianCountMin);//at least one Pdg\n int NumOfPerson = (int) Math.round(rd.nextDouble() * totalNumOfPdst);//if only 1 pdt,along with randomDouble<0.5 , 0.4x*1 rounded=0, will only an animal\n //so if you are random being in pdt but pdt only an animal, you neither wont be in scenario, so your negative probability in scenario is higher.\n int NumOfAnimal = totalNumOfPdst - NumOfPerson;\n for (int i = 0; i < NumOfPerson; i++) {\n liPdt.add(getRandomPerson());\n }\n for (int i = 0; i < NumOfAnimal; i++) {\n liPdt.add(getRandomAnimal());\n }\n //System.out.println(\"PedestrianNum= \"+totalNumOfPdst+\" with \"+NumOfPerson+\" human and \"+NumOfAnimal+\" animals\");\n\n\n //allocating where you are, 0=you absence & do nothing, 1=you in car, 2=you on road !!!!yeah happy solving\n int allocate_of_user = (int) Math.round(rd.nextDouble() * 2);\n if (allocate_of_user == 1) {\n ((Person) liPsg.get(0)).setAsYou(true); //set the first psg is you. !!!!!important Cast Obj into Person!!!!\n } else if (allocate_of_user == 2) {\n for (int i = 0; i < liPdt.size(); i++) {\n if (liPdt.get(i) instanceof Person) {//check whether a person\n ((Person) liPdt.get(i)).setAsYou(true);\n break; // only set once than break rather than set all of people of pdt is you\n }\n }\n }\n\n //Scenario(ArrayList<Character> passengers, ArrayList<Character> pedestrians, boolean isLegalCrossing)\n S = new Scenario(liPsg, liPdt, rd.nextBoolean()); //isLegalCrossing = red or green light;\n return S;\n }", "private List<Individual<T>> selectIndividuals(Deme<T> deme) {\n return IntStream.range(0, tournamentSize).mapToObj(i -> selRandomOp.select(deme.getIndividuals()))\n .collect(Collectors.toList());\n }", "private List<Individual<T>> removeWorst(List<Individual<T>> tournament) {\n Individual<T> worst = selWorstOp.select(tournament);\n tournament.remove(worst);\n return tournament;\n }", "public static void worldTimeStep() {\n\t\t\n\t//Do time step for all critters\n\t\tfor (Critter c: population) {\n\t\t\tc.doTimeStep();\t\t\t\n\t\t}\n\t\n\t\t\n\t//Resolve encounters\n\t\tIterator<Critter> it1 = population.iterator();\n\t\tfightMode = true;\n\t\twhile(it1.hasNext())\n\t\t{\n\t\t\tCritter c = it1.next();\n\t\t\tIterator<Critter> it2 = population.iterator();\n\t\t\twhile(it2.hasNext()&&(c.energy > 0)) \n\t\t\t{\t\n\t\t\t\tCritter a =it2.next();\n\t\t\t\tif((c != a)&&(a.x_coord==c.x_coord)&&(a.y_coord==c.y_coord))\n\t\t\t\t{\n\t\t\t\t\tboolean cFighting = c.fight(a.toString());\n\t\t\t\t\tboolean aFighting = a.fight(c.toString());\n\t\t\t\t//If they are both still in the same location and alive, then fight\n\t\t\t\t\tif ((a.x_coord == c.x_coord) && (a.y_coord == c.y_coord) && (a.energy > 0) && (c.energy > 0)) {\t\t\n\t\t\t\t\t\tint cFight=0;\n\t\t\t\t\t\tint aFight=0;\n\t\t\t\t\t\tif(cFighting)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcFight = getRandomInt(100);\n\t\t\t\t\t\t\tcFight++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(aFighting)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\taFight =getRandomInt(100);\n\t\t\t\t\t\t\taFight++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(cFight>aFight)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tc.energy+=(a.energy/2);\n\t\t\t\t\t\t\t//it2.remove();\n\t\t\t\t\t\t\ta.energy=0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(aFight>cFight)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ta.energy+=(c.energy/2);\n\t\t\t\t\t\t\t//it1.remove()\n\t\t\t\t\t\t\tc.energy=0;\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(aFight>50)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta.energy+=(c.energy/2);\n\t\t\t\t\t\t\t\t//it1.remove();\n\t\t\t\t\t\t\t\tc.energy=0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tc.energy+=(a.energy);\n\t\t\t\t\t\t\t\t//it2.remove();\n\t\t\t\t\t\t\t\ta.energy=0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfightMode = false;\n\t\t\n\t//Update rest energy and reset hasMoved\n\t\tfor (Critter c2: population) {\n\t\t\tc2.hasMoved = false;\n\t\t\tc2.energy -= Params.rest_energy_cost;\n\t\t}\n\t\t\n\t//Spawn offspring and add to population\n\t\tpopulation.addAll(babies);\n\t\tbabies.clear();\n\t\t\n\t\tIterator<Critter> it3 = population.iterator();\n\t\twhile(it3.hasNext())\n\t\t{\n\t\t\tif(it3.next().energy<=0)\n\t\t\t\tit3.remove();\n\t\t}\n\t//Create new algae\n\t\tfor (int i = 0; i < Params.refresh_algae_count; i++) {\n\t\t\ttry {\n\t\t\t\tmakeCritter(\"Algae\");\n\t\t\t} catch (InvalidCritterException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}", "public void setFitness(int newFitness) {\n fitness = newFitness;\n }", "private <T> GeneticResult<T> maxFitness(List<Chromosome<T>> chromosomes, int totalBreedings){\n\t\tChromosome<T> bestFit = fittestChromosome(chromosomes);\n\t\treturn new GeneticResult<T>(bestFit, bestFit.getFitness(), totalBreedings);\n\t}", "public Tour getFittest() {\n Tour fittest = tours[0];\n // Loop through individuals to find fittest\n for (int i = 1; i < populationSize(); i++) {\n if (fittest.getFitness() <= getTour(i).getFitness()) {\n fittest = getTour(i);\n }\n }\n return fittest;\n }" ]
[ "0.81174314", "0.7890193", "0.72546154", "0.7254499", "0.7248957", "0.70296127", "0.69970524", "0.6848246", "0.6827707", "0.68226886", "0.6763179", "0.67245334", "0.66572976", "0.66223395", "0.66216946", "0.65907997", "0.65371466", "0.6507709", "0.6486128", "0.6468996", "0.6366083", "0.6317698", "0.6310374", "0.62925154", "0.62772095", "0.62756085", "0.62035656", "0.6190978", "0.61614615", "0.6149447", "0.61471766", "0.61224324", "0.60971165", "0.60754204", "0.6063409", "0.6059527", "0.60312814", "0.5991717", "0.59784186", "0.5972943", "0.5972925", "0.59610367", "0.5954656", "0.5952059", "0.59424603", "0.5941995", "0.5933255", "0.5918173", "0.5910985", "0.58896166", "0.5868907", "0.5862185", "0.58526886", "0.58518535", "0.5831411", "0.58296216", "0.5829331", "0.5813221", "0.5806235", "0.5805701", "0.5804843", "0.5804213", "0.57963115", "0.5795507", "0.5792918", "0.57899517", "0.5789093", "0.5771605", "0.5769218", "0.5767697", "0.57643396", "0.57554066", "0.5746959", "0.57453346", "0.5724143", "0.56964153", "0.5690894", "0.5686742", "0.56812537", "0.5667485", "0.5661745", "0.5657537", "0.56571853", "0.56502444", "0.5639273", "0.5635771", "0.5625768", "0.5617399", "0.5607365", "0.560361", "0.56003183", "0.55975354", "0.55866", "0.55815405", "0.5581046", "0.5580713", "0.55759186", "0.55692273", "0.55573314", "0.5550095" ]
0.647314
19
/ AccountDao adao = new AccountDao(); adao.insert(new Account("Sample Account", 12345L, AccountType.debit,14)); adao.insert(new Account("Sample Account2", 12345L, AccountType.credit,3)); Create and Insert a sample element into the Transaction table / TypeDao typeDao = new TypeDao(); Type type = new Type("one"); typeDao.insert(type); TransactionDao dao = new TransactionDao(); dao.insert(new Transaction("Sample Transaction", type, Math.round(Math.random() 50), "Sample Description", new Date())); Set the title of the application
@Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("MyMoney Application"); // Set the scene of the application to the new Scene primaryStage.setScene(createScene()); primaryStage.setResizable(true); // Display the Stage primaryStage.show(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void insertDemoData() throws SQLException\n {\n insertAccount(new Account(0, \"John Doe\", \"Marvin Gardens\", false));\n insertAccount(new Account(0, \"Robert Roe\", \"Louisiana Avenue\", false));\n }", "private void addSomeItemsToDB () throws Exception {\n/*\n Position pos;\n Course course;\n Ingredient ing;\n\n PositionDAO posdao = new PositionDAO();\n CourseDAO coursedao = new CourseDAO();\n IngredientDAO ingdao = new IngredientDAO();\n\n ing = new Ingredient(\"Mozzarella\", 10,30);\n ingdao.insert(ing);\n\n // Salads, Desserts, Main course, Drinks\n pos = new Position(\"Pizza\");\n posdao.insert(pos);\n\n course = new Course(\"Salads\", \"Greek\", \"Cucumber\", \"Tomato\", \"Feta\");\n coursedao.insert(course);\n\n ing = new Ingredient(\"-\", 0,0);\n ingdao.insert(ing);\n */\n }", "int insertBet(Account account, Bet bet) throws DAOException;", "@Dao\npublic interface TransactionDao {\n @Query(\"SELECT * FROM `Transaction`\")\n List<Transaction> getAll();\n\n @Insert\n void insertAll(Transaction... trans);\n\n @Insert\n void insertAll(Transaction trans);\n\n @Delete\n void delete(Transaction trans);\n\n @Query(\"delete from `Transaction`\")\n void nukeTable();\n\n}", "public interface AccountDao {\n\n /**\n * Retrieve a specific bank account by id\n *\n * @param id the account id to retrieve\n * @return Account object representing the bank account\n */\n Account getAccount(int id);\n\n /**\n * Retrieve all accounts for a given customer\n *\n * @param customerId the customer id to lookup\n * @return list of accounts belonging to the given customer\n */\n List<Account> getAccountsForCustomerId(int customerId);\n\n /**\n * Add a new account to the data source\n *\n * Note that the account id will be automatically generated\n *\n * @param account the account information to store\n * @return generated account id\n */\n int createAccount(Account account);\n\n /**\n * Update stored information for a given account\n *\n * @param account the account to update\n */\n void updateAccount(Account account);\n}", "@DB(table = \"share_list\")\npublic interface ShareDao {\n\n @SQL(\"insert into #table(code,name,industry,area,pe,outstanding,totals,totalAssets,liquidAssets,fixedAssets,esp,bvps,pb,timeToMarket,undp,holders) \" +\n \"values(:1.code,:1.name,:1.industry,:1.area,:1.pe,:1.outstanding,:1.totals,:1.totalAssets,:1.liquidAssets,:1.fixedAssets,:1.esp,:1.bvps,:1.pb,:1.timeToMarket,:1.undp,:1.holders)\")\n int insert(List<Share> shares);\n\n @SQL(\"select code,name,timeToMarket from #table\")\n List<Share> findAll();\n\n @SQL(\"select * from #table where code=:1\")\n Share find(String code);\n \n}", "@Test\n void insertSuccess() {\n int insertedCarId;\n\n //Get User\n GenericDao<User> userDao = new GenericDao(User.class);\n User user = userDao.getById(1);\n\n //Create Inserted Car\n Car insertedCar = new Car(user,\"2016\",\"Honda\",\"Civic\",\"19XFC1F35GE206053\");\n\n //Save Inserted Car\n insertedCarId = carDao.insert(insertedCar);\n\n //Get Saved Car\n Car retrievedCar = carDao.getById(insertedCarId);\n assertNotNull(retrievedCar);\n\n //Compare Cars\n assertEquals(insertedCar,retrievedCar);\n }", "public interface AccountDao {\n\n /**\n * Get one account with accountNumber\n *\n * @param accountNumber unique number for account\n * @return Account or null\n */\n Account getAccount(Integer accountNumber);\n\n /**\n * Get one account with accountNumber\n *\n * @param accountNumber unique number for account\n * @param configuration {@link Configuration} for executing in DB-transaction\n * @return Account or null\n */\n Account getAccount(Integer accountNumber, Configuration configuration);\n\n /**\n * Get all accounts for user with login\n *\n * @param login unique String key for user\n * @return List of Account or empty List\n */\n List<Account> getAccounts(String login);\n\n /**\n * Update account\n *\n * @param account new data to Account\n * @param configuration {@link Configuration} for executing in DB-transaction\n * @return new updated Account\n */\n Account updateAccount(Account account, Configuration configuration);\n\n}", "@Test(groups = \"Transactions Tests\", description = \"Create new transaction\")\n\tpublic void createNewTransaction() {\n\t\tMainScreen.clickAccountItem(\"Income\");\n\t\tSubAccountScreen.clickSubAccountItem(\"Salary\");\n\t\tTransactionsScreen.clickAddTransactionBtn();\n\t\tTransactionsScreen.typeTransactionDescription(\"Extra income\");\n\t\tTransactionsScreen.typeTransactionAmount(\"300\");\n\t\tTransactionsScreen.clickTransactionType();\n\t\tTransactionsScreen.typeTransactionNote(\"Extra income from this month\");\n\t\tTransactionsScreen.clickSaveBtn();\n\t\tTransactionsScreen.transactionItem(\"Extra income\").shouldBe(visible);\n\t\tTransactionsScreen.transactionAmout().shouldHave(text(\"$300\"));\n\t\ttest.log(Status.PASS, \"Sub-account created successfully and the value is correct\");\n\n\t\t//Testing if the transaction was created in the 'Double Entry' account, if the value is correct and logging the result to the report\n\t\treturnToHomeScreen();\n\t\tMainScreen.clickAccountItem(\"Assets\");\n\t\tSubAccountScreen.clickSubAccountItem(\"Current Assets\");\n\t\tSubAccountScreen.clickSubAccountItem(\"Cash in Wallet\");\n\t\tTransactionsScreen.transactionItem(\"Extra income\").shouldBe(visible);\n\t\tTransactionsScreen.transactionAmout().shouldHave(text(\"$300\"));\n\t\ttest.log(Status.PASS, \"'Double Entry' account also have the transaction and the value is correct\");\n\n\t}", "@Test\n public void insert() {\n// int insert = iUserDao.insert(u);\n// System.out.println(u);\n\n }", "public interface AccountDao {\n int insert(Account account);\n\n Account queryAccountById(Long id);\n\n Account findAccount(Account account);\n\n Account queryAccountByMobile(Long mobile);\n\n Account queryAccountByEmail(String email);\n\n void update(Account account);\n\n void resetPassword(Account account);\n}", "public interface DarenMerchantInfosDao {\n public void insert(DarenMerchantInfos darenMerchantInfos);\n}", "public interface AccountDao {\n void into(String inner, int money);\n void out(String outter, int money);\n}", "int insert(Transaction record);", "public interface HelloDao {\n\n String getName();\n\n void InsertAdCustomRelation(AdGroupSum adGroupSum);\n\n}", "public interface AccountDAO {\n public BankAccount createAccount(String accountNumber);\n public BankAccount getAccount(String accountNumber);\n public long deposit(String accountNumber, long amount, String description);\n public long withdraw(String accountNumber, long amount, String description);\n}", "public interface BugsActivityDAO {\n\n @Insert(\"insert into firefox_bugs_activity \" +\n \"(`bugId`,`who`,`when`,`what`,`removed`,`added`,`crawledTime`) \" +\n \"values (#{bugId},#{who},#{when},#{what},#{removed},#{added},#{crawledTime})\")\n public int add(BugsActivity fireFoxBugsActivity);\n\n @Insert(\"insert into firefox_bugs_activity_html (`bugId`,`html`) \" +\"values (#{bugId},#{html})\")\n public int addHtml(BugsActivity fireFoxBugsActivity);\n}", "void insert(PaymentTrade record);", "@Test\r\n public void testA1Insert() throws Exception {\r\n System.out.println(\"insert\");\r\n \r\n Usuario obj = new Usuario();\r\n obj.setFullName(\"Nicolas Duran\");\r\n obj.setUser(\"admin\");\r\n obj.setPassword(\"admin\");\r\n obj.setEmail(\"[email protected]\");\r\n obj.setType(1);\r\n \r\n UsuarioDao instance = new UsuarioDao();\r\n int expResult = 0;\r\n int result = instance.insert(obj);\r\n \r\n assertNotEquals(expResult, result);\r\n }", "public GenericDao<Account> getAccountDao();", "int insert(Account record);", "int insert(Account record);", "@Test\n public void test1Insert() {\n\n System.out.println(\"Prueba de SpecialityDAO\");\n SpecialityFactory factory = new MysqlSpecialityDAOFactry();\n SpecialityDAO dao = factory.create();\n assertEquals(dao.insert(spec), 1);\n \n }", "int insert(ShopAccount record);", "public interface TransactionDAO {\n \n String addTransaction(Long userId, String transaction) throws Exception;\n \n String showTransaction(Long userId, String transactionId) throws Exception;\n \n String listTransactions(Long userId) throws Exception;\n \n String sumTransactions(Long userId) throws Exception;\n \n}", "int insert(FundManagerDo record);", "public interface ITradeDao {\n int insertTrade(Trade trade);\n\n List<Trade> queryTrade(TradeQuery query);\n}", "@Insert({\n \"insert into PURCHASE (ID, SDATE, \",\n \"STYPE, SMONEY, TOUCHING, \",\n \"ACCOUNT, CHECKSTATUS, \",\n \"DEMO1, DEMO2, DEMO3)\",\n \"values (#{id,jdbcType=DECIMAL}, #{sdate,jdbcType=TIMESTAMP}, \",\n \"#{stype,jdbcType=VARCHAR}, #{smoney,jdbcType=DECIMAL}, #{touching,jdbcType=VARCHAR}, \",\n \"#{account,jdbcType=VARCHAR}, #{checkstatus,jdbcType=DECIMAL}, \",\n \"#{demo1,jdbcType=DECIMAL}, #{demo2,jdbcType=VARCHAR}, #{demo3,jdbcType=DECIMAL})\"\n })\n int insert(Purchase record);", "int insert(FinanceAccount record);", "Purchase create(Purchase purchase) throws SQLException, DAOException;", "private static void insertListsInDataBase () throws SQLException {\n //Create object ActionsWithRole for working with table role\n ActionsCRUD<Role,Integer> actionsWithRole = new ActionsWithRole();\n for (Role role : roles) {\n actionsWithRole.create(role);\n }\n //Create object ActionsWithUsers for working with table users\n ActionsCRUD<User,Integer> actionsWithUsers = new ActionsWithUsers();\n for (User user : users) {\n actionsWithUsers.create(user);\n }\n //Create object ActionsWithAccount for working with table account\n ActionsCRUD<Account,Integer> actionsWithAccount = new ActionsWithAccount();\n for (Account account : accounts) {\n actionsWithAccount.create(account);\n }\n //Create object ActionsWithPayment for working with table payment\n ActionsCRUD<Payment,Integer> actionsWithPayment = new ActionsWithPayment();\n for (Payment payment : payments) {\n actionsWithPayment.create(payment);\n }\n }", "public void transaction() throws DBException {\n\t\tUsersTransaction transaction = new UsersTransaction();\n\t\tScanner scan = new Scanner(System.in);\n\t\tLogger.info(\"================TRANSACTION DETAILS TO DONATE======================\");\n\t\tLogger.info(\"Enter the transaction ID\");\n\t\ttransactionId = scan.nextInt();\n\t\tLogger.info(\"Enter the donor ID\");\n\t\tdonorId = scan.nextInt();\n\t\tLogger.info(\"Enter the fund Id\");\n\t\tfundRequestId = scan.nextInt();\n\t\tLogger.info(\"Enter the amount to be funded\");\n\t\ttargetAmount = scan.nextInt();\n\t\ttransaction.setTransactionId(transactionId);\n\t\ttransaction.setDonorId(donorId);\n\t\ttransaction.setFundRequestId(fundRequestId);\n\t\ttransaction.setTargetAmount(targetAmount);\n\t\tinsert(transaction);\n\t\tdonorFundRequest(reqType);\n\t}", "public void insertDB() {\n sql = \"Insert into Order (OrderID, CustomerID, Status) VALUES ('\"+getCustomerID()+\"','\"+getCustomerID()+\"', '\"+getStatus()+\"')\";\n db.insertDB(sql);\n \n }", "@Override\n\tpublic void createSavingAccount(Account as) {\n\t\ttry {\n\t\t\tConnection con = conUtil.getConnection();\n\t\t\t//To use our functions/procedure we need to turn off autocommit\n\t\t\tcon.setAutoCommit(false);\n\t\t\tString saving = \"insert into savings( owner_id, balance) values (?,?)\";\n\t\t\tCallableStatement chaccount = con.prepareCall(saving);\n\t\t\n\t\t\tchaccount.setInt(1,as.getOwner_id() );\n\t\t\tchaccount.setDouble(2, as.getBalance());\n\t\t\tchaccount.execute();\n\t\t\t\n\t\t\tcon.setAutoCommit(true);\n\t\t\t\n\t\t} catch(SQLException e) {\n\t\t\t\n\t\t\tSystem.out.println(\"In CheckingDaoDB Exception\");\n\t\t\te.printStackTrace();\n\t\t}\n}", "@Dao\npublic interface ExpenseDao {\n\n @Query(\"SELECT * FROM expenses\")\n List<Expense> getExpenses();\n\n @Query(\"SELECT * FROM expenses WHERE id = :expenseId\")\n Expense getExpense(long expenseId);\n\n\n @Insert()\n long addExpense(Expense expense);\n\n @Update()\n void updateExpense(Expense expense);\n\n @Delete()\n void deleteExpense(Expense expense);\n\n @Insert()\n void addTwoExpenses(List<Expense> expenses);\n\n\n}", "public interface OrderDao {\n\n void createOrder(Order order);\n\n}", "@Override\n\tpublic int createTransaction(BankTransaction transaction) throws BusinessException {\n\t\tint tran = 0;\n\t\t\n\t\ttry {\n\t\t\tConnection connection = PostgresqlConnection.getConnection();\n\t\t\tString sql = \"insert into dutybank.transactions (account_id, transaction_type, amount, transaction_date) values(?,?,?,?)\";\n\t\t\t\n\t\t\tPreparedStatement preparedStatement = connection.prepareStatement(sql);\n\t\t\t\n\t\t\tpreparedStatement.setInt(1, transaction.getAccountid());\n\t\t\tpreparedStatement.setString(2, transaction.getTransactiontype());\n\t\t\tpreparedStatement.setDouble(3, transaction.getTransactionamount());\n\t\t\tpreparedStatement.setDate(4, new java.sql.Date(transaction.getTransactiondate().getTime()));\n\n\t\t\t\n\t\t\ttran = preparedStatement.executeUpdate();\n\t\t\t\n\t\t} catch (ClassNotFoundException | SQLException e) {\n\t\t\tthrow new BusinessException(\"Some internal error has occurred while inserting data\");\n\t\t}\n\t\t\n\n\t\treturn tran;\n\t}", "@Override\n public void insertAccount() throws Exception {\n\n }", "@Test\n public void CompoundTransaction_AddTransactionTest()\n {\n ct = new CompoundTransaction(\"compound\");\n\n acc_db.addAccount(acc);\n acc_db.addAccount(acc2);\n\n ct.addTransaction(new Transaction(\"atomic1\", acc_db,acc.get_Account_Number(),acc2.get_Account_Number(),10));\n\n ct.addTransaction(new Transaction(\"atomic2\",acc_db,acc.get_Account_Number(),acc2.get_Account_Number(),40));\n\n Assert.assertEquals(2, ct.getTransaction_list().size());\n }", "void insert(CusBankAccount record);", "@Test\n void insertSuccess() {\n GenericDao userDao = new GenericDao(User.class);\n //get a user to insert a new role\n User toInsert = (User) userDao.getEntityByName(\"lastName\", \"Curry\").get(0);\n\n UserRoles roles = new UserRoles(\"admin\", toInsert, toInsert.getUserName() );\n int id = genericDao.insert(roles);\n assertNotEquals(0, id);\n int insertedRoles = roles.getId();\n //assertEquals(toInsert.getId(), insertedRoles);\n }", "@Test\n public void addArticle(){\n User user = userDao.load(3);\n Article article = new Article();\n article.setUser(user);\n// article.setTitle(\"1896\");\n articleDao.add(article);\n }", "public interface IndentDao extends BaseDao<Indent,Integer>{\n\n /**\n * 通过订单关联查询到买家信息\n */\n void queryBuyerByIndentNO();\n}", "public void insert1(login uv) {\n\t\ttry\n {\n SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();\n \t\n Session session = sessionFactory.openSession();\n \n Transaction transaction=session.beginTransaction();\n \n session.save(uv);\n \n transaction.commit();\n \n session.close();\n }\n catch(Exception ex)\n {\n ex.printStackTrace();\n }\n\t\t\n\t}", "@Test\r\n public void testCreate() throws Exception {\r\n System.out.println(\"create\");\r\n Bureau obj = new Bureau(0,\"Test\",\"000000000\",\"\");\r\n BureauDAO instance = new BureauDAO();\r\n instance.setConnection(dbConnect);\r\n Bureau expResult = new Bureau(0,\"Test\",\"000000000\",\"\");\r\n Bureau result = instance.create(obj);\r\n \r\n assertEquals(\"sigles différents\",expResult.getSigle(), result.getSigle());\r\n assertEquals(\"tel différents\",expResult.getTel(), result.getTel());\r\n //etc\r\n assertNotEquals(\"id non généré\",expResult.getIdbur(),result.getIdbur());\r\n int idclient=result.getIdbur();\r\n obj=new Bureau(0,\"Test\",\"000000000\",\"\");\r\n try{\r\n Bureau result2 = instance.create(obj);\r\n fail(\"exception de doublon non déclenchée\");\r\n instance.delete(result2);\r\n }\r\n catch(SQLException e){}\r\n instance.delete(result);\r\n \r\n obj=new Bureau(0,\"Test2\",\"000000001\",\"\");\r\n try{\r\n Bureau result3 = instance.create(obj);\r\n fail(\"exception de code postal non déclenchée\");\r\n instance.delete(result3);\r\n }\r\n catch(SQLException e){}\r\n \r\n }", "int insert(PurchasePayment record);", "@Test\n public void testInsertUser() throws Exception {\n int insert = userDao.insertUser(\n 123,\n \"abc\",\n \"天涯\");\n System.out.println(\"insert=\" + insert);\n }", "int insert(TestActivityEntity record);", "int insert(BankUserInfo record);", "int insert(BankUserInfo record);", "@Insert({\n \"insert into order (id, orderid, \",\n \"name, price, userid)\",\n \"values (#{id,jdbcType=BIGINT}, #{orderid,jdbcType=VARCHAR}, \",\n \"#{name,jdbcType=VARCHAR}, #{price,jdbcType=BIGINT}, #{userid,jdbcType=VARCHAR})\"\n })\n int insert(Order record);", "public static void main(String[] args) {\n\n UserDao userDao = new UserDao();\n User user = new User();\n user.setName(\"cai\");\n user.setPassword(\"123456\");\n try {\n System.out.println(userDao.save(user));\n } catch (IllegalArgumentException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n } catch (IllegalAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "public void generateAttributes() throws SQLException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, InstantiationException{\n ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(\"spring.xml\");\n //Get the EmployeeDAO Bean\n BasicDataDAO dataDAO = null;\n BasicData newData = null;\n \n \n if (tableName.equals(\"test\")) {\n\t\t\tdataDAO = ctx.getBean(\"testDAO\", TestDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new Test(0, 99, \"Hello\", \"sample\", new Date());\n\t\t}else if (tableName.equals(\"utilisateur\")) {\n\t\t\tdataDAO = ctx.getBean(\"utilisateurDAO\", UtilisateurDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new Utilisateur(0, \"handa\", \"handa-upsud\", \"admin\", 30);\n\t\t}else if (tableName.equals(\"source\")) {\n\t\t\tdataDAO = ctx.getBean(\"sourceDAO\", SourceDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new Source(0, \"http\", \"srouce1\", \"haut\", \"France\", \"vertical\", 10, \"test\");\n\t\t}else if (tableName.equals(\"theme\")) {\n\t\t\tdataDAO = ctx.getBean(\"themeDAO\", ThemeDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new Theme(0, \"testTheme\");\n\t\t}else if (tableName.equals(\"themeRelation\")) {\n\t\t\tdataDAO = ctx.getBean(\"themeRelationDAO\", ThemeRelationDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new ThemeRelation(0, 1, 1);\n\t\t}else if (tableName.equals(\"version\")) {\n\t\t\tdataDAO = ctx.getBean(\"versionDAO\", VersionDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new Version(0, 1, \"url_serveur\", \"version\", new Date());\n\t\t}else if (tableName.equals(\"abonnementRelation\")) {\n\t\t\tdataDAO = ctx.getBean(\"abonnementRelationDAO\", AbonnementRelationDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new AbonnementRelation(0, 1, 1);\n\t\t}else if (tableName.equals(\"alerteRelation\")) {\n\t\t\tdataDAO = ctx.getBean(\"alerteRelationDAO\", AlerteRelationDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new AlerteRelation(0, 1, 1, 15, new Date(), \"sujet\", \"type\", \"statut\", \"description\");\n\t\t}else if (tableName.equals(\"blacklistageSysteme\")) {\n\t\t\tdataDAO = ctx.getBean(\"blacklistageSystemeDAO\", BlacklistageSystemeDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new BlacklistageSysteme(0, 1);\n\t\t}else if (tableName.equals(\"blacklistageUtilisateurRelation\")) {\n\t\t\tdataDAO = ctx.getBean(\"blacklistageUtilisateurRelationDAO\", BlacklistageUtilisateurRelationDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new BlacklistageUtilisateurRelation(0, 1, 1);\n\t\t}else if (tableName.equals(\"demandeModifRelation\")) {\n\t\t\tdataDAO = ctx.getBean(\"demandeModifRelationDAO\", DemandeModifRelationDAO.class);\n\t\t\t//insert\n\t\t\tnewData = new DemandeModifRelation(0, 1, 1, new Date(), \"type\", \"statut\", \"description\");\n\t\t}\n \n \n this.insert = dataDAO.insert(newData);\n //selecById\n BasicData t = dataDAO.selectById(this.insert);\n if (t!=null) {\n\t\t\tthis.selectById = t.toString();\n\t\t}else {\n\t\t\tthis.selectById = \"rien\";\n\t\t}\n //update\n this.update = dataDAO.update(t);\n t = dataDAO.selectById(this.insert);\n if (t!=null) {\n\t\t\tthis.resultatUpdate = t.toString();\n\t\t}else {\n\t\t\tthis.resultatUpdate = \"rien\";\n\t\t}\n //selectAll\n ArrayList<? extends BasicData> alTest = dataDAO.selectAll();\n this.selectAll = alTest.size();\n if (alTest.size()==0) {\n \tthis.ligne1 = \"rien\";\n\t\t}else {\n\t\t\tthis.ligne1 = alTest.get(0).toString();\n\t\t}\n //selectWhere\n String condition = \"id > 1\";\n this.condition = condition;\n ArrayList<? extends BasicData> alTest1 = dataDAO.selectWhere(condition);\n this.selectWhere = alTest1.size();\n if (alTest1.size()==0) {\n \tthis.ligne11 = \"rien\";\n\t\t}else {\n\t\t\tthis.ligne11 = alTest1.get(0).toString();\n\t\t}\n //deleteById\n this.deleteById = 99;\n //this.deleteById = dataDAO.deleteById(insert);\n }", "int insert(Payment record);", "public interface TransactionDAO\n{\n public void addTransaction(Transaction transaction);\n public Transaction findById(Integer id);\n public List<Transaction> getAll();\n}", "public GenericDao<Payment> getPaymentDao();", "int insert(TmpUserPayAccount record);", "private void inseredados() {\n // Insert Funcionários\n\n FuncionarioDAO daoF = new FuncionarioDAO();\n Funcionario func1 = new Funcionario();\n func1.setCpf(\"08654683970\");\n func1.setDataNasc(new Date(\"27/04/1992\"));\n func1.setEstadoCivil(\"Solteiro\");\n func1.setFuncao(\"Garcom\");\n func1.setNome(\"Eduardo Kempf\");\n func1.setRg(\"10.538.191-3\");\n func1.setSalario(1000);\n daoF.persisteObjeto(func1);\n\n Funcionario func2 = new Funcionario();\n func2.setCpf(\"08731628974\");\n func2.setDataNasc(new Date(\"21/08/1992\"));\n func2.setEstadoCivil(\"Solteira\");\n func2.setFuncao(\"Caixa\");\n func2.setNome(\"Juliana Iora\");\n func2.setRg(\"10.550.749-6\");\n func2.setSalario(1200);\n daoF.persisteObjeto(func2);\n\n Funcionario func3 = new Funcionario();\n func3.setCpf(\"08731628974\");\n func3.setDataNasc(new Date(\"03/05/1989\"));\n func3.setEstadoCivil(\"Solteiro\");\n func3.setFuncao(\"Gerente\");\n func3.setNome(\"joão da Silva\");\n func3.setRg(\"05.480.749-2\");\n func3.setSalario(3000);\n daoF.persisteObjeto(func3);\n\n Funcionario func4 = new Funcionario();\n func4.setCpf(\"01048437990\");\n func4.setDataNasc(new Date(\"13/04/1988\"));\n func4.setEstadoCivil(\"Solteiro\");\n func4.setFuncao(\"Garçon\");\n func4.setNome(\"Luiz Fernandodos Santos\");\n func4.setRg(\"9.777.688-1\");\n func4.setSalario(1000);\n daoF.persisteObjeto(func4);\n\n TransactionManager.beginTransaction();\n Funcionario func5 = new Funcionario();\n func5.setCpf(\"01048437990\");\n func5.setDataNasc(new Date(\"13/04/1978\"));\n func5.setEstadoCivil(\"Casada\");\n func5.setFuncao(\"Cozinheira\");\n func5.setNome(\"Sofia Gomes\");\n func5.setRg(\"3.757.688-8\");\n func5.setSalario(1500);\n daoF.persisteObjeto(func5);\n\n // Insert Bebidas\n BebidaDAO daoB = new BebidaDAO();\n Bebida bebi1 = new Bebida();\n bebi1.setNome(\"Coca Cola\");\n bebi1.setPreco(3.25);\n bebi1.setQtde(1000);\n bebi1.setTipo(\"Refrigerante\");\n bebi1.setDataValidade(new Date(\"27/04/2014\"));\n daoB.persisteObjeto(bebi1);\n\n Bebida bebi2 = new Bebida();\n bebi2.setNome(\"Cerveja\");\n bebi2.setPreco(4.80);\n bebi2.setQtde(1000);\n bebi2.setTipo(\"Alcoolica\");\n bebi2.setDataValidade(new Date(\"27/11/2013\"));\n daoB.persisteObjeto(bebi2);\n\n Bebida bebi3 = new Bebida();\n bebi3.setNome(\"Guaraná Antatica\");\n bebi3.setPreco(3.25);\n bebi3.setQtde(800);\n bebi3.setTipo(\"Refrigerante\");\n bebi3.setDataValidade(new Date(\"27/02/2014\"));\n daoB.persisteObjeto(bebi3);\n\n Bebida bebi4 = new Bebida();\n bebi4.setNome(\"Água com gás\");\n bebi4.setPreco(2.75);\n bebi4.setQtde(500);\n bebi4.setTipo(\"Refrigerante\");\n bebi4.setDataValidade(new Date(\"27/08/2013\"));\n daoB.persisteObjeto(bebi4);\n\n Bebida bebi5 = new Bebida();\n bebi5.setNome(\"Whisky\");\n bebi5.setPreco(3.25);\n bebi5.setQtde(1000);\n bebi5.setTipo(\"Alcoolica\");\n bebi5.setDataValidade(new Date(\"03/05/2016\"));\n daoB.persisteObjeto(bebi5);\n\n // Insert Comidas\n ComidaDAO daoC = new ComidaDAO();\n Comida comi1 = new Comida();\n comi1.setNome(\"Batata\");\n comi1.setQuantidade(30);\n comi1.setTipo(\"Kilograma\");\n comi1.setDataValidade(new Date(\"27/04/2013\"));\n daoC.persisteObjeto(comi1);\n\n Comida comi2 = new Comida();\n comi2.setNome(\"Frango\");\n comi2.setQuantidade(15);\n comi2.setTipo(\"Kilograma\");\n comi2.setDataValidade(new Date(\"22/04/2013\"));\n daoC.persisteObjeto(comi2);\n\n Comida comi3 = new Comida();\n comi3.setNome(\"Mussarela\");\n comi3.setQuantidade(15000);\n comi3.setTipo(\"Grama\");\n comi3.setDataValidade(new Date(\"18/04/2013\"));\n daoC.persisteObjeto(comi3);\n\n Comida comi4 = new Comida();\n comi4.setNome(\"Presunto\");\n comi4.setQuantidade(10000);\n comi4.setTipo(\"Grama\");\n comi4.setDataValidade(new Date(\"18/04/2013\"));\n daoC.persisteObjeto(comi4);\n\n Comida comi5 = new Comida();\n comi5.setNome(\"Bife\");\n comi5.setQuantidade(25);\n comi5.setTipo(\"Kilograma\");\n comi5.setDataValidade(new Date(\"22/04/2013\"));\n daoC.persisteObjeto(comi5);\n\n\n // Insert Mesas\n MesaDAO daoM = new MesaDAO();\n Mesa mes1 = new Mesa();\n mes1.setCapacidade(4);\n mes1.setStatus(true);\n daoM.persisteObjeto(mes1);\n\n Mesa mes2 = new Mesa();\n mes2.setCapacidade(4);\n mes2.setStatus(true);\n daoM.persisteObjeto(mes2);\n\n Mesa mes3 = new Mesa();\n mes3.setCapacidade(6);\n mes3.setStatus(true);\n daoM.persisteObjeto(mes3);\n\n Mesa mes4 = new Mesa();\n mes4.setCapacidade(6);\n mes4.setStatus(true);\n daoM.persisteObjeto(mes4);\n\n Mesa mes5 = new Mesa();\n mes5.setCapacidade(8);\n mes5.setStatus(true);\n daoM.persisteObjeto(mes5);\n\n // Insert Pratos\n PratoDAO daoPr = new PratoDAO();\n Prato prat1 = new Prato();\n List<Comida> comI = new ArrayList<Comida>();\n comI.add(comi1);\n prat1.setNome(\"Porção de Batata\");\n prat1.setIngredientes(comI);\n prat1.setQuantidadePorcoes(3);\n prat1.setPreco(13.00);\n daoPr.persisteObjeto(prat1);\n\n Prato prat2 = new Prato();\n List<Comida> comII = new ArrayList<Comida>();\n comII.add(comi2);\n prat2.setNome(\"Porção de Frango\");\n prat2.setIngredientes(comII);\n prat2.setQuantidadePorcoes(5);\n prat2.setPreco(16.00);\n daoPr.persisteObjeto(prat2);\n\n Prato prat3 = new Prato();\n List<Comida> comIII = new ArrayList<Comida>();\n comIII.add(comi1);\n comIII.add(comi3);\n comIII.add(comi4);\n prat3.setNome(\"Batata Recheada\");\n prat3.setIngredientes(comIII);\n prat3.setQuantidadePorcoes(3);\n prat3.setPreco(13.00);\n daoPr.persisteObjeto(prat3);\n\n Prato prat4 = new Prato();\n List<Comida> comIV = new ArrayList<Comida>();\n comIV.add(comi2);\n comIV.add(comi3);\n comIV.add(comi4);\n prat4.setNome(\"Lanche\");\n prat4.setIngredientes(comIV);\n prat4.setQuantidadePorcoes(3);\n prat4.setPreco(13.00);\n daoPr.persisteObjeto(prat4);\n\n Prato prat5 = new Prato();\n prat5.setNome(\"Porção especial\");\n List<Comida> comV = new ArrayList<Comida>();\n comV.add(comi1);\n comV.add(comi3);\n comV.add(comi4);\n prat5.setIngredientes(comV);\n prat5.setQuantidadePorcoes(3);\n prat5.setPreco(13.00);\n daoPr.persisteObjeto(prat5);\n\n // Insert Pedidos Bebidas\n PedidoBebidaDAO daoPB = new PedidoBebidaDAO();\n PedidoBebida pb1 = new PedidoBebida();\n pb1.setPago(false);\n List<Bebida> bebI = new ArrayList<Bebida>();\n bebI.add(bebi1);\n bebI.add(bebi2);\n pb1.setBebidas(bebI);\n pb1.setIdFuncionario(func5);\n pb1.setIdMesa(mes5);\n daoPB.persisteObjeto(pb1);\n\n PedidoBebida pb2 = new PedidoBebida();\n pb2.setPago(false);\n List<Bebida> bebII = new ArrayList<Bebida>();\n bebII.add(bebi1);\n bebII.add(bebi4);\n pb2.setBebidas(bebII);\n pb2.setIdFuncionario(func4);\n pb2.setIdMesa(mes4);\n daoPB.persisteObjeto(pb2);\n\n TransactionManager.beginTransaction();\n PedidoBebida pb3 = new PedidoBebida();\n pb3.setPago(false);\n List<Bebida> bebIII = new ArrayList<Bebida>();\n bebIII.add(bebi2);\n bebIII.add(bebi3);\n pb3.setBebidas(bebIII);\n pb3.setIdFuncionario(func2);\n pb3.setIdMesa(mes2);\n daoPB.persisteObjeto(pb3);\n\n PedidoBebida pb4 = new PedidoBebida();\n pb4.setPago(false);\n List<Bebida> bebIV = new ArrayList<Bebida>();\n bebIV.add(bebi2);\n bebIV.add(bebi5);\n pb4.setBebidas(bebIV);\n pb4.setIdFuncionario(func3);\n pb4.setIdMesa(mes3);\n daoPB.persisteObjeto(pb4);\n\n PedidoBebida pb5 = new PedidoBebida();\n pb5.setPago(false);\n List<Bebida> bebV = new ArrayList<Bebida>();\n bebV.add(bebi1);\n bebV.add(bebi2);\n bebV.add(bebi3);\n pb5.setBebidas(bebV);\n pb5.setIdFuncionario(func1);\n pb5.setIdMesa(mes5);\n daoPB.persisteObjeto(pb5);\n\n // Insert Pedidos Pratos\n PedidoPratoDAO daoPP = new PedidoPratoDAO();\n PedidoPrato pp1 = new PedidoPrato();\n pp1.setPago(false);\n List<Prato> praI = new ArrayList<Prato>();\n praI.add(prat1);\n praI.add(prat2);\n praI.add(prat3);\n pp1.setPratos(praI);\n pp1.setIdFuncionario(func5);\n pp1.setIdMesa(mes5);\n daoPP.persisteObjeto(pp1);\n\n PedidoPrato pp2 = new PedidoPrato();\n pp2.setPago(false);\n List<Prato> praII = new ArrayList<Prato>();\n praII.add(prat1);\n praII.add(prat3);\n pp2.setPratos(praII);\n pp2.setIdFuncionario(func4);\n pp2.setIdMesa(mes4);\n daoPP.persisteObjeto(pp2);\n\n PedidoPrato pp3 = new PedidoPrato();\n pp3.setPago(false);\n List<Prato> praIII = new ArrayList<Prato>();\n praIII.add(prat1);\n praIII.add(prat2);\n pp3.setPratos(praIII);\n pp3.setIdFuncionario(func2);\n pp3.setIdMesa(mes2);\n daoPP.persisteObjeto(pp3);\n\n PedidoPrato pp4 = new PedidoPrato();\n pp4.setPago(false);\n List<Prato> praIV = new ArrayList<Prato>();\n praIV.add(prat1);\n praIV.add(prat3);\n pp4.setPratos(praIV);\n pp4.setIdFuncionario(func3);\n pp4.setIdMesa(mes3);\n daoPP.persisteObjeto(pp4);\n\n PedidoPrato pp5 = new PedidoPrato();\n pp5.setPago(false);\n List<Prato> praV = new ArrayList<Prato>();\n praV.add(prat1);\n praV.add(prat2);\n praV.add(prat3);\n praV.add(prat4);\n pp5.setPratos(praV);\n pp5.setIdFuncionario(func1);\n pp5.setIdMesa(mes5);\n daoPP.persisteObjeto(pp5);\n\n }", "int insert(FinancialManagement record);", "public Database() {\n if (init) {\n\n //creating Transaction data\n Transaction transactionOne\n = new Transaction(1, \"Debit\", \"Spar Grocery\", 54.68,1);\n\n transactionDB.add(transactionOne);\n\n // Creating an Account data\n Account accountOne = new Account(1, 445, 111111111, \"Savings\",\n 1250.24, transactionDB);\n\n accountDB.add(accountOne);\n\n //creating withdrawal data\n Withdrawal withdrawalOne = new Withdrawal(1, 64422545, 600.89);\n withdrawalDB.add(withdrawalOne);\n\n //creating transfer data\n Transfer transferOne = new Transfer(1, 25252525, 521.23);\n transferDB.add(transferOne);\n\n //creating lodgement data\n Lodgement lodgementOne = new Lodgement(1, 67766666, 521.23);\n lodgementDB.add(lodgementOne);\n\n //add Customer data \n Customer customerOne\n = new Customer(1, \"Darth Vader\", \"[email protected]\",\n \"Level 5, Suit Dark\", \"darkSideIsGoodStuff\",\n accountDB, withdrawalDB, transferDB, lodgementDB);\n\n customerDB.add(customerOne);\n\n init = false;\n }\n }", "public interface FlowOrderDao {\n\n //数据库新增 充值流浪 记录\n int AddFlowOrder(FlowOrder flowOrder);\n\n //数据库修改 当前订单的状态\n int updateFlowStatus(String orderId);\n\n\n //查询 flowOrder 流量充值记录\n ArrayList<FlowOrder> searchFlowOrderList () ;\n\n}", "@Test\n\tpublic void testAddTransaction(){\n setDoubleEntryEnabled(true);\n\t\tsetDefaultTransactionType(TransactionType.DEBIT);\n validateTransactionListDisplayed();\n\n\t\tonView(withId(R.id.fab_create_transaction)).perform(click());\n\n\t\tonView(withId(R.id.input_transaction_name)).perform(typeText(\"Lunch\"));\n\t\tonView(withId(R.id.input_transaction_amount)).perform(typeText(\"899\"));\n\t\tonView(withId(R.id.input_transaction_type))\n\t\t\t\t.check(matches(allOf(isDisplayed(), withText(R.string.label_receive))))\n\t\t\t\t.perform(click())\n\t\t\t\t.check(matches(withText(R.string.label_spend)));\n\n\t\tString expectedValue = NumberFormat.getInstance().format(-899);\n\t\tonView(withId(R.id.input_transaction_amount)).check(matches(withText(expectedValue)));\n\n int transactionsCount = getTransactionCount();\n\t\tonView(withId(R.id.menu_save)).perform(click());\n\n validateTransactionListDisplayed();\n\n List<Transaction> transactions = mTransactionsDbAdapter.getAllTransactionsForAccount(DUMMY_ACCOUNT_UID);\n assertThat(transactions).hasSize(2);\n Transaction transaction = transactions.get(0);\n\t\tassertThat(transaction.getSplits()).hasSize(2);\n\n assertThat(getTransactionCount()).isEqualTo(transactionsCount + 1);\n }", "@Override\n public TransactionModel createTransaction(String custId, LocalDateTime transactionTime, String accountNumber, TransactionType type, BigDecimal amount,String description)\n {\n return transactionDao.createTransaction(custId,accountNumber,transactionTime,type,amount,description);\n }", "int insert(MedicalOrdersExecutePlan record);", "Transaction createTransaction();", "@Test\n void insertSuccess() {\n String name = \"Testing a new event\";\n LocalDate date = LocalDate.parse(\"2020-05-23\");\n LocalTime startTime = LocalTime.parse(\"11:30\");\n LocalTime endTime = LocalTime.parse(\"13:45\");\n String notes = \"Here are some new notes for my new event.\";\n GenericDao userDao = new GenericDao(User.class);\n User user = (User)userDao.getById(1);\n\n Event newEvent = new Event(name, date, startTime, endTime, notes, user);\n int id = genericDao.insert(newEvent);\n assertNotEquals(0,id);\n Event insertedEvent = (Event)genericDao.getById(id);\n assertEquals(newEvent, insertedEvent);\n }", "public interface OrdersDao extends BaseDao<Orders> {\n public void updateANT(String address,String name,String telephone,String oid);\n\n}", "@Dao\npublic interface NoteItemDao{\n @Query(\"select * from \" + DBTables.NoteItemTable.TABLE_NAME + \" order by \" + DBTables.NoteItemTable._ID + \" ASC\")\n List<NoteItem> queryAllNotes();\n\n @Insert\n void insertNote(NoteItem noteItem);\n\n @Delete\n void deleteNote(NoteItem noteItem);\n\n @Update\n void updateNote(NoteItem noteItem);\n}", "public void insertAccount(Account account){\n\t\tSession s=sf.openSession();\n\t\tTransaction tx=s.beginTransaction();\n\t\ts.save(account);\n\t\ttx.commit();\n\t\ts.close();\n\t\t}", "public void addCustomer(int Id, String name, String dob, String gender, String number, String email, String address, String password, Boolean promo, Integer reward, Boolean reg) throws SQLException { //code for add-operation \n st.executeUpdate(\"INSERT INTO IOTBAY.CUSTOMER \" + \"VALUES ('\" \n + Id + \"','\" + name + \"', '\" + dob + \"', '\" \n + gender + \"', '\" + number + \"', '\" \n + email + \"', '\" + address + \"', '\" \n + password + \"', '\" + promo + \"', '\"+ reward + \"', '\"+ reg \n + \"')\");\n\n }", "private void insert() {//将数据录入数据库\n\t\tUser eb = new User();\n\t\tUserDao ed = new UserDao();\n\t\teb.setUsername(username.getText().toString().trim());\n\t\tString pass = new String(this.pass.getPassword());\n\t\teb.setPassword(pass);\n\t\teb.setName(name.getText().toString().trim());\n\t\teb.setSex(sex1.isSelected() ? sex1.getText().toString().trim(): sex2.getText().toString().trim());\t\n\t\teb.setAddress(addr.getText().toString().trim());\n\t\teb.setTel(tel.getText().toString().trim());\n\t\teb.setType(role.getSelectedIndex()+\"\");\n\t\teb.setState(\"1\");\n\t\t\n\t\tif (ed.addUser(eb) == 1) {\n\t\t\teb=ed.queryUserone(eb);\n\t\t\tJOptionPane.showMessageDialog(null, \"帐号为\" + eb.getUsername()\n\t\t\t\t\t+ \"的客户信息,录入成功\");\n\t\t\tclear();\n\t\t}\n\n\t}", "public interface IPackageActivateDao extends IBaseDao<PackageActivate>{\n\t/**\n\t * \n\t * <p>\n\t * Title: confirmationNumber\n\t * </p>\n\t * <p>\n\t * Description:广告主确认数录入\n\t * </p>\n\t * \n\t * @param id\n\t * @param number\n\t * @throws Exception\n\t * @author lichuang\n\t * @date 2013-5-23\n\t * @return void\n\t * @version 1.0\n\t */\n\tpublic void confirmationNumber(Long id, Integer number,Integer status) throws Exception;\n\n\n\t/**\n\t * <p>\n\t * Title: statusConfirm\n\t * </p>\n\t * <p>\n\t * Description:数据分完\n\t * </p>\n\t * \n\t * @param fraction_id\n\t * @throws Exception\n\t * @author lichuang\n\t * @date 2013-5-27\n\t * @return void\n\t * @version 1.0\n\t */\n\tpublic void updateStatus(Long id,Integer status) throws Exception;\n\n\t/**\n\t * <p>\n\t * Title: statusConfirm\n\t * </p>\n\t * <p>\n\t * Description:数据分完\n\t * </p>\n\t * \n\t * @param fraction_id\n\t * @throws Exception\n\t * @author lichuang\n\t * @date 2013-5-27\n\t * @return void\n\t * @version 1.0\n\t */\n\tpublic void updateStatu(String ids, Integer status) throws Exception;\n\n\t/**\n\t * <p>\n\t * Title: submitConfirmNumber\n\t * </p>\n\t * <p>\n\t * Description:TODO\n\t * </p>\n\t * \n\t * @param ids\n\t * @author cuidd\n\t * @date 2013-7-16\n\t * @return void\n\t * @version 1.0\n\t */\n\tpublic void submitConfirmNumber(String ids);\n\n\n\t/**\n\t* <p>Title: confirmationCpd</p>\n\t* <p>Description:cpd确认的钱</p>\n\t* @param id\n\t* @param amount\n\t* @throws Exception\n\t* @author lichuang\n\t* @date 2013-8-8\n\t* @return void\n\t* @version 1.0\n\t */\n\tpublic void confirmationCpd(Long id, Double amount)throws Exception;\n\n\t/**\n\t* <p>Title: getById</p>\n\t* <p>Description:读取提交android数据</p>\n\t* @param ids\n\t* @return\n\t* @author cuidd\n\t* @date 2014年11月14日\n\t* @return List<PackageActivateAndroid>\n\t* @version 1.0\n\t */\n\tpublic PackageActivateAndroid getById(Long id)throws Exception;\n\n}", "public interface CustomerOrderDao {\n\n void addCustomerOrder(CustomerOrder customerOrder);\n\n}", "public static void main(String[] args) throws SQLException, ClassNotFoundException, IOException {\n \tUserDaoClass pdao = new UserDaoClass();\n pdao.testConnection(); \n List<User> plist = pdao.getAllUsers();\n for(User p: plist)\n \t System.out.println(p.getName());\n \n //Insert\n// User p = new User();\n// p.setName(\"Ryan\");\n// p.setPassword(\"Ryan0000\");\n// p.setJavaScore(100.0);\n// p.setSqlScore(80.0);\n// pdao.registerUser(p);\n \n //update \n User u = new User();\n u.setName(\"Kavita\");\n u.setPassword(\"kav000\");\n u.setUserId(3);\n pdao.updateUser(u);\n //System.out.println(pdao.getUserId);\n \n //delete\n User d = new User();\n d.setUserId(5);\n pdao.removeUser(5);\n // System.out.println(pdao.getUserId(5));\n }", "int insertGenDetail(Integer uid, Integer merid, Double paymoney, Double sendmoney, Double tomoney, Double balance, Double topupbalance, Double givebalance, String ordernum, Date createTime, Integer paysource, String remark);", "public interface StudentDao {\n void insert(Student student);\n}", "private static void testInsert() {\n\t\tSkemp skemp = new Skemp();\n\t\tskemp.setId(99);\n\t\tskemp.setName(\"王2\");\n\t\tskemp.setSex(\"男\");\n\t\tSkempDao skempDao = new SkempDaoImpl();\n\t\tskempDao.insertSkemp(skemp);\n\t}", "@Test\n void insertWithTripSuccess() {\n String newUserFirst = \"Dave\";\n String newUserLast = \"Bowman\";\n String newUserEmail = \"[email protected]\";\n String newUserUname = \"dbowman1\";\n String newUserPassword = \"Supersecret2!\";\n String tripCityLoc = \"MILWWI\";\n int tripCount = 6;\n String tripRating = \"5\";\n String tripComment = \"Definitely worth a second look\";\n Date today = new Date();\n User newUser = new User(newUserFirst, newUserLast, newUserEmail, newUserUname, newUserPassword, today);\n //Usertrip newUserTrip = new Usertrip(newUser, tripCityLoc, tripCount, tripRating, tripComment, today);\n //newUser.addTrip(newUserTrip);\n //int id = dao.insert(newUser);\n //assertNotEquals(0, id);\n //User insertedUser = (User) dao.getById(id);\n //assertNotNull(insertedUser);\n //assertEquals(\"dbowman1\", insertedUser.getUserName());\n //assertEquals(1, insertedUser.getUsertrips().size());\n\n }", "public interface DaoFactory {\r\n\r\n\t/**\r\n\t * Returns objects for access to account table.\r\n\t * \r\n\t * @return DAO for account table.\r\n\t */\r\n\tpublic GenericDao<Account> getAccountDao();\r\n\r\n\t/**\r\n\t * Returns objects for access to client table.\r\n\t * \r\n\t * @return DAO for client table.\r\n\t */\r\n\tpublic GenericDao<Client> getClientDao();\r\n\r\n\t/**\r\n\t * Returns objects for access to payment table.\r\n\t * \r\n\t * @return DAO for payment table.\r\n\t */\r\n\tpublic GenericDao<Payment> getPaymentDao();\r\n\r\n\t/**\r\n\t * Returns objects for access to credit card table.\r\n\t * \r\n\t * @return DAO for credit card table.\r\n\t */\r\n\tpublic GenericDao<CreditCard> getCreditCardDao();\r\n\r\n\t/**\r\n\t * Returns objects for access to authorization table.\r\n\t * \r\n\t * @return DAO for authorization table.\r\n\t */\r\n\tpublic GenericDao<Autorization> getAutorizationDao();\r\n\r\n\t/**\r\n\t * This method returns connection for accessing to database.\r\n\t * \r\n\t * @return\r\n\t */\r\n\tpublic Connection getConnection();\r\n\r\n}", "int insert(OrderDetail record);", "int insert(OrderDetails record);", "public static void main(String[] args) {\n\n DaoChild dao = new DaoChild();\n dao.checkDbConnection();\n //dao.insertData();\n //dao.selectEverythingFromChild();\n //dao.insertData2(2, \"Katus\", 33);\n dao.selectEverythingFromChild();\n\n\n }", "@Test\r\n\t\tpublic void insertUserTestCase() {\r\n\t\t\t\r\n\t\t\tUser user = new User();\r\n\t\t\t\t\t\r\n\t\t//\tuser.setBirthDate(LocalDate.parse(\"1994-04-09\"));\r\n\t\t\tuser.setUsername(\"renu\");\r\n\t\t//\tuser.setUserId(1003);\r\n\t\t\t\r\n\t\t\tuser.setEmail(\"[email protected]\");\r\n\t\t\t\t\t\r\n\t\t\tuser.setFirstname(\"Renu\");\r\n\t\t\tuser.setSurname(\"Rawat\");\r\n\t\t//\tuser.setGender('F');\r\n\t\t\tuser.setPassword(\"renu\");\r\n\t\t\tuser.setPhone(\"9876543210\");\r\n\t\t//\tuser.setStatus(\"A\");\r\n\t\t\tuser.setIsOnline(false);\r\n\t\t\t\r\n\t\t\tuser.setRole(\"ADMIN\");\r\n\t\t//\tuser.setConfmemail(\"[email protected]\");\r\n\t\t//\tuser.setConfpassword(\"renu\");\r\n\t\t\t\r\n\t\t\tSystem.out.println(\"user printed\");\r\n\t\t\tassertEquals(\"successfully!\", Boolean.valueOf(true), userDao.registerUser(user));\r\n\t\t\tSystem.out.println(\"After User Table\");\r\n\t\t\t\r\n\t}", "public interface DotaMaxDAO {\n\n\n /**\n * 将hero实例存储到数据库。\n */\n void insertHeroes(List<Heroes> heroList);\n\n /**\n * 将Item实例存储到数据库。\n */\n void insertItems(List<Items> itemsList);\n\n\n /**\n * 加载英雄列表\n * @return\n */\n Heroes getHeroes(int id);\n\n\n\n\n\n\n void insertMatch(MatchDetails match);\n\n /**\n * 加载数据库里已有的数据\n * @param id\n * @return\n */\n MatchDetails getMatch(long id);\n\n /**\n * 加载用户的数据\n * @param account_id\n * @return\n */\n List<MatchDetails> getMatchByAccountId(long account_id);\n\n\n String getItemsNameById(String item_id);\n\n\n\n /**\n * 添加到User表\n */\n boolean insertUser(User user);\n\n /**\n * 从User表读取所有的用户\n */\n List<Long> getUser();\n\n\n\n}", "@Dao\npublic interface SalesDAO {\n\n @Insert\n void saveSales(Sales sales);\n\n @Query(\"SELECT * FROM Sales LIMIT 1\")\n Sales getSales();\n}", "@Insert({\n \"insert into actions_accounts (actor, permission, \",\n \"action_id)\",\n \"values (#{actor,jdbcType=VARCHAR}, #{permission,jdbcType=VARCHAR}, \",\n \"#{actionId,jdbcType=INTEGER})\"\n })\n int insert(ActionsAccounts record);", "@Test\npublic void testInsertAStudentScore() {\n//TODO: Test goes here...\n System.out.println(StudentDao.insertAStudentScore(1007,\"7\", 5, 5, 5));\n}", "@Dao\npublic interface ReservationDao {\n\n @Query(\"SELECT * FROM reservation\")\n Single<List<Reservation>> getAllReservations();\n\n @Query(\"SELECT * FROM reservation where customer_id = :id LIMIT 1\")\n Single<Reservation> findByCustomerId(long id);\n\n @Query(\"SELECT * FROM reservation where table_no = :tableNo LIMIT 1\")\n Single<Reservation> findByTableNo(int tableNo);\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n long insertReservation(Reservation reservation);\n\n @Insert\n long[] insertAll(List<Reservation> reservations);\n\n @Update\n void update(Reservation reservation);\n\n @Delete\n int delete(Reservation reservation);\n\n @Query(\"DELETE FROM reservation\")\n int deleteAll();\n}", "public void testInsert() throws Exception {\n\n DAS das = DAS.FACTORY.createDAS(getConnection());\n Command insert = das.createCommand(\"insert into COMPANY (NAME) values (?)\");\n insert.setParameter(1, \"AAA Rental\");\n insert.execute();\n\n // Verify insert\n // Verify\n Command select = das.createCommand(\"Select ID, NAME from COMPANY\");\n DataObject root = select.executeQuery();\n\n assertEquals(4, root.getList(\"COMPANY\").size());\n assertTrue(root.getInt(\"COMPANY[1]/ID\") > 0);\n\n }", "public static void Enitityinsert (int id,String name,String FQN, String container,int potincy,String directtype,String table )\n { \n \n \ttry \n { \n Statement stmt=null; \n ResultSet res=null; \n Class.forName(\"com.mysql.jdbc.Driver\"); \n Connection conn = DriverManager.getConnection(sqldatabase,mysqluser,mysqlpassword); \n stmt = (Statement)conn.createStatement(); \n res= stmt.executeQuery(\"SELECT * from entity \"); \n\n\n // 增加数据\n Statement stm = (Statement) conn.createStatement();// 提交查巡\n String sql = \"select * from entity\";\n ResultSet rs = stm.executeQuery(sql);// 取得查巡結果\n// sql = \"insert into entity (id,name,FQN,container) values ('6','AccountType','Example2.O2.AccountType','Example2.O10')\";\n \n int n = stm.executeUpdate(\"insert into \"+table+\"(id,FQN,name,container,potincy,direct_type) values (\"+\"'\"+id+\"'\"+\",\"+\"'\"+FQN+\"'\"+\",\"+\"'\"+name+\"'\"+\",\"+\"'\"+container+\"'\"+\",\"+\"'\"+potincy+\"'\"+\",\"+\"'\"+directtype+\"'\"+\")\"); // 增加数据 \n if (n > 0) {\n// JOptionPane.showMessageDialog(null, \"成功\");\n \n \n } else {\n// JOptionPane.showMessageDialog(null, \"失败\");\n }\n //增加数据结束\n\n while (res.next()) \n { \n\n } \n } \n \n catch(Exception ex) \n { \n ex.printStackTrace(); \n } \n}", "public void createTransaction(Transaction trans);", "public String addBilling(Tour t,Event e){\n \n \n String result = \"0\";\n Connection con = null;\n //build the sql\n String SQLCommand = \"INSERT INTO billing(id,lineup_order,event_id,artist_id,tour_id)\" +\n \" values (seq_billing_id.NEXTVAL,?,?,?,?)\";\n \n try{\n //obtain the database connection by calling getConn() \n con = getConn();\n Billing b = t.getBills().get(0);\n \n \n //create the PreparedStatement from the Connection object by calling prepareCall\n //method, passing it the sql , parameters are represented by ? in the sql\n PreparedStatement ps = con.prepareStatement(SQLCommand); \n \n //setting the parameters values\n ps.setInt(1,b.getLineupOrder());\n ps.setLong(2,e.getId());\n ps.setLong(3, b.getArtist().getId());\n ps.setLong(4, t.getId());\n \n //exceuting the insert or update operation \n ps.executeUpdate(); \n }\n catch (SQLException ex){\n ex.printStackTrace();\n result = ex.getMessage();\n }\n return result;\n }", "public GenericDao<CreditCard> getCreditCardDao();", "int insert(DepAcctDO record);", "@Dao\npublic interface UserDao {\n @Query(\"SELECT * FROM users\")\n List<User> getAllUsers();\n\n @Query(\"SELECT * FROM users WHERE user_name like :username\")\n List<User> getAllUsers(String username);\n\n @Query(\"SELECT * FROM users WHERE userId like :userId\")\n User getUser(int userId);\n\n @Insert\n long insert(User user); //return id of the user added\n// void insert(User user);\n\n @Insert\n void insertAll(List<User> users);\n\n @Update\n void update(User user);\n\n @Delete\n void delete(User user);\n}", "@Test\n @Order(1)\n void TC_UTENTE_DAO_1()\n {\n\n /*creo uno username valido*/\n Utente utente = new Utente();\n utente.setUsername(\"utenteTest1\");\n utente.setPassword(\"password\");\n utente.setNome(\"Test\");\n utente.setCognome(\"Test\");\n utente.setNazionalità(\"italiana\");\n utente.setEmail(\"[email protected]\");\n UtenteDAO utenteDAO = new UtenteDAO();\n\n assertTrue(utenteDAO.doSave(utente));\n }", "@Test\r\n public void saveUserShouldCreateNewRowInDB(){\n userDaoJDBCTemplate.delete(38);\r\n userDaoJDBCTemplate.delete(40);\r\n userDaoJDBCTemplate.deleteByName(\"admin3\");\r\n userDaoJDBCTemplate.deleteByName(\"admin4\");\r\n }", "public BankDatabase() {\r\n accounts = new Account[3];\r\n Connection c = null;\r\n Statement stmt = null;\r\n try {\r\n Class.forName(\"org.postgresql.Driver\");\r\n c = DriverManager\r\n .getConnection(\"jdbc:postgresql://localhost:5432/ATM\",\r\n \"postgres\", \"0000\");\r\n c.setAutoCommit(false);\r\n stmt = c.createStatement();\r\n ResultSet rs = stmt.executeQuery( \"SELECT * FROM accounts;\" );\r\n var i = 0;\r\n while ( rs.next() ) {\r\n int theAccountNumber = rs.getInt(\"accountnumber\");\r\n int thePin = rs.getInt(\"pin\");\r\n double theAvailiableBalance = rs.getDouble(\"availiablebalance\");\r\n double theTotalBalance = rs.getDouble(\"totalbalance\");\r\n accounts[i] = new Account( theAccountNumber, thePin, theAvailiableBalance, theTotalBalance);\r\n i++;\r\n }\r\n rs.close();\r\n stmt.close();\r\n c.close();\r\n } catch ( Exception e ) {\r\n System.err.println( e.getClass().getName()+\": \"+ e.getMessage() );\r\n System.exit(0);\r\n }\r\n\r\n\r\n// accounts = new Account[2]; // just 2 accounts for testing\r\n// accounts[0] = new Account(12345, 54321, 1000.0, 1200.0);\r\n// accounts[1] = new Account(98765, 56789, 200.0, 200.0);\r\n }", "public int Trans1(Long userid,Long amount,Double price,Double comp_id)throws SQLException {\n\tint i=DbConnect.getStatement().executeUpdate(\"Insert into transaction values(trans_seq.nextval,\"+userid+\",sysdate,\"+amount+\",'sale','self',\"+comp_id+\",\"+price+\")\");\r\n\treturn i;\r\n}", "int insert(Admin record);", "int insert(Admin record);" ]
[ "0.6657685", "0.66476685", "0.6568574", "0.65552837", "0.65400016", "0.6507349", "0.6482898", "0.6457468", "0.64538234", "0.6385716", "0.6385461", "0.6375739", "0.635887", "0.63566387", "0.6315301", "0.6313687", "0.63115126", "0.62886715", "0.6269423", "0.626341", "0.6262515", "0.6262515", "0.625021", "0.6231961", "0.6208248", "0.6195489", "0.6188201", "0.6183664", "0.6182569", "0.6155238", "0.6151608", "0.61311036", "0.61294365", "0.61282897", "0.6121216", "0.6117176", "0.61132115", "0.6103296", "0.6101103", "0.60988474", "0.6098578", "0.60963166", "0.6093358", "0.60910666", "0.60835236", "0.60695654", "0.60511345", "0.6049154", "0.60450363", "0.60450363", "0.6044281", "0.6043693", "0.60300446", "0.6021959", "0.6021462", "0.6016025", "0.6013403", "0.6004204", "0.6001", "0.599269", "0.5989258", "0.5985677", "0.59844095", "0.5981388", "0.5980949", "0.5980184", "0.5979463", "0.5979118", "0.596332", "0.5960426", "0.5954498", "0.5953925", "0.59387404", "0.59348136", "0.5932625", "0.59252125", "0.59248", "0.5919047", "0.59166443", "0.5915739", "0.5915103", "0.5913931", "0.59085035", "0.59051526", "0.5904767", "0.590134", "0.5898839", "0.58981323", "0.5896779", "0.5894538", "0.5889303", "0.5888595", "0.5883608", "0.58808064", "0.5874491", "0.58601356", "0.58594114", "0.5858179", "0.5858152", "0.5853675", "0.5853675" ]
0.0
-1
remove DefaultUIProvider instances to avoid mapping extraneous UIs if e.g. a servlet is declared as a nested class in a UI class
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { VaadinSession session = event.getSession(); final String DefaultUiProviderCanonicalName = DefaultUIProvider.class.getCanonicalName(); for (UIProvider uiProvider : session.getUIProviders()) { // use canonical names as these may have been loaded with // different classloaders if (DefaultUiProviderCanonicalName.equals(uiProvider.getClass().getCanonicalName())) { session.removeUIProvider(uiProvider); } } //set the GuiceUIProvider session.addUIProvider(this.guiceUIProvider); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Form removeDefaultRendererForElementClass(Class<? extends Element> clazz);", "private UIManager() {\n tableUI = new TableUI();\n snifferUI = new SnifferUI();\n }", "public abstract void removeUI(BaseConfigInstance pPCI);", "@Override\r\n\tpublic Panel getUI() {\n\t\treturn null;\r\n\t}", "@Override\r\n\tpublic Panel getUI() {\n\t\treturn null;\r\n\t}", "public void uninstallUI(JComponent c) {\n // detach from the model\n editor.removePropertyChangeListener(updateHandler);\n editor.getDocument().removeDocumentListener(updateHandler);\n\n // view part\n painted = false;\n uninstallDefaults();\n rootView.setView(null);\n c.removeAll();\n LayoutManager lm = c.getLayout();\n if (lm instanceof UIResource) {\n c.setLayout(null);\n }\n\n // controller part\n uninstallKeyboardActions();\n uninstallListeners();\n\n editor = null;\n }", "@Override\n\tprotected void deInitUIandEvent()\n\t{\n\t}", "@Override\npublic void removeFromParentUIContainer() {\n\t\n}", "Form removeDefaultDecoratorsForElementClass(Class<? extends Element> clazz);", "@Override\n protected void unregisterVisuals() {\n Map visualPartMap = this.getViewer().getVisualPartMap();\n visualPartMap.remove(getFigure().getLabel());\n visualPartMap.remove(getFigure().getCheckBox());\n super.unregisterVisuals();\n }", "interface UiBinderInstance extends UiBinder<Widget, Menu> {\r\n\t\t// Nothing to do\r\n\t}", "protected void unhookViewers() {\n\t}", "public void uninstallUI(JComponent c) {\n uninstallDefaults();\n uninstallListeners();\n this.spinner = null;\n c.removeAll(); }", "public void updateUI() {\n if (ui != null) {\n removeKeymap(ui.getClass().getName());\n }\n setUI(UIManager.getUI(this));\n }", "protected void uninstallComponents() {\n }", "protected void uninstallComponents() {\n\t}", "protected void uninstallDefaults() {\n spinner.setLayout(null); }", "private void loginLoadRoomViewerUI()\r\n\t{\r\n\t\t// remove all login UI components\r\n\t\tthis.removeAll();\r\n\t\t\r\n\t\t// load the Room Viewer UI\r\n\t\tloadRoomViewerUI();\r\n\t}", "private void removeDefaultNewWizards()\n {\n // based on:\n // http://stackoverflow.com/questions/11307367/how-to-remove-default-wizards-from-file-new-menu-in-rcp-application\n // http://www.eclipse.org/forums/index.php/t/261462\n\n AbstractExtensionWizardRegistry wizardRegistry = (AbstractExtensionWizardRegistry) PlatformUI.getWorkbench().getNewWizardRegistry();\n IWizardCategory[] categories = PlatformUI.getWorkbench().getNewWizardRegistry().getRootCategory().getCategories();\n\n for (IWizardDescriptor wizard : getAllWizards(categories))\n {\n if(wizard.getCategory().getId().matches(\"org.eclipse.ui.Basic\"))\n {\n WorkbenchWizardElement wizardElement = (WorkbenchWizardElement) wizard;\n wizardRegistry.removeExtension(wizardElement.getConfigurationElement().getDeclaringExtension(), new Object[] { wizardElement });\n }\n }\n }", "public void uninstallUI(JComponent c)\n/* */ {\n/* 176 */ this.delegate.uninstallUI(c);\n/* 177 */ c.removeFocusListener(focusHandler);\n/* 178 */ this.promptComponent = null;\n/* */ }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "protected void setupUI() {\n\n }", "public static void setUI(UI newUi) {\n\t\tUI = newUi;\n\t}", "private void createUIComponents() {\n }", "@Override\n\tpublic boolean hasCustomUI() {\n\t\treturn false;\n\t}", "protected void unsetContribution(ComponentFactory factory) {\n\t\tComponentInstance ci;\n\t\tComponent c;\n\t\tsynchronized (this) {\n\t\t\tci = mapping.remove(factory);\n\t\t\tc = (Component) ci.getInstance();\n\t\t\ttabs.removeComponent(c);\n\t\t}\n\t\tc.detach();\n\t\tci.dispose();\n\t}", "private void leaveRenderGroups() {\r\n if (onePageDataModel.page != null) {\r\n for (CustomerBean uiCustomerBean : uiCustomerBeans) {\r\n renderManager.getOnDemandRenderer(uiCustomerBean.getCustomer().getCustomernumber().toString()).remove(this);\r\n }\r\n }\r\n }", "@Override\r\n\tprotected void initUI() {\n\r\n\t}", "@Override\n\tpublic IBaseLabelProvider getLabelProvider() {\n\t\treturn null;\n\t}", "public static UserRegistryImposition none() {\n return of(Registry.empty());\n }", "private PullUISingleton() {\n\t\tsuper.setTitle(\"Welcome to Pulls\");\n\t\tsuper.setSize(320, 550);\n\t\tsuper.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // \n\t\tsuper.setLocationRelativeTo(null);\n\t\tsuper.setResizable(false);\n\t\t\n\t\tsuper.addWindowListener(new WindowAdapter() {\n\t\t\tpublic void windowClosing(WindowEvent e) {\n\t\t\t\tMyPullsUISingleton myPullsUISingleton = MyPullsUISingleton.getInstance();\n\t\t\t\tmyPullsUISingleton.setVisible(false);\n\t\t\t\t\n\t\t\t\tLoginUISingleton loginUI = LoginUISingleton.getInstance();\n\t\t\t\tloginUI.setVisible(true);\n\t\t\t\t\n\t\t\t\tsession.setSession(false);\n\t\t\t}\n\t\t});\n\t\t\n\t\tcontrollersUI();\n\t}", "private UIUtils() {\n }", "private void clearUserNames()\n\t{\n\t\tfor (final JLabel jLabel : userNamesLabels)\n\t\t{\n\t\t\tuserDisplayPanel.remove(jLabel);\n\t\t}\n\t\tuserNamesLabels.clear();\n\t}", "private void clearAllUi() {\n /* Clear notification fields. */\n mTxtAuthentication.setText(R.string.noData);\n\n /* Clear card reader's response fields. */\n clearResponseUi();\n }", "void unsetControlType();", "protected void uninstallDefaults() {\n }", "private UnloadTestModelLoader() {\n registerProject(\"a\");\n registerProject(\"e\");\n registerProject(\"b\", \"e\");\n registerProject(\"c\");\n registerProject(\"d\");\n registerProject(\"f\");\n registerProject(\"p1\", \"a\", \"b\");\n registerProject(\"p2\", \"b\", \"c\");\n registerProject(\"p3\", \"b\", \"d\");\n registerProject(\"p4\", \"d\");\n }", "public UiFactoryImpl() {\n\t\tsuper();\n\t}", "public void removeRepresentations()\r\n\t{\n\t}", "public interface IInternalJiveUIConstants {\n\t\n\t/**\n\t * The prefix of all internal constants. \n\t */\n\tpublic String INTERNAL_ID_PREFIX = \"edu.buffalo.cse.jive.internal.ui\";\n\n\t/**\n\t * The folder ID of the <code>IFolderLayout</code> used to hold views\n\t * related to the current launches.\n\t */\n\tpublic String LAUNCH_FOLDER_ID = INTERNAL_ID_PREFIX + \".launchFolder\";\n\t\n\t/**\n\t * The folder ID of the <code>IFolderLayout</code> used to hold views for\n\t * the console or other miscellaneous views.\n\t */\n\tpublic String CONSOLE_FOLDER_ID = INTERNAL_ID_PREFIX + \".consoleFolder\";\n\t\n\t/**\n\t * The folder ID of the <code>IFolderLayout</code> used to hold views\n\t * related to the execution state of the active target.\n\t */\n\tpublic String EXECUTION_STATE_FOLDER_ID = INTERNAL_ID_PREFIX + \".executionStateFolder\";\n\t\n\t/**\n\t * The folder ID of the <code>IFolderLayout</code> used to hold views\n\t * related to the execution history of the active target.\n\t */\n\tpublic String EXECUTION_HISTORY_FOLDER_ID = INTERNAL_ID_PREFIX + \".executionHistoryFolder\";\n}", "private void initUI() {\n }", "void unsetDisplayName();", "protected void remove() {\n injectors.remove();\n }", "default HtmlFormatter removePackages() {\n return replace(\n PACKAGE_PATTERN,\n \"\"\n );\n }", "private void removeOldMouseGrabber() {\n Object oldLogger = ReflectionUtil.changeIllegalAccessLogger(null);\n AppContext context = AppContext.getAppContext();\n try {\n Field field = BasicPopupMenuUI.class.getDeclaredField(\"MOUSE_GRABBER_KEY\");\n field.setAccessible(true);\n Object value = field.get(null);\n Object mouseGrabber = context.get(value);\n if (mouseGrabber != null) {\n Method method = mouseGrabber.getClass().getDeclaredMethod(\"uninstall\");\n method.setAccessible(true);\n method.invoke(mouseGrabber);\n }\n context.put(value, null);\n } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {\n e.printStackTrace();\n } finally {\n ReflectionUtil.changeIllegalAccessLogger(oldLogger);\n }\n }", "public static void unregisterMainView(View<?> view) {\n DevintController.mainViews.remove(view);\n }", "protected void uninstallDefaults() {\n LookAndFeel.uninstallBorder(this.controlPanel);\n }", "private void removeNonCaleydoMenuEntries() {\n \t\tIMenuManager menuManager = getWindowConfigurer().getActionBarConfigurer()\n \t\t\t\t.getMenuManager();\n \t\tfor (IContributionItem item : menuManager.getItems()) {\n \n \t\t\tif (!item.getId().contains(\"org.caleydo\")) {\n \t\t\t\tmenuManager.remove(item);\n \t\t\t}\n \t\t}\n \n \t\tif (DataDomainManager.get().getDataDomainByID(\"org.caleydo.datadomain.generic\") != null) {\n \n \t\t\tIActionBarConfigurer configurer = getWindowConfigurer().getActionBarConfigurer();\n \n \t\t\t// Delete unwanted menu items\n \t\t\tIContributionItem[] menuItems = configurer.getMenuManager().getItems();\n \t\t\tfor (int i = 0; i < menuItems.length; i++) {\n \t\t\t\tIContributionItem menuItem = menuItems[i];\n \t\t\t\tif (menuItem.getId().equals(\"org.caleydo.search.menu\")) {\n \t\t\t\t\tconfigurer.getMenuManager().remove(menuItem);\n \t\t\t\t}\n \t\t\t\telse if (menuItem.getId().equals(\"viewMenu\")) {\n \t\t\t\t\tIContributionItem itemToRemove = ((MenuManager) menuItem)\n \t\t\t\t\t\t\t.find(\"org.caleydo.core.command.openviews.remote\");\n \n \t\t\t\t\tif (itemToRemove != null)\n \t\t\t\t\t\titemToRemove.setVisible(false);\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t}", "protected void uninstallDefaults() {\n\t\tLookAndFeel.uninstallBorder(this.controlPanel);\n\t}", "@Override\n public void formClearRegistry() {\n throw new UnsupportedOperationException(\"Not supported yet.\");\n }", "@Override\n public void formClearRegistry() {\n throw new UnsupportedOperationException(\"Not supported yet.\");\n }", "@Override\n\tpublic Component getConfigUI2(List<Design2> designs) {\n\t\treturn null;\n\t}", "public void hideCastMiniController() {\n }", "public void setMyUi(Object ui) {\n super.setMyUi(ui);\n try {\n init();\n } catch (Exception e) {e.printStackTrace();};\n }", "@Test\n\tpublic void testUIControllerImpl() {\n\t\tassertNotNull(uic);\n\t}", "public void teardown() {\n for (App app : applications) {\n app.icon.setCallback(null);\n }\n\t}", "public static void clearRegistry() {\r\n\t\tINTERPRETERS.clear();\r\n\t}", "private void initUIAfterLogin() {\n lnLoggedOutState.setVisibility(View.GONE);\n lnLoggedInState.setVisibility(View.VISIBLE);\n initUserProfileUI();\n }", "void removeRenderEngine(String context, LoginRenderEngine vengine);", "@ZAttr(id=1112)\n public Map<String,Object> unsetGalLdapGroupHandlerClass(Map<String,Object> attrs) {\n if (attrs == null) attrs = new HashMap<String,Object>();\n attrs.put(Provisioning.A_zimbraGalLdapGroupHandlerClass, \"\");\n return attrs;\n }", "@Override\n public Map<String, ? extends ServletRegistration> getServletRegistrations() {\n return null;\n }", "public interface UserInterface {\n /**\n * Remove all objects from UserInterface.\n */\n void clear();\n\n /**\n * Add object to UserInterface.\n *\n * @param actor UI object to add.\n */\n void add(Actor actor);\n\n /**\n * Removes object from UserInterface.\n *\n * @param actor UI object to remove.\n */\n void remove(Actor actor);\n\n /**\n * Updates all UI Objects and renders stage.\n */\n void update();\n\n /**\n * Returns reference to the style store.\n *\n * @return UiStyle store\n */\n UiStyle getUiStyle();\n}", "void tempInRegionUI();", "protected void removeSipProvider() {\n\t\tthis.sipProviderImpl = null;\n\t}", "public interface UiController {\n void showOrHideProgressBar(boolean show);\n void refreshWidgetUi(LocalWallpaperInfo info);\n void refreshMainUi(LocalWallpaperInfo info);\n void setSystemWallpaper(Bitmap bitmap);\n}", "public void unregister(boolean perUserNotMachine) throws ComException {\n\t\tfor (Class<?> cls : getCoClasses())\n\t\t\tRegUtil.unregisterCoClass(perUserNotMachine, cls);\n\t\tfor (Class<?> cls : getAddins())\n\t\t\tRegisterAddin.unregister(perUserNotMachine, cls);\n\t\tfor (Class<?> cls : getFormRegions())\n\t\t\tRegisterFormRegion.unregister(perUserNotMachine, cls);\n\t}", "@SuppressWarnings(\"unchecked\")\n @Override\n public void unexport() {\n String protocolKey = null;\n String ipPort = url.getServerPortStr();\n\n Exporter<T> exporter = (Exporter<T>) exporterMap.remove(protocolKey);\n\n if (exporter != null) {\n exporter.destroy();\n }\n ProviderMessageRouter requestRouter = ipPort2RequestRouter.get(ipPort);\n\n if (requestRouter != null) {\n requestRouter.removeProvider(provider);\n }\n }", "private void hideAdvanceFeatures() {\n sourceLabel.setVisible(false);\n sourceTextField.setVisible(false);\n threadsTextField.setEnabled(false);\n adminLabel.setVisible(false);\n adminTextField.setVisible(false);\n tracerPanel.setVisible(false);\n simulateCheckBox.setVisible(false);\n useScriptCheckBox.setVisible(false);\n editScriptButton.setVisible(false);\n batchImportCheckBox.setVisible(false);\n numResourceToCopyLabel.setVisible(false);\n numResourceToCopyTextField.setVisible(false);\n recordURIComboBox.setVisible(false);\n paramsLabel.setVisible(false);\n paramsTextField.setVisible(false);\n viewRecordButton.setVisible(false);\n testRecordButton.setVisible(false);\n basicUIButton.setVisible(false);\n\n isBasicUI = true;\n }", "public synchronized void unRegisterAll()\r\n {\r\n clearNameObjectMaps();\r\n }", "@Override\r\n\tprotected void onDestroy() {\n\t\tsuper.onDestroy();\r\n\t\tUiUpdater.unregisterClient(handler);\r\n\t}", "private void reloadUI() {\n\t\tMessages.reloadUIi18n(uis);\n\t}", "public void removeDefaultInterpreter() {\n\t\ttry {\n\t\t\topenInterpreters();\n\t\t\tSWTBotShell shell = getBot().shell(DLG_PREFERENCES);\n\t\t\tSWTBotTable tableBot = getBot().table();\n\n\t\t\tcheckInterpreter(tableBot, DltkTestsHelper.ALT_INTERPRETER_PATH,\n\t\t\t\t\tDltkTestsHelper.ALT_INTERPRETER_ID, false, 0);\n\t\t\tcheckInterpreter(tableBot, DltkTestsHelper.DEF_INTERPRETER_PATH,\n\t\t\t\t\tDltkTestsHelper.DEF_INTERPRETER_ID, true, 1);\n\n\t\t\ttableBot.select(1);\n\t\t\tgetBot().button(BTN_REMOVE).click();\n\n\t\t\ttableBot = getBot().table();\n\t\t\tgetBot().waitUntil(Conditions.tableHasRows(tableBot, 1));\n\n\t\t\tcheckInterpreter(tableBot, DltkTestsHelper.ALT_INTERPRETER_PATH,\n\t\t\t\t\tDltkTestsHelper.ALT_INTERPRETER_ID, true, 0);\n\n\t\t\twaitEnableAndClick(BTN_OK);\n\t\t\tgetBot().waitUntil(Conditions.shellCloses(shell));\n\t\t} catch (WidgetNotFoundException ex) {\n\t\t\tSWTBotTestCase.fail(ex.getLocalizedMessage());\n\t\t} catch (TimeoutException ex) {\n\t\t\tSWTBotTestCase.fail(ex.getLocalizedMessage());\n\t\t}\n\t}", "public interface InterfaceUI {\n \n // This is used in all other UI classes\n public Scene getUI(UIController uicontroller);\n}", "public static UIActivator getDefault() {\r\n\t\treturn plugin;\r\n\t}", "public void resetUI() {\r\n\t\tframe.resetUI();\r\n\t}", "public void unregisterAll()\n {\n final Set<javax.servlet.Servlet> servlets = new HashSet<>(this.localServlets);\n for (final javax.servlet.Servlet servlet : servlets)\n {\n unregisterServlet(servlet);\n }\n }", "void removeObjectFactory(Injectable injectable);", "private void removeProvider(MarketDataProvider inProvider)\n {\n activeProvidersByName.remove(inProvider.getProviderName());\n providersByPriority.remove(inProvider);\n }", "@SuppressWarnings(\"unchecked\")\n private void userinitComponents() {\n attendace.home = this;\n \n \n \n }", "public void removeAllAnnotationTypes() {\n \t\tfConfiguredAnnotationTypes.clear();\n \t\tfAllowedAnnotationTypes.clear();\n \t\tfConfiguredHighlightAnnotationTypes.clear();\n \t\tfAllowedHighlightAnnotationTypes.clear();\n \t\tif (fTextInputListener != null) {\n \t\t\tfSourceViewer.removeTextInputListener(fTextInputListener);\n \t\t\tfTextInputListener= null;\n \t\t}\n \t}", "static /* synthetic */ void m56320b(HoneyPayMainUI honeyPayMainUI) {\n AppMethodBeat.m2504i(41905);\n Iterator it = honeyPayMainUI.nsA.iterator();\n while (it.hasNext()) {\n honeyPayMainUI.nsy.removeView((HoneyPayCardLayout) it.next());\n }\n honeyPayMainUI.nsA.clear();\n AppMethodBeat.m2505o(41905);\n }", "private WSEditorProviderRegistry() {\n }", "public void dispose() {\r\n\t\tif (ihsDeployRootItemProvider != null) ihsDeployRootItemProvider.dispose();\r\n\t\tif (ihsModuleItemProvider != null) ihsModuleItemProvider.dispose();\r\n\t\tif (ihsServerItemProvider != null) ihsServerItemProvider.dispose();\r\n\t\tif (ihsServerUnitItemProvider != null) ihsServerUnitItemProvider.dispose();\r\n\t\tif (ihsSystemItemProvider != null) ihsSystemItemProvider.dispose();\r\n\t\tif (ihsSystemUnitItemProvider != null) ihsSystemUnitItemProvider.dispose();\r\n\t\tif (ihsUserItemProvider != null) ihsUserItemProvider.dispose();\r\n\t\tif (ihsUserRepositoryItemProvider != null) ihsUserRepositoryItemProvider.dispose();\r\n\t\tif (ihsUserUnitItemProvider != null) ihsUserUnitItemProvider.dispose();\r\n\t\tif (ihsWasAdminModuleItemProvider != null) ihsWasAdminModuleItemProvider.dispose();\r\n\t\tif (ihsWasAdminModuleUnitItemProvider != null) ihsWasAdminModuleUnitItemProvider.dispose();\r\n\t\tif (ihsWasModuleItemProvider != null) ihsWasModuleItemProvider.dispose();\r\n\t\tif (ihsWasModuleUnitItemProvider != null) ihsWasModuleUnitItemProvider.dispose();\r\n\t\tif (linuxIhsSystemItemProvider != null) linuxIhsSystemItemProvider.dispose();\r\n\t\tif (windowsIhsSystemItemProvider != null) windowsIhsSystemItemProvider.dispose();\r\n\t}" ]
[ "0.5926586", "0.5557083", "0.5472249", "0.54544705", "0.54544705", "0.54366916", "0.54291904", "0.5416696", "0.532904", "0.5305391", "0.52869797", "0.52415776", "0.5184138", "0.5175846", "0.51497114", "0.51232564", "0.5100436", "0.5092297", "0.50890654", "0.50835544", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.50819063", "0.5081176", "0.5079255", "0.5059301", "0.504886", "0.50313586", "0.5026131", "0.50133044", "0.49944866", "0.49858552", "0.49781877", "0.49698988", "0.49660766", "0.4965727", "0.4963529", "0.49460626", "0.4941366", "0.49336416", "0.4931835", "0.49274495", "0.49161404", "0.49127445", "0.49094835", "0.49009976", "0.48779684", "0.4873501", "0.4861227", "0.48557588", "0.4846297", "0.48440942", "0.48440942", "0.4841127", "0.4832637", "0.4826892", "0.48123178", "0.4807669", "0.47898206", "0.47819266", "0.47792", "0.47704455", "0.47613758", "0.47290206", "0.47269604", "0.47190785", "0.47185567", "0.4712444", "0.47024143", "0.46993726", "0.4698409", "0.46954635", "0.4687515", "0.46859193", "0.46839866", "0.46762028", "0.46760985", "0.46658716", "0.46650714", "0.46570826", "0.46515396", "0.46478507", "0.4647236", "0.46430072", "0.46369135" ]
0.57923067
1
Gets the single instance of InfoCommand.
public static InfoCommand getInstance(){ return instance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public CommandInfo getInfo() {\n\t\treturn info;\n\t}", "public InfoCommand() {\n\n\t\tsuper(\"info\", Command.ArgumentType.NONE, Command.Category.UTILITY);\n\t}", "public InfoCommand() {\n super(\"info\", \"info <Spieler>\", \"Gib dir Informationen über den Chunk oder Spieler\", SubCommand.NONE_PERMISSION);\n }", "private InfoCommand()\n\t{\n\t\t\n\t\t\n\t}", "public Object getInfo() {\n return info;\n }", "public CommandDetail() {\n this.commandType = CommandType.UNKNOWN;\n commandData = new HashMap<String, Object>();\n }", "@Override\n public final Command getCommand() {\n return commandIdentifier;\n }", "public CommandManager getCommand() {\n\treturn command;\n }", "public ServerInfo commandInterface()\n {\n return command_stub;\n }", "public network.message.PlayerResponses.Command getCommand() {\n if (responseCase_ == 2) {\n return (network.message.PlayerResponses.Command) response_;\n }\n return network.message.PlayerResponses.Command.getDefaultInstance();\n }", "public java.lang.String getInfoId() {\n return infoId;\n }", "ProviderCommandRequest findOne(Long id);", "public String getInfo() {\n return this.info;\n }", "public String getInfo() {\n return info;\n }", "public Command getCurrentCommand();", "public String getCommand() {\n return command;\n }", "public String getCommand() {\n return command;\n }", "public String getCommand() {\n\n return command;\n }", "public String getCommand() {\r\n return command;\r\n }", "public String getCommand(){\n return getCommand(null);\n }", "public String Command() {\n\treturn command;\n }", "public String getCommand()\r\n\t{\r\n\t\treturn command;\r\n\t}", "public String getCommand() { return command; }", "public String getInfo()\n {\n return info;\n }", "public network.message.PlayerResponses.Command getCommand() {\n if (commandBuilder_ == null) {\n if (responseCase_ == 2) {\n return (network.message.PlayerResponses.Command) response_;\n }\n return network.message.PlayerResponses.Command.getDefaultInstance();\n } else {\n if (responseCase_ == 2) {\n return commandBuilder_.getMessage();\n }\n return network.message.PlayerResponses.Command.getDefaultInstance();\n }\n }", "@NonNull\n T getInfo();", "public int getCommand() {\n return command_;\n }", "public String getCommand() {\n return this.command;\n }", "public int getCommand() {\n return command_;\n }", "public InfoCommand(CollectionManager col){\n collectionManager = col;\n }", "public java.lang.String getCommand() {\n java.lang.Object ref = command_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n command_ = s;\n }\n return s;\n }\n }", "@Override\n public String getInfo() {\n return this.info;\n }", "public com.google.protobuf.ByteString\n getInfoBytes() {\n Object ref = info_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (String) ref);\n info_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public java.lang.String getCommand() {\n java.lang.Object ref = command_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n command_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "String getCommand();", "public com.google.protobuf.ByteString\n getInfoBytes() {\n Object ref = info_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (String) ref);\n info_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public network.message.PlayerResponses.CommandOrBuilder getCommandOrBuilder() {\n if (responseCase_ == 2) {\n return (network.message.PlayerResponses.Command) response_;\n }\n return network.message.PlayerResponses.Command.getDefaultInstance();\n }", "java.lang.String getCommand();", "public String getCommand(){\n return command;\n }", "public int getCommand()\n\t{\n\t\treturn this.command;\n\t}", "Information getInfo();", "public Command createInstance() {\n\t\t\n\t\tif(name == \"Direction\")\n\t\t\treturn new Direction();\n\t\t\n\t\tif(name == \"Gear\")\n\t\t\treturn new Gear();\n\t\t\n\t\tif(name == \"Pause\")\n\t\t\treturn new Pause();\n\t\t\n\t\treturn null;\n\t\t\n\t}", "public network.message.PlayerResponses.CommandOrBuilder getCommandOrBuilder() {\n if ((responseCase_ == 2) && (commandBuilder_ != null)) {\n return commandBuilder_.getMessageOrBuilder();\n } else {\n if (responseCase_ == 2) {\n return (network.message.PlayerResponses.Command) response_;\n }\n return network.message.PlayerResponses.Command.getDefaultInstance();\n }\n }", "@Override\n\tpublic String getCommand() {\n\t\treturn model.getCommand();\n\t}", "public String getInfo() {\n Object ref = info_;\n if (ref instanceof String) {\n return (String) ref;\n } else {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n info_ = s;\n return s;\n }\n }", "private void cmdInfo(String line) throws NoSystemException {\n StringTokenizer tokenizer = new StringTokenizer(line);\n try {\n String subCmd = tokenizer.nextToken();\n if (subCmd.equals(\"class\")) {\n String arg = tokenizer.nextToken();\n cmdInfoClass(arg);\n } else if (subCmd.equals(\"model\")) {\n cmdInfoModel();\n } else if (subCmd.equals(\"state\")) {\n cmdInfoState();\n } else if (subCmd.equals(\"opstack\")) {\n cmdInfoOpStack();\n } else if (subCmd.equals(\"prog\")) {\n cmdInfoProg();\n } else if (subCmd.equals(\"vars\")) {\n cmdInfoVars();\n } else\n Log.error(\"Syntax error in info command. Try `help'.\");\n } catch (NoSuchElementException ex) {\n Log.error(\"Missing argument to `info' command. Try `help'.\");\n }\n }", "public int getInfo()\r\n\t{\r\n\t\treturn info;\r\n\t}", "@Override\r\n\tpublic String getCOMMAND() {\n\t\treturn COMMAND;\r\n\t}", "@java.lang.Override\n public com.google.cloud.networkmanagement.v1beta1.InstanceInfo getInstance() {\n if (stepInfoCase_ == 5) {\n return (com.google.cloud.networkmanagement.v1beta1.InstanceInfo) stepInfo_;\n }\n return com.google.cloud.networkmanagement.v1beta1.InstanceInfo.getDefaultInstance();\n }", "public int getInfo ()\n\t\t{\n\t\t\treturn info;\n\t\t}", "MBeanInfo getCommandDescription(String commandType);", "public String readCommand() {\n return scanner.nextLine();\n }", "public AbstractCommand getCommand(HttpServletRequest request) {\n LOGGER.info(\"request key is \" + request.getMethod() + request.getPathInfo());\n String method = request.getMethod();\n String pathInfo = request.getPathInfo();\n return command.get(method + pathInfo);\n }", "@Override\n public String getInfo(){\n return info;\n }", "public java.lang.String getInfoCode() {\n return infoCode;\n }", "public String getInfo() {\n Object ref = info_;\n if (!(ref instanceof String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n info_ = s;\n return s;\n } else {\n return (String) ref;\n }\n }", "public InfoMessage createInfoMessage();", "public Info() {\n super();\n }", "public Command getCommand() {\n String userInput = in.nextLine();\n String[] words = userInput.split(\" \", 2);\n try {\n return new Command(words[0].toLowerCase(), words[1]);\n } catch (ArrayIndexOutOfBoundsException e) {\n return new Command(words[0].toLowerCase(), Command.BLANK_DESCRIPTION);\n }\n }", "public MBeanInfo getInfo() throws InstanceNotFoundException,\r\n\t\t\tIntrospectionException, ReflectionException, IOException {\r\n\t\treturn home.getInfo(objectName);\r\n\t}", "public ICommand getCommand(HttpServletRequest request) {\n\n ICommand command = commands.get(request.getParameter(\"command\"));\n\n if (command == null) {\n command = new NoCommand();\n }\n\n return command;\n }", "public Command getCommand() {\n\t\treturn redCom;\n\t}", "public InfoView getInfoView() {\r\n return infoPanel;\r\n }", "public lnrpc.Rpc.GetInfoResponse getInfo(lnrpc.Rpc.GetInfoRequest request) {\n return blockingUnaryCall(\n getChannel(), getGetInfoMethod(), getCallOptions(), request);\n }", "public abstract String getCommand();", "int getCommand();", "public java.lang.String getCommand(int index) {\n return command_.get(index);\n }", "public Command click() {\r\n\t\treturn command;\r\n\t}", "public java.lang.String getCommand(int index) {\n return command_.get(index);\n }", "public String toString(){\n return \"info\";\n }", "@JsonIgnore\n\tdefault short getCmd() {\n\t\tMessageMeta annotation = getClass().getAnnotation(MessageMeta.class);\n\t\tif (annotation != null) {\n\t\t\treturn annotation.cmd();\n\t\t}\n\t\treturn 0;\n\t}", "public int getCommand() {\r\n\t\tif(this.command == null){\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\treturn this.command.ordinal();\r\n\t}", "@java.lang.Override\n public com.google.cloud.networkmanagement.v1beta1.InstanceInfo getInstance() {\n if (instanceBuilder_ == null) {\n if (stepInfoCase_ == 5) {\n return (com.google.cloud.networkmanagement.v1beta1.InstanceInfo) stepInfo_;\n }\n return com.google.cloud.networkmanagement.v1beta1.InstanceInfo.getDefaultInstance();\n } else {\n if (stepInfoCase_ == 5) {\n return instanceBuilder_.getMessage();\n }\n return com.google.cloud.networkmanagement.v1beta1.InstanceInfo.getDefaultInstance();\n }\n }", "void doInfo() throws AmbiguousException, PlayerDebugException\n\t{\n\t\t/* info without any args brings up help */\n\t\tif (!hasMoreTokens())\n\t\t\tout( getHelpTopic(\"info\") ); //$NON-NLS-1$\n\t\telse\n\t\t{\n\t\t\t/* otherwise we have a boatload of options */\n\t\t\tString subCmdString = nextToken();\n\t\t\tint subCmd = infoCommandFor(subCmdString);\n\t\t\tswitch(subCmd)\n\t\t\t{\n\t\t\t\tcase INFO_ARGS_CMD:\n\t\t\t\t\tdoInfoArgs();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_BREAK_CMD:\n\t\t\t\t\tdoInfoBreak();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_FILES_CMD:\n\t\t\t\t\tdoInfoFiles();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_FUNCTIONS_CMD:\n\t\t\t\t\tdoInfoFuncs();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_HANDLE_CMD:\n\t\t\t\t\tdoInfoHandle();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_LOCALS_CMD:\n\t\t\t\t\tdoInfoLocals();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_SCOPECHAIN_CMD:\n\t\t\t\t\tdoInfoScopeChain();\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase INFO_SOURCES_CMD:\n\t\t\t\t\tdoInfoSources();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_STACK_CMD:\n\t\t\t\t\tdoInfoStack();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_VARIABLES_CMD:\n\t\t\t\t\tdoInfoVariables();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_DISPLAY_CMD:\n\t\t\t\t\tdoInfoDisplay();\n\t\t\t\t\tbreak;\n\n case INFO_TARGETS_CMD:\n doInfoTargets();\n break;\n\n case INFO_SWFS_CMD:\n doInfoSwfs();\n break;\n\n\t\t\t\tdefault:\n\t\t\t\t\tdoUnknown(\"info\", subCmdString); //$NON-NLS-1$\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "@Override\r\n\tpublic InfoApi getInfoApi() {\r\n\t\treturn this;\r\n\t}", "com.google.protobuf.ByteString\n getCommandBytes();", "public com.google.protobuf.ByteString\n getCommandBytes() {\n java.lang.Object ref = command_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n command_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public String getToolCommand();", "public String getCmd() {\r\n return cmd;\r\n }", "public String getCommand() {\n\t\tString[] lines = commandLine.getText().split(\"\\n\");\n\t\treturn lines[commandLine.getLineCount() - 2];\n\t}", "public CommandDetail(CommandType commandType) {\n this.commandType = commandType;\n commandData = new HashMap<String, Object>();\n }", "public String getInfoPkid() {\n return infoPkid;\n }", "public static Command get(String commandName) {\n if (commandName == null || !commands.containsKey(commandName)) {\n log.trace(\"Command not found, name --> \" + commandName);\n return commands.get(\"noCommand\");\n }\n\n return commands.get(commandName);\n }", "public Pit getCommandPit();", "public Object getInfo() {\n // from AddEventHandler\n return new String();\n }", "public String getInfo() {\n\t\treturn null;\r\n\t}", "public com.google.protobuf.ByteString\n getCommandBytes() {\n java.lang.Object ref = command_;\n if (ref instanceof java.lang.String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n command_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "@Override\n @Transactional(readOnly = true)\n public Optional<CommandDTO> findOne(Long id) {\n log.debug(\"Request to get Command : {}\", id);\n return commandRepository.findById(id)\n .map(commandMapper::toDto);\n }", "@Override\n public String toString() {\n return (\"Command \" + this.getCommandName().toUpperCase() + \":\\n\" + this\n .commandDocumentation());\n }", "@Override\n public BuildInfo get() {\n return BUILD_INFO;\n }", "Optional<String> command();", "public InformationField getInfo() {\n\treturn informationField;\n }", "final public String getActionCommand() {\n return command;\n }", "public static BlackjackCommandManager getInstance() {\n return instance;\n }", "public CommandValue getCommand() {\n\t\treturn value;\n\t}", "private Widget getInfo() {\n FocusPanel infoPanel = new FocusPanel();\n infoPanel.setStyleName(\"elv-Molecules-InfoPanel\");\n HorizontalPanel content = new HorizontalPanel();\n try{\n Image img = new Image(ReactomeImages.INSTANCE.information());\n String helpTitle = \"Info\";\n HTMLPanel helpContent = new HTMLPanel(\n \"The molecules tab shows you all the molecules of a complete pathway diagram.\\n\" +\n \"Molecules are grouped in Chemical Compounds, Proteins, Sequences and Others.\\n\" +\n \"The molecules of a selected object appear highlighted in the molecules lists;\\n\" +\n \"a molecule selected in the list will be highlighted in the diagram.\\n\" +\n \"For each molecule you can see a symbol, a link to the main reference DB, a name and the number of\\n\" +\n \"occurrences in the pathway. Clicking on the symbol several times will allow you to circle through\\n\" +\n \"all its occurrences in the diagram.\\n\" +\n \"Expanding by clicking on the '+' will provide you with further external links.\\n\" +\n \"Lists can be downloaded. Just click on the button in the top right\\n\" +\n \"corner, select the fields and types you are interested in and click 'Start Download'.\");\n\n content.add(img);\n popup = new HelpPopup(helpTitle, helpContent);\n infoPanel.addMouseOverHandler(this);\n infoPanel.addMouseOutHandler(this);\n infoPanel.getElement().getStyle().setProperty(\"cursor\", \"help\");\n }catch (Exception e){\n// e.printStackTrace();\n Console.error(getClass() + \": \" + e.getMessage());\n //ToDo: Enough?\n }\n HTMLPanel title = new HTMLPanel(\"Info\");\n title.getElement().getStyle().setMarginLeft(10, Style.Unit.PX);\n content.add(title);\n\n infoPanel.add(content.asWidget());\n\n return infoPanel;\n }", "@java.lang.Override\n public com.google.cloud.networkmanagement.v1beta1.InstanceInfoOrBuilder getInstanceOrBuilder() {\n if (stepInfoCase_ == 5) {\n return (com.google.cloud.networkmanagement.v1beta1.InstanceInfo) stepInfo_;\n }\n return com.google.cloud.networkmanagement.v1beta1.InstanceInfo.getDefaultInstance();\n }", "public Command commandType() {\r\n if (command.startsWith(\"push\")) {\r\n return Command.C_PUSH;\r\n } else if (command.startsWith(\"pop\")) {\r\n return Command.C_POP;\r\n } else if (isArithmeticCmd()) {\r\n return Command.C_ARITHMETIC;\r\n } else if (command.startsWith(\"label\")) {\r\n return Command.C_LABEL;\r\n } else if (command.startsWith(\"goto\")) {\r\n return Command.C_GOTO;\r\n } else if (command.startsWith(\"if-goto\")) {\r\n return Command.C_IF;\r\n } else if (command.startsWith(\"function\")) {\r\n return Command.C_FUNCTION;\r\n } else if (command.startsWith(\"call\")) {\r\n return Command.C_CALL;\r\n } else if (command.startsWith(\"return\")) {\r\n return Command.C_RETURN;\r\n } else {\r\n return null;\r\n }\r\n }", "public static IControllerInfo getInstance() {\r\n\t\treturn instance;\r\n\t}", "public CommandLineTool getCommandLineToolInstance() {\n \treturn COMMAND_LINE_TOOL;\n }" ]
[ "0.79147655", "0.73374814", "0.6680813", "0.66454756", "0.610843", "0.5955623", "0.58979106", "0.58581126", "0.5849891", "0.5833743", "0.5801596", "0.5785148", "0.57815486", "0.577842", "0.5773068", "0.57581884", "0.57581884", "0.5753124", "0.5751345", "0.5750762", "0.5732847", "0.5725095", "0.57198524", "0.5703333", "0.56764984", "0.56678694", "0.56472266", "0.5629078", "0.5613081", "0.55956274", "0.556055", "0.55582184", "0.55421615", "0.5530074", "0.55276215", "0.5526407", "0.54978997", "0.54940915", "0.5470135", "0.54674757", "0.54135203", "0.5407598", "0.5404092", "0.5364783", "0.5344462", "0.53264755", "0.53252643", "0.5318758", "0.53178114", "0.53052527", "0.5299614", "0.5298207", "0.52981585", "0.5297857", "0.52947384", "0.52808475", "0.5265907", "0.52573895", "0.52536434", "0.5252335", "0.5244862", "0.52419937", "0.51978064", "0.51953727", "0.5180226", "0.51781756", "0.5165485", "0.516026", "0.51542866", "0.51515865", "0.514959", "0.5148071", "0.5134139", "0.51307917", "0.51235116", "0.51098865", "0.51096725", "0.5106219", "0.5105133", "0.5100491", "0.5098968", "0.50967664", "0.5096247", "0.5095196", "0.5090135", "0.5086338", "0.5085973", "0.5072805", "0.50646496", "0.50543237", "0.50474596", "0.5041763", "0.5040491", "0.50370884", "0.5036571", "0.50325525", "0.5021348", "0.5019901", "0.50192934", "0.5018723" ]
0.7995438
0
Instantiates a new info command.
private InfoCommand() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public InfoCommand() {\n\n\t\tsuper(\"info\", Command.ArgumentType.NONE, Command.Category.UTILITY);\n\t}", "public InfoCommand() {\n super(\"info\", \"info <Spieler>\", \"Gib dir Informationen über den Chunk oder Spieler\", SubCommand.NONE_PERMISSION);\n }", "public Info() {\n super();\n }", "public static InfoCommand getInstance(){\n\t return instance;\n\t}", "public CommandInfo getInfo() {\n\t\treturn info;\n\t}", "public CommandInfo(String verb, String className) {\n\tthis.verb = verb;\n\tthis.className = className;\n }", "public InfoCommand(CollectionManager col){\n collectionManager = col;\n }", "public InfoProvider()\n {\n }", "private void cmdInfo(String line) throws NoSystemException {\n StringTokenizer tokenizer = new StringTokenizer(line);\n try {\n String subCmd = tokenizer.nextToken();\n if (subCmd.equals(\"class\")) {\n String arg = tokenizer.nextToken();\n cmdInfoClass(arg);\n } else if (subCmd.equals(\"model\")) {\n cmdInfoModel();\n } else if (subCmd.equals(\"state\")) {\n cmdInfoState();\n } else if (subCmd.equals(\"opstack\")) {\n cmdInfoOpStack();\n } else if (subCmd.equals(\"prog\")) {\n cmdInfoProg();\n } else if (subCmd.equals(\"vars\")) {\n cmdInfoVars();\n } else\n Log.error(\"Syntax error in info command. Try `help'.\");\n } catch (NoSuchElementException ex) {\n Log.error(\"Missing argument to `info' command. Try `help'.\");\n }\n }", "public InfoMessage createInfoMessage();", "public InfoDialog() {\r\n\t\tcreateContents();\r\n\t}", "public Info(String json) {\n super(json);\n }", "public void setInfo(String info) {\n this.info = info;\n }", "private GetMyInfo()\r\n/* 13: */ {\r\n/* 14:13 */ super(new APITag[] { APITag.INFO }, new String[0]);\r\n/* 15: */ }", "public CommandDetail() {\n this.commandType = CommandType.UNKNOWN;\n commandData = new HashMap<String, Object>();\n }", "public Information()\n\t{\n\t\t// empty constructor\n\t}", "Information createInformation();", "public PIInfo() {\n }", "public void info()\n {\n System.out.println(toString());\n }", "void doInfo() throws AmbiguousException, PlayerDebugException\n\t{\n\t\t/* info without any args brings up help */\n\t\tif (!hasMoreTokens())\n\t\t\tout( getHelpTopic(\"info\") ); //$NON-NLS-1$\n\t\telse\n\t\t{\n\t\t\t/* otherwise we have a boatload of options */\n\t\t\tString subCmdString = nextToken();\n\t\t\tint subCmd = infoCommandFor(subCmdString);\n\t\t\tswitch(subCmd)\n\t\t\t{\n\t\t\t\tcase INFO_ARGS_CMD:\n\t\t\t\t\tdoInfoArgs();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_BREAK_CMD:\n\t\t\t\t\tdoInfoBreak();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_FILES_CMD:\n\t\t\t\t\tdoInfoFiles();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_FUNCTIONS_CMD:\n\t\t\t\t\tdoInfoFuncs();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_HANDLE_CMD:\n\t\t\t\t\tdoInfoHandle();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_LOCALS_CMD:\n\t\t\t\t\tdoInfoLocals();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_SCOPECHAIN_CMD:\n\t\t\t\t\tdoInfoScopeChain();\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase INFO_SOURCES_CMD:\n\t\t\t\t\tdoInfoSources();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_STACK_CMD:\n\t\t\t\t\tdoInfoStack();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_VARIABLES_CMD:\n\t\t\t\t\tdoInfoVariables();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase INFO_DISPLAY_CMD:\n\t\t\t\t\tdoInfoDisplay();\n\t\t\t\t\tbreak;\n\n case INFO_TARGETS_CMD:\n doInfoTargets();\n break;\n\n case INFO_SWFS_CMD:\n doInfoSwfs();\n break;\n\n\t\t\t\tdefault:\n\t\t\t\t\tdoUnknown(\"info\", subCmdString); //$NON-NLS-1$\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public void setInfo(String i)\n {\n info = i;\n }", "@SuppressWarnings(\"unused\")\n private void generateInfo()\n {\n }", "public CallInfo() {\n\t}", "public NoticeInfo() {\n this(DSL.name(\"notice_info\"), null);\n }", "default String info(String... args) {\n String message = create(args);\n getLogger().info(message);\n return message;\n }", "Information getInfo();", "public static void p_show_info_program() {\n System.out.println(\"╔══════════════════════════════╗\");\n System.out.println(\"║ SoftCalculator V1.2 ║\");\n System.out.println(\"║ Oscar Javier Cardozo Diaz ║\");\n System.out.println(\"║ 16/04/2021 ║\");\n System.out.println(\"╚══════════════════════════════╝\");\n }", "public static Message createInfoMessage(String msg, long timestamp,\n\t\t\tint line, String scriptName) {\n\t\treturn new Message(INFO_MSG, msg, timestamp, line, scriptName);\n\t}", "public final void mT62() throws RecognitionException {\n try {\n int _type = T62;\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:60:5: ( 'info' )\n // ../org.eclipselabs.mscript.language/src-gen/org/eclipselabs/mscript/language/parser/antlr/internal/InternalMscript.g:60:7: 'info'\n {\n match(\"info\"); \n\n\n }\n\n this.type = _type;\n }\n finally {\n }\n }", "public final void setInfo(Info info)\n {\n this.info = info;\n }", "public SystemInfo() {\r\n\t}", "public LVInfo() {\r\n }", "private void gotoInfo() {\n Intent launchInfo = new Intent(this, Info.class);\n startActivity(launchInfo);\n }", "public DeviceInfo() {}", "Information(String name, String number, String dayTime, String duration, String dir ) {\n\n mNumber = number;\n mName = name;\n mDayTime = dayTime;\n mDuration = duration;\n mDir = dir;\n }", "public ItemInfo () {}", "public String toString(){\n return \"info\";\n }", "public void setInfoId(java.lang.String infoId) {\n this.infoId = infoId;\n }", "public ClassInfo() {\n }", "public java.lang.String getInfoId() {\n return infoId;\n }", "public String getInfo() {\n return info;\n }", "public MessageInfo() { }", "public void getInfo(){\n System.out.println(\"Name: \" + name + \"\\n\" + \"Address: \" + address);\n }", "public String getInfo()\n {\n return info;\n }", "public Object getInfo() {\n return info;\n }", "public String getInfo() {\n return this.info;\n }", "@Override\n public String getInfo(){\n return info;\n }", "public Arborist(Information info, boolean verbose) {\n\t\tthis.info = info;\n\t\tthis.verbose = verbose;\n\t}", "public NewCommand(ApplicationData data) {\n super(\"NewCommand\");\n this.data = data;\n // configure log4j using resource URL APF-548\n DOMConfigurator.configure(getClass().getResource(\"/META-INF/log4j.xml\"));\n log = getLogger(NewCommand.class);\n\n }", "public static InfoScreen createEntity() {\n InfoScreen infoScreen = new InfoScreen()\n .screenUrl(DEFAULT_SCREEN_URL)\n .caption(DEFAULT_CAPTION)\n .createdDate(DEFAULT_CREATED_DATE)\n .modifiedDate(DEFAULT_MODIFIED_DATE)\n .lastModifiedBy(DEFAULT_LAST_MODIFIED_BY);\n return infoScreen;\n }", "@Override\n public void receiveInfo(String info) {\n sendInstruction(MessageId.RECEIVE_INFO,\n Serdes.STRING_SERDE.serialize(info));\n }", "public void info(String string) {\n\t\t\n\t}", "void info(String messageKey, Object... args);", "WrapInfo() {\n super(2);\n }", "public InfoDirective( final String title, final String description )\r\n {\r\n m_title = title;\r\n m_description = description;\r\n }", "@Override\r\n\tpublic ItemInfo createItemInfo() {\n\t\treturn new HpInfo();\r\n\t}", "public void info() {\r\n System.out.println(\" Name: \" + name + \" Facility: \" + facility + \" Floor: \" + floor + \" Covid: \"\r\n + positive + \" Age: \" + age + \" ID: \" + id);\r\n }", "public Builder setInfo(\n String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n\n info_ = value;\n onChanged();\n return this;\n }", "public ReturnInfo()\r\n\t{\r\n\t\tsuper();\r\n\t}", "void info(String message);", "@Override\n public ObjectNode info() {\n\n try {\n JsonpDeserializer<ObjectNode> deserializer = new JsonpDeserializerBase<>(EnumSet.allOf(JsonParser.Event.class)) {\n @Override\n public ObjectNode deserialize(JsonParser parser, JsonpMapper mapper, JsonParser.Event event) {\n return mapper.deserialize(parser, ObjectNode.class);\n }\n };\n\n Endpoint<InfoRequest, ObjectNode, ErrorResponse> infoEndpoint = new SimpleEndpoint<>(\n request -> \"GET\", // method\n request -> \"/\", // path\n request -> emptyMap(), // parameters\n SimpleEndpoint.emptyMap(), // headers\n false, // has request body?\n deserializer\n );\n\n return client._transport()\n .performRequest(InfoRequest._INSTANCE, infoEndpoint, null);\n\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }", "@Override\r\n public void info() {\n System.out.println(\"开始介绍\");\r\n }", "public ServiceInfo() {\n }", "public void info(){\r\n System.out.println(\"Title : \" + title);\r\n System.out.println(\"Author . \" + author);\r\n System.out.println(\"Location : \" + location);\r\n if (isAvailable){\r\n System.out.println(\"Available\");\r\n }\r\n else {\r\n System.out.println(\"Not available\");\r\n }\r\n\r\n }", "@Override\n\tpublic void info(String message, Object p0, Object p1, Object p2, Object p3, Object p4,\n\t\t\tObject p5, Object p6, Object p7, Object p8, Object p9) {\n\n\t}", "public void info(String message);", "public void info(String message);", "@Override\n protected MyInfoPresenter createPresenter() {\n return new MyInfoPresenter(MyInfoActivity.this);\n }", "public InfoOptions() {\n\t\tHelpOpt = new ArrayList<String>();\n\t\tDisplayOpt = new ArrayList<String>();\n\t\tNoteOpt = new ArrayList<String>();\n\t\tDelOpt = new ArrayList<String>();\n\t\tChangeNameOpt = new ArrayList<String>();\n\t\tsetDisplay();\n\t\tsetHelp();\n\t\tsetNote();\n\t\tsetDel();\n\t\tsetChangeName();\n\t}", "public com.google.protobuf.ByteString\n getInfoBytes() {\n Object ref = info_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (String) ref);\n info_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public ShelterInfo(ShelterInfo info) {\n this(info.getName(), info.getAddress(), info.getSpecialNotes(),\n info.getPhoneNumber(), info.getRestrictions());\n }", "public IdentityInfo() {\n }", "public void getInfo(lnrpc.Rpc.GetInfoRequest request,\n io.grpc.stub.StreamObserver<lnrpc.Rpc.GetInfoResponse> responseObserver) {\n asyncUnaryCall(\n getChannel().newCall(getGetInfoMethod(), getCallOptions()), request, responseObserver);\n }", "ServiceInfo(ServiceInfo info)\n {\n if (info != null)\n {\n this.type = info.type;\n this.name = info.name;\n this.port = info.port;\n this.weight = info.weight;\n this.priority = info.priority;\n this.text = info.text;\n }\n }", "UsageInfo(UsageInfo info) {\n this.pm = info.pm;\n this.mapped_vms = new HashSet<VirtualMachine>(info.mapped_vms);\n this.used_cpu = info.used_cpu;\n this.used_mem = info.used_mem;\n this.mapped_anti_coloc_job_ids = new HashSet<Integer>(info.mapped_anti_coloc_job_ids);\n }", "@Override\n\t\tpublic Info createFromParcel(Parcel source) {\n\t\t\treturn new Info(source);\n\t\t}", "@Override\n\tpublic void info(String message, Object p0, Object p1) {\n\n\t}", "public Command (int id, String name) {\n if (commands[id] != null) {\n\n } else {\n commands[id] = this;\n this.name = name;\n System.out.println(\"[Command Initialization] Command \" + name + \" successfully initialized with id \"\n + id + \" and allowable arguments:\" /*allowable args will be printed here.*/);\n }\n }", "@Override\n public String getInfo() {\n return this.info;\n }", "public void startInfo() {\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"Enter your name:\");\n\t\tString name = this.getInputString();\n\t\tSystem.out.println(\"Enter your mobile number:\");\n\t\tint number = this.getInputInteger();\n\t\tSystem.out.println(\"Enter your email:\");\n\t\tString email = this.getInputString();\n\t}", "Nodo(T info, Nodo sig) {\n this.info = info;\n this.sig = sig;\n }", "public BuddyInfo() {\n this(\"\", \"\", \"123-456-7890\");\n }", "private Widget getInfo() {\n FocusPanel infoPanel = new FocusPanel();\n infoPanel.setStyleName(\"elv-Molecules-InfoPanel\");\n HorizontalPanel content = new HorizontalPanel();\n try{\n Image img = new Image(ReactomeImages.INSTANCE.information());\n String helpTitle = \"Info\";\n HTMLPanel helpContent = new HTMLPanel(\n \"The molecules tab shows you all the molecules of a complete pathway diagram.\\n\" +\n \"Molecules are grouped in Chemical Compounds, Proteins, Sequences and Others.\\n\" +\n \"The molecules of a selected object appear highlighted in the molecules lists;\\n\" +\n \"a molecule selected in the list will be highlighted in the diagram.\\n\" +\n \"For each molecule you can see a symbol, a link to the main reference DB, a name and the number of\\n\" +\n \"occurrences in the pathway. Clicking on the symbol several times will allow you to circle through\\n\" +\n \"all its occurrences in the diagram.\\n\" +\n \"Expanding by clicking on the '+' will provide you with further external links.\\n\" +\n \"Lists can be downloaded. Just click on the button in the top right\\n\" +\n \"corner, select the fields and types you are interested in and click 'Start Download'.\");\n\n content.add(img);\n popup = new HelpPopup(helpTitle, helpContent);\n infoPanel.addMouseOverHandler(this);\n infoPanel.addMouseOutHandler(this);\n infoPanel.getElement().getStyle().setProperty(\"cursor\", \"help\");\n }catch (Exception e){\n// e.printStackTrace();\n Console.error(getClass() + \": \" + e.getMessage());\n //ToDo: Enough?\n }\n HTMLPanel title = new HTMLPanel(\"Info\");\n title.getElement().getStyle().setMarginLeft(10, Style.Unit.PX);\n content.add(title);\n\n infoPanel.add(content.asWidget());\n\n return infoPanel;\n }", "void info(String tag, String msg);", "public void setInfoText(String infoText);", "public static void shoInfo() {\n\t\tSystem.out.println(description);\n\t \n\t}", "public com.google.protobuf.ByteString\n getInfoBytes() {\n Object ref = info_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b =\n com.google.protobuf.ByteString.copyFromUtf8(\n (String) ref);\n info_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public CommandMAN() {\n super();\n }", "@Override\n\tpublic void info(String message, Object p0, Object p1, Object p2) {\n\n\t}", "@Override\n\tpublic void info(Object message) {\n\n\t}", "public lnrpc.Rpc.GetInfoResponse getInfo(lnrpc.Rpc.GetInfoRequest request) {\n return blockingUnaryCall(\n getChannel(), getGetInfoMethod(), getCallOptions(), request);\n }", "public abstract void displayInfo();", "public void setInfo (int n)\n\t\t{\n\t\t\tinfo = n ;\n\t\t}", "private SystemInfo() {\n }", "private Command() {\n initFields();\n }", "public String getInfoString();", "private static void addInfo(String info){\n\tif (started) {\n\t try{\n\t\tif (verbose) {\n\t\t System.out.println(info);\n\t\t System.out.println(newLine);\n\t\t}\n\t\tfStream.writeBytes(info);\n\t\tfStream.writeBytes(newLine);\n\t }catch(IOException e){\n\t }\n\t}\n }", "String getInfo();", "public NoticeInfo(Name alias) {\n this(alias, NOTICE_INFO);\n }", "public NoticeInfo(String alias) {\n this(DSL.name(alias), NOTICE_INFO);\n }" ]
[ "0.85030675", "0.8149069", "0.7056777", "0.6770325", "0.6732298", "0.6589024", "0.65332764", "0.65196186", "0.64348626", "0.6362519", "0.62794566", "0.6260401", "0.6227391", "0.6205466", "0.6142277", "0.60754186", "0.6058675", "0.59511095", "0.5950633", "0.59145963", "0.59061843", "0.5900435", "0.58848935", "0.5879248", "0.5867517", "0.5856224", "0.58184767", "0.57881296", "0.5741871", "0.5711198", "0.57055867", "0.5694566", "0.567767", "0.56762296", "0.5670485", "0.56673115", "0.5642808", "0.56326467", "0.5632204", "0.5625458", "0.5606318", "0.56054723", "0.55942297", "0.5586846", "0.558084", "0.55795026", "0.55773705", "0.5563153", "0.55591094", "0.5554138", "0.5545493", "0.55443525", "0.55435824", "0.55337346", "0.5523467", "0.55172896", "0.5516276", "0.5502726", "0.54999936", "0.54878944", "0.54825705", "0.5477073", "0.54575175", "0.54425657", "0.54380304", "0.54365367", "0.54365367", "0.5419901", "0.54194105", "0.54186267", "0.541735", "0.541662", "0.5414069", "0.54138625", "0.54111063", "0.5406247", "0.54047084", "0.54046607", "0.54041886", "0.5390737", "0.5385787", "0.5383485", "0.53814286", "0.53809434", "0.53791755", "0.53716475", "0.5371114", "0.53709614", "0.53668356", "0.5366463", "0.5365005", "0.53611827", "0.5345326", "0.5342277", "0.5341236", "0.53314614", "0.53285825", "0.53202087", "0.53089154", "0.5305349" ]
0.81815666
1
Parses the metadata flac.
void parseMetadataFlac(String pathToAudioFile) { AudioFile f = null; try { f = AudioFileIO.read(new File(pathToAudioFile)); } catch (CannotReadException e) { System.err.println("ParseMedataFlac CannotReadException"+e); setExecutionType("Exception"); } catch (IOException e) { System.err.println("ParseMedataFlac IOException"+e); setExecutionType("Exception"); } catch (TagException e) { System.err.println("ParseMedataFlac TagException"+e); setExecutionType("Exception"); } catch (ReadOnlyFileException e) { System.err.println("ParseMedataFlac ReadOnlyException"+e); setExecutionType("Exception"); } catch (InvalidAudioFrameException e) { System.err.println("ParseMedataFlac InvalidAudioFrameException"+e); setExecutionType("Exception"); } Tag tag = f.getTag(); try{ this.setTitle(tag.getFirst(FieldKey.TITLE)); this.setAlbum(tag.getFirst(FieldKey.ALBUM)); this.setArtist(tag.getFirst(FieldKey.ARTIST)); this.setComposer(tag.getFirst(FieldKey.COMPOSER)); this.setGenre(tag.getFirst(FieldKey.GENRE)); this.setPath(pathToAudioFile); setExecutionType("ok"); } catch(UnsupportedOperationException e){ System.err.println("ParseMedataFlac UnsupportedOperationException"+e); setExecutionType("Exception"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void initMetadata() throws IOException {\n \n // start by reading the file header\n in.seek(0);\n byte[] toRead = new byte[4];\n in.read(toRead);\n long order = batoi(toRead); // byte ordering\n little = toRead[2] != 0xff || toRead[3] != 0xff;\n metadata.put(\"Byte Order\", new Boolean(little));\n \n in.skipBytes(4);\n in.read(toRead);\n long version = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Version\", new Long(version));\n \n byte[] er = new byte[2];\n in.read(er);\n short count = DataTools.bytesToShort(er, little);\n metadata.put(\"Count\", new Short(count));\n \n in.skipBytes(2);\n \n in.read(toRead);\n long offset = DataTools.bytesToLong(toRead, little);\n \n // skip to first tag\n in.seek(offset);\n \n // read in each tag and its data\n \n for (int i=0; i<count; i++) {\n in.read(er);\n short tag = DataTools.bytesToShort(er, little);\n in.skipBytes(2);\n \n in.read(toRead);\n offset = DataTools.bytesToLong(toRead, little);\n \n in.read(toRead);\n long fmt = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Format\", new Long(fmt));\n \n in.read(toRead);\n long numBytes = DataTools.bytesToLong(toRead, little);\n metadata.put(\"NumBytes\", new Long(numBytes));\n \n if (tag == 67 || tag == 68) {\n byte[] b = new byte[1];\n in.read(b);\n boolean isOpenlab2;\n if (b[0] == '0') isOpenlab2 = false;\n else isOpenlab2 = true;\n metadata.put(\"isOpenlab2\", new Boolean(isOpenlab2));\n \n in.skipBytes(2);\n in.read(er);\n short layerId = DataTools.bytesToShort(er, little);\n metadata.put(\"LayerID\", new Short(layerId));\n \n in.read(er);\n short layerType = DataTools.bytesToShort(er, little);\n metadata.put(\"LayerType\", new Short(layerType));\n \n in.read(er);\n short bitDepth = DataTools.bytesToShort(er, little);\n metadata.put(\"BitDepth\", new Short(bitDepth));\n \n in.read(er);\n short opacity = DataTools.bytesToShort(er, little);\n metadata.put(\"Opacity\", new Short(opacity));\n \n // not sure how many bytes to skip here\n in.skipBytes(10);\n \n in.read(toRead);\n long type = DataTools.bytesToLong(toRead, little);\n metadata.put(\"ImageType\", new Long(type));\n \n // not sure how many bytes to skip\n in.skipBytes(10);\n \n in.read(toRead);\n long timestamp = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Timestamp\", new Long(timestamp));\n \n in.skipBytes(2);\n \n if (isOpenlab2 == true) {\n byte[] layerName = new byte[127];\n in.read(layerName);\n metadata.put(\"LayerName\", new String(layerName));\n \n in.read(toRead);\n long timestampMS = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Timestamp-MS\", new Long(timestampMS));\n \n in.skipBytes(1);\n byte[] notes = new byte[118];\n in.read(notes);\n metadata.put(\"Notes\", new String(notes));\n }\n else in.skipBytes(123);\n }\n else if (tag == 69) {\n in.read(toRead);\n long platform = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Platform\", new Long(platform));\n \n in.read(er);\n short units = DataTools.bytesToShort(er, little);\n metadata.put(\"Units\", new Short(units));\n \n in.read(er);\n short imageId = DataTools.bytesToShort(er, little);\n metadata.put(\"ID\", new Short(imageId));\n in.skipBytes(1);\n \n byte[] toRead2 = new byte[8];\n double xOrigin = DataTools.readDouble(in, little);\n metadata.put(\"XOrigin\", new Double(xOrigin));\n double yOrigin = DataTools.readDouble(in, little);\n metadata.put(\"YOrigin\", new Double(yOrigin));\n double xScale = DataTools.readDouble(in, little);\n metadata.put(\"XScale\", new Double(xScale));\n double yScale = DataTools.readDouble(in, little);\n metadata.put(\"YScale\", new Double(yScale));\n in.skipBytes(1);\n \n byte[] other = new byte[31];\n in.read(other);\n metadata.put(\"Other\", new String(other));\n }\n \n // Initialize OME metadata\n \n if (ome != null) {\n OMETools.setBigEndian(ome, !little);\n if (metadata.get(\"BitDepth\") != null) {\n int bitDepth = ((Integer) metadata.get(\"BitDepth\")).intValue();\n String type;\n \n if (bitDepth <= 8) type = \"int8\";\n else if (bitDepth <= 16) type = \"int16\";\n else type = \"int32\";\n \n OMETools.setPixelType(ome, type);\n }\n if (metadata.get(\"Timestamp\") != null) {\n OMETools.setCreationDate(ome, (String) metadata.get(\"Timestamp\"));\n }\n \n if (metadata.get(\"XOrigin\") != null) {\n Double xOrigin = (Double) metadata.get(\"XOrigin\");\n OMETools.setStageX(ome, xOrigin.floatValue());\n }\n \n if (metadata.get(\"YOrigin\") != null) {\n Double yOrigin = (Double) metadata.get(\"YOrigin\");\n OMETools.setStageY(ome, yOrigin.floatValue());\n }\n \n if (metadata.get(\"XScale\") != null) {\n Double xScale = (Double) metadata.get(\"XScale\");\n OMETools.setPixelSizeX(ome, xScale.floatValue());\n }\n \n if (metadata.get(\"YScale\") != null) {\n Double yScale = (Double) metadata.get(\"YScale\");\n OMETools.setPixelSizeY(ome, yScale.floatValue());\n }\n }\n in.seek(offset);\n }\n }", "private static MetaData parseMultipleFormat(File f) throws IOException {\n\t if(LimeXMLUtils.isASFFile(f)) {\n\t ASFParser p = new ASFParser(f);\n\t if(p.hasVideo())\n\t return new WMVMetaData(p);\n\t else if(p.hasAudio())\n\t return new WMAMetaData(p);\n }\n \n return null;\n }", "public static ToscaMetadata parseToscaMetadataFile(InputStream st) throws IOException {\n if(st == null) {\n throw new IOException(Messages.METADATA_PARSER_INTERNAL.getErrorMessage());\n }\n OnboardingToscaMetadata meta = new OnboardingToscaMetadata();\n List<String> metadataLines = IOUtils.readLines(st, \"utf-8\");\n for (String line : metadataLines) {\n line = line.trim();\n if (line.isEmpty()) {\n return meta;\n }\n String[] entry = line.split(SEPARATOR_MF_ATTRIBUTE);\n //No empty keys allowed, no empty values allowed\n if (entry.length < 2 || entry[0].isEmpty()) {\n meta.errors.add(new ErrorMessage(ErrorLevel.ERROR, getErrorWithParameters(\n Messages.METADATA_INVALID_ENTRY_DEFINITIONS.getErrorMessage(), line)));\n //want to get all error lines in meta file block_0, no breaking loop\n } else {\n meta.metaEntries.put(entry[0].trim(), entry[1].trim());\n }\n }\n\n if (!meta.metaEntries.containsKey(TOSCA_META_ENTRY_DEFINITIONS)) {\n meta.errors.add(new ErrorMessage(ErrorLevel.ERROR, getErrorWithParameters(\n Messages.METADATA_NO_ENTRY_DEFINITIONS.getErrorMessage())));\n }\n return meta;\n }", "@Override\n \t\tprotected void typedParse(final io.scif.io.RandomAccessInputStream stream,\n \t\t\tfinal Metadata meta, final SCIFIOConfig config) throws IOException,\n \t\t\tio.scif.FormatException\n \t\t{\n \t\t\t// normalize file name\n \t\t\tfinal String id = stream.getFileName();\n \n \t\t\tfinal String dir = new File(id).getParent();\n \n \t\t\t// parse and populate OME-XML metadata\n \t\t\tString fileName =\n \t\t\t\tnew Location(getContext(), id).getAbsoluteFile().getAbsolutePath();\n \t\t\tif (!new File(fileName).exists()) {\n \t\t\t\tfileName = stream.getFileName();\n \t\t\t}\n \t\t\tfinal RandomAccessInputStream ras =\n \t\t\t\tnew RandomAccessInputStream(getContext(), fileName);\n \t\t\tString xml;\n \t\t\tIFD firstIFD;\n \t\t\ttry {\n \t\t\t\tfinal TiffParser tp = new TiffParser(getContext(), ras);\n \t\t\t\tfirstIFD = tp.getFirstIFD();\n \t\t\t\txml = firstIFD.getComment();\n \t\t\t}\n \t\t\tfinally {\n \t\t\t\tras.close();\n \t\t\t}\n \n \t\t\tmeta.setFirstIFD(firstIFD);\n \n \t\t\tif (service == null) setupServices(getContext());\n \t\t\tOMEXMLMetadata omexmlMeta;\n \t\t\ttry {\n \t\t\t\tomexmlMeta = service.createOMEXMLMetadata(xml);\n \t\t\t}\n \t\t\tcatch (final ServiceException se) {\n \t\t\t\tthrow new FormatException(se);\n \t\t\t}\n \n \t\t\tmeta.setHasSPW(omexmlMeta.getPlateCount() > 0);\n \n \t\t\tfor (int i = 0; i < meta.getImageCount(); i++) {\n \t\t\t\tfinal int sizeC = omexmlMeta.getPixelsSizeC(i).getValue().intValue();\n \t\t\t\tservice.removeChannels(omexmlMeta, i, sizeC);\n \t\t\t}\n \n \t\t\tfinal Hashtable<String, Object> originalMetadata =\n \t\t\t\tservice.getOriginalMetadata(omexmlMeta);\n \t\t\tif (originalMetadata != null) meta.getTable().putAll(originalMetadata);\n \n \t\t\tlog().trace(xml);\n \n \t\t\tif (omexmlMeta.getRoot() == null) {\n \t\t\t\tthrow new FormatException(\"Could not parse OME-XML from TIFF comment\");\n \t\t\t}\n \n \t\t\tmeta.setOmeMeta(new OMEMetadata(getContext(), omexmlMeta));\n \n \t\t\tfinal String[] acquiredDates = new String[meta.getImageCount()];\n \t\t\tfor (int i = 0; i < acquiredDates.length; i++) {\n \t\t\t\tfinal Timestamp acquisitionDate = omexmlMeta.getImageAcquisitionDate(i);\n \t\t\t\tif (acquisitionDate != null) {\n \t\t\t\t\tacquiredDates[i] = acquisitionDate.getValue();\n \t\t\t\t}\n \t\t\t}\n \n \t\t\tfinal String currentUUID = omexmlMeta.getUUID();\n \n \t\t\t// determine series count from Image and Pixels elements\n \t\t\tfinal int imageCount = omexmlMeta.getImageCount();\n \t\t\tmeta.createImageMetadata(imageCount);\n \n \t\t\tOMETIFFPlane[][] info = new OMETIFFPlane[imageCount][];\n \t\t\tmeta.setPlaneInfo(info);\n \n \t\t\tfinal int[] tileWidth = new int[imageCount];\n \t\t\tfinal int[] tileHeight = new int[imageCount];\n \n \t\t\tmeta.setTileWidth(tileWidth);\n \t\t\tmeta.setTileHeight(tileHeight);\n \n \t\t\t// compile list of file/UUID mappings\n \t\t\tfinal Hashtable<String, String> files = new Hashtable<String, String>();\n \t\t\tboolean needSearch = false;\n \t\t\tfor (int i = 0; i < imageCount; i++) {\n \t\t\t\tfinal int tiffDataCount = omexmlMeta.getTiffDataCount(i);\n \t\t\t\tfor (int td = 0; td < tiffDataCount; td++) {\n \t\t\t\t\tString uuid = null;\n \t\t\t\t\ttry {\n \t\t\t\t\t\tuuid = omexmlMeta.getUUIDValue(i, td);\n \t\t\t\t\t}\n \t\t\t\t\tcatch (final NullPointerException e) {}\n \t\t\t\t\tString filename = null;\n \t\t\t\t\tif (uuid == null) {\n \t\t\t\t\t\t// no UUID means that TiffData element refers to this file\n \t\t\t\t\t\tuuid = \"\";\n \t\t\t\t\t\tfilename = id;\n \t\t\t\t\t}\n \t\t\t\t\telse {\n \t\t\t\t\t\tfilename = omexmlMeta.getUUIDFileName(i, td);\n \t\t\t\t\t\tif (!new Location(getContext(), dir, filename).exists()) filename =\n \t\t\t\t\t\t\tnull;\n \t\t\t\t\t\tif (filename == null) {\n \t\t\t\t\t\t\tif (uuid.equals(currentUUID) || currentUUID == null) {\n \t\t\t\t\t\t\t\t// UUID references this file\n \t\t\t\t\t\t\t\tfilename = id;\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\telse {\n \t\t\t\t\t\t\t\t// will need to search for this UUID\n \t\t\t\t\t\t\t\tfilename = \"\";\n \t\t\t\t\t\t\t\tneedSearch = true;\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t\telse filename = normalizeFilename(dir, filename);\n \t\t\t\t\t}\n \t\t\t\t\tfinal String existing = files.get(uuid);\n \t\t\t\t\tif (existing == null) files.put(uuid, filename);\n \t\t\t\t\telse if (!existing.equals(filename)) {\n \t\t\t\t\t\tthrow new FormatException(\"Inconsistent UUID filenames\");\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \n \t\t\t// search for missing filenames\n \t\t\tif (needSearch) {\n \t\t\t\tfinal Enumeration<String> en = files.keys();\n \t\t\t\twhile (en.hasMoreElements()) {\n \t\t\t\t\tfinal String uuid = en.nextElement();\n \t\t\t\t\tfinal String filename = files.get(uuid);\n \t\t\t\t\tif (filename.equals(\"\")) {\n \t\t\t\t\t\t// TODO search...\n \t\t\t\t\t\t// should scan only other .ome.tif files\n \t\t\t\t\t\t// to make this work with OME server may be a little tricky?\n \t\t\t\t\t\tthrow new FormatException(\"Unmatched UUID: \" + uuid);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \n \t\t\t// build list of used files\n \t\t\tfinal Enumeration<String> en = files.keys();\n \t\t\tfinal int numUUIDs = files.size();\n \t\t\tfinal HashSet<String> fileSet = new HashSet<String>(); // ensure no\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// duplicate\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// filenames\n \t\t\tfor (int i = 0; i < numUUIDs; i++) {\n \t\t\t\tfinal String uuid = en.nextElement();\n \t\t\t\tfinal String filename = files.get(uuid);\n \t\t\t\tfileSet.add(filename);\n \t\t\t}\n \t\t\tfinal String[] used = new String[fileSet.size()];\n \t\t\tmeta.setUsed(used);\n \n \t\t\tfinal Iterator<String> iter = fileSet.iterator();\n \t\t\tfor (int i = 0; i < used.length; i++)\n \t\t\t\tused[i] = iter.next();\n \n \t\t\t// process TiffData elements\n \t\t\tfinal Hashtable<String, MinimalTIFFFormat.Reader<?>> readers =\n \t\t\t\tnew Hashtable<String, MinimalTIFFFormat.Reader<?>>();\n \t\t\tfinal List<Boolean> adjustedSamples = new ArrayList<Boolean>();\n \t\t\tfinal List<Integer> samples = new ArrayList<Integer>();\n \t\t\tmeta.adjustedSamples = adjustedSamples;\n \t\t\tmeta.samples = samples;\n \n \t\t\tfor (int i = 0; i < imageCount; i++) {\n \t\t\t\tfinal int s = i;\n \t\t\t\tlog().debug(\"Image[\" + i + \"] {\");\n \t\t\t\tlog().debug(\" id = \" + omexmlMeta.getImageID(i));\n \n \t\t\t\tadjustedSamples.add(false);\n \n \t\t\t\tfinal String order = omexmlMeta.getPixelsDimensionOrder(i).toString();\n \n \t\t\t\tPositiveInteger samplesPerPixel = null;\n \t\t\t\tif (omexmlMeta.getChannelCount(i) > 0) {\n \t\t\t\t\tsamplesPerPixel = omexmlMeta.getChannelSamplesPerPixel(i, 0);\n \t\t\t\t}\n \t\t\t\tsamples.add(i, samplesPerPixel == null ? -1 : samplesPerPixel\n \t\t\t\t\t.getValue());\n \t\t\t\tfinal int tiffSamples = firstIFD.getSamplesPerPixel();\n \n \t\t\t\tif (adjustedSamples.get(i) ||\n \t\t\t\t\t(samples.get(i) != tiffSamples && (i == 0 || samples.get(i) < 0)))\n \t\t\t\t{\n \t\t\t\t\tlog().warn(\n \t\t\t\t\t\t\"SamplesPerPixel mismatch: OME=\" + samples.get(i) + \", TIFF=\" +\n \t\t\t\t\t\t\ttiffSamples);\n \t\t\t\t\tsamples.set(i, tiffSamples);\n \t\t\t\t\tadjustedSamples.set(i, true);\n \t\t\t\t}\n \t\t\t\telse {\n \t\t\t\t\tadjustedSamples.set(i, false);\n \t\t\t\t}\n \n \t\t\t\tif (adjustedSamples.get(i) && omexmlMeta.getChannelCount(i) <= 1) {\n \t\t\t\t\tadjustedSamples.set(i, false);\n \t\t\t\t}\n \n \t\t\t\tint effSizeC = omexmlMeta.getPixelsSizeC(i).getValue().intValue();\n \t\t\t\tif (!adjustedSamples.get(i)) {\n \t\t\t\t\teffSizeC /= samples.get(i);\n \t\t\t\t}\n \t\t\t\tif (effSizeC == 0) effSizeC = 1;\n \t\t\t\tif (effSizeC * samples.get(i) != omexmlMeta.getPixelsSizeC(i)\n \t\t\t\t\t.getValue().intValue())\n \t\t\t\t{\n \t\t\t\t\teffSizeC = omexmlMeta.getPixelsSizeC(i).getValue().intValue();\n \t\t\t\t}\n \t\t\t\tfinal int sizeT = omexmlMeta.getPixelsSizeT(i).getValue().intValue();\n \t\t\t\tfinal int sizeZ = omexmlMeta.getPixelsSizeZ(i).getValue().intValue();\n \t\t\t\tint num = effSizeC * sizeT * sizeZ;\n \n \t\t\t\tOMETIFFPlane[] planes = new OMETIFFPlane[num];\n \t\t\t\tfor (int no = 0; no < num; no++)\n \t\t\t\t\tplanes[no] = new OMETIFFPlane();\n \n \t\t\t\tfinal int tiffDataCount = omexmlMeta.getTiffDataCount(i);\n \t\t\t\tBoolean zOneIndexed = null;\n \t\t\t\tBoolean cOneIndexed = null;\n \t\t\t\tBoolean tOneIndexed = null;\n \n \t\t\t\t// pre-scan TiffData indices to see if any of them are indexed from 1\n \n \t\t\t\tfor (int td = 0; td < tiffDataCount; td++) {\n \t\t\t\t\tfinal NonNegativeInteger firstC = omexmlMeta.getTiffDataFirstC(i, td);\n \t\t\t\t\tfinal NonNegativeInteger firstT = omexmlMeta.getTiffDataFirstT(i, td);\n \t\t\t\t\tfinal NonNegativeInteger firstZ = omexmlMeta.getTiffDataFirstZ(i, td);\n \t\t\t\t\tfinal int c = firstC == null ? 0 : firstC.getValue();\n \t\t\t\t\tfinal int t = firstT == null ? 0 : firstT.getValue();\n \t\t\t\t\tfinal int z = firstZ == null ? 0 : firstZ.getValue();\n \n \t\t\t\t\tif (c >= effSizeC && cOneIndexed == null) {\n \t\t\t\t\t\tcOneIndexed = true;\n \t\t\t\t\t}\n \t\t\t\t\telse if (c == 0) {\n \t\t\t\t\t\tcOneIndexed = false;\n \t\t\t\t\t}\n \t\t\t\t\tif (z >= sizeZ && zOneIndexed == null) {\n \t\t\t\t\t\tzOneIndexed = true;\n \t\t\t\t\t}\n \t\t\t\t\telse if (z == 0) {\n \t\t\t\t\t\tzOneIndexed = false;\n \t\t\t\t\t}\n \t\t\t\t\tif (t >= sizeT && tOneIndexed == null) {\n \t\t\t\t\t\ttOneIndexed = true;\n \t\t\t\t\t}\n \t\t\t\t\telse if (t == 0) {\n \t\t\t\t\t\ttOneIndexed = false;\n \t\t\t\t\t}\n \t\t\t\t}\n \n \t\t\t\tfor (int td = 0; td < tiffDataCount; td++) {\n \t\t\t\t\tlog().debug(\" TiffData[\" + td + \"] {\");\n \t\t\t\t\t// extract TiffData parameters\n \t\t\t\t\tString filename = null;\n \t\t\t\t\tString uuid = null;\n \t\t\t\t\ttry {\n \t\t\t\t\t\tfilename = omexmlMeta.getUUIDFileName(i, td);\n \t\t\t\t\t}\n \t\t\t\t\tcatch (final NullPointerException e) {\n \t\t\t\t\t\tlog().debug(\"Ignoring null UUID object when retrieving filename.\");\n \t\t\t\t\t}\n \t\t\t\t\ttry {\n \t\t\t\t\t\tuuid = omexmlMeta.getUUIDValue(i, td);\n \t\t\t\t\t}\n \t\t\t\t\tcatch (final NullPointerException e) {\n \t\t\t\t\t\tlog().debug(\"Ignoring null UUID object when retrieving value.\");\n \t\t\t\t\t}\n \t\t\t\t\tfinal NonNegativeInteger tdIFD = omexmlMeta.getTiffDataIFD(i, td);\n \t\t\t\t\tfinal int ifd = tdIFD == null ? 0 : tdIFD.getValue();\n \t\t\t\t\tfinal NonNegativeInteger numPlanes =\n \t\t\t\t\t\tomexmlMeta.getTiffDataPlaneCount(i, td);\n \t\t\t\t\tfinal NonNegativeInteger firstC = omexmlMeta.getTiffDataFirstC(i, td);\n \t\t\t\t\tfinal NonNegativeInteger firstT = omexmlMeta.getTiffDataFirstT(i, td);\n \t\t\t\t\tfinal NonNegativeInteger firstZ = omexmlMeta.getTiffDataFirstZ(i, td);\n \t\t\t\t\tint c = firstC == null ? 0 : firstC.getValue();\n \t\t\t\t\tint t = firstT == null ? 0 : firstT.getValue();\n \t\t\t\t\tint z = firstZ == null ? 0 : firstZ.getValue();\n \n \t\t\t\t\t// NB: some writers index FirstC, FirstZ and FirstT from 1\n \t\t\t\t\tif (cOneIndexed != null && cOneIndexed) c--;\n \t\t\t\t\tif (zOneIndexed != null && zOneIndexed) z--;\n \t\t\t\t\tif (tOneIndexed != null && tOneIndexed) t--;\n \n \t\t\t\t\tif (z >= sizeZ || c >= effSizeC || t >= sizeT) {\n \t\t\t\t\t\tlog().warn(\n \t\t\t\t\t\t\t\"Found invalid TiffData: Z=\" + z + \", C=\" + c + \", T=\" + t);\n \t\t\t\t\t\tbreak;\n \t\t\t\t\t}\n \n \t\t\t\t\tfinal long[] pos = metaService.zctToArray(order, z, c, t);\n \t\t\t\t\tfinal long[] lengths =\n \t\t\t\t\t\tmetaService.zctToArray(order, sizeZ, effSizeC, sizeT);\n \t\t\t\t\tfinal long index = FormatTools.positionToRaster(lengths, pos);\n \t\t\t\t\tfinal int count = numPlanes == null ? 1 : numPlanes.getValue();\n \t\t\t\t\tif (count == 0) {\n \t\t\t\t\t\tmeta.get(s);\n \t\t\t\t\t\tbreak;\n \t\t\t\t\t}\n \n \t\t\t\t\t// get reader object for this filename\n \t\t\t\t\tif (filename == null) {\n \t\t\t\t\t\tif (uuid == null) filename = id;\n \t\t\t\t\t\telse filename = files.get(uuid);\n \t\t\t\t\t}\n \t\t\t\t\telse filename = normalizeFilename(dir, filename);\n \t\t\t\t\tMinimalTIFFFormat.Reader<?> r = readers.get(filename);\n \t\t\t\t\tif (r == null) {\n \t\t\t\t\t\tr =\n \t\t\t\t\t\t\t(io.scif.formats.MinimalTIFFFormat.Reader<?>) formatService\n \t\t\t\t\t\t\t\t.getFormatFromClass(MinimalTIFFFormat.class).createReader();\n \t\t\t\t\t\treaders.put(filename, r);\n \t\t\t\t\t}\n \n \t\t\t\t\tfinal Location file = new Location(getContext(), filename);\n \t\t\t\t\tif (!file.exists()) {\n \t\t\t\t\t\t// if this is an absolute file name, try using a relative name\n \t\t\t\t\t\t// old versions of OMETiffWriter wrote an absolute path to\n \t\t\t\t\t\t// UUID.FileName, which causes problems if the file is moved to\n \t\t\t\t\t\t// a different directory\n \t\t\t\t\t\tfilename =\n \t\t\t\t\t\t\tfilename.substring(filename.lastIndexOf(File.separator) + 1);\n \t\t\t\t\t\tfilename = dir + File.separator + filename;\n \n \t\t\t\t\t\tif (!new Location(getContext(), filename).exists()) {\n \t\t\t\t\t\t\tfilename = stream.getFileName();\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \n \t\t\t\t\t// populate plane index -> IFD mapping\n \t\t\t\t\tfor (int q = 0; q < count; q++) {\n \t\t\t\t\t\tfinal int no = (int) (index + q);\n \t\t\t\t\t\tplanes[no].reader = r;\n \t\t\t\t\t\tplanes[no].id = filename;\n \t\t\t\t\t\tplanes[no].ifd = ifd + q;\n \t\t\t\t\t\tplanes[no].certain = true;\n \t\t\t\t\t\tlog().debug(\n \t\t\t\t\t\t\t\" Plane[\" + no + \"]: file=\" + planes[no].id + \", IFD=\" +\n \t\t\t\t\t\t\t\tplanes[no].ifd);\n \t\t\t\t\t}\n \t\t\t\t\tif (numPlanes == null) {\n \t\t\t\t\t\t// unknown number of planes; fill down\n \t\t\t\t\t\tfor (int no = (int) (index + 1); no < num; no++) {\n \t\t\t\t\t\t\tif (planes[no].certain) break;\n \t\t\t\t\t\t\tplanes[no].reader = r;\n \t\t\t\t\t\t\tplanes[no].id = filename;\n \t\t\t\t\t\t\tplanes[no].ifd = planes[no - 1].ifd + 1;\n \t\t\t\t\t\t\tlog().debug(\" Plane[\" + no + \"]: FILLED\");\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t\telse {\n \t\t\t\t\t\t// known number of planes; clear anything subsequently filled\n \t\t\t\t\t\tfor (int no = (int) (index + count); no < num; no++) {\n \t\t\t\t\t\t\tif (planes[no].certain) break;\n \t\t\t\t\t\t\tplanes[no].reader = null;\n \t\t\t\t\t\t\tplanes[no].id = null;\n \t\t\t\t\t\t\tplanes[no].ifd = -1;\n \t\t\t\t\t\t\tlog().debug(\" Plane[\" + no + \"]: CLEARED\");\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t\tlog().debug(\" }\");\n \t\t\t\t}\n \n \t\t\t\tif (meta.get(s) == null) continue;\n \n \t\t\t\t// verify that all planes are available\n \t\t\t\tlog().debug(\" --------------------------------\");\n \t\t\t\tfor (int no = 0; no < num; no++) {\n \t\t\t\t\tlog().debug(\n \t\t\t\t\t\t\" Plane[\" + no + \"]: file=\" + planes[no].id + \", IFD=\" +\n \t\t\t\t\t\t\tplanes[no].ifd);\n \t\t\t\t\tif (planes[no].reader == null) {\n \t\t\t\t\t\tlog().warn(\n \t\t\t\t\t\t\t\"Image ID '\" + omexmlMeta.getImageID(i) + \"': missing plane #\" +\n \t\t\t\t\t\t\t\tno + \". \" +\n \t\t\t\t\t\t\t\t\"Using TiffReader to determine the number of planes.\");\n \t\t\t\t\t\tfinal TIFFFormat.Reader<?> r =\n \t\t\t\t\t\t\t(io.scif.formats.TIFFFormat.Reader<?>) formatService\n \t\t\t\t\t\t\t\t.getFormatFromClass(TIFFFormat.class).createReader();\n \t\t\t\t\t\tr.setSource(stream.getFileName());\n \t\t\t\t\t\ttry {\n \t\t\t\t\t\t\tplanes = new OMETIFFPlane[r.getImageCount()];\n \t\t\t\t\t\t\tfor (int plane = 0; plane < planes.length; plane++) {\n \t\t\t\t\t\t\t\tplanes[plane] = new OMETIFFPlane();\n \t\t\t\t\t\t\t\tplanes[plane].id = stream.getFileName();\n \t\t\t\t\t\t\t\tplanes[plane].reader = r;\n \t\t\t\t\t\t\t\tplanes[plane].ifd = plane;\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\tnum = planes.length;\n \t\t\t\t\t\t}\n \t\t\t\t\t\tfinally {\n \t\t\t\t\t\t\tr.close();\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\tinfo[i] = planes;\n \t\t\t\tlog().debug(\" }\");\n \n \t\t\t}\n \n \t\t\t// remove null CoreMetadata entries\n \n \t\t\tfinal Vector<OMETIFFPlane[]> planeInfo = new Vector<OMETIFFPlane[]>();\n \t\t\tfor (int i = meta.getImageCount() - 1; i >= 0; i--) {\n \t\t\t\tif (meta.get(i) == null) {\n \t\t\t\t\tmeta.getAll().remove(i);\n \t\t\t\t\tadjustedSamples.remove(i);\n \t\t\t\t\tsamples.remove(i);\n \t\t\t\t}\n \t\t\t\telse {\n \t\t\t\t\tplaneInfo.add(0, info[i]);\n \t\t\t\t}\n \t\t\t}\n \t\t\tinfo = planeInfo.toArray(new OMETIFFPlane[0][0]);\n \n // meta.getOmeMeta().populateImageMetadata();\n \t\t}", "@Override\n public RecordType parseMetadata() {\n \n this.stationIndex = StationLookup.lookup(getStationId(this.filename));\n \n try {\n reader.mark(READ_AHEAD_LIMIT);\n String line = null;\n boolean headerRead = false;\n List<Variable> vars = null;\n while (null != (line = reader.readLine())) {\n Matcher matcher = headerLinePattern.matcher(line);\n if (matcher.matches()) {\n vars = headerVariables(matcher.group(1));\n reader.mark(READ_AHEAD_LIMIT);\n headerRead = true;\n }\n else if (headerRead) {\n matcher = dataLinePattern.matcher(line);\n if (matcher.matches()) {\n String date = matcher.group(1);\n Instant timestep = Instant.parse(date, getInputDateFormatter());\n this.baseDate = timestep;\n \n RecordType recordType = new RecordType(\"days since \" + baseDate.toString());\n for (Variable var : vars) {\n recordType.addType(var);\n }\n \n reader.reset();\n return recordType;\n }\n }\n }\n \n }\n catch (IOException ex) {\n LOG.debug(\"Error reading metadata\", ex);\n }\n return null;\n }", "protected void parseDescription(XMPMetadata metadata)\n\t\t\tthrows XmpParsingException, XMLStreamException, XmpSchemaException,\n\t\t\tXmpUnknownValueTypeException, XmpExpectedRdfAboutAttribute,\n\t\t\tBadFieldValueException {\n\t\tnsMap.resetComplexBasicTypesDeclarationInSchemaLevel();\n\t\tint cptNS = reader.get().getNamespaceCount();\n\t\tHashMap<String, String> namespaces = new HashMap<String, String>();\n\t\tfor (int i = 0; i < cptNS; i++) {\n\t\t\tnamespaces.put(reader.get().getNamespacePrefix(i), reader.get()\n\t\t\t\t\t.getNamespaceURI(i));\n\t\t\tif (nsMap.isComplexBasicTypes(reader.get().getNamespaceURI(i))) {\n\t\t\t\t// System.out.println(\"in parseDesc method: prefix:\"+reader.get().getNamespacePrefix(i)+\", nsURI:\"+reader.get().getNamespaceURI(i));\n\t\t\t\tnsMap.setComplexBasicTypesDeclarationForLevelSchema(reader\n\t\t\t\t\t\t.get().getNamespaceURI(i), reader.get()\n\t\t\t\t\t\t.getNamespacePrefix(i));\n\t\t\t}\n\t\t}\n\t\t// Different treatment for PDF/A Extension schema\n\t\t// System.out.println(PDFAExtensionSchema.PDFAEXTENSION+\";\"+PDFAExtensionSchema.PDFAPROPERTY+\";\"+PDFAExtensionSchema.PDFASCHEMA);\n\t\tif (namespaces.containsKey(PDFAExtensionSchema.PDFAEXTENSION)) {\n\t\t\tif (namespaces.containsKey(PDFAExtensionSchema.PDFAPROPERTY)\n\t\t\t\t\t&& namespaces.containsKey(PDFAExtensionSchema.PDFASCHEMA)) {\n\t\t\t\tif (namespaces\n\t\t\t\t\t\t.containsValue(PDFAExtensionSchema.PDFAEXTENSIONURI)\n\t\t\t\t\t\t&& namespaces\n\t\t\t\t\t\t.containsValue(PDFAExtensionSchema.PDFAPROPERTYURI)\n\t\t\t\t\t\t&& namespaces\n\t\t\t\t\t\t.containsValue(PDFAExtensionSchema.PDFASCHEMAURI)) {\n\t\t\t\t\tPDFAExtensionSchema schema = metadata\n\t\t\t\t\t\t\t.createAndAddPDFAExtensionSchemaWithNS(namespaces);\n\t\t\t\t\ttreatDescriptionAttributes(metadata, schema);\n\t\t\t\t\tparseExtensionSchema(schema, metadata);\n\n\t\t\t\t} else {\n\t\t\t\t\tthrow new XmpUnexpectedNamespaceURIException(\n\t\t\t\t\t\t\t\"Unexpected namespaceURI in PDFA Extension Schema encountered\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new XmpUnexpectedNamespacePrefixException(\n\t\t\t\t\t\t\"Unexpected namespace Prefix in PDFA Extension Schema\");\n\t\t\t}\n\n\t\t} else {\n\t\t\t// TODO Considering first namespace is that corresponding to the\n\t\t\t// schema (see if it must be changed)\n\t\t\tString namespaceUri = reader.get().getNamespaceURI(0);\n\t\t\tString namespacePrefix = reader.get().getNamespacePrefix(0);\n\t\t\tXMPSchema schema = nsMap.getAssociatedSchemaObject(metadata, namespaceUri, namespacePrefix);\n\t\t\tif (schema != null) {\n\t\t\t\tnamespaces.remove(namespacePrefix);\n\t\t\t} else {\n\t\t\t\tschema = metadata.createAndAddDefaultSchema(namespacePrefix,namespaceUri);\n\t\t\t}\n\t\t\tfor (int i = 1; i < cptNS; i++) {\n\t\t\t\tschema.setAttribute(new Attribute(XMPSchema.NS_NAMESPACE,\n\t\t\t\t\t\t\"xmlns\", reader.get().getNamespacePrefix(i), reader.get().getNamespaceURI(i)));\n\t\t\t}\n\t\t\ttreatDescriptionAttributes(metadata, schema);\n\t\t\twhile (reader.get().nextTag() == XMLStreamReader.START_ELEMENT) {\n\t\t\t\tparseProperty(schema, metadata);\n\t\t\t}\n\t\t}\n\n\t}", "private void readMetadata() throws IOException {\n\t\t/*int magicNumber = */ metadataFile.readInt();\n\t\t/*int formatVersion = */ metadataFile.readInt();\n\t\t/*int managerIndex = */ metadataFile.readInt();\n\t\tfileListOffset = metadataFile.readInt() & 0xFFFFFFFFL;\n\t\tpathListOffset = metadataFile.readInt() & 0xFFFFFFFFL;\n\n\t\tmetadataFile.setPosition(fileListOffset);\n\t\treadFileList();\n\t}", "public abstract T parseFSMeta(T river, Map<String, Object> content);", "public static MetaData parse(File f) throws IOException {\n try {\n if (LimeXMLUtils.isSupportedAudioFormat(f))\n return AudioMetaData.parseAudioFile(f);\n else if (LimeXMLUtils.isSupportedVideoFormat(f))\n return VideoMetaData.parseVideoMetaData(f);\n //TODO: add other media formats here\t\t\t\n else if (LimeXMLUtils.isSupportedMultipleFormat(f))\n return parseMultipleFormat(f);\n } catch (OutOfMemoryError e) {\n LOG.warn(\"Ran out of memory while parsing.\",e);\n }\n\t\treturn null;\n\t}", "public XMPMetadata parse(byte[] xmp) throws XmpParsingException,\n\tXmpSchemaException, XmpUnknownValueTypeException,\n\tXmpExpectedRdfAboutAttribute, XmpXpacketEndException,\n\tBadFieldValueException {\n\n\t\tif (!(this instanceof XMPDocumentPreprocessor)) {\n\t\t\tfor (XMPDocumentPreprocessor processor : preprocessors) {\n\t\t\t\tNSMapping additionalNSMapping = processor.process(xmp);\n\t\t\t\tthis.nsMap.importNSMapping(additionalNSMapping);\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\tByteArrayInputStream is = new ByteArrayInputStream(xmp);\n\t\ttry {\n\t\t\tXMLInputFactory factory = XMLInputFactory.newInstance();\n\t\t\treader.set(factory.createXMLStreamReader(is));\n\n\t\t\t// expect xpacket processing instruction\n\t\t\texpectNext(XMLStreamReader.PROCESSING_INSTRUCTION,\n\t\t\t\t\t\"Did not find initial xpacket processing instruction\");\n\t\t\tXMPMetadata metadata = parseInitialXpacket(reader.get().getPIData());\n\n\t\t\t// expect x:xmpmeta\n\t\t\texpectNextTag(XMLStreamReader.START_ELEMENT,\n\t\t\t\t\t\"Did not find initial x:xmpmeta\");\n\t\t\texpectName(\"adobe:ns:meta/\", \"xmpmeta\");\n\n\t\t\t// expect rdf:RDF\n\t\t\texpectNextTag(XMLStreamReader.START_ELEMENT,\n\t\t\t\t\t\"Did not find initial rdf:RDF\");\n\t\t\texpectName(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\", \"RDF\");\n\n\t\t\tnsMap.resetComplexBasicTypesDeclarationInEntireXMPLevel();\n\t\t\t// add all namespaces which could declare nsURI of a basicValueType\n\t\t\t// all others declarations are ignored\n\t\t\tint nsCount = reader.get().getNamespaceCount();\n\t\t\tfor (int i = 0; i < nsCount; i++) {\n\t\t\t\tif (nsMap.isComplexBasicTypes(reader.get().getNamespaceURI(i))) {\n\t\t\t\t\tnsMap.setComplexBasicTypesDeclarationForLevelXMP(\n\t\t\t\t\t\t\treader.get().getNamespaceURI(i), \n\t\t\t\t\t\t\treader.get().getNamespacePrefix(i));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// now work on each rdf:Description\n\t\t\tint type = reader.get().nextTag();\n\t\t\twhile (type == XMLStreamReader.START_ELEMENT) {\n\t\t\t\tparseDescription(metadata);\n\t\t\t\ttype = reader.get().nextTag();\n\t\t\t}\n\n\t\t\t// all description are finished\n\t\t\t// expect end of rdf:RDF\n\t\t\texpectType(XMLStreamReader.END_ELEMENT,\n\t\t\t\t\t\"Expected end of descriptions\");\n\t\t\texpectName(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\", \"RDF\");\n\n\t\t\t// expect ending xmpmeta\n\t\t\texpectNextTag(XMLStreamReader.END_ELEMENT,\n\t\t\t\t\t\"Did not find initial x:xmpmeta\");\n\t\t\texpectName(\"adobe:ns:meta/\", \"xmpmeta\");\n\n\t\t\t// expect final processing instruction\n\t\t\texpectNext(XMLStreamReader.PROCESSING_INSTRUCTION,\n\t\t\t\t\t\"Did not find final xpacket processing instruction\");\n\t\t\t// treats xpacket end\n\t\t\tif (!reader.get().getPITarget().equals(\"xpacket\")) {\n\t\t\t\tthrow new XmpXpacketEndException(\"Excepted PI xpacket\");\n\t\t\t}\n\t\t\tString xpackData = reader.get().getPIData();\n\t\t\t// end attribute must be present and placed in first\n\t\t\t// xmp spec says Other unrecognized attributes can follow, but\n\t\t\t// should be ignored\n\t\t\tif (xpackData.startsWith(\"end=\")) {\n\t\t\t\t// check value (5 for end='X')\n\t\t\t\tif (xpackData.charAt(5)!='r' && xpackData.charAt(5)!='w') {\n\t\t\t\t\tthrow new XmpXpacketEndException(\n\t\t\t\t\t\t\t\"Excepted xpacket 'end' attribute with value 'r' or 'w' \");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// should find end='r/w'\n\t\t\t\tthrow new XmpXpacketEndException(\n\t\t\t\t\t\t\"Excepted xpacket 'end' attribute (must be present and placed in first)\");\n\t\t\t}\n\n\t\t\tmetadata.setEndXPacket(xpackData);\n\t\t\t// return constructed object\n\t\t\treturn metadata;\n\t\t} catch (XMLStreamException e) {\n\t\t\tthrow new XmpParsingException(\"An error has occured when processing the underlying XMP source\", e);\n\t\t} finally {\n\t\t\treader.remove();\n\t\t\tIOUtils.closeQuietly(is);\n\t\t}\n\t}", "private void readMetaFile() throws Exception, ErrorMessageException {\n System.out.println(\"Read Meta File\");\n DataInputStream dis = new DataInputStream(is);\n metaFilesPeer = new MetaFilesPeer();\n while (true) {\n /* read parent */\n String parent = dis.readUTF();\n if (parent.equals(\"//\")) {\n break;\n }\n String name = dis.readUTF();\n boolean isfile = dis.readBoolean();\n byte[] sha = null;\n if (isfile) {\n String shaBase64 = dis.readUTF();\n sha = Util.convertBase64ToBytes(shaBase64);\n }\n long timeadded = dis.readLong();\n metaFilesPeer.addMetaFile(parent, name, isfile, sha, timeadded);\n }\n }", "void parseMetadataMp3(String pathToAudioFile, String parameters){\n\t\ttry{\n\t\t\tParser parser=null;\n\t\t\tInputStream input=null;\n\t\t\tif(Pattern.matches(\"(.)+.mp3\", parameters)){\t\n\t\t\t\tparser = new Mp3Parser();\t\n\t\t\t\tinput=new FileInputStream(new File(pathToAudioFile));\n\t\t\t}\n\t\t\tContentHandler handler = new DefaultHandler();\n\t\t\tMetadata metadata = new Metadata();\n\n\t\t\tParseContext parseCtx= new ParseContext();\n\t\t\tparser.parse(input,handler,metadata,parseCtx);\n\n\t\t\tthis.setTitle(metadata.get(\"title\"));\n\t\t\tthis.setAlbum(metadata.get(\"xmpDM:album\"));\n\t\t\tthis.setArtist(metadata.get(\"xmpDM:artist\"));\n\t\t\tthis.setComposer(metadata.get(\"xmpDM:composer\"));\n\t\t\tthis.setGenre(metadata.get(\"xmpDM:genre\"));\n\t\t\tthis.setPath(pathToAudioFile);\n\t\t\tsetExecutionType(\"ok\");\n\t\t}\n\t\tcatch(FileNotFoundException e){\n\t\t\tSystem.err.println(\"ParseMedataMp3 FileNotFoundException\"+e);\n\t\t\tsetExecutionType(\"Exception\");\n\t\t}catch (IOException e){\n\t\t\tSystem.err.println(\"ParseMedataMp3 IOException\"+e);\n\t\t\tsetExecutionType(\"Exception\");\n\t\t}catch(SAXException e){\n\t\t\tSystem.err.println(\"ParseMedataMp3 SAXEException\"+e);\n\t\t\tsetExecutionType(\"Exception\");\n\t\t}catch(TikaException e){\n\t\t\tSystem.err.println(\"ParseMedataMp3 TikaException\"+e);\n\t\t\tsetExecutionType(\"Exception\");\n\t\t}\n\t}", "public static void main(final String[] args) throws IOException, TikaException, SAXException {\n\t File file = new File(args[0]);\n\n Tika tika = new Tika();\n \n //detecting the file type using detect method\n String filetype = tika.detect(file);\n //System.out.println(filetype);\n \n //Parser method parameters\n //Parser parser = new AutoDetectParser();\n //Parser parser = new DcXMLParser();\n Parser parser = new Eml211Parser();\n \n BodyContentHandler handler = new BodyContentHandler();\n Metadata metadata = new Metadata();\n FileInputStream inputstream = new FileInputStream(file);\n ParseContext context = new ParseContext();\n \n parser.parse(inputstream, handler, metadata, context);\n \n //System.out.println(handler.toString());\n \n System.out.println(\"Extracting Metadata of the document: \");\n //getting the list of all meta data elements \n String[] metadataNames = metadata.names();\n \n for(String name : metadataNames) {\t\t \n System.out.println(name + \": \"+ metadata.get(name));\n } \n }", "private void readMetaData(int location) throws IOException {\n //Log.i(LOG_Task, \"/readMetaData\");\n long read = 0;\n String md = \"\"; // The metadata\n // Skipping stream until get to the metadata\n InputStream is = conn.getInputStream();\n while (read != location) { read += is.skip(location - read);}\n // The first byte of metadata tell how large the metadata is\n int mdl = is.read() * 16;\n //Log.i(LOG_Task, \"Skipped \" + read + \" bytes, reading \" + mdl + \" next bytes for metadatas\");\n // Start reading metadata if there is some\n if (mdl > 0) {\n read = 0;\n // try to read metadata 3 times at most, because the stream might be corrupted\n for (int i = 0; i < 3; i++){\n byte[] mdb = new byte[mdl - (int) read];\n read = is.read(mdb);\n md += new String(mdb, 0, mdb.length);\n //Log.i(LOG_Task, \"read:\" + read + \"/\" + mdl + \"bytes\");\n if (read==mdl) {break;} // Got enough needed data\n }\n //Log.i(LOG_Task, \"raw metadata: \" + md);\n // Get the chunks of metadata\n String[] metdatas = new String(md.trim().getBytes(), \"utf-8\").split(\";\");\n // Extract metadata in form StreamTitle='DELTA GOODREM - BORN TO TRY';\n for (String data : metdatas) {\n //Log.i(LOG_Task, data);\n String[] item = data.split(\"-|=\");\n // Extract the data line contains StreamTitle (replace \"\" to avoid this: StreamT��itle)\n if (item[0].replaceAll(\"[^\\\\p{Alnum}\\\\s]\", \"\").compareTo(\"StreamTitle\") == 0) {\n currentTitle = item[1].replaceAll(\"[^\\\\p{Alnum}\\\\s]\", \"\");\n currentArtist = (item.length == 3) ? item[2].replaceAll(\"[^\\\\p{Alnum}\\\\s]\", \"\") : \"\";\n }\n }\n Log.i(LOG_Task, \"Title: \" + currentTitle + \" | Artist: \" + currentArtist);\n }\n is.close();\n }", "protected void initFile(String id) throws FormatException, IOException {\n super.initFile(id);\n\n // hack up the IFDs\n //\n // Imaris TIFFs store a thumbnail in the first IFD; each of the remaining\n // IFDs defines a stack of tiled planes.\n // MinimalTiffReader.initFile(String) removes thumbnail IFDs.\n\n LOGGER.info(\"Verifying IFD sanity\");\n\n IFDList tmp = new IFDList();\n\n for (IFD ifd : ifds) {\n long[] byteCounts = ifd.getStripByteCounts();\n long[] offsets = ifd.getStripOffsets();\n\n for (int i=0; i<byteCounts.length; i++) {\n IFD t = new IFD(ifd);\n t.putIFDValue(IFD.TILE_BYTE_COUNTS, byteCounts[i]);\n t.putIFDValue(IFD.TILE_OFFSETS, offsets[i]);\n tmp.add(t);\n }\n }\n\n String comment = ifds.get(0).getComment();\n\n LOGGER.info(\"Populating metadata\");\n\n core[0].sizeC = ifds.size();\n core[0].sizeZ = tmp.size() / getSizeC();\n core[0].sizeT = 1;\n core[0].sizeX = (int) ifds.get(0).getImageWidth();\n core[0].sizeY = (int) ifds.get(0).getImageLength();\n\n ifds = tmp;\n core[0].imageCount = getSizeC() * getSizeZ();\n core[0].dimensionOrder = \"XYZCT\";\n core[0].interleaved = false;\n core[0].rgb = getImageCount() != getSizeZ() * getSizeC() * getSizeT();\n core[0].pixelType = ifds.get(0).getPixelType();\n\n LOGGER.info(\"Parsing comment\");\n\n // likely an INI-style comment, although we can't be sure\n\n MetadataStore store = makeFilterMetadata();\n MetadataTools.populatePixels(store, this);\n\n if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {\n String description = null, creationDate = null;\n Vector<Integer> emWave = new Vector<Integer>();\n Vector<Integer> exWave = new Vector<Integer>();\n Vector<String> channelNames = new Vector<String>();\n\n if (comment != null && comment.startsWith(\"[\")) {\n // parse key/value pairs\n StringTokenizer st = new StringTokenizer(comment, \"\\n\");\n while (st.hasMoreTokens()) {\n String line = st.nextToken();\n int equals = line.indexOf(\"=\");\n if (equals < 0) continue;\n String key = line.substring(0, equals).trim();\n String value = line.substring(equals + 1).trim();\n addGlobalMeta(key, value);\n\n if (key.equals(\"Description\")) {\n description = value;\n }\n else if (key.equals(\"LSMEmissionWavelength\") && !value.equals(\"0\")) {\n emWave.add(new Integer(value));\n }\n else if (key.equals(\"LSMExcitationWavelength\") && !value.equals(\"0\"))\n {\n exWave.add(new Integer(value));\n }\n else if (key.equals(\"Name\") && !currentId.endsWith(value)) {\n channelNames.add(value);\n }\n else if (key.equals(\"RecordingDate\")) {\n value = value.replaceAll(\" \", \"T\");\n creationDate = value.substring(0, value.indexOf(\".\"));\n }\n }\n metadata.remove(\"Comment\");\n }\n\n // populate Image data\n store.setImageDescription(description, 0);\n store.setImageAcquiredDate(creationDate, 0);\n\n // populate LogicalChannel data\n for (int i=0; i<emWave.size(); i++) {\n store.setChannelEmissionWavelength(\n new PositiveInteger(emWave.get(i)), 0, i);\n store.setChannelExcitationWavelength(\n new PositiveInteger(exWave.get(i)), 0, i);\n store.setChannelName(channelNames.get(i), 0, i);\n }\n }\n }", "public TreeMap<Object, Metadata> metadata_reader(String filepath) throws Exception {\r\n String lang = Globals.CURRENT_LOCALE.getLanguage();\r\n TreeMap<Object, Metadata> metadatas = new TreeMap<Object, Metadata>();\r\n\r\n //Hash dei MIDs dei nodi obbligatori\r\n TreeMap forceAddMID = new TreeMap();\r\n forceAddMID.put(\"98\", 1);\r\n forceAddMID.put(\"14\", 1);\r\n forceAddMID.put(\"15\", 1);\r\n forceAddMID.put(\"64\", 1);\r\n forceAddMID.put(\"65\", 1);\r\n forceAddMID.put(\"122\", 1);\r\n forceAddMID.put(\"105\", 1);\r\n forceAddMID.put(\"23\", 1); //format\r\n forceAddMID.put(\"24\", 1); //location\r\n forceAddMID.put(\"25\", 1); //filesize\r\n forceAddMID.put(\"17\", 1); //technical\r\n forceAddMID.put(\"22\", 1); //Classification\r\n forceAddMID.put(\"45\", 1); //Taxonpath\r\n forceAddMID.put(\"46\", 1); //Source\r\n forceAddMID.put(\"47\", 1); //Taxon\r\n forceAddMID.put(\"82\", 1); //Kontextuelle Angaben\r\n forceAddMID.put(\"89\", 1); //REFERENZ\r\n forceAddMID.put(\"94\", 1); //Referenz\r\n forceAddMID.put(\"95\", 1); //Referenznummer\r\n forceAddMID.put(\"137\", 1); //Referenznummer\r\n forceAddMID.put(\"123\", 1); //identifiers\r\n forceAddMID.put(\"124\", 1); //identifiers\r\n forceAddMID.put(\"125\", 1); //identifiers\r\n forceAddMID.put(\"5\", 1); //keywords\r\n\tforceAddMID.put(\"96\", 1); // GPS\r\n forceAddMID.put(\"6\", 1); // Copertura\r\n forceAddMID.put(\"84\", 1); // Dimensioni\r\n forceAddMID.put(\"83\", 1); // Descrizione\r\n forceAddMID.put(\"93\", 1); // Tipo Materiale\r\n forceAddMID.put(\"88\", 1); // Unita di misura\r\n forceAddMID.put(\"85\", 1); // Lunghezza\r\n forceAddMID.put(\"86\", 1); // Larghezza\r\n forceAddMID.put(\"87\", 1); // Altezza\r\n forceAddMID.put(\"92\", 1); // Diametro\r\n \r\n forceAddMID.put(\"11\", 1); // Contributo\r\n forceAddMID.put(\"12\", 1); // Ruolo\r\n //forceAddMID.put(\"126\", 1); // Altro Ruolo\r\n forceAddMID.put(\"13\", 1); // Dati Personali\r\n forceAddMID.put(\"14\", 1); // Nome\r\n forceAddMID.put(\"15\", 1); // Cognome \r\n forceAddMID.put(\"63\", 1); // Ente\r\n forceAddMID.put(\"64\", 1); // Titolo\r\n forceAddMID.put(\"65\", 1); // Titolo\r\n //forceAddMID.put(\"66\", 1); // Tipo\r\n forceAddMID.put(\"148\", 1); // Numero Matricola\r\n \r\n /*forceAddMID.put(\"115\", 1); // Provenienza\r\n forceAddMID.put(\"114\", 1); // Provenienza - info\r\n forceAddMID.put(\"121\", 1); // Provenienza - tipo materiale\r\n forceAddMID.put(\"119\", 1); // Provenienza - note\r\n forceAddMID.put(\"107\", 1); // Provenienza - ruolo\r\n forceAddMID.put(\"106\", 1); // Provenienza - dati personali\r\n forceAddMID.put(\"108\", 1); // Provenienza - Nome\r\n forceAddMID.put(\"109\", 1); // Provenienza - Cognome\r\n forceAddMID.put(\"113\", 1); // Provenienza - Ente\r\n forceAddMID.put(\"110\", 1); // Provenienza - Titolo uno\r\n forceAddMID.put(\"111\", 1); // Provenienza - Titolo due\r\n forceAddMID.put(\"112\", 1); // Provenienza - tipo\r\n forceAddMID.put(\"117\", 1); // Provenienza - contributo\r\n forceAddMID.put(\"118\", 1); // Provenienza - contributo\r\n forceAddMID.put(\"116\", 1); // Provenienza - contributo\r\n forceAddMID.put(\"120\", 1); // Provenienza - contributo*/\r\n \r\n try {\r\n //selectedClassificationList = new TreeMap<String, String>();\r\n \r\n DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\r\n DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();\r\n Document doc;\r\n \r\n File urlf = new File(filepath);\r\n doc = dBuilder.parse(urlf);\r\n\r\n Node n = doc.getFirstChild();\r\n\r\n if (n.getNodeType() == Node.ELEMENT_NODE) {\r\n Element iENode = (Element) n;\r\n metadata_reader_metadatas(iENode, metadatas, false, forceAddMID, lang);\r\n }\r\n } catch (Exception ex) {\r\n throw ex;\r\n }\r\n\r\n return metadatas;\r\n }", "public TextMetaData parse(IFileHandler file) {\n\n\t\tTextMetaData metaData = new TextMetaData();\n\t\tStringBuilder bldWord = new StringBuilder();\n\n\t\t// the caret position holds the current position in the text stream\n\t\t// and is used to store the position of the words that have been found\n\t\t// which is useful information to highlight the words later on\n\t\tlong caretPosition = 0;\n\t\t\n\t\twhile (file.hasNext()) {\n\n\t\t\t// we iterate over the file content (which is obviously text based)\n\t\t\tString filePart = file.next();\n\t\t\t\n\t\t\tfor (int i = 0; i < filePart.length(); ++i) {\n\n\t\t\t\tchar c = filePart.charAt(i);\n\t\t\t\tboolean isWordFinisihed = false;\n\n\t\t\t\tint type = Character.getType(c);\n\n\t\t\t\t// check for a punctuation character\n\t\t\t\tswitch (type) {\n\t\t\t\t\n\t\t\t\tcase Character.START_PUNCTUATION:\n\t\t\t\tcase Character.INITIAL_QUOTE_PUNCTUATION:\n\t\t\t\tcase Character.FINAL_QUOTE_PUNCTUATION:\n\t\t\t\tcase Character.END_PUNCTUATION:\n\t\t\t\tcase Character.DASH_PUNCTUATION:\n\t\t\t\tcase Character.CONNECTOR_PUNCTUATION:\n\t\t\t\tcase Character.SPACE_SEPARATOR:\n\t\t\t\tcase Character.LINE_SEPARATOR:\n\t\t\t\tcase Character.PARAGRAPH_SEPARATOR:\n\t\t\t\tcase Character.CONTROL:\n\t\t\t\t\t\n\t\t\t\t\tisWordFinisihed = true;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase Character.OTHER_PUNCTUATION:\n\n\t\t\t\t\t// if we found a punctuation between a letter or digit\n\t\t\t\t\t// aka 1.2.3 or V.1.2 or something like this\n\t\t\t\t\t// we will see this as a single word\n\t\t\t\t\tif ((i > 0)\n\t\t\t\t\t\t\t&& (i != filePart.length() - 1)\n\t\t\t\t\t\t\t&& Character\n\t\t\t\t\t\t\t\t\t.isLetterOrDigit(filePart.charAt(i - 1))\n\t\t\t\t\t\t\t&& Character\n\t\t\t\t\t\t\t\t\t.isLetterOrDigit(filePart.charAt(i + 1))) {\n\n\t\t\t\t\t\tisWordFinisihed = false;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t\n\t\t\t\t\t\tisWordFinisihed = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tisWordFinisihed = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// if we figured out that we have finished one word\n\t\t\t\tif (isWordFinisihed) {\n\n\t\t\t\t\tif (bldWord.length() > 0) {\n\n\t\t\t\t\t\t// we have to store this information in the meta data\n\t\t\t\t\t\tString newWord = bldWord.toString();\n\t\t\t\t\t\t\n\t\t\t\t\t\tWordPosition pos = new WordPosition(caretPosition + i - newWord.length(), newWord);\n\t\t\t\t\t\t\n\t\t\t\t\t\tmetaData.addWord(newWord, pos);\n\n\t\t\t\t\t\t// and inform the UI about the process update\n\t\t\t\t\t\tint percentage = (int) (pos.getEndPosition() * 100 / file.getFileLength());\n\t\t\t\t\t\t\n\t\t\t\t\t\tString message = String.format(\"Wort \\\"%s\\\" gefunden\",\n\t\t\t\t\t\t\t\tnewWord);\n\n\t\t\t\t\t\tnotifyTextProcessStatusUpdate(new TextProcessStatusEvent(\n\t\t\t\t\t\t\t\tthis, percentage, message));\n\n\t\t\t\t\t\tbldWord = new StringBuilder();\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// when the word is finished, we have examined a valid punctuation character before\n\t\t\t\t\t// which is the signal to the text processing strategy that the word is finished\n\t\t\t\t\tmetaData.addPunctuation(c);\n\t\t\t\t\t\n\t\t\t\t} else {\n\n\t\t\t\t\t// otherwise we are still in-between the word and have to build it \n\t\t\t\t\t// char-by-char\n\t\t\t\t\tbldWord.append(c);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tcaretPosition += filePart.length();\n\t\t}\n\n\t\t// notify that we will have to sort the list of examined words\n\t\t// based on their frequency, which might take a while\n\t\tnotifyTextProcessStatusUpdate(new TextProcessStatusEvent(this, -1,\n\t\t\t\t\"Sortiere Wortliste...\"));\n\n\t\tmetaData.sortWordsByFrequency();\n\n\t\t// after all the process is finished, so refresh the UI here\n\t\tnotifyTextProcessStatusFinish(new TextProcessFinishEvent(this,\n\t\t\t\tfile.getPlainText(), metaData));\n\t\t\n\t\treturn metaData;\n\t}", "protected MetaData[] parseMetaData( Element datasetElement )\n throws XMLParsingException,\n InvalidCapabilitiesException {\n\n List<Node> metaDataList = XMLTools.getNodes( datasetElement, PRE_WPVS + \"MetaData\", nsContext );\n if ( metaDataList.size() == 0 ) {\n return null;\n }\n MetaData[] metaData = new MetaData[metaDataList.size()];\n\n for ( int i = 0; i < metaData.length; i++ ) {\n\n Element metaDataElement = (Element) metaDataList.get( i );\n\n String type = XMLTools.getRequiredNodeAsString( metaDataElement, \"@type\", nsContext );\n\n String format = XMLTools.getRequiredNodeAsString( metaDataElement, PRE_WPVS + \"Format/text()\", nsContext );\n URI onlineResourceURI = XMLTools.getNodeAsURI( metaDataElement,\n PRE_WPVS + \"OnlineResource/@xlink:href\",\n nsContext,\n null );\n URL onlineResource = null;\n if ( onlineResourceURI != null ) {\n try {\n onlineResource = onlineResourceURI.toURL();\n } catch ( MalformedURLException e ) {\n throw new InvalidCapabilitiesException( onlineResourceURI + \" does not represent a valid URL: \"\n + e.getMessage() );\n }\n }\n\n metaData[i] = new MetaData( type, format, onlineResource );\n }\n\n return metaData;\n }", "public MetadataContext parseMetadata(KXmlParser myParser)\n\t{\n\t\tMetadataContext metadata = new MetadataContext();\n\t\t\n\t\t//<contextMetadata>\n\t\ttry {\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\t//<description>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\tmetadata.setM_description( myParser.nextText());\n\t\t\t\n\t\t\t//<positionInfo>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\tmetadata.setM_latitude( Double.parseDouble( myParser.getAttributeValue(0)));\n\t\t\tmetadata.setM_longitude( Double.parseDouble( myParser.getAttributeValue(1)));\n\t\t\t\n\t\t\t//</positionInfo>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\t//<temporalInfo>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\t\n\t\t\tmetadata.setM_time( myParser.nextText());\n\t\t\t\n\t\t\t//<version>\n\t\t\tmyParser.nextTag();\n\t\t\tmetadata.setM_time( myParser.nextText());\n\t\t\t\n\t\t\t\n\t\t\t//<unit>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\tmetadata.setM_unit(myParser.nextText());\n\t\t\t\n\t\t\t//</contextMetadata>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t} catch (XmlPullParserException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\treturn metadata;\n\t\t\n\t}", "Metadata getMetaData();", "protected void initFile(String id) throws FormatException, IOException {\n super.initFile(id);\n in = new RandomAccessInputStream(id);\n\n String endian = in.readString(2);\n boolean little = endian.equals(\"II\");\n in.order(little);\n\n in.seek(98);\n int seriesCount = in.readInt();\n\n in.seek(192);\n while (in.read() == 0);\n String description = in.readCString();\n addGlobalMeta(\"Description\", description);\n\n while (in.readInt() == 0);\n\n long fp = in.getFilePointer();\n if ((fp % 2) == 0) fp -= 4;\n else fp--;\n\n offsets = new long[seriesCount];\n core = new CoreMetadata[seriesCount];\n for (int i=0; i<seriesCount; i++) {\n in.seek(fp + i*256);\n core[i] = new CoreMetadata();\n core[i].littleEndian = little;\n core[i].sizeX = in.readInt();\n core[i].sizeY = in.readInt();\n int numBits = in.readInt();\n core[i].sizeC = in.readInt();\n core[i].sizeZ = in.readInt();\n core[i].sizeT = in.readInt();\n\n core[i].imageCount = core[i].sizeZ * core[i].sizeC * core[i].sizeT;\n int nBytes = numBits / 8;\n core[i].pixelType =\n FormatTools.pixelTypeFromBytes(nBytes, false, nBytes == 8);\n\n core[i].dimensionOrder = \"XYCZT\";\n core[i].rgb = false;\n\n in.skipBytes(4);\n\n long pointer = in.getFilePointer();\n String name = in.readCString();\n\n if (i == 0) {\n in.skipBytes((int) (92 - in.getFilePointer() + pointer));\n while (true) {\n int check = in.readInt();\n if (check > in.getFilePointer()) {\n offsets[i] = (long) check + LUT_SIZE;\n break;\n }\n in.skipBytes(92);\n }\n }\n else {\n offsets[i] = offsets[i - 1] + core[i - 1].sizeX * core[i - 1].sizeY *\n core[i - 1].imageCount *\n FormatTools.getBytesPerPixel(core[i - 1].pixelType);\n }\n offsets[i] += 352;\n in.seek(offsets[i]);\n while (in.getFilePointer() + 116 < in.length() && in.read() == 3 &&\n in.read() == 37)\n {\n in.skipBytes(114);\n offsets[i] = in.getFilePointer();\n }\n in.seek(in.getFilePointer() - 1);\n byte[] buf = new byte[3 * 1024 * 1024];\n int n = in.read(buf, 0, 1);\n boolean found = false;\n while (!found && in.getFilePointer() < in.length()) {\n n += in.read(buf, 1, buf.length - 1);\n for (int q=0; q<buf.length - 1; q++) {\n if ((buf[q] & 0xff) == 192 && (buf[q + 1] & 0xff) == 46) {\n offsets[i] = in.getFilePointer() - n + q;\n found = true;\n break;\n }\n }\n buf[0] = buf[buf.length - 1];\n n = 1;\n }\n if (found) offsets[i] += 16063;\n if (i == offsets.length - 1 && !compressed && i > 0) {\n offsets[i] = (int) (in.length() -\n (core[i].sizeX * core[i].sizeY * core[i].imageCount * (numBits / 8)));\n }\n }\n\n MetadataStore store = makeFilterMetadata();\n MetadataTools.populatePixels(store, this);\n MetadataTools.setDefaultCreationDate(store, id, 0);\n }", "public interface IMetaService {\n\n // Get FLV from FLVService\n // grab a reader from FLV\n // Set up CuePoints\n // Set up MetaData\n // Pass CuePoint array into MetaData\n // read in current MetaData if there is MetaData\n // if there isn't MetaData, write new MetaData\n // Call writeMetaData method on MetaService\n // that in turn will write the current metadata\n // and the cuepoint data\n // after that, call writeMetaCue()\n // this will loop through all the tags making\n // sure that the cuepoints are inserted\n\n /**\n * Initiates writing of the MetaData\n *\n * @param meta\n * Metadata\n * @throws IOException\n * I/O exception\n */\n public void write(IMetaData<?, ?> meta) throws IOException;\n\n /**\n * Writes the MetaData\n *\n * @param metaData\n * Metadata\n */\n public void writeMetaData(IMetaData<?, ?> metaData);\n\n /**\n * Writes the Meta Cue Points\n */\n public void writeMetaCue();\n\n /**\n * Read the MetaData\n *\n * @return metaData Metadata\n * @param buffer\n * IoBuffer source\n */\n public MetaData<?, ?> readMetaData(IoBuffer buffer);\n\n /**\n * Read the Meta Cue Points\n *\n * @return Meta cue points\n */\n public IMetaCue[] readMetaCue();\n\n /**\n * Media file to be accessed\n *\n * @param file\n * file\n */\n public void setFile(File file);\n\n /**\n * Returns the file being accessed\n *\n * @return file\n */\n public File getFile();\n\n}", "private List<PDFAFieldDescription> parseFieldDescription(\n\t\t\tXMPMetadata metadata) throws XmpParsingException,\n\t\t\tXMLStreamException {\n\t\tList<PDFAFieldDescription> fields = new ArrayList<PDFAFieldDescription>();\n\t\t// <rdf:Seq>\n\t\texpectNextSpecificTag(XMLStreamReader.START_ELEMENT, \"Seq\",\n\t\t\t\t\"Expected Seq Declaration\");\n\t\tint elmtType = reader.get().nextTag();\n\t\tString name, type, description;\n\t\twhile (elmtType == XMLStreamReader.START_ELEMENT) {\n\t\t\texpectCurrentLocalName(\"li\");\n\t\t\telmtType = reader.get().nextTag();\n\t\t\tname = null;\n\t\t\ttype = null;\n\t\t\tdescription = null;\n\n\t\t\twhile (elmtType == XMLStreamReader.START_ELEMENT) {\n\t\t\t\tif (reader.get().getLocalName().equals(\"name\")) {\n\t\t\t\t\tname = reader.get().getElementText();\n\t\t\t\t} else if (reader.get().getLocalName().equals(\"valueType\")) {\n\t\t\t\t\ttype = reader.get().getElementText();\n\t\t\t\t} else if (reader.get().getLocalName().equals(\"description\")) {\n\t\t\t\t\tdescription = reader.get().getElementText();\n\t\t\t\t} else {\n\t\t\t\t\tthrow new XmpUnexpectedElementException(\n\t\t\t\t\t\t\t\"Unexpected property definition in one of ValueType Field Descriptions of PDF/A Extension schemas description\");\n\t\t\t\t}\n\t\t\t\telmtType = reader.get().nextTag();\n\t\t\t}\n\t\t\tif ((name != null) && (type != null) && (description != null)) {\n\t\t\t\tPDFAFieldDescription tmp = new PDFAFieldDescription(metadata);\n\t\t\t\ttmp.setNameValue(name);\n\t\t\t\ttmp.setValueTypeValue(type);\n\t\t\t\ttmp.setDescriptionValue(description);\n\t\t\t\tfields.add(tmp);\n\t\t\t} else {\n\t\t\t\tthrow new XmpRequiredPropertyException(\n\t\t\t\t\t\t\"One valuetype field declaration in PDF/A Extension is not complete\");\n\t\t\t}\n\t\t\t// expectNextTag(XMLStreamReader.END_ELEMENT,\"Expected element end\");\n\t\t\telmtType = reader.get().nextTag();\n\t\t}\n\t\texpectNextSpecificTag(XMLStreamReader.END_ELEMENT, \"field\",\n\t\t\t\t\"Expected End of Properties Declaration\");\n\t\tif (fields.size() != 0) {\n\t\t\treturn fields;\n\t\t}\n\t\treturn null;\n\t}", "@Override\n \t\tpublic void populateImageMetadata() {\n \n \t\t\t// populate core metadata\n \n \t\t\tfinal OMEXMLMetadata omexmlMeta = getOmeMeta().getRoot();\n \n \t\t\tfor (int s = 0; s < getImageCount(); s++) {\n \n \t\t\t\tfinal ImageMetadata m = get(s);\n \t\t\t\ttry {\n \t\t\t\t\tm.setPlanarAxisCount(2);\n \t\t\t\t\tm.setAxisLength(Axes.X, omexmlMeta.getPixelsSizeX(s).getValue()\n \t\t\t\t\t\t.intValue());\n \t\t\t\t\tfinal int tiffWidth = (int) firstIFD.getImageWidth();\n \t\t\t\t\tif (m.getAxisLength(Axes.X) != tiffWidth && s == 0) {\n \t\t\t\t\t\tlog().warn(\n \t\t\t\t\t\t\t\"SizeX mismatch: OME=\" + m.getAxisLength(Axes.X) + \", TIFF=\" +\n \t\t\t\t\t\t\t\ttiffWidth);\n \t\t\t\t\t}\n \t\t\t\t\tm.setAxisLength(Axes.Y, omexmlMeta.getPixelsSizeY(s).getValue()\n \t\t\t\t\t\t.intValue());\n \t\t\t\t\tfinal int tiffHeight = (int) firstIFD.getImageLength();\n \t\t\t\t\tif (m.getAxisLength(Axes.Y) != tiffHeight && s == 0) {\n \t\t\t\t\t\tlog().warn(\n \t\t\t\t\t\t\t\"SizeY mismatch: OME=\" + m.getAxisLength(Axes.Y) + \", TIFF=\" +\n \t\t\t\t\t\t\t\ttiffHeight);\n \t\t\t\t\t}\n \t\t\t\t\tm.setAxisLength(Axes.Z, omexmlMeta.getPixelsSizeZ(s).getValue()\n \t\t\t\t\t\t.intValue());\n \t\t\t\t\tm.setAxisLength(Axes.CHANNEL, omexmlMeta.getPixelsSizeC(s).getValue()\n \t\t\t\t\t\t.intValue());\n \t\t\t\t\tm.setAxisLength(Axes.TIME, omexmlMeta.getPixelsSizeT(s).getValue()\n \t\t\t\t\t\t.intValue());\n \t\t\t\t\tm.setPixelType(FormatTools.pixelTypeFromString(omexmlMeta\n \t\t\t\t\t\t.getPixelsType(s).toString()));\n \t\t\t\t\tfinal int tiffPixelType = firstIFD.getPixelType();\n \t\t\t\t\tif (m.getPixelType() != tiffPixelType &&\n \t\t\t\t\t\t(s == 0 || adjustedSamples.get(s)))\n \t\t\t\t\t{\n \t\t\t\t\t\tlog().warn(\n \t\t\t\t\t\t\t\"PixelType mismatch: OME=\" + m.getPixelType() + \", TIFF=\" +\n \t\t\t\t\t\t\t\ttiffPixelType);\n \t\t\t\t\t\tm.setPixelType(tiffPixelType);\n \t\t\t\t\t}\n \t\t\t\t\tm.setBitsPerPixel(FormatTools.getBitsPerPixel(m.getPixelType()));\n \t\t\t\t\tString dimensionOrder =\n \t\t\t\t\t\tomexmlMeta.getPixelsDimensionOrder(s).toString();\n \n \t\t\t\t\t// hackish workaround for files exported by OMERO that have an\n \t\t\t\t\t// incorrect dimension order\n \t\t\t\t\tString uuidFileName = \"\";\n \t\t\t\t\ttry {\n \t\t\t\t\t\tif (omexmlMeta.getTiffDataCount(s) > 0) {\n \t\t\t\t\t\t\tuuidFileName = omexmlMeta.getUUIDFileName(s, 0);\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t\tcatch (final NullPointerException e) {}\n \t\t\t\t\tif (omexmlMeta.getChannelCount(s) > 0 &&\n \t\t\t\t\t\tomexmlMeta.getChannelName(s, 0) == null &&\n \t\t\t\t\t\tomexmlMeta.getTiffDataCount(s) > 0 &&\n \t\t\t\t\t\tuuidFileName.indexOf(\"__omero_export\") != -1)\n \t\t\t\t\t{\n \t\t\t\t\t\tdimensionOrder = \"XYZCT\";\n \t\t\t\t\t}\n \t\t\t\t\tm.setAxisTypes(metaService.findDimensionList(dimensionOrder));\n \n \t\t\t\t\tm.setOrderCertain(true);\n \t\t\t\t\tfinal PhotoInterp photo = firstIFD.getPhotometricInterpretation();\n \t\t\t\t\tif (samples.get(s) > 1 || photo == PhotoInterp.RGB) {\n \t\t\t\t\t\tm.setPlanarAxisCount(3);\n \t\t\t\t\t}\n \t\t\t\t\tif ((samples.get(s) != m.getAxisLength(Axes.CHANNEL) &&\n \t\t\t\t\t\t(samples.get(s) % m.getAxisLength(Axes.CHANNEL)) != 0 && (m\n \t\t\t\t\t\t.getAxisLength(Axes.CHANNEL) % samples.get(s)) != 0) ||\n \t\t\t\t\t\tm.getAxisLength(Axes.CHANNEL) == 1 || adjustedSamples.get(s))\n \t\t\t\t\t{\n \t\t\t\t\t\tm.setAxisLength(Axes.CHANNEL, m.getAxisLength(Axes.CHANNEL) *\n \t\t\t\t\t\t\tsamples.get(s));\n \t\t\t\t\t}\n \n \t\t\t\t\tif (m.getAxisLength(Axes.Z) * m.getAxisLength(Axes.TIME) *\n \t\t\t\t\t\tm.getAxisLength(Axes.CHANNEL) > info[s].length &&\n \t\t\t\t\t\t!m.isMultichannel())\n \t\t\t\t\t{\n \t\t\t\t\t\tif (m.getAxisLength(Axes.Z) == info[s].length) {\n \t\t\t\t\t\t\tm.setAxisLength(Axes.TIME, 1);\n \t\t\t\t\t\t\tm.setAxisLength(Axes.CHANNEL, 1);\n \t\t\t\t\t\t}\n \t\t\t\t\t\telse if (m.getAxisLength(Axes.TIME) == info[s].length) {\n \t\t\t\t\t\t\tm.setAxisLength(Axes.Z, 1);\n \t\t\t\t\t\t\tm.setAxisLength(Axes.CHANNEL, 1);\n \t\t\t\t\t\t}\n \t\t\t\t\t\telse if (m.getAxisLength(Axes.CHANNEL) == info[s].length) {\n \t\t\t\t\t\t\tm.setAxisLength(Axes.TIME, 1);\n \t\t\t\t\t\t\tm.setAxisLength(Axes.Z, 1);\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \n \t\t\t\t\tif (omexmlMeta.getPixelsBinDataCount(s) > 1) {\n \t\t\t\t\t\tlog().warn(\n \t\t\t\t\t\t\t\"OME-TIFF Pixels element contains BinData elements! \"\n \t\t\t\t\t\t\t\t+ \"Ignoring.\");\n \t\t\t\t\t}\n \t\t\t\t\tm.setLittleEndian(firstIFD.isLittleEndian());\n \t\t\t\t\tm.setIndexed(photo == PhotoInterp.RGB_PALETTE &&\n \t\t\t\t\t\tfirstIFD.getIFDValue(IFD.COLOR_MAP) != null);\n \t\t\t\t\tm.setFalseColor(true);\n \t\t\t\t\tm.setMetadataComplete(true);\n \t\t\t\t}\n \t\t\t\tcatch (final NullPointerException exc) {\n \t\t\t\t\tlog().error(\"Incomplete Pixels metadata\", exc);\n \t\t\t\t}\n \t\t\t\tcatch (final FormatException exc) {\n \t\t\t\t\tlog().error(\"Format exception when creating ImageMetadata\", exc);\n \t\t\t\t}\n \t\t\t}\n \n // if (getImageCount() == 1) {\n // CoreMetadata ms0 = core.get(0);\n // ms0.sizeZ = 1;\n // if (!ms0.rgb) {\n // ms0.sizeC = 1;\n // }\n // ms0.sizeT = 1;\n // }\n // metaService.populatePixels(getOmeMeta().getRoot(), this, false, false);\n \t\t\tgetOmeMeta().setRoot((OMEXMLMetadata) getMetadataStoreForConversion());\n \t\t}", "private void readMetaData() throws AreaFileException {\r\n \r\n int i;\r\n// hasReadData = false;\r\n\r\n// if (! fileok) {\r\n// throw new AreaFileException(\"Error reading AreaFile directory\");\r\n// }\r\n\r\n dir = new int[AD_DIRSIZE];\r\n\r\n for (i=0; i < AD_DIRSIZE; i++) {\r\n try { dir[i] = af.readInt();\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error reading AreaFile directory:\" + e);\r\n }\r\n }\r\n position += AD_DIRSIZE * 4;\r\n\r\n // see if the directory needs to be byte-flipped\r\n\r\n if (dir[AD_VERSION] != VERSION_NUMBER) {\r\n McIDASUtil.flip(dir,0,19);\r\n // check again\r\n if (dir[AD_VERSION] != VERSION_NUMBER)\r\n throw new AreaFileException(\r\n \"Invalid version number - probably not an AREA file\");\r\n // word 20 may contain characters -- if small integer, flip it...\r\n if ( (dir[20] & 0xffff) == 0) McIDASUtil.flip(dir,20,20);\r\n McIDASUtil.flip(dir,21,23);\r\n // words 24-31 contain memo field\r\n McIDASUtil.flip(dir,32,50);\r\n // words 51-2 contain cal info\r\n McIDASUtil.flip(dir,53,55);\r\n // word 56 contains original source type (ascii)\r\n McIDASUtil.flip(dir,57,63);\r\n flipwords = true;\r\n }\r\n\r\n areaDirectory = new AreaDirectory(dir);\r\n\r\n // pull together some values needed by other methods\r\n navLoc = dir[AD_NAVOFFSET];\r\n calLoc = dir[AD_CALOFFSET];\r\n auxLoc = dir[AD_AUXOFFSET];\r\n datLoc = dir[AD_DATAOFFSET];\r\n numBands = dir[AD_NUMBANDS];\r\n linePrefixLength = \r\n dir[AD_DOCLENGTH] + dir[AD_CALLENGTH] + dir[AD_LEVLENGTH];\r\n if (dir[AD_VALCODE] != 0) linePrefixLength = linePrefixLength + 4;\r\n if (linePrefixLength != dir[AD_PFXSIZE]) \r\n throw new AreaFileException(\"Invalid line prefix length in AREA file.\");\r\n lineDataLength = numBands * dir[AD_NUMELEMS] * dir[AD_DATAWIDTH];\r\n lineLength = linePrefixLength + lineDataLength;\r\n numberLines = dir[AD_NUMLINES];\r\n\r\n if (datLoc > 0 && datLoc != McIDASUtil.MCMISSING) {\r\n navbytes = datLoc - navLoc;\r\n calbytes = datLoc - calLoc;\r\n auxbytes = datLoc - auxLoc;\r\n }\r\n if (auxLoc > 0 && auxLoc != McIDASUtil.MCMISSING) {\r\n navbytes = auxLoc - navLoc;\r\n calbytes = auxLoc - calLoc;\r\n }\r\n\r\n if (calLoc > 0 && calLoc != McIDASUtil.MCMISSING ) {\r\n navbytes = calLoc - navLoc;\r\n }\r\n\r\n\r\n // Read in nav block\r\n if (navLoc > 0 && navbytes > 0) {\r\n nav = new int[navbytes/4];\r\n newPosition = (long) navLoc;\r\n skipByteCount = (int) (newPosition - position);\r\n try {\r\n af.skipBytes(skipByteCount);\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error skipping AreaFile bytes: \" + e);\r\n }\r\n for (i=0; i<navbytes/4; i++) {\r\n try {\r\n nav[i] = af.readInt();\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error reading AreaFile navigation:\"+e);\r\n }\r\n }\r\n if (flipwords){\r\n flipnav(nav);\r\n }\r\n position = navLoc + navbytes;\r\n }\r\n\r\n // Read in cal block\r\n if (calLoc > 0 && calbytes > 0) {\r\n cal = new int[calbytes/4];\r\n newPosition = (long)calLoc;\r\n skipByteCount = (int) (newPosition - position);\r\n try {\r\n af.skipBytes(skipByteCount);\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error skipping AreaFile bytes: \" + e);\r\n }\r\n for (i=0; i<calbytes/4; i++) {\r\n try { \r\n cal[i] = af.readInt();\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error reading AreaFile calibration:\"+e);\r\n }\r\n }\r\n // if (flipwords) flipcal(cal);\r\n position = calLoc + calbytes;\r\n }\r\n\r\n // Read in aux block\r\n if (auxLoc > 0 && auxbytes > 0){\r\n aux = new int[auxbytes/4];\r\n newPosition = (long) auxLoc;\r\n skipByteCount = (int) (newPosition - position);\r\n try{\r\n af.skipBytes(skipByteCount);\r\n }catch (IOException e){\r\n status = -1;\r\n throw new AreaFileException(\"Error skipping AreaFile bytes: \" + e);\r\n }\r\n for (i = 0; i < auxbytes/4; i++){\r\n try{\r\n aux[i] = af.readInt();\r\n }catch (IOException e){\r\n status = -1;\r\n throw new AreaFileException(\"Error reading AreaFile aux block:\" + e);\r\n }\r\n }\r\n position = auxLoc + auxbytes;\r\n }\r\n\r\n // now return the Dir, as requested...\r\n status = 1;\r\n return;\r\n }", "private static boolean parseHtcMetaData(final FileChannel fc, final long offset, final long size) throws IOException {\n\n\t int version = 0;\n\t boolean nBitsCheck = true;\n\t long nOffset = 0;\n\t int nSize = 0;\n\n\t byte[] buffer = Util.read(fc, offset, (int)size);\n\t ByteArrayInputStream bis = new ByteArrayInputStream(buffer);\n\n\t version = Util.readInt(bis);;\n\n\t nBitsCheck =Util.readInt(bis)==1? true:false;\n\n\t if(version != 1) {\n\t Log.e(TAG, \"Htc Table version(\"+ version+\") incorrect!! Skip parsing Htc table\");\n\t return true;\n\t }\n\n\t if(nBitsCheck) {\n\t nOffset = Util.readUInt(bis);\n\t }else {\n\t nOffset = Util.readLong(bis);\n\t }\n\n\t nSize = Util.readInt(bis);\n\t \n\t sUSE_32BIT_OFFSET = nBitsCheck;\n\t sHMTA_Offset = nOffset;\n\t sHMTA_Size = nSize;\n\n\t Log.d(TAG, \"version \"+version+\", use32Bits \"+ nBitsCheck);\n\t Log.v(TAG, \"offset \"+nOffset+\", size \" +nSize);\n\n\t bis.close();\n\n\t return true;\n\t }", "protected InvMetadata readMetadata( InvCatalog catalog, InvDatasetImpl dataset, Element mdataElement) {\n Namespace namespace;\r\n List inlineElements = mdataElement.getChildren();\r\n if (inlineElements.size() > 0) // look at the namespace of the children, if they exist\r\n namespace = ((Element) inlineElements.get( 0)).getNamespace();\r\n else\r\n namespace = mdataElement.getNamespace(); // will be thredds\r\n\r\n String mtype = mdataElement.getAttributeValue(\"metadataType\");\r\n String href = mdataElement.getAttributeValue(\"href\", xlinkNS);\r\n String title = mdataElement.getAttributeValue(\"title\", xlinkNS);\r\n String inheritedS = mdataElement.getAttributeValue(\"inherited\");\r\n boolean inherited = (inheritedS != null) && inheritedS.equalsIgnoreCase(\"true\");\r\n\r\n boolean isThreddsNamespace = ((mtype == null) || mtype.equalsIgnoreCase(\"THREDDS\")) &&\r\n namespace.getURI().equals(XMLEntityResolver.CATALOG_NAMESPACE_10);\r\n\r\n // see if theres a converter for it.\r\n MetadataConverterIF metaConverter = factory.getMetadataConverter( namespace.getURI());\r\n if (metaConverter == null) metaConverter = factory.getMetadataConverter( mtype);\r\n if (metaConverter != null) {\r\n if (debugMetadataRead) System.out.println(\"found factory for metadata type = \"+mtype+\" namespace = \"+\r\n namespace+\"=\"+metaConverter.getClass().getName());\r\n\r\n // see if theres any inline content\r\n Object contentObj = null;\r\n if (inlineElements.size() > 0) {\r\n contentObj = metaConverter.readMetadataContent( dataset, mdataElement);\r\n return new InvMetadata( dataset, mtype, namespace.getURI(), namespace.getPrefix(),\r\n inherited, false, metaConverter, contentObj);\r\n\r\n } else { // otherwise it must be an Xlink; defer reading\r\n return new InvMetadata(dataset, href, title, mtype, namespace.getURI(),\r\n namespace.getPrefix(), inherited, false, metaConverter);\r\n }\r\n }\r\n\r\n // the case where its not ThreddsMetadata, but theres no converter\r\n if (!isThreddsNamespace) {\r\n if (inlineElements.size() > 0) {\r\n // just hold onto the jdom elements as the \"content\" LOOK should be DOM?\r\n return new InvMetadata( dataset, mtype, namespace.getURI(), namespace.getPrefix(),\r\n inherited, false, this, mdataElement);\r\n\r\n } else { // otherwise it must be an Xlink, never read\r\n return new InvMetadata(dataset, href, title, mtype, namespace.getURI(),\r\n namespace.getPrefix(), inherited, false, null);\r\n }\r\n\r\n }\r\n\r\n // the case where its ThreddsMetadata\r\n if (inlineElements.size() > 0) {\r\n ThreddsMetadata tmg = new ThreddsMetadata(false);\r\n readThreddsMetadata( catalog, dataset, mdataElement, tmg);\r\n return new InvMetadata( dataset, mtype, namespace.getURI(), namespace.getPrefix(),\r\n inherited, true, this, tmg);\r\n\r\n } else { // otherwise it must be an Xlink; defer reading\r\n return new InvMetadata(dataset, href, title, mtype, namespace.getURI(),\r\n namespace.getPrefix(), inherited, true, this);\r\n }\r\n\r\n }", "@Test\n\tpublic void probandoConParser() {\n\t\tString dBoxUrl = \"/home/julio/Dropbox/julio_box/educacion/maestria_explotacion_datos_uba/materias/cuat_4_text_mining/material/tp3/\";\n\t\tString modelUrl = dBoxUrl + \"NER/models/es-ner-person.bin\";\n\t\tString filesUrl = dBoxUrl + \"NER/archivoPrueba\";\n\t\tString sampleFile = filesUrl + \"/viernes-23-05-14-alan-fitzpatrick-gala-cordoba.html\";\n\t\tList<String> docs = getMyDocsFromSomewhere(filesUrl);\n\n\t\ttry {\n\t\t\t// detecting the file type\n\t\t\tBodyContentHandler handler = new BodyContentHandler();\n\t\t\tMetadata metadata = new Metadata();\n\t\t\tFileInputStream inputstream = new FileInputStream(new File(sampleFile));\n\t\t\tParseContext pcontext = new ParseContext();\n\n\t\t\t// Html parser\n\t\t\tHtmlParser htmlparser = new HtmlParser();\n\t\t\thtmlparser.parse(inputstream, handler, metadata, pcontext);\n\t\t\tSystem.out.println(\"Contents of the document:\" + handler.toString());\n\t\t\tSystem.out.println(\"Metadata of the document:\");\n\t\t\tString[] metadataNames = metadata.names();\n\n\t\t\tfor (String name : metadataNames) {\n\t\t\t\tSystem.out.println(name + \": \" + metadata.get(name));\n\t\t\t}\n\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\tAssert.fail();\n\t\t}\n\n\t}", "@Test\n public void testInfoParser() {\n Issues<Issue> warnings = new NagFortranParser().parse(openFile(\"NagFortranInfo.txt\"));\n\n assertSoftly(softly -> {\n softly.assertThat(warnings).hasSize(1);\n softly.assertThat(warnings).hasLowPrioritySize(1);\n\n Issue warning = warnings.get(0);\n softly.assertThat(warning)\n .hasFileName(\"C:/file1.inc\")\n .hasCategory(\"Info\")\n .hasPriority(Priority.LOW)\n .hasMessage(\"Unterminated last line of INCLUDE file\")\n .hasDescription(\"\")\n .hasPackageName(\"-\")\n .hasLineStart(1)\n .hasLineEnd(1)\n .hasColumnStart(0)\n .hasColumnEnd(0);\n });\n }", "public abstract List<EXIFContent> parse();", "private void setMetadata(XMLStreamReader reader, Model model) throws XMLStreamException {\n\t\tString dcNS = Namespaces.DUBLIN_CORE_NS_URI;\n\t\tString dcPfx = \"dc\";\n\t\t\n\t\t//reader positioned at <tags/>\n\t\tfor (int i = 0; i < reader.getAttributeCount(); i++) {\n\t\t\tString name = reader.getAttributeName(i).getLocalPart().toLowerCase();\n\t\t\tif(name.equals(\"title\")) {\n\t\t\t\tQName q = new QName(dcNS,\"Title\",dcPfx);\n\t\t\t\tmodel.getMetadata().add(q, reader.getAttributeValue(i));\n\t\t\t}else if(name.equals(\"artist\")) {\n\t\t\t\tQName q = new QName(dcNS,\"Creator\",dcPfx);\n\t\t\t\tmodel.getMetadata().add(q, reader.getAttributeValue(i));\n\t\t\t}else if(name.equals(\"year\")) {\n\t\t\t\tQName q = new QName(dcNS,\"Date\",dcPfx);\n\t\t\t\tmodel.getMetadata().add(q, reader.getAttributeValue(i));\n\t\t\t}else if(name.equals(\"uid\")) {\n\t\t\t\tQName q = new QName(dcNS,\"Identifier\",dcPfx);\n\t\t\t\tmodel.getMetadata().add(q, reader.getAttributeValue(i));\n\t\t\t}\t\t\n\t\t}\t\t\n\t\t//check if any <tag> children\n\t\twhile(reader.hasNext()) {\n\t\t\treader.next();\n\t\t\tif(reader.isEndElement() && reader.getLocalName().equals(\"tags\")) {\n\t\t\t\treturn;\n\t\t\t}else if(reader.isStartElement() && reader.getLocalName().equals(\"tag\")) {\n\t\t\t\tString name = \"\"; \n\t\t\t\tString value = \"\"; \n\t\t\t\tfor (int i = 0; i < reader.getAttributeCount(); i++) {\n\t\t\t\t\tString attrName = reader.getAttributeName(i).getLocalPart();\n\t\t\t\t\tif(attrName.equals(\"name\")) {\n\t\t\t\t\t\tname = reader.getAttributeValue(i).toLowerCase();\n\t\t\t\t\t}else if(attrName.equals(\"value\")) {\n\t\t\t\t\t\tvalue = reader.getAttributeValue(i);\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t\tif(name.length()>0&&value.length()>0) {\n\t\t\t\t\tif(name.equals(\"album\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Title\",dcPfx);\n\t\t\t\t\t\tmodel.getMetadata().add(q, value);\n\t\t\t\t\t}else if(name.equals(\"artist\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Creator\",dcPfx);\n\t\t\t\t\t\tmodel.getMetadata().add(q, value);\n\t\t\t\t\t}else if(name.equals(\"year\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Date\",dcPfx);\n\t\t\t\t\t\tmodel.getMetadata().add(q, value);\n\t\t\t\t\t}else if(name.equals(\"uid\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Identifier\",dcPfx);\n\t\t\t\t\t\tMetadataItem item = new MetadataItem(q,value);\n\t\t\t\t\t\titem.addAttribute(\"id\", \"uid\");\n\t\t\t\t\t\tmodel.getMetadata().add(item);\n\t\t\t\t\t}else if(name.equals(\"lang\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Language\",dcPfx);\n\t\t\t\t\t\tMetadataItem item = new MetadataItem(q,value);\n\t\t\t\t\t\tmodel.getMetadata().add(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\n\t}", "protected static LibMetaData createLibMetaData(LibMetaData lmd) {\n MetaData metaData = new MetaData();\r\n metaData.add(\"IsThing\", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"ImageSource\", \"Items\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Image\", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Number\", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n lmd.add(THING, metaData);\r\n \r\n metaData = new MetaData(lmd.get(\"thing\"));\r\n metaData.add(\"IsItem\", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"ImageSource\", \"Items\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Image\", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Name\", \"Thing\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"NameType\", new Integer(Description.NAMETYPE_NORMAL), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Z\", new Integer(Thing.Z_ITEM), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n lmd.add(ITEM, metaData);\r\n \r\n metaData = new MetaData(lmd.get(\"thing\"));\r\n metaData.add(\"IsBeing\",new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"ImageSource\", \"Creatures\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Image\", new Integer(340), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"IsMobile\",new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"IsBlocking\", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"MoveCost\", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"DeathDecoration\", \"blood pool\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"NameType\", new Integer(Description.NAMETYPE_NORMAL), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Z\", new Integer(Thing.Z_MOBILE), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n lmd.add(BEING, metaData);\r\n \r\n lmd = createEffectMetaData(lmd);\r\n lmd = createPoisonMetaData(lmd);\r\n lmd = createFoodMetaData(lmd);\r\n lmd = createScrollMetaData(lmd);\r\n lmd = createMissileMetaData(lmd);\r\n lmd = createRangedWeaponMetaData(lmd);\r\n lmd = createPotionMetaData(lmd);\r\n lmd = createWandMetaData(lmd);\r\n lmd = createRingMetaData(lmd);\r\n lmd = createCoinMetaData(lmd);\r\n lmd = createArmourMetaData(lmd);\r\n lmd = createWeaponMetaData(lmd);\r\n lmd = createSecretMetaData(lmd);\r\n lmd = createSpellBookMetaData(lmd);\r\n lmd = createChestMetaData(lmd);\r\n lmd = createDecorationMetaData(lmd);\r\n lmd = createSceneryMetaData(lmd);\r\n lmd = createPortalMetaData(lmd);\r\n lmd = createTrapMetaData(lmd);\r\n createMonsterMetaData(lmd);\r\n createPersonMetaData(lmd);\r\n return lmd;\r\n }", "final public void parse() throws ParseException {\n\t\tToken x = null;\n\t\tjj_consume_token(20);\n\t\tgetColumns(true);\n\t\tjj_consume_token(REFER);\n\n\t\tx = jj_consume_token(ID);\n\t\tm_refcatalog = x.image;\n\t\tjj_consume_token(21);\n\t\tx = jj_consume_token(ID);\n\t\tm_reftable = x.image;\n\t\tjj_consume_token(20);\n\t\tgetColumns(false);\n\t\tgetActions();\n\t}", "private void parseData() {\n\t\t\r\n\t}", "public void parse(String filename);", "private static void parseMETS() throws IOException, XMLStreamException {\r\n\r\n\t\tFile metsFile = new File(additionalDir, metsPath);\r\n\r\n\t\tif (!metsFile.exists()) {\r\n\t\t\tthrow new IOException(\"File does not exist. Current path is \"\r\n\t\t\t\t\t+ metsFile.getAbsolutePath());\r\n\t\t}\r\n\t\tString volumeID = extractVolumeIDFromFilePath(metsPath);\r\n\t\tXMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();\r\n\r\n\t\tvolumeRecord = new VolumeRecord(volumeID);\r\n\r\n\t\t// copyright is assumed to be public domain for all volumes\r\n\t\tvolumeRecord.setCopyright(CopyrightEnum.PUBLIC_DOMAIN);\r\n\r\n\t\tMETSParser metsParser = new METSParser(metsFile, volumeRecord,\r\n\t\t\t\txmlInputFactory);\r\n\t\tmetsParser.parse();\r\n\r\n\t\t// that's it. it is now parsed and the volumeRecord should be populated\r\n\t\t// by the parser\r\n\t\t// use volumeRecord to retrieve the information (see test cases on what\r\n\t\t// information is there)\r\n\r\n\t}", "public void parseHeader() {\n\t\tthis.release = (Integer) this.headerData.get(0);\n\t\tthis.endian = (ByteOrder) this.headerData.get(1);\n\t\tthis.K = (Short) this.headerData.get(2);\n\t\tthis.datasetLabel = (String) this.headerData.get(4);\n\t\tthis.datasetTimeStamp = (String) this.headerData.get(5);\n\t\tthis.mapOffset = (Integer) this.headerData.get(6);\n\t}", "public AnalysisMetadata parseFileToAnalysisMetadata(String filename) {\n\t\t\n\t\tAnalysisMetadata am = new AnalysisMetadata();\n\t\t\n\t\tRubyScript rs = new RubyScript(filename);\n\t\t\n\t\tam.setScript(rs);\n\t\t\t\t\n\t\tParameterDictionary pd = ParameterDictionary.emptyDictionary();\n\t\t\n\t\tParameter p = new Parameter(SCRIPT_FILENAME_PARAM, SCRIPT_FILENAME_PARAM, ParameterType.STRING_T, filename, null);\n\t\tpd.addParameter(p);\n\t\t\n\t\t\n\t\tam.setInputParameters(pd);\n\t\t\n\t\tScriptingContainer sc = new ScriptingContainer(org.jruby.embed.LocalContextScope.SINGLETHREAD, org.jruby.embed.LocalVariableBehavior.PERSISTENT);\n\t\tsc.setClassLoader(ij.IJ.getClassLoader());\n\t\tsc.put(\"parameters\", pd);\n\t\t\t\t\n\t\tsc.setCompatVersion(org.jruby.CompatVersion.RUBY1_9);\n\t\t\n\t\tsc.runScriptlet(this.getClass().getClassLoader().getResourceAsStream(SCRIPT_FUNCTIONS_FILE), SCRIPT_FUNCTIONS_FILE);\n\t\tsc.runScriptlet(rs.getScriptString());\n\t\t\n\t\tp = new Parameter(\"method_name\", \"method_name\", ParameterType.STRING_T, \"ScriptMethod\", null);\n\t\tpd.addIfNotSet(\"method_name\", p);\n\t\t\n\t\tam.setOutputParameters(new ParameterDictionary(pd));\n\t\t\n\t\treturn am;\n\t}", "protected abstract List<O> parseFileForObservations(Scanner scn);", "@SuppressWarnings(\"unchecked\")\n\tprivate void parseMetadata(String resp, String downloadUUID) throws DocumentException{\n\t\tSAXReader reader = new SAXReader();\n\t\treader.setStripWhitespaceText(true);\n\t\treader.setMergeAdjacentText(true);\n\t\tDocument document = reader.read(new StringReader(resp));\n\t\t\n\t\tMap<String, String> namespaceURIs=null;\n\t\ttry {\n\t\t\tnamespaceURIs = Namespaces.getNamespaces(resp);\n\t\t} catch (Exception e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te1.printStackTrace();\n\t\t}\n\t\t \n\t\tlog.info(\"Parsing Metadata\");\n\t\t\n\t\tServiceElements serviceElements = new ServiceElements();\n\t\tList<DatasetElements> dataSetList=new ArrayList<DatasetElements>();\n\n\t\tserviceElements.setTitle(getElement(ServiceXPaths.getXPath(ServiceXPaths.TITEL,namespaceURIs), namespaceURIs, document));\n\t\tserviceElements.setDesc(getElement(ServiceXPaths.getXPath(ServiceXPaths.DESC,namespaceURIs), namespaceURIs, document));\n\t\tserviceElements.setDateStamp(getElement(ServiceXPaths.getXPath(ServiceXPaths.DATE_STAMP,namespaceURIs), namespaceURIs, document));\n\t\tserviceElements.setRights(getElement(ServiceXPaths.getXPath(ServiceXPaths.RIGHTS,namespaceURIs), namespaceURIs, document));\n\t\tserviceElements.setLanguage(getElement(ServiceXPaths.getXPath(ServiceXPaths.LANGUAGE,namespaceURIs), namespaceURIs, document));\n\t\tserviceElements.setAuthorName(getElement(ServiceXPaths.getXPath(ServiceXPaths.AUTHOR_NAME,namespaceURIs), namespaceURIs, document));\n\t\tserviceElements.setAuthorMail(getElement(ServiceXPaths.getXPath(ServiceXPaths.AUTHOR_MAIL,namespaceURIs), namespaceURIs, document));\n\t\tserviceElements.setOrgName(getElement(ServiceXPaths.getXPath(ServiceXPaths.ORG_NAME,namespaceURIs), namespaceURIs, document));\n\t\tserviceElements.setBrowseGraphic(getElement(ServiceXPaths.getXPath(ServiceXPaths.BROWSE_GRAPHIC,namespaceURIs), namespaceURIs, document));\n\n\t\t XPath xPathKW = DocumentHelper.createXPath(ServiceXPaths.getXPath(ServiceXPaths.KEYWORDS,namespaceURIs));\n\t\t xPathKW.setNamespaceURIs(namespaceURIs);\n\t\t List<Node> asResultsNodesKW = xPathKW.selectNodes(document.getRootElement());\n\t\t List<String> keywords =new ArrayList<String>();\n\t\t for(int j=0;j<asResultsNodesKW.size();j++){\n\t\t\t keywords.add(asResultsNodesKW.get(j).getStringValue().replace(\"&\", \"&amp;\"));\n\t\t }\n\t\t serviceElements.setKeywords(keywords);\t\n\t\t \n\t\t XPath xPath2 = DocumentHelper.createXPath(ServiceXPaths.getXPath(ServiceXPaths.OPERATES_ON,namespaceURIs));\n\t\t xPath2.setNamespaceURIs(namespaceURIs);\n\n\t\t List<Node> asResultsNodes2 = xPath2.selectNodes(document.getRootElement());\t\t\n\n\t\t for(int i=0;i<asResultsNodes2.size();i++){\n\t\t\t \n\t\t\t DatasetElements dataSet=new DatasetElements();\n\t\t\t \t\t \n\t\t\t String respDS=CSWUtil.executeRequest(cswURL, asResultsNodes2.get(i).getText(), proxyHost, proxyPort);\n\t\t\t Document document2 = reader.read(new StringReader(respDS));\n\t\t\t namespaceURIs = Namespaces.getNamespaces(respDS);\n\t\t\t dataSet.setCodeUUID(getElement(DatasetXPaths.getXPath(DatasetXPaths.UUID,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setId(getElement(DatasetXPaths.getXPath(DatasetXPaths.FILE_ID,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setTitle(getElement(DatasetXPaths.getXPath(DatasetXPaths.TITLE,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setDesc(getElement(DatasetXPaths.getXPath(DatasetXPaths.DESC,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setDateStamp(getElement(DatasetXPaths.getXPath(DatasetXPaths.DATE_STAMP,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setRights(getElement(DatasetXPaths.getXPath(DatasetXPaths.RIGHTS,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setAuthorName(getElement(DatasetXPaths.getXPath(DatasetXPaths.AUTHOR_NAME,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setAuthorMail(getElement(DatasetXPaths.getXPath(DatasetXPaths.AUTHOR_MAIL,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setOrganisationName(getElement(DatasetXPaths.getXPath(DatasetXPaths.ORG_NAME,namespaceURIs), namespaceURIs, document2)); \n\t\t\t dataSet.setBBOXwest(getElement(DatasetXPaths.getXPath(DatasetXPaths.BBOX_WEST,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setBBOXeast(getElement(DatasetXPaths.getXPath(DatasetXPaths.BBOX_EAST,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setBBOXsouth(getElement(DatasetXPaths.getXPath(DatasetXPaths.BBOX_SOUTH,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setBBOXnorth(getElement(DatasetXPaths.getXPath(DatasetXPaths.BBOX_NORTH,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setType(getElement(DatasetXPaths.getXPath(DatasetXPaths.TYPE,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setLanguage(getElement(DatasetXPaths.getXPath(DatasetXPaths.LANGUAGE,namespaceURIs), namespaceURIs, document2));\n\t\t\t dataSet.setBrowseGraphic(getElement(DatasetXPaths.getXPath(DatasetXPaths.BROWSE_GRAPHIC,namespaceURIs), namespaceURIs, document2));\n\t\t\t \n\t\t\t List<String> dsURLList=new ArrayList<String>();\n\t\t\t List<String> dsDescriptionList=new ArrayList<String>();\n\t\t\t List<String> dsCodeListValueList=new ArrayList<String>();\n\t\t\t List<String> dsNameValueList=new ArrayList<String>();\n\t\t\t List<String> dsAppProfileValueList=new ArrayList<String>();\n\t\t\t \n\t\t\t \n\t\t\t XPath xPath8 = DocumentHelper.createXPath(DatasetXPaths.getXPath(DatasetXPaths.ONLINE_RESSOURCE,namespaceURIs));\n\t\t\t xPath8.setNamespaceURIs(namespaceURIs);\n\t\t\t List<Node> asResultsNodes8 = xPath8.selectNodes(document2.getRootElement());\n\t\t\t for(int j=0;j<asResultsNodes8.size();j++){\n\t\t\t\t XPath xPath9 = DocumentHelper.createXPath(DatasetXPaths.getXPath(DatasetXPaths.ONLINE_RESSOURCE_DESC_SUB,namespaceURIs));\n\t\t\t\t XPath xPath10 = DocumentHelper.createXPath(DatasetXPaths.getXPath(DatasetXPaths.ONLINE_RESSOURCE_URL_SUB,namespaceURIs));\n\t\t\t\t XPath xPath11 = DocumentHelper.createXPath(DatasetXPaths.getXPath(DatasetXPaths.ONLINE_RESSOURCE_CODE_SUB,namespaceURIs));\n\t\t\t\t //XPath xPath12 = DocumentHelper.createXPath(DatasetXLinks.getXPath(DatasetXPaths.ONLINE_RESSOURCE_PROTOCOL_SUB,namespaceURIs));\n\t\t\t\t XPath xPath13 = DocumentHelper.createXPath(DatasetXPaths.getXPath(DatasetXPaths.ONLINE_RESSOURCE_PROFILE_SUB,namespaceURIs));\n\t\t\t\t XPath xPath14 = DocumentHelper.createXPath(DatasetXPaths.getXPath(DatasetXPaths.ONLINE_RESSOURCE_NAME_SUB,namespaceURIs));\t\t\t\t\t\t \n\t\t\t\t \n\t\t\t\t xPath9.setNamespaceURIs(namespaceURIs);\n\t\t\t\t xPath10.setNamespaceURIs(namespaceURIs);\n\t\t\t\t xPath11.setNamespaceURIs(namespaceURIs);\n\t\t\t\t //xPath12.setNamespaceURIs(namespaceURIs);\n\t\t\t\t xPath13.setNamespaceURIs(namespaceURIs);\n\t\t\t\t xPath14.setNamespaceURIs(namespaceURIs);\n\t\t\t\t \n\t\t\t\t List<Node> asResultsNodes9 = xPath9.selectNodes(asResultsNodes8.get(j));\n\t\t\t\t List<Node> asResultsNodes10 = xPath10.selectNodes(asResultsNodes8.get(j));\n\t\t\t\t List<Node> asResultsNodes11 = xPath11.selectNodes(asResultsNodes8.get(j));\n\t\t\t\t //List<Node> asResultsNodes12 = xPath12.selectNodes(asResultsNodes8.get(j));\n\t\t\t\t List<Node> asResultsNodes13 = xPath13.selectNodes(asResultsNodes8.get(j));\n\t\t\t\t List<Node> asResultsNodes14 = xPath14.selectNodes(asResultsNodes8.get(j));\n\t\t\t\t \n\t\t\t\t String desc = \"\";\n\t\t\t\t String url =\"\";\n\t\t\t\t String code = \"\";\n\t\t\t\t //String protocol = \"\";\n\t\t\t\t String appProfile = \"\";\n\t\t\t\t String name = \"\";\n\t\t\t\t \n\t\t\t\t if(asResultsNodes9.size() > 0){\n\t\t\t\t\t desc =asResultsNodes9.get(0).getStringValue();\n\t\t\t\t }\n\t\t\t\t if(asResultsNodes10.size() > 0){\n\t\t\t\t\t url = asResultsNodes10.get(0).getStringValue();\n\t\t\t\t }\n\t\t\t\t if(asResultsNodes11.size() > 0){\n\t\t\t\t\t code =asResultsNodes11.get(0).getStringValue();\n\t\t\t\t }\n//\t\t\t\t\t if(asResultsNodes12.size() > 0l){\n//\t\t\t\t\t\t protocol =asResultsNodes12.get(0).getStringValue();\n//\t\t\t\t\t }\n\t\t\t\t if(asResultsNodes13.size() > 0){\n\t\t\t\t\t appProfile =asResultsNodes13.get(0).getStringValue();\n\t\t\t\t }\n\t\t\t\t if(asResultsNodes14.size() > 0){\n\t\t\t\t\t name =asResultsNodes14.get(0).getStringValue();\n\t\t\t\t }\n\t\t\t\t \t\t\t\t\t\t\t\t \n\t\t\t\t dsURLList.add(url.replaceAll(\"&\", \"&amp;\"));\n\t\t\t\t dsDescriptionList.add(desc.replaceAll(\"&\", \"&amp;\"));\n\t\t\t\t dsCodeListValueList.add(code.replaceAll(\"&\", \"&amp;\"));\n\t\t\t\t dsNameValueList.add(name.replaceAll(\"&\", \"&amp;\"));\n\t\t\t\t dsAppProfileValueList.add(appProfile.replaceAll(\"&\", \"&amp;\"));\n\n\t\t\t }\n\t\t\t dataSet.setURLList(dsURLList);\n\t\t\t dataSet.setDescriptionList(dsDescriptionList);\n\t\t\t dataSet.setCodeListValueList(dsCodeListValueList);\n\t\t\t dataSet.setNameList(dsNameValueList);\n\t\t\t dataSet.setAppProfileList(dsAppProfileValueList);\n\t\t\t \n\t\t\t dataSetList.add(dataSet);\n\t\t }\n\t\t \n\t\t writeFeed(serviceElements, dataSetList, downloadUUID);\n\t}", "private void parse() {\n if (getFields() == null) {\n List<? extends StructField> fieldRefs =\n ((StructObjectInspector)getInspector()).getAllStructFieldRefs();\n setFields(new LazyObject[fieldRefs.size()]);\n for (int i = 0; i < getFields().length; i++) {\n String hbaseColumnFamily = hbaseColumnFamilies.get(i);\n String hbaseColumnQualifier = hbaseColumnQualifiers.get(i);\n\n ObjectInspector fieldObjectInspector = fieldRefs.get(i).getFieldObjectInspector();\n if (hbaseColumnQualifier == null && !HBaseSerDe.isSpecialColumn(hbaseColumnFamily)) {\n // a column family\n getFields()[i] = new LazyHBaseCellMap(\n (LazyMapObjectInspector) fieldObjectInspector);\n continue;\n }\n if(fieldObjectInspector instanceof LazyListObjectInspector) {\n \tgetFields()[i] = new LazyJsonArray((LazyListObjectInspector)fieldObjectInspector);\n \tcontinue;\n }\n\n getFields()[i] = LazyFactory.createLazyObject(fieldRefs.get(i).getFieldObjectInspector());\n }\n setFieldInited(new boolean[getFields().length]);\n }\n Arrays.fill(getFieldInited(), false);\n setParsed(true);\n }", "ReleaseFile parse( InputStream is ) throws IOException;", "@Test\r\n\tpublic void test1() {\n\t\tFile jpegFile = new File(\"C:\\\\Users\\\\lefto\\\\Downloads\\\\flickr\\\\test2\\\\20170814-150511-6_36561788895_o_EDIT.jpg\");\r\n\t\tMetadata metadata;\r\n\t\ttry {\r\n\t\t\tmetadata = ImageMetadataReader.readMetadata(jpegFile);\r\n\t\t\tfor (Directory directory : metadata.getDirectories()) {\r\n\t\t\t\tfor (Tag tag : directory.getTags()) {\r\n\t\t\t\t\tSystem.out.println(tag);\r\n//\t\t\t\t\tSystem.out.println(tag.getDirectoryName() + \", \" + tag.getTagName() + \", \" + tag.getDescription());\r\n//\t\t\t\t\tif (tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)\r\n//\t\t\t\t\t\tSystem.out.println(tag);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (ImageProcessingException | IOException e) {\r\n\t\t\tthrow new RuntimeException(e);\r\n\t\t}\r\n\t}", "@Test\n public void testReadMetadataMaybeNull() throws IOException {\n // Just test that we can read the metadata without exceptions\n JPEGImageReader reader = createReader();\n\n for (TestData testData : getTestData()) {\n reader.setInput(testData.getInputStream());\n\n for (int i = 0; i < reader.getNumImages(true); i++) {\n try {\n IIOMetadata metadata = reader.getImageMetadata(i);\n assertNotNull(String.format(\"Image metadata null for %s image %s\", testData, i), metadata);\n }\n catch (IIOException e) {\n System.err.println(String.format(\"WARNING: Reading metadata failed for %s image %s: %s\", testData, i, e.getMessage()));\n }\n }\n }\n }", "protected void initFile(String id) throws FormatException, IOException {\n // normalize file name\n super.initFile(normalizeFilename(null, id));\n id = currentId;\n String dir = new File(id).getParent();\n\n // parse and populate OME-XML metadata\n String fileName = new Location(id).getAbsoluteFile().getAbsolutePath();\n RandomAccessInputStream ras = new RandomAccessInputStream(fileName);\n String xml;\n IFD firstIFD;\n try {\n TiffParser tp = new TiffParser(ras);\n firstIFD = tp.getFirstIFD();\n xml = firstIFD.getComment();\n }\n finally {\n ras.close();\n }\n\n if (service == null) setupService();\n OMEXMLMetadata meta;\n try {\n meta = service.createOMEXMLMetadata(xml);\n }\n catch (ServiceException se) {\n throw new FormatException(se);\n }\n\n hasSPW = meta.getPlateCount() > 0;\n\n for (int i=0; i<meta.getImageCount(); i++) {\n int sizeC = meta.getPixelsSizeC(i).getValue().intValue();\n service.removeChannels(meta, i, sizeC);\n }\n\n // TODO\n //Hashtable originalMetadata = meta.getOriginalMetadata();\n //if (originalMetadata != null) metadata = originalMetadata;\n\n LOGGER.trace(xml);\n\n if (meta.getRoot() == null) {\n throw new FormatException(\"Could not parse OME-XML from TIFF comment\");\n }\n\n String[] acquiredDates = new String[meta.getImageCount()];\n for (int i=0; i<acquiredDates.length; i++) {\n acquiredDates[i] = meta.getImageAcquiredDate(i);\n }\n\n String currentUUID = meta.getUUID();\n service.convertMetadata(meta, metadataStore);\n\n // determine series count from Image and Pixels elements\n int seriesCount = meta.getImageCount();\n core = new CoreMetadata[seriesCount];\n for (int i=0; i<seriesCount; i++) {\n core[i] = new CoreMetadata();\n }\n info = new OMETiffPlane[seriesCount][];\n\n tileWidth = new int[seriesCount];\n tileHeight = new int[seriesCount];\n\n // compile list of file/UUID mappings\n Hashtable<String, String> files = new Hashtable<String, String>();\n boolean needSearch = false;\n for (int i=0; i<seriesCount; i++) {\n int tiffDataCount = meta.getTiffDataCount(i);\n for (int td=0; td<tiffDataCount; td++) {\n String uuid = null;\n try {\n uuid = meta.getUUIDValue(i, td);\n }\n catch (NullPointerException e) { }\n String filename = null;\n if (uuid == null) {\n // no UUID means that TiffData element refers to this file\n uuid = \"\";\n filename = id;\n }\n else {\n filename = meta.getUUIDFileName(i, td);\n if (!new Location(dir, filename).exists()) filename = null;\n if (filename == null) {\n if (uuid.equals(currentUUID) || currentUUID == null) {\n // UUID references this file\n filename = id;\n }\n else {\n // will need to search for this UUID\n filename = \"\";\n needSearch = true;\n }\n }\n else filename = normalizeFilename(dir, filename);\n }\n String existing = files.get(uuid);\n if (existing == null) files.put(uuid, filename);\n else if (!existing.equals(filename)) {\n throw new FormatException(\"Inconsistent UUID filenames\");\n }\n }\n }\n\n // search for missing filenames\n if (needSearch) {\n Enumeration en = files.keys();\n while (en.hasMoreElements()) {\n String uuid = (String) en.nextElement();\n String filename = files.get(uuid);\n if (filename.equals(\"\")) {\n // TODO search...\n // should scan only other .ome.tif files\n // to make this work with OME server may be a little tricky?\n throw new FormatException(\"Unmatched UUID: \" + uuid);\n }\n }\n }\n\n // build list of used files\n Enumeration en = files.keys();\n int numUUIDs = files.size();\n HashSet fileSet = new HashSet(); // ensure no duplicate filenames\n for (int i=0; i<numUUIDs; i++) {\n String uuid = (String) en.nextElement();\n String filename = files.get(uuid);\n fileSet.add(filename);\n }\n used = new String[fileSet.size()];\n Iterator iter = fileSet.iterator();\n for (int i=0; i<used.length; i++) used[i] = (String) iter.next();\n\n // process TiffData elements\n Hashtable<String, IFormatReader> readers =\n new Hashtable<String, IFormatReader>();\n for (int i=0; i<seriesCount; i++) {\n int s = i;\n LOGGER.debug(\"Image[{}] {\", i);\n LOGGER.debug(\" id = {}\", meta.getImageID(i));\n\n String order = meta.getPixelsDimensionOrder(i).toString();\n\n PositiveInteger samplesPerPixel = null;\n if (meta.getChannelCount(i) > 0) {\n samplesPerPixel = meta.getChannelSamplesPerPixel(i, 0);\n }\n int samples = samplesPerPixel == null ? -1 : samplesPerPixel.getValue();\n int tiffSamples = firstIFD.getSamplesPerPixel();\n\n boolean adjustedSamples = false;\n if (samples != tiffSamples) {\n LOGGER.warn(\"SamplesPerPixel mismatch: OME={}, TIFF={}\",\n samples, tiffSamples);\n samples = tiffSamples;\n adjustedSamples = true;\n }\n\n if (adjustedSamples && meta.getChannelCount(i) <= 1) {\n adjustedSamples = false;\n }\n\n int effSizeC = meta.getPixelsSizeC(i).getValue().intValue();\n if (!adjustedSamples) {\n effSizeC /= samples;\n }\n if (effSizeC == 0) effSizeC = 1;\n if (effSizeC * samples != meta.getPixelsSizeC(i).getValue().intValue()) {\n effSizeC = meta.getPixelsSizeC(i).getValue().intValue();\n }\n int sizeT = meta.getPixelsSizeT(i).getValue().intValue();\n int sizeZ = meta.getPixelsSizeZ(i).getValue().intValue();\n int num = effSizeC * sizeT * sizeZ;\n\n OMETiffPlane[] planes = new OMETiffPlane[num];\n for (int no=0; no<num; no++) planes[no] = new OMETiffPlane();\n\n int tiffDataCount = meta.getTiffDataCount(i);\n boolean zOneIndexed = false;\n boolean cOneIndexed = false;\n boolean tOneIndexed = false;\n\n // pre-scan TiffData indices to see if any of them are indexed from 1\n\n for (int td=0; td<tiffDataCount; td++) {\n NonNegativeInteger firstC = meta.getTiffDataFirstC(i, td);\n NonNegativeInteger firstT = meta.getTiffDataFirstT(i, td);\n NonNegativeInteger firstZ = meta.getTiffDataFirstZ(i, td);\n int c = firstC == null ? 0 : firstC.getValue();\n int t = firstT == null ? 0 : firstT.getValue();\n int z = firstZ == null ? 0 : firstZ.getValue();\n\n if (c >= effSizeC) cOneIndexed = true;\n if (z >= sizeZ) zOneIndexed = true;\n if (t >= sizeT) tOneIndexed = true;\n }\n\n for (int td=0; td<tiffDataCount; td++) {\n LOGGER.debug(\" TiffData[{}] {\", td);\n // extract TiffData parameters\n String filename = null;\n String uuid = null;\n try {\n filename = meta.getUUIDFileName(i, td);\n } catch (NullPointerException e) {\n LOGGER.debug(\"Ignoring null UUID object when retrieving filename.\");\n }\n try {\n uuid = meta.getUUIDValue(i, td);\n } catch (NullPointerException e) {\n LOGGER.debug(\"Ignoring null UUID object when retrieving value.\");\n }\n NonNegativeInteger tdIFD = meta.getTiffDataIFD(i, td);\n int ifd = tdIFD == null ? 0 : tdIFD.getValue();\n NonNegativeInteger numPlanes = meta.getTiffDataPlaneCount(i, td);\n NonNegativeInteger firstC = meta.getTiffDataFirstC(i, td);\n NonNegativeInteger firstT = meta.getTiffDataFirstT(i, td);\n NonNegativeInteger firstZ = meta.getTiffDataFirstZ(i, td);\n int c = firstC == null ? 0 : firstC.getValue();\n int t = firstT == null ? 0 : firstT.getValue();\n int z = firstZ == null ? 0 : firstZ.getValue();\n\n // NB: some writers index FirstC, FirstZ and FirstT from 1\n if (cOneIndexed) c--;\n if (zOneIndexed) z--;\n if (tOneIndexed) t--;\n\n int index = FormatTools.getIndex(order,\n sizeZ, effSizeC, sizeT, num, z, c, t);\n int count = numPlanes == null ? 1 : numPlanes.getValue();\n if (count == 0) {\n core[s] = null;\n break;\n }\n\n // get reader object for this filename\n if (filename == null) {\n if (uuid == null) filename = id;\n else filename = files.get(uuid);\n }\n else filename = normalizeFilename(dir, filename);\n IFormatReader r = readers.get(filename);\n if (r == null) {\n r = new MinimalTiffReader();\n readers.put(filename, r);\n }\n\n Location file = new Location(filename);\n if (!file.exists()) {\n // if this is an absolute file name, try using a relative name\n // old versions of OMETiffWriter wrote an absolute path to\n // UUID.FileName, which causes problems if the file is moved to\n // a different directory\n filename =\n filename.substring(filename.lastIndexOf(File.separator) + 1);\n filename = dir + File.separator + filename;\n\n if (!new Location(filename).exists()) {\n filename = currentId;\n }\n }\n\n // populate plane index -> IFD mapping\n for (int q=0; q<count; q++) {\n int no = index + q;\n planes[no].reader = r;\n planes[no].id = filename;\n planes[no].ifd = ifd + q;\n planes[no].certain = true;\n LOGGER.debug(\" Plane[{}]: file={}, IFD={}\",\n new Object[] {no, planes[no].id, planes[no].ifd});\n }\n if (numPlanes == null) {\n // unknown number of planes; fill down\n for (int no=index+1; no<num; no++) {\n if (planes[no].certain) break;\n planes[no].reader = r;\n planes[no].id = filename;\n planes[no].ifd = planes[no - 1].ifd + 1;\n LOGGER.debug(\" Plane[{}]: FILLED\", no);\n }\n }\n else {\n // known number of planes; clear anything subsequently filled\n for (int no=index+count; no<num; no++) {\n if (planes[no].certain) break;\n planes[no].reader = null;\n planes[no].id = null;\n planes[no].ifd = -1;\n LOGGER.debug(\" Plane[{}]: CLEARED\", no);\n }\n }\n LOGGER.debug(\" }\");\n }\n\n if (core[s] == null) continue;\n\n // verify that all planes are available\n LOGGER.debug(\" --------------------------------\");\n for (int no=0; no<num; no++) {\n LOGGER.debug(\" Plane[{}]: file={}, IFD={}\",\n new Object[] {no, planes[no].id, planes[no].ifd});\n if (planes[no].reader == null) {\n LOGGER.warn(\"Image ID '{}': missing plane #{}. \" +\n \"Using TiffReader to determine the number of planes.\",\n meta.getImageID(i), no);\n TiffReader r = new TiffReader();\n r.setId(currentId);\n try {\n planes = new OMETiffPlane[r.getImageCount()];\n for (int plane=0; plane<planes.length; plane++) {\n planes[plane] = new OMETiffPlane();\n planes[plane].id = currentId;\n planes[plane].reader = r;\n planes[plane].ifd = plane;\n }\n num = planes.length;\n }\n finally {\n r.close();\n }\n }\n }\n LOGGER.debug(\" }\");\n\n // populate core metadata\n info[s] = planes;\n try {\n if (!info[s][0].reader.isThisType(info[s][0].id)) {\n info[s][0].id = currentId;\n }\n for (int plane=0; plane<info[s].length; plane++) {\n if (!info[s][plane].reader.isThisType(info[s][plane].id)) {\n info[s][plane].id = info[s][0].id;\n }\n }\n\n info[s][0].reader.setId(info[s][0].id);\n tileWidth[s] = info[s][0].reader.getOptimalTileWidth();\n tileHeight[s] = info[s][0].reader.getOptimalTileHeight();\n\n core[s].sizeX = meta.getPixelsSizeX(i).getValue().intValue();\n int tiffWidth = (int) firstIFD.getImageWidth();\n if (core[s].sizeX != tiffWidth) {\n LOGGER.warn(\"SizeX mismatch: OME={}, TIFF={}\",\n core[s].sizeX, tiffWidth);\n }\n core[s].sizeY = meta.getPixelsSizeY(i).getValue().intValue();\n int tiffHeight = (int) firstIFD.getImageLength();\n if (core[s].sizeY != tiffHeight) {\n LOGGER.warn(\"SizeY mismatch: OME={}, TIFF={}\",\n core[s].sizeY, tiffHeight);\n }\n core[s].sizeZ = meta.getPixelsSizeZ(i).getValue().intValue();\n core[s].sizeC = meta.getPixelsSizeC(i).getValue().intValue();\n core[s].sizeT = meta.getPixelsSizeT(i).getValue().intValue();\n core[s].pixelType = FormatTools.pixelTypeFromString(\n meta.getPixelsType(i).toString());\n int tiffPixelType = firstIFD.getPixelType();\n if (core[s].pixelType != tiffPixelType) {\n LOGGER.warn(\"PixelType mismatch: OME={}, TIFF={}\",\n core[s].pixelType, tiffPixelType);\n core[s].pixelType = tiffPixelType;\n }\n core[s].imageCount = num;\n core[s].dimensionOrder = meta.getPixelsDimensionOrder(i).toString();\n\n // hackish workaround for files exported by OMERO that have an\n // incorrect dimension order\n String uuidFileName = \"\";\n try {\n if (meta.getTiffDataCount(i) > 0) {\n uuidFileName = meta.getUUIDFileName(i, 0);\n }\n }\n catch (NullPointerException e) { }\n if (meta.getChannelCount(i) > 0 && meta.getChannelName(i, 0) == null &&\n meta.getTiffDataCount(i) > 0 &&\n uuidFileName.indexOf(\"__omero_export\") != -1)\n {\n core[s].dimensionOrder = \"XYZCT\";\n }\n\n core[s].orderCertain = true;\n PhotoInterp photo = firstIFD.getPhotometricInterpretation();\n core[s].rgb = samples > 1 || photo == PhotoInterp.RGB;\n if ((samples != core[s].sizeC && (samples % core[s].sizeC) != 0 &&\n (core[s].sizeC % samples) != 0) || core[s].sizeC == 1 ||\n adjustedSamples)\n {\n core[s].sizeC *= samples;\n }\n\n if (core[s].sizeZ * core[s].sizeT * core[s].sizeC >\n core[s].imageCount && !core[s].rgb)\n {\n if (core[s].sizeZ == core[s].imageCount) {\n core[s].sizeT = 1;\n core[s].sizeC = 1;\n }\n else if (core[s].sizeT == core[s].imageCount) {\n core[s].sizeZ = 1;\n core[s].sizeC = 1;\n }\n else if (core[s].sizeC == core[s].imageCount) {\n core[s].sizeT = 1;\n core[s].sizeZ = 1;\n }\n }\n\n if (meta.getPixelsBinDataCount(i) > 1) {\n LOGGER.warn(\"OME-TIFF Pixels element contains BinData elements! \" +\n \"Ignoring.\");\n }\n core[s].littleEndian = firstIFD.isLittleEndian();\n core[s].interleaved = false;\n core[s].indexed = photo == PhotoInterp.RGB_PALETTE &&\n firstIFD.getIFDValue(IFD.COLOR_MAP) != null;\n if (core[s].indexed) {\n core[s].rgb = false;\n }\n core[s].falseColor = true;\n core[s].metadataComplete = true;\n }\n catch (NullPointerException exc) {\n throw new FormatException(\"Incomplete Pixels metadata\", exc);\n }\n }\n\n // remove null CoreMetadata entries\n\n Vector<CoreMetadata> series = new Vector<CoreMetadata>();\n Vector<OMETiffPlane[]> planeInfo = new Vector<OMETiffPlane[]>();\n for (int i=0; i<core.length; i++) {\n if (core[i] != null) {\n series.add(core[i]);\n planeInfo.add(info[i]);\n }\n }\n core = series.toArray(new CoreMetadata[series.size()]);\n info = planeInfo.toArray(new OMETiffPlane[0][0]);\n\n MetadataTools.populatePixels(metadataStore, this, false, false);\n for (int i=0; i<acquiredDates.length; i++) {\n if (acquiredDates[i] != null) {\n metadataStore.setImageAcquiredDate(acquiredDates[i], i);\n }\n }\n metadataStore = getMetadataStoreForConversion();\n }", "protected abstract void parseFile(File f) throws IOException;", "private void readClassInfo() throws IOException, ClassFormatException {\n access_flags = dataInputStream.readUnsignedShort();\n /* Interfaces are implicitely abstract, the flag should be set\n * according to the JVM specification.\n */\n if ((access_flags & AccessFlag.INTERFACE) != 0) {\n access_flags |= AccessFlag.ABSTRACT;\n }\n if (((access_flags & AccessFlag.ABSTRACT) != 0)\n && ((access_flags & AccessFlag.FINAL) != 0)) {\n throw new ClassFormatException(\"Class \" + file_name + \" can't be both final and abstract\");\n }\n class_name_index = dataInputStream.readUnsignedShort();\n superclass_name_index = dataInputStream.readUnsignedShort();\n }", "public XMPMetadata parse(InputStream input) throws XmpParsingException,\n\tXmpSchemaException, XmpUnknownValueTypeException,\n\tXmpExpectedRdfAboutAttribute, XmpXpacketEndException,\n\tBadFieldValueException {\n\n\t\tbyte[] bos = getStreamAsByteArray(input);\n\t\treturn parse(bos);\n\t}", "public void parse(String fileName) throws Exception;", "public void grabarMetaDato (Vector c) throws IOException\r\n {\r\n // se supone que el archivo está recién creado y abierto\r\n \r\n // grabamos la cantidad de campos al inicio del archivo\r\n maestro.writeInt(c.size());\r\n \r\n // ahora grabamos los metadatos propiamente dichos\r\n for(int i = 0; i<c.size(); i++)\r\n {\r\n grabarMetaDato((Campo)c.get(i));\r\n }\r\n \r\n iniDatos = maestro.getFilePointer();\r\n }", "public IMetaCue[] readMetaCue();", "@Override\n\tpublic void parse() throws IOException {\n\t}", "public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)\n\t\tthrows IOException,SAXException,TikaException {\n\n\t\t// Get metadata\n\t\tthis.mdata = metadata;\n\n\t\t// Read in all text\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(stream));\n\t\tString line = reader.readLine();\n\t\tString text = \"\";\n\t\twhile (line != null) {\n\t\t\ttext += line;\n\t\t\tline = reader.readLine();\n\t\t}\n\t\treader.close();\n\n\t\ttry {\n\t\t\t// Get NER results from each NER toolkit.\n\t\t\tthis.openNLPEntities = this.openNLPParse(text);\t\n\t\t\tthis.coreNLPEntities = this.coreNLPParse(text);\t\n\t\t\tthis.nltkEntities = this.nltkParse(text);\n\t\t\tthis.gQMeasurements = this.gQParse(text);\n\n\t\t\t// Combine results and add to metadata.\n\t\t\tMap<String, Map<String,Integer>> combo = combineResults();\n\t\t\tString json = mapToJSON(combo);\n\t\t\tString openNLPJSON = mapToJSON(this.openNLPEntities);\n\t\t\tString coreNLPJSON = mapToJSON(this.coreNLPEntities);\n\t\t\tString nltkJSON = mapToJSON(this.nltkEntities);\n\t\t\tpushToMetadata(\"openNLP entities\", openNLPJSON);\n\t\t\tpushToMetadata(\"coreNLP entities\", coreNLPJSON);\n\t\t\tpushToMetadata(\"nltk entities\", nltkJSON);\n\t\t\tpushToMetadata(\"maxJointAgreement\",json);\n\t\t\tpushToMetadata(\"quantities\", this.gQMeasurements);\n\t\t\n\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static Facts parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {\r\n Facts object =\r\n new Facts();\r\n\r\n int event;\r\n java.lang.String nillableValue = null;\r\n java.lang.String prefix = \"\";\r\n java.lang.String namespaceuri = \"\";\r\n try {\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement())\r\n reader.next();\r\n\r\n\r\n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\", \"type\") != null) {\r\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\r\n \"type\");\r\n if (fullTypeName != null) {\r\n java.lang.String nsPrefix = null;\r\n if (fullTypeName.indexOf(\":\") > -1) {\r\n nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(\":\"));\r\n }\r\n nsPrefix = nsPrefix == null ? \"\" : nsPrefix;\r\n\r\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\") + 1);\r\n\r\n if (!\"Facts\".equals(type)) {\r\n //find namespace for the prefix\r\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\r\n return (Facts) ExtensionMapper.getTypeObject(\r\n nsUri, type, reader);\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n // Note all attributes that were handled. Used to differ normal attributes\r\n // from anyAttributes.\r\n java.util.List handledAttributes = new java.util.ArrayList();\r\n\r\n\r\n reader.next();\r\n\r\n java.util.ArrayList list1 = new java.util.ArrayList();\r\n\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n\r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\", \"fact\").equals(reader.getName())) {\r\n\r\n\r\n // Process the array and step past its final element's end.\r\n\r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\", \"nil\");\r\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)) {\r\n list1.add(null);\r\n reader.next();\r\n } else {\r\n list1.add(Fact.Factory.parse(reader));\r\n }\r\n //loop until we find a start element that is not part of this array\r\n boolean loopDone1 = false;\r\n while (!loopDone1) {\r\n // We should be at the end element, but make sure\r\n while (!reader.isEndElement())\r\n reader.next();\r\n // Step out of this element\r\n reader.next();\r\n // Step to next element event.\r\n while (!reader.isStartElement() && !reader.isEndElement())\r\n reader.next();\r\n if (reader.isEndElement()) {\r\n //two continuous end elements means we are exiting the xml structure\r\n loopDone1 = true;\r\n } else {\r\n if (new javax.xml.namespace.QName(\"\", \"fact\").equals(reader.getName())) {\r\n\r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\", \"nil\");\r\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)) {\r\n list1.add(null);\r\n reader.next();\r\n } else {\r\n list1.add(Fact.Factory.parse(reader));\r\n }\r\n } else {\r\n loopDone1 = true;\r\n }\r\n }\r\n }\r\n // call the converter utility to convert and set the array\r\n\r\n object.setFact((Fact[])\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(\r\n Fact.class,\r\n list1));\r\n\r\n } // End of if for expected property start element\r\n\r\n else {\r\n\r\n }\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement())\r\n reader.next();\r\n\r\n if (reader.isStartElement())\r\n // A start element we are not expecting indicates a trailing invalid property\r\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\r\n\r\n\r\n } catch (javax.xml.stream.XMLStreamException e) {\r\n throw new java.lang.Exception(e);\r\n }\r\n\r\n return object;\r\n }", "private void extractRemainingMetadata(ArticleMetadata thisAM,\n CachedUrl mdCu) {\n\n // Which top node is appropriate for this specific dtd\n String top_node = null;\n String dtdString = thisAM.getRaw(ElsevierDTD5XmlSchemaHelper.dataset_dtd_metadata);\n Matcher mat = DTD_PATTERN.matcher(dtdString);\n if (mat.matches() && JOURNAL_ARTICLE.equals(mat.group(1))) {\n top_node = JASchemaMap.get(mat.group(3));\n }\n //String top_node = SchemaMap.get(dtdString);\n if (top_node == null) {\n log.siteWarning(\"Unknown type of Elsevier DTD provided for article\" + dtdString);\n return; // we can't extract article level metadata (author & title)\n }\n try {\n List<ArticleMetadata> amList = \n new XPathXmlMetadataParser(null, \n top_node,\n ElsevierDTD5XmlSchemaHelper.articleLevelMDMap,\n false).extractMetadata(MetadataTarget.Any(), mdCu);\n /*\n * There should only be ONE top_node per main.xml; don't verify\n * but just access first one.\n */\n if (amList.size() > 0) {\n log.debug3(\"found article level metadata...\");\n ArticleMetadata oneAM = amList.get(0);\n String rawVal = oneAM.getRaw(ElsevierDTD5XmlSchemaHelper.common_title);\n if (rawVal != null) {\n thisAM.putRaw(ElsevierDTD5XmlSchemaHelper.common_title, rawVal);\n } else {\n // a simple-article might use document heading, like \"Book Review\" as title\n rawVal = oneAM.getRaw(ElsevierDTD5XmlSchemaHelper.common_dochead);\n if (rawVal != null) {\n // store it in the title anyway, it only exists if title doesn't\n thisAM.putRaw(ElsevierDTD5XmlSchemaHelper.common_title, rawVal);\n }\n }\n rawVal = oneAM.getRaw(ElsevierDTD5XmlSchemaHelper.common_author_group);\n if ( rawVal != null) {\n thisAM.putRaw(ElsevierDTD5XmlSchemaHelper.common_author_group, rawVal);\n }\n } else {\n log.debug3(\"no md extracted from \" + mdCu.getUrl());\n }\n } catch (XPathExpressionException e) {\n log.debug3(\"Xpath expression exception:\",e); // this is a note to the PLUGIN writer!\n } catch (IOException e) {\n // We going to keep going and just not extract from this file\n log.siteWarning(\"IO exception loading article level XML file\", e);\n } catch (SAXException e) {\n // We going to keep going and just not extract from this file\n log.siteWarning(\"SAX exception loading article level XML file\", e);\n } \n }", "private void processMetadataFromLoader() {\n\n int recordCount = mdi.readInt();\n\n long currentTime = System.currentTimeMillis();\n synchronized (entities) {\n clearOldTempIndexes(currentTime);\n\n for (int i = 0; i < recordCount; i++) {\n int tempIndex = mdi.readInt();\n assert DirectProtocol.isValidTempIndex(tempIndex);\n String symbol = mdi.readCharSequence().toString().intern();\n\n ConstantIdentityKey key;\n int entityIndex = entities.get(symbol, NOT_FOUND_VALUE);\n if (entityIndex == NOT_FOUND_VALUE) {\n entityIndex = entities.size();\n key = new ConstantIdentityKey(symbol);\n entities.put(key, entityIndex);\n } else {\n key = entities.getKeyObject(symbol);\n }\n\n // Note: key is guarantied to be same object as in \"entities\" field\n tempIndexes.put(tempIndex, key);\n\n sendMetadata(symbol, entityIndex);\n }\n if (recordCount > 0) {\n lastTempIndexAdded = currentTime;\n }\n }\n }", "com.cmpe275.grpcComm.MetaData getMetaData();", "public interface PCSMetadata {\n\n /* Met Fields */\n String APPLICATION_SUCCESS_FLAG = \"ApplicationSuccessFlag\";\n\n String ON_DISK = \"OnDisk\";\n\n String TAPE_LOCATION = \"TapeLocation\";\n\n String PRODUCTION_LOCATION = \"ProductionLocation\";\n\n String PRODUCTION_LOCATION_CODE = \"ProductionLocationCode\";\n\n String DATA_VERSION = \"DataVersion\";\n\n String DATA_PROVIDER = \"DataProvider\";\n\n String COLLECTION_LABEL = \"CollectionLabel\";\n\n String COMMENTS = \"Comments\";\n\n String EXECUTABLE_PATHNAMES = \"ExecutablePathnames\";\n\n String EXECUTABLE_VERSIONS = \"ExecutableVersions\";\n\n String PROCESSING_LEVEL = \"ProcessingLevel\";\n\n String JOB_ID = \"JobId\";\n\n String TASK_ID = \"TaskId\";\n\n String PRODUCTION_DATE_TIME = \"ProductionDateTime\";\n\n String INPUT_FILES = \"InputFiles\";\n\n String PGE_NAME = \"PGEName\";\n\n String OUTPUT_FILES = \"OutputFiles\";\n \n String TEST_TAG = \"TestTag\";\n\n String SUB_TEST_TAG = \"SubTestTag\";\n\n String TEST_LOCATION = \"TestLocation\";\n\n String TEST_COUNTER = \"TestCounter\";\n\n String TEST_DATE = \"TestDate\";\n \n String START_DATE_TIME = \"StartDateTime\";\n\n String END_DATE_TIME = \"EndDateTime\";\n\n}", "public void parseMXL() {\n try {\n unzipMXL();\n }\n catch(Exception e) {\n e.printStackTrace();\n }\n }", "public void parse(FileInfo file) throws FatalException \r\n\t{\r\n\t /** ChipDataParser parser deals with single file only. So just pick up \r\n\t * the first file name from the list of files*/\r\n\t String fileName = (String) file.getFiles().firstElement();\r\n\t \r\n\t Logger.log(\" Chip_data::parsing started \",Logger.INFO);\r\n\t\t\r\n\t\tinitTables();\r\n\t\tLogger.log(\"init table over\",Logger.INFO);\r\n\t\t\r\n\t\tcreateRecords();\r\n\t\tLogger.log(\"create record over \",Logger.INFO);\r\n\t\t\r\n\t\tcreateFileWriters(fileName);\r\n\t\tLogger.log(\"create file writers over \",Logger.INFO);\r\n\t\t\r\n\t\twriteMETADATA();\r\n\t\tLogger.log(\"Write metadata over \",Logger.INFO);\r\n\t\t\r\n\t\t/** This function will build the HashMap FieldIDTable containg the column names from \r\n\t\t * chipinformation table and will store them by assigning an ID for each */\r\n\t\tbuildFieldTable();\r\n\t\t\r\n\t\t/** This function will set the fieldIndexArray based on the file format. The probeset id\r\n\t\t * will be default first field and description will be default last field*/ \r\n\t\tpopulateFieldArray();\r\n\t\t\r\n\t\t/** Get the chipname from the first line.*/\r\n\t\tString chipname = \"\";\r\n\t\tString organism = \"\";\r\n\t\ttry \r\n\t\t{\r\n\t\t\t/** Get the first line of the chip library file. This should be the chip name and species entry.*/\r\n\t\t\tm_line = getNextRecord();\r\n\t\t\tif (m_line != null)\r\n\t\t\t{\r\n\t\t\t\tStringTokenizer sTok = new StringTokenizer(m_line,\"\\t\");\r\n\t\t\t\t/** Check whether the correct data is found on the first line */\r\n\t\t\t\tif(sTok.countTokens() >= 2)\r\n\t\t\t\t{\r\n\t\t\t\t\tchipname = sTok.nextToken();\r\n\t\t\t\t}\r\n\t\t\t\tif(sTok.hasMoreTokens())\r\n\t\t\t\t{\r\n\t\t\t\t\torganism = sTok.nextToken();\r\n\t\t\t\t}\r\n\t\t\t\tLogger.log(\"Read chipname \" + chipname + \" from file\",Logger.INFO);\r\n\t\t\t\tLogger.log(\"Read organism \" + organism + \" from file\",Logger.INFO);\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (IOException ioex)\r\n\t\t{\r\n\t\t\tLogger.log(ioex.getMessage(),Logger.DEBUG);\r\n\t\t\tthrow new FatalException(ioex.getMessage());\r\n\t\t}\r\n\t\t\r\n\t\t/** This variable stores chiptypeid for the current chip*/\r\n\t\tint chipTypeID = -1; \r\n\t\t\r\n\t\t/** Parse the Chipinformation data*/\r\n\t\ttry \r\n\t\t{\r\n\t\t\twhile ( (m_line = getNextRecord()) != null)\r\n\t\t\t{\r\n\t\t\t\t/** break the line into record fields. It will populate baseRecord which will have the\r\n\t\t\t\t * values as parsed from the current line*/\r\n\t\t\t\tboolean isSuccess = parseLine();\r\n\t\t\t\tif (true == isSuccess)\r\n\t\t\t\t{\r\n\t\t\t\t\t/** Get chiptypeID corresponding to the chipname from chiptypes table\r\n\t\t\t\t\t* chipTypeId is -1 for the first line (initially). So this\r\n\t\t\t\t\t* query is done only for the firstline in the file.*/\r\n\t\t\t\t\tif(-1 == chipTypeID)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t/** lookup the chiptypeid in the chiptypes table.*/\r\n\t\t\t\t\t\tchipTypeID = m_dbManager.getChipTypeID(chipname.toUpperCase());\r\n\t\t\t\t\t\t/** if no entry for chipname is found 0 is returned then that chip's entry is added\r\n\t\t\t\t\t\t * to the chiptypes table with next chiptype id and the information from the hesder in \r\n\t\t\t\t\t\t * the chip library file */\r\n\t\t\t\t\t\tif(0 == chipTypeID)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tLogger.log(\"Chip not found in ChipTypes table :\" + chipname,Logger.WARNING);\r\n\t\t\t\t\t\t\t/** Here the information from current chip library file's first line will \r\n\t\t\t\t\t\t\t * be used to add record in chiptypes table.*/\r\n\t\t\t\t\t\t\tchipTypeID = m_dbManager.addChipName(chipname,organism);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tLogger.log(\"ChiptypeID found \" + chipTypeID,Logger.INFO);\r\n\t\t\t\t\t\t\t/** check how many records with the chiptypeid exist in the chipinformation table.*/\r\n\t\t\t\t\t\t\tint count = m_dbManager.getChipTypeIDCount(chipTypeID);\r\n\t\t\t\t\t\t\t/** If count is > 0 then the chip already exists then the processing will not\r\n\t\t\t\t\t\t\t * be continued. */\r\n\t\t\t\t\t\t\tif(count>0)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tLogger.log(\"Chip already exists: \"+\tchipname.toUpperCase(),\tLogger.WARNING);\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t/** replace the chipname in baserecord by chiptypeid for current chipname as in chiptypes table */\r\n\t\t\t\t\tbaseRecord.fields[0].setLength(0);\r\n\t\t\t\t\tbaseRecord.fields[0].append(chipTypeID);\r\n\t\t\t\t\t\r\n\t\t\t\t\t/**write the Chip record to database*/\r\n\t\t\t\t\ttry\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t/** if organism is being read then convert it to local taxonomy id.*/\r\n\t\t\t\t\t\tString orgName = \"\"; \r\n\t\t\t\t\t\tif(!baseRecord.fields[4].toString().equals(\"\"))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\torgName = (String)Variables.hmOrganismLocalId.get(baseRecord.fields[4].toString());\r\n\t\t\t\t\t\t\tbaseRecord.fields[4].setLength(0);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbaseRecord.fields[4].append(orgName);\r\n\t\t\t\t\t\twriteRecordToDb(Constants.chipTableName, baseRecord);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcatch(InsertException ie)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tLogger.log(\"Invalid record found in the Chip library \" + chipname + \". Rolling back chip.\",Logger.WARNING);\r\n\t\t\t\t\t\tm_dbManager.rollbackChip(chipTypeID);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbaseRecord.resetAllFields();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t/** parseLine failed so rollback chip*/\r\n\t\t\t\t\tLogger.log(\"Rolling back chip due to parsing problems:\" + chipname,Logger.WARNING);\r\n\t\t\t\t\tm_dbManager.rollbackChip(chipTypeID);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (IOException ioex) \r\n\t\t{\r\n\t\t\tLogger.log(ioex.getMessage(),Logger.DEBUG);\r\n\t\t\tthrow new FatalException(ioex.getMessage());\r\n\t\t}\r\n\t\tLogger.log(\" ChiData parsing over \",Logger.INFO);\r\n\r\n\t}", "Map<String, Object> getAllMetadata();", "protected CFMetaData getCFMetaData(String ks, String cf, Cassandra.Client client)\n throws NotFoundException,\n org.apache.cassandra.thrift.InvalidRequestException,\n TException,\n org.apache.cassandra.exceptions.InvalidRequestException,\n ConfigurationException\n {\n KsDef ksDef = client.describe_keyspace(ks);\n for (CfDef cfDef : ksDef.cf_defs)\n {\n if (cfDef.name.equalsIgnoreCase(cf))\n return ThriftConversion.fromThrift(cfDef);\n }\n return null;\n }", "private void getMetadata() {\n masterRoot = AbstractMetadata.getAbstractedMetadata(sourceProduct);\n masterMetadata = new MetadataDoris(masterRoot);\n masterOrbit = new OrbitsDoris();\n masterOrbit.setOrbit(masterRoot);\n \n // SLAVE METADATA\n // hash table or just map for slaves - now it supports only a single sourceSlave image\n slaveRoot = sourceProduct.getMetadataRoot().getElement(AbstractMetadata.SLAVE_METADATA_ROOT).getElementAt(0);\n slaveMetadata = new MetadataDoris(slaveRoot);\n slaveOrbit = new OrbitsDoris();\n slaveOrbit.setOrbit(slaveRoot);\n }", "private void parseSchemaDescription(PDFAExtensionSchema schema,\n\t\t\tXMPMetadata metadata) throws XMLStreamException,\n\t\t\tXmpParsingException, XmpUnknownValueTypeException,\n\t\t\tBadFieldValueException {\n\t\texpectCurrentLocalName(\"li\");\n\t\tSchemaDescription desc = schema.createSchemaDescription();\n\t\tint type = reader.get().nextTag();\n\t\twhile (type == XMLStreamReader.START_ELEMENT) {\n\t\t\tif (reader.get().getLocalName().equals(\"schema\")\n\t\t\t\t\t|| reader.get().getLocalName().equals(\"namespaceURI\")\n\t\t\t\t\t|| reader.get().getLocalName().equals(\"prefix\")) {\n\t\t\t\ttry {\n\t\t\t\t\t// System.out.println(reader.get().getPrefix()+\";\"+reader.get().getLocalName()+\";\"+reader.get().getElementText());\n\t\t\t\t\tdesc.addProperty(new TextType(metadata, reader.get()\n\t\t\t\t\t\t\t.getPrefix(), reader.get().getLocalName(), reader\n\t\t\t\t\t\t\t.get().getElementText()));\n\t\t\t\t} catch (IllegalArgumentException e) {\n\t\t\t\t\tthrow new XmpPropertyFormatException(\n\t\t\t\t\t\t\t\"Unexpected value for '\"\n\t\t\t\t\t\t\t\t\t+ reader.get().getLocalName()\n\t\t\t\t\t\t\t\t\t+ \"' property\");\n\t\t\t\t}\n\t\t\t} else if (reader.get().getLocalName().equals(\"property\")) {\n\t\t\t\tparsePropertyDefinition(desc);\n\t\t\t} else if (reader.get().getLocalName().equals(\"valueType\")) {\n\t\t\t\tparseValueTypeDefinition(desc, metadata);\n\n\t\t\t} else {\n\t\t\t\tthrow new XmpUnexpectedElementException(\n\t\t\t\t\t\t\"Unexpected property definition in one of PDF/A Extension schemas description\");\n\t\t\t}\n\t\t\ttype = reader.get().nextTag();\n\t\t}\n\t\tschema.addSchemaDescription(desc);\n\t\tnsMap.setNamespaceDefinition(desc);\n\n\t}", "public static Vector<Metadata> ReadingMetadata(File file){\n\t\tVector<Metadata> v = new Vector<Metadata>(); \n\t\ttry {\n\t\t\tObjectInputStream input = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));\n\t\t\tv = (Vector<Metadata>)input.readObject();\n\t\t\tinput.close();\n\t\t} catch(ClassNotFoundException e) {\n\t\t\tSystem.out.println(\"List Not Found\");\n\t\t\te.printStackTrace();\n\t\t} catch(IOException e) {\n\t\t\tSystem.out.println(\"Error of I/O\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn v;\n\t}", "public GracenoteMetadata(final GracenoteWebAPI api, Document xml) {\r\n\t\tfinal Element root = xml.getDocumentElement();\r\n\r\n\t\tfinal NodeList nl = root.getElementsByTagName(\"ALBUM\");\r\n\t\tfor (int i = 0; i < nl.getLength(); i++) {\r\n\t\t\tElement e = (Element) nl.item(i);\r\n\r\n\t\t\t// Album data map\r\n\t\t\tfinal Map<String, Object> albumData = new HashMap<String, Object>();\r\n\r\n\t\t\t// If there's no GOET data, do a fetch to get the full information\r\n\t\t\t// instead.\r\n\t\t\tif (_getTextValue(e, \"ARTIST_ORIGIN\") == null) {\r\n\t\t\t\txml = api.fetchAlbumWithoutParsing(_getTextValue(e, \"GN_ID\"));\r\n\t\t\t\tif (xml == null) {\r\n\t\t\t\t\tLogging.log(\"[GRACE]\\tno gracenote match\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\te = xml.getDocumentElement();\r\n\t\t\t}\r\n\r\n\t\t\t// Album metadata\r\n\t\t\talbumData.put(\"album_gnid\", _getTextValue(e, \"GN_ID\"));\r\n\t\t\talbumData.put(\"album_artist_name\", _getTextValue(e, \"ARTIST\"));\r\n\t\t\talbumData.put(\"album_title\", _getTextValue(e, \"TITLE\"));\r\n\t\t\talbumData.put(\"album_year\", _getTextValue(e, \"DATE\"));\r\n\t\t\talbumData.put(\"genre\", _getOETData(e, \"GENRE\"));\r\n\t\t\talbumData.put(\"track_count\", _getTextValue(e, \"TRACK_COUNT\"));\r\n\t\t\talbumData.put(\"album_coverart\", _getAttribElement(e, \"URL\", \"TYPE\", \"COVERART\"));\r\n\r\n\t\t\t// Artist metadata\r\n\t\t\talbumData.put(\"artist_image_url\", _getAttribElement(e, \"URL\", \"TYPE\", \"ARTIST_IMAGE\"));\r\n\t\t\talbumData.put(\"artist_bio_url\", _getAttribElement(e, \"URL\", \"TYPE\", \"ARTIST_BIOGRAPHY\"));\r\n\t\t\talbumData.put(\"review_url\", _getAttribElement(e, \"URL\", \"TYPE\", \"ARTIST_REVIEW\"));\r\n\r\n\t\t\t// Artist OET metadata\r\n\t\t\talbumData.put(\"artist_era\", _getOETData(e, \"ARTIST_ERA\"));\r\n\t\t\talbumData.put(\"artist_type\", _getOETData(e, \"ARTIST_TYPE\"));\r\n\t\t\talbumData.put(\"artist_origin\", _getOETData(e, \"ARTIST_ORIGIN\"));\r\n\r\n\t\t\tfinal int trackCount = e.getElementsByTagName(\"TRACK\").getLength();\r\n\r\n\t\t\t// Parse track metadata if there is any.\r\n\t\t\tfor (int j = 0; j < trackCount; j++) {\r\n\t\t\t\tfinal Element trackElement = (Element) e.getElementsByTagName(\"TRACK\").item(j);\r\n\r\n\t\t\t\tfinal String title = _getTextValue(trackElement, \"TITLE\");\r\n\t\t\t\tfinal String search = api.getSearchedTrack();\r\n\t\t\t\tfinal boolean success = title.contains(search) || search.contains(title) || Levenshtein.distance(search, title) <= 0.1 * title.length();\r\n\t\t\t\tif (!success) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\talbumData.put(\"track_number\", _getTextValue(trackElement, \"TRACK_NUM\"));\r\n\t\t\t\talbumData.put(\"track_gn_id\", _getTextValue(trackElement, \"GN_ID\"));\r\n\t\t\t\talbumData.put(\"track_title\", title);\r\n\t\t\t\talbumData.put(\"track_artist_name\", _getTextValue(trackElement, \"ARTIST\"));\r\n\r\n\t\t\t\talbumData.put(\"mood\", _getOETData(trackElement, \"MOOD\"));\r\n\t\t\t\talbumData.put(\"tempo\", _getOETData(trackElement, \"TEMPO\"));\r\n\r\n\t\t\t\t// If track level GOET data exists, overwrite metadata from\r\n\t\t\t\t// album.\r\n\t\t\t\tif (trackElement.getElementsByTagName(\"GENRE\").getLength() > 0) {\r\n\t\t\t\t\talbumData.put(\"genre\", _getOETData(trackElement, \"GENRE\"));\r\n\t\t\t\t}\r\n\t\t\t\tif (trackElement.getElementsByTagName(\"ARTIST_ERA\").getLength() > 0) {\r\n\t\t\t\t\talbumData.put(\"artist_era\", _getOETData(trackElement, \"ARTIST_ERA\"));\r\n\t\t\t\t}\r\n\t\t\t\tif (trackElement.getElementsByTagName(\"ARTIST_TYPE\").getLength() > 0) {\r\n\t\t\t\t\talbumData.put(\"artist_type\", _getOETData(trackElement, \"ARTIST_TYPE\"));\r\n\t\t\t\t}\r\n\t\t\t\tif (trackElement.getElementsByTagName(\"ARTIST_ORIGIN\").getLength() > 0) {\r\n\t\t\t\t\talbumData.put(\"artist_origin\", _getOETData(trackElement, \"ARTIST_ORIGIN\"));\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t_data.add(albumData);\r\n\t\t}\r\n\t}", "void parse_ciff (int offset, int length)\n{\n int tboff, nrecs, c, type, len, save, wbi=-1;\n int key[] = new int[2];\n key[0] = 0x410;\n key[1] = 0x45f3;\n\n CTOJ.fseek (ifp, offset+length-4, CTOJ.SEEK_SET);\n tboff = get4() + offset;\n CTOJ.fseek (ifp, tboff, CTOJ.SEEK_SET);\n nrecs = get2();\n if (nrecs > 100) return;\n while (nrecs-- != 0) {\n type = get2();\n len = get4();\n save = CTOJ.ftell(ifp) + 4;\n CTOJ.fseek (ifp, offset+get4(), CTOJ.SEEK_SET);\n if ((((type >> 8) + 8) | 8) == 0x38)\n parse_ciff (CTOJ.ftell(ifp), len);\t/* Parse a sub-table */\n\n if (type == 0x0810)\n Uc.fread (artist, 64, 1, ifp);\n if (type == 0x080a) {\n Uc.fread (make, 64, 1, ifp);\n CTOJ.fseek (ifp, Uc.strlen(make) - 63, CTOJ.SEEK_CUR);\n Uc.fread (model, 64, 1, ifp);\n }\n if (type == 0x1810) {\n CTOJ.fseek (ifp, 12, CTOJ.SEEK_CUR);\n flip = get4();\n }\n if (type == 0x1835)\t\t\t/* Get the decoder table */\n tiff_compress = get4();\n if (type == 0x2007) {\n thumb_offset = CTOJ.ftell(ifp);\n thumb_length = len;\n }\n if (type == 0x1818) {\n get4();\n shutter = (float)Math.pow (2, -int_to_float((get4())));\n aperture = (float)Math.pow (2, int_to_float(get4())/2);\n }\n if (type == 0x102a) {\n get4();\n iso_speed = (float)Math.pow (2, (get2())/32.0 - 4) * 50;\n get2();\n aperture = (float)Math.pow (2, ((short)get2())/64.0);\n shutter = (float)Math.pow (2,-((short)get2())/32.0);\n get2();\n wbi = (get2());\n if (wbi > 17) wbi = 0;\n CTOJ.fseek (ifp, 32, CTOJ.SEEK_CUR);\n if (shutter > 1e6) shutter = (float)get2()/10.0f;\n }\n if (type == 0x102c) {\n if (get2() > 512) {\t\t/* Pro90, G1 */\n\tCTOJ.fseek (ifp, 118, CTOJ.SEEK_CUR);\n\tfor ( c=0; c<4;c++) cam_mul[c ^ 2] = get2();\n } else {\t\t\t\t/* G2, S30, S40 */\n\tCTOJ.fseek (ifp, 98, CTOJ.SEEK_CUR);\n\tfor ( c=0; c<4;c++) cam_mul[c ^ (c >> 1) ^ 1] = get2();\n }\n }\n if (type == 0x0032) {\n if (len == 768) {\t\t\t/* EOS D30 */\n\tCTOJ.fseek (ifp, 72, CTOJ.SEEK_CUR);\n\tfor ( c=0; c<4;c++) cam_mul[c ^ (c >> 1)] = 1024.0f / get2();\n\tif ( wbi==0 ) cam_mul[0] = -1;\t/* use my auto white balance */\n } else if ( cam_mul[0] == 0.0) {\n\tif (get2() == key[0]) {\t\t/* Pro1, G6, S60, S70 */\n CharPtr chaine = null;\n if (Uc.strstr(model,\"Pro1\") != null)\n\t chaine = new CharPtr(\"012346000000000000\");\n else\n chaine = new CharPtr(\"01345:000000006008\");\n c = chaine.charAt(wbi)-'0'+ 2;\n }\n\telse {\t\t\t\t/* G3, G5, S45, S50 */\n CharPtr chaine = new CharPtr(\"023457000000006000\");\n\t c = chaine.charAt(wbi)-'0';\n\t key[0] = key[1] = 0;\n\t}\n\tCTOJ.fseek (ifp, 78 + c*8, CTOJ.SEEK_CUR);\n\tfor ( c=0; c<4;c++) cam_mul[c ^ (c >> 1) ^ 1] = get2() ^ key[c & 1];\n\tif (wbi == 0) cam_mul[0] = -1;\n }\n }\n if (type == 0x10a9) {\t\t/* D60, 10D, 300D, and clones */\n if (len > 66) {\n CharPtr chaine = new CharPtr(\"0134567028\");\n wbi = chaine.charAt(wbi)-'0';\n }\n CTOJ.fseek (ifp, 2 + wbi*8, CTOJ.SEEK_CUR);\n for ( c=0; c<4;c++) cam_mul[c ^ (c >> 1)] = get2();\n }\n if (type == 0x1030 && (0x18040 >> wbi & 1) != 0)\n ciff_block_1030();\t\t/* all that don't have 0x10a9 */\n if (type == 0x1031) {\n get2();\n raw_width = (get2());\n raw_height = get2();\n }\n if (type == 0x5029) {\n focal_len = len >> 16;\n if ((len & 0xffff) == 2) focal_len /= 32;\n }\n if (type == 0x5813) flash_used = int_to_float(len);\n if (type == 0x5814) canon_ev = int_to_float(len);\n if (type == 0x5817) shot_order = len;\n if (type == 0x5834) unique_id = len;\n if (type == 0x580e) timestamp = len;\n if (type == 0x180e) timestamp = get4();\n /*\n#ifdef LOCALTIME\n if ((type | 0x4000) == 0x580e)\n timestamp = mktime (gmtime (&timestamp));\n#endif\n */\n CTOJ.fseek (ifp, save, CTOJ.SEEK_SET);\n }\n}", "public Iterable<SequenceInformation> extractMetadata(ExtractionContext extractionContext) throws SQLException;", "public TSETInfoTables parseXml(String fileName) { \n\t\ttry { \n\t\t\tDocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); \n\t\t\tDocumentBuilder db = dbf.newDocumentBuilder(); \n\t\t\tDocument document = db.parse(fileName); \n\t\t\tNodeList TSETInfoTablesNodeList = document.getChildNodes(); \n\t\t\tNode TSETInfoTablesNode = TSETInfoTablesNodeList.item(0); \n\t\t\t//if (!columnNode.hasChildNodes()) continue;\n\t\t\t\n\t\t\t// pojo\n\t\t\tTSETInfoTables infoTables = new TSETInfoTables();\n\t\t\tList<MetaDB> metaDBList = new ArrayList<MetaDB>();\n\t\t\t//infoTables.setMetaDBList(metaDBList);\n\t\t\t\n\t\t\tNodeList metaDBNodeList = TSETInfoTablesNode.getChildNodes();\n\t\t\tfor (int i = 0; i < metaDBNodeList.getLength(); i++) { \n\t\t\t\tNode metaDBNode = metaDBNodeList.item(i);\n\t\t\t\t// tackle the CRLF character, otherwise it will be treated as a empty node.\n\t\t\t\tif (!metaDBNode.hasChildNodes()) continue;\n\t\t\t\tMetaDB metaDB = new MetaDB();\n\t\t\t\t//metaDBList.add(metaDB);\n\t\t\t\tthis.parseMetaDBAttribute(metaDBNode, metaDB);\n\t\t\t\tList<Table> tableList = new ArrayList<Table>();\n\t\t\t\t//metaDB.setTableList(tableList);\n\t\t\t\t\n\t\t\t\tNodeList tableNodeList = metaDBNode.getChildNodes(); \n\t\t\t\tfor (int j = 0; j < tableNodeList.getLength(); j++) { \n\t\t\t\t\tNode tableNode = tableNodeList.item(j); \n\t\t\t\t\tif (!tableNode.hasChildNodes()) continue;\n\t\t\t\t\tTable table = new Table();\n\t\t\t\t\t//tableList.add(table);\n\t\t\t\t\tthis.parseTableAttribute(tableNode, table);\n\t\t\t\t\tList<Column> columnList = new ArrayList<Column>();\n\t\t\t\t\t//table.setColumnList(columnList);\n\t\t\t\t\t\n\t\t\t\t\tNodeList columnNodeList = tableNode.getChildNodes(); \n\t\t\t\t\tfor (int k = 0; k < columnNodeList.getLength(); k++) { \n\t\t\t\t\t\tNode columnNode = columnNodeList.item(k);\n\t\t\t\t\t\tif (!columnNode.hasChildNodes()) continue;\n\t\t\t\t\t\t//this.parseAttribute(columnNode);\n\t\t\t\t\t\tColumn column = new Column();\n\t\t\t\t\t\t//columnList.add(column);\n\t\t\t\t\t\tthis.parseColumnAttribute(columnNode, column);\n\t\t\t\t\t\t\n\t\t\t\t\t\tNodeList columnContentNodeList = columnNode.getChildNodes();\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor(int m = 0; m < columnContentNodeList.getLength(); m++) {\n\t\t\t\t\t\t\t//Node columnContent = columnContentList.item(m);\n\t\t\t\t\t\t\tNode columnContentNode = columnContentNodeList.item(m);\n\t\t\t\t\t\t\t// The CRLF character will be treated as a node, so using IF.\n\t\t\t\t\t\t\tif (columnContentNode.hasChildNodes()) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (columnContentNode.getNodeName().equals(\"columnName\")) {\n\t\t\t\t\t\t\t\t\tcolumn.setName(columnContentNode.getTextContent());\n\t\t\t\t\t\t\t\t} else if (columnContentNode.getNodeName().equals(\"columnType\")) {\n\t\t\t\t\t\t\t\t\tcolumn.setType(columnContentNode.getTextContent());\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tlogger.error(\"unknown column content.\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcolumnList.add(column);\n\t\t\t\t\t} \n\t\t\t\t\ttable.setColumnList(columnList);\n\t\t\t\t\ttableList.add(table);\n\t\t\t\t\tlogger.info(j + \" table tackled.\");\n\t\t\t\t} \n\t\t\t\tmetaDB.setTableList(tableList);\n\t\t\t\tmetaDBList.add(metaDB);\n\t\t\t\tlogger.info(i + \" metaDB tackled.\");\n\t\t\t} \n\t\t\tinfoTables.setMetaDBList(metaDBList);\n\t\t\tlogger.info(\"Parse XML success.\");\n\t\t\treturn infoTables;\n\t\t} catch (FileNotFoundException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (ParserConfigurationException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (SAXException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (IOException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} \n\t\treturn null;\n\t}", "@Test\n public void testParseCDM1() {\n final String ex = \"/ccsds/cdm/CDMExample1.txt\";\n\n // Initialize the parser\n final CdmParser parser = new ParserBuilder().buildCdmParser();\n\n final DataSource source = new DataSource(ex, () -> getClass().getResourceAsStream(ex));\n\n // Generated CDM file\n final Cdm file = parser.parseMessage(source);\n\n // Verify general data\n Assertions.assertEquals(IERSConventions.IERS_2010, file.getConventions());\n Assertions.assertEquals(DataContext.getDefault(), file.getDataContext());\n\n // Check Header Block\n Assertions.assertEquals(1.0, file.getHeader().getFormatVersion(), 1.0e-10);\n Assertions.assertEquals(new AbsoluteDate(2010, 3, 12, 22, 31, 12,\n TimeScalesFactory.getUTC()), file.getHeader().getCreationDate());\n Assertions.assertEquals(\"JSPOC\", file.getHeader().getOriginator());\n Assertions.assertEquals(\"201113719185\", file.getHeader().getMessageId());\n\n // OBJECT1\n // Check Relative Metadata Block\n Assertions.assertEquals(new AbsoluteDate(2010, 3, 13, 22, 37, 52.618,\n TimeScalesFactory.getUTC()), file.getRelativeMetadata().getTca());\n Assertions.assertEquals(715.0, file.getRelativeMetadata().getMissDistance(), DISTANCE_PRECISION);\n\n // Check Metadata Block\n Assertions.assertEquals(\"OBJECT1\", file.getMetadataObject1().getObject());\n Assertions.assertEquals(\"12345\", file.getMetadataObject1().getObjectDesignator());\n Assertions.assertEquals(\"SATCAT\", file.getMetadataObject1().getCatalogName());\n Assertions.assertEquals(\"SATELLITE A\", file.getMetadataObject1().getObjectName());\n Assertions.assertEquals(\"1997−030E\", file.getMetadataObject1().getInternationalDes());\n Assertions.assertEquals(\"EPHEMERIS SATELLITE A\", file.getMetadataObject1().getEphemName());\n Assertions.assertEquals(CovarianceMethod.CALCULATED, file.getMetadataObject1().getCovarianceMethod());\n Assertions.assertEquals(Maneuvrable.YES, file.getMetadataObject1().getManeuverable());\n Assertions.assertEquals(CelestialBodyFrame.EME2000,\n file.getMetadataObject1().getRefFrame().asCelestialBodyFrame());\n Assertions.assertEquals(\"UTC\", file.getMetadataObject1().getTimeSystem().name());\n\n // Check data block\n // State vector block\n Assertions.assertEquals(2570.097065e3, file.getDataObject1().getStateVectorBlock().getPositionVector().getX(),\n DISTANCE_PRECISION);\n Assertions.assertEquals(2244.654904e3, file.getDataObject1().getStateVectorBlock().getPositionVector().getY(),\n DISTANCE_PRECISION);\n Assertions.assertEquals(6281.497978e3, file.getDataObject1().getStateVectorBlock().getPositionVector().getZ(),\n DISTANCE_PRECISION);\n Assertions.assertEquals(4.418769571e3, file.getDataObject1().getStateVectorBlock().getVelocityVector().getX(),\n DERIVATION_PRECISION);\n Assertions.assertEquals(4.833547743e3, file.getDataObject1().getStateVectorBlock().getVelocityVector().getY(),\n DERIVATION_PRECISION);\n Assertions.assertEquals(-3.526774282e3, file.getDataObject1().getStateVectorBlock().getVelocityVector().getZ(),\n DERIVATION_PRECISION);\n // Covariance Matrix block\n Assertions.assertEquals(4.142e1, file.getDataObject1().getRTNCovarianceBlock().getCrr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(-8.579, file.getDataObject1().getRTNCovarianceBlock().getCtr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(2.533e3, file.getDataObject1().getRTNCovarianceBlock().getCtt(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(-2.313e1, file.getDataObject1().getRTNCovarianceBlock().getCnr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(1.336e1, file.getDataObject1().getRTNCovarianceBlock().getCnt(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(7.098e1, file.getDataObject1().getRTNCovarianceBlock().getCnn(),\n COVARIANCE_DIAG_PRECISION);\n\n Assertions.assertEquals(2.520e-3, file.getDataObject1().getRTNCovarianceBlock().getCrdotr(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-5.476, file.getDataObject1().getRTNCovarianceBlock().getCrdott(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(8.626e-4, file.getDataObject1().getRTNCovarianceBlock().getCrdotn(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(5.744e-3, file.getDataObject1().getRTNCovarianceBlock().getCrdotrdot(),\n COVARIANCE_PRECISION);\n\n Assertions.assertEquals(-1.006e-2, file.getDataObject1().getRTNCovarianceBlock().getCtdotr(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(4.041e-3, file.getDataObject1().getRTNCovarianceBlock().getCtdott(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.359e-3, file.getDataObject1().getRTNCovarianceBlock().getCtdotn(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.502e-5, file.getDataObject1().getRTNCovarianceBlock().getCtdotrdot(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(1.049e-5, file.getDataObject1().getRTNCovarianceBlock().getCtdottdot(),\n COVARIANCE_PRECISION);\n\n Assertions.assertEquals(1.053e-3, file.getDataObject1().getRTNCovarianceBlock().getCndotr(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-3.412e-3, file.getDataObject1().getRTNCovarianceBlock().getCndott(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(1.213e-2, file.getDataObject1().getRTNCovarianceBlock().getCndotn(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-3.004e-6, file.getDataObject1().getRTNCovarianceBlock().getCndotrdot(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.091e-6, file.getDataObject1().getRTNCovarianceBlock().getCndottdot(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(5.529e-5, file.getDataObject1().getRTNCovarianceBlock().getCndotndot(),\n COVARIANCE_PRECISION);\n\n Assertions.assertEquals(2.520e-3, file.getDataObject1().getRTNCovarianceBlock().\n getRTNCovarianceMatrix().getEntry(3, 0), COVARIANCE_PRECISION);\n Assertions.assertEquals(Double.NaN, file.getDataObject1().getRTNCovarianceBlock().\n getRTNCovarianceMatrix().getEntry(7, 6), COVARIANCE_PRECISION);\n\n\n\n // OBJECT2\n // Check Relative Metadata Block\n Assertions.assertEquals(file.getSegments().get(1).getMetadata().getRelativeMetadata().getTca(),\n file.getRelativeMetadata().getTca());\n Assertions.assertEquals(file.getSegments().get(1).getMetadata().getRelativeMetadata().getMissDistance(),\n file.getRelativeMetadata().getMissDistance(), DISTANCE_PRECISION);\n\n // Check Metadata Block\n Assertions.assertEquals(\"OBJECT2\", file.getMetadataObject2().getObject());\n Assertions.assertEquals(\"30337\", file.getMetadataObject2().getObjectDesignator());\n Assertions.assertEquals(\"SATCAT\", file.getMetadataObject2().getCatalogName());\n Assertions.assertEquals(\"FENGYUN 1C DEB\", file.getMetadataObject2().getObjectName());\n Assertions.assertEquals(\"1999-025AA\", file.getMetadataObject2().getInternationalDes());\n Assertions.assertEquals(\"NONE\", file.getMetadataObject2().getEphemName());\n Assertions.assertEquals(CovarianceMethod.CALCULATED, file.getMetadataObject2().getCovarianceMethod());\n Assertions.assertEquals(Maneuvrable.NO, file.getMetadataObject2().getManeuverable());\n Assertions.assertEquals(CelestialBodyFrame.EME2000,\n file.getMetadataObject2().getRefFrame().asCelestialBodyFrame());\n Assertions.assertEquals(\"UTC\", file.getMetadataObject2().getTimeSystem().name());\n\n // Check data block\n Assertions.assertEquals(2569.540800e3, file.getDataObject2().getStateVectorBlock().getPositionVector().getX(),\n DISTANCE_PRECISION);\n Assertions.assertEquals(2245.093614e3, file.getDataObject2().getStateVectorBlock().getPositionVector().getY(),\n DISTANCE_PRECISION);\n Assertions.assertEquals(6281.599946e3, file.getDataObject2().getStateVectorBlock().getPositionVector().getZ(),\n DISTANCE_PRECISION);\n Assertions.assertEquals(-2.888612500e3, file.getDataObject2().getStateVectorBlock().getVelocityVector().getX(),\n DERIVATION_PRECISION);\n Assertions.assertEquals(-6.007247516e3, file.getDataObject2().getStateVectorBlock().getVelocityVector().getY(),\n DERIVATION_PRECISION);\n Assertions.assertEquals(3.328770172e3, file.getDataObject2().getStateVectorBlock().getVelocityVector().getZ(),\n DERIVATION_PRECISION);\n // Covariance Matrix block\n Assertions.assertEquals(1.337e3, file.getDataObject2().getRTNCovarianceBlock().getCrr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(-4.806e4, file.getDataObject2().getRTNCovarianceBlock().getCtr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(2.492e6, file.getDataObject2().getRTNCovarianceBlock().getCtt(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(-3.298e1, file.getDataObject2().getRTNCovarianceBlock().getCnr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(-7.5888e2, file.getDataObject2().getRTNCovarianceBlock().getCnt(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(7.105e1, file.getDataObject2().getRTNCovarianceBlock().getCnn(),\n COVARIANCE_DIAG_PRECISION);\n\n Assertions.assertEquals(2.591e-3, file.getDataObject2().getRTNCovarianceBlock().getCrdotr(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-4.152e-2, file.getDataObject2().getRTNCovarianceBlock().getCrdott(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.784e-6, file.getDataObject2().getRTNCovarianceBlock().getCrdotn(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(6.886e-5, file.getDataObject2().getRTNCovarianceBlock().getCrdotrdot(),\n COVARIANCE_PRECISION);\n\n Assertions.assertEquals(-1.016e-2, file.getDataObject2().getRTNCovarianceBlock().getCtdotr(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.506e-4, file.getDataObject2().getRTNCovarianceBlock().getCtdott(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(1.637e-3, file.getDataObject2().getRTNCovarianceBlock().getCtdotn(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-2.987e-6, file.getDataObject2().getRTNCovarianceBlock().getCtdotrdot(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(1.059e-5, file.getDataObject2().getRTNCovarianceBlock().getCtdottdot(),\n COVARIANCE_PRECISION);\n\n Assertions.assertEquals(4.400e-3, file.getDataObject2().getRTNCovarianceBlock().getCndotr(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(8.482e-3, file.getDataObject2().getRTNCovarianceBlock().getCndott(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(8.633e-5, file.getDataObject2().getRTNCovarianceBlock().getCndotn(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.903e-6, file.getDataObject2().getRTNCovarianceBlock().getCndotrdot(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-4.594e-6, file.getDataObject2().getRTNCovarianceBlock().getCndottdot(),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(5.178e-5, file.getDataObject2().getRTNCovarianceBlock().getCndotndot(),\n COVARIANCE_PRECISION);\n // Test in the matrix\n Assertions.assertEquals(1.337e3, file.getDataObject2().getRTNCovarianceBlock().getCrr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(-4.806e4, file.getDataObject2().getRTNCovarianceBlock().getCtr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(2.492e6, file.getDataObject2().getRTNCovarianceBlock().getCtt(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(-3.298e1, file.getDataObject2().getRTNCovarianceBlock().getCnr(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(-7.5888e2, file.getDataObject2().getRTNCovarianceBlock().getCnt(),\n COVARIANCE_DIAG_PRECISION);\n Assertions.assertEquals(7.105e1, file.getDataObject2().getRTNCovarianceBlock().getCnn(),\n COVARIANCE_DIAG_PRECISION);\n\n Assertions.assertEquals(2.591e-3,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(3, 0),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-4.152e-2,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(3, 1),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.784e-6,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(3, 2),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(6.886e-5,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(3, 3),\n COVARIANCE_PRECISION);\n\n Assertions.assertEquals(-1.016e-2,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(4, 0),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.506e-4,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(4, 1),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(1.637e-3,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(4, 2),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-2.987e-6,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(4, 3),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(1.059e-5,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(4, 4),\n COVARIANCE_PRECISION);\n\n Assertions.assertEquals(4.400e-3,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(5, 0),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(8.482e-3,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(5, 1),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(8.633e-5,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(5, 2),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-1.903e-6,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(5, 3),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(-4.594e-6,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(5, 4),\n COVARIANCE_PRECISION);\n Assertions.assertEquals(5.178e-5,\n file.getDataObject2().getRTNCovarianceBlock().getRTNCovarianceMatrix().getEntry(5, 5),\n COVARIANCE_PRECISION);\n\n }", "public void loadHackerFile(HackerFile hf) {\n \n resetVariables();\n \n // should I load the description, etc from the HF? Should I even save it in the HF? I don't see any reason.\n this.name = hf.getName();\n\n HashMap content = hf.getContent();\n \n // <specialAttribute1><name><value><short_desc><long_desc>\n HashMap special1 = hf.getSpecial(1);\n HashMap special2 = hf.getSpecial(2);\n \n String a1 = (String)special1.get(\"name\");\n\t\tString v1 = (String)special1.get(\"value\");\n\t\tif(v1.equals(\"\")){\n\t\t\tv1 = \"0\";\n\t\t}\n float value = (new Float(\"\" + v1)).floatValue();\n if (a1.equals(\"emptyPettyCash()fail\")) {\n this.pettyCashFailPct = value;\n } else if (a1.equals(\"emptyPettyCash()reduce\")) {\n this.pettyCashReducePct = 1.0f-value;\n } else if (a1.equals(\"stealFile()fail\")) {\n this.stealFileFailPct = value;\n } else if (a1.equals(\"changeDailyPay()fail\")) {\n this.dailyPayChangeFailPct = value;\n } else if (a1.equals(\"changeDailyPay()reduce\")) {\n this.dailyPayChangeReducePct = 1.0f-value;\n } else if (a1.equals(\"installScript()fail\")) {\n this.installScriptFailPct = value;\n }\n \n String a2 = (String)special2.get(\"name\");\n\t\tString v2 = (String)special2.get(\"value\");\n\t\tif(v2.equals(\"\")){\n\t\t\tv2 = \"0\";\n\t\t}\n value = (new Float(\"\" + v2)).floatValue();\n if (a2.equals(\"emptyPettyCash()fail\")) {\n this.pettyCashFailPct = value;\n } else if (a2.equals(\"emptyPettyCash()reduce\")) {\n this.pettyCashReducePct = value;\n } else if (a2.equals(\"stealFile()fail\")) {\n this.stealFileFailPct = value;\n } else if (a2.equals(\"changeDailyPay()fail\")) {\n this.dailyPayChangeFailPct = value;\n } else if (a2.equals(\"changeDailyPay()reduce\")) {\n this.dailyPayChangeReducePct = value;\n } else if (a2.equals(\"installScript()fail\")) {\n this.installScriptFailPct = value;\n }\n \n // damage modifiers for this specific firewall\n this.bankDamageModifier = (new Float(\"\" + content.get(\"bank_damage_modifier\")).floatValue());\n this.redirectDamageModifier = (new Float(\"\" + content.get(\"redirect_damage_modifier\")).floatValue());\n this.attackDamageModifier = (new Float(\"\" + content.get(\"attack_damage_modifier\")).floatValue());\n this.ftpDamageModifier = (new Float(\"\" + content.get(\"ftp_damage_modifier\")).floatValue());\n this.httpDamageModifier = (new Float(\"\" + content.get(\"http_damage_modifier\")).floatValue());\n \n // attack back value for this firewall\n\t\tif(content.get(\"attack_damage\") == null){\n\t\t\tcontent.put(\"attack_damage\",\"0\");\n\t\t}\n this.attackDamage = (new Float(\"\" + content.get(\"attack_damage\"))).floatValue(); // how much attack damage does this firewall do back\n\t\t\n this.equipLevel = (int)(float)(new Float(\"\" + content.get(\"equip_level\"))).floatValue();\n this.cpuCost = hf.getCPUCost();\n\t\tif(name.equals(\"\")){\n\t\t\tname = (String)content.get(\"name\");\n\t\t}\n this.hackerFile = hf;\n }", "protected void populateObjectMetadata(CosHttpResponse response, ObjectMetadata metadata) {\n for (Entry<String, String> header : response.getHeaders().entrySet()) {\n String key = header.getKey();\n if (StringUtils.beginsWithIgnoreCase(key, Headers.COS_USER_METADATA_PREFIX)) {\n key = key.substring(Headers.COS_USER_METADATA_PREFIX.length());\n metadata.addUserMetadata(key, header.getValue());\n } else if (ignoredHeaders.contains(key)) {\n // ignore...\n } else if (key.equalsIgnoreCase(Headers.LAST_MODIFIED)) {\n try {\n metadata.setHeader(key, DateUtils.parseRFC822Date(header.getValue()));\n } catch (Exception pe) {\n log.warn(\"Unable to parse last modified date: \" + header.getValue(), pe);\n }\n } else if (key.equalsIgnoreCase(Headers.CONTENT_LENGTH)) {\n try {\n metadata.setHeader(key, Long.parseLong(header.getValue()));\n } catch (NumberFormatException nfe) {\n log.warn(\"Unable to parse content length: \" + header.getValue(), nfe);\n }\n } else if (key.equalsIgnoreCase(Headers.DELETE_MARKER)) {\n metadata.setDeleteMarker(Boolean.parseBoolean(header.getValue()));\n } else if (key.equalsIgnoreCase(Headers.ETAG)) {\n metadata.setETag(StringUtils.removeQuotes(header.getValue()));\n } else if (key.equalsIgnoreCase(Headers.EXPIRES)) {\n try {\n metadata.setHttpExpiresDate(DateUtils.parseRFC822Date(header.getValue()));\n } catch (Exception pe) {\n log.warn(\"Unable to parse http expiration date: \" + header.getValue(), pe);\n }\n } else if (key.equalsIgnoreCase(Headers.EXPIRATION)) {\n new ObjectExpirationHeaderHandler<ObjectMetadata>().handle(metadata, response);\n } else if (key.equalsIgnoreCase(Headers.RESTORE)) {\n new ObjectRestoreHeaderHandler<ObjectRestoreResult>().handle(metadata, response);\n } else if (key.equalsIgnoreCase(Headers.FILE_MODE_DIR)) { // used for merge bucket\n metadata.setFileModeDir(true);\n } else {\n metadata.setHeader(key, header.getValue());\n }\n }\n }", "public abstract void parse() throws IOException;", "public static Hashtable<String, Vector<String>> getMetaData3(String tablename) {\n\t\tHashtable<String, Vector<String>> temp = new Hashtable<String, Vector<String>>();\n\t\tBufferedReader fileReader = null;\n\t\tString[] array;\n\n\t\ttry {\n\t\t\tString l = \"\";\n\t\t\tfileReader = new BufferedReader(new FileReader(\"src/main/resources/metadata.csv\"));\n\t\t\twhile ((l = fileReader.readLine()) != null) {\n\t\t\t\tVector<String> v = new Vector<>();\n\t\t\t\tarray = l.split(\",\");\n\t\t\t\tif (array[0].equals(tablename)) {\n\t\t\t\t\tv.add(array[5]);\n\t\t\t\t\tv.add(array[6]);\n\t\t\t\t\ttemp.put(array[1], v);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (FileNotFoundException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te1.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn temp;\n\t}", "private void extractMetadata(String identifier)\r\n {\r\n\r\n if (isStringNull(identifier)) { throw new IllegalArgumentException(String.format(\r\n Messagesl18n.getString(\"ErrorCodeRegistry.GENERAL_INVALID_ARG_NULL\"), \"Nodeidentifier\")); }\r\n\r\n try\r\n {\r\n UrlBuilder url = new UrlBuilder(OnPremiseUrlRegistry.getActionQueue(session));\r\n url.addParameter(OnPremiseConstant.PARAM_ASYNC, true);\r\n // Log.d(\"URL\", url.toString());\r\n\r\n // prepare json data\r\n JSONObject jo = new JSONObject();\r\n jo.put(OnPremiseConstant.ACTIONEDUPONNODE_VALUE, NodeRefUtils.getCleanIdentifier(identifier));\r\n jo.put(OnPremiseConstant.ACTIONDEFINITIONNAME_VALUE, OnPremiseConstant.ACTION_EXTRACTMETADATA_VALUE);\r\n\r\n final JsonDataWriter formData = new JsonDataWriter(jo);\r\n\r\n // send and parse\r\n Response response = post(url, formData.getContentType(), new Output()\r\n {\r\n public void write(OutputStream out) throws IOException\r\n {\r\n formData.write(out);\r\n }\r\n }, ErrorCodeRegistry.DOCFOLDER_GENERIC);\r\n\r\n if (response.getResponseCode() == HttpStatus.SC_OK)\r\n {\r\n // Log.d(TAG, \"Metadata extraction : ok\");\r\n }\r\n }\r\n catch (Exception e)\r\n {\r\n Log.e(TAG, \"Metadata extraction : KO\");\r\n }\r\n }", "public ArticleMetadata extract(MetadataTarget target, CachedUrl cu)\n throws IOException {\n if (cu == null) {\n throw new IllegalArgumentException(\"null CachedUrl\");\n }\n ArticleMetadata am = new ArticleMetadata();\n\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n DocumentBuilder builder;\n try {\n dbf.setValidating(false);\n dbf.setFeature(\"http://xml.org/sax/features/namespaces\", false);\n dbf.setFeature(\"http://xml.org/sax/features/validation\", false);\n dbf.setFeature(\"http://apache.org/xml/features/nonvalidating/load-dtd-grammar\", false);\n dbf.setFeature(\"http://apache.org/xml/features/nonvalidating/load-external-dtd\", false); \n builder = dbf.newDocumentBuilder();\n } catch (ParserConfigurationException ex) {\n log.warning(ex.getMessage());\n return am;\n }\n if (!cu.hasContent()) {\n return am;\n }\n InputSource bReader = new InputSource(cu.openForReading());\n Document doc;\n try {\n doc = builder.parse(bReader);\n } catch (SAXException ex) {\n log.warning(ex.getMessage());\n return am;\n } finally {\n IOUtil.safeClose(bReader.getCharacterStream());\n }\n\n // search for values using specified XPath expressions and\n // set raw value using string based on type of node value \n for (int i = 0; i < xpathKeys.length; i++) { \n try {\n QName type = nodeValues[i].getType();\n Object result = xpathExprs[i].evaluate(doc, XPathConstants.NODESET);\n NodeList nodeList = (NodeList)result;\n for (int j = 0; j < nodeList.getLength(); j++) {\n Node node = nodeList.item(j);\n if (node == null) {\n continue;\n }\n String value = null;\n if (type == XPathConstants.NODE) {\n // filter node\n value = nodeValues[i].getValue(node);\n } else if (type == XPathConstants.STRING) {\n // filter node text content\n String text = node.getTextContent();\n if (!StringUtil.isNullString(text)) {\n value = nodeValues[i].getValue(text);\n }\n } else if (type == XPathConstants.BOOLEAN) {\n // filter boolean value of node text content\n String text = node.getTextContent();\n if (!StringUtil.isNullString(text)) {\n value = nodeValues[i].getValue(Boolean.parseBoolean(text));\n }\n } else if (type == XPathConstants.NUMBER) {\n // filter number value of node text content\n try {\n String text = node.getTextContent();\n if (!StringUtil.isNullString(text)) {\n NumberFormat format = NumberFormat.getInstance();\n value = nodeValues[i].getValue(format.parse(text));\n }\n } catch (ParseException ex) {\n // ignore invalid number\n log.debug3(ex.getMessage());\n }\n } else {\n log.debug(\"Unknown nodeValue type: \" + type.toString());\n }\n \n if (!StringUtil.isNullString(value)) {\n am.putRaw(xpathKeys[i], value);\n }\n }\n } catch (XPathExpressionException ex) {\n // ignore evaluation errors\n log.warning(\"ignorning xpath error\", ex);\n }\n }\n\n return am;\n }", "public static ArrayList<Metadata> getMetadata() {\n\t\tmetadata.add(new Metadata(\"id\", \"Numero identificativo del lavoro\", \"long\"));\n\t\tmetadata.add(new Metadata(\"role\", \"Ruolo lavorativo\", \"String\"));\n\t\tmetadata.add(new Metadata(\"cname\", \"Nome dell'azienda\", \"String\"));\n\t\tmetadata.add(new Metadata(\"etype\", \"Tipo di impiego\", \"String\"));\n\t\tmetadata.add(new Metadata(\"location\", \"Luogo\", \"String\"));\n\t\tmetadata.add(new Metadata(\"remote\", \"Lavoro a distanza\", \"Bool\"));\n\t\t\n\n\t\treturn metadata;\n\t}", "public static void extractMetadata(POIFSFileSystem poiFileSystem, Map container) {\n\t\tSummaryInformation summary = getSummaryInformation(poiFileSystem);\n\t\tif (summary != null) {\n\t\t\tcopyString(summary.getTitle(), DATA.title, container);\n\t\t\tcopyString(summary.getSubject(), DATA.subject, container);\n\t\t\tcopyString(summary.getComments(), DATA.description, container);\n\t\t\tcopyString(summary.getApplicationName(), DATA.generator, container);\n\t\t\tcopyString(summary.getAuthor(), DATA.creator, container);\n\t\t\tcopyString(summary.getLastAuthor(), DATA.creator, container);\n\n\t\t\tcopyDate(summary.getCreateDateTime(), DATA.created, container);\n\t\t\tcopyDate(summary.getLastSaveDateTime(), DATA.date, container);\n\n\t\t\tint nrPages = summary.getPageCount();\n\t\t\tif (nrPages > 1) {\n\t\t\t\t// '0' means 'unknown' according to POI's API (<sigh>)\n\t\t\t\t// '1' is often erroneously returned and can thus not be trusted\n\t\t\t\t// higher values tend to be right (not seen a counter example yet) and are\n\t\t\t\t// therefore included\n\t\t\t\tcontainer.put(DATA.pageCount, new Integer(nrPages));\n\t\t\t}\n\n\t\t\tcontainer.put(DATA.keywords, summary.getKeywords());\n\t\t}\n\t}", "private static void initMetadataContext(SessionState state)\n\t{\n\t\t// define MetadataSets map\n\t\tList metadataGroups = (List) state.getAttribute(STATE_METADATA_GROUPS);\n\t\tif(metadataGroups == null)\n\t\t{\n\t\t\tmetadataGroups = new Vector();\n\t\t\tstate.setAttribute(STATE_METADATA_GROUPS, metadataGroups);\n\t\t}\n\t\t// define DublinCore\n\t\tif( !metadataGroups.contains(new MetadataGroup(rb.getString(\"opt_props\"))) )\n\t\t{\n\t\t\tMetadataGroup dc = new MetadataGroup( rb.getString(\"opt_props\") );\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_TITLE);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_DESCRIPTION);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_ALTERNATIVE);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_CREATOR);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_PUBLISHER);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_SUBJECT);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_CREATED);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_ISSUED);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_MODIFIED);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_TABLEOFCONTENTS);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_ABSTRACT);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_CONTRIBUTOR);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_TYPE);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_FORMAT);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_IDENTIFIER);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_SOURCE);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_LANGUAGE);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_COVERAGE);\n\t\t\t// dc.add(ResourcesMetadata.PROPERTY_DC_RIGHTS);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_AUDIENCE);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_EDULEVEL);\n\t\t\tmetadataGroups.add(dc);\n\t\t\tstate.setAttribute(STATE_METADATA_GROUPS, metadataGroups);\n\t\t}\n\t\t/*\n\t\t// define DublinCore\n\t\tif(!metadataGroups.contains(new MetadataGroup(\"Test of Datatypes\")))\n\t\t{\n\t\t\tMetadataGroup dc = new MetadataGroup(\"Test of Datatypes\");\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_TITLE);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_DESCRIPTION);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_ANYURI);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_DOUBLE);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_DATETIME);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_TIME);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_DATE);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_BOOLEAN);\n\t\t\tdc.add(ResourcesMetadata.PROPERTY_DC_INTEGER);\n\t\t\tmetadataGroups.add(dc);\n\t\t\tstate.setAttribute(STATE_METADATA_GROUPS, metadataGroups);\n\t\t}\n\t\t*/\n\t}", "protected void postParse(T fileParsed) {\n\t}", "static private ImageMetaInfo getImageMetaInfo(File file) {\n ImageMetaInfo imageMetaInfo = null;\n ImageParser imageParser = null;\n BufferedImage bufferedImage = null;\n ImageInfo imageInfo = null;\n ImageInfo.CompressionAlgorithm compressionAlgorithm = null;\n String compression = \"\";\n try {\n log(\"read file: \" + file.getName());\n\n String extension = ExtFilter.getExtension(file);\n // unambiguous definition of extension\n if (extension.equals(\"jpg\"))\n extension = \"jpeg\";\n else if (extension.equals(\"tif\"))\n extension = \"tiff\";\n\n imageParser = imageParserMap.get(extension);\n bufferedImage = imageParser.getBufferedImage(file, null);\n //for know compression algorithm name\n imageInfo = imageParser.getImageInfo(file, null);\n compressionAlgorithm = imageInfo.getCompressionAlgorithm();\n compression = compressionAlgorithm.toString();\n\n } catch (IOException e) {\n e.printStackTrace();\n } catch (ImageReadException e) {\n e.printStackTrace();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n if (bufferedImage == null){\n try {\n bufferedImage = ImageIO.read(file);\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n }\n\n try {\n int height = bufferedImage.getHeight();\n int width = bufferedImage.getWidth();\n ColorModel colorModel = bufferedImage.getColorModel();\n int bpi = colorModel.getPixelSize();\n //size in kb\n long size = (long) (file.length() / 1024.0);\n imageMetaInfo = new ImageMetaInfo(file.getName(), size, width, height, bpi, compression);\n } catch (Exception e){\n e.printStackTrace();\n }\n\n\n return imageMetaInfo;\n }", "public ResourceContent getMetadata() throws IOException;", "@Override\n public ConfigurationMetaData parse(String configFile) {\n ParsingMethod parsingMethod = ParsingMethod.REGEX;\n FlexGrammarParser parser = null;\n if (!StringUtils.isEmpty(configFile)) {\n try {\n CharStream input = new ANTLRInputStream(new StringReader(configFile));\n FlexGrammarLexer lex = new FlexGrammarLexer(input);\n CommonTokenStream tokens = new CommonTokenStream(lex);\n parser = new FlexGrammarParser(tokens);\n parser.removeErrorListeners();\n ErrorListener errorListener = new ErrorListener();\n parser.addErrorListener(errorListener);\n ConfigurationMetaData configMetaData = resolve(parser);\n configMetaData.setParsingMethod(parsingMethod);\n validator.validateTokenCount(configMetaData);\n return configMetaData;\n } catch (IllegalArgumentException | FlexEngineParseException e) {\n throw e;\n } catch (Exception e) {\n logger.error(\"unable to parse config file, error: {}\", e.getMessage(), e);\n throw new FlexEngineParseException(\"unable to parse config file\", e);\n }\n } else {\n logger.error(\"config file is null or empty\");\n throw new IllegalArgumentException(\"config file is null or empty\");\n }\n\n }", "public void extrairMetadados(Dataset dataset) throws SenseRDFException;", "public static ParsedData arffFileReader(File file) throws Exception {\n\n ParsedData data;\n String line = null;\n BufferedReader br = new BufferedReader(new FileReader(file));\n\n ArrayList<Attribute> attributes = new ArrayList<>();\n boolean attributeTest = true;\n int attributeNumber = 0;\n ArrayList<String> datasetList = new ArrayList<>();\n String relName = \"\";\n\n int rows = 0;\n int columns = 0;\n\n while ((line = br.readLine()) != null) {\n\n line = line.trim();\n\n if (attributeTest) {\n if(line.startsWith(\"@relation\")){\n relName = line.split(\" \")[1];\n }\n\n if (line.startsWith(\"@attribute\")) {\n attributes.add(parseAttribute(line, attributeNumber));\n attributeNumber++;\n }\n } else {\n String[] instance = parseInstance(line);\n if(instance.length != attributes.size()) {\n System.out.println(\"Skip illegal line: \" + Utils.concatStringArray(instance));\n continue;\n }\n for (int i = 0; i < instance.length; i++) {\n datasetList.add(instance[i]);\n }\n rows++;\n }\n if (line.startsWith(\"@data\")) {\n attributeTest = false;\n }\n\n }\n columns = attributes.size();\n\n String[] datasetArray = new String[datasetList.size()];\n for (int i = 0; i < datasetList.size(); i++) {\n datasetArray[i] = datasetList.get(i);\n }\n\n DataSet dataset = new DataSet(datasetArray, rows, columns);\n data = new ParsedData(dataset, attributes, relName);\n return data;\n\n }", "public void loadMetadata(Element e)\n\t\t{\n\t\tMap<String, FlowUnitDeclaration> map=new HashMap<String, FlowUnitDeclaration>();\n\t\tfor(FlowUnitDeclaration dec:unitDeclarations)\n\t\t\tmap.put(dec.metadata,dec);\n\n\t\tunits.clear();\n\t\tconns.clear();\n\t\t\n\t\t//Load all units\n\t\tMap<Integer,FlowUnit> numMap=new HashMap<Integer, FlowUnit>();\n\t\tint nexti=0;\n\t\tfor(Object subo:e.getChildren())\n\t\t\t{\n\t\t\tElement sube=(Element)subo;\n\t\t\tif(sube.getName().equals(\"unit\"))\n\t\t\t\t{\n\t\t\t\t//TODO handle unknown units\n\t\t\t\tString unitname=sube.getAttributeValue(\"unitname\");\n\t\t\t\tFlowUnitDeclaration dec=map.get(unitname);\n\t\t\t\tif(dec!=null)\n\t\t\t\t\t{\n\t\t\t\t\tFlowUnit unit=dec.createInstance();\n\t\t\t\t\tunit.x=Integer.parseInt(sube.getAttributeValue(\"unitx\"));\n\t\t\t\t\tunit.y=Integer.parseInt(sube.getAttributeValue(\"unity\"));\n\t\t\t\t\tnumMap.put(nexti++, unit);\n\t\t\t\t\tunit.fromXML(sube);\n\t\t\t\t\tunits.add(unit);\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tEvLog.printError(\"Warning: unrecognized flow unit \"+unitname, null);\n\t\t\t\t\tnumMap.put(nexti++, null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\telse if(sube.getName().equals(\"conn\"))\n\t\t\t\t{\n\t\t\t\tFlowUnit fromUnit=numMap.get(Integer.parseInt(sube.getAttributeValue(\"fromUnit\")));\n\t\t\t\tFlowUnit toUnit=numMap.get(Integer.parseInt(sube.getAttributeValue(\"toUnit\")));\n\t\t\t\tif(fromUnit!=null && toUnit!=null)\n\t\t\t\t\t{\n\t\t\t\t\tString fromArg=sube.getAttributeValue(\"fromArg\");\n\t\t\t\t\tString toArg=sube.getAttributeValue(\"toArg\");\n\t\t\t\t\tFlowConn c=new FlowConn(fromUnit,fromArg,toUnit,toArg);\n\t\t\t\t\tif(c.fromUnit!=null && c.toUnit!=null)\n\t\t\t\t\t\tconns.add(c);\n\t\t\t\t\telse\n\t\t\t\t\t\tEvLog.printError(\"Removed incomplete connection line\", null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "protected String parse(InputStream is, Metadata metadata) throws IOException, SAXException, TikaException \n\t{\n\t\tParseContext context = new ParseContext();\n\t\tParser parser = new AutoDetectParser();\n\t\tcontext.set(Parser.class, parser);\n\t\tContentHandler handler = new BodyContentHandler(-1);\n\t\tparser.parse(is, handler, metadata, context);\n\t\treturn handler.toString();\n\t}", "private void initMetaSetting() throws DPFTRuntimeException {\n\t\tDPFTConnector connector;\n\t\ttry {\n\t\t\tconnector = DPFTConnectionFactory.initDPFTConnector(DPFTUtil.getSystemDBConfig());\n\t\t\tmeta = (FileMetaDefDboSet) connector.getDboSet(\"DPFT_FILE_META_DEF\", \"chal_name='\" + getChannelName() + \"' and active=1\");\n\t\t\tdicSet = (FileDictionaryDboSet) connector.getDboSet(\"DPFT_FILE_DIC\", \"chal_name='\" + getChannelName() + \"' and active=1\");\n\t\t} catch (DPFTConnectionException e) {\n\t\t\tthrow new DPFTActionException(this, \"SYSTEM\", \"DPFT0001E\", e);\n\t\t}\n\t\tmeta.load();\n\t\tdicSet.load();\n\t\tmeta.close();\n\t\tdicSet.close();\n\t}", "public void parse() {\n }", "protected CosServiceResponse<T> parseResponseMetadata(CosHttpResponse response) {\n CosServiceResponse<T> cosResponse = new CosServiceResponse<T>();\n String cosRequestId = response.getHeaders().get(Headers.REQUEST_ID);\n String cosTraceId = response.getHeaders().get(Headers.TRACE_ID);\n String ciRequestId = response.getHeaders().get(Headers.CI_REQUEST_ID);\n\n Map<String, String> metadataMap = new HashMap<String, String>();\n metadataMap.put(Headers.REQUEST_ID, cosRequestId);\n metadataMap.put(Headers.TRACE_ID, cosTraceId);\n metadataMap.put(Headers.CI_REQUEST_ID, ciRequestId);\n cosResponse.setResponseMetadata(new ResponseMetadata(metadataMap));\n\n return cosResponse;\n }", "public void parse() throws XMLStreamException {\n\t\tInputStream dictStream = ClassLoader.getSystemResourceAsStream(fixFileName);\n\t\tXMLStreamReader reader = factory.createXMLStreamReader(dictStream);\n\t\tString curFieldName = \"\";\n\t\twhile (reader.hasNext()) {\n\t\t\tint event = reader.next();\n\t\t\tswitch (event) {\n\t\t\tcase XMLStreamConstants.START_ELEMENT:\n\t\t\t\tString elementName = reader.getLocalName();\n\t\t\t\telementNames.add(elementName);\n\t\t\t\tif (\"fields\".equals(elementName)) {\n\t\t\t\t\tisFieldsElement = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (\"field\".equals(elementName) && isFieldsElement) {\n\t\t\t\t\tString num = reader.getAttributeValue(null, \"number\");\n\t\t\t\t\tcurFieldName = reader.getAttributeValue(null, \"name\");\n\t\t\t\t\tFieldParser.logger.info(num + \", \" + curFieldName);\n\t\t\t\t\t// Integer tagNumber = Integer.parseInt(num);\n\t\t\t\t\ttagNameToNumber.put(curFieldName, num);\n\t\t\t\t\ttagNumberToName.put(num, curFieldName);\n\t\t\t\t\tMap<String, String> tagValueToTagValueDesc = tagNameToTagValueDesc.get(curFieldName);\n\t\t\t\t\tif (tagValueToTagValueDesc == null) {\n\t\t\t\t\t\ttagValueToTagValueDesc = new ConcurrentHashMap<>();\n\t\t\t\t\t\ttagNameToTagValueDesc.put(curFieldName, tagValueToTagValueDesc);\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (\"value\".equals(elementName) && !\"\".equals(curFieldName)) {\n\t\t\t\t\tMap<String, String> tagValueToTagValueDesc = tagNameToTagValueDesc.get(curFieldName);\n\t\t\t\t\tString enumNum = reader.getAttributeValue(null, \"enum\");\n\t\t\t\t\tString enumDesc = reader.getAttributeValue(null, \"description\");\n\t\t\t\t\ttagValueToTagValueDesc.put(enumNum, enumDesc);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase XMLStreamConstants.END_ELEMENT:\n\t\t\t\telementName = reader.getLocalName();\n\t\t\t\tif (\"fields\".equals(elementName)) {\n\t\t\t\t\tisFieldsElement = false;\n\t\t\t\t\tcurFieldName = \"\";\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\treader.close();\n\t}", "private void m72698ho() {\n try {\n FileInputStream openFileInput = this.mContext.openFileInput(this.aeq);\n try {\n XmlPullParser newPullParser = Xml.newPullParser();\n newPullParser.setInput(openFileInput, \"UTF-8\");\n int i = 0;\n while (i != 1 && i != 2) {\n i = newPullParser.next();\n }\n if (\"historical-records\".equals(newPullParser.getName())) {\n List list = this.aep;\n list.clear();\n while (true) {\n int next = newPullParser.next();\n if (next != 1) {\n if (!(next == 3 || next == 4)) {\n if (\"historical-record\".equals(newPullParser.getName())) {\n list.add(new C31890c(newPullParser.getAttributeValue(null, \"activity\"), Long.parseLong(newPullParser.getAttributeValue(null, \"time\")), Float.parseFloat(newPullParser.getAttributeValue(null, \"weight\"))));\n } else {\n throw new XmlPullParserException(\"Share records file not well-formed.\");\n }\n }\n } else if (openFileInput != null) {\n try {\n openFileInput.close();\n return;\n } catch (IOException e) {\n return;\n }\n } else {\n return;\n }\n }\n }\n throw new XmlPullParserException(\"Share records file does not start with historical-records tag.\");\n } catch (XmlPullParserException e2) {\n new StringBuilder(\"Error reading historical recrod file: \").append(this.aeq);\n if (openFileInput != null) {\n try {\n openFileInput.close();\n } catch (IOException e3) {\n }\n }\n } catch (IOException e4) {\n new StringBuilder(\"Error reading historical recrod file: \").append(this.aeq);\n if (openFileInput != null) {\n try {\n openFileInput.close();\n } catch (IOException e5) {\n }\n }\n } catch (Throwable th) {\n if (openFileInput != null) {\n try {\n openFileInput.close();\n } catch (IOException e6) {\n }\n }\n }\n } catch (FileNotFoundException e7) {\n }\n }", "public PDMetadata getMetadata() {\n/* 528 */ PDMetadata retval = null;\n/* 529 */ COSBase mdStream = this.stream.getDictionaryObject(COSName.METADATA);\n/* 530 */ if (mdStream != null)\n/* */ {\n/* 532 */ if (mdStream instanceof COSStream) {\n/* */ \n/* 534 */ retval = new PDMetadata((COSStream)mdStream);\n/* */ }\n/* 536 */ else if (!(mdStream instanceof org.apache.pdfbox.cos.COSNull)) {\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 542 */ throw new IllegalStateException(\"Expected a COSStream but was a \" + mdStream\n/* */ \n/* 544 */ .getClass().getSimpleName());\n/* */ } \n/* */ }\n/* 547 */ return retval;\n/* */ }", "public VicarMetadata() {\n\t\tsuper(true, nativeImageMetadataFormatName, nativeImageMetadataFormatClassName,\n\t\t// metadataFormatNames,\n\t\t\t\tnull, null);\n\t}", "private void processMetaData(boolean withGamma) {\n StringBuilder metaStr = new StringBuilder();\n for (String name : getMetaDataNames()) {\n if (!name.contains(\"gamma\") || withGamma) {\n Object value = getMetaData(name);\n metaStr.append(name).append(\"=\");\n if (value instanceof Object[]) {\n Object[] values = (Object[]) value;\n metaStr.append(\"{\");\n for (int i = 0; i < values.length; i++) {\n if (i > 0) metaStr.append(\",\");\n metaStr.append(values[i].toString());\n }\n metaStr.append(\"}\");\n } else {\n metaStr.append(value.toString());\n }\n metaStr.append(\",\");\n }\n }\n if (metaStr.length() > 0)\n metaDataString = metaStr.toString().substring(0, metaStr.length() - 1);\n else\n metaDataString = \"\";\n }", "private MetaInfo getJobMetaInfo(List<FileStatus> fileStatusList, JobId jobId)\n throws IOException {\n for (FileStatus fs : fileStatusList) {\n JobIndexInfo jobIndexInfo = FileNameIndexUtils.getIndexInfo(fs.getPath()\n .getName());\n if (jobIndexInfo.getJobId().equals(jobId)) {\n String confFileName = JobHistoryUtils\n .getIntermediateConfFileName(jobIndexInfo.getJobId());\n String summaryFileName = JobHistoryUtils\n .getIntermediateSummaryFileName(jobIndexInfo.getJobId());\n MetaInfo metaInfo = new MetaInfo(fs.getPath(), new Path(fs.getPath()\n .getParent(), confFileName), new Path(fs.getPath().getParent(),\n summaryFileName), jobIndexInfo);\n return metaInfo;\n }\n }\n return null;\n }", "public MetaData getMetaData();", "public void adapt(File file, ParserContext out) throws IOException {\n\t\tBufferedReader reader = null;\n\t\t\n\t\ttry {\n\t\t\t// Open the BMP section of the metadata file. Part of the\n\t\t\t// bmp.dtd defintion is that the native format starts with an\n\t\t\t// opening <BMP> tag.\n\t\t\tout.fireStartParseEvent(\"XML\");\n\n\t\t\t// Extract the basic file metadata. This includes things like\n\t\t\t// last modified date and so forth.\n\t\t\twriteFileInfo(file, out);\t\t\t\n\t\t\t\n\t\t\tout.fireStartParseEvent(\"INFORMATION\");\n\t\t\t\n\t\t\treader = new BufferedReader(new FileReader(file));\n\t\t\t\n\t\t\t// Read the first MAX_LINES_TO_READ lines into a buffer.\n\t\t\tStringBuffer contents = new StringBuffer();\n\t\t\tString line = null;\n\t\t\tfor(int i=0; (line = reader.readLine()) != null && i<MAX_LINES_TO_READ; i++) {\n\t\t\t\tcontents.append(line);\n\t\t\t}\n\t\t\t\n\t\t\t// Replace all whitespace with a single space.\n\t\t\tString testString = contents.toString().replaceAll(\"[\\\\x20\\\\x09\\\\x0D\\\\x0A]+\", \" \");\n\t\t\t\n\t\t\t// Find the XML declaration.\n\t\t\tMatcher m = XML_DECL2.matcher(testString);\n\t\t\tif(m.find()) {\n\t\t\t\tout.fireParseEvent(\"VERSION\", m.group(2));\n\t\t\t\tout.fireParseEvent(\"ENCODING\", (m.group(5) == null ? \"unspecified\" : m.group(5)));\n\t\t\t\tout.fireParseEvent(\"STANDALONE\", (m.group(8) == null ? \"unspecified\" : m.group(8)));\n\t\t\t}\n\t\t\t\n\t\t\t// Find the DOCTYPE declaration.\n\t\t\tm = DOCTYPE.matcher(testString);\n\t\t\tif(m.find()) {\n\t\t\t\tout.fireParseEvent(\"MAINTAG\", m.group(1));\n\t\t\t\t\n\t\t\t\tif(m.group(2) != null) {\n\t\t\t\t\tString systemIdentifier = m.group(3) != null ? m.group(3) : m.group(5);\n\t\t\t\t\tString publicIdentifier = m.group(3) != null ? null : m.group(4);\n\t\t\t\t\t\n\t\t\t\t\tout.fireParseEvent(\"SYSTEM\", stripQuotes(systemIdentifier));\n\t\t\t\t\t\n\t\t\t\t\tif(publicIdentifier != null) {\n\t\t\t\t\t\tout.fireParseEvent(\"PUBLIC\", stripQuotes(publicIdentifier));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tout.fireEndParseEvent(\"INFORMATION\");\n\t\t\tout.fireEndParseEvent(\"XML\");\n\t\t}\n\t\t\t\n\t\tcatch(IOException ex) {\n\t\t\tLogManager.getInstance().logMessage(ex);\n\t\t}\t\t\n\t\tfinally {\n\t\t\ttry {\n\t\t\t\treader.close();\n\t\t\t}\n\t\t\tcatch(IOException ex) {\n\t\t\t\t// Nothing we can do if we fail to close the \n\t\t\t\t// stream, so log the messasge and continue.\n\t\t\t\tLogManager.getInstance().logMessage(\n\t\t\t\t\t\tLogMessage.INFO,\n\t\t\t\t\t\t\"Failed to close reader in XMLAdapter::acceptsFile\");\n\t\t\t}\n\t\t}\n\t\t\n\t}", "protected void addMetadataFieldsFromParameters() {\n for (Map.Entry<String, String> e: parameters.entrySet()) {\n if (e.getKey().startsWith(\"meta-\")) {\n String fieldName = e.getKey().substring(5);\n String fieldValue = e.getValue();\n currentDoc.addTextualMetadataField(fieldName, fieldValue, getDocWriter().metadataFieldType(false));\n }\n }\n }", "private void parseEntities() {\n // See: https://github.com/twitter/twitter-text/tree/master/java\n entities.addExtractedEntities(TweetEntityAbstract.entitiesExtractor.extractCashtagsWithIndices(getText()));\n entities.addExtractedEntities(TweetEntityAbstract.entitiesExtractor.extractHashtagsWithIndices(getText()));\n entities.addExtractedEntities(TweetEntityAbstract.entitiesExtractor.extractMentionedScreennamesWithIndices(getText()));\n }" ]
[ "0.6962022", "0.6617808", "0.64871913", "0.6417733", "0.63672435", "0.6260404", "0.61522484", "0.6119156", "0.6012388", "0.5965924", "0.5886469", "0.5885803", "0.5858819", "0.5807113", "0.5667707", "0.5569637", "0.5557592", "0.5543503", "0.553895", "0.5498574", "0.5494807", "0.5493837", "0.5458571", "0.543548", "0.54144543", "0.5402157", "0.54015523", "0.53169453", "0.5312009", "0.52905226", "0.52396756", "0.5226772", "0.52207863", "0.5215195", "0.52096766", "0.5200127", "0.5187544", "0.5184293", "0.5182727", "0.5166787", "0.51665103", "0.5157908", "0.5152379", "0.5144309", "0.5143306", "0.51243126", "0.51174074", "0.5109244", "0.5106393", "0.5104052", "0.5047839", "0.50402653", "0.50392437", "0.50382143", "0.50352675", "0.5034341", "0.5015352", "0.5002433", "0.5002294", "0.4999798", "0.4999731", "0.49948496", "0.49935043", "0.49911234", "0.49815696", "0.49740458", "0.49695307", "0.4964621", "0.49633506", "0.49621716", "0.49460596", "0.49434632", "0.49429223", "0.4941251", "0.49369606", "0.4934316", "0.4929864", "0.4929331", "0.49276406", "0.49218202", "0.49150556", "0.49063542", "0.49022713", "0.49003884", "0.48982826", "0.48972952", "0.4894947", "0.4893085", "0.48881575", "0.48864764", "0.48802504", "0.48671192", "0.48604098", "0.48599476", "0.48599356", "0.4851218", "0.48403865", "0.48393092", "0.48249984", "0.48214498" ]
0.69818574
0
Parses the metadata mp3.
void parseMetadataMp3(String pathToAudioFile, String parameters){ try{ Parser parser=null; InputStream input=null; if(Pattern.matches("(.)+.mp3", parameters)){ parser = new Mp3Parser(); input=new FileInputStream(new File(pathToAudioFile)); } ContentHandler handler = new DefaultHandler(); Metadata metadata = new Metadata(); ParseContext parseCtx= new ParseContext(); parser.parse(input,handler,metadata,parseCtx); this.setTitle(metadata.get("title")); this.setAlbum(metadata.get("xmpDM:album")); this.setArtist(metadata.get("xmpDM:artist")); this.setComposer(metadata.get("xmpDM:composer")); this.setGenre(metadata.get("xmpDM:genre")); this.setPath(pathToAudioFile); setExecutionType("ok"); } catch(FileNotFoundException e){ System.err.println("ParseMedataMp3 FileNotFoundException"+e); setExecutionType("Exception"); }catch (IOException e){ System.err.println("ParseMedataMp3 IOException"+e); setExecutionType("Exception"); }catch(SAXException e){ System.err.println("ParseMedataMp3 SAXEException"+e); setExecutionType("Exception"); }catch(TikaException e){ System.err.println("ParseMedataMp3 TikaException"+e); setExecutionType("Exception"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private String getAlbum(File mp3){\n\t\tString tempString = \"\";\n\t InputStream input;\n\t ContentHandler handler = new DefaultHandler();\n\t Metadata metadata = new Metadata();\n\t Parser parser = new Mp3Parser();\n\t ParseContext parseCtx = new ParseContext();\n\t \n\t\ttry {\n\t\t\tinput = new FileInputStream(mp3);\n\t\t\tparser.parse(input, handler, metadata, parseCtx);\n\t\t input.close();\n\t\t} \n\t\tcatch (IOException | SAXException | TikaException e) {\n\t\t\tSystem.out.println(\"Error with: \" + mp3.getPath());\n\t\t\te.printStackTrace();\n\t\t}\n\t \n\t tempString = metadata.get(\"xmpDM:album\");\n\t\t\n\t\tif (tempString.isEmpty() || tempString.contentEquals(\" \")){\n\t\t\treturn \"Unknown\";\n\t\t}\n\t\treturn tempString;\n\t}", "private String getArtist(File mp3){\n\t\tString tempString = \"\";\n\t InputStream input;\n\t ContentHandler handler = new DefaultHandler();\n\t Metadata metadata = new Metadata();\n\t Parser parser = new Mp3Parser();\n\t ParseContext parseCtx = new ParseContext();\n\t \n\t\ttry {\n\t\t\tinput = new FileInputStream(mp3);\n\t\t\tparser.parse(input, handler, metadata, parseCtx);\n\t\t input.close();\n\t\t} \n\t\tcatch (IOException | SAXException | TikaException e) {\n\t\t\tSystem.out.println(\"Error with: \" + mp3.getPath());\n\t\t\te.printStackTrace();\n\t\t}\n\t \n\t tempString = metadata.get(\"xmpDM:artist\");\n\t\t\n\t\tif (tempString.isEmpty() || tempString.contentEquals(\" \")){\n\t\t\treturn \"Unknown\";\n\t\t}\n\t\treturn tempString;\n\t\t\n\t}", "void parseMetadataFlac(String pathToAudioFile)\n\t{\n\t\tAudioFile f = null;\n\t\ttry {\n\t\t\tf = AudioFileIO.read(new File(pathToAudioFile));\n\t\t} catch (CannotReadException e) {\n\t\t\t System.err.println(\"ParseMedataFlac CannotReadException\"+e);\n\t\t\t setExecutionType(\"Exception\");\n\t\t} catch (IOException e) {\n\t\t\tSystem.err.println(\"ParseMedataFlac IOException\"+e);\n\t\t\tsetExecutionType(\"Exception\");\n\t\t} catch (TagException e) {\n\t\t\tSystem.err.println(\"ParseMedataFlac TagException\"+e);\n\t\t\tsetExecutionType(\"Exception\");\n\t\t} catch (ReadOnlyFileException e) {\n\t\t\tSystem.err.println(\"ParseMedataFlac ReadOnlyException\"+e);\n\t\t\tsetExecutionType(\"Exception\");\n\t\t} catch (InvalidAudioFrameException e) {\n\t\t\tSystem.err.println(\"ParseMedataFlac InvalidAudioFrameException\"+e);\t\n\t\t\tsetExecutionType(\"Exception\");\n\t\t}\n\t\t\n\t\tTag tag = f.getTag();\n\n\t\ttry{\n\t\t\t\n\t\t\tthis.setTitle(tag.getFirst(FieldKey.TITLE));\n\t\t\tthis.setAlbum(tag.getFirst(FieldKey.ALBUM));\n\t\t\tthis.setArtist(tag.getFirst(FieldKey.ARTIST));\n\t\t\tthis.setComposer(tag.getFirst(FieldKey.COMPOSER));\n\t\t\tthis.setGenre(tag.getFirst(FieldKey.GENRE));\n\t\t\tthis.setPath(pathToAudioFile);\n\t\t\tsetExecutionType(\"ok\");\n\t\t\t\n\t\t} catch(UnsupportedOperationException e){\n\t\t\tSystem.err.println(\"ParseMedataFlac UnsupportedOperationException\"+e);\n\t\t\tsetExecutionType(\"Exception\");\n\t\t}\n\t}", "private void initMetadata() throws IOException {\n \n // start by reading the file header\n in.seek(0);\n byte[] toRead = new byte[4];\n in.read(toRead);\n long order = batoi(toRead); // byte ordering\n little = toRead[2] != 0xff || toRead[3] != 0xff;\n metadata.put(\"Byte Order\", new Boolean(little));\n \n in.skipBytes(4);\n in.read(toRead);\n long version = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Version\", new Long(version));\n \n byte[] er = new byte[2];\n in.read(er);\n short count = DataTools.bytesToShort(er, little);\n metadata.put(\"Count\", new Short(count));\n \n in.skipBytes(2);\n \n in.read(toRead);\n long offset = DataTools.bytesToLong(toRead, little);\n \n // skip to first tag\n in.seek(offset);\n \n // read in each tag and its data\n \n for (int i=0; i<count; i++) {\n in.read(er);\n short tag = DataTools.bytesToShort(er, little);\n in.skipBytes(2);\n \n in.read(toRead);\n offset = DataTools.bytesToLong(toRead, little);\n \n in.read(toRead);\n long fmt = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Format\", new Long(fmt));\n \n in.read(toRead);\n long numBytes = DataTools.bytesToLong(toRead, little);\n metadata.put(\"NumBytes\", new Long(numBytes));\n \n if (tag == 67 || tag == 68) {\n byte[] b = new byte[1];\n in.read(b);\n boolean isOpenlab2;\n if (b[0] == '0') isOpenlab2 = false;\n else isOpenlab2 = true;\n metadata.put(\"isOpenlab2\", new Boolean(isOpenlab2));\n \n in.skipBytes(2);\n in.read(er);\n short layerId = DataTools.bytesToShort(er, little);\n metadata.put(\"LayerID\", new Short(layerId));\n \n in.read(er);\n short layerType = DataTools.bytesToShort(er, little);\n metadata.put(\"LayerType\", new Short(layerType));\n \n in.read(er);\n short bitDepth = DataTools.bytesToShort(er, little);\n metadata.put(\"BitDepth\", new Short(bitDepth));\n \n in.read(er);\n short opacity = DataTools.bytesToShort(er, little);\n metadata.put(\"Opacity\", new Short(opacity));\n \n // not sure how many bytes to skip here\n in.skipBytes(10);\n \n in.read(toRead);\n long type = DataTools.bytesToLong(toRead, little);\n metadata.put(\"ImageType\", new Long(type));\n \n // not sure how many bytes to skip\n in.skipBytes(10);\n \n in.read(toRead);\n long timestamp = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Timestamp\", new Long(timestamp));\n \n in.skipBytes(2);\n \n if (isOpenlab2 == true) {\n byte[] layerName = new byte[127];\n in.read(layerName);\n metadata.put(\"LayerName\", new String(layerName));\n \n in.read(toRead);\n long timestampMS = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Timestamp-MS\", new Long(timestampMS));\n \n in.skipBytes(1);\n byte[] notes = new byte[118];\n in.read(notes);\n metadata.put(\"Notes\", new String(notes));\n }\n else in.skipBytes(123);\n }\n else if (tag == 69) {\n in.read(toRead);\n long platform = DataTools.bytesToLong(toRead, little);\n metadata.put(\"Platform\", new Long(platform));\n \n in.read(er);\n short units = DataTools.bytesToShort(er, little);\n metadata.put(\"Units\", new Short(units));\n \n in.read(er);\n short imageId = DataTools.bytesToShort(er, little);\n metadata.put(\"ID\", new Short(imageId));\n in.skipBytes(1);\n \n byte[] toRead2 = new byte[8];\n double xOrigin = DataTools.readDouble(in, little);\n metadata.put(\"XOrigin\", new Double(xOrigin));\n double yOrigin = DataTools.readDouble(in, little);\n metadata.put(\"YOrigin\", new Double(yOrigin));\n double xScale = DataTools.readDouble(in, little);\n metadata.put(\"XScale\", new Double(xScale));\n double yScale = DataTools.readDouble(in, little);\n metadata.put(\"YScale\", new Double(yScale));\n in.skipBytes(1);\n \n byte[] other = new byte[31];\n in.read(other);\n metadata.put(\"Other\", new String(other));\n }\n \n // Initialize OME metadata\n \n if (ome != null) {\n OMETools.setBigEndian(ome, !little);\n if (metadata.get(\"BitDepth\") != null) {\n int bitDepth = ((Integer) metadata.get(\"BitDepth\")).intValue();\n String type;\n \n if (bitDepth <= 8) type = \"int8\";\n else if (bitDepth <= 16) type = \"int16\";\n else type = \"int32\";\n \n OMETools.setPixelType(ome, type);\n }\n if (metadata.get(\"Timestamp\") != null) {\n OMETools.setCreationDate(ome, (String) metadata.get(\"Timestamp\"));\n }\n \n if (metadata.get(\"XOrigin\") != null) {\n Double xOrigin = (Double) metadata.get(\"XOrigin\");\n OMETools.setStageX(ome, xOrigin.floatValue());\n }\n \n if (metadata.get(\"YOrigin\") != null) {\n Double yOrigin = (Double) metadata.get(\"YOrigin\");\n OMETools.setStageY(ome, yOrigin.floatValue());\n }\n \n if (metadata.get(\"XScale\") != null) {\n Double xScale = (Double) metadata.get(\"XScale\");\n OMETools.setPixelSizeX(ome, xScale.floatValue());\n }\n \n if (metadata.get(\"YScale\") != null) {\n Double yScale = (Double) metadata.get(\"YScale\");\n OMETools.setPixelSizeY(ome, yScale.floatValue());\n }\n }\n in.seek(offset);\n }\n }", "private static MetaData parseMultipleFormat(File f) throws IOException {\n\t if(LimeXMLUtils.isASFFile(f)) {\n\t ASFParser p = new ASFParser(f);\n\t if(p.hasVideo())\n\t return new WMVMetaData(p);\n\t else if(p.hasAudio())\n\t return new WMAMetaData(p);\n }\n \n return null;\n }", "public XMPMetadata parse(byte[] xmp) throws XmpParsingException,\n\tXmpSchemaException, XmpUnknownValueTypeException,\n\tXmpExpectedRdfAboutAttribute, XmpXpacketEndException,\n\tBadFieldValueException {\n\n\t\tif (!(this instanceof XMPDocumentPreprocessor)) {\n\t\t\tfor (XMPDocumentPreprocessor processor : preprocessors) {\n\t\t\t\tNSMapping additionalNSMapping = processor.process(xmp);\n\t\t\t\tthis.nsMap.importNSMapping(additionalNSMapping);\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\tByteArrayInputStream is = new ByteArrayInputStream(xmp);\n\t\ttry {\n\t\t\tXMLInputFactory factory = XMLInputFactory.newInstance();\n\t\t\treader.set(factory.createXMLStreamReader(is));\n\n\t\t\t// expect xpacket processing instruction\n\t\t\texpectNext(XMLStreamReader.PROCESSING_INSTRUCTION,\n\t\t\t\t\t\"Did not find initial xpacket processing instruction\");\n\t\t\tXMPMetadata metadata = parseInitialXpacket(reader.get().getPIData());\n\n\t\t\t// expect x:xmpmeta\n\t\t\texpectNextTag(XMLStreamReader.START_ELEMENT,\n\t\t\t\t\t\"Did not find initial x:xmpmeta\");\n\t\t\texpectName(\"adobe:ns:meta/\", \"xmpmeta\");\n\n\t\t\t// expect rdf:RDF\n\t\t\texpectNextTag(XMLStreamReader.START_ELEMENT,\n\t\t\t\t\t\"Did not find initial rdf:RDF\");\n\t\t\texpectName(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\", \"RDF\");\n\n\t\t\tnsMap.resetComplexBasicTypesDeclarationInEntireXMPLevel();\n\t\t\t// add all namespaces which could declare nsURI of a basicValueType\n\t\t\t// all others declarations are ignored\n\t\t\tint nsCount = reader.get().getNamespaceCount();\n\t\t\tfor (int i = 0; i < nsCount; i++) {\n\t\t\t\tif (nsMap.isComplexBasicTypes(reader.get().getNamespaceURI(i))) {\n\t\t\t\t\tnsMap.setComplexBasicTypesDeclarationForLevelXMP(\n\t\t\t\t\t\t\treader.get().getNamespaceURI(i), \n\t\t\t\t\t\t\treader.get().getNamespacePrefix(i));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// now work on each rdf:Description\n\t\t\tint type = reader.get().nextTag();\n\t\t\twhile (type == XMLStreamReader.START_ELEMENT) {\n\t\t\t\tparseDescription(metadata);\n\t\t\t\ttype = reader.get().nextTag();\n\t\t\t}\n\n\t\t\t// all description are finished\n\t\t\t// expect end of rdf:RDF\n\t\t\texpectType(XMLStreamReader.END_ELEMENT,\n\t\t\t\t\t\"Expected end of descriptions\");\n\t\t\texpectName(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\", \"RDF\");\n\n\t\t\t// expect ending xmpmeta\n\t\t\texpectNextTag(XMLStreamReader.END_ELEMENT,\n\t\t\t\t\t\"Did not find initial x:xmpmeta\");\n\t\t\texpectName(\"adobe:ns:meta/\", \"xmpmeta\");\n\n\t\t\t// expect final processing instruction\n\t\t\texpectNext(XMLStreamReader.PROCESSING_INSTRUCTION,\n\t\t\t\t\t\"Did not find final xpacket processing instruction\");\n\t\t\t// treats xpacket end\n\t\t\tif (!reader.get().getPITarget().equals(\"xpacket\")) {\n\t\t\t\tthrow new XmpXpacketEndException(\"Excepted PI xpacket\");\n\t\t\t}\n\t\t\tString xpackData = reader.get().getPIData();\n\t\t\t// end attribute must be present and placed in first\n\t\t\t// xmp spec says Other unrecognized attributes can follow, but\n\t\t\t// should be ignored\n\t\t\tif (xpackData.startsWith(\"end=\")) {\n\t\t\t\t// check value (5 for end='X')\n\t\t\t\tif (xpackData.charAt(5)!='r' && xpackData.charAt(5)!='w') {\n\t\t\t\t\tthrow new XmpXpacketEndException(\n\t\t\t\t\t\t\t\"Excepted xpacket 'end' attribute with value 'r' or 'w' \");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// should find end='r/w'\n\t\t\t\tthrow new XmpXpacketEndException(\n\t\t\t\t\t\t\"Excepted xpacket 'end' attribute (must be present and placed in first)\");\n\t\t\t}\n\n\t\t\tmetadata.setEndXPacket(xpackData);\n\t\t\t// return constructed object\n\t\t\treturn metadata;\n\t\t} catch (XMLStreamException e) {\n\t\t\tthrow new XmpParsingException(\"An error has occured when processing the underlying XMP source\", e);\n\t\t} finally {\n\t\t\treader.remove();\n\t\t\tIOUtils.closeQuietly(is);\n\t\t}\n\t}", "private static void parseMETS() throws IOException, XMLStreamException {\r\n\r\n\t\tFile metsFile = new File(additionalDir, metsPath);\r\n\r\n\t\tif (!metsFile.exists()) {\r\n\t\t\tthrow new IOException(\"File does not exist. Current path is \"\r\n\t\t\t\t\t+ metsFile.getAbsolutePath());\r\n\t\t}\r\n\t\tString volumeID = extractVolumeIDFromFilePath(metsPath);\r\n\t\tXMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();\r\n\r\n\t\tvolumeRecord = new VolumeRecord(volumeID);\r\n\r\n\t\t// copyright is assumed to be public domain for all volumes\r\n\t\tvolumeRecord.setCopyright(CopyrightEnum.PUBLIC_DOMAIN);\r\n\r\n\t\tMETSParser metsParser = new METSParser(metsFile, volumeRecord,\r\n\t\t\t\txmlInputFactory);\r\n\t\tmetsParser.parse();\r\n\r\n\t\t// that's it. it is now parsed and the volumeRecord should be populated\r\n\t\t// by the parser\r\n\t\t// use volumeRecord to retrieve the information (see test cases on what\r\n\t\t// information is there)\r\n\r\n\t}", "private void readMetaData(int location) throws IOException {\n //Log.i(LOG_Task, \"/readMetaData\");\n long read = 0;\n String md = \"\"; // The metadata\n // Skipping stream until get to the metadata\n InputStream is = conn.getInputStream();\n while (read != location) { read += is.skip(location - read);}\n // The first byte of metadata tell how large the metadata is\n int mdl = is.read() * 16;\n //Log.i(LOG_Task, \"Skipped \" + read + \" bytes, reading \" + mdl + \" next bytes for metadatas\");\n // Start reading metadata if there is some\n if (mdl > 0) {\n read = 0;\n // try to read metadata 3 times at most, because the stream might be corrupted\n for (int i = 0; i < 3; i++){\n byte[] mdb = new byte[mdl - (int) read];\n read = is.read(mdb);\n md += new String(mdb, 0, mdb.length);\n //Log.i(LOG_Task, \"read:\" + read + \"/\" + mdl + \"bytes\");\n if (read==mdl) {break;} // Got enough needed data\n }\n //Log.i(LOG_Task, \"raw metadata: \" + md);\n // Get the chunks of metadata\n String[] metdatas = new String(md.trim().getBytes(), \"utf-8\").split(\";\");\n // Extract metadata in form StreamTitle='DELTA GOODREM - BORN TO TRY';\n for (String data : metdatas) {\n //Log.i(LOG_Task, data);\n String[] item = data.split(\"-|=\");\n // Extract the data line contains StreamTitle (replace \"\" to avoid this: StreamT��itle)\n if (item[0].replaceAll(\"[^\\\\p{Alnum}\\\\s]\", \"\").compareTo(\"StreamTitle\") == 0) {\n currentTitle = item[1].replaceAll(\"[^\\\\p{Alnum}\\\\s]\", \"\");\n currentArtist = (item.length == 3) ? item[2].replaceAll(\"[^\\\\p{Alnum}\\\\s]\", \"\") : \"\";\n }\n }\n Log.i(LOG_Task, \"Title: \" + currentTitle + \" | Artist: \" + currentArtist);\n }\n is.close();\n }", "private void readMetadata() throws IOException {\n\t\t/*int magicNumber = */ metadataFile.readInt();\n\t\t/*int formatVersion = */ metadataFile.readInt();\n\t\t/*int managerIndex = */ metadataFile.readInt();\n\t\tfileListOffset = metadataFile.readInt() & 0xFFFFFFFFL;\n\t\tpathListOffset = metadataFile.readInt() & 0xFFFFFFFFL;\n\n\t\tmetadataFile.setPosition(fileListOffset);\n\t\treadFileList();\n\t}", "@Override\n\tpublic void decodeSong(String path) throws UnsupportedAudioFileException, IOException {\n\t\tsongFile = new File(path);\n\n\t\tAudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(songFile);\n\t\tif (fileFormat instanceof TAudioFileFormat) {\n\t\t\tMap<?, ?> properties = ((TAudioFileFormat) fileFormat).properties();\n\n\t\t\tfinal String songNameKey = \"title\";\n\t\t\tfinal String artistNameKey = \"author\";\n\t\t\tfinal String albumNameKey = \"album\";\n\t\t\tfinal String yearOfReleaseKey = \"date\";\n\t\t\tfinal String genreKey = \"mp3.id3tag.genre\";\n\t\t\tfinal String durationKey = \"duration\";\n\t\t\tfinal String lengthInFramesKey = \"mp3.length.frames\";\n\t\t\tfinal String lengthInBytesKey = \"mp3.length.bytes\";\n\n\t\t\tsongName = (String) properties.get(songNameKey);\n\t\t\tartistName = (String) properties.get(artistNameKey);\n\t\t\talbumName = (String) properties.get(albumNameKey);\n\t\t\tyearOfRelease = (String) properties.get(yearOfReleaseKey);\n\t\t\tgenre = (String) properties.get(genreKey);\n\n\t\t\tLong microseconds = (Long) properties.get(durationKey);\n\n\t\t\tmiliSec = (int) (microseconds / 1000);\n\t\t\tsec = (miliSec / 1000) % 60;\n\t\t\tmin = (miliSec / 1000) / 60;\n\n\t\t\tlengthInFrames = (int) properties.get(lengthInFramesKey);\n\n\t\t\tlengthInBytes = ((int) properties.get(lengthInBytesKey));\n\n\t\t} else {\n\t\t\tthrow new UnsupportedAudioFileException();\n\t\t}\n\t}", "public SongMetada getMetadata() {\n\t\treturn metadata;\n\t}", "@Nullable\n public abstract MediaMetadata getPlaylistMetadata();", "private void readMetaFile() throws Exception, ErrorMessageException {\n System.out.println(\"Read Meta File\");\n DataInputStream dis = new DataInputStream(is);\n metaFilesPeer = new MetaFilesPeer();\n while (true) {\n /* read parent */\n String parent = dis.readUTF();\n if (parent.equals(\"//\")) {\n break;\n }\n String name = dis.readUTF();\n boolean isfile = dis.readBoolean();\n byte[] sha = null;\n if (isfile) {\n String shaBase64 = dis.readUTF();\n sha = Util.convertBase64ToBytes(shaBase64);\n }\n long timeadded = dis.readLong();\n metaFilesPeer.addMetaFile(parent, name, isfile, sha, timeadded);\n }\n }", "public ArrayList<ArrayList<String>> readthePathOfMusicFiles()\n {\n File file = new File(path);\n String[] names = file.list();// all directories inside dataset1 direcory\n ArrayList<ArrayList<String>> pathOfMusicFiles = new ArrayList<>();\n String artistName = \"\";\n String trackName = \"\";\n Mp3File song = null;\n for (int i = 0; i < names.length; i++) \n {\n File file1 = new File(path + '/' + names[i]);\n if (file1.isDirectory())\n {\n String[] fileNames = file1.list();\n for (String fileName : fileNames)// all files in directory\n {\n if (fileName.contains(\".mp3\") && !(fileName.charAt(0) == '.'))\n {\n try\n {\n song = new Mp3File(path + '/' + names[i] + '/' + fileName);\n }\n catch (UnsupportedTagException | InvalidDataException | IOException e)\n {\n e.printStackTrace();\n }\n if(song!=null && song.hasId3v1Tag())\n {\n ID3v1 id3v1Tag = song.getId3v1Tag();\n artistName = id3v1Tag.getArtist();\n trackName = id3v1Tag.getTitle();\n }\n if(song!=null && song.hasId3v2Tag())\n {\n ID3v2 id3v2tag = song.getId3v2Tag();\n artistName = id3v2tag.getArtist();\n trackName = id3v2tag.getTitle();\n }\n if(artistName != null && artistName.length() >= 1 && trackName != null && artistName.length() >= 1)\n {\n if(artistName.charAt(0) >= startChar && artistName.charAt(0) <= endChar)\n {\n ArrayList<String> songAttributes = new ArrayList<>();\n songAttributes.add(path + '/' + names[i] + '/' + fileName);\n songAttributes.add(artistName);\n songAttributes.add(trackName);\n pathOfMusicFiles.add(songAttributes);\n }\n }\n }\n }\n }\n }\n return pathOfMusicFiles;\n }", "public MediaPropertiesChunk(DataInputStream f) throws Exception {\n\t\tstreamId = f.readShort();\n\t\tmaxBitrate = f.readInt();\n\t\taverageBitrate = f.readInt();\n\t\tmaxDataPacketSize = f.readInt();\n\t\taverageDataPacketSize = f.readInt();\n\t\tstreamStartInMs = f.readInt();\n\t\tprerollInMs = f.readInt();\n\t\tduration = f.readInt();\n//\t\tbyte Size of stream description string\n\t\tstreamDescription = Utils.readString(f, f.read());\n//\t\tbyte Size of stream mime type string\n\t\tmimeType = Utils.readString(f, f.read());\n\t\t\n\t\tint dataLength = (int)f.readInt();\n\t\tbyte [] b = new byte[dataLength];\n\t\tf.readFully(b);\n\t\t\n\t\tswitch(mimeType) {\n\t\t\tcase \"audio/x-pn-realaudio\" :\n\t\t\t\taudioInfo = new AudioInfo(new DataInputStream(new ByteArrayInputStream(b)));\n\t\t\t\tbreak;\n\t\t\tcase \"logical-fileinfo\":\n\t\t\t\tlogicStreamInfo = new LogicalStreamInfo(new DataInputStream(new ByteArrayInputStream(b)));\n\t\t\t\tbreak;\n\t\t\tcase \"audio/X-MP3-draft-00\": /*dataLength must equals 0. In this case we do not have any codec info */ break;\n\t\t\tcase \"audio/x-ralf-mpeg4\" : \n\t\t\tcase \"audio/x-ralf-mpeg4-generic\" :\n\t\t\t\tlosslessAudioInfo = new LosslessAudioInfo(new DataInputStream(new ByteArrayInputStream(b)));\n\t\t\t\tbreak;\n\t\t\tcase \"audio/x-pn-multirate-realaudio\" : /* ASM-compatible RealAudio stream. Not supported */\t\t\t\t\n\t\t\tdefault: throw new UnsupportedException(\"Unknow mime : \" + mimeType); \n\t\t}\n\t}", "public void resetInfo() {\n\t\ttry {\n\t\t\tMp3File mp3 = new Mp3File(currSong.getUrl());\n\t\t\tlong tduration = mp3.getLengthInSeconds();\n\t\t\ttotalDuration.setText(secToMin((long) tduration));\n\t\t\tcurrentDuration.setText(\"0:00\");\n\t\t\tplayedTime = 0;\n\t\t}catch(Exception e) {}\n\t}", "public XMPMetadata parse(InputStream input) throws XmpParsingException,\n\tXmpSchemaException, XmpUnknownValueTypeException,\n\tXmpExpectedRdfAboutAttribute, XmpXpacketEndException,\n\tBadFieldValueException {\n\n\t\tbyte[] bos = getStreamAsByteArray(input);\n\t\treturn parse(bos);\n\t}", "@Override\n public RecordType parseMetadata() {\n \n this.stationIndex = StationLookup.lookup(getStationId(this.filename));\n \n try {\n reader.mark(READ_AHEAD_LIMIT);\n String line = null;\n boolean headerRead = false;\n List<Variable> vars = null;\n while (null != (line = reader.readLine())) {\n Matcher matcher = headerLinePattern.matcher(line);\n if (matcher.matches()) {\n vars = headerVariables(matcher.group(1));\n reader.mark(READ_AHEAD_LIMIT);\n headerRead = true;\n }\n else if (headerRead) {\n matcher = dataLinePattern.matcher(line);\n if (matcher.matches()) {\n String date = matcher.group(1);\n Instant timestep = Instant.parse(date, getInputDateFormatter());\n this.baseDate = timestep;\n \n RecordType recordType = new RecordType(\"days since \" + baseDate.toString());\n for (Variable var : vars) {\n recordType.addType(var);\n }\n \n reader.reset();\n return recordType;\n }\n }\n }\n \n }\n catch (IOException ex) {\n LOG.debug(\"Error reading metadata\", ex);\n }\n return null;\n }", "private void parseLastfm() {\t\t\r\n\t\tfor(String artist : library.getCopyArtists()) {\r\n\t\t\ttry {\r\n\t\t\t\tartist = URLEncoder.encode(artist, \"UTF-8\");\r\n\t\t\t} catch (UnsupportedEncodingException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\tthis.wq.execute(new Fetcher(artist, library));\r\n\t\t}\r\n\t}", "public static MetaData parse(File f) throws IOException {\n try {\n if (LimeXMLUtils.isSupportedAudioFormat(f))\n return AudioMetaData.parseAudioFile(f);\n else if (LimeXMLUtils.isSupportedVideoFormat(f))\n return VideoMetaData.parseVideoMetaData(f);\n //TODO: add other media formats here\t\t\t\n else if (LimeXMLUtils.isSupportedMultipleFormat(f))\n return parseMultipleFormat(f);\n } catch (OutOfMemoryError e) {\n LOG.warn(\"Ran out of memory while parsing.\",e);\n }\n\t\treturn null;\n\t}", "public IMetaCue[] readMetaCue();", "public void loadMusic(File f) {\n music = new MP3(f);\n }", "public static ToscaMetadata parseToscaMetadataFile(InputStream st) throws IOException {\n if(st == null) {\n throw new IOException(Messages.METADATA_PARSER_INTERNAL.getErrorMessage());\n }\n OnboardingToscaMetadata meta = new OnboardingToscaMetadata();\n List<String> metadataLines = IOUtils.readLines(st, \"utf-8\");\n for (String line : metadataLines) {\n line = line.trim();\n if (line.isEmpty()) {\n return meta;\n }\n String[] entry = line.split(SEPARATOR_MF_ATTRIBUTE);\n //No empty keys allowed, no empty values allowed\n if (entry.length < 2 || entry[0].isEmpty()) {\n meta.errors.add(new ErrorMessage(ErrorLevel.ERROR, getErrorWithParameters(\n Messages.METADATA_INVALID_ENTRY_DEFINITIONS.getErrorMessage(), line)));\n //want to get all error lines in meta file block_0, no breaking loop\n } else {\n meta.metaEntries.put(entry[0].trim(), entry[1].trim());\n }\n }\n\n if (!meta.metaEntries.containsKey(TOSCA_META_ENTRY_DEFINITIONS)) {\n meta.errors.add(new ErrorMessage(ErrorLevel.ERROR, getErrorWithParameters(\n Messages.METADATA_NO_ENTRY_DEFINITIONS.getErrorMessage())));\n }\n return meta;\n }", "@Override\n protected Void doInBackground(String... params) {\n \tdbHelper = new DBAccessHelper(mContext);\n \tString selection = DBAccessHelper.SONG_SOURCE + \"<>\" + \"'GOOGLE_PLAY_MUSIC'\";\n \tString[] projection = { DBAccessHelper._ID, \n \t\t\t\t\t\t\tDBAccessHelper.SONG_FILE_PATH,\n \t\t\t\t\t\t\tDBAccessHelper.SONG_ALBUM,\n \t\t\t\t\t\t\tDBAccessHelper.SONG_ARTIST, \n \t\t\t\t\t\t\tDBAccessHelper.SONG_TITLE };\n \t\n \tCursor cursor = dbHelper.getWritableDatabase().query(DBAccessHelper.MUSIC_LIBRARY_TABLE, \n\t\t\t\t \t\t\t\t\t\t\t\t\t\t projection, \n\t\t\t\t \t\t\t\t\t\t\t\t\t\t selection, \n\t\t\t\t \t\t\t\t\t\t\t\t\t\t null, \n\t\t\t\t \t\t\t\t\t\t\t\t\t\t null, \n\t\t\t\t \t\t\t\t\t\t\t\t\t\t null, \n\t\t\t\t \t\t\t\t\t\t\t\t\t\t null);\n \t\n \tif (cursor.getCount()!=0) {\n \t\t\n \t\tcursor.moveToFirst();\n \t\tdataURIsList.add(cursor.getString(1));\n \t\talbumsList.add(cursor.getString(2));\n \t\tartistsList.add(cursor.getString(3));\n \t\t\n \t\twhile(cursor.moveToNext()) {\n \t\t\t\n \t\t\tdataURIsList.add(cursor.getString(1));\n \t\talbumsList.add(cursor.getString(2));\n \t\tartistsList.add(cursor.getString(3));\n \t\t}\n \t\t\n \t} else {\n \t\t//The user doesn't have any music so let's get outta here.\n \t\treturn null;\n \t}\n \t\n \tpd.setMax(dataURIsList.size());\n \t \t\n \t//Now that we have the attributes of the songs, we'll go through them each and check for missing covers.\n \tfor (int i=0; i < dataURIsList.size(); i++) {\n \t\t\n \t\ttry {\n \t\t\tfile = new File(dataURIsList.get(i));\n \t\t} catch (Exception e) {\n \t\t\tcontinue;\n \t\t}\n\n \t\taudioFile = null;\n\t\t\ttry {\n\t\t\t\taudioFile = AudioFileIO.read(file);\n\t\t\t} catch (CannotReadException e2) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\tcontinue;\n\t\t\t} catch (IOException e2) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\tcontinue;\n\t\t\t} catch (TagException e2) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\tcontinue;\n\t\t\t} catch (ReadOnlyFileException e2) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\tcontinue;\n\t\t\t} catch (InvalidAudioFrameException e2) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n \t\tTag tag = audioFile.getTag();\n \t\t\n\t //Set the destination directory for the xml file.\n\t File SDCardRoot = Environment.getExternalStorageDirectory();\n\t File xmlFile = new File(SDCardRoot,\"albumArt.xml\");\n \t\t\n\t if (tag!=null) {\n\t \t\n \t\t\tString title = tag.getFirst(FieldKey.TITLE);\n \t\tString checkingMessage = mContext.getResources().getString(R.string.checking_if)\n \t\t\t\t\t\t\t + \" \" \n \t\t\t\t\t\t\t + title \n \t\t\t\t\t\t\t + \" \" \n \t\t\t\t\t\t\t + mContext.getResources().getString(R.string.has_album_art)\n \t\t\t\t\t\t\t + \".\";\n \t\t\n \t\tcurrentProgress = currentProgress + 1;\n\t \t\tString[] checkingProgressParams = { checkingMessage, \"\" + currentProgress };\n\t \t\tpublishProgress(checkingProgressParams);\n\t \t\n\t \tList<Artwork> artworkList = tag.getArtworkList();\n\t \t\n\t \t\tif (artworkList.size()==0) {\n\n\t \t\t\t//Since the file doesn't have any album artwork, we'll have to download it.\n\t \t\t\t//Get the artist and album name of the file we're working with.\n\t \t\t\tString artist = tag.getFirst(FieldKey.ARTIST);\n\t \t\t\tString album = tag.getFirst(FieldKey.ALBUM);\n\t \t\t\t\n\t \t\t\t//Update the progress dialog.\n\t \t\t\tString message = mContext.getResources().getString(R.string.downloading_artwork_for) + \" \" + title;\n\t \t\t\tString[] progressParams = { message, \"\" + currentProgress };\n\t \t\t\tpublishProgress(progressParams);\n\t \t\t\t\n\t \t\t\t//Remove any unacceptable characters.\n\t \t\t\tif (artist.contains(\"#\")) {\n\t \t\t\t\tartist = artist.replace(\"#\", \"\");\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (artist.contains(\"$\")) {\n\t \t\t\t\tartist = artist.replace(\"$\", \"\");\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (artist.contains(\"@\")) {\n\t \t\t\t\tartist = artist.replace(\"@\", \"\");\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (album.contains(\"#\")) {\n\t \t\t\t\talbum = album.replace(\"#\", \"\");\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (album.contains(\"$\")) {\n\t \t\t\t\talbum = album.replace(\"$\", \"\");\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (album.contains(\"@\")) {\n\t \t\t\t\talbum = album.replace(\"@\", \"\");\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\t//Replace any spaces in the artist and album fields with \"%20\".\n\t \t\t\tif (artist.contains(\" \")) {\n\t \t\t\t\tartist = artist.replace(\" \", \"%20\");\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (album.contains(\" \")) {\n\t \t\t\t\talbum = album.replace(\" \", \"%20\");\n\t \t\t\t}\n\t \t\t\t\n\t \t \t//Construct the url for the HTTP request.\n\t \t \tURL url = null;\n\t \t\t\ttry {\n\t \t\t\t\turl = new URL(\"http://itunes.apple.com/search?term=\" + artist + \"+\" + album + \"&entity=album\");\n\t \t\t\t} catch (MalformedURLException e1) {\n\t \t\t\t\t// TODO Auto-generated catch block\n\t \t\t\t\tcontinue;\n\t \t\t\t}\n\t \n\t \t\t\tString xml = null;\n\t \t \ttry {\n\t \t \t\t\n\t \t\t \t//Create a new HTTP connection.\n\t \t\t HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();\n\t \t\t\n\t \t\t urlConnection.connect();\n\t \t\t \n\t \t\t //Check if albumArt.xml already exists and delete it.\n\t \t\t if (xmlFile.exists()) {\n\t \t\t \txmlFile.delete();\n\t \t\t }\n\t \t\t \n\t \t\t //Create the OuputStream that will be used to store the downloaded data into the file.\n\t \t\t FileOutputStream fileOutput = new FileOutputStream(xmlFile);\n\t \t\t\n\t \t\t //Create the InputStream that will read the data from the HTTP connection.\n\t \t\t InputStream inputStream = urlConnection.getInputStream();\n\t \t\t \n\t \t\t //Total size of target file.\n\t \t\t int totalSize = urlConnection.getContentLength();\n\t \t\t\n\t \t\t //Temp variable that stores the number of downloaded bytes.\n\t \t\t int downloadedSize = 0;\n\t \t\t\n\t \t\t //Create a buffer to store the downloaded bytes.\n\t \t\t buffer = new byte[1024];\n\t \t\t int bufferLength = 0;\n\n\t \t\t //Now read through the buffer and write the contents to the file.\n\t \t\t while((bufferLength = inputStream.read(buffer)) > 0 ) {\n\t \t\t fileOutput.write(buffer, 0, bufferLength);\n\t \t\t downloadedSize += bufferLength;\n\t \t\t\n\t \t\t }\n\t \t\t \n\t \t\t //Close the File Output Stream.\n\t \t\t fileOutput.close();\n\n\t \t \t} catch (MalformedURLException e) {\n\t \t \t\t//TODO Auto-generated method stub\n\t \t \t\tcontinue;\n\t \t \t} catch (IOException e) {\n\t \t \t\t// TODO Auto-generated method stub\n\t \t \t\tcontinue;\n\t \t \t}\n\t \t \t\n\t \t \t//Load the XML file into a String variable for local use.\n\t \t \tString xmlAsString = null;\n\t \t\t\ttry {\n\t \t\t\t\txmlAsString = FileUtils.readFileToString(xmlFile);\n\t \t\t\t} catch (IOException e) {\n\t \t\t\t\t// TODO Auto-generated catch block\n\t \t\t\t\te.printStackTrace();\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\t//Extract the albumArt parameter from the XML file.\n\t \t\t\tartworkURL = StringUtils.substringBetween(xmlAsString, \"\\\"artworkUrl100\\\":\\\"\", \"\\\",\");\n\t \t \t\n\t \t\t\tif (artworkURL==null) {\n\t \t\t\t\t\n\t \t\t\t\t//Check and see if a lower resolution image available.\n\t \t\t\t\tartworkURL = StringUtils.substringBetween(xmlAsString, \"\\\"artworkUrl60\\\":\\\"\", \"\\\",\");\n\t \t\t\t\t\n\t \t\t\t\tif (artworkURL==null) {\n\t \t\t\t\t\t//Can't do anything about that here.\n\t \t\t\t\t} else {\n\t \t\t\t\t\t//Replace \"100x100\" with \"600x600\" to retrieve larger album art images.\n\t \t\t\t\t\tartworkURL = artworkURL.replace(\"100x100\", \"600x600\");\n\t \t\t\t\t}\n\t \t\t \t\n\t \t\t\t} else {\n\t \t\t\t\t//Replace \"100x100\" with \"600x600\" to retrieve larger album art images.\n\t \t\t\t\tartworkURL = artworkURL.replace(\"100x100\", \"600x600\");\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\t//If no URL has been found, there's no point in continuing.\n\t \t\t\tif (artworkURL!=null) {\n\t \t\t\t\t\n\t \t\t\tartworkBitmap = null;\n\t \t\t\tartworkBitmap = mApp.getImageLoader().loadImageSync(artworkURL);\n\t \t\t\t\n\t \t \t\tFile artworkFile = new File(Environment.getExternalStorageDirectory() + \"/artwork.jpg\");\n\t \t\t\t\n\t \t \t//Save the artwork.\n\t \t \ttry {\n\t \t \t\t\n\t \t \t\tFileOutputStream out = new FileOutputStream(artworkFile);\n\t \t \t \tartworkBitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);\n\t \t\t\t\t\t\n\t \t \t} catch (Exception e) {\n\t \t \t\te.printStackTrace();\n\t \t \t} finally {\n\t \t \t\t\n\t \t \t\tArtwork artwork = null;\n\t \t\t\t\t\ttry {\n\t \t\t\t\t\t\tartwork = ArtworkFactory.createArtworkFromFile(artworkFile);\n\t \t\t\t\t\t} catch (IOException e) {\n\t \t\t\t\t\t\t// TODO Auto-generated catch block\n\t \t\t\t\t\t\tsetArtworkAsFile(artworkFile, dataURIsList.get(i));\n\t\t\t\t\t\t\t\tcontinue;\n\t \t\t\t\t\t} catch (ArrayIndexOutOfBoundsException e) {\n\t \t\t\t\t\t\t// TODO Auto-generated catch block\n\t \t\t\t\t\t\tsetArtworkAsFile(artworkFile, dataURIsList.get(i));\n\t\t\t\t\t\t\t\tcontinue;\n\t \t\t\t\t\t} catch (Exception e) {\n\t \t\t\t\t\t\te.printStackTrace();\n\t \t\t\t\t\t\tsetArtworkAsFile(artworkFile, dataURIsList.get(i));\n\t\t\t\t\t\t\t\tcontinue;\n\t \t\t\t\t\t} catch (Error e) {\n\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t\tsetArtworkAsFile(artworkFile, dataURIsList.get(i));\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t \t\t\t\t\t\n\t \t\t\t\t\tif (artwork!=null) {\n\t \t\t\t\t\t\t\n\t \t\t \t\ttry {\n\t \t\t\t\t\t\t//Remove the current artwork field and recreate it.\n\t \t\t \t\t\ttag.deleteArtworkField();\n\t \t\t \t\t\ttag.addField(artwork);\n\t \t\t\t\t\t} catch (Exception e) {\n\t \t\t\t\t\t\t// TODO Auto-generated catch block\n\t \t\t\t\t\t\tsetArtworkAsFile(artworkFile, dataURIsList.get(i));\n\t\t\t\t\t\t\t\t\tcontinue;\n\t \t\t\t\t\t} catch (Error e) {\n\t \t\t\t\t\t\t\te.printStackTrace();\n\t \t\t\t\t\t\t\tsetArtworkAsFile(artworkFile, dataURIsList.get(i));\n\t \t\t\t\t\t\t\tcontinue;\n\t \t\t\t\t\t\t}\n\t \t\t \t\t\n\t \t\t \t\ttry {\n\t \t\t\t\t\t\taudioFile.commit();\n\t \t\t\t\t\t} catch (CannotWriteException e) {\n\t \t\t\t\t\t\t// TODO Auto-generated catch block\n\t \t\t\t\t\t\tsetArtworkAsFile(artworkFile, dataURIsList.get(i));\n\t\t\t\t\t\t\t\t\tcontinue;\n\t \t\t\t\t\t} catch (Error e) {\n\t \t\t\t\t\t\t\te.printStackTrace();\n\t \t\t\t\t\t\t\tsetArtworkAsFile(artworkFile, dataURIsList.get(i));\n\t \t\t\t\t\t\t\tcontinue;\n\t \t\t\t\t\t\t}\n\t \t\t\t\t\t\t\n\t \t\t\t\t\t}\n\t \t\t\t\t\t\n\t \t \t//Delete the temporary files that we stored during the fetching process.\n\t \t\t \t\tif (artworkFile.exists()) {\n\t \t\t \t\t\tartworkFile.delete();\n\t \t\t \t\t}\n\t \t\t \t\t\n\t \t\t \t\tif (xmlFile.exists()) {\n\t \t\t \t\t\txmlFile.delete();\n\t \t\t \t\t}\n\t \t \t \t\n\t \t\t \t\t//Set the files to null to help clean up memory.\n\t \t\t \t\tartworkBitmap = null;\n\t \t\t \t\taudioFile = null;\n\t \t\t \t\ttag = null;\n\t \t\t \t\txmlFile = null;\n\t \t\t \t\tartworkFile = null;\n\t \t\t \t\t\n\t \t \t\t}\n\n\t \t\t\t}\n\n\t \t\t}\n\t \t\n\t }\n \t\t\n \t}\n \t\n \taudioFile = null;\n \tfile = null;\n \t//System.gc();\n \t\n \treturn null;\n\t \n }", "@Override\n public Song getSongRepresentation() {\n\n try {\n final Track track = en.uploadTrack(mp3File, true);\n\n // Wait for a predefined period of time in which the track is analyzed\n track.waitForAnalysis(30000);\n\n if (track.getStatus() == Track.AnalysisStatus.COMPLETE) {\n\n final double tempo = track.getTempo();\n final String title = Modulo7Utils.stringAssign(track.getTitle());\n final String artistName = Modulo7Utils.stringAssign(track.getArtistName());\n\n // Gets the time signature\n final int timeSignatureRatio = track.getTimeSignature();\n TimeSignature timeSignature = guessTimeSigntureRatio(timeSignatureRatio);\n\n // Getting the key signature information from the echo nest meta data analysis in integer format\n final int key = track.getKey();\n final int mode = track.getMode();\n\n try {\n keySignature = EchoNestKeySignatureEstimator.estimateKeySignature(key, mode);\n } catch (Modulo7BadKeyException e) {\n logger.error(e.getMessage());\n }\n\n // Gets the duration of the track\n final double duration = track.getDuration();\n\n TrackAnalysis analysis = track.getAnalysis();\n\n Voice voiceOfSong = new Voice();\n\n /**\n * There is no clear distinguishing way of acquiring timbral approximations\n * Hence the only possible approximation I can think of it call the a part of a\n * single voice\n */\n for (final Segment segment : analysis.getSegments()) {\n VoiceInstant songInstant = ChromaAnalysis.getLineInstantFromVector(segment.getPitches(), segment.getDuration());\n voiceOfSong.addVoiceInstant(songInstant);\n }\n if (keySignature == null) {\n return new Song(voiceOfSong, new SongMetadata(artistName, title, (int) tempo), MusicSources.MP3, duration);\n } else {\n if (timeSignature == null) {\n return new Song(voiceOfSong, new SongMetadata(keySignature, artistName, title, (int) tempo),\n MusicSources.MP3, duration);\n } else {\n return new Song(voiceOfSong, new SongMetadata(keySignature, timeSignature, artistName, title,\n (int) tempo), MusicSources.MP3, duration);\n }\n }\n\n } else {\n logger.error(\"Trouble analysing track \" + track.getStatus());\n return null;\n }\n } catch (IOException e) {\n logger.error(\"Trouble uploading file to track analyzer\" + e.getMessage());\n } catch (Modulo7InvalidVoiceInstantSizeException | EchoNestException | Modulo7BadIntervalException | Modulo7BadNoteException e) {\n logger.error(e.getMessage());\n }\n\n // Return null if no song is inferred\n return null;\n }", "public Song parserSong(JSONObject jsonTrack) throws JSONException {\n if (jsonTrack == null) return null;\n Song song = new Song();\n song.setArtworkUrl(jsonTrack.optString(SongEntry.ARTWORK_URL, null));\n song.setCommentCount(jsonTrack.optInt(SongEntry.COMMENT_COUNT, 0));\n song.setDescription(jsonTrack.optString(SongEntry.DESCRIPTION, \"\"));\n song.setDownloadable(jsonTrack.optBoolean(SongEntry.DOWNLOADABLE, false));\n song.setDownloadUrl(jsonTrack.optString(SongEntry.DOWNLOAD_URL, \"\"));\n song.setDuration(jsonTrack.optInt(SongEntry.DURATION, 0));\n song.setGenre(jsonTrack.optString(SongEntry.GENRE, \"\"));\n song.setId(jsonTrack.optInt(SongEntry.ID, 0));\n song.setKind(jsonTrack.optString(SongEntry.KIND, \"\"));\n song.setLikesCount(jsonTrack.optInt(SongEntry.LIKES_COUNT, 0));\n song.setPermalinkUrl(jsonTrack.optString(SongEntry.PERMALINK, \"\"));\n song.setPlaybackCount(jsonTrack.optInt(SongEntry.PLAYBACK_COUNT, 0));\n song.setTitle(jsonTrack.optString(SongEntry.TITLE, \"\"));\n song.setUri(StringUtils.createUri(jsonTrack.optString(SongEntry.URI, \"\")));\n song.setUserId(jsonTrack.optInt(SongEntry.USER_ID, 0));\n JSONObject jsonUser = jsonTrack.getJSONObject(SongEntry.USER);\n song.setAvatarUrl(jsonUser.optString(SongEntry.AVATAR_URL, null));\n song.setUsername(jsonUser.optString(SongEntry.USERNAME, \"\"));\n song.setPublic(jsonTrack.optBoolean(SongEntry.PUBLIC, false));\n if (song.getArtworkUrl() == null) {\n song.setArtworkUrl(song.getAvatarUrl());\n }\n if (song.getArtworkUrl() == null) return null;\n return song;\n }", "public String getArtist() {\n\t\tString item = \"\";\n\t\ttry {\n\t\t\tif (mp3File.hasID3v1Tag()) {\n\t\t\t\titem = mp3File.getID3v1Tag().getArtist();\n\t\t\t\tif (item != null && item != \"\")\n\t\t\t\t\treturn item;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tLog.e(TAG, \"Error when reading artist from ID3v1 tag.\", e);\n\t\t}\n\n\t\ttry {\n\t\t\tif (mp3File.hasID3v1Tag()) {\n\t\t\t\titem = mp3File.getID3v1Tag().getLeadArtist();\n\t\t\t\tif (item != null && item != \"\")\n\t\t\t\t\treturn item;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tLog.e(TAG, \"Error when reading artist from ID3v1 tag.\", e);\n\t\t}\n\n\t\ttry {\n\t\t\tif (mp3File.hasID3v2Tag()) {\n\t\t\t\titem = mp3File.getID3v2Tag().getLeadArtist();\n\t\t\t\tif (item != null && item != \"\")\n\t\t\t\t\treturn item;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tLog.e(TAG, \"Error when reading artist from ID3v2 tag.\", e);\n\t\t}\n\n\t\treturn item;\n\t}", "private void setMetadata(XMLStreamReader reader, Model model) throws XMLStreamException {\n\t\tString dcNS = Namespaces.DUBLIN_CORE_NS_URI;\n\t\tString dcPfx = \"dc\";\n\t\t\n\t\t//reader positioned at <tags/>\n\t\tfor (int i = 0; i < reader.getAttributeCount(); i++) {\n\t\t\tString name = reader.getAttributeName(i).getLocalPart().toLowerCase();\n\t\t\tif(name.equals(\"title\")) {\n\t\t\t\tQName q = new QName(dcNS,\"Title\",dcPfx);\n\t\t\t\tmodel.getMetadata().add(q, reader.getAttributeValue(i));\n\t\t\t}else if(name.equals(\"artist\")) {\n\t\t\t\tQName q = new QName(dcNS,\"Creator\",dcPfx);\n\t\t\t\tmodel.getMetadata().add(q, reader.getAttributeValue(i));\n\t\t\t}else if(name.equals(\"year\")) {\n\t\t\t\tQName q = new QName(dcNS,\"Date\",dcPfx);\n\t\t\t\tmodel.getMetadata().add(q, reader.getAttributeValue(i));\n\t\t\t}else if(name.equals(\"uid\")) {\n\t\t\t\tQName q = new QName(dcNS,\"Identifier\",dcPfx);\n\t\t\t\tmodel.getMetadata().add(q, reader.getAttributeValue(i));\n\t\t\t}\t\t\n\t\t}\t\t\n\t\t//check if any <tag> children\n\t\twhile(reader.hasNext()) {\n\t\t\treader.next();\n\t\t\tif(reader.isEndElement() && reader.getLocalName().equals(\"tags\")) {\n\t\t\t\treturn;\n\t\t\t}else if(reader.isStartElement() && reader.getLocalName().equals(\"tag\")) {\n\t\t\t\tString name = \"\"; \n\t\t\t\tString value = \"\"; \n\t\t\t\tfor (int i = 0; i < reader.getAttributeCount(); i++) {\n\t\t\t\t\tString attrName = reader.getAttributeName(i).getLocalPart();\n\t\t\t\t\tif(attrName.equals(\"name\")) {\n\t\t\t\t\t\tname = reader.getAttributeValue(i).toLowerCase();\n\t\t\t\t\t}else if(attrName.equals(\"value\")) {\n\t\t\t\t\t\tvalue = reader.getAttributeValue(i);\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t\tif(name.length()>0&&value.length()>0) {\n\t\t\t\t\tif(name.equals(\"album\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Title\",dcPfx);\n\t\t\t\t\t\tmodel.getMetadata().add(q, value);\n\t\t\t\t\t}else if(name.equals(\"artist\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Creator\",dcPfx);\n\t\t\t\t\t\tmodel.getMetadata().add(q, value);\n\t\t\t\t\t}else if(name.equals(\"year\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Date\",dcPfx);\n\t\t\t\t\t\tmodel.getMetadata().add(q, value);\n\t\t\t\t\t}else if(name.equals(\"uid\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Identifier\",dcPfx);\n\t\t\t\t\t\tMetadataItem item = new MetadataItem(q,value);\n\t\t\t\t\t\titem.addAttribute(\"id\", \"uid\");\n\t\t\t\t\t\tmodel.getMetadata().add(item);\n\t\t\t\t\t}else if(name.equals(\"lang\")) {\n\t\t\t\t\t\tQName q = new QName(dcNS,\"Language\",dcPfx);\n\t\t\t\t\t\tMetadataItem item = new MetadataItem(q,value);\n\t\t\t\t\t\tmodel.getMetadata().add(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\n\t}", "private boolean fileIsAnMp3Format(byte[] fileBytesToVerify) {\r\n\r\n\t\tboolean isOk = false;\r\n\t\tTika tk = new Tika();\r\n\r\n\t\tisOk = tk.detect(fileBytesToVerify).equalsIgnoreCase(\"audio/mpeg\");\r\n\r\n\t\tif (this.debug) {\r\n\t\t\tprintln(isOk + \" found in fileIsAnMp3Format in TextToAudioFile\");\r\n\t\t}\r\n\r\n\t\treturn isOk;\r\n\t}", "protected XMPMetadata getXmpMetadata() throws IOException {\n\t\tPDMetadata meta = doc.getDocumentCatalog().getMetadata();\n\t\tif ((meta != null) && (meta.getLength() > 0)) {\n\t\t\ttry {\n\t\t\t\tDomXmpParser xmpParser = new DomXmpParser();\n\t\t\t\treturn xmpParser.parse(meta.toByteArray());\n\t\t\t} catch (XmpParsingException | IOException e) {\n\t\t\t\tthrow new IOException(e);\n\t\t\t}\n\t\t}\n\t\treturn XMPMetadata.createXMPMetadata();\n\t}", "@Override\n public IQ parseIQ(XmlPullParser parser) throws Exception\n {\n Audio audio = new Audio();\n \n // for testing\n //parser.next();\n \n audio.setAId(parser.getAttributeValue(\"\", \"aid\"));\n audio.setAudioType(AudioType.getAudioType(parser.getAttributeValue(\"\", \"type\")));\n\n while(true)\n {\n int eventType = parser.next();\n String elementName = parser.getName();\n \n if (eventType == XmlPullParser.START_TAG)\n {\n if (elementName.equals(\"file\"))\n {\n AudioFile file = new AudioFile();\n file.setId(Integer.parseInt(parser.getAttributeValue(\"\", \"id\")));\n file.setArtist(parser.getAttributeValue(\"\", \"artist\"));\n file.setAlbum(parser.getAttributeValue(\"\", \"album\"));\n file.setTrack(parser.getAttributeValue(\"\", \"track\"));\n file.setName(parser.nextText());\n audio.addFile(file);\n }\n }\n else if (eventType == XmlPullParser.END_TAG)\n {\n if (elementName.equals(Audio.ELEMENTNAME))\n {\n break;\n }\n }\n }\n \n return audio;\n }", "public void readAlbumCollectionFromFile(Object fileName)\r\n {\r\n\t// Initialise variables to hold album title, artist and tracks\r\n\tList<Track> albumTracks = new ArrayList<>();\r\n\tString albumTitle = \"\";\r\n\tString albumArtist = \"\";\r\n\tString file = (String) fileName;\r\n\ttry\r\n\t{\r\n\t // Read in the album data file line by line\r\n\t BufferedReader buffer;\r\n\t buffer = new BufferedReader(new FileReader(file));\r\n\t String currentLine;\r\n\t Album album = null;\r\n\r\n\t while ((currentLine = buffer.readLine()) != null)\r\n\t {\r\n\t\t// Lines in the album data file begin with a letter when the line \r\n\t\t// contains an album title and artist, or an integer when it \r\n\t\t// contains track info\r\n\t\t\r\n\r\n\t\t// For each line, check whether first character is a letter. If so,\r\n\t\t// assume we are at a new Album title/artist\r\n\t\tif (Character.isLetter(currentLine.charAt(0)))\r\n\t\t{\r\n\t\t // Album title found\r\n\t\t \r\n\t\t // Get Album title and artist from the current line\r\n\t\t String[] split = currentLine.split(\":\");\r\n\t\t albumArtist = split[0].trim();\r\n\t\t albumTitle = split[1].trim();\r\n\r\n\r\n\t\t // check that current album does not exist in collection\r\n\t\t // try to get album by title\r\n\t\t Album albumByTitle = this.getAlbumByTitle(albumTitle);\r\n\t\t //only add album if albumByTitle returned null\r\n\t\t //TODO checking by artist will not work here as only first album by title found is returned. Need method to check for more albums of same name.\r\n\t\t if (albumByTitle == null || !albumByTitle.getAlbumArtist().equals(albumArtist))\r\n\t\t {\r\n\t\t\t// We are at the end of the current album. Therefore, create\r\n\t\t\t// the album and add it to the album collection\r\n\t\t\talbum = new Album(albumArtist, albumTitle);\r\n\t\t\tthis.addAlbum(album);\r\n\t\t }\r\n\t\t}\r\n\t\t// If first char is not a letter assume the line is a new track\r\n\t\telse if (album != null)\r\n\t\t{\r\n\t\t // Track found - get its title and duration\r\n\t\t String[] split = currentLine.split(\"-\", 2); // ', 2' prevents \r\n\t\t //splitting where '-' character occurs in title of the track\r\n\t\t String strTrackDuration = split[0].trim();\r\n\t\t String trackTitle = split[1].trim();\r\n\r\n\t\t // create duration object from string\r\n\t\t Duration trackDuration = new Duration(strTrackDuration);\r\n\t\t // create track object and add to album track list\r\n\t\t Track track = new Track(trackTitle, trackDuration);\r\n\t\t album.addTrack(track);\r\n\t\t}\r\n\t }\r\n\r\n\t} catch (IOException e)\r\n\t{\r\n\t // if error occurs, print the IOException\r\n\t System.out.println(e);\r\n\t}\r\n }", "@Override\n protected String doInBackground(String... arg0) {\n jobj = jsonparser.makeHttpRequest(url);\n try {\n metadata = jobj.getString(TAG_METADATA);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return metadata;\n }", "public static void getTitles(String tag){\n Connection con = LyricsAccess.startconnection(\"orcl\");\n int count = 0; //song lyrics count\n int page = 1; //page of lyrics\n \n while(count<50){\n XmlPage xml = getXmlResults(tag,page);\n if(xml.asXml().contains(\"error code\")){ //if there was an error, exit\n return;\n }\n //System.out.println(xml.asXml());\n try{\n BufferedReader in = new BufferedReader(new StringReader(xml.asXml()));\n\n String line = \"\";\n String lastline = \"\";\n boolean nameflag = false;\n boolean artistflag = false;\n String artist = \"\";\n String name = \"\"; \n int length = 0;\n\n while((line = in.readLine())!=null){ //iterate thorugh each line \n if(lastline.trim().equals(\"<duration>\")){\n length = Integer.parseInt(line.trim());\n //System.out.println(length);\n } \n if(nameflag){ //song name\n name = line.trim().replace(\"&amp;\", \"&\"); //convert HTML escaped character into normal character\n //System.out.println(line.trim());\n }\n if(artistflag){ //song artist\n artist = line.trim();\n //System.out.println(\" \" + line.trim());\n\n // Get lyrics from online\n LyricsProcess lyric = new LyricsProcess();\n String uLyrics = lyric.webgrab(name,artist); //get lyrics\n String c_lyrics = \"\"; //with timestamp\n String nt_lyrics = \"\"; //no timestamp\n //c_lyrics = lyric.cleanup7(uLyrics,true); //clean up\n //nt_lyrics = lyric.cleanup7(uLyrics, false); //clean up (without timestamp)\n \n nt_lyrics = LyricsWiki.cleanup(LyricsWiki.grabLyrics(name, artist)); //get lyrics and clean up\n //System.out.println(c_lyrics);\n \n //random wait time\n Random rand = new Random();\n int value = 1000*(rand.nextInt(4)+2);\n try {\n Thread.sleep(value);\n } catch (InterruptedException ex) {\n Thread.currentThread().interrupt();\n }\n \n int moods[] = {5}; ///////////mood to be input, 0-7\\\\\\\\\\\\\\\\\\\\\\\n \n //c_lyrics = LyricsProcess.oneLine(c_lyrics);\n nt_lyrics = LyricsProcess.oneLine(nt_lyrics); //put lyrics in one line\n \n if(!nt_lyrics.isEmpty()){ //if there are lyrics\n LyricsAccess.saveto(con, name, artist, length, nt_lyrics, c_lyrics, moods);\n count++;\n System.out.println(count);\n }\n if(count==50){\n return;\n }\n } \n\n if(line.trim().equals(\"<name>\")&&!lastline.trim().equals(\"<artist>\")){ //finds the name of the song\n nameflag = true;\n } else {\n nameflag = false;\n }\n\n if(line.trim().equals(\"<name>\")&&lastline.trim().equals(\"<artist>\")){ //finds the artist of the song\n artistflag = true;\n } else {\n artistflag = false;\n }\n\n lastline = line;\n }\n } catch (Exception e){\n e.printStackTrace();\n }\n \n page++;\n }\n }", "protected XMPMetadata parseInitialXpacket(String data)\n\t\t\tthrows XmpInitialXPacketParsingException,\n\t\t\tCreateXMPMetadataException {\n\t\tStringTokenizer tokens = new StringTokenizer(data, \" \");\n\t\tString id = null;\n\t\tString begin = null;\n\t\tString bytes = null;\n\t\tString encoding = null;\n\t\twhile (tokens.hasMoreTokens()) {\n\t\t\tString token = tokens.nextToken();\n\t\t\tif (!token.endsWith(\"\\\"\") && !token.endsWith(\"\\'\")) {\n\t\t\t\tthrow new XmpInitialXPacketParsingException(\n\t\t\t\t\t\t\"Cannot understand PI data part : '\" + token + \"'\");\n\t\t\t}\n\t\t\tString quote = token.substring(token.length()-1);\n\t\t\tint pos = token.indexOf(\"=\"+quote);\n\t\t\tif (pos <= 0) {\n\t\t\t\tthrow new XmpInitialXPacketParsingException(\n\t\t\t\t\t\t\"Cannot understand PI data part : '\" + token + \"'\");\n\t\t\t}\n\t\t\tString name = token.substring(0, pos);\n\t\t\tString value = token.substring(pos + 2, token.length() - 1);\n\t\t\tif (\"id\".equals(name)) {\n\t\t\t\tid = value;\n\t\t\t} else if (\"begin\".equals(name)) {\n\t\t\t\tbegin = value;\n\t\t\t} else if (\"bytes\".equals(name)) {\n\t\t\t\tbytes = value;\n\t\t\t} else if (\"encoding\".equals(name)) {\n\t\t\t\tencoding = value;\n\t\t\t} else {\n\t\t\t\tthrow new XmpInitialXPacketParsingException(\n\t\t\t\t\t\t\"Unknown attribute in xpacket PI : '\" + token + \"'\");\n\t\t\t}\n\t\t}\n\t\treturn new XMPMetadata(begin, id, bytes, encoding);\n\t}", "private boolean isMp3(File file){\n\t\tif (file.getName().endsWith(\".mp3\")){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public Music loadMusic(String fileName);", "protected void validateTag(AudioMetaData data) throws IOException { \n assertEquals(TITLE, data.getTitle());\n assertEquals(ARTIST, data.getArtist());\n assertEquals(ALBUM, data.getAlbum());\n assertEquals(COMMENT, data.getComment());\n assertEquals(TRACK, data.getTrack());\n assertEquals(YEAR, data.getYear());\n assertEquals(GENRE, data.getGenre());\n }", "public int getMP3FileDuration(String audioNamingDetails, Properties prop) {\r\n\r\n\t\t/*\r\n\t\t * Get file path details, same as was used for creating the target\r\n\t\t * MP3 file\r\n\t\t *\r\n\t\t * Determine OS of underlying system and set file path accordingly\r\n\t\t */\r\n\t\tString filePath = \"\";\r\n\t\tString serverOS = System.getProperty(\"os.name\");\r\n\r\n\t\tif (serverOS.startsWith(\"Windows\")) {\r\n\r\n\t\t\tif (this.debug) {\r\n\t\t\t\tSystem.out.println(\"\\nWindows OS found\");\r\n\t\t\t}\r\n\r\n\t\t\tfilePath = prop.getProperty(\"audioFileStorageWindows\");\r\n\r\n\t\t} else if (serverOS.startsWith(\"Linux\")) {\r\n\t\t\tif (this.debug) {\r\n\t\t\t\tSystem.out.println(\"Linux OS found\");\r\n\t\t\t}\r\n\t\t\tfilePath = prop.getProperty(\"audioFileStorageLinux\");\r\n\r\n\t\t} \r\n\r\n\t\t/*\r\n\t\t * Now access the file and get its duration\r\n\t\t */\r\n\t\tint dur = 0;\r\n\r\n\t\tAudioFile audioFile;\r\n\t\ttry {\r\n\t\t\t\r\n\t\t\taudioFile = AudioFileIO.read(new File(filePath + \"/\" + audioNamingDetails));\r\n\t\t\tdur = audioFile.getAudioHeader().getTrackLength();\r\n\t\t\r\n\t\t} catch (Exception e) {\r\n\t\t\treturn -1;\r\n\t\t} \r\n\t\t \r\n\t\tif(this.debug) {\r\n\t\t\tprintln(\"\\nPlaying time of \" + audioNamingDetails + \" is \" + dur + \" sec\\n\");\r\n\t\t}\t\r\n\t\t\r\n\t\treturn dur;\r\n\t}", "public static void play(String file) throws IOException {\n File abcFile = new File(file);\n \n Header header = Parser.parseHeader(abcFile);\n// MusicBody music = Parser.parseMusic(abcFile);\n }", "public CCAudioMetaData getMetaData() {\n\t\treturn meta;\n\t}", "private void startMusic() {\r\n final Format input1 = new AudioFormat(AudioFormat.MPEGLAYER3);\r\n final Format input2 = new AudioFormat(AudioFormat.MPEG);\r\n final Format output = new AudioFormat(AudioFormat.LINEAR);\r\n PlugInManager.addPlugIn(\r\n \"com.sun.media.codec.audio.mp3.JavaDecoder\",\r\n new Format[]{input1, input2},\r\n new Format[]{output},\r\n PlugInManager.CODEC\r\n );\r\n try {\r\n final File f = new File(\"support_files//tetris.mp3\");\r\n myPlayer = Manager.createPlayer(new MediaLocator(f.toURI().toURL()));\r\n } catch (final NoPlayerException | IOException e) {\r\n e.printStackTrace();\r\n }\r\n if (myPlayer != null) {\r\n myPlayer.start();\r\n }\r\n }", "public MP3 getMusic() {\n return music;\n }", "public GracenoteMetadata(final GracenoteWebAPI api, Document xml) {\r\n\t\tfinal Element root = xml.getDocumentElement();\r\n\r\n\t\tfinal NodeList nl = root.getElementsByTagName(\"ALBUM\");\r\n\t\tfor (int i = 0; i < nl.getLength(); i++) {\r\n\t\t\tElement e = (Element) nl.item(i);\r\n\r\n\t\t\t// Album data map\r\n\t\t\tfinal Map<String, Object> albumData = new HashMap<String, Object>();\r\n\r\n\t\t\t// If there's no GOET data, do a fetch to get the full information\r\n\t\t\t// instead.\r\n\t\t\tif (_getTextValue(e, \"ARTIST_ORIGIN\") == null) {\r\n\t\t\t\txml = api.fetchAlbumWithoutParsing(_getTextValue(e, \"GN_ID\"));\r\n\t\t\t\tif (xml == null) {\r\n\t\t\t\t\tLogging.log(\"[GRACE]\\tno gracenote match\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\te = xml.getDocumentElement();\r\n\t\t\t}\r\n\r\n\t\t\t// Album metadata\r\n\t\t\talbumData.put(\"album_gnid\", _getTextValue(e, \"GN_ID\"));\r\n\t\t\talbumData.put(\"album_artist_name\", _getTextValue(e, \"ARTIST\"));\r\n\t\t\talbumData.put(\"album_title\", _getTextValue(e, \"TITLE\"));\r\n\t\t\talbumData.put(\"album_year\", _getTextValue(e, \"DATE\"));\r\n\t\t\talbumData.put(\"genre\", _getOETData(e, \"GENRE\"));\r\n\t\t\talbumData.put(\"track_count\", _getTextValue(e, \"TRACK_COUNT\"));\r\n\t\t\talbumData.put(\"album_coverart\", _getAttribElement(e, \"URL\", \"TYPE\", \"COVERART\"));\r\n\r\n\t\t\t// Artist metadata\r\n\t\t\talbumData.put(\"artist_image_url\", _getAttribElement(e, \"URL\", \"TYPE\", \"ARTIST_IMAGE\"));\r\n\t\t\talbumData.put(\"artist_bio_url\", _getAttribElement(e, \"URL\", \"TYPE\", \"ARTIST_BIOGRAPHY\"));\r\n\t\t\talbumData.put(\"review_url\", _getAttribElement(e, \"URL\", \"TYPE\", \"ARTIST_REVIEW\"));\r\n\r\n\t\t\t// Artist OET metadata\r\n\t\t\talbumData.put(\"artist_era\", _getOETData(e, \"ARTIST_ERA\"));\r\n\t\t\talbumData.put(\"artist_type\", _getOETData(e, \"ARTIST_TYPE\"));\r\n\t\t\talbumData.put(\"artist_origin\", _getOETData(e, \"ARTIST_ORIGIN\"));\r\n\r\n\t\t\tfinal int trackCount = e.getElementsByTagName(\"TRACK\").getLength();\r\n\r\n\t\t\t// Parse track metadata if there is any.\r\n\t\t\tfor (int j = 0; j < trackCount; j++) {\r\n\t\t\t\tfinal Element trackElement = (Element) e.getElementsByTagName(\"TRACK\").item(j);\r\n\r\n\t\t\t\tfinal String title = _getTextValue(trackElement, \"TITLE\");\r\n\t\t\t\tfinal String search = api.getSearchedTrack();\r\n\t\t\t\tfinal boolean success = title.contains(search) || search.contains(title) || Levenshtein.distance(search, title) <= 0.1 * title.length();\r\n\t\t\t\tif (!success) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\talbumData.put(\"track_number\", _getTextValue(trackElement, \"TRACK_NUM\"));\r\n\t\t\t\talbumData.put(\"track_gn_id\", _getTextValue(trackElement, \"GN_ID\"));\r\n\t\t\t\talbumData.put(\"track_title\", title);\r\n\t\t\t\talbumData.put(\"track_artist_name\", _getTextValue(trackElement, \"ARTIST\"));\r\n\r\n\t\t\t\talbumData.put(\"mood\", _getOETData(trackElement, \"MOOD\"));\r\n\t\t\t\talbumData.put(\"tempo\", _getOETData(trackElement, \"TEMPO\"));\r\n\r\n\t\t\t\t// If track level GOET data exists, overwrite metadata from\r\n\t\t\t\t// album.\r\n\t\t\t\tif (trackElement.getElementsByTagName(\"GENRE\").getLength() > 0) {\r\n\t\t\t\t\talbumData.put(\"genre\", _getOETData(trackElement, \"GENRE\"));\r\n\t\t\t\t}\r\n\t\t\t\tif (trackElement.getElementsByTagName(\"ARTIST_ERA\").getLength() > 0) {\r\n\t\t\t\t\talbumData.put(\"artist_era\", _getOETData(trackElement, \"ARTIST_ERA\"));\r\n\t\t\t\t}\r\n\t\t\t\tif (trackElement.getElementsByTagName(\"ARTIST_TYPE\").getLength() > 0) {\r\n\t\t\t\t\talbumData.put(\"artist_type\", _getOETData(trackElement, \"ARTIST_TYPE\"));\r\n\t\t\t\t}\r\n\t\t\t\tif (trackElement.getElementsByTagName(\"ARTIST_ORIGIN\").getLength() > 0) {\r\n\t\t\t\t\talbumData.put(\"artist_origin\", _getOETData(trackElement, \"ARTIST_ORIGIN\"));\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t_data.add(albumData);\r\n\t\t}\r\n\t}", "public Music loadMusic(String fileName, float volume);", "public Map<String, Variant<?>> GetMetadata(int position);", "public interface IMetaService {\n\n // Get FLV from FLVService\n // grab a reader from FLV\n // Set up CuePoints\n // Set up MetaData\n // Pass CuePoint array into MetaData\n // read in current MetaData if there is MetaData\n // if there isn't MetaData, write new MetaData\n // Call writeMetaData method on MetaService\n // that in turn will write the current metadata\n // and the cuepoint data\n // after that, call writeMetaCue()\n // this will loop through all the tags making\n // sure that the cuepoints are inserted\n\n /**\n * Initiates writing of the MetaData\n *\n * @param meta\n * Metadata\n * @throws IOException\n * I/O exception\n */\n public void write(IMetaData<?, ?> meta) throws IOException;\n\n /**\n * Writes the MetaData\n *\n * @param metaData\n * Metadata\n */\n public void writeMetaData(IMetaData<?, ?> metaData);\n\n /**\n * Writes the Meta Cue Points\n */\n public void writeMetaCue();\n\n /**\n * Read the MetaData\n *\n * @return metaData Metadata\n * @param buffer\n * IoBuffer source\n */\n public MetaData<?, ?> readMetaData(IoBuffer buffer);\n\n /**\n * Read the Meta Cue Points\n *\n * @return Meta cue points\n */\n public IMetaCue[] readMetaCue();\n\n /**\n * Media file to be accessed\n *\n * @param file\n * file\n */\n public void setFile(File file);\n\n /**\n * Returns the file being accessed\n *\n * @return file\n */\n public File getFile();\n\n}", "public Song parseSongs(Path path, String extension){\n\t\tJSONParser parser = new JSONParser();\n\t\ttry (BufferedReader reader = Files.newBufferedReader(path, Charset.forName(\"UTF-8\"))){\n\n\t\t\tJSONObject contents = (JSONObject) parser.parse(reader);\n\t\t\tSong song = new Song(contents);\n\t\t\t\n\t\t\treturn song;\n\t\t\t\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (ParseException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn null;\n\t\t\n\t}", "Metadata getMetaData();", "public native static void convertMp3(String input, String mp3);", "public MultimediaPart parse(CompositionInstruction instruction) throws IOException{\n for (MultimediaParser parser : parsers) {\n try {\n return parser.parse(instruction);\n } catch (Exception e) {\n log.debug(\"{} could not parse {}\", parser.getClass().getSimpleName(), instruction.dvl().url());\n log.debug(\"Parsing error: \", e);\n }\n }\n String parserList = \"\";\n for (MultimediaParser parser : parsers) {\n parserList += parser.getClass().getSimpleName() + \" \";\n }\n throw new IOException(\"No parsers able to parse \" + instruction.dvl().url() + \", check debug log! Tried parsers: \" + parserList);\n }", "public MetadataContext parseMetadata(KXmlParser myParser)\n\t{\n\t\tMetadataContext metadata = new MetadataContext();\n\t\t\n\t\t//<contextMetadata>\n\t\ttry {\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\t//<description>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\tmetadata.setM_description( myParser.nextText());\n\t\t\t\n\t\t\t//<positionInfo>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\tmetadata.setM_latitude( Double.parseDouble( myParser.getAttributeValue(0)));\n\t\t\tmetadata.setM_longitude( Double.parseDouble( myParser.getAttributeValue(1)));\n\t\t\t\n\t\t\t//</positionInfo>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\t//<temporalInfo>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\t\n\t\t\tmetadata.setM_time( myParser.nextText());\n\t\t\t\n\t\t\t//<version>\n\t\t\tmyParser.nextTag();\n\t\t\tmetadata.setM_time( myParser.nextText());\n\t\t\t\n\t\t\t\n\t\t\t//<unit>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t\t\n\t\t\tmetadata.setM_unit(myParser.nextText());\n\t\t\t\n\t\t\t//</contextMetadata>\n\t\t\tmyParser.nextTag();\n\t\t\tSystem.out.println(myParser.getName());\n\t\t} catch (XmlPullParserException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\treturn metadata;\n\t\t\n\t}", "public boolean loadSongs(String fileName) throws FileNotFoundException {\n\t\tFile x = new File(fileName);\n\t\tthis.name = fileName;\n\t\tScanner reader = new Scanner(x);\n\t\tArrayList<String> line = new ArrayList<String>();\n\t\tArrayList<String> title = new ArrayList<String>();\n\t\tArrayList<String> artist = new ArrayList<String>();\n\t\tArrayList<String> time = new ArrayList<String>();\n\t\tboolean output = false;\n\t\twhile (reader.hasNextLine()) {\n\t\t\tString l = reader.nextLine().trim();\n\t\t\tline.add(l);\n\t\t}\n\t\tfor (int i = 3; i < line.size() - 1; i += 3) {\n\t\t\tif (!line.isEmpty() && line.get(i).contains(\"\")) {\n\t\t\t\tSong s = new Song(line.get(1), line.get(0));\n\t\t\t\tthis.songList.add(s);\n\t\t\t\toutput = true;\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < line.size() - 1; i += 4) {\n\t\t\ttitle.add(line.get(i));\n\t\t}\n\t\tfor (int i = 1; i < line.size() - 1; i += 4) {\n\t\t\tartist.add(line.get(i));\n\t\t}\n\t\tfor (int i = 2; i < line.size() - 1; i += 4) {\n\t\t\ttime.add((line.get(i)));\n\t\t}\n\n\t\tfor (int i = 0; i < songList.size() - 1; i++) {\n\t\t\tsongList.get(i).setArtist(artist.get(i));\n\t\t\tsongList.get(i).setTitle(title.get(i));\n\t\t\tsongList.get(i).setMinutes(Character.getNumericValue((time.get(i).charAt(0))));\n\t\t}\n\n\t\t/** add minutes to the last song on playlist **/\n\t\t/**\n\t\t * the loop keeps giving 0 so this is a precaution to ensure that the\n\t\t * correct numbers get picked\n\t\t **/\n\t\tsongList.get(songList.size() - 1).setMinutes(Character.getNumericValue((time.get(time.size() - 1).charAt(0))));\n\n\t\tfor (int i = 0; i < songList.size() - 1; i++) {\n\t\t\tif (time.get(i).substring(2).length() <= 2) {\n\t\t\t\tsongList.get(i).setSeconds(Integer.parseInt(time.get(i).substring(2)));\n\t\t\t} else {\n\t\t\t\tint sec = Integer.parseInt(time.get(i).substring(2));\n\t\t\t\tsongList.get(i).setSeconds(sec % 60);\n\t\t\t\tsongList.get(i).setMinutes(songList.get(i).getMinutes() + sec / 60);\n\t\t\t}\n\t\t}\n\n\t\t/** add proper minutes and second to the last song on playlist **/\n\t\t/**\n\t\t * the loop keeps giving 0 so this is a precaution to ensure that the\n\t\t * correct numbers get picked\n\t\t **/\n\t\tif (time.get(time.size() - 1).substring(2).length() <= 2) {\n\t\t\tsongList.get(songList.size() - 1).setSeconds(Integer.parseInt(time.get(time.size() - 1).substring(2)));\n\t\t} else {\n\t\t\tint sec = Integer.parseInt(time.get(time.size() - 1).substring(2));\n\t\t\tsongList.get(songList.size() - 1).setSeconds(sec % 60);\n\t\t\tsongList.get(songList.size() - 1).setMinutes(songList.get(songList.size() - 1).getMinutes() + sec / 60);\n\t\t}\n\t\treturn output;\n\n\t}", "private SoundPlayer(String mp3) {\n\t\tfile = new File(mp3);\n\t}", "protected InvMetadata readMetadata( InvCatalog catalog, InvDatasetImpl dataset, Element mdataElement) {\n Namespace namespace;\r\n List inlineElements = mdataElement.getChildren();\r\n if (inlineElements.size() > 0) // look at the namespace of the children, if they exist\r\n namespace = ((Element) inlineElements.get( 0)).getNamespace();\r\n else\r\n namespace = mdataElement.getNamespace(); // will be thredds\r\n\r\n String mtype = mdataElement.getAttributeValue(\"metadataType\");\r\n String href = mdataElement.getAttributeValue(\"href\", xlinkNS);\r\n String title = mdataElement.getAttributeValue(\"title\", xlinkNS);\r\n String inheritedS = mdataElement.getAttributeValue(\"inherited\");\r\n boolean inherited = (inheritedS != null) && inheritedS.equalsIgnoreCase(\"true\");\r\n\r\n boolean isThreddsNamespace = ((mtype == null) || mtype.equalsIgnoreCase(\"THREDDS\")) &&\r\n namespace.getURI().equals(XMLEntityResolver.CATALOG_NAMESPACE_10);\r\n\r\n // see if theres a converter for it.\r\n MetadataConverterIF metaConverter = factory.getMetadataConverter( namespace.getURI());\r\n if (metaConverter == null) metaConverter = factory.getMetadataConverter( mtype);\r\n if (metaConverter != null) {\r\n if (debugMetadataRead) System.out.println(\"found factory for metadata type = \"+mtype+\" namespace = \"+\r\n namespace+\"=\"+metaConverter.getClass().getName());\r\n\r\n // see if theres any inline content\r\n Object contentObj = null;\r\n if (inlineElements.size() > 0) {\r\n contentObj = metaConverter.readMetadataContent( dataset, mdataElement);\r\n return new InvMetadata( dataset, mtype, namespace.getURI(), namespace.getPrefix(),\r\n inherited, false, metaConverter, contentObj);\r\n\r\n } else { // otherwise it must be an Xlink; defer reading\r\n return new InvMetadata(dataset, href, title, mtype, namespace.getURI(),\r\n namespace.getPrefix(), inherited, false, metaConverter);\r\n }\r\n }\r\n\r\n // the case where its not ThreddsMetadata, but theres no converter\r\n if (!isThreddsNamespace) {\r\n if (inlineElements.size() > 0) {\r\n // just hold onto the jdom elements as the \"content\" LOOK should be DOM?\r\n return new InvMetadata( dataset, mtype, namespace.getURI(), namespace.getPrefix(),\r\n inherited, false, this, mdataElement);\r\n\r\n } else { // otherwise it must be an Xlink, never read\r\n return new InvMetadata(dataset, href, title, mtype, namespace.getURI(),\r\n namespace.getPrefix(), inherited, false, null);\r\n }\r\n\r\n }\r\n\r\n // the case where its ThreddsMetadata\r\n if (inlineElements.size() > 0) {\r\n ThreddsMetadata tmg = new ThreddsMetadata(false);\r\n readThreddsMetadata( catalog, dataset, mdataElement, tmg);\r\n return new InvMetadata( dataset, mtype, namespace.getURI(), namespace.getPrefix(),\r\n inherited, true, this, tmg);\r\n\r\n } else { // otherwise it must be an Xlink; defer reading\r\n return new InvMetadata(dataset, href, title, mtype, namespace.getURI(),\r\n namespace.getPrefix(), inherited, true, this);\r\n }\r\n\r\n }", "@Override\r\n\t\tprotected String doInBackground(String... arg0) {\n\t\t\tNetUtil net=new NetUtil();\r\n\t\t\tString musicname=mp3Info.getMp3Name();\r\n\t\t\tmusicname=\"'\"+musicname+\"'\";\r\n\t\t\tSystem.out.println(musicname);\r\n\t\t\tString result=net.queryTalk(musicname);\r\n\t\t\treturn result;\r\n\t\t}", "protected MetaData[] parseMetaData( Element datasetElement )\n throws XMLParsingException,\n InvalidCapabilitiesException {\n\n List<Node> metaDataList = XMLTools.getNodes( datasetElement, PRE_WPVS + \"MetaData\", nsContext );\n if ( metaDataList.size() == 0 ) {\n return null;\n }\n MetaData[] metaData = new MetaData[metaDataList.size()];\n\n for ( int i = 0; i < metaData.length; i++ ) {\n\n Element metaDataElement = (Element) metaDataList.get( i );\n\n String type = XMLTools.getRequiredNodeAsString( metaDataElement, \"@type\", nsContext );\n\n String format = XMLTools.getRequiredNodeAsString( metaDataElement, PRE_WPVS + \"Format/text()\", nsContext );\n URI onlineResourceURI = XMLTools.getNodeAsURI( metaDataElement,\n PRE_WPVS + \"OnlineResource/@xlink:href\",\n nsContext,\n null );\n URL onlineResource = null;\n if ( onlineResourceURI != null ) {\n try {\n onlineResource = onlineResourceURI.toURL();\n } catch ( MalformedURLException e ) {\n throw new InvalidCapabilitiesException( onlineResourceURI + \" does not represent a valid URL: \"\n + e.getMessage() );\n }\n }\n\n metaData[i] = new MetaData( type, format, onlineResource );\n }\n\n return metaData;\n }", "public void setMetadata(PDMetadata meta) {\n/* 557 */ this.stream.setItem(COSName.METADATA, meta);\n/* */ }", "public void scanForSongs() {\n if (scanner != null) {\n return;\n }\n scanner = new FileScanner();\n scanner.setActivity(getActivity(), new FileScanner.OnLoadDone() {\n @Override\n public void onLoadDone(ArrayList<MusicFile> data) {\n scanDone(data);\n }\n }, MusicFile.TYPE.MP3);\n scanner.execute(0);\n }", "protected void parseDescription(XMPMetadata metadata)\n\t\t\tthrows XmpParsingException, XMLStreamException, XmpSchemaException,\n\t\t\tXmpUnknownValueTypeException, XmpExpectedRdfAboutAttribute,\n\t\t\tBadFieldValueException {\n\t\tnsMap.resetComplexBasicTypesDeclarationInSchemaLevel();\n\t\tint cptNS = reader.get().getNamespaceCount();\n\t\tHashMap<String, String> namespaces = new HashMap<String, String>();\n\t\tfor (int i = 0; i < cptNS; i++) {\n\t\t\tnamespaces.put(reader.get().getNamespacePrefix(i), reader.get()\n\t\t\t\t\t.getNamespaceURI(i));\n\t\t\tif (nsMap.isComplexBasicTypes(reader.get().getNamespaceURI(i))) {\n\t\t\t\t// System.out.println(\"in parseDesc method: prefix:\"+reader.get().getNamespacePrefix(i)+\", nsURI:\"+reader.get().getNamespaceURI(i));\n\t\t\t\tnsMap.setComplexBasicTypesDeclarationForLevelSchema(reader\n\t\t\t\t\t\t.get().getNamespaceURI(i), reader.get()\n\t\t\t\t\t\t.getNamespacePrefix(i));\n\t\t\t}\n\t\t}\n\t\t// Different treatment for PDF/A Extension schema\n\t\t// System.out.println(PDFAExtensionSchema.PDFAEXTENSION+\";\"+PDFAExtensionSchema.PDFAPROPERTY+\";\"+PDFAExtensionSchema.PDFASCHEMA);\n\t\tif (namespaces.containsKey(PDFAExtensionSchema.PDFAEXTENSION)) {\n\t\t\tif (namespaces.containsKey(PDFAExtensionSchema.PDFAPROPERTY)\n\t\t\t\t\t&& namespaces.containsKey(PDFAExtensionSchema.PDFASCHEMA)) {\n\t\t\t\tif (namespaces\n\t\t\t\t\t\t.containsValue(PDFAExtensionSchema.PDFAEXTENSIONURI)\n\t\t\t\t\t\t&& namespaces\n\t\t\t\t\t\t.containsValue(PDFAExtensionSchema.PDFAPROPERTYURI)\n\t\t\t\t\t\t&& namespaces\n\t\t\t\t\t\t.containsValue(PDFAExtensionSchema.PDFASCHEMAURI)) {\n\t\t\t\t\tPDFAExtensionSchema schema = metadata\n\t\t\t\t\t\t\t.createAndAddPDFAExtensionSchemaWithNS(namespaces);\n\t\t\t\t\ttreatDescriptionAttributes(metadata, schema);\n\t\t\t\t\tparseExtensionSchema(schema, metadata);\n\n\t\t\t\t} else {\n\t\t\t\t\tthrow new XmpUnexpectedNamespaceURIException(\n\t\t\t\t\t\t\t\"Unexpected namespaceURI in PDFA Extension Schema encountered\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new XmpUnexpectedNamespacePrefixException(\n\t\t\t\t\t\t\"Unexpected namespace Prefix in PDFA Extension Schema\");\n\t\t\t}\n\n\t\t} else {\n\t\t\t// TODO Considering first namespace is that corresponding to the\n\t\t\t// schema (see if it must be changed)\n\t\t\tString namespaceUri = reader.get().getNamespaceURI(0);\n\t\t\tString namespacePrefix = reader.get().getNamespacePrefix(0);\n\t\t\tXMPSchema schema = nsMap.getAssociatedSchemaObject(metadata, namespaceUri, namespacePrefix);\n\t\t\tif (schema != null) {\n\t\t\t\tnamespaces.remove(namespacePrefix);\n\t\t\t} else {\n\t\t\t\tschema = metadata.createAndAddDefaultSchema(namespacePrefix,namespaceUri);\n\t\t\t}\n\t\t\tfor (int i = 1; i < cptNS; i++) {\n\t\t\t\tschema.setAttribute(new Attribute(XMPSchema.NS_NAMESPACE,\n\t\t\t\t\t\t\"xmlns\", reader.get().getNamespacePrefix(i), reader.get().getNamespaceURI(i)));\n\t\t\t}\n\t\t\ttreatDescriptionAttributes(metadata, schema);\n\t\t\twhile (reader.get().nextTag() == XMLStreamReader.START_ELEMENT) {\n\t\t\t\tparseProperty(schema, metadata);\n\t\t\t}\n\t\t}\n\n\t}", "@Override\n\tpublic X3DMetadataObject getMetadata();", "public PDMetadata getMetadata() {\n/* 528 */ PDMetadata retval = null;\n/* 529 */ COSBase mdStream = this.stream.getDictionaryObject(COSName.METADATA);\n/* 530 */ if (mdStream != null)\n/* */ {\n/* 532 */ if (mdStream instanceof COSStream) {\n/* */ \n/* 534 */ retval = new PDMetadata((COSStream)mdStream);\n/* */ }\n/* 536 */ else if (!(mdStream instanceof org.apache.pdfbox.cos.COSNull)) {\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 542 */ throw new IllegalStateException(\"Expected a COSStream but was a \" + mdStream\n/* */ \n/* 544 */ .getClass().getSimpleName());\n/* */ } \n/* */ }\n/* 547 */ return retval;\n/* */ }", "public static void main(String[] args) throws Exception\t{\r\n\t\tif (args.length != 1) {\r\n\t\t\tthrow new IllegalArgumentException(\"Specify a valid directory.\");\r\n\t\t}\r\n\r\n\t\tPath path = Paths.get(args[0]); // Create Path object\r\n\t\t//Having trouble running from commandline. \r\n\t\t// Path path = Paths.get(\"C:\\\\Users\\\\asanchez\\\\Desktop\\\\mp3s\");\r\n\r\n\t\tif (!Files.exists(path)) { // Verify path actually exists.\r\n\t\t\tthrow new IllegalArgumentException(\"Specifed directory does not exist: \" + path);\r\n\t\t}\r\n\t\tSystem.out.println(\"Path Exist!\");\r\n\r\n\t\t/*Step 2.\r\n\t\t * Read all files from directory\r\n\t\t */\r\n\t\tList<Path> filePaths = new ArrayList<>();\r\n\t\t// will need to edit below stream to only pick up certain file types\r\n\t\t// Files.newDirectoryStream(path, \"*.mp3\")\r\n\t\ttry(DirectoryStream<Path> paths = Files.newDirectoryStream(path, \"*.mp3\")) { // try + conditions; stream will need to be closed afterwards\r\n\t\t\t//Get the file names using lambda expressions.\r\n\t\t\tpaths.forEach(p -> {\r\n\t\t\t\tSystem.out.println(\"Found: \" + p.getFileName().toString());\r\n\t\t\t\tfilePaths.add(p);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t//Step 3: Part 1. Using streams to construct list of Song objects created from MP3 data.\r\n\t\tList<Song> songs = filePaths.stream().map(p -> {\r\n\t\t\ttry {\r\n\t\t\t\tMp3File mp3 = new Mp3File(p.toString());\r\n\t\t\t\tID3v2 id3 = mp3.getId3v2Tag();\r\n\t\t\t\treturn new Song(id3.getArtist(), id3.getYear(), id3.getAlbum(), id3.getTitle());\r\n\t\t\t}\r\n\t\t\tcatch (IOException | UnsupportedTagException | InvalidDataException e) {\r\n\t\t\t\tthrow new IllegalStateException(e);\r\n\t\t\t}\r\n\t\t}).collect(Collectors.toList());\r\n\r\n\t\t//Step 4: Database. \r\n\t\t// Can probably update this to Derby on home computer.\r\n\t\ttry (Connection conn = DriverManager.getConnection(\"jdbc:h2:~/mydatabase;AUTO_SERVER=TRUE;INIT=runscript from './create.sql'\")) {\r\n\t\t\tPreparedStatement ps = conn.prepareStatement(\"INSERT INTO Songs (artist, year, album, title) VALUES (?, ?, ?, ?)\");\r\n\r\n\t\t\tfor(Song s : songs) {\r\n\t\t\t\tps.setString(1, s.getArtist());\r\n\t\t\t\tps.setString(2, s.getYear());\r\n\t\t\t\tps.setString(3, s.getAlbum());\r\n\t\t\t\tps.setString(4, s.getTitle());\r\n\t\t\t\tps.addBatch();\r\n\t\t\t}\r\n\r\n\t\t\tint[] rows = ps.executeBatch();\r\n\t\t\tSystem.out.println(\"Number of rows inserted: \" + rows.length);\t\t\t\r\n\t\t}\r\n\r\n\t\t//Step 5: Start HTTP Server - Part 1\r\n\t\t//This is pretty new for us.. Going to embed Jetty into Java program.\r\n\t\tServer server = new Server(8080);\r\n\r\n\t\tServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);\r\n\t\tcontext.setContextPath(\"/\");\r\n\t\tcontext.setResourceBase(System.getProperty(\"java.io.tmpdir\"));\r\n\t\tserver.setHandler(context);\r\n\r\n\t\tcontext.addServlet(SongServlet.class, \"/songs\");\r\n\t\tserver.start();\r\n\r\n\t\t// Check if program is running on a desktop, and if so, open up a browser on localhost:8080/songs\r\n\t\tif (Desktop.isDesktopSupported()) {\r\n\t\t\tDesktop.getDesktop().browse(new URI(\"http://localhost:8080/songs\"));\r\n\t\t}\r\n\t}", "private void refreshMetadata(String url) {\n Log.d(LOG_TAG, \"refreshMetadata()\");\n\n final IcyStreamMeta streamMeta = new IcyStreamMeta();\n\n //Set the url\n try {\n\n streamMeta.setStreamUrl(new URL(url));\n } catch (MalformedURLException e) {\n Log.w(LOG_TAG, \"Malformed URL: \" + url);\n return;\n }\n\n new Thread(new Runnable() {\n @Override\n public void run() {\n\n retrieveTimer = new Timer();\n retrieveTimer.scheduleAtFixedRate(new TimerTask() {\n @Override\n public void run() {\n String songTitle = \"\";\n try {\n //Refresh metadata\n streamMeta.refreshMeta();\n songTitle = new String(streamMeta.getStreamTitle().getBytes(\"ISO-8859-1\"), \"UTF-8\");\n } catch (IOException e) {\n Log.d(LOG_TAG, \"No song title info!\");\n return;\n }\n\n //Send song title to RadioPlayer Fragment\n if (songTitle.length() > 4) {\n Log.d(LOG_TAG, \"Current song: \" + songTitle);\n sendAlert(RadioPlayerFragment.SEND_TITLE, songTitle);\n }\n }\n }, 0, 1000);\n\n }\n }).start();\n\n }", "public void read() throws IOException {\n\t\tString path = \"/Users/amit/Documents/songs/A.mp3\";\n\t\tFile file = new File(path);\n\t\tfinal int EOF = -1;\n\t\t\n\t\tif(file.exists()) {\n\t\t\tSystem.out.println(\"Exist...\");\n\t\tFileInputStream fs = new FileInputStream(path);\n\t\tBufferedInputStream bs = new BufferedInputStream(fs);\n\t\tlong startTime = System.currentTimeMillis();\n\t\tint singleByte = bs.read(); // read single byte\n\t\twhile(singleByte!=EOF) {\n\t\t\t//System.out.print((char)singleByte);\n\t\t\t singleByte = bs.read();\n\t\t}\n\t\tlong endTime = System.currentTimeMillis();\n\t\tSystem.out.println(\"Total Time Taken \"+(endTime-startTime)+\"ms\");\n\t\tbs.close();\n\t\tfs.close();\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"File Not Exist\");\n\t\t}\n\t\t\n\t}", "protected void loadMockData() {\n\n int ctr;\n InputStream inputStream = getResources().openRawResource(R.raw.song_list);\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n try {\n ctr = inputStream.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = inputStream.read();\n }\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // Parse the data.\n try {\n JSONObject jObject = new JSONObject(byteArrayOutputStream.toString());\n\n String status_code = jObject.getString(\"statusCode\");\n\n if (status_code.equalsIgnoreCase(\"200\")) {\n JSONArray jArray = jObject.getJSONArray(\"data\");\n\n audioList = new ArrayList<>();\n\n for (int i = 0; i < jArray.length(); i++) {\n JSONObject song = jArray.getJSONObject(i);\n\n String genre = song.getString(\"genre\");\n String album = song.getString(\"album\");\n String author = song.getString(\"author\");\n String title = song.getString(\"title\");\n String url = song.getString(\"url\");\n String imgUrl = song.getString(\"img\");\n\n Audio audio = new Audio(genre, album, author, title, url, imgUrl);\n\n // Save to audioList.\n audioList.add(audio);\n }\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "public List<Song> parseSongs(String respContent) {\n\t\treturn null;\r\n\t}", "private String addMusic() {\n\t\t// One Parameter: MusicName\n\t\tStringBuilder tag = new StringBuilder();\n\t\ttag.append(\"|music:\" + parameters[0]);\n\t\treturn tag.toString();\n\n\t}", "@Override\r\n\tpublic void startElement(String uri, String localName, String qName,\r\n\t\t\tAttributes attributes) throws SAXException {\n\t\ttagName = localName;\r\n\t\t\r\n\t\tif(tagName.equals(\"song_elt\")){\r\n\t\t\tmp3 = new DownloadMp3Model();//为每一首歌实例化对象\r\n\t\t\ti = 1;\r\n\t\t}\r\n\r\n\t}", "public void testMetaHTMLParsing() {\n\n try {\n\n /* loop through the test documents and validate result */\n for (int t = 0; t < docs.length; t++) {\n\n Content content = getContent(docs[t]);\n Parser parser = ParserFactory.getParser(\"text/html\", URL);\n Parse parse = parser.getParse(content);\n\n assertEquals(metalanguages[t], (String) parse.getData().get(\n HTMLLanguageParser.META_LANG_NAME));\n\n }\n } catch (Exception e) {\n e.printStackTrace(System.out);\n fail(e.toString());\n }\n\n }", "private void parseMovie(String url) {\n\t\tBoolean is3D = false;\n\t\tDocument doc;\n\t\ttry {\n\t\t\tdoc = Jsoup.connect(WOLFF + url).get();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn;\n\t\t}\t\t\n\n\t\tString movietitle = doc.select(\"#wrapper_left h2\").first().text().trim();\n\t\tSystem.out.println(\"Movie: \" + movietitle);\n\t\t\n\t\t// check if it is 3D movie\n\t\tif(url.contains(\"-3d\")) {\n\t\t\tis3D = true;\n\t\t}\n\n\t\t//create resource movie with the type 'Movie' and data property 'title'\n\t\tResource movie = m.createResource(MOVIE + url.replace(\"/film/\", \"\"));\n\t\tmovie.addProperty(RDF.type, m.getProperty(NS + \"Movie\"))\n\t\t\t .addProperty(m.getProperty(NS + \"title\"), movietitle);\n\n\t\t//if it is 3D movie..\n\t\tif(is3D)\n\t\t\tmovie.addProperty(m.getProperty(NS + \"hasPresentation\"), m.getResource(NS + \"3D\"));\n\n\t\t// does it have corresponding dbpedia resource?\n\t\tString mResult;\n\t\tif((mResult = SparqlQuery.movieInDbpediaEn(movietitle)) != null) {\n\t\t\ttemp = ResourceFactory.createResource(mResult);\n\t\t\tmovie.addProperty(OWL.sameAs, temp);\n\t\t} //else if((mResult = SparqlQuery.movieInDbpediaNl(movietitle)) != null) {\n//\t\t\ttemp = ResourceFactory.createResource(mResult);\n//\t\t\tmovie.addProperty(OWL.sameAs, temp);\n//\t\t}else if((mResult = SparqlQuery.movieInDbpediaDe(movietitle)) != null) {\n//\t\t\ttemp = ResourceFactory.createResource(mResult);\n//\t\t\tmovie.addProperty(OWL.sameAs, temp);\n//\t\t}\n//\t\t\n\t\t//parse sidebar information\n\t\tElements sidebar = doc.select(\".sidebar_container\").get(1).select(\".table_view tr td\");\n\t\t\n\t\tfor (Element element:sidebar) {\n\t\t\tswitch (element.select(\"strong\").text()) {\n\t\t\t//get all actors\n\t\t\tcase \"Acteurs\":\n\t\t\t\tString[] actors = element.text().substring(8).split(\", \"); //Remove \"Acteurs\" from string\n\t\t\t\tfor(String actor : actors) {\n\t\t\t\t\tResource person = m.createResource(PERSON + actor.replace(\" \", \"_\"));\n\t\t\t\t\tperson.addProperty(RDF.type, m.getProperty(NS + \"Person\"))\n\t\t\t\t\t\t .addProperty(m.getProperty(NS + \"name\"), actor.trim());\n\t\t\t\t\tmovie.addProperty(m.getProperty(NS + \"hasActor\"), person);\n\t\t\t\t\t\n\t\t\t\t\t//check if the actor has dbpedia page. Describe as sameAs if true\n\t\t\t\t\tString qResult;\n\t\t\t\t\tif((qResult = SparqlQuery.personInDbpediaEn(actor)) != null) { // in dbpedia.org\n\t\t\t\t\t\ttemp = ResourceFactory.createResource(qResult);\n\t\t\t\t\t\tperson.addProperty(OWL.sameAs, temp);\n\t\t\t\t\t} //else if((qResult = SparqlQuery.personInDbpediaNl(actor)) != null) { // in nl.dbpedia.org\n//\t\t\t\t\t\ttemp = ResourceFactory.createResource(qResult);\n//\t\t\t\t\t\tperson.addProperty(OWL.sameAs, temp);\n//\t\t\t\t\t} else if((qResult = SparqlQuery.personInDbpediaDe(actor)) != null) { // in de.dbpedia.org\n//\t\t\t\t\t\ttemp = ResourceFactory.createResource(qResult);\n//\t\t\t\t\t\tperson.addProperty(OWL.sameAs, temp);\n//\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t//get the director\n\t\t\tcase \"Regie\": //director\n\t\t\t\tString nameString = element.text().substring(6).toString().trim(); //Remove \"Regie\" from string\n\t\t\t\tResource person = m.createResource(PERSON + nameString.replace(\" \", \"_\"));\n\t\t\t\tperson.addProperty(m.getProperty(NS + \"name\"), nameString);\n\t\t\t\tmovie.addProperty(m.getProperty(NS + \"hasDirector\"), person);\n\t\t\t\t\n\t\t\t\t//check if the director has dbpedia page. Describe as sameAs if true \n\t\t\t\tString qResult;\n\t\t\t\tif((qResult = SparqlQuery.personInDbpediaEn(nameString)) != null) { // in dbpedia.org\n\t\t\t\t\tperson.addProperty(OWL.sameAs, DBR + qResult);\n\t\t\t\t}// else if((qResult = SparqlQuery.personInDbpediaNl(nameString)) != null) { // in nl.dbpedia.org\n//\t\t\t\t\tperson.addProperty(OWL.sameAs, DBR_NL + qResult);\n//\t\t\t\t} else if((qResult = SparqlQuery.personInDbpediaDe(nameString)) != null) { // in de.dbpedia.org\n//\t\t\t\t\tperson.addProperty(OWL.sameAs, DBR_DE + qResult);\n//\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// a little bit cheating for JJ Abrams\n\t\t\t\tif(nameString.equals(\"Jeffrey (J.J.) Abrams\")) {\n\t\t\t\t\tperson.addProperty(OWL.sameAs, DBR + \"J._J._Abrams\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t//get the duration\n\t\t\tcase \"Speelduur\":\n\t\t\t\tmovie.addProperty(m.getProperty(NS + \"duration\"), last(element).toString().trim().split(\" \")[0], XSDDatatype.XSDint);\n\t\t\t\tbreak;\n\n\t\t\t//get the genre\n\t\t\tcase \"Genre\":\n\t\t\t\tString[] genres = last(element).toString().toLowerCase().split(\", \");\n\t\t\t\tfor (String genreName:genres) {\n\t\t\t\t\tif(GENRE_MAP.containsKey(genreName))\n\t\t\t\t\t\tgenreName = GENRE_MAP.get(genreName);\n\t\t\t\t\telse { //unknown genre; report it and create new resource to acommodate\n\t\t\t\t\t\tSystem.out.println(\"*) another genre found: \" + genreName);\n\t\t\t\t\t\tm.createResource(GENRE + genreName)\n\t\t\t\t\t\t .addProperty(RDF.type, m.getProperty(NS + \"Genre\"));\n\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\tmovie.addProperty(m.getProperty(NS + \"hasGenre\"), m.getResource(GENRE + genreName));\n\t\t\t\t}\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t//get the language presentation\n\t\t\tcase \"Taal\":\n\t\t\t\tString lang = last(element).toString().trim().toLowerCase();\n\t\t\t\tif(LANGUAGE.containsKey(lang)) {\n\t\t\t\t\tlang = LANGUAGE.get(lang);\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"another language found: \" + lang);\n\t\t\t\t}\n\n\t\t\t\tmovie.addProperty(m.getProperty(NS + \"language\"), lang);\t\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t//get the release date\n\t\t\tcase \"In de bioscoop sinds\":\n\t\t\t\tString[] releasedate = last(element).toString().trim().split(\" \");\n\t\t\t\tString day = releasedate[0];\n\t\t\t\tString month = String.valueOf((Arrays.asList(DUTCH_MONTH).indexOf(releasedate[1].toLowerCase()) + 1));\n\t\t\t\tString year = releasedate[2];\n\t\t\t\tString formatteddate = year + \"-\" + month + \"-\" + day + \"T00:00:00\";\n\t\t\t\tmovie.addProperty(m.getProperty(NS + \"releaseDate\"), formatteddate, XSDDatatype.XSDdateTime);\t\t\t\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t//get the local distributor\n\t\t\tcase \"Distributeur\":\n\t\t\t\tNode distributorLink = (Node) last(element);\n\t\t\t\tResource distributorResource;\n\t\t\t\tif (distributorLink instanceof Element) {\n\t\t\t\t\tdistributorResource = m.createResource(COMPANY + ((Element) distributorLink).text().replace(\" \", \"_\"));\n\t\t\t\t\tdistributorResource.addProperty(m.getProperty(NS + \"companyURL\"), distributorLink.attr(\"href\"));\n\t\t\t\t\tdistributorResource.addProperty(m.getProperty(NS + \"companyName\"), ((Element) distributorLink).text());\n\t\t\t\t\tmovie.addProperty(m.getProperty(NS + \"isDistributedBy\"), distributorResource);\n\t\t\t\t} else {\n\t\t\t\t\tdistributorResource = m.createResource(COMPANY + distributorLink.toString().replace(\" \", \"_\"));\n\t\t\t\t\tdistributorResource.addProperty(m.getProperty(NS + \"companyName\"), distributorLink.toString());\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tmovie.addProperty(m.getProperty(NS + \"isDistributedBy\"), distributorResource);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public ArrayList getSongs() {\r\n\t\tArrayList songs = new ArrayList(mlitDataFields.size());\r\n\t\tfor (int i = 0; i < mlitDataFields.size(); i++) {\r\n\t\t\tArrayList fps = ((ArrayList) mlitDataFields.get(i));\r\n\t\t\tString name = null;\r\n\t\t\tint id = 0;\r\n\t\t\tDaapSong s = new DaapSong();\r\n\t\t\t\ts.host = host;\r\n\t\t\tfor (int j = 0; j < fps.size(); j++) {\r\n\t\t\t\tFieldPair fp = ((FieldPair) fps.get(j));\r\n\t\t\t\tif (fp.name.equals(\"miid\")) {\r\n\t\t\t\t\ts.id = Request.readInt(fp.value, 0, 4);\r\n\t\t\t\t} else if (fp.name.equals(\"minm\")) {\r\n\t\t\t\t\ts.name = Request.readString(fp.value, 0, fp.value.length).trim();\r\n\t\t\t\t} else if (fp.name.equals(\"mper\")) {\r\n\t\t\t\t s.persistent_id = Request.readString(fp.value, 0, fp.value.length).trim();\r\n\t\t\t\t} else if (fp.name.equals(\"asal\")) {\r\n\t\t\t\t\ts.album = Request.readString(fp.value, 0, fp.value.length).trim();\r\n\t\t\t\t} else if (fp.name.equals(\"asar\")) {\r\n\t\t\t\t\ts.artist = Request.readString(fp.value, 0, fp.value.length).trim();\r\n\t\t\t\t} else if (fp.name.equals(\"astn\")) {\r\n\t\t\t\t\ts.track = Request.readInt(fp.value, 0, 2);\r\n\t\t\t\t} else if (fp.name.equals(\"asgn\")) {\r\n\t\t\t\t\ts.genre = Request.readString(fp.value, 0, fp.value.length);\r\n\t\t\t\t} else if (fp.name.equals(\"asfm\")) {\r\n\t\t\t\t\ts.format = Request.readString(fp.value, 0, fp.value.length);\r\n\t\t\t\t} else if (fp.name.equals(\"astm\")) {\r\n\t\t\t\t\ts.time = Request.readInt(fp.value, 0, 4);\r\n\t\t\t\t} else if (fp.name.equals(\"assz\")) {\r\n\t\t\t\t\ts.size = Request.readInt(fp.value, 0, 4);\r\n\t\t\t\t} else if (fp.name.equals(\"asco\")) {\r\n\t\t\t\t s.compilation = (Request.readInt(fp.value, 0,1) == 1);\r\n\t\t\t\t} else if (fp.name.equals(\"asbr\")) {\r\n\t\t\t\t s.bitrate = Request.readInt(fp.value,0,2);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tsongs.add(s);\r\n\t\t}\r\n\t\treturn songs;\r\n\t}", "private void parseThumbnailProperty(XMPMetadata metadata, QName altName,\n\t\t\tComplexPropertyContainer container)\n\t\t\t\t\tthrows XmpUnexpectedTypeException, XmpParsingException,\n\t\t\t\t\tXMLStreamException, XmpUnknownPropertyTypeException,\n\t\t\t\t\tXmpPropertyFormatException {\n\t\texpectCurrentLocalName(\"li\");\n\t\tThumbnailType thumbnail = new ThumbnailType(metadata, altName\n\t\t\t\t.getPrefix(), altName.getLocalPart());\n\t\tint elmtType = reader.get().nextTag();\n\t\tQName eltName;\n\t\tString eltContent;\n\t\twhile (!((elmtType == XMLStreamReader.END_ELEMENT) && reader.get()\n\t\t\t\t.getName().getLocalPart().equals(\"li\"))) {\n\t\t\teltName = reader.get().getName();\n\t\t\teltContent = reader.get().getElementText();\n\t\t\tif (eltName.getLocalPart().equals(\"height\")) {\n\t\t\t\tthumbnail.setHeight(eltName.getPrefix(),\n\t\t\t\t\t\teltName.getLocalPart(), Integer.valueOf(eltContent));\n\t\t\t} else if (eltName.getLocalPart().equals(\"width\")) {\n\t\t\t\tthumbnail.setWidth(eltName.getPrefix(), eltName.getLocalPart(),\n\t\t\t\t\t\tInteger.valueOf(eltContent));\n\t\t\t} else if (eltName.getLocalPart().equals(\"image\")) {\n\t\t\t\tthumbnail.setImg(eltName.getPrefix(), eltName.getLocalPart(),\n\t\t\t\t\t\teltContent);\n\t\t\t} else if (eltName.getLocalPart().equals(\"format\")) {\n\t\t\t\tthumbnail.setFormat(eltName.getPrefix(),\n\t\t\t\t\t\teltName.getLocalPart(), eltContent);\n\t\t\t} else {\n\t\t\t\tthrow new XmpParsingException(\n\t\t\t\t\t\t\"Unknown property name for a thumbnail element : \"\n\t\t\t\t\t\t\t\t+ eltName.getLocalPart());\n\t\t\t}\n\t\t\telmtType = reader.get().nextTag();\n\t\t}\n\t\tcontainer.addProperty(thumbnail);\n\t}", "protected void performExtraction(URI id, File file, Charset charset,\r\n\t\t\tString mimeType, RDFContainer result) throws ExtractorException\r\n\t{\r\n\t\tMP3File mp3File = null;\r\n\r\n\t\tModel model = result.getModel();\r\n\r\n\t\tResource track = ModelUtil.generateRandomResource(model);\r\n\t\tResource musicAlbum = ModelUtil.generateRandomResource(model);\r\n\t\tResource release = ModelUtil.generateRandomResource(model);\r\n\t\tResource releaseEvent = ModelUtil.generateRandomResource(model);\r\n\r\n\t\tresourceMap = new HashMap<String, Resource>();\r\n\r\n\t\tresourceMap.put(ID3Util.TRACK, track);\r\n\t\tresourceMap.put(ID3Util.MUSICALBUM, musicAlbum);\r\n\t\tresourceMap.put(ID3Util.RELEASE, release);\r\n\t\tresourceMap.put(ID3Util.RELEASEEVENT, releaseEvent);\r\n\r\n\t\tmodel.addStatement(track, MO.available_as, result.getDescribedUri());\r\n\t\tmodel.addStatement(track, RDF.type, MO.Track);\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\t// we want to open the file in write mode\r\n\t\t\tmp3File = new MP3File(file);\r\n\t\t}\r\n\t\tcatch (FileNotFoundException e)\r\n\t\t{\r\n\t\t\tthrow new ExtractorException(e);\r\n\t\t}\r\n\t\tcatch (IOException e)\r\n\t\t{\r\n\t\t\tthrow new ExtractorException(e);\r\n\t\t}\r\n\t\tcatch (TagException e)\r\n\t\t{\r\n\t\t\tthrow new ExtractorException(\r\n\t\t\t\t\t\"File format not supported by the MP3Exctractor: \"\r\n\t\t\t\t\t\t\t+ file.getParent(), e);\r\n\t\t}\r\n\t\tcatch (ReadOnlyFileException e)\r\n\t\t{\r\n\t\t\tthrow new ExtractorException(e);\r\n\t\t}\r\n\t\tcatch (InvalidAudioFrameException e)\r\n\t\t{\r\n\t\t\tthrow new ExtractorException(e);\r\n\t\t}\r\n\r\n\t\tHashMap<URI, String> id3v1hashMap = new HashMap<URI, String>();\r\n\r\n\t\tif (mp3File.hasID3v1Tag())\r\n\t\t{\r\n\t\t\tprocessID3V1Tags(id, mp3File, charset, mimeType, id3v1hashMap);\r\n\t\t}\r\n\r\n\t\tif (mp3File.hasID3v2Tag())\r\n\t\t{\r\n\t\t\tprocessID3V2Tags(id, mp3File, charset, mimeType, id3v1hashMap,\r\n\t\t\t\t\tresult);\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * now that we processed all the ID3V2 tags, we can add the remaining\r\n\t\t * id3v1 fields we do it now because after processing id3v2 frames the\r\n\t\t * id3v1 fields may have been obsoleted this solution is better because\r\n\t\t * the extractor doesn't need to delete anything from the rdfcontainer\r\n\t\t */\r\n\t\taddId3V1Fields(id3v1hashMap, result);\r\n\t\t/*\r\n\t\t * if (mp3File.hasFilenameTag()) { processFilenameTag(id, mp3File,\r\n\t\t * charset, mimeType, result); }\r\n\t\t * \r\n\t\t * if (mp3File.hasLyrics3Tag()) { processLyrics3Tag(id, mp3File,\r\n\t\t * charset, mimeType, result); }\r\n\t\t */\r\n\t\tresult.add(RDF.type, MO.AudioFile);\r\n\t\tresult.add(RDF.type, MFO.Digital_Media);\r\n\r\n\t}", "public static void main(final String[] args) throws IOException, TikaException, SAXException {\n\t File file = new File(args[0]);\n\n Tika tika = new Tika();\n \n //detecting the file type using detect method\n String filetype = tika.detect(file);\n //System.out.println(filetype);\n \n //Parser method parameters\n //Parser parser = new AutoDetectParser();\n //Parser parser = new DcXMLParser();\n Parser parser = new Eml211Parser();\n \n BodyContentHandler handler = new BodyContentHandler();\n Metadata metadata = new Metadata();\n FileInputStream inputstream = new FileInputStream(file);\n ParseContext context = new ParseContext();\n \n parser.parse(inputstream, handler, metadata, context);\n \n //System.out.println(handler.toString());\n \n System.out.println(\"Extracting Metadata of the document: \");\n //getting the list of all meta data elements \n String[] metadataNames = metadata.names();\n \n for(String name : metadataNames) {\t\t \n System.out.println(name + \": \"+ metadata.get(name));\n } \n }", "protected static LibMetaData createLibMetaData(LibMetaData lmd) {\n MetaData metaData = new MetaData();\r\n metaData.add(\"IsThing\", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"ImageSource\", \"Items\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Image\", new Integer(0), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Number\", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n lmd.add(THING, metaData);\r\n \r\n metaData = new MetaData(lmd.get(\"thing\"));\r\n metaData.add(\"IsItem\", new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"ImageSource\", \"Items\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Image\", new Integer(1), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Name\", \"Thing\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"NameType\", new Integer(Description.NAMETYPE_NORMAL), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Z\", new Integer(Thing.Z_ITEM), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n lmd.add(ITEM, metaData);\r\n \r\n metaData = new MetaData(lmd.get(\"thing\"));\r\n metaData.add(\"IsBeing\",new Integer(1), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"ImageSource\", \"Creatures\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Image\", new Integer(340), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"IsMobile\",new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"IsBlocking\", new Integer(1), new Integer[]{new Integer(0), new Integer(1)}, MetaDataEntry.CERTAIN_VALUES, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"MoveCost\", new Integer(100), null, MetaDataEntry.POSITIVE_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"DeathDecoration\", \"blood pool\", null, MetaDataEntry.ANY_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"NameType\", new Integer(Description.NAMETYPE_NORMAL), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n metaData.add(\"Z\", new Integer(Thing.Z_MOBILE), null, MetaDataEntry.FIX_VALUE, MetaDataEntry.MANDATORY_PROPERTY);\r\n lmd.add(BEING, metaData);\r\n \r\n lmd = createEffectMetaData(lmd);\r\n lmd = createPoisonMetaData(lmd);\r\n lmd = createFoodMetaData(lmd);\r\n lmd = createScrollMetaData(lmd);\r\n lmd = createMissileMetaData(lmd);\r\n lmd = createRangedWeaponMetaData(lmd);\r\n lmd = createPotionMetaData(lmd);\r\n lmd = createWandMetaData(lmd);\r\n lmd = createRingMetaData(lmd);\r\n lmd = createCoinMetaData(lmd);\r\n lmd = createArmourMetaData(lmd);\r\n lmd = createWeaponMetaData(lmd);\r\n lmd = createSecretMetaData(lmd);\r\n lmd = createSpellBookMetaData(lmd);\r\n lmd = createChestMetaData(lmd);\r\n lmd = createDecorationMetaData(lmd);\r\n lmd = createSceneryMetaData(lmd);\r\n lmd = createPortalMetaData(lmd);\r\n lmd = createTrapMetaData(lmd);\r\n createMonsterMetaData(lmd);\r\n createPersonMetaData(lmd);\r\n return lmd;\r\n }", "public WritableMp3File(String arg0) throws IOException,\n UnsupportedTagException, InvalidDataException {\n super(arg0);\n // TODO Auto-generated constructor stub\n }", "public abstract T parseFSMeta(T river, Map<String, Object> content);", "public void showMetadata() {\n String title;\n String description;\n if (fileHandler.metaTitle.equals(\"\")) {\n title = \"No title\";\n } else {\n title = fileHandler.metaTitle;\n }\n if (fileHandler.metaData.equals(\"\")) {\n description = \"No description available. Try loading an RLE-file!\";\n } else {\n description = fileHandler.metaData;\n }\n PopUpAlerts.metaData(title, description);\n }", "public TreeMap<Object, Metadata> metadata_reader(String filepath) throws Exception {\r\n String lang = Globals.CURRENT_LOCALE.getLanguage();\r\n TreeMap<Object, Metadata> metadatas = new TreeMap<Object, Metadata>();\r\n\r\n //Hash dei MIDs dei nodi obbligatori\r\n TreeMap forceAddMID = new TreeMap();\r\n forceAddMID.put(\"98\", 1);\r\n forceAddMID.put(\"14\", 1);\r\n forceAddMID.put(\"15\", 1);\r\n forceAddMID.put(\"64\", 1);\r\n forceAddMID.put(\"65\", 1);\r\n forceAddMID.put(\"122\", 1);\r\n forceAddMID.put(\"105\", 1);\r\n forceAddMID.put(\"23\", 1); //format\r\n forceAddMID.put(\"24\", 1); //location\r\n forceAddMID.put(\"25\", 1); //filesize\r\n forceAddMID.put(\"17\", 1); //technical\r\n forceAddMID.put(\"22\", 1); //Classification\r\n forceAddMID.put(\"45\", 1); //Taxonpath\r\n forceAddMID.put(\"46\", 1); //Source\r\n forceAddMID.put(\"47\", 1); //Taxon\r\n forceAddMID.put(\"82\", 1); //Kontextuelle Angaben\r\n forceAddMID.put(\"89\", 1); //REFERENZ\r\n forceAddMID.put(\"94\", 1); //Referenz\r\n forceAddMID.put(\"95\", 1); //Referenznummer\r\n forceAddMID.put(\"137\", 1); //Referenznummer\r\n forceAddMID.put(\"123\", 1); //identifiers\r\n forceAddMID.put(\"124\", 1); //identifiers\r\n forceAddMID.put(\"125\", 1); //identifiers\r\n forceAddMID.put(\"5\", 1); //keywords\r\n\tforceAddMID.put(\"96\", 1); // GPS\r\n forceAddMID.put(\"6\", 1); // Copertura\r\n forceAddMID.put(\"84\", 1); // Dimensioni\r\n forceAddMID.put(\"83\", 1); // Descrizione\r\n forceAddMID.put(\"93\", 1); // Tipo Materiale\r\n forceAddMID.put(\"88\", 1); // Unita di misura\r\n forceAddMID.put(\"85\", 1); // Lunghezza\r\n forceAddMID.put(\"86\", 1); // Larghezza\r\n forceAddMID.put(\"87\", 1); // Altezza\r\n forceAddMID.put(\"92\", 1); // Diametro\r\n \r\n forceAddMID.put(\"11\", 1); // Contributo\r\n forceAddMID.put(\"12\", 1); // Ruolo\r\n //forceAddMID.put(\"126\", 1); // Altro Ruolo\r\n forceAddMID.put(\"13\", 1); // Dati Personali\r\n forceAddMID.put(\"14\", 1); // Nome\r\n forceAddMID.put(\"15\", 1); // Cognome \r\n forceAddMID.put(\"63\", 1); // Ente\r\n forceAddMID.put(\"64\", 1); // Titolo\r\n forceAddMID.put(\"65\", 1); // Titolo\r\n //forceAddMID.put(\"66\", 1); // Tipo\r\n forceAddMID.put(\"148\", 1); // Numero Matricola\r\n \r\n /*forceAddMID.put(\"115\", 1); // Provenienza\r\n forceAddMID.put(\"114\", 1); // Provenienza - info\r\n forceAddMID.put(\"121\", 1); // Provenienza - tipo materiale\r\n forceAddMID.put(\"119\", 1); // Provenienza - note\r\n forceAddMID.put(\"107\", 1); // Provenienza - ruolo\r\n forceAddMID.put(\"106\", 1); // Provenienza - dati personali\r\n forceAddMID.put(\"108\", 1); // Provenienza - Nome\r\n forceAddMID.put(\"109\", 1); // Provenienza - Cognome\r\n forceAddMID.put(\"113\", 1); // Provenienza - Ente\r\n forceAddMID.put(\"110\", 1); // Provenienza - Titolo uno\r\n forceAddMID.put(\"111\", 1); // Provenienza - Titolo due\r\n forceAddMID.put(\"112\", 1); // Provenienza - tipo\r\n forceAddMID.put(\"117\", 1); // Provenienza - contributo\r\n forceAddMID.put(\"118\", 1); // Provenienza - contributo\r\n forceAddMID.put(\"116\", 1); // Provenienza - contributo\r\n forceAddMID.put(\"120\", 1); // Provenienza - contributo*/\r\n \r\n try {\r\n //selectedClassificationList = new TreeMap<String, String>();\r\n \r\n DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\r\n DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();\r\n Document doc;\r\n \r\n File urlf = new File(filepath);\r\n doc = dBuilder.parse(urlf);\r\n\r\n Node n = doc.getFirstChild();\r\n\r\n if (n.getNodeType() == Node.ELEMENT_NODE) {\r\n Element iENode = (Element) n;\r\n metadata_reader_metadatas(iENode, metadatas, false, forceAddMID, lang);\r\n }\r\n } catch (Exception ex) {\r\n throw ex;\r\n }\r\n\r\n return metadatas;\r\n }", "public @Nullable MediaMetadata2 getMetadata() {\n return mMetadata;\n }", "public void getArtistsMetaDataFromDevice(){\n // implement a cursorLoader\n ContentResolver resolver = getContentResolver();\n Cursor cursor = resolver.query(MediaStore.Audio.Artists.INTERNAL_CONTENT_URI,null,null,null,MediaStore.Audio.ArtistColumns.ARTIST);\n }", "public void parseHeader() {\n\t\tthis.release = (Integer) this.headerData.get(0);\n\t\tthis.endian = (ByteOrder) this.headerData.get(1);\n\t\tthis.K = (Short) this.headerData.get(2);\n\t\tthis.datasetLabel = (String) this.headerData.get(4);\n\t\tthis.datasetTimeStamp = (String) this.headerData.get(5);\n\t\tthis.mapOffset = (Integer) this.headerData.get(6);\n\t}", "@Override\r\n\tpublic void endElement(String uri, String localName, String qName)\r\n\t\t\tthrows SAXException {\n\t\tif(localName.equals(\"song_elt\")){\r\n\t\t\tmp3.setType(\"\");\r\n\t\t\tmp3.setArtist_id(\"\");\r\n\t\t\tmp3.setPic_small(\"\");\r\n\t\t\tmp3.setLrclink(\"\");\r\n\t\t\tmp3.setAlbum_title(\"\");\r\n\t\t\tPublicVariable.networkMp3ModelList.add(mp3);\r\n\t\t}\r\n\t\ttagName = \"\";\r\n\t}", "public static void main(String[] args) throws IOException {\n InputStream mp3 = new FileInputStream(args[0]);\n\n List<byte[]> blocks = new ArrayList<byte[]>();\n SoundStreamHead head = MP3Helper.streamingBlocks(mp3, 30, blocks);\n\n Movie movie = new Movie();\n movie.setFrameRate(30);\n\n Frame f = movie.appendFrame();\n f.setSoundHeader(head);\n\n for (Iterator<byte[]> i = blocks.iterator(); i.hasNext();) {\n byte[] data = i.next();\n f.setSoundData(data);\n f = movie.appendFrame();\n }\n\n movie.write(args[1]);\n }", "private static void loadMusic()\n\t{\n\t\t// TODO: update this with the correct file names.\n\t\tmusic = new ArrayList<Music>();\n\t\t\n\t\ttry\n\t\t{\n\t\t\tmusic.add(Gdx.audio.newMusic(new FileHandle(new File(MUSIC_PATH + \"Lessons-8bit.mp3\"))));\n\t\t\tmusic.add(Gdx.audio.newMusic(new FileHandle(new File(MUSIC_PATH + \"bolo_menu.mp3\"))));\n\t\t\t//music.add(Gdx.audio.newMusic(new FileHandle(new File(MUSIC_PATH + \"song2.ogg\"))));\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\t\n\t\t\tSystem.out.println(e);\n\t\t\te.printStackTrace();\n\t\t\tthrow e;\n\t\t}\n\t}", "public PlayMP3(String filename, GUIView gui) {\n\t\tthis.gui = gui;\n\t\tthis.filename = filename;\n\t}", "public void grabarMetaDato (Vector c) throws IOException\r\n {\r\n // se supone que el archivo está recién creado y abierto\r\n \r\n // grabamos la cantidad de campos al inicio del archivo\r\n maestro.writeInt(c.size());\r\n \r\n // ahora grabamos los metadatos propiamente dichos\r\n for(int i = 0; i<c.size(); i++)\r\n {\r\n grabarMetaDato((Campo)c.get(i));\r\n }\r\n \r\n iniDatos = maestro.getFilePointer();\r\n }", "public org.thdl.lex.component.Meta getMeta();", "private List<Music> parseJSON(JSONArray ary)throws JSONException {\r\n\t\tList<Music> musics=new ArrayList<Music>();\r\n\t\tfor(int i=0; i<ary.length(); i++){\r\n\t\t\tJSONObject obj=ary.getJSONObject(i);\r\n\t\t\tMusic m=new Music();\r\n\t\t\tm.setId(obj.getInt(\"id\"));\r\n\t\t\tm.setAlbum(obj.getString(\"album\"));\r\n\t\t\tm.setAlbumpic(obj.getString(\"albumpic\"));\r\n\t\t\tm.setAuthor(obj.getString(\"author\"));\r\n\t\t\tm.setComposer(obj.getString(\"composer\"));\r\n\t\t\tm.setDowncount(obj.getString(\"downcount\"));\r\n\t\t\tm.setDurationtime(obj.getString(\"durationtime\"));\r\n\t\t\tm.setFavcount(obj.getString(\"favcount\"));\r\n\t\t\tm.setMusicpath(obj.getString(\"musicpath\"));\r\n\t\t\tm.setName(obj.getString(\"name\"));\r\n\t\t\tm.setSinger(obj.getString(\"singer\"));\r\n\t\t\tmusics.add(m);\r\n\t\t}\r\n\t\treturn musics;\r\n\t}", "private void parseTitleField() {\n\t\tif (track.length() == 0) {\n\t\t\tString titleLC = title.toLowerCase();\n\t\t\tfor (Entry<String, String> entry : trackPrefixes.entrySet()) {\n\t\t\t\tString key = entry.getKey();\n\t\t\t\tString value = entry.getValue();\n\t\t\t\tif (titleLC.startsWith(key)) {\n\t\t\t\t\ttrack = value;\n\t\t\t\t\ttitle = title.substring(key.length());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public abstract void parse() throws IOException;", "public Music createMusic(String file);", "public static Vector<Metadata> ReadingMetadata(File file){\n\t\tVector<Metadata> v = new Vector<Metadata>(); \n\t\ttry {\n\t\t\tObjectInputStream input = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));\n\t\t\tv = (Vector<Metadata>)input.readObject();\n\t\t\tinput.close();\n\t\t} catch(ClassNotFoundException e) {\n\t\t\tSystem.out.println(\"List Not Found\");\n\t\t\te.printStackTrace();\n\t\t} catch(IOException e) {\n\t\t\tSystem.out.println(\"Error of I/O\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn v;\n\t}", "AnimationObject3d getParsedAnimationObject();", "private static Gav extractGavInformation(JarFile jarFile, JarEntry jarEntry) throws IOException {\n InputStream is = null;\n ByteArrayOutputStream bos = null;\n StringReader stringReader = null;\n try {\n is = jarFile.getInputStream(jarEntry);\n bos = new ByteArrayOutputStream();\n int i = 0;\n while ((i = is.read()) != -1) {\n bos.write(i);\n }\n String pomContent = new String(bos.toByteArray());\n stringReader = new StringReader(pomContent);\n Properties p = new Properties();\n p.load(stringReader);\n return new Gav(p.getProperty(\"groupId\"), p.getProperty(\"artifactId\"), p.getProperty(\"version\"));\n } finally {\n safeClose(is);\n safeClose(bos);\n safeClose(stringReader);\n }\n }", "public void mp3(View view) {\n mp1 = MediaPlayer.create(this, R.raw.heyjude);\n mp1.setLooping(false);\n mp1.setVolume(100, 100);\n mp1.start();\n }", "public String getAlbumInfo() {\n String albumInfo = \"\";\n Elements elements = album.getElementsByClass(\"header-new-title\");\n albumInfo += \"<strong>\" + elements.text() + \"</strong> ( \";\n elements = album.getElementsByClass(\"catalogue-metadata-description\");\n albumInfo += elements.get(1).text() + \" )\\n\\n\" + getScrobbles(album);\n\n String wiki = getWiki(albumLink);\n if (wiki.contains(\"<i>Do you know any background info about this?</i>\\n\\n\"))\n return albumInfo + \"\\n\\n\" + wiki;\n if (wiki.length() > 400)\n wiki = wiki.substring(0, 400) + \" ...\";\n\n albumInfo += \"\\n\\n\" + wiki + \"\\n\\n\" + getLink(albumLink + \"/+wiki\", \" Continue on Last.fm\");\n return albumInfo;\n }", "boolean hasMultimediaData();", "public interface MP3Player {\n public void play(String audioType, String fileName);\n}" ]
[ "0.6820754", "0.6699472", "0.6376671", "0.6254576", "0.6252274", "0.60907733", "0.60876924", "0.58403915", "0.5792162", "0.57461846", "0.572713", "0.56824636", "0.56483227", "0.5614204", "0.5583717", "0.5558819", "0.55524886", "0.5516306", "0.5515414", "0.54570436", "0.54175943", "0.54148996", "0.53940827", "0.5363743", "0.5283743", "0.52693063", "0.52680796", "0.52554685", "0.52526736", "0.5240214", "0.5215204", "0.51781577", "0.5138924", "0.513554", "0.5135165", "0.510009", "0.509475", "0.508727", "0.5076347", "0.5074579", "0.5061665", "0.50444", "0.5038342", "0.5033925", "0.50245714", "0.49810144", "0.49684668", "0.4962224", "0.49563915", "0.49561232", "0.49542496", "0.49481398", "0.49441054", "0.49386975", "0.49281764", "0.49246225", "0.49097142", "0.49092808", "0.49043056", "0.48864207", "0.4875405", "0.48671392", "0.48635665", "0.4863124", "0.48609623", "0.48604715", "0.48568708", "0.48499796", "0.48393574", "0.48350704", "0.48196688", "0.48152035", "0.48067978", "0.4801447", "0.47969896", "0.47965986", "0.4790318", "0.47854838", "0.4772403", "0.4769766", "0.47600883", "0.47539803", "0.47516403", "0.47495055", "0.474663", "0.47419", "0.47361767", "0.47278476", "0.47220835", "0.47202924", "0.47199082", "0.47133484", "0.47072512", "0.47070602", "0.47019982", "0.46999156", "0.46948043", "0.4688206", "0.46846798", "0.46838033" ]
0.7748263
0
Gets the execution type.
public String getExecutionType() { return executionType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public ExecutionType executionType() {\n return this.executionType;\n }", "public int getExecutionType() {\n\t\treturn 0;\n\t}", "public Class getRunTimeType() {\n return lho.getRuntimeType();\n }", "public Executable.ExecKind getExecKind() {\n\t\t\treturn ((TSExecutable)this.getTypeSpec()).getExecKind();\n\t\t}", "public Class getEvaluationType() {\n return lho.getOperandType();\n }", "public TaskType getTaskType() {\n return (TaskType) commandData.get(CommandProperties.TASK_TYPE);\n }", "public InvocationType getInvocationType() {\n return invocationType;\n }", "@Override\n\tpublic String getRunType() {\n\t\treturn model.getRunType();\n\t}", "public Executable.ExecKind getExecKind() {\n\t\t\treturn (Executable.ExecKind)this.getData(Index_ExecKind);\n\t\t}", "public RunType runType() {\n return this.runType;\n }", "public final String getType() {\n return this.getClass().getName();\n }", "public String getType() {\r\n return this.getClass().getName();\r\n }", "public void setExecutionType(String executionType) {\n\t\tthis.executionType = executionType;\n\t}", "@Override\n\tpublic java.lang.String getRunType() {\n\t\treturn _scienceApp.getRunType();\n\t}", "public String getType() {\n return theTaskType ;\n }", "public String get_type() throws Exception {\n\t\treturn this.type;\n\t}", "public String getType() {\n return (String) getObject(\"type\");\n }", "public static String getType() {\n\t\treturn type;\n\t}", "public ProcessType getType() {\n\t\treturn this.type;\n\t}", "public final String type() {\n return type;\n }", "public Type getType () {\n\t\treturn type;\n\t}", "public Type type() {\n\t\treturn type;\n\t}", "public String getType () {\n return type;\n }", "public String getType () {\n return type;\n }", "public String getType () {\n return type;\n }", "public final slm.proxies.ProcessType getProcessType()\r\n\t{\r\n\t\treturn getProcessType(getContext());\r\n\t}", "public synchronized String getType() {\n\t\treturn type;\n\t}", "public Type getType() {\n return this.te.getType();\n }", "public String obtenirType() {\n\t\treturn this.type;\n\t}", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public Type getType() {\n\t\treturn type;\n\t}", "public Type getType() {\n\t\treturn type;\n\t}", "public String getType() {\n\t\treturn _type;\n\t}", "public String getType() {\r\n return type;\r\n }", "public Class<?> getType() {\n return this.value.getClass();\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public String getType() {\n return type;\n }", "public int getType() {\r\n\t\treturn (type);\r\n\t}", "public Type getType() {\n return type;\n }", "public java.lang.String getEXECUTION()\n {\n \n return __EXECUTION;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public Type getType() {\n return type;\n }", "public int type() {\n return type;\n }", "public String getType() {\n return _type;\n }", "public String getType() {\n\t\treturn type;\n\t}", "public String getType() {\n\t\treturn type;\n\t}", "public String getType() {\n\t\treturn type;\n\t}", "public String getType() {\n\t\treturn type;\n\t}", "public String getType() {\n\t\treturn type;\n\t}" ]
[ "0.8263217", "0.78576165", "0.75507325", "0.69559014", "0.69282407", "0.6834094", "0.67429197", "0.6719744", "0.6641405", "0.6586083", "0.65576255", "0.65575665", "0.6552494", "0.64242125", "0.6329066", "0.6308312", "0.6286232", "0.6285029", "0.6282359", "0.62108", "0.6172917", "0.6170925", "0.6165889", "0.6165889", "0.6165889", "0.61580247", "0.6146429", "0.6140826", "0.6136079", "0.6127938", "0.6127938", "0.61203045", "0.61203045", "0.61182207", "0.61167616", "0.61152077", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6114643", "0.6113168", "0.6109432", "0.6105758", "0.6102023", "0.6102023", "0.6102023", "0.6102023", "0.6102023", "0.6102023", "0.6102023", "0.6102023", "0.6102023", "0.6102023", "0.60823977", "0.6081679", "0.60786915", "0.60786915", "0.60786915", "0.60786915", "0.60786915" ]
0.85768443
0
Sets the execution type.
public void setExecutionType(String executionType) { this.executionType = executionType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getExecutionType() {\n\t\treturn executionType;\n\t}", "@Override\n\tpublic void setRunType(java.lang.String runType) {\n\t\t_scienceApp.setRunType(runType);\n\t}", "final public void setType(String type)\n {\n setProperty(TYPE_KEY, (type));\n }", "public void set_type(String t)\n {\n type =t;\n }", "public final native void setType(String type) /*-{\n this.setType(type);\n }-*/;", "void setType(String type) {\n this.type = type;\n }", "public void setType(org.aspectj.compiler.base.ast.Type type) {\n this.type = type;\n }", "public static void setType(String type) {\n Globals.type = type;\n setProperty(\"type\", type);\n }", "@Override\n\tpublic void setRunType(String runType) {\n\t\tmodel.setRunType(runType);\n\t}", "public void setType(Object type)\r\n {\r\n\tthis.type = type;\r\n }", "void setType(Type type)\n {\n this.type = type;\n }", "public void setType(String type);", "public void setType(String type);", "public void setType(String type);", "public void setType(Type t) {\n type = t;\n }", "void setType(java.lang.String type);", "public final void setType(String type){\n\t\tthis.type = type;\t\n\t}", "public void set_type(String type) throws Exception{\n\t\tthis.type = type;\n\t}", "public final void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\r\n this.type = type;\r\n }", "public void setType (String type) {\n this.type = type;\n }", "public void setType (String type) {\n this.type = type;\n }", "public void setType (String type) {\n this.type = type;\n }", "public void setType( Type type ) {\n assert type != null;\n this.type = type;\n }", "public void setType(String type){\r\n if(type == null){\r\n throw new IllegalArgumentException(\"Type can not be null\");\r\n }\r\n this.type = type;\r\n }", "public void setType(type type) {\r\n\t\tthis.Type = type;\r\n\t}", "public void setType (String typ) {\n type = typ;\n }", "public void setType( String type )\n {\n this.type = type;\n }", "public void setType(String type) {\r\n this.type = type;\r\n }", "public void setType(String type) {\r\n this.type = type;\r\n }", "public void setType(String type) {\r\n this.type = type;\r\n }", "public void setType(String type) {\r\n this.type = type;\r\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType( String type ) {\n this.type = type;\n }", "public void setType(Type type) {\n this.type = type;\n }", "public void setType(Type type) {\n this.type = type;\n }", "public void setType(Type type) {\n this.type = type;\n }", "public void setType(String type) \n {\n this.type = type;\n }", "public void setType(String type) {\r\n this.type = type;\r\n }", "@Override\n public void setType(String type) {\n this.type = type;\n }", "public void setType(String type){\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type){\n \tthis.type = type;\n }", "private void setType(String type) {\n mType = type;\n }", "public void setType(Type type){\n\t\tthis.type = type;\n\t}", "public void setType(String type) {\n this.type = type;\n }", "public ExecutionType executionType() {\n return this.executionType;\n }", "public void setType(Type t) {\n\t\ttype = t;\n\t}", "public void setType(String value) {\n this.type = value;\n }", "public void setType(String type) {\r\r\n\t\tthis.type = type;\r\r\n\t}", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\r\n\t\tthis.type = type;\r\n\t}", "public void setType(String type) {\r\n\t\tthis.type = type;\r\n\t}", "public void setType(String type) {\r\n\t\tthis.type = type;\r\n\t}", "public void setType(String t) {\n\ttype = t;\n }", "public void setType(String type) {\n m_Type = type;\n }", "public void set_type(String type)\r\n\t{\r\n\t\tthis.type = type;\r\n\t}", "public void setType(String type){\n\t\tthis.type = type;\n\t}", "public void setType(int type) {\r\n this.type = type;\r\n }", "public void setType(int type) {\r\n this.type = type;\r\n }", "public void setType (int type) {\n this.type = type;\n }", "public void setType (int type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType(String type) {\n this.type = type;\n }", "public void setType( int type ) {\r\n typ = type;\r\n }", "public void setType(String t) {\n\t\tthis.type = t;\n\t}", "public void setType(String val) {\n type = val;\n }", "public void setType(String type) {\n\n this.type = type;\n }", "public void setType(String type) {\r\n\t\tthis.type=type;\r\n\t}", "public void setType(final Type type) {\n this.type = type;\n }", "public void setType(int type) {\n this.type = type;\n }", "public void setType(String type) {\n\t\tthis.type = type;\n\t}", "public void setType(String type) {\n\t\tthis.type = type;\n\t}", "public void setType(String type) {\n\t\tthis.type = type;\n\t}", "public void setType(String type) {\n\t\tthis.type = type;\n\t}", "public void setType(String type) {\n\t\tthis.type = type;\n\t}", "public void setType(String type) {\n\t\tthis.type = type;\n\t}", "public void setType(String type) {\n\t\tthis.type = type;\n\t}" ]
[ "0.6650202", "0.64997846", "0.6469655", "0.64407474", "0.6388743", "0.63777566", "0.6371345", "0.63314044", "0.63251996", "0.6307401", "0.63050205", "0.63016766", "0.63016766", "0.63016766", "0.6300728", "0.62503177", "0.6244735", "0.62251645", "0.6216384", "0.6213301", "0.6207609", "0.6207609", "0.6207609", "0.6207121", "0.6204885", "0.61981875", "0.61761993", "0.61641526", "0.61622757", "0.61622757", "0.61622757", "0.61622757", "0.6161231", "0.6161231", "0.61609286", "0.61601305", "0.61601305", "0.61601305", "0.61472327", "0.6146283", "0.6144214", "0.6141736", "0.6139742", "0.61391073", "0.6135823", "0.6117985", "0.61093134", "0.61063474", "0.6099582", "0.6099066", "0.60940015", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.6093904", "0.60748947", "0.60748947", "0.60748947", "0.6073614", "0.60674286", "0.60669506", "0.60486484", "0.60476494", "0.60476494", "0.6043148", "0.6043148", "0.6041763", "0.6041763", "0.604038", "0.6031165", "0.6028454", "0.60282063", "0.6014997", "0.6009449", "0.6002793", "0.5978805", "0.5978805", "0.5978805", "0.5978805", "0.5978805", "0.5978805", "0.5978805" ]
0.7735261
0
Created by Naeem Ibrahim on 10/17/2016.
public interface OnLoadMoreListener { void onLoadMore(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private stendhal() {\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "public final void mo51373a() {\n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "protected MetadataUGWD() {/* intentionally empty block */}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n protected void initialize() {\n\n \n }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\n public void init() {\n\n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "public void mo38117a() {\n }", "public void mo4359a() {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n void init() {\n }", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\n public void init() {\n }", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n public void memoria() {\n \n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tprotected void initialize() {\n\n\t}", "public void mo6081a() {\n }", "@Override\n\tpublic void nghe() {\n\n\t}", "private static void cajas() {\n\t\t\n\t}", "protected void mo6255a() {\n }", "private void init() {\n\n\t}", "@Override\n protected void init() {\n }", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\n public void init() {}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n public void initialize() { \n }", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void initialize() {\n \n }", "@Override\n public void func_104112_b() {\n \n }", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "public void mo55254a() {\n }", "Petunia() {\r\n\t\t}", "@Override\r\n\tpublic void init() {}", "@SuppressWarnings(\"unused\")\n\tprivate void version() {\n\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public void initialize() {\n }", "@Override\n public int describeContents() { return 0; }", "protected void onFirstUse() {}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "protected Doodler() {\n\t}", "private TMCourse() {\n\t}", "@Override\n\tpublic void create () {\n\n\t}", "private Singletion3() {}" ]
[ "0.6356007", "0.63338655", "0.609262", "0.6048923", "0.5972795", "0.5928356", "0.5928356", "0.5906302", "0.5901564", "0.5901564", "0.5901564", "0.5901564", "0.5901564", "0.5901564", "0.58808374", "0.58808374", "0.58654755", "0.58522284", "0.5848182", "0.5838211", "0.5800012", "0.5795992", "0.5781733", "0.5774833", "0.5752304", "0.57373774", "0.57370305", "0.5733655", "0.5721442", "0.5719282", "0.5716038", "0.57159585", "0.5711605", "0.5711605", "0.57034385", "0.5698652", "0.569392", "0.5678747", "0.5675539", "0.5670291", "0.5670291", "0.5670291", "0.5670291", "0.5670291", "0.5670291", "0.5670291", "0.5667818", "0.56556475", "0.5647773", "0.5633881", "0.56316274", "0.563069", "0.5627498", "0.56140876", "0.56041956", "0.56041956", "0.56041956", "0.56041235", "0.560376", "0.5603019", "0.5596925", "0.5591406", "0.5591406", "0.5591406", "0.5591406", "0.5591406", "0.55860746", "0.55737686", "0.5568891", "0.5568891", "0.5565086", "0.5560373", "0.5560373", "0.55529916", "0.5546565", "0.55325556", "0.5523241", "0.55202913", "0.5519688", "0.551347", "0.55130225", "0.5507305", "0.5507305", "0.5507305", "0.5507305", "0.5507305", "0.5507305", "0.5507305", "0.5507305", "0.5507305", "0.5507305", "0.5507019", "0.5502766", "0.550191", "0.5500661", "0.5500661", "0.5500661", "0.5498831", "0.54972374", "0.54861563", "0.547975" ]
0.0
-1
capturando valores del form
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String nombre = request.getParameter("nombre"); String descripcion = request.getParameter("descripcion"); String cantidad = request.getParameter("cantidad"); String precio = request.getParameter("precio"); String pago = request.getParameter("pago"); //creando objeto del costructor modelo.ventas venta = new modelo.ventas(); //almacenando datos en las variables con el constructor venta.setNombre(nombre); venta.setDescripcion(descripcion); venta.setCantidad(Integer.parseInt(cantidad)); venta.setPrecio(Double.parseDouble(precio)); venta.setPago(Integer.parseInt(pago)); //creando objeto para guardar cliente modelo.addVenta addventa = new modelo.addVenta(); try { addventa.agrega(venta); } catch (SQLException ex) { Logger.getLogger(formVenta.class.getName()).log(Level.SEVERE, null, ex); } response.sendRedirect("ventas");//si se guarda exitosamente se redirecciona a membresia }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void readForm() {\n }", "public void limpiarCamposFormBusqueda() {\n\t}", "void storeFormState();", "private void processFormField(FileItem item) {\n if (item.isFormField()) {\n String name = item.getFieldName();\n String value = item.getString();\n log(\"name: \" + name + \" value: \" + value);\n }\n }", "private String getFormValue(EditText edit){\n if(edit!=null) return edit.getText().toString();\n else return \"\";\n }", "@Override\r\n protected void onForm(ClientForm form) {\n \r\n }", "private void populateForm() {\n Part selectedPart = (Part) PassableData.getPartData();\n partPrice.setText(String.valueOf(selectedPart.getPrice()));\n partName.setText(selectedPart.getName());\n inventoryCount.setText(String.valueOf(selectedPart.getStock()));\n partId.setText(String.valueOf(selectedPart.getId()));\n maximumInventory.setText(String.valueOf(selectedPart.getMax()));\n minimumInventory.setText(String.valueOf(selectedPart.getMin()));\n\n if (PassableData.isOutsourced()) {\n Outsourced part = (Outsourced) selectedPart;\n variableTextField.setText(part.getCompanyName());\n outsourced.setSelected(true);\n\n } else if (!PassableData.isOutsourced()) {\n InHouse part = (InHouse) selectedPart;\n variableTextField.setText(String.valueOf(part.getMachineId()));\n inHouse.setSelected(true);\n }\n\n\n }", "private void initForm(@Nullable View view){\n inputCalendar = formatCalendar(new GregorianCalendar());\n\n if (view == null) view = getView();\n\n setValueOfField(view, R.id.at_button_date, getContext().getString(R.string.ad_button_date));\n setValueOfField(view, R.id.at_editTextNumberSigned_timeValue, \"0\");\n setValueOfField(view, R.id.at_editTextNumberSigned_levelEasyValue, \"0\");\n setValueOfField(view, R.id.at_editTextNumberSigned_levelMiddleValue, \"0\");\n setValueOfField(view, R.id.at_editTextNumberSigned_levelHighValue, \"0\");\n setValueOfField(view, R.id.at_editTextNumberSigned_levelExpertValue, \"0\");\n }", "public abstract String toFORMParam();", "protected RespostaFormularioPreenchido() {\n // for ORM\n }", "public abstract FullResponse onServeFormParams(Map<String, List<String>> formParams);", "@Override\n\tpublic void onFormCreate(AbstractForm arg0, DataMsgBus arg1) {\n\t}", "public void setForm(Form form)\n {\n this.form = form;\n }", "public String getForm() {\r\n\t\treturn form;\r\n\t}", "private void getValues(){\n username = etUsername.getText().toString();\n password = etPassword.getText().toString();\n }", "protected void saveInput() {\r\n value = valueText.getText();\r\n }", "private void onValider() {\n recuperation​(Reponse.getText());\r\n\r\n }", "private void loadForm() {\n service.getReasons(refusalReasons);\n service.getVacEligibilty(vacElig);\n service.getVacSites(vacSites);\n service.getReactions(vacReactions);\n service.getOverrides(vacOverrides);\n updateComboValues();\n \n selPrv = \"\";\n selLoc = \"\";\n \n //datGiven.setDateConstraint(new SimpleDateConstraint(SimpleDateConstraint.NO_NEGATIVE, DateUtil.addDays(patient.getBirthDate(), -1, true), null, BgoConstants.TX_BAD_DATE_DOB));\n datGiven.setDateConstraint(getConstraintDOBDate());\n datEventDate.setConstraint(getConstraintDOBDate());\n radFacility.setLabel(service.getParam(\"Caption-Facility\", \"&Facility\"));\n if (immunItem != null) {\n \n txtVaccine.setValue(immunItem.getVaccineName());\n txtVaccine.setAttribute(\"ID\", immunItem.getVaccineID());\n txtVaccine.setAttribute(\"DATA\", immunItem.getVaccineID() + U + immunItem.getVaccineName());\n setEventType(immunItem.getEventType());\n \n radRefusal.setDisabled(!radRefusal.isChecked());\n radHistorical.setDisabled(!radHistorical.isChecked());\n radCurrent.setDisabled(!radCurrent.isChecked());\n \n visitIEN = immunItem.getVisitIEN();\n if (immunItem.getProvider() != null) {\n txtProvider.setText(FhirUtil.formatName(immunItem.getProvider().getName()));\n txtProvider.setAttribute(\"ID\", immunItem.getProvider().getId().getIdPart());\n selPrv = immunItem.getProvider().getId().getIdPart() + U + U + immunItem.getProvider().getName();\n }\n switch (immunItem.getEventType()) {\n case REFUSAL:\n ListUtil.selectComboboxItem(cboReason, immunItem.getReason());\n txtComment.setText(immunItem.getComment());\n datEventDate.setValue(immunItem.getDate());\n break;\n case HISTORICAL:\n datEventDate.setValue(immunItem.getDate());\n txtLocation.setValue(immunItem.isImmunization() ? immunItem.getLocationName() : \"\");\n txtLocation.setAttribute(\"ID\", immunItem.isImmunization() ? immunItem.getLocationID() : \"\");\n selLoc = immunItem.getLocationID() + U + U + immunItem.getLocationName();\n radOther.setSelected(txtLocation.getAttribute(\"ID\") != null\n ? txtLocation.getAttribute(\"ID\").toString().isEmpty() : false);\n txtAdminNote.setText(immunItem.getAdminNotes());\n ZKUtil.disableChildren(fraDate, true);\n ZKUtil.disableChildren(fraHistorical, true);\n default:\n service.getLot(lotNumbers, getVaccineID());\n loadComboValues(cboLot, lotNumbers, comboRenderer);\n loadVaccination();\n txtLocation.setValue(immunItem.isImmunization() ? immunItem.getLocationName() : \"\");\n txtLocation.setAttribute(\"ID\", immunItem.isImmunization() ? immunItem.getLocationID() : \"\");\n selLoc = immunItem.getLocationID() + U + U + immunItem.getLocationName();\n radOther.setSelected(txtLocation.getAttribute(\"ID\") != null\n ? txtLocation.getAttribute(\"ID\").toString().isEmpty() : false);\n ListUtil.selectComboboxItem(cboLot, immunItem.getLot());\n ListUtil.selectComboboxItem(cboSite, StrUtil.piece(immunItem.getInjSite(), \"~\", 2));\n spnVolume.setText(immunItem.getVolume());\n datGiven.setDate(immunItem.getDate());\n datVIS.setValue(immunItem.isImmunization() ? immunItem.getVISDate() : null);\n ListUtil.selectComboboxItem(cboReaction, immunItem.getReaction());\n ListUtil.selectComboboxData(cboOverride, immunItem.getVacOverride());\n txtAdminNote.setText(immunItem.getAdminNotes());\n cbCounsel.setChecked(immunItem.wasCounseled());\n }\n } else {\n IUser user = UserContext.getActiveUser();\n Practitioner provider = new Practitioner();\n provider.setId(user.getLogicalId());\n provider.setName(FhirUtil.parseName(user.getFullName()));\n txtProvider.setValue(FhirUtil.formatName(provider.getName()));\n txtProvider.setAttribute(\"ID\", VistAUtil.parseIEN(provider)); //provider.getId().getIdPart());\n selPrv = txtProvider.getAttribute(\"ID\") + U + U + txtProvider.getValue();\n Location location = new Location();\n location.setName(\"\");\n location.setId(\"\");\n datGiven.setDate(getBroker().getHostTime());\n onClick$btnVaccine(null);\n \n if (txtVaccine.getValue().isEmpty()) {\n close(true);\n return;\n }\n \n Encounter encounter = EncounterContext.getActiveEncounter();\n if (!EncounterUtil.isPrepared(encounter)) {\n setEventType(EventType.HISTORICAL);\n radCurrent.setDisabled(true);\n } else {\n if (isCategory(encounter, \"E\")) {\n setEventType(EventType.HISTORICAL);\n Date date = encounter == null ? null : encounter.getPeriod().getStart();\n datEventDate.setValue(DateUtil.stripTime(date == null ? getBroker().getHostTime() : date));\n radCurrent.setDisabled(true);\n txtLocation.setText(user.getSecurityDomain().getName());\n PromptDialog.showInfo(user.getSecurityDomain().getLogicalId());\n txtLocation.setAttribute(\"ID\", user.getSecurityDomain().getLogicalId());\n \n } else {\n if (isVaccineInactive()) {\n setEventType(EventType.HISTORICAL);\n radCurrent.setDisabled(true);\n } else {\n setEventType(EventType.CURRENT);\n radCurrent.setDisabled(false);\n }\n }\n }\n selectItem(cboReason, NONESEL);\n }\n btnSave.setLabel(immunItem == null ? \"Add\" : \"Save\");\n btnSave.setTooltiptext(immunItem == null ? \"Add record\" : \"Save record\");\n txtVaccine.setFocus(true);\n }", "FORM createFORM();", "@Test\n public void value() {\n assertEquals(\"4\", onPage.get(\"select\").withName(\"plain_select\").value());\n // Get the first selected value for a multiple select\n assertEquals(\"2\", onPage.get(\"select\").withName(\"multiple_select\").value());\n // Get the value of the option\n assertEquals(\"1\", onPage.get(\"select\").withName(\"plain_select\").get(\"option\").value());\n assertEquals(\" The textarea content. \", onPage.get(\"textarea\").value());\n assertEquals(\"Enter keywords here\", onPage.get(\"#keywords\").value());\n // Checkboxes and radiobuttons simply return the value of the first element,\n // not the first checked element\n assertEquals(\"google\", onPage.get(\"input\").withName(\"site\").value());\n }", "public Form getForm() {\n return form;\n }", "protected final Form getForm() {\n\t\treturn itsForm;\n\t}", "public interface RecuperarSesionForm\r\n{\r\n /**\r\n * This field is a collection type, and this method allows you to set it into the form.\r\n *\r\n * \r\n *\r\n * @see #setTimeLimit#sArray(Object[])\r\n */\r\n public void setTimeLimit(java.util.Collection timeLimit);\r\n\r\n /**\r\n * This field is a collection type, and this method allows you to get it from the form.\r\n *\r\n * \r\n *\r\n * @see #getTimeLimit#sArray()\r\n */\r\n public java.util.Collection getTimeLimit();\r\n\r\n /**\r\n * This field is a collection type, and this method allows you to set it as an\r\n * array into the form, conversion will be automatically performed.\r\n *\r\n * \r\n *\r\n * @see #setTimeLimit(java.util.Collection)\r\n */\r\n public void setTimeLimitAsArray(Object[] timeLimit);\r\n\r\n /**\r\n * This field is a collection type, and this method allows you to get it as an\r\n * array from the form, conversion will be automatically performed.\r\n *\r\n * \r\n *\r\n * @see #getTimeLimit()\r\n */\r\n public java.lang.Object[] getTimeLimitAsArray();\r\n\r\n /**\r\n * Resets the <code>timeLimit</code> field.\r\n */\r\n public void resetTimeLimit();\r\n\r\n /**\r\n * Sets the <code>title</code> field.\r\n *\r\n * \r\n */\r\n public void setTitle(java.lang.String title);\r\n\r\n /**\r\n * Gets the <code>title</code> field.\r\n *\r\n * \r\n */\r\n public java.lang.String getTitle();\r\n \r\n /**\r\n * Resets the <code>title</code> field.\r\n */\r\n public void resetTitle();\r\n\r\n /**\r\n * Sets the <code>completionThreshold</code> field.\r\n *\r\n * \r\n */\r\n public void setCompletionThreshold(java.lang.String completionThreshold);\r\n\r\n /**\r\n * Gets the <code>completionThreshold</code> field.\r\n *\r\n * \r\n */\r\n public java.lang.String getCompletionThreshold();\r\n \r\n /**\r\n * Resets the <code>completionThreshold</code> field.\r\n */\r\n public void resetCompletionThreshold();\r\n\r\n /**\r\n * Sets the <code>isVisible</code> field.\r\n *\r\n * \r\n */\r\n public void setIsVisible(java.lang.Boolean isVisible);\r\n\r\n /**\r\n * Gets the <code>isVisible</code> field.\r\n *\r\n * \r\n */\r\n public java.lang.Boolean getIsVisible();\r\n \r\n /**\r\n * Resets the <code>isVisible</code> field.\r\n */\r\n public void resetIsVisible();\r\n\r\n /**\r\n * This field is a collection type, and this method allows you to set it into the form.\r\n *\r\n * \r\n *\r\n * @see #setPresentation#sArray(Object[])\r\n */\r\n public void setPresentation(java.util.Collection presentation);\r\n\r\n /**\r\n * This field is a collection type, and this method allows you to get it from the form.\r\n *\r\n * \r\n *\r\n * @see #getPresentation#sArray()\r\n */\r\n public java.util.Collection getPresentation();\r\n\r\n /**\r\n * This field is a collection type, and this method allows you to set it as an\r\n * array into the form, conversion will be automatically performed.\r\n *\r\n * \r\n *\r\n * @see #setPresentation(java.util.Collection)\r\n */\r\n public void setPresentationAsArray(Object[] presentation);\r\n\r\n /**\r\n * This field is a collection type, and this method allows you to get it as an\r\n * array from the form, conversion will be automatically performed.\r\n *\r\n * \r\n *\r\n * @see #getPresentation()\r\n */\r\n public java.lang.Object[] getPresentationAsArray();\r\n\r\n /**\r\n * Resets the <code>presentation</code> field.\r\n */\r\n public void resetPresentation();\r\n\r\n /**\r\n * Sets the <code>selectPresentation</code> field.\r\n *\r\n * \r\n */\r\n public void setSelectPresentation(java.lang.String[] selectPresentation);\r\n\r\n /**\r\n * Gets the <code>selectPresentation</code> field.\r\n *\r\n * \r\n */\r\n public java.lang.String[] getSelectPresentation();\r\n \r\n /**\r\n * Resets the <code>selectPresentation</code> field.\r\n */\r\n public void resetSelectPresentation();\r\n\r\n /**\r\n * The <code>selectPresentation</code> field can be selected from a list,\r\n * this method allows you to retrieve the current elements from that list.\r\n * <p/>\r\n * <i>Please note that the elements from that list are key value pairs, so you will\r\n * need to call <code>getLabel()</code> and <code>getValue()</code> to get the label and\r\n * value for this entry respectively.</i>\r\n *\r\n * @see #getSelectPresentation()\r\n * @see #getSelectPresentationValueList()\r\n * @see #getSelectPresentationLabelList()\r\n * @see #setSelectPresentationLabelList(java.util.Collection,java.lang.String,java.lang.String)\r\n */\r\n public java.lang.Object[] getSelectPresentationBackingList();\r\n\r\n /**\r\n * Convenient method to quickly set the value and label backinglist for the\r\n * selectPresentation property. This method takes a collection of objects, as well as\r\n * the property names to query on these objects in order to find the corresponding\r\n * values and labels.\r\n * <p/>\r\n * Let's say you have a set of value objects with the following properties:\r\n * <ul>\r\n * <li><code>id</code></li>\r\n * <li><code>code</code></li>\r\n * <li><code>name</code></li>\r\n * <li><code>description</code></li>\r\n * </ul>\r\n * But you need to populate the selectPresentation backing list with the <code>id</code> properties as the values and the\r\n * <code>name</code> properties as the labels then you would make a call like this:\r\n * <code>setSelectPresentationBackingList(valueObjects, \"id\", \"name\")</code>\r\n * <p/>\r\n * This method knows how to handle primitive property types as it simply delegates to\r\n * <code>org.apache.commons.beanutils.PropertyUtils.getProperty(Object, String)</code>.\r\n *\r\n * @param items The items from which to read the properties, if this argument is <code>null</code> this method\r\n * will simply clear the existing values and labels\r\n * @param valueProperty the name of the property to query on each object to retrieve\r\n * the corresponding value, cannot be <code>null</code>\r\n * @throws java.lang.IllegalArgumentException if the valueProperty or labelProperty is <code>null</code>\r\n * @throws java.lang.RuntimeException if one of the items in the collection is <code>null</code>, or\r\n * if the caller does not have access one of the object's properties, if an exception was thrown while\r\n * accessing a property or if the property does not exist on at least one of the items\r\n *\r\n * @see #getSelectPresentation()\r\n * @see #getSelectPresentationValueList()\r\n * @see #getSelectPresentationLabelList()\r\n * @see #getSelectPresentationLabelList()\r\n */\r\n public void setSelectPresentationBackingList(java.util.Collection items, String valueProperty, String labelProperty);\r\n\r\n /**\r\n * The <code>selectPresentation</code> field can be selected from a list,\r\n * this method allows you to retrieve the values from that list.\r\n *\r\n * @see #getSelectPresentation()\r\n * @see #getSelectPresentationBackingList()\r\n */\r\n public java.lang.Object[] getSelectPresentationValueList();\r\n\r\n /**\r\n * The <code>selectPresentation</code> field can be selected from a list,\r\n * this method allows you to set the values for that list.\r\n *\r\n * @see #getSelectPresentation()\r\n * @see #getSelectPresentationBackingList()\r\n */\r\n public void setSelectPresentationValueList(java.lang.Object[] selectPresentationValueList);\r\n\r\n /**\r\n * The <code>selectPresentation</code> field can be selected from a list,\r\n * this method allows you to retrieve the labels from that list.\r\n *\r\n * @see #getSelectPresentation()\r\n * @see #getSelectPresentationBackingList()\r\n */\r\n public java.lang.Object[] getSelectPresentationLabelList();\r\n\r\n /**\r\n * The <code>selectPresentation</code> field can be selected from a list,\r\n * this method allows you to set the labels for that list.\r\n *\r\n * @see #getSelectPresentation()\r\n * @see #getSelectPresentationBackingList()\r\n */\r\n public void setSelectPresentationLabelList(java.lang.Object[] selectPresentationLabelList);\r\n\r\n /**\r\n * Sets the <code>referenciado</code> field.\r\n *\r\n * \r\n */\r\n public void setReferenciado(java.lang.String referenciado);\r\n\r\n /**\r\n * Gets the <code>referenciado</code> field.\r\n *\r\n * \r\n */\r\n public java.lang.String getReferenciado();\r\n \r\n /**\r\n * Resets the <code>referenciado</code> field.\r\n */\r\n public void resetReferenciado();\r\n\r\n /**\r\n * Sets the <code>timeLimitAction</code> field.\r\n *\r\n * \r\n */\r\n public void setTimeLimitAction(java.lang.String timeLimitAction);\r\n\r\n /**\r\n * Gets the <code>timeLimitAction</code> field.\r\n *\r\n * \r\n */\r\n public java.lang.String getTimeLimitAction();\r\n \r\n /**\r\n * Resets the <code>timeLimitAction</code> field.\r\n */\r\n public void resetTimeLimitAction();\r\n\r\n /**\r\n * Sets the <code>dataFromLMS</code> field.\r\n *\r\n * \r\n */\r\n public void setDataFromLMS(java.lang.String dataFromLMS);\r\n\r\n /**\r\n * Gets the <code>dataFromLMS</code> field.\r\n *\r\n * \r\n */\r\n public java.lang.String getDataFromLMS();\r\n \r\n /**\r\n * Resets the <code>dataFromLMS</code> field.\r\n */\r\n public void resetDataFromLMS();\r\n\r\n}", "public interface GuardarDatosForm\r\n{\r\n /**\r\n * Sets the <code>valor</code> field.\r\n *\r\n * \r\n */\r\n public void setValor(java.lang.String valor);\r\n\r\n /**\r\n * Gets the <code>valor</code> field.\r\n *\r\n * \r\n */\r\n public java.lang.String getValor();\r\n \r\n /**\r\n * Resets the <code>valor</code> field.\r\n */\r\n public void resetValor();\r\n\r\n}", "private void preparaForm(String opcao) {\n switch(opcao){\n case \"fill\": { preparaFill(); break; }\n case \"novo\": { preparaNovo(); break; }\n case \"alterar\": { preparaAlterar(); break; }\n case \"cancelar\": { preparaCancelar(); break; }\n case \"salvar\": { preparaSalvar(); break; }\n }\n }", "public String inputForm() {\n return inputDataTraveler.validateData();\n }", "public void receberValores() {\n Bundle b = getIntent().getExtras();\n if (b != null) {\n cpf3 = b.getString(\"valor2\");\n renda = b.getDouble(\"valor3\");\n data = b.getString(\"valor4\");\n data2 = b.getString(\"valor5\");\n }\n }", "public void grabarDatos(ActionEvent actionEvent){\r\n int esMo = Integer.parseInt(txtMotos.getText());\r\n estMo = esMo;\r\n int esCar = Integer.parseInt(txtCarros.getText());\r\n estCar = esCar;\r\n int esCam = Integer.parseInt(txtCamiones.getText());\r\n estCam = esCam;\r\n double ctarifa = Double.parseDouble(txtTarifa.getText());\r\n tarifa = ctarifa;\r\n /**\r\n * para eliminar los datos una vez sean guardados de lo contrario quedaria con el mismo\r\n * numero que se coloco.\r\n */\r\n txtMotos.setText(\"\");\r\n txtCarros.setText(\"\");\r\n txtCamiones.setText(\"\");\r\n txtTarifa.setText(\"\");\r\n txtMensaje.setText(\"Informacion grabada satisfactoriamente\");\r\n }", "private void validarForm(AtualizarTramiteEspecificacaoActionForm form){\n\n\t\tString idLocalidade = form.getIdLocalidade();\n\t\tString codigoSetorComercial = form.getCodigoSetorComercial();\n\t\tString idMunicipio = form.getIdMunicipio();\n\t\tString codigoBairro = form.getCodigoBairro();\n\t\tString idSistemaAbastecimento = form.getIdSistemaAbastecimento();\n\t\tString idDistritoOperacional = form.getIdDistritoOperacional();\n\t\tString idZonaAbastecimento = form.getIdZonaAbastecimento();\n\t\tString idSetorAbastecimento = form.getIdSetorAbastecimento();\n\t\tString idSistemaEsgoto = form.getIdSistemaEsgoto();\n\t\tString idSubsistemaEsgoto = form.getIdSubsistemaEsgoto();\n\t\tString idBacia = form.getIdBacia();\n\t\tString idSubBacia = form.getIdSubBacia();\n\t\tString idUnidadeOrganizacionalOrigem = form.getIdUnidadeOrganizacionalOrigem();\n\t\tString idUnidadeOrganizacionalDestino = form.getIdUnidadeOrganizacionalDestino();\n\t\tString indicadorUso = form.getIndicadorUso();\n\n\t\tString numeroNaoInformadoStr = Integer.toString(ConstantesSistema.NUMERO_NAO_INFORMADO);\n\n\t\tFachada fachada = Fachada.getInstancia();\n\n\t\t// Localidade\n\t\tif(!Util.isVazioOuBranco(idLocalidade)){\n\t\t\tFiltroLocalidade filtro = new FiltroLocalidade();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroLocalidade.INDICADORUSO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroLocalidade.ID, idLocalidade));\n\n\t\t\tCollection<Localidade> colecao = fachada.pesquisar(filtro, Localidade.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Localidade\");\n\t\t\t}\n\t\t}\n\n\t\t// Setor Comercial\n\t\tif(Util.isVazioOuBranco(idLocalidade) && !Util.isVazioOuBranco(codigoSetorComercial)){\n\t\t\tthrow new ActionServletException(\"atencao.required\", null, \"Localidade\");\n\t\t}else if(!Util.isVazioOuBranco(idLocalidade) && !Util.isVazioOuBranco(codigoSetorComercial)){\n\t\t\tFiltroSetorComercial filtro = new FiltroSetorComercial();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorComercial.INDICADORUSO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorComercial.ID_LOCALIDADE, idLocalidade));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorComercial.CODIGO_SETOR_COMERCIAL, codigoSetorComercial));\n\n\t\t\tCollection<SetorComercial> colecao = fachada.pesquisar(filtro, SetorComercial.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Setor Comercial\");\n\t\t\t}\n\t\t}\n\n\t\t// Bairro\n\t\tif(Util.isVazioOuBranco(idMunicipio) && !Util.isVazioOuBranco(codigoBairro)){\n\t\t\tthrow new ActionServletException(\"atencao.required\", null, \"Município\");\n\t\t}else if(!Util.isVazioOuBranco(idMunicipio) && !Util.isVazioOuBranco(codigoBairro)){\n\t\t\tFiltroBairro filtro = new FiltroBairro();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBairro.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBairro.MUNICIPIO_ID, idMunicipio));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBairro.CODIGO, codigoBairro));\n\n\t\t\tCollection<Bairro> colecao = fachada.pesquisar(filtro, Bairro.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Bairro\");\n\t\t\t}\n\t\t}\n\n\t\t// Sistema de Abastecimento\n\t\tif(!Util.isVazioOuBranco(idSistemaAbastecimento) && !idSistemaAbastecimento.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSistemaAbastecimento filtro = new FiltroSistemaAbastecimento();\n\t\t\tfiltro\n\t\t\t\t\t\t\t.adicionarParametro(new ParametroSimples(FiltroSistemaAbastecimento.INDICADOR_USO,\n\t\t\t\t\t\t\t\t\t\t\tConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSistemaAbastecimento.ID, idSistemaAbastecimento));\n\n\t\t\tCollection<SistemaAbastecimento> colecao = fachada.pesquisar(filtro, SistemaAbastecimento.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Sistema de Abastecimento\");\n\t\t\t}\n\t\t}\n\n\t\t// Unidade Operacional\n\t\tif(!Util.isVazioOuBranco(idDistritoOperacional) && !idDistritoOperacional.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroDistritoOperacional filtro = new FiltroDistritoOperacional();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroDistritoOperacional.INDICADORUSO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroDistritoOperacional.ID, idDistritoOperacional));\n\n\t\t\tCollection<DistritoOperacional> colecao = fachada.pesquisar(filtro, DistritoOperacional.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Unidade Operacional\");\n\t\t\t}\n\t\t}\n\n\t\t// Zona de Abastecimento\n\t\tif(!Util.isVazioOuBranco(idZonaAbastecimento) && !idZonaAbastecimento.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroZonaAbastecimento filtro = new FiltroZonaAbastecimento();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroZonaAbastecimento.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroZonaAbastecimento.ID, idZonaAbastecimento));\n\n\t\t\tCollection<ZonaAbastecimento> colecao = fachada.pesquisar(filtro, ZonaAbastecimento.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Zona de Abastecimento\");\n\t\t\t}\n\t\t}\n\n\t\t// Setor de Abastecimento\n\t\tif(!Util.isVazioOuBranco(idSetorAbastecimento) && !idSetorAbastecimento.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSetorAbastecimento filtro = new FiltroSetorAbastecimento();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorAbastecimento.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorAbastecimento.ID, idSetorAbastecimento));\n\n\t\t\tCollection<SetorAbastecimento> colecao = fachada.pesquisar(filtro, SetorAbastecimento.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Setor de Abastecimento\");\n\t\t\t}\n\t\t}\n\n\t\t// Sistema de Esgoto\n\t\tif(!Util.isVazioOuBranco(idSistemaEsgoto) && !idSistemaEsgoto.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSistemaEsgoto filtro = new FiltroSistemaEsgoto();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSistemaEsgoto.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSistemaEsgoto.ID, idSistemaEsgoto));\n\n\t\t\tCollection<SistemaEsgoto> colecao = fachada.pesquisar(filtro, SistemaEsgoto.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Sistema de Esgoto\");\n\t\t\t}\n\t\t}\n\n\t\t// Subsistema de Esgoto\n\t\tif(!Util.isVazioOuBranco(idSubsistemaEsgoto) && !idSubsistemaEsgoto.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSubsistemaEsgoto filtro = new FiltroSubsistemaEsgoto();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSubsistemaEsgoto.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSubsistemaEsgoto.ID, idSubsistemaEsgoto));\n\n\t\t\tCollection<SubsistemaEsgoto> colecao = fachada.pesquisar(filtro, SubsistemaEsgoto.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Subsistema de Esgoto\");\n\t\t\t}\n\t\t}\n\n\t\t// Bacia\n\t\tif(!Util.isVazioOuBranco(idBacia) && !idBacia.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroBacia filtro = new FiltroBacia();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBacia.INDICADORUSO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBacia.ID, idBacia));\n\n\t\t\tCollection<Bacia> colecao = fachada.pesquisar(filtro, Bacia.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Bacia\");\n\t\t\t}\n\t\t}\n\n\t\t// Subbacia\n\t\tif(!Util.isVazioOuBranco(idSubBacia) && !idSubBacia.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSubBacia filtro = new FiltroSubBacia();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSubBacia.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSubBacia.ID, idSubBacia));\n\n\t\t\tCollection<SubBacia> colecao = fachada.pesquisar(filtro, SubBacia.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Subbacia\");\n\t\t\t}\n\t\t}\n\n\t\t// Unidade Origem\n\t\tif(!Util.isVazioOuBranco(idUnidadeOrganizacionalOrigem)){\n\t\t\tFiltroUnidadeOrganizacional filtro = new FiltroUnidadeOrganizacional();\n\t\t\tfiltro\n\t\t\t\t\t\t\t.adicionarParametro(new ParametroSimples(FiltroUnidadeOrganizacional.INDICADOR_USO,\n\t\t\t\t\t\t\t\t\t\t\tConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroUnidadeOrganizacional.ID, idUnidadeOrganizacionalOrigem));\n\n\t\t\tCollection<UnidadeOrganizacional> colecao = fachada.pesquisar(filtro, UnidadeOrganizacional.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Unidade Origem\");\n\t\t\t}\n\t\t}\n\n\t\t// Unidade Destino\n\t\tif(Util.isVazioOuBranco(idUnidadeOrganizacionalDestino)){\n\t\t\tthrow new ActionServletException(\"atencao.required\", null, \"Unidade Destino\");\n\t\t}else{\n\t\t\tFiltroUnidadeOrganizacional filtro = new FiltroUnidadeOrganizacional();\n\t\t\tfiltro\n\t\t\t\t\t\t\t.adicionarParametro(new ParametroSimples(FiltroUnidadeOrganizacional.INDICADOR_USO,\n\t\t\t\t\t\t\t\t\t\t\tConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroUnidadeOrganizacional.ID, idUnidadeOrganizacionalDestino));\n\n\t\t\tCollection<UnidadeOrganizacional> colecaoUnidadeOrganizacional = fachada.pesquisar(filtro, UnidadeOrganizacional.class\n\t\t\t\t\t\t\t.getName());\n\t\t\tif(colecaoUnidadeOrganizacional == null || colecaoUnidadeOrganizacional.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Unidade Destino\");\n\t\t\t}\n\t\t}\n\n\t\t// Indicador de Uso\n\t\tif(Util.isVazioOuBranco(indicadorUso)){\n\t\t\tthrow new ActionServletException(\"atencao.required\", null, \"Indicador de Uso\");\n\t\t}\n\t}", "private void submitNewUser() {\n\t\tboolean validationFlag = true;\n\t\tArrayList<HashMap<String, String>> signUpFields = new ArrayList<HashMap<String, String>>();\n\t\tint size = lnr_form.getChildCount();\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tLinearLayout v = (LinearLayout) lnr_form.getChildAt(i);\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tHashMap<String, String> field = (HashMap<String, String>) v.getTag();\n\n\t\t\tIjoomerEditText edtValue = null;\n\t\t\tSpinner spnrValue = null;\n\n\t\t\tif (field != null) {\n\t\t\t\tif (field.get(TYPE).equals(TEXT)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEdit)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(TYPE).equals(TEXTAREA)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditArea)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(TYPE).equals(PASSWORD)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrPassword)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(TYPE).equals(MAP)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditMap)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(\"type\").equals(LABEL)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrLabel)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(TYPE).equals(DATE)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditClickable)).findViewById(R.id.txtValue);\n\n\t\t\t\t\tif (edtValue.getText().toString().trim().length() > 0) {\n\t\t\t\t\t\tif (!IjoomerUtilities.birthdateValidator(edtValue.getText().toString().trim())) {\n\t\t\t\t\t\t\tedtValue.setFocusable(true);\n\t\t\t\t\t\t\tedtValue.setError(getString(R.string.validation_invalid_birth_date));\n\t\t\t\t\t\t\tvalidationFlag = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (field.get(TYPE).equals(MULTIPLESELECT)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditClickable)).findViewById(R.id.txtValue);\n\t\t\t\t}\n\t\t\t\tif (field.get(TYPE).equals(TIME)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditClickable)).findViewById(R.id.txtValue);\n\t\t\t\t}\n\n\t\t\t\tif (field.get(TYPE).equals(SELECT)) {\n\t\t\t\t\tspnrValue = (Spinner) ((LinearLayout) v.findViewById(R.id.lnrSpin)).findViewById(R.id.txtValue);\n\t\t\t\t\tfield.put(VALUE, spnrValue.getSelectedItem().toString());\n\t\t\t\t\tsignUpFields.add(field);\n\t\t\t\t} else if (field.get(TYPE).equals(PASSWORD) && field.get(NAME).equals(\"Retype Password\")) {\n\t\t\t\t\tint len = lnr_form.getChildCount();\n\t\t\t\t\tfor (int j = 0; j < len; j++) {\n\t\t\t\t\t\tLinearLayout view = (LinearLayout) lnr_form.getChildAt(i);\n\t\t\t\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\t\t\t\tHashMap<String, String> row = (HashMap<String, String>) view.getTag();\n\t\t\t\t\t\tif (row.get(TYPE).equals(PASSWORD) && field.get(NAME).equals(\"Password\")) {\n\t\t\t\t\t\t\tString password = ((IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrPassword)).findViewById(R.id.txtValue)).getText().toString();\n\t\t\t\t\t\t\tif (password.equals(edtValue.getText().toString())) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tedtValue.setError(getString(R.string.validation_password_not_match));\n\t\t\t\t\t\t\t\tvalidationFlag = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (edtValue != null && edtValue.getText().toString().trim().length() <= 0 && (field.get(REQUIRED).equals(\"1\"))) {\n\t\t\t\t\tedtValue.setError(getString(R.string.validation_value_required));\n\t\t\t\t\tvalidationFlag = false;\n\t\t\t\t} else {\n\t\t\t\t\tfield.put(VALUE, edtValue.getText().toString().trim());\n\t\t\t\t\tsignUpFields.add(field);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (validationFlag) {\n\t\t\tfinal SeekBar proSeekBar = IjoomerUtilities.getLoadingDialog(getString(R.string.dialog_loading_register_newuser));\n\t\t\tnew IjoomerRegistration(this).submitNewUser(signUpFields, new WebCallListener() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void onProgressUpdate(int progressCount) {\n\t\t\t\t\tproSeekBar.setProgress(progressCount);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void onCallComplete(final int responseCode, String errorMessage, ArrayList<HashMap<String, String>> data1, Object data2) {\n\t\t\t\t\tif (responseCode == 200) {\n\t\t\t\t\t\tIjoomerUtilities.getCustomOkDialog(getString(R.string.dialog_loading_profile), getString(R.string.registration_successfully), getString(R.string.ok),\n\t\t\t\t\t\t\t\tR.layout.ijoomer_ok_dialog, new CustomAlertNeutral() {\n\n\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\tpublic void NeutralMethod() {\n\n\t\t\t\t\t\t\t\t\t\tIntent intent = new Intent(\"clearStackActivity\");\n\t\t\t\t\t\t\t\t\t\tintent.setType(\"text/plain\");\n\t\t\t\t\t\t\t\t\t\tsendBroadcast(intent);\n\t\t\t\t\t\t\t\t\t\tIjoomerWebService.cookies = null;\n\n\t\t\t\t\t\t\t\t\t\tloadNew(IjoomerLoginActivity.class, IPropertyRegistrationActivity.this, true);\n\t\t\t\t\t\t\t\t\t\tfinish();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tIjoomerUtilities.getCustomOkDialog(getString(R.string.dialog_loading_profile),\n\t\t\t\t\t\t\t\tgetString(getResources().getIdentifier(\"code\" + responseCode, \"string\", getPackageName())), getString(R.string.ok), R.layout.ijoomer_ok_dialog,\n\t\t\t\t\t\t\t\tnew CustomAlertNeutral() {\n\n\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\tpublic void NeutralMethod() {\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}", "public Form readForm(String formKey);", "public void parseForm()\n {\n if (mForm.gotoRoot().gotoTag(\"h:head/%1$s:model\", mDefaultPrefix).hasTag(\"%1$s:itext\", mDefaultPrefix)) {\n Log.d(Collect.LOGTAG, t + \"parsing itext form translations...\");\n parseFormTranslations(mForm.gotoRoot().gotoTag(\"h:head/%1$s:model/%1$s:itext\", mDefaultPrefix));\n } else\n Log.d(Collect.LOGTAG, t + \"no form translations to parse\"); \n \n Log.d(Collect.LOGTAG, t + \"parsing form binds...\");\n parseFormBinds(mForm.gotoRoot().gotoTag(\"h:head/%1$s:model\", mDefaultPrefix));\n \n Log.d(Collect.LOGTAG, t + \"parsing form controls...\");\n parseFormControls(mForm.gotoRoot().gotoTag(\"h:body\"));\n \n Log.d(Collect.LOGTAG, t + \"parsing form instance...\");\n parseFormInstance(mForm.gotoRoot().gotoTag(\"h:head/%1$s:model/%1$s:instance\", mDefaultPrefix).gotoChild(), \"/\" + mInstanceRoot);\n Log.d(Collect.LOGTAG, t + \"FINISHED parsing form instance\");\n }", "public SalidaCajaForm() {\n\t\tinicializarComponentes();\n }", "public void addParameters(Form form) {\r\n boolean readNext = true;\r\n Parameter param = null;\r\n \r\n // Let's read all form parameters\r\n try {\r\n while (readNext) {\r\n param = readNextParameter();\r\n \r\n if (param != null) {\r\n // Add parsed parameter to the form\r\n form.add(param);\r\n } else {\r\n // Last parameter parsed\r\n readNext = false;\r\n }\r\n }\r\n } catch (IOException ioe) {\r\n getLogger()\r\n .log(\r\n Level.WARNING,\r\n \"Unable to parse a form parameter. Skipping the remaining parameters.\",\r\n ioe);\r\n }\r\n \r\n try {\r\n this.stream.close();\r\n } catch (IOException ioe) {\r\n getLogger().log(Level.WARNING,\r\n \"Unable to close the form input stream\", ioe);\r\n }\r\n }", "private void getTextFromInput() {\n firstName = firstNameField.getText();\n lastName = lastNameField.getText();\n age = ageField.getText();\n email = emailField.getText().toLowerCase();\n }", "@Override\n public void formPopulated(FormEvent fe) {\n formObject = FormContext.getCurrentInstance().getFormReference();\n\n formObject.setNGValue(\"purchasestatus\", \"\");\n formObject.setNGValue(\"purchaseremarks\", \"\");\n formObject.setNGValue(\"previousstatus\", \"\");\n formObject.setNGValue(\"returnpo\", \"\");\n\n String previousactivity = formObject.getNGValue(\"previousactivity\");\n if (previousactivity.equalsIgnoreCase(\"Initiator\")\n || previousactivity.equalsIgnoreCase(\"StoreMaker\")\n || previousactivity.equalsIgnoreCase(\"StoreChecker\")\n || previousactivity.equalsIgnoreCase(\"AccountsMaker\")\n || previousactivity.equalsIgnoreCase(\"AccountsChecker\")) {\n formObject.addComboItem(\"purchasestatus\", \"Hold\", \"Hold\");\n formObject.addComboItem(\"purchasestatus\", \"Exception Cleared\", \"Exception Cleared\");\n }\n\n if (previousactivity.equalsIgnoreCase(\"QualityMaker\")\n || previousactivity.equalsIgnoreCase(\"QualityChecker\")) {\n formObject.addComboItem(\"purchasestatus\", \"Hold\", \"Hold\");\n formObject.addComboItem(\"purchasestatus\", \"Replacement or Exchange\", \"Replacement or Exchange\");\n formObject.addComboItem(\"purchasestatus\", \"Purchase Return\", \"Purchase Return\");\n }\n\n formObject.clear(\"proctype\");\n Query = \"select HeadName from supplypoheadmaster order by HeadName asc\";\n System.out.println(\"Query is \" + Query);\n result = formObject.getDataFromDataSource(Query);\n for (int i = 0; i < result.size(); i++) {\n formObject.addComboItem(\"proctype\", result.get(i).get(0), result.get(i).get(0));\n }\n }", "@Override\r\n public String getArtisticForm() {\r\n return artisticForm;\r\n }", "@Override\r\n public void actionPerformed(ActionEvent e) {\n String texto = tf.getText();\r\n //lo seteo como texto en el Label\r\n lab.setText(texto);\r\n //refresco los componentes de la ventana\r\n validate();\r\n //combierto a mayuscula el texto del textfield\r\n tf.setText(texto.toUpperCase());\r\n //lo selecciono todo\r\n tf.selectAll();\r\n }", "public void limparCampos() {\n\t\tcodigoField.setText(\"\");\n\t\tdescricaoField.setText(\"\");\n\t\tcodigoField.setEditable(true);\n\t\tBorder border = BorderFactory.createLineBorder(Color.RED);\n\t\tcodigoField.setBorder(border);\n\t\tcodigoField.requestFocus();\n\t\tBorder border1 = BorderFactory.createLineBorder(Color.BLACK);\n\t\tdescricaoField.setBorder(border1);\n\t\t\n\t\t\n\t}", "String getFormFieldDescription();", "public FormPemilihan() {\n initComponents();\n }", "public FormUtama() {\n initComponents();\n }", "public frm_tutor_subida_prueba() {\n }", "public Ventaform() {\n initComponents();\n }", "public JTextField[] camposCliente(){\n JTextField campos [] = new JTextField[]{txtCliCNPJ, txtCliDDD, \n txtCliDDDTel2, txtCliNFant, txtCliResp,\n txtCliRz, txtCliTel, txtCliTel2};\n \n return campos;\n }", "@Override\r\n\tpublic void fill(FormMap formMap) {\n\t\tif (log.isInfoEnabled()) {\r\n\t\t\tlog.info(\"Into the fill method\");\t\t\t\r\n\t\t}\r\n\t\tif (formMap == null) return;\r\n\t\tif ( formMap.getField(\"name\") != null) {\r\n\t\t\tString name=formMap.getField(\"name\").getValue();\r\n\t\t\tsetName(name);\r\n\t\t}\r\n\t\tif ( formMap.getField(\"email\") != null) {\r\n\t\t\tString email=formMap.getField(\"email\").getValue();\r\n\t\t\tsetEmail(email);\r\n\t\t}\r\n\t\tif ( formMap.getField(\"comment\") != null) {\r\n\t\t\tString comment=formMap.getField(\"comment\").getValue();\r\n\t\t\tsetComment(comment);\r\n\t\t}\r\n\t\tif ( formMap.getField(\"rating\") != null) {\r\n\t\t\tString rating=formMap.getField(\"rating\").getValue();\r\n\t\t\tLong longrating=Long.parseLong(rating);\r\n\t\t\tsetRating(longrating);\r\n\t\t}\r\n\t\t\r\n\t}", "private void initFormulario() {\n btnCadastro = findViewById(R.id.btnCadastro);\n editNome = findViewById(R.id.editNome);\n editEmail = findViewById(R.id.editEmail);\n editSenhaA = findViewById(R.id.editSenha);\n editSenhaB = findViewById(R.id.editSenhaB);\n chTermo = findViewById(R.id.chTermos);\n isFormOk = false;\n }", "private void saveForm() {\n\n if (reportWithCurrentDateExists()) {\n // Can't save this case\n return;\n }\n\n boolean isNewReport = (mRowId == null);\n\n // Get field values from the form elements\n\n // Date\n SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");\n String date = df.format(mCalendar.getTime());\n\n // Value\n Double value;\n try {\n value = Double.valueOf(mValueText.getText().toString());\n } catch (NumberFormatException e) {\n value = 0.0;\n }\n\n // Create/update report\n boolean isSaved;\n if (isNewReport) {\n mRowId = mDbHelper.getReportPeer().createReport(mTaskId, date, value);\n isSaved = (mRowId != 0);\n } else {\n isSaved = mDbHelper.getReportPeer().updateReport(mRowId, date, value);\n }\n\n // Show toast notification\n if (isSaved) {\n int toastMessageId = isNewReport ?\n R.string.message_report_created :\n R.string.message_report_updated;\n Toast toast = Toast.makeText(getApplicationContext(), toastMessageId, Toast.LENGTH_SHORT);\n toast.show();\n }\n }", "public String getFieldValue() {\r\n\t\tString value = textBox.getValue();\r\n\t\t\t\r\n\t\treturn value;\r\n\t}", "public Form_reporte_comuna_y_tipo(Controlador cont) {\n initComponents();\n this.controlador = cont;\n cargarSelect();\n\n }", "public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)\r\n {\r\n super.processFormRequest(pageContext, webBean);\r\n }", "private void setValues() {\n textViewPrice = findViewById(R.id.textViewPrice);\n textViewStoreName = findViewById(R.id.textViewStoreName);\n textViewLocation = findViewById(R.id.textViewLocation);\n buttonAcceptOrder = findViewById(R.id.buttonAcceptOrder);\n\n order = Parcels.unwrap(getIntent().getParcelableExtra(Order.class.getSimpleName()));\n\n textViewPrice.setText(\"$\" + decimalFormat.format(order.getPrice()));\n textViewStoreName.setText(\"Store: \"+ order.getStore().getName());\n textViewLocation.setText(\"Address: \" + order.getStore().getAddress());\n }", "@Override\r\n\tpublic void actionPerformed(ActionEvent e) {\n\t\ttry {\r\n\t\t\tString txt_nom = paramActeur.getAct_nom();\r\n\t\t\tString txt_prenom = paramActeur.getAct_pre();\r\n\t\t\tString txt_mail = paramActeur.getAct_mai();\r\n\t\t\tString txt_tel = paramActeur.getAct_tel();\r\n\t\t\tString txt_grp = paramActeur.getAct_grp();\r\n\t\t\tString txt_login = paramActeur.getAct_log();\r\n\t\t\tString txt_pass = paramMdp1.getmdp_pw();\r\n\t\t\tString txt_pass2 = paramMdp2.getmdp_pw();\r\n\t\t\tString txt_ville = paramLoc.getLoc_lib();\r\n\t\t\tString txt_type = paramType.getTyp_lib();\r\n\t\t\t\r\n\t\t\tSystem.out.println(txt_type);\r\n\t\t\t\r\n\t\t\tDB_Connection conn = new DB_Connection();\r\n\t\t\tConnection laCo = conn.get_connection();\r\n\t\t\t\r\n\t\t} \r\n\t\tcatch(Exception ex) {\r\n\t\t\tex.getMessage();\r\n\t\t}\r\n\t\t//if(e.getSource() == application) {\r\n\t\t\tInscrire(); \r\n\t\t//}\r\n\t\t\r\n\t\t\r\n\t}", "public sub_Form(HashMap<String, ReturnedValue> entry, int index){\n this.form_ID = entry.get(\"formID\").to_string();\n this.repID = entry.get(\"repID\").to_string();\n this.plantRegistry = entry.get(\"plantRegistry\").to_string();\n this.domesticOrImported = entry.get(\"domesticOrImported\").to_string();\n this.serialNumber = entry.get(\"serialNumber\").to_string();\n this.beverageType = entry.get(\"beverageType\").to_string();\n this.brandName = entry.get(\"brandName\").to_string();\n this.fancifulName = entry.get(\"fancifulName\").to_string();\n this.vintage = entry.get(\"vintage\").to_string();\n this.grapeVarietals = entry.get(\"grapeVarietals\").to_string();\n this.pHValue = entry.get(\"pHValue\").to_string();\n this.wineAppellation = entry.get(\"wineAppellation\").to_string();\n this.alcoholContent = entry.get(\"alcoholContent\").to_string();\n this.phoneNumber = entry.get(\"phoneNumber\").to_string();\n this.email = entry.get(\"email\").to_string();\n this.index = index;\n }", "private void ValorActionPerformed(java.awt.event.ActionEvent evt) {\n }", "private void azzeraInsertForm() {\n\t\tviewInserimento.getCmbbxTipologia().setSelectedIndex(-1);\n\t\tviewInserimento.getTxtFieldDataI().setText(\"\");\n\t\tviewInserimento.getTxtFieldValore().setText(\"\");\n\t\tviewInserimento.getTxtFieldDataI().setBackground(Color.white);\n\t\tviewInserimento.getTxtFieldValore().setBackground(Color.white);\n\t}", "public quanlixe_form() {\n initComponents();\n }", "public AuditFunctionForm() {\n initComponents();\n init();\n }", "public FormInserir() {\n initComponents();\n }", "@Override\n protected void carregaObjeto() throws ViolacaoRegraNegocioException {\n entidade.setNome( txtNome.getText() );\n entidade.setDescricao(txtDescricao.getText());\n entidade.setTipo( txtTipo.getText() );\n entidade.setValorCusto(new BigDecimal((String) txtCusto.getValue()));\n entidade.setValorVenda(new BigDecimal((String) txtVenda.getValue()));\n \n \n }", "public void setForm(Form form) {\n this.data.setForm(form.getDataFormToSend());\n }", "public myForm() {\n\t\t\tinitComponents();\n\t\t}", "public Form_soal() {\n initComponents();\n tampil_soal();\n }", "public frmAfiliado() {\n initComponents();\n \n }", "private void loadForm() {\n CodingProxy icd9 = problem.getIcd9Code();\n \n if (icd9 != null) {\n txtICD.setText(icd9.getProxiedObject().getCode());\n }\n \n String narr = problem.getProviderNarrative();\n \n if (narr == null) {\n narr = icd9 == null ? \"\" : icd9.getProxiedObject().getDisplay();\n }\n \n String probId = problem.getNumberCode();\n \n if (probId == null || probId.isEmpty()) {\n probId = getBroker().callRPC(\"BGOPROB NEXTID\", PatientContext.getActivePatient().getIdElement().getIdPart());\n }\n \n String pcs[] = probId.split(\"\\\\-\", 2);\n lblPrefix.setValue(pcs[0] + \" - \");\n txtID.setValue(pcs.length < 2 ? \"\" : pcs[1]);\n txtNarrative.setText(narr);\n datOnset.setValue(problem.getOnsetDate());\n \n if (\"P\".equals(problem.getProblemClass())) {\n radPersonal.setSelected(true);\n } else if (\"F\".equals(problem.getProblemClass())) {\n radFamily.setSelected(true);\n } else if (\"I\".equals(problem.getStatus())) {\n radInactive.setSelected(true);\n } else {\n radActive.setSelected(true);\n }\n \n int priority = NumberUtils.toInt(problem.getPriority());\n cboPriority.setSelectedIndex(priority < 0 || priority > 5 ? 0 : priority);\n loadNotes();\n }", "public ProfilsFIForm() {\r\n\t\tsuper();\r\n\t}", "private void RetrieveEditTextData() {\n\n strFirstName = etFirstName.getText().toString();\n strMiddleName = etMiddleName.getText().toString();\n strLastName = etLastName.getText().toString();\n strEmployId = etEmployId.getText().toString();\n strDesignation = etDesignation.getText().toString();\n strCompName = etCompName.getText().toString();\n strCategory = etCategory.getText().toString();\n strDOB = etDOB.getText().toString();\n\n }", "private void saveInput() {\n\t rateId = txtRateId.getText();\t \n\t startSize = txtStartSize.getText();\n\t endSize = txtEndSize.getText();\n\t }", "public void populateForm(Model model) {\n populateFormats(model);\n }", "public void processFormRequest(OAPageContext pageContext, \n OAWebBean webBean) {\n super.processFormRequest(pageContext, webBean);\n }", "private void limpiarCampos() {\n campoNombre.setText(\"\");\n campoNumLibro.setText(\"\");\n campoNumPagina.setText(\"\");\n }", "public void fillForm() {\n\t\t// fills the name field with nameOfProject\n\t\tprojName.sendKeys(nameOfProject);\n\t\t// selects the first option from the 'Client partner' dropdown list\n\t\tSelect sel = new Select(clientList);\n\t\tsel.selectByIndex(1);\n\t\t// enters valid date data\n\t\tstartDate.sendKeys(\"06042018\");\n\t\tendDate.sendKeys(\"06052018\");\n\t}", "public HTMLInputElement getElementValor() { return this.$element_Valor; }", "public FormCadastroAutomovel() {\n initComponents();\n }", "public MechanicForm() {\n initComponents();\n }", "public String getFormacao() {\n\t\treturn formacao;\n\t}", "public JTextField gettxtUsuario() {\n return txtUsuario;\n }", "public TorneoForm() {\n initComponents();\n }", "public FormProduct() {\n initComponents();\n getData();\n }", "private void limpiarValores(){\n\t\tpcodcia = \"\";\n\t\tcedula = \"\";\n\t\tcoduser = \"\";\n\t\tcluser = \"\";\n\t\tmail = \"\";\n\t\taudit = \"\";\n\t\tnbr = \"\";\n\t\trol = \"\";\n\t}", "public FormCliente() {\n initComponents();\n txtLimiteDeCredito.addKeyListener(new KeyAdapter() {\n @Override\n public void keyTyped(KeyEvent e) {\n System.out.println(txtLimiteDeCredito.getText() );\n \n if((int)e.getKeyChar() == KeyEvent.VK_PERIOD && !txtLimiteDeCredito.getText().contains(\".\")){\n return;\n }\n \n if((int)e.getKeyChar() < KeyEvent.VK_0 || (int)e.getKeyChar() > KeyEvent.VK_9) { \n e.consume();\n }\n }\n \n });\n \n setLocationRelativeTo(null);\n \n campos = new JTextField[]{txtCedula, txtNombre, txtApellido, txtDireccion, txtTelefono, txtLimiteDeCredito};\n }", "public void cambioEstadAvaluo() {\r\n try {\r\n if (\"\".equals(mBRadicacion.Radi.getObservacionAvaluo()) || \"\".equals(mBRadicacion.Radi.getEstadoAvaluo())) {\r\n mbTodero.setMens(\"Falta informacion por Llenar\");\r\n mbTodero.warn();\r\n } else {\r\n mBRadicacion.Radi.CambioEstRad(mBsesion.codigoMiSesion());\r\n mbTodero.setMens(\"La informacion ha sido guardada correctamente\");\r\n mbTodero.info();\r\n mbTodero.resetTable(\"FRMSeguimiento:SeguimientoTable\");\r\n RequestContext.getCurrentInstance().execute(\"PF('DlgEstAvaluo').hide()\");\r\n ListSeguimiento = Seg.ConsulSeguimAvaluos(mBsesion.codigoMiSesion());//VARIABLES DE SESION\r\n }\r\n } catch (Exception e) {\r\n mbTodero.setMens(\"Error en el metodo '\" + this.getClass() + \".cambioEstadAvaluo()' causado por: \" + e.getMessage());\r\n mbTodero.error();\r\n }\r\n }", "@Override\n\tpublic void postRun(FormCheckerForm form) {\n\t}", "public void setUsuarioTxt(JTextField usuarioTxt) {\n this.usuarioTxt = usuarioTxt;\n }", "public Browser submitForm(String name, Args values);", "private void createForm(ArrayList<HashMap<String, String>> data) {\n\t\tLayoutInflater inflater = LayoutInflater.from(IPropertyRegistrationActivity.this);\n\t\tLinearLayout.LayoutParams params = new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT,\n\t\t\t\tandroid.widget.LinearLayout.LayoutParams.WRAP_CONTENT);\n\t\tparams.topMargin = 10;\n\n\t\tfields = data;\n\t\tLinearLayout layout = null;\n\t\tint len = fields.size();\n\t\tfor (int j = 0; j < len; j++) {\n\t\t\tfinal HashMap<String, String> field = fields.get(j);\n\t\t\tView fieldView = inflater.inflate(R.layout.iproperty_registration_dynamic_view_item, null);\n\n\t\t\tif (field.get(TYPE).equals(LABEL)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrLabel));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t} else if (field.get(TYPE).equals(PASSWORD)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEdit));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tif (field.get(NAME).contains(getString(R.string.phone)) || field.get(NAME).contains(getString(R.string.year))) {\n\t\t\t\t\tedit.setInputType(InputType.TYPE_CLASS_NUMBER);\n\t\t\t\t} else if (field.get(NAME).contains(getString(R.string.website)) || field.get(NAME).contains(getString(R.string.email))) {\n\t\t\t\t\tedit.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);\n\t\t\t\t}\n\t\t\t} else if (field.get(TYPE).equals(TEXT)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEdit));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tif (field.get(NAME).contains(getString(R.string.phone)) || field.get(NAME).contains(getString(R.string.year))) {\n\t\t\t\t\tedit.setInputType(InputType.TYPE_CLASS_NUMBER);\n\t\t\t\t} else if (field.get(NAME).contains(getString(R.string.website)) || field.get(NAME).contains(getString(R.string.email))) {\n\t\t\t\t\tedit.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);\n\t\t\t\t}\n\t\t\t} else if (field.get(TYPE).equals(TEXTAREA)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditArea));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\n\t\t\t\tif (field.get(VALUE).toString().trim().length() > 0) {\n\t\t\t\t\tedit.setText(field.get(VALUE));\n\t\t\t\t} else {\n\t\t\t\t}\n\n\t\t\t} else if (field.get(TYPE).equals(MAP)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tfinal ImageView imgMap;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditMap));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\timgMap = ((ImageView) layout.findViewById(R.id.imgMap));\n\t\t\t\tif (field.get(NAME).equalsIgnoreCase(getString(R.string.state))) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tAddress address = IjoomerUtilities.getAddressFromLatLong(0, 0);\n\t\t\t\t\t\tedit.setText(address.getAdminArea().replace(address.getCountryName() == null ? \"\" : address.getCountryName(), \"\")\n\t\t\t\t\t\t\t\t.replace(address.getPostalCode() == null ? \"\" : address.getPostalCode(), \"\"));\n\t\t\t\t\t} catch (Throwable e) {\n\t\t\t\t\t\tedit.setText(\"\");\n\t\t\t\t\t}\n\t\t\t\t} else if (field.get(NAME).equalsIgnoreCase(getString(R.string.city_town))) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tAddress address = IjoomerUtilities.getAddressFromLatLong(0, 0);\n\t\t\t\t\t\tedit.setText(address.getSubAdminArea());\n\t\t\t\t\t} catch (Throwable e) {\n\t\t\t\t\t\tedit.setText(\"\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\timgMap.setOnClickListener(new OnClickListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\teditMap = edit;\n\t\t\t\t\t\tIntent intent = new Intent(IPropertyRegistrationActivity.this, IjoomerMapAddress.class);\n\t\t\t\t\t\tstartActivityForResult(intent, GET_ADDRESS_FROM_MAP);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else if (field.get(TYPE).equals(SELECT)) {\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrSpin));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tfinal Spinner spn;\n\t\t\t\tspn = ((Spinner) layout.findViewById(R.id.txtValue));\n\t\t\t\tspn.setAdapter(IjoomerUtilities.getSpinnerAdapter(field));\n\t\t\t\tif (field.get(NAME).equalsIgnoreCase(getString(R.string.country))) {\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tAddress address = IjoomerUtilities.getAddressFromLatLong(0, 0);\n\t\t\t\t\t\tString country = address.getCountryName();\n\t\t\t\t\t\tint selectedIndex = 0;\n\t\t\t\t\t\tJSONArray jsonArray = null;\n\n\t\t\t\t\t\tjsonArray = new JSONArray(field.get(OPTIONS));\n\t\t\t\t\t\tint optionSize = jsonArray.length();\n\t\t\t\t\t\tfor (int k = 0; k < optionSize; k++) {\n\t\t\t\t\t\t\tJSONObject options = (JSONObject) jsonArray.get(k);\n\n\t\t\t\t\t\t\tif (options.getString(VALUE).equalsIgnoreCase(country)) {\n\t\t\t\t\t\t\t\tselectedIndex = k;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tspn.setSelection(selectedIndex);\n\t\t\t\t\t} catch (Throwable e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tspn.setSelection(0);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if (field.get(TYPE).equals(DATE)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditClickable));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tedit.setOnClickListener(new OnClickListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(final View v) {\n\t\t\t\t\t\tIjoomerUtilities.getDateDialog(((IjoomerEditText) v).getText().toString(), true, new CustomClickListner() {\n\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void onClick(String value) {\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setText(value);\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setError(null);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else if (field.get(TYPE).equals(TIME)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditClickable));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tedit.setOnClickListener(new OnClickListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(final View v) {\n\t\t\t\t\t\tIjoomerUtilities.getTimeDialog(((IjoomerEditText) v).getText().toString(), new CustomClickListner() {\n\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void onClick(String value) {\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setText(value);\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setError(null);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else if (field.get(TYPE).equals(MULTIPLESELECT)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditClickable));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tedit.setOnClickListener(new OnClickListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(final View v) {\n\t\t\t\t\t\tIjoomerUtilities.getMultiSelectionDialog(field.get(NAME), field.get(OPTIONS), ((IjoomerEditText) v).getText().toString(), new CustomClickListner() {\n\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void onClick(String value) {\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setText(value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (field.get(REQUIRED).equalsIgnoreCase(\"1\")) {\n\t\t\t\t((IjoomerTextView) layout.findViewById(R.id.txtLable)).setText(field.get(NAME) + \" *\");\n\t\t\t} else {\n\t\t\t\t((IjoomerTextView) layout.findViewById(R.id.txtLable)).setText(field.get(NAME));\n\t\t\t}\n\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrEdit)).setVisibility(View.GONE);\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrEditArea)).setVisibility(View.GONE);\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrSpin)).setVisibility(View.GONE);\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrEditClickable)).setVisibility(View.GONE);\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrLabel)).setVisibility(View.GONE);\n\n\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrReadOnly));\n\t\t\tlayout.setVisibility(View.VISIBLE);\n\n\t\t\t((IjoomerTextView) layout.findViewById(R.id.txtLable)).setText(field.get(NAME));\n\t\t\t((IjoomerEditText) layout.findViewById(R.id.txtValue)).setText(field.get(VALUE));\n\t\t\tfieldView.setTag(field);\n\t\t\tlnr_form.addView(fieldView, params);\n\t\t}\n\t}", "private void limpaCampos() {\n txtNome.setText(\"\");\n txtRG.setText(\"\");\n txtFCpf.setText(\"\");\n txtFNascimento.setText(\"\");\n txtEmail.setText(\"\");\n txtFCelular.setText(\"\");\n txtFTelefone.setText(\"\");\n txtRua.setText(\"\");\n txtComplemento.setText(\"\");\n txtFCep.setText(\"\");\n txtBairro.setText(\"\");\n txtCidade.setText(\"\");\n }", "public void execute(ProgramContext pc) throws ParserException {\n\t\tif (!pc.isEscribe()){\n\t\t\t//marco el field como hide, para que endform sepa que hacer con el\n\t\t\tfield.setHide(true);\n\t\t\treturn;\n\t\t}\n\t\tString res = \"\";\n\t\tString itemName = field.getItemName();\n\t\tString itemType = field.getItemType();\n\t\tint itemUi = field.getItemUi();\n\t\tString resto = field.getResto();\n\t\tString valor = pc.getDocAct().getItemValue(itemName);\n\t\tif (valor == null) valor = \"\";\n\t\t\n\t\tif (itemName.toLowerCase().startsWith(\"fecha\")){\n\t\t\tlog.debug(\"###########################################################################\");\n\t\t\tlog.debug(\"# itemName=\"+itemName+\" valor=\"+valor+\" class:\"+pc.getDocAct().getItem(itemName));\n\t\t\tlog.debug(\"###########################################################################\");\n\t\t}\n\t\t\n\t\tvalor = Arguments.scapeHTML(valor);\n\t\t\n\t\tif (((pc.getActionType()==ProgramContext.ACTION_NEW)||(pc.getActionType()==ProgramContext.ACTION_EDIT))&&(field.getItemKind()==Field.KIND_EDITABLE)){\n\t\t\t//veo si hay lista dinamica y statica y las proceso\n\t\t\tList<String> options = new ArrayList<String>();\n\t\t\tif (field.getDinamicList()!=null) options.addAll(pc.getDomSession().executeGetList(field.getDinamicList()));\n\t\t\tif (field.getTextList()!=null) {\n\t\t\t\tString[] opts = field.getTextList().split(field.getSeparator());\n\t\t\t\tfor(String opt:opts) options.add(opt);\n\t\t\t}\n\t\t\t//arreglo para poner columnas en checks y radios\n\t\t\tint col=0;\n\t\t\tint numCols = field.getNumCols();\n\t\t\tif (numCols==0) numCols=options.size();\n\n\t\t\t//veo si el valor es multivaluado y lo proceso\n\t\t\tString isep = field.getInternalSeparator();\n\t\t\tSystem.out.println(\"#### isep=\"+isep+\" valor=\"+valor);\n\t\t\tList<String> valores = new ArrayList<String>();\n\t\t\tif (isep!=null){\n\t\t\t\tString[] vals = valor.split(isep);\n\t\t\t\tfor(String val:vals) valores.add(val.trim());\n\t\t\t} else valores.add(valor);\n\t\t\t\n\t\t\tswitch(itemUi){\n\t\t\tcase Field.UI_TEXT:\n\t\t\t\tres = \"<input type=\\\"text\\\" id=\\\"\"+itemName+\"\\\" name=\\\"\" + itemName + \"\\\" \"+resto+\" value=\\\"\" + valor + \"\\\">\";\n\t\t\t\tbreak;\n\t\t\tcase Field.UI_TEXTAREA:\n\t\t\t\tres = \"<textarea id=\\\"\"+itemName+\"\\\" name=\\\"\" + itemName + \"\\\" \"+resto+\">\" + valor + \"</textarea>\";\n\t\t\t\tbreak;\n\t\t\tcase Field.UI_CHECKBOX:\n\t\t\t\tfor(String option:options){\n\t\t\t\t\t//ver caso especial donde | separa texto de valor\n\t\t\t\t\tint i1=option.indexOf(\"|\");\n\t\t\t\t\tString val = option.trim();\n\t\t\t\t\tString txt = option.trim();\n\t\t\t\t\tif (i1>0){\n\t\t\t\t\t\ttxt = option.substring(0,i1).trim();\n\t\t\t\t\t\tval = option.substring(i1+1).trim();\n\t\t\t\t\t}\n\t\t\t\t\tres += \"<input type=\\\"checkbox\\\" name=\\\"\" + itemName + \"\\\" \"+resto+\" value=\\\"\" + val + \"\\\"\";\n\t\t\t\t\t//comprobar debo marcar la opcion teniendo en cuenta los multivaluados (internalSeparator)\n\t\t\t\t\tif (valores.contains(val)) res+=\" checked=\\\"true\\\"\";\n\t\t\t\t\tres += \">\"+txt;\n\t\t\t\t\tcol++;\n\t\t\t\t\tif (col>=numCols) {\n\t\t\t\t\t\tres += \"<br>\";\n\t\t\t\t\t\tcol = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Field.UI_RADIOBUTTON:\n\t\t\t\tfor(String option:options){\n\t\t\t\t\t//ver caso especial donde | separa texto de valor\n\t\t\t\t\tint i1=option.indexOf(\"|\");\n\t\t\t\t\tString val = option.trim();\n\t\t\t\t\tString txt = option.trim();\n\t\t\t\t\tif (i1>0){\n\t\t\t\t\t\ttxt = option.substring(0,i1).trim();\n\t\t\t\t\t\tval = option.substring(i1+1).trim();\n\t\t\t\t\t}\n\t\t\t\t\tres += \"<input type=\\\"radio\\\" name=\\\"\" + itemName + \"\\\" \"+resto+\" value=\\\"\" + val + \"\\\"\";\n\t\t\t\t\t//comprobar debo marcar la opcion teniendo en cuenta los multivaluados (internalSeparator)\n\t\t\t\t\tif (valores.contains(val)) res+=\" checked=\\\"true\\\"\";\n\t\t\t\t\tres += \">\"+txt;\n\t\t\t\t\t//ajuste de columna segun el atributo numCols de field\n\t\t\t\t\tcol++;\n\t\t\t\t\tif (col>=numCols) {\n\t\t\t\t\t\tres += \"<br>\";\n\t\t\t\t\t\tcol = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Field.UI_COMBOBOX:\n\t\t\tcase Field.UI_DIALOGLIST:\n\t\t\tcase Field.UI_LISTBOX:\n\t\t\t\tres = \"<select id=\\\"\"+itemName+\"\\\" name=\\\"\" + itemName + \"\\\" \"+resto+\">\\n\";\n\t\t\t\tfor(String option:options) {\n\t\t\t\t\t//ver caso especial donde | separa texto de valor\n\t\t\t\t\tint i1=option.indexOf(\"|\");\n\t\t\t\t\tString val = option.trim();\n\t\t\t\t\tString txt = option.trim();\n\t\t\t\t\tif (i1>0){\n\t\t\t\t\t\ttxt = option.substring(0,i1).trim();\n\t\t\t\t\t\tval = option.substring(i1+1).trim();\n\t\t\t\t\t}\n\t\t\t\t\tres += \"<option value=\\\"\"+val+\"\\\"\";\n\t\t\t\t\t//comprobar debo marcar la opcion teniendo en cuenta los multivaluados (internalSeparator)\n\t\t\t\t\tif (valores.contains(val)) res+=\" selected=\\\"true\\\"\";\n\t\t\t\t\tres+=\">\"+txt+\"</option>\";\n\t\t\t\t}\n\t\t\t\tres += \"</select>\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else res+=valor;\n\t\tpc.append(res);\n\t}", "public viewForm() {\n this.addGLEventListener(this);\n }", "private void limpaCampos() {\r\n\t\tnome.setText(\"\");\r\n\t\tsituacao.setSelectedIndex(0);\r\n\t\tidade.setText(\"\");\r\n\t\terroNome.setText(\"\");\r\n\t\terroIdade.setText(\"\");\r\n\t}", "public void val() {\r\n\t\tjquery.val(this, webDriver);\r\n\t}", "@Override\n public Object saveState(FacesContext _context) {\n if (_values == null) {\n _values = new Object[6];\n }\n _values[0] = super.saveState(_context);\n _values[1] = description;\n _values[2] = varname;\n _values[4] = param;\n _values[5] = simple;\n return _values;\n }", "public void setPresupuesto(Presupuesto presupuesto) {\n this.presupuesto = presupuesto;\n Cliente cliente = presupuesto.getCliente();\n\n nroPresupuestoField.setText(String.valueOf(presupuesto.getNroPresupuesto()));\n cuitField.setText(cliente.getCuit());\n denominacionField.setText(cliente.getDenominacion());\n String ci = cliente.getCondicionIva();\n if(ci!= null){\n \tif(ci.startsWith(\"RI\")){\n \tthis.condicionIvaField.setText(\"Responsable Inscripto\");\n }\n else if(ci.startsWith(\"EX\")){\n \tthis.condicionIvaField.setText(\"Exento\");\n }\n else if(ci.startsWith(\"MO\")){\n \tthis.condicionIvaField.setText(\"Monotributista\");\n }\n else if(ci.startsWith(\"NR\")){\n \tthis.condicionIvaField.setText(\"No Responsable\");\n }\n else if(ci.startsWith(\"CF\")){\n \tthis.condicionIvaField.setText(\"Consumidor Final\");\n }\n }\n \n alicuotaChoiceBox.setItems(FXCollections.observableArrayList(\"0%\",\"10,5%\",\"21%\"));\n \n Float ali = presupuesto.getAlicuota();\n if(ali!= null){\n \tif(ali == 0.0){\n \talicuotaChoiceBox.setValue(\"0%\");\n }\n else if(ali == 10.5){\n \talicuotaChoiceBox.setValue(\"10,5%\");\n }\n else if(ali == 21.0){\n \talicuotaChoiceBox.setValue(\"21%\");\n }\n else{\n \talicuotaChoiceBox.setValue(\"\");\n }\n }\n \n mesChoiceBox.setItems(FXCollections.observableArrayList(Presupuesto.getMeses()));\n\t\t\n\t\t//TODO: elegir el mes actual de los presupuestos\n\t\tint mesesito = presupuesto.getMes() -1 ;\n\t\tmesChoiceBox.getSelectionModel().select(mesesito);\n \n subtotalField.setText(String.valueOf(presupuesto.getSubtotal()));\n montoTotalField.setText(String.valueOf(recalcularMonto(presupuesto.getAlicuota())));\n \n conceptosTable.setItems(presupuesto.getConceptosObservables());\n conceptoColumn.setCellValueFactory(\n\t\t\tcellData -> cellData.getValue().getConceptoProperty());\n \n\t\tmontoColumn.setCellValueFactory(\n\t\t\tcellData -> cellData.getValue().getMontoConceptoStringProperty());\n \n }", "private void validarCampos() {\n }", "public void LimpiarCampos() {\n\n txtIdAsignarPer.setText(\"\");\n txtNombreusu.setText(\"\");\n pswConfCont.setText(\"\");\n combPerf.setSelectedItem(\"\");\n pswContra.setText(\"\");\n txtDocumento.setText(\"\");\n }", "private void setFieldValues(){ \n\n if(rDatabaseType.equalsIgnoreCase(\"mysql\")){\n jComboBoxDatabaseType.setSelectedIndex(1);\n }\n if(rDatabaseType.equalsIgnoreCase(\"oracle\")){\n jComboBoxDatabaseType.setSelectedIndex(0);\n }\n jTextFieldDatabaseNameIp.setText(rDatabaseServerName);\n jTextFieldDBPort.setText(rDBPort);\n jTextFieldSchemaTNSName.setText(rTnsNameOrDBName);\n jTextFieldUserName.setText(rUserName);\n jTextFieldPassword.setText(rPassword);\n jTextFieldTableName.setText(rTableName);\n jTextFieldColumnName.setText(rColumnName);\n jTextFieldSQLQuery.setText(rQuery); \n }", "public void loadForm() {\n if (!selectedTipo.equals(\"accion\")) {\n this.renderPaginaForm = true;\n } else {\n this.renderPaginaForm = false;\n }\n if (selectedTipo.equals(null) || selectedTipo.equals(\"menu\")) {\n this.renderGrupoForm = false;\n } else {\n this.renderGrupoForm = true;\n }\n populateListaObjetos();\n }", "private void getDataFromView() throws EmptyTextFieldException, EmptyChoiceBoxException, NumberSmallerOneException {\n\n date = _view.getDate().getValue();\n title = _view.getTitle().getText();\n function = _view.getFunction().getText();\n protagonist = _view.getProtagonist().getText();\n source = _view.getSource().getText();\n references = _view.getReferences().getText();\n description = _view.getDescription().getText();\n checkForEmptyFields();\n\n priority = _view.getPriorityMap().get(_view.getPriority().getValue());\n classification = _view.getClassificationMap().get(_view.getClassification().getValue());\n checkForEmptyChoiceBox();\n\n id = Integer.parseInt(_view.getId().getText());\n ftr = Integer.parseInt(_view.getFtr().getText());\n det = Integer.parseInt(_view.getDet().getText());\n checkForNumbersSmallerOne();\n }", "public void getFullForm(SecurityUserBaseinfoForm form,\r\n\t\t\tSecurityUserBaseinfo data) {\n\t\tthis.setForm(form, data);\r\n\t\tthis.getDetail(form);\r\n\t}", "@Override\r\n\t\t\tpublic void handleEvent(Event arg0) {\n\t\t\t\tdiachi = txt_diachi.getText();\r\n\t\t\t}", "public abstract void addSelectorForm();" ]
[ "0.6806757", "0.6633384", "0.58621895", "0.5855404", "0.58400744", "0.5785399", "0.57675904", "0.5744769", "0.5729344", "0.56534404", "0.56481045", "0.5629684", "0.5627266", "0.56164086", "0.55687255", "0.5527424", "0.55266815", "0.55195606", "0.54977566", "0.54806685", "0.54561543", "0.54530424", "0.5428241", "0.5424857", "0.54067165", "0.540099", "0.538936", "0.5383225", "0.5380684", "0.5372045", "0.53409064", "0.53354335", "0.5330888", "0.53215694", "0.53135264", "0.5313416", "0.53014", "0.5290209", "0.52829707", "0.5279273", "0.5267839", "0.52670705", "0.52636105", "0.52620584", "0.524757", "0.52412385", "0.5239673", "0.5238995", "0.52317697", "0.5230479", "0.5227237", "0.52142537", "0.52141184", "0.52073383", "0.5204556", "0.52030486", "0.51954865", "0.51908654", "0.51876116", "0.51805604", "0.5172884", "0.5170611", "0.5169253", "0.5167433", "0.51597637", "0.5157679", "0.51576525", "0.5156564", "0.5151242", "0.5146653", "0.5146046", "0.51435745", "0.51424664", "0.5139042", "0.51347953", "0.51339895", "0.51330423", "0.51295745", "0.5119268", "0.511611", "0.50972795", "0.5094303", "0.5094132", "0.50936663", "0.50900465", "0.508091", "0.50787556", "0.50751", "0.5073632", "0.5070688", "0.5060425", "0.5059469", "0.50557065", "0.50510776", "0.50471586", "0.5042226", "0.50417143", "0.50377643", "0.50344956", "0.5028717", "0.50261956" ]
0.0
-1
Method to parse the csv file and return list of Lender objects
public List<Lender> readCSVFile(String path){ List<Lender> inputList = new ArrayList<>(); try{ File inputF = new File(path); InputStream inputFS = new FileInputStream(inputF); BufferedReader br = new BufferedReader(new InputStreamReader(inputFS)); // skip the header of the csv inputList = br.lines().skip(1).map(mapToItem).collect(Collectors.toList()); br.close(); } catch (IOException e) { throw new QuoteException("Error reading the csv file", e); } return inputList ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void loadListFromCsv() {\n List<Publication> list = new ArrayList<>();\n String line;\n try(BufferedReader bufferedReader = new BufferedReader(new FileReader(\"saves/data.csv\"))){\n while ((line = bufferedReader.readLine()) != null){\n String[] attributes = line.split(\",(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\n String[] formattedAttributes = formatAttributes(attributes);\n Publication book = createPublicationFromAttributes(formattedAttributes);\n list.add(book);\n }\n } catch (IOException e){\n System.out.println(\"IOException occurred: \" + e.getMessage());\n }\n\n this.library = list;\n }", "protected static ArrayList<String> load() throws Exception {\r\n\t\tArrayList<String> list;\r\n\t\tFileReader fileRead = new FileReader(csv);\r\n\t\tBufferedReader buff = Files.newBufferedReader(Paths.get(\"story.csv\"));\r\n\t\tlist = buff.lines().map(line -> line.split(\",\")).flatMap(Arrays::stream)\r\n\t\t\t\t.collect(Collectors.toCollection(ArrayList::new));\r\n\t\tbuff.close();\r\n\t\tfileRead.close();\r\n\r\n\t\treturn list;\r\n\t}", "public static Lender[] fileTransformer(String fileName) throws IOException {\r\n Lender[] lenderList = new Lender[7];\r\n CSVReader reader = null;\r\n try {\r\n reader = new CSVReader(new FileReader(path + fileName), SEPARATOR);\r\n String[] nextLine = null;\r\n int count = 0;\r\n while ((nextLine = reader.readNext()) != null) {\r\n if (!nextLine[0].toString().equals(\"Lender\")) {\r\n lenderList[count] = new Lender(nextLine[0].toString(), BigDecimal.valueOf(Float.parseFloat(nextLine[1])).setScale(3, RoundingMode.CEILING),\r\n BigDecimal.valueOf(Float.parseFloat(nextLine[2])).setScale(3, RoundingMode.CEILING));\r\n count++;\r\n }\r\n }\r\n Arrays.sort(lenderList);\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n } finally {\r\n if (null != reader) {\r\n reader.close();\r\n }\r\n }\r\n return lenderList;\r\n }", "private static ArrayList<Glootie> loadAliensFromFile(String pathToCSV) throws Exception{\r\n\t\tArrayList<Glootie> alienArray = new ArrayList<>();\r\n\t\tBufferedReader csvReader = new BufferedReader(new FileReader(pathToCSV));\r\n\t\t//Read and ignore header row:\r\n\t\tString row = csvReader.readLine();\r\n\t\t//Read remain data from CSV file\r\n\t\twhile ((row = csvReader.readLine()) != null) {\r\n\t\t\tString[] data = row.split(\",\");\r\n\t\t\t// Add new Glootie to array\r\n\t\t\talienArray.add(new Glootie(data));\r\n\t\t}\r\n\t\tcsvReader.close();\r\n\r\n\t\treturn alienArray;\r\n\t}", "public List<Country> readCountriesFromCSV(String fileName){\n try {\n Scanner scanner = new Scanner(new File(fileName));\n scanner.useDelimiter(\",\");\n scanner.nextLine();\n while(scanner.hasNextLine()){\n lsta.add(createCountry(scanner.nextLine().split(\",\")));\n// System.out.println(pyr.get_pharaoh()+\"|\"+pyr.get_modern_name()+\"|\"+pyr.get_site()+\"|\"+pyr.get_height()+\"|\");\n }\n scanner.close();\n } catch (FileNotFoundException ex) {\n Logger.getLogger(CityCSVDAO.class.getName()).log(Level.SEVERE, null, ex);\n }\n return lsta;\n }", "private List<String> read_level_row(String line){\r\n List<String> row = new ArrayList<>();\r\n try (Scanner rowScanner = new Scanner(line)){\r\n rowScanner.useDelimiter(\",\");\r\n while (rowScanner.hasNext()) {\r\n row.add(rowScanner.next());\r\n }\r\n }\r\n return row;\r\n }", "public ArrayList<Player> importPlayerData() {\n \n try {\n //Try to access player.csv in the given directory\n\t\t\tFile file = new File(\"data\\\\player.csv\");\n Scanner fileIn = new Scanner(file);\n \n fileIn.skip(\"userName,fullName,password,gold,exp,noOfLand\");\n \n\t\t\t//Use comma as delimiter in extracting various player info\n\t\t\tfileIn.useDelimiter(\",|\\r\\n|\\n\");\n \n while (fileIn.hasNext()) {\n String userName = fileIn.next().trim();\n String fullName = fileIn.next().trim();\n String password = fileIn.next().trim();\n int gold = fileIn.nextInt();\n int exp = fileIn.nextInt();\n\t\t\t\tint noOfLand = fileIn.nextInt();\n\t\t\t\t\n\t\t\t\t//Create new players based on extracted info\n Player player = new Player(userName, fullName, password, gold, exp, noOfLand);\n\t\t\t\t\n\t\t\t\t//Add players to playerList\n playerList.add(player);\n }\n \n }\n \n catch (IOException e) {\n //Specify the location of IOException\n\t\t\te.printStackTrace();\n }\n\t\t\n\t\treturn playerList;\n\t}", "@Override\n\tpublic void parseCSV(String csv) {\n\t\t\n\t}", "@SuppressWarnings(\"resource\")\r\n\tpublic static ArrayList<UserInfo> getUserDataFromCsvFile()\r\n\t{\r\n\t\t\r\n\t\tArrayList<UserInfo> unfList=null;\r\n\t\ttry{\r\n\t\t\tFile myObj= new File(\"E:\\\\Selenium Setup\\\\datadriven.csv\");\r\n\t\t\tunfList = new ArrayList<UserInfo>();\r\n\t\t\tScanner myReader= new Scanner(myObj);\r\n\t\t\tint count=0;\r\n\t\t\twhile (myReader.hasNextLine()) \r\n\t\t\t{\r\n\t\t\t\tString data= myReader.nextLine();\r\n\t\t\t\tif (count !=0)\r\n\t\t\t\t{\r\n\t\t\t\t\tString[] info =data.split(\"\\\\,\");\r\n\t\t\t\t\tunfList.add(new UserInfo(info[0],info[1]));\r\n\t\t\t\t\t//unfList.add(new UserInfo(info[0], info[1]));\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t++count;\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}catch (Exception e)\r\n\t\t\t{\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t\t// TODO: handle exception\r\n\t\t\t}\r\n\t\t\treturn unfList;\r\n\t}", "private static List<Student> getStudents() {\n \t\n List<Student> studentList = new ArrayList<>();\n Scanner readStudents=null;\n try {\n\t\t\treadStudents = new Scanner(new File(\"src/Student.csv\"));\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tSystem.out.println(\"Student file not found.\");\n\t\t}\n\t\twhile(readStudents.hasNextLine()) {\n\t\t\tString[] studentLine = readStudents.nextLine().split(\",\");\n\t\t\tlong studentId= Long.parseLong(studentLine[0]);\n\t\t\tint age = Integer.parseInt(studentLine[4]);\n\t\t\tlong recordId = Long.parseLong(studentLine[5]);\n \tStudent newStudent = new Student(studentId,age,studentLine[1],studentLine[2],studentLine[3],recordId);\n \tstudentList.add(newStudent);\n\t\t}\n \n readStudents.close();\n return studentList;\n }", "public List readCSVIntoList(String path, List appendToThisList,\n\t\t\tImportType type) {\n\n\t\tif (appendToThisList != null) {\n\t\t\ttry {\n\t\t\t\tint ver = 153;\n\n\t\t\t\tif (fileReader == null) fileReader = new CsvReader(path);\n\t\t\t\tfileReader.readHeaders();\n\n\t\t\t\twhile (fileReader.readRecord()) {\n\t\t\t\t\tswitch (type) {\n/*\n\t\t\t\t\tcase Advantage:\n\t\t\t\t\t\treadAdv(appendToThisList, ver);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase Skill:\n\t\t\t\t\t\treadSkill(appendToThisList, ver);\n\t\t\t\t\t\tbreak;\n*/\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\tcase FlowChart:\n\t\t\t\t\t\treadStep(appendToThisList, ver);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfileReader.close();\n\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n//\t\t\t\tLog.e(\"CsvRead failed FNF: \", e.toString());\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n//\t\t\t\tLog.e(\"CsvRead failed IO: \", e.toString());\n\t\t\t}\n\t\t}\n\t\tfileReader = null;\n\t\treturn appendToThisList;\n\t}", "private static void readInputDataFromCSV(String pathToCSVfile) throws IOException {\n\n // open the file\n BufferedReader reader = new BufferedReader(new FileReader(pathToCSVfile));\n // read line by line\n String line = null;\n Scanner scanner = null;\n int index = 0;\n inputPlayersList = new ArrayList<>();\n\n while ((line = reader.readLine()) != null) {\n Player pl = new Player();\n scanner = new Scanner(line);\n scanner.useDelimiter(\",\");\n while (scanner.hasNext()) {\n String data = scanner.next();\n if (index == 0)\n pl.setLastName(data);\n else if (index == 1)\n pl.setFirstName(data);\n else if (index == 2)\n pl.setCountry(data);\n else if (index == 3)\n pl.setTicketNumber(data);\n else\n System.out.println(\"Incorrect data: \" + data);\n index++;\n }\n index = 0;\n inputPlayersList.add(pl);\n\n }\n //close reader\n reader.close();\n }", "public List<Attending> getAttending(){\r\n \tList<Attending> aList = new ArrayList<Attending>();\r\n \ttry {\r\n \t\tString attendingPath = \"C:\\\\Users\\\\Tam Uduc\\\\Documents\\\\tempJavaData\\\\attending.csv\";\r\n \t\tFile attendingFile = new File(attendingPath);\r\n \t\tScanner sc = new Scanner(attendingFile);\r\n \t\t\r\n \t\twhile (sc.hasNextLine()) {\r\n \t\t\tString[] line = sc.nextLine().split(\",\");\r\n \t\taList.add(new Attending(line[0],line[1]));\r\n \t\t}\r\n \t\t\r\n \t} catch (Exception e){\r\n \t\tSystem.out.println(\"Something went wrong\");\r\n \t}\r\n \treturn aList; \r\n }", "public void readCsvFile(String path) {\n\n // make sure the ArrayList is empty before you start recording the data\n if (!Records.isEmpty()) {\n Records.clear();\n }\n try {\n // read data from the .csv file\n System.out.println(\"Reading array list....\");\n BufferedReader br = new BufferedReader(new FileReader(path));\n // Skip the first line\n String line = br.readLine();\n while ((line = br.readLine()) != null) {\n\n String[] fields = line.split(\",\");\n Record record = new Record( // the fields in .csv are jumbled\n Integer.parseInt(fields[2]), // skierID\n Integer.parseInt(fields[3]), // liftID\n Integer.parseInt(fields[1]), // dayNum\n Integer.parseInt(fields[4])); // time\n Records.add(record);\n }\n\n br.close();\n System.out.println(\"!!Reading completed!!\");\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private ArrayList<CSVRecord> processCsvData(String csvFile) {\n ArrayList<CSVRecord> records = new ArrayList<>();\n\n File csvData = new File(\"src/main/resources/csv/\" + csvFile + \".csv\");\n\n try {\n CSVParser parser = CSVParser.parse(csvData, Charset.defaultCharset(), CSVFormat.EXCEL);\n records.addAll(parser.getRecords());\n } catch (IOException exception) {\n logger.error(\"Unable to parse CSV file: \" + exception.getMessage());\n }\n\n return records;\n }", "public ArrayList<Location> parseData(BufferedReader reader) throws IOException {\n String line;\n\n reader.readLine();\n while (((line = reader.readLine()) != null)) {\n String[] array = line.split(\",\");\n float latitude = Float.valueOf(array[2]);\n float longitude = Float.valueOf(array[3]);\n// list.add(new Location(array[1], latitude, longitude, array[4], array[5], array[6], array[7], array[8], array[9], array[10]));\n Location newLocation = new Location(array[1], latitude, longitude, array[4], array[5], array[6], array[7], array[8], array[9], array[10]);\n _locations.add(newLocation);\n _nameMap.put(array[1], newLocation);\n }\n return _locations;\n }", "public List<String[]> readCSV() {\n\t\tCSVReader reader;\n\t\tList<String[]> myEntries = new ArrayList<String[]>();\n\t\ttry {\n\t\t\treader = new CSVReader(new FileReader(getCSVFolder() + File.separator + getFileName() + \".csv\"));\n\t\t\tmyEntries = reader.readAll();\n\t\t\treader.close();\t\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn myEntries;\n\t}", "public void createArrayList() throws IOException,ParseException\r\n\t {\n\t \t\r\n\t try(ICsvBeanReader beanReader = new CsvBeanReader(new FileReader(CSV_FILENAME), \r\n\t \t\tCsvPreference.STANDARD_PREFERENCE))\r\n\t {\r\n\t // the header elements are used to map the values to the bean\r\n\t final String[] headers = beanReader.getHeader(true);\r\n\t final CellProcessor[] processors = getProcessors();\r\n\t Complete customer;\r\n\t String gender,fullname;\r\n\t while ((customer = beanReader.read(Complete.class, headers, processors)) != null)\r\n\t {\r\n\t fullname = customer.getFirstname() + \" \" + customer.getLastname();\r\n\t if(customer.getGender().equals(\"f\"))\r\n\t \t gender = \"female\";\r\n\t \telse\r\n\t gender = \"male\";\r\n\t Date dob=new SimpleDateFormat(\"MM/dd/yyyy\").parse(customer.getDob()); \r\n\t String pattern = \"dd/MM/yyyy\";\r\n\t SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);\r\n \tString date = simpleDateFormat.format(dob);\r\n\t String age = calcAge(date);\r\n\t if(customer.getCategory().equals(\"student\"))\r\n\t {\r\n\t \tString grade = calcGrade(customer.getSec_percent());\r\n\t \tstudentList.add(new Student(customer.getId(),fullname,gender,date,age,customer.getAadhar_number(),customer.getCity(),\r\n\t \tcustomer.getContact_number(),Integer.parseInt(customer.getRoll_no()),customer.getClass_no(),Integer.parseInt(customer.getTotal_marks())\r\n\t \t,grade,Integer.parseInt(customer.getSec_percent()),customer.getHs_stream()));\r\n\t \t\t\r\n\t } \r\n\t else //for teacher\r\n\t {\r\n\t \tDate doj=new SimpleDateFormat(\"MM/dd/yyyy\").parse(customer.getDoj()); \r\n\t \tString pattern1 = \"dd/MM/yyyy\";\r\n\t SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat(pattern);\r\n \tString join_date = simpleDateFormat.format(doj);\r\n\t \tString str_sub_teachers = customer.getSubject_teaches();\r\n\t \tString service_period = calService(join_date);\r\n\t \tList<String> sub_teachers = new ArrayList<String>(Arrays.asList(str_sub_teachers.split(\"-\")));\r\n\t \t\t\t\r\n\t \t\tteacherList.add(new Teacher(customer.getId(),fullname,gender,date,age,customer.getAadhar_number(),customer.getCity(),\r\n \t\t\t\tcustomer.getContact_number(),customer.getEmp_no(),customer.getClass_teacher_of(),join_date,service_period\r\n \t\t\t\t,customer.getPrevious_school(),customer.getPost(),Integer.parseInt(customer.getSalary()),sub_teachers));\r\n }\r\n\t \r\n\t } //while\r\n\t }\r\n\t System.out.println(\"ArrayList Sucessfully Created\");\t\r\n\t \t\r\n\t }", "private static ArrayList<Ms3Person> readCSV(String fileName) {\r\n\t\tArrayList<Ms3Person> personsList = new ArrayList<>();\r\n\t\ttry (Scanner sc = new Scanner(new File(fileName))) {\r\n\t\t\t// skip the first line which is having column headers name\r\n\t\t\tsc.nextLine();\r\n\t\t\tint index = 1;\r\n\t\t\t// loop will go till end of file is reached ie.\r\n\t\t\twhile (sc.hasNextLine()) {\r\n\t\t\t\t// read single line at a time\r\n\t\t\t\tString personData = sc.nextLine();\r\n\t\t\t\tif(index >=5999)\r\n\t\t\t\t\tSystem.out.println(index+\" index\"+personData);\r\n\t\t\t\t//System.out.println(personData);\r\n\t\t\t\t//split the string by delimiter ,\r\n\t\t\t\tif(personData.length()>2) {\r\n\t\t\t\t\tString singlePersonRecord[] = personData.split(\",\");\r\n\t\t\t\t\t//the data we get is in form of sTring we need to convert\r\n\t\t\t\t\t//it to required data type for usage\r\n\t\t\t\t\tMs3Person person = convertDataToRequiredDataType(singlePersonRecord,index);\r\n\t\t\t\t\tif (person != null) {\r\n\t\t\t\t\t\t// add the person object in ArrayList\r\n\t\t\t\t\t\tpersonsList.add(person);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// bad data so create new file & write data\r\n // writing to the logfile\r\n \r\n \r\n\t\t\t\t\t}\r\n\t\t\t\t\tSystem.out.println(\"index: \" + index);\r\n\t\t\t\t}else {\r\n\t\t\t\t\tif(personData.length()<1) {//if no more line is there or only empty lines left\r\n\t\t\t\t\t\tSystem.out.println(\"finished reading the file...\");\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\t// if any exception arises while reading the file data that exception\r\n\t\t\t// will be caught in this block\r\n\t\t\tSystem.out.println(\"EXCEPTION: \" + e.getMessage());\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn personsList;\r\n\t}", "public static List<Sample> readCSV(String Location){\n\t\tList<Sample> SampleList= new ArrayList<Sample>();\n\n\t\tFileReader fileReader = null;\n\n\t\tCSVParser csvFileParser = null;\n\n\t\tCSVFormat csvFileFormat = CSVFormat.DEFAULT.withSkipHeaderRecord();\n\t\ttry {\n\n\t\t\t//initialize FileReader object\n\t\t\tfileReader = new FileReader(Location);\n\n\t\t\t//initialize CSVParser object\n\t\t\tcsvFileParser = new CSVParser(fileReader, csvFileFormat);\n\n\t\t\t//Get a list of CSV file records\n\t\t\tList<CSVRecord> csvRecords = csvFileParser.getRecords(); \n\n\t\t\tint start=0;\n\t\t\tString check = csvRecords.get(0).get(0);\n\t\t\tif(check.equals(\"Time\")){\n\t\t\t\tstart=1;\n\n\t\t\t}\n\t\t\telse{\n\t\t\t\tstart=0;\n\t\t\t}\n\n\t\t\t//Read the CSV file records \n\t\t\tfor (int j = start; j < csvRecords.size(); j++) {\n\n\t\t\t\tCSVRecord record = csvRecords.get(j);\n\t\t\t\tList<wifi> listOfWifi= new ArrayList<wifi>();\n\n\n\t\t\t\tboolean end=true;\n\t\t\t\tfor( int i=6; i<record.size()&&end; ){\n\t\t\t\t\tif(record.get(i).trim().equals(\"\") && record.get(i+1).trim().equals(\"\")){\n\t\t\t\t\t\tend=false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(i+3<record.size()){\n\t\t\t\t\t\tlistOfWifi.add(new wifi(record.get(i), record.get(i+1), record.get(i+3), record.get(i+2)));\n\t\t\t\t\t}\n\t\t\t\t\ti+=4;\n\t\t\t\t}\t\t\n\t\t\t\tString recordlat;\n\t\t\t\tString recordlon;\n\t\t\t\tString recordAlt;\n\n\t\t\t\tif (record.get(2).equals(\"?\")){\n\t\t\t\t\trecordlat=\"-200\";\n\t\t\t\t\trecordlon=\"-200\";\n\t\t\t\t\trecordAlt=\"-200\";\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\trecordlat=record.get(2); \n\t\t\t\t\trecordlon=record.get(3);\n\t\t\t\t\trecordAlt=record.get(4);\n\t\t\t\t}\n\t\t\t\ttry{\n\t\t\t\t\tSample sample= new Sample(record.get(0), record.get(1),recordlat,recordlon,recordAlt,\n\t\t\t\t\t\t\trecord.get(5), listOfWifi);\n\t\t\t\t\tSampleList.add(sample);\n\t\t\t\t}catch(Exception e){\n\t\t\t\t\tSystem.out.println(\"not in format 46 CSV file\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} \n\t\t} \n\t\tcatch (Exception e) {\n\t\t\tSystem.out.println(\"Error in CsvFileReader !!!\");\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tfileReader.close();\n\t\t\t\tcsvFileParser.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.out.println(\"Error while closing fileReader/csvFileParser !!!\");\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn SampleList;\n\t}", "void loadCrimeList(InputStream inputStream) {\n // Define a scanner\n try (Scanner scanner = new Scanner(inputStream)) {\n\n // While the scanner has another line to read\n while (scanner.hasNextLine()) {\n\n // Get the next link and split it into parts\n String line = scanner.nextLine();\n String parts[] = line.split(\",\");\n\n //Assign each part to a local var\n String id = parts[0];\n String title = parts[1];\n String dateString = parts[2];\n String solvedString = parts[3];\n\n UUID uuid = UUID.fromString(id);\n Date date = new SimpleDateFormat(\n \"yyyy-MM-dd\",\n Locale.getDefault()\n ).parse(dateString);\n boolean isSolved = (solvedString.equals(\"1\"));\n\n // Add the Crime to the Crime list\n mCrimes.add(\n new Crime(\n uuid,\n title,\n date,\n isSolved\n )\n );\n }\n\n // Date read in, so set the dataLoadedOnce flag to true.\n mDataLoadedOnce = true;\n\n } catch (Exception e) {\n Log.e(\"Read CSV\", e.toString());\n }\n }", "public void LoadFromCSV(){\n InputStream inputStream = getResources().openRawResource(R.raw.movielist);\n CSVinput csVinput = new CSVinput(inputStream);\n final List<String[]> movList = csVinput.read();\n\n for(String[] data : movList) {\n itemArrAdapt.add(data);\n }\n }", "public static List<List<String>> getCSV2(String filepath) { //this method words the best\r\n List<List<String>> records = new ArrayList<>();\r\n try (BufferedReader br = new BufferedReader(new FileReader(filepath))) {\r\n String line;\r\n int lineCounter = 1; // this is to stop it from reading lines after the data is done\r\n while ((line = br.readLine()) != null) {\r\n String[] values = line.split(\",\");\r\n if (values.length < 2 && lineCounter > 14) { // <----- the 14th line is chosen arbitrarily.\r\n System.out.println(\"end of file\");\r\n break;\r\n } else {\r\n records.add(Arrays.asList(values));\r\n lineCounter++;\r\n }\r\n }\r\n } catch (FileNotFoundException e) {\r\n e.printStackTrace();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n return records;\r\n }", "public static ArrayList<Actor> getActors() {\n File file = new File(\"./data/names.csv\");\n FileReader nameFileReader;\n Scanner scan;\n try {\n nameFileReader = new FileReader(file);\n scan = new Scanner(nameFileReader);\n\n } catch (IOException e) {\n throw new Error(\"Could not open names file\");\n }\n scan.nextLine();\n\n // Read File to get Actors\n ArrayList<Actor> actors = new ArrayList<Actor>();\n while (scan.hasNextLine()) {\n String line = scan.nextLine();\n String[] ratingParts = line.split(\"\\t\");\n\n if (isActor(ratingParts[ratingParts.length - 1])) {\n Actor actor = new Actor(ratingParts[2], ratingParts[1]);\n actors.add(actor);\n }\n }\n\n // Close Scanner\n scan.close();\n\n // Return Actors\n return actors;\n }", "public DataProcessor(String filename) throws FileNotFoundException{\n\tlst = new ArrayList();\n\tScanner input = new Scanner(new FileReader(filename));\n //skip the first line of the csv file\n\tString escapedLine = input.nextLine();\n \twhile(input.hasNextLine()){\n\t recordCount++;\n\t String line = input.nextLine();\n\t //CORRECTION BLOC to skip quoted commas\n\t if (line.contains(\"\\\"\")){\n\t\tint first= line.indexOf(\"\\\"\");\n\t\twhile(first >0 ){\n\t\t String problem = line.substring(first,line.indexOf(\"\\\"\",first+1)+1);\n\t\t \tint second = line.indexOf(\"\\\"\",first+1);\n\t\t\t//look for comma between quoted\n\t\t\tif(problem.contains(\",\")){\n\t\t\t //replace comma by space not to change string indices\n\t\t\t problem=problem.replace(\",\",\" \");\n\t\t\t line=line.replace(line.substring(first,line.indexOf(\"\\\"\",first+1)+1),problem);\n\t\t\t}\n\t\t\t//look for another quote symbol\n\t\t\tfirst = line.indexOf(\"\\\"\",second+1);\n\t\t}\n\t }\n\t String[] fields = line.split(\",\");\n\t //create Person object to store the suspect's data\n\t Person suspect = new Person(fields[SEX].charAt(0),fields[RACE].charAt(0),Integer.parseInt(fields[DOB]),Integer.parseInt(fields[HEIGHTFT]),fields[EYECOLOR],fields[BUILD].charAt(0));\n\t lst.add(suspect);\n\t}\n\t//close scanner\n\tinput.close();\n }", "static List<Student> loadStudentList(InputStream in) {\n return new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))\n .lines()\n .skip(1)\n .map(Student::fromCsv)\n .collect(Collectors.toList());\n }", "public void readRestaurantDetail (BufferedReader reader) {\n\n\n try {\n // Each line of CSV will be stored in this String\n String line = \"\";\n reader.readLine();\n int id = 0;\n while ((line = reader.readLine()) != null) {\n// count++;\n\n // line will be split by \",\", into an array of String\n String[] eachDetailsOfRestaurant = line.split(\",(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\n\n // Restaurant object created with the tracking number and name.\n Restaurant restaurant = new Restaurant(eachDetailsOfRestaurant[0], eachDetailsOfRestaurant[1], id);\n\n// Log.e(\"checking..............\", count.toString() + \" \" + restaurant.getName());\n\n // Converting coordinates to double and creating Location object\n for (int i = 0; i < eachDetailsOfRestaurant.length; i++) {\n Log.e(TAG, \"\" + i + \":\" + eachDetailsOfRestaurant[i]);\n }\n Double latitude = Double.parseDouble(eachDetailsOfRestaurant[5]);\n Double longitude = Double.parseDouble(eachDetailsOfRestaurant[6]);\n Location location = new Location(eachDetailsOfRestaurant[2], eachDetailsOfRestaurant[3], latitude, longitude);\n\n // Setting Location of the restaurant and adding to the Arraylist\n restaurant.setLocation(location);\n restaurants.add(restaurant);\n id++;\n }\n Collections.sort(restaurants);\n } catch (IOException e) {\n// e.printStackTrace();\n }\n }", "public void readEntityCSV(String line) {\n List<String> items = Arrays.asList(line.split(\",\"));\n this.setId(Long.valueOf(items.get(0)));\n this.noOfRounds = Integer.parseInt(items.get(1));\n this.caliber = Float.parseFloat(items.get(2));\n this.manufacturer = items.get(3);\n this.price = Float.parseFloat(items.get(4));\n }", "@Override\n public ToDoList readCSV(String csvPath) throws InvalidArgumentException {\n this.csvPath = csvPath;\n this.toDoList = new ToDoList();\n\n BufferedReader inputFile = null;\n try {\n inputFile = new BufferedReader(new FileReader(this.csvPath));\n\n String line = inputFile.readLine();\n if (line == null) {\n inputFile.close();\n return this.toDoList;\n } // Empty CSV file, no need for processing.\n this.processHeader(line);\n while ((line = inputFile.readLine()) != null) {\n this.processToDoItem(line);\n }\n inputFile.close();\n return this.toDoList;\n } catch (FileNotFoundException fnfe) {\n throw new InvalidArgumentException(\"OOPS! File not found!\");\n } catch (IOException ioe) {\n throw new InvalidArgumentException(\"There is somthing wrong!\");\n }\n }", "private static List<City> getCitiesFromString(String line, SocialNetwork r) {\n List<City> cities = new LinkedList<City>();\n String[] splitString = line.split(\",\");\n for (int i = 2; i < splitString.length; i++) {\n City city = r.getListOfCities().getCityByName(splitString[i]);\n cities.add(city);\n }\n return cities;\n }", "private Agent loadFromFile(String _login)\n {\n Agent agent = new Agent();\n File file = new File(_login + \".csv\");\n FileReader fr;\n BufferedReader br;\n String line;\n try {\n fr = new FileReader(file);\n br = new BufferedReader(fr);\n\n line = br.readLine();\n\n int numCients;\n { // to restrain the scope of csvData\n String[] csvData = line.split(\",\");\n agent.setID(Integer.parseInt(csvData[0]));\n agent.setName(csvData[1]);\n agent.setSalary(Double.parseDouble(csvData[2]));\n agent.setSalesBalance(Double.parseDouble(csvData[3]));\n\n numCients = Integer.parseInt(csvData[4]);\n }\n\n for(int i = 0; i<numCients; i++) {\n line = br.readLine();\n\n Client client = new Client();\n int numProp;\n\n {\n String[] csvData = line.split(\",\");\n client.setID(Integer.parseInt(csvData[0]));\n client.setName(csvData[1]);\n client.setIncome(Double.parseDouble(csvData[2]));\n\n numProp = Integer.parseInt(csvData[3]);\n }\n\n for(int j=0; j<numProp; j++)\n {\n line = br.readLine();\n\n String[] csvData = line.split(\",\");\n\n if(csvData[0].equals(\"house\")) {\n House property = new House();\n\n property.setAddress(csvData[1]);\n property.setNumRoom(Integer.parseInt(csvData[2]));\n property.setPrice(Double.parseDouble(csvData[3]));\n property.setSize(Double.parseDouble(csvData[4]));\n property.setHasGarage(Boolean.parseBoolean(csvData[5]));\n\n property.setHasGarden(Boolean.parseBoolean(csvData[6]));\n property.setHasPool(Boolean.parseBoolean(csvData[7]));\n\n client.addProperty(property);\n }\n else if(csvData[0].equals(\"apt\"))\n {\n Apartment property = new Apartment();\n\n property.setAddress(csvData[1]);\n property.setNumRoom(Integer.parseInt(csvData[2]));\n property.setPrice(Double.parseDouble(csvData[3]));\n property.setSize(Double.parseDouble(csvData[4]));\n property.setHasGarage(Boolean.parseBoolean(csvData[5]));\n\n property.setHasTerrace(Boolean.parseBoolean(csvData[6]));\n property.setHasElevator(Boolean.parseBoolean(csvData[7]));\n property.setFloor(Integer.parseInt(csvData[8]));\n property.setNumber(Integer.parseInt(csvData[9]));\n\n client.addProperty(property);\n }\n }\n\n agent.addClient(client);\n }\n fr.close();\n br.close();\n return agent;\n }\n catch (NumberFormatException nfEx) {\n JOptionPane.showMessageDialog(null, \"There was a problem when retrieving \" +\n \"the agent's data.\\n Please try again\");\n return null;\n }\n catch (IOException ioEx) {\n JOptionPane.showMessageDialog(null, \"This user doesn't exist....\");\n return null;\n }\n }", "@Override\r\n\tpublic ArrayList<String> importCsv(File file) {\r\n\t\t\tFileReader monFichier = null;\r\n\t\t\tBufferedReader tampon = null;\r\n\t\t\tArrayList<String> aLImport = new ArrayList<String>();\r\n\t\t\tString[] tabString ;\r\n\t\t\tint sizeLine;\r\n\t\t\r\n\t\t\ttry {\r\n\t\t\t\t// file path\r\n\t\t\t\tmonFichier = new FileReader(file.getAbsolutePath());\r\n\t\t\t\ttampon = new BufferedReader(monFichier);\r\n\r\n\t\t\t\t// read the first line of the file .csv\r\n\t\t\t\tString ligneTemp = tampon.readLine();\r\n\t\t\t\ttabString = ligneTemp.split(\";\");\r\n\t\t\t\tthis.setNbColumnsRead(tabString.length);\r\n\t\t\t\t\r\n\t\t\t\t//Start of the actual content (first line only acting as a header)\r\n\t\t\t\tligneTemp = tampon.readLine();\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\t// faire la gestion des erreurs \r\n\t\t\t\t\t\t/*JOptionPane.showMessageDialog(this, \"Le fichier .csv n'est pas valide\", \"Erreur !\",\r\n\t\t\t\t\t\t\t\t\tJOptionPane.ERROR_MESSAGE);*/\r\n\t\t\t\t\r\n\t\t\t\t// read all the lines one by one and split them to keep the\r\n\t\t\t\t// structure's name\r\n\t\t\t\twhile (ligneTemp != null) {\t\t\t\t\t\r\n\t\t\t\t\ttabString = ligneTemp.split(\";\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tsizeLine = tabString.length;\r\n\t\t\t\t\t//This for start at 1 in order to skip the first cell, assuming it is always \"Start\" and is therefore not required in the ArrayList\r\n\t\t\t\t\tfor (int i = 1; i < sizeLine; i+=2) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(!tabString[i].contains(\"End\")){\r\n\t\t\t\t\t\t\taLImport.add(tabString[i]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tligneTemp = tampon.readLine();\r\n\t\t\t\t}\r\n\r\n\t\t\t} catch (IOException exception) {\r\n\t\t\t\texception.printStackTrace();\r\n\t\t\t\treturn null;\r\n\t\t\t} finally {\r\n\t\t\t\ttry {\r\n\t\t\t\tif (tampon != null)\r\n\t\t\t\t{\r\n\t\t\t\t\ttampon.close();\r\n\t\t\t\t}\r\n\t\t\t\tif (monFichier != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmonFichier.close();\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch (IOException exception1) {\r\n\t\t\t\t\texception1.printStackTrace();\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\treturn aLImport;\t\r\n\t}", "private static List<String> parseLine(String csvLine) {\n List<String> result = new ArrayList<>();\n if (Objects.isNull(csvLine) || csvLine.isEmpty()) {\n return result;\n }\n StringBuilder charSet = new StringBuilder();\n char[] chars = csvLine.toCharArray();\n for (char character : chars) {\n if (character == DEFAULT_SEPARATOR) {\n result.add(charSet.toString().trim());\n charSet = new StringBuilder();\n } else {\n charSet.append(character);\n }\n }\n result.add(charSet.toString().trim());\n return result;\n }", "public String[] parseLine() {\n String[] tokens = null;\n try {\n tokens = csvReader.readNext();\n } catch (IOException e) {\n e.printStackTrace();\n } catch (Exception e) {\n e.printStackTrace();\n }\n return tokens;\n }", "public List<String[]> parseCSV(String filename) throws FileNotFoundException {\n Scanner scanner = new Scanner(new File(filename));\n List<String[]> list = new ArrayList<>();\n while (scanner.hasNextLine()) {\n String line = scanner.nextLine();\n list.add(line.split(\", \"));\n }\n scanner.close();\n return list;\n }", "@Override\n protected void processLine(String line) {\n String[] lines = line.split(\",\");\n for (String l : lines) {\n data.add(l);\n }\n }", "public static LinkedList<Patient> CSVImport(String str) {\n\t\treturn CSVImport(new File(str));\n\t}", "static public List<Category> categoryReader() throws IOException {\n\n BufferedReader csvReader = new BufferedReader(new FileReader(CATEGORIES_REFERENCE_FILE));\n String row;\n List<Category> dataList = new ArrayList<>();\n\n row = csvReader.readLine();\n while ((row = csvReader.readLine()) != null){\n Category data = new Category();\n String[] datas = row.split(SEPARATOR_COMA);\n\n data.setCategory_id(Integer.parseInt(datas[0]));\n data.setName(datas[1]);\n dataList.add(data);\n\n }\n return dataList;\n }", "private void parseCSVToBean(String url) throws Exception {\r\n\r\n\t\t// later we have to implement to check created time of the CSV file\r\n\r\n\t\tColumnPositionMappingStrategy<DealerDetails> strat = new ColumnPositionMappingStrategy<>();\r\n\t\tstrat.setType(DealerDetails.class);\r\n\t\tString[] columns = new String[] { \"firstName\", \"lastName\", \"username\",\r\n\t\t\t\t\"contactNumber\", \"panNumber\", \"vatNumber\", \"bankName\",\r\n\t\t\t\t\"bankAccountNumber\", \"websiteUrl\", \"address\",\r\n\t\t\t\t\"branchTelNumber\", \"country\", \"state\", \"city\", \"zipcode\" };\r\n\t\tstrat.setColumnMapping(columns);\r\n\r\n\t\tCsvToBean<DealerDetails> csvToBean = new CsvToBean<DealerDetails>();\r\n\r\n\t\t// URL fileURL = new URL(url);\r\n\t\t// BufferedReader br = new BufferedReader(new InputStreamReader(\r\n\t\t// fileURL.openStream()));\r\n\r\n\t\tURL csvFileURL = new URL(url);\r\n\t\tBufferedReader bufferedReader = new BufferedReader(\r\n\t\t\t\tnew InputStreamReader(csvFileURL.openStream()));\r\n\r\n\t\tCSVReader reader = new CSVReader(bufferedReader);\r\n\r\n\t\tList<DealerDetails> dealers = csvToBean.parse(strat, reader);\r\n\r\n\t\tfor (DealerDetails dealerDetails : dealers) {\r\n\t\t\t// create user\r\n\t\t\tcreateUser(dealerDetails);\r\n\t\t}\r\n\r\n\t}", "public void read()\r\n\t{\r\n\t\tScanner input = null;\r\n\t\ttry\r\n\t\t{\r\n\t\t\tint i = 0;\r\n\r\n\t\t\tinput = new Scanner(new File(\"netflix.csv\")).useDelimiter(\"[,\\r\\n]\");\r\n\r\n\t\t\twhile (input.hasNext())\r\n\t\t\t{\r\n\t\t\t\tinput.nextLine();\r\n\t\t\t\tString title = input.next();\r\n\r\n\t\t\t\tString rating = input.next();\r\n\r\n\t\t\t\tint year = Integer.parseInt(input.next());\r\n\r\n\t\t\t\tint score = Integer.parseInt(input.next());\r\n\t\t\t\tMovie a = new Movie(title, rating, year, score);\r\n\t\t\t\tdata[i] = a;\r\n\t\t\t\ti++;\r\n\t\t\t\tactualSize++;\r\n\r\n\t\t\t}\r\n\t\t\tinput.close();\r\n\r\n\t\t}\r\n\t\tcatch (FileNotFoundException e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"File not found\");\r\n\r\n\t\t}\r\n\r\n\t}", "public static List<String> parseCSVFile(final String filePath) {\n\t\tLOG.info(\"Entred in to parseCSVFile()\");\n\t\tLOG.info(\"File path is : {}\", filePath);\n\n\t\tList<String> dataList = new ArrayList<>();\n\t\tCSVReader csvReader = null;\n\t\ttry {\n\t\t\tcsvReader = new CSVReader(new FileReader(filePath));\n\t\t\tString[] nextLine;\n\t\t\tint lineNumber = 0;\n\t\t\twhile ((nextLine = csvReader.readNext()) != null) {\n\t\t\t\tlineNumber++;\n\t\t\t\tif (lineNumber == 1)\n\t\t\t\t\tcontinue;\n\t\t\t\tString data = String.join(ReportingDataConstants.CSV_DATA_SPERATOR, nextLine);\n\t\t\t\tLOG.info(\"The data is {}\", data);\n\t\t\t\tdataList.add(data);\n\t\t\t}\n\t\t} catch (FileNotFoundException e) {\n\t\t\tthrow new RuntimeException(\"CSV File not found, please check the file paths\");\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(\"CSV File parse exception, please check the file format\");\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (csvReader != null)\n\t\t\t\t\tcsvReader.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tLOG.error(\"Exception occured while closing reader: {}\", e.getLocalizedMessage());\n\t\t\t}\n\t\t}\n\n\t\tLOG.info(\"Exit from parseCSVFile()\");\n\t\treturn dataList;\n\t}", "public Set<Airport> loadFile(final String csvFile) throws CoreException;", "public ArrayList<Auction> readAuctions()\n {\n String dataLines[]; /* Data read from line */\n int countAuction = 0; /* No. of auction */\n boolean bNotNull = true; /* Indicate line null error */ \n \n ArrayList<Auction> auctionList = new ArrayList<Auction>();\n \n /* Open file. If cannot open, return null; */\n TextFileReader reader = new TextFileReader(auctionFileName);\n if (reader.open() == false)\n return null;\n \n /* Read number of data */\n String line;\n line = reader.readLine();\n try\n {\n countAuction = Integer.parseInt(line);\n }\n catch (Exception e)\n {\n return null;\n }\n \n /* Loop get auction, loop get bid, and add to list */\n int numTag = tagAuction.length;\n for (int i = 0; i < countAuction && bNotNull; i++)\n {\n /* Get Auction */\n dataLines = new String[numTag];\n for (int j = 0; j < numTag && bNotNull; j++)\n {\n dataLines[j] = reader.readLine();\n if (dataLines[j] == null)\n bNotNull = false;\n }\n Auction auction = parseAuction(dataLines);\n if (auction != null) /* If data is correct, add to auction list */\n {\n auctionList.add(auction);\n readBids(reader, auction);\n }\n }\n reader.close();\n return auctionList;\n }", "public void load() throws CityException{\r\n \r\n allRanks = new ArrayList<Rank>();\r\n File file = new File(RANK_DATA_DIRECTORY);\r\n Scanner rankDataReader = null;\r\n Scanner lineReader = null;\r\n\r\n try {\r\n\r\n rankDataReader = new Scanner(file);\r\n\r\n ArrayList<String> rankDataArray = new ArrayList<String>();\r\n int count = 0;\r\n\r\n while (rankDataReader.hasNext()) {\r\n\r\n String rankDataLine = rankDataReader.nextLine();\r\n\r\n if (count > 0) {\r\n\r\n String[] rankData = rankDataLine.split(\",\");\r\n\r\n String rankName = rankData[0];\r\n int xp = Integer.parseInt(rankData[1]);\r\n int plotAvailable = Integer.parseInt(rankData[2]);\r\n\r\n allRanks.add(new Rank(rankName, xp, plotAvailable));\r\n }\r\n\r\n count++;\r\n }\r\n\r\n } catch (FileNotFoundException e) {\r\n throw new CityException(\"InvalidFile\");\r\n } finally {\r\n rankDataReader.close();\r\n }\r\n }", "List<String[]> readCsv(String inputFilePath)throws IOException;", "public Films getFilmData(String csvPath){\n Films films = new Films();\n String[] line;\n \n try(CSVReader csv = new CSVReader(new FileReader(csvPath));){\n String[] headers = csv.readNext(); //read first line for header strings\n \n while((line = csv.readNext()) != null){\n films = storeLine(line, films); //store each line as film data in films\n }\n }catch(IOException ex){\n ex.printStackTrace();\n }\n \n return films;\n }", "public List<String> convertCsvToJava() {\n List<String> bookList = new ArrayList<String>();\n try {\n String csvFileToRead = STRING1;\n BufferedReader br = null;\n String line = \"\";\n String splitBy = \",\";\n \n try {\n\n br = new BufferedReader(new FileReader(csvFileToRead));\n while ((line = br.readLine()) != null) {\n\n // split on comma(',')\n String[] books = line.split(splitBy);\n String stringBook = \"\";\n for(int i=0;i<12;i++){\n if (i<11){\n stringBook=stringBook.concat(books[i]+\",\"); \n }else{\n stringBook=stringBook.concat(books[i]);\n }\n }\n bookList.add(stringBook);\n }\n } catch (FileNotFoundException e) {\n LOGGER.info(e);\n\n } catch (IOException e) {\n LOGGER.info(e);\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n LOGGER.info(e);\n }\n }\n }\n } catch (Exception e) {\n LOGGER.info(e);\n }\n return bookList;\n\n }", "private void processCSVFile( BufferedReader csvFile ) throws IOException {\r\n\t\t\r\n\t\tboolean headerRowRead = false;\r\n\t\tString[] headerArray = null;\r\n\t\t\r\n\t\t//loop through all rows and create contacts\r\n\t\tString row = csvFile.readLine();\r\n\t\t\r\n\t\twhile (row != null) {\r\n\t\t\t\r\n\t\t\tif (row.length()==0 || row.startsWith(\"#\") || row.startsWith(\";\") ) {\t\t\r\n\t\t\t\t\r\n\t\t\t\t//empty or comment row: skip\r\n\t\t\t\t\r\n\t\t\t} else if (!headerRowRead) {\r\n\t\t\t\t\r\n\t\t\t\t//header row is the first non-blank, not-comment row in the CSV file\r\n\t\t\t\t//the required header row contains the attribute names\r\n\t\t\t\t\r\n\t\t\t\theaderRowRead = true;\r\n\t\t\t\t\r\n\t\t\t\t//read header\r\n\t\t\t\theaderArray = parseCSVLine( row, true); \t\t\r\n\t\t\t\tLogger.debug(\"header: \" + row);\r\n\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\r\n\t\t\t\tHashMap<String,String> contactObject = ContactsImport.getRowValues(headerArray, row);\r\n\t\t\t\tcreateContact(contactObject);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\trow = csvFile.readLine(); //read next line form csv file\r\n\t\t}\r\n\t\t\r\n\t\tLogger.debug(\"finished\");\r\n\r\n\t}", "private void readFile() {\r\n\t\tcsvEntrys = new ArrayList<>();\r\n\t\tString line = \"\";\r\n\t\ttry (BufferedReader br = new BufferedReader(new FileReader(new File(filepath)))) {\r\n\t\t\twhile ((line = br.readLine()) != null) {\r\n\t\t\t\tif (!line.contains(\"id\")) {\r\n\t\t\t\t\tcsvEntrys.add(line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void openPlayerDataFromCSV() throws FileNotFoundException {\n csvReader = new BufferedReader(new FileReader(PATH_TO_CSV));\n }", "public static ArrayList<Director> getDirectors() {\n File file = new File(\"./data/names.csv\");\n Scanner scan;\n try {\n scan = new Scanner(file);\n\n } catch (IOException e) {\n throw new Error(\"Could not open names file\");\n }\n scan.nextLine();\n\n // Read File to get Directors\n ArrayList<Director> directors = new ArrayList<Director>();\n while (scan.hasNextLine()) {\n String line = scan.nextLine();\n String[] ratingParts = line.split(\"\\t\");\n\n if (isDirector(ratingParts[ratingParts.length - 1])) {\n Director director = new Director(ratingParts[2], ratingParts[1]);\n directors.add(director);\n }\n }\n\n // Close Scanner\n scan.close();\n\n // Return Directors\n return directors;\n }", "public static List<Person> deserializeObjectFromCsvFile(Path filePath)\n throws IOException, DataConversionException {\n requireNonNull(filePath);\n return fromCsvString(FileUtil.readFromFile(filePath));\n }", "private List<String[]> parseFileByName(String name){\n\n List<String[]> content = new ArrayList<>();\n String csvFile = name;\n BufferedReader br = null;\n String line = \"\";\n String cvsSplitBy = \",\";\n\n try {\n\n br = new BufferedReader(new FileReader(csvFile));\n while ((line = br.readLine()) != null) {\n\n // use comma as separator\n String[] data = line.split(cvsSplitBy);\n content.add(data);\n\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n return content;\n }", "static public List<Product> productReader() throws IOException {\n BufferedReader csvReader = new BufferedReader(new FileReader(PRODUCTS_REFERENCE_FILE));\n String row;\n List<Product> dataList = new ArrayList<>();\n\n row = csvReader.readLine();\n while ((row = csvReader.readLine()) != null){\n\n Product data = new Product();\n //I separate the row data by a separator, a coma in this case and add all the data in the class\n String[] datas = row.split(SEPARATOR_COLON);\n\n data.setProduct_id(Integer.parseInt(datas[0]));\n data.setName(datas[1]);\n data.setDescription(datas[2]);\n data.setCategory_id(Integer.parseInt(datas[3]));\n\n DateTimeFormatter formatter = DateTimeFormatter.ofPattern(\"MM/dd/yyyy\");\n\n //Since some dates had just one number for the month, I had to use this to add a 0\n //to make all the dates the same length after getting rid of the 0:01 that was not necessary\n String[] creationDate = datas[4].split(\" \");\n if(creationDate[0].length() == 9){\n creationDate[0] = \"0\"+ creationDate[0];\n }\n data.setCreation_date(LocalDate.parse(creationDate[0], formatter));\n\n creationDate = datas[5].split(\" \");\n if(creationDate[0].length() == 9){\n creationDate[0] = \"0\"+ creationDate[0];\n }\n data.setUpdate_date(LocalDate.parse(creationDate[0], formatter));\n\n creationDate = datas[6].split(\" \");\n if(creationDate[0].length() == 9){\n creationDate[0] = \"0\"+ creationDate[0];\n }\n data.setLast_purchased_date(LocalDate.parse(creationDate[0], formatter));\n\n dataList.add(data);\n\n }\n return dataList;\n\n }", "private Iterable<CSVRecord> obtainCsvIterable()\n throws FileNotFoundException, IOException {\n return CSVFormat.RFC4180\n .withFirstRecordAsHeader()\n .parse(this.fileReader);\n\n }", "public static void main(String[] args) throws FileNotFoundException, IOException {\r\n \r\n Directory d = new Directory();\r\n \r\n if (args.length != 1) {\r\n System.out.println(\"Usage: java CSVReaderTest <filename>\");\r\n }\r\n else {\r\n FileReader fr = new FileReader(args[0]);\r\n BufferedReader c = new BufferedReader(fr);\r\n\r\n int lineNum = 0;\r\n boolean eof = false;\r\n \r\n while (!eof) {\r\n String line = c.readLine();\r\n \r\n if (line == null) {\r\n eof = true;\r\n }\r\n else{\r\n // Allocate an array of the necessary size to return the strings\r\n String[] values = new String[4];\r\n // Start beginIndex at the beginning of the String, position 0\r\n int beginIndex = 0;\r\n\r\n for (int i = 0; i < 3; i++) {\r\n int endIndex;\r\n endIndex = line.indexOf(',', beginIndex);\r\n\r\n // if the argument begins and ends with quotes, remove them\r\n if (line.charAt(beginIndex) == '\"' && line.charAt(endIndex - 1) == '\"') {\r\n values[i] = line.substring(beginIndex + 1, endIndex - 1);\r\n\r\n } else {\r\n values[i] = line.substring(beginIndex, endIndex);\r\n }\r\n\r\n beginIndex = endIndex + 1;\r\n }\r\n\r\n if (line.charAt(beginIndex) == '\"' && line.charAt(line.length() - 1) == '\"') {\r\n values[3] = line.substring(beginIndex + 1, line.length() - 1);\r\n } else {\r\n values[3] = line.substring(beginIndex, line.length());\r\n }\r\n \r\n if (lineNum > 1) {\r\n lineNum = lineNum + 1;\r\n Student s = new Student(values[0]);\r\n s.setFirstName(values[1]);\r\n s.setLastName(values[2]);\r\n s.setPhoneNumber(values[3]);\r\n d.addStudent(s);\r\n System.out.println(s);\r\n }\r\n\r\n }\r\n }\r\n c.close();\r\n }\r\n \r\n Student c = new Student(\"mengl1\");\r\n c.setFirstName(\"Meng\");\r\n c.setLastName(\"Li\");\r\n c.setPhoneNumber(\"412-807-0153\");\r\n \r\n Student a = new Student(\"mengl2\");\r\n a.setFirstName(\"Mengl\");\r\n a.setLastName(\"Li\");\r\n a.setPhoneNumber(\"412-807-0154\");\r\n \r\n Student b = new Student(\"terryhong\");\r\n b.setFirstName(\"terry\");\r\n b.setLastName(\"hong\");\r\n b.setPhoneNumber(\"412-464-475\");\r\n\r\n d.addStudent(c);\r\n d.addStudent(a);\r\n d.addStudent(b);\r\n \r\n //System.out.println(d.searchByAndrewId(\"mengl2\"));\r\n //d.deleteStudent(\"terryhong\");\r\n System.out.println(d.size());\r\n // System.out.println(d.searchByLastName(\"Li\"));\r\n\r\n }", "public Set<Airport> loadFile(final File csvFile) throws CoreException;", "public static ArrayList<Loan> readData(String file) throws FileNotFoundException {\n // Scanner used to read in the data from the file.\n Scanner in = new Scanner(new File(file));\n // ArrayList to store the data.\n ArrayList<Loan> list = new ArrayList<Loan>();\n // Read in the header line so it is not added to the ArrayLists.\n String header = in.nextLine();\n // Check to see if the file still has data to be read in.\n while(in.hasNextLine()) {\n \n // Read in the line of data and \n // use a space as a delimiter to separate the different columns.\n String[] line = in.nextLine().split(\",\");\n \n // Local variable containing the ID.\n int ID = Integer.parseInt(line[0]);\n \n // Local variable containing the amount.\n int amount = Integer.parseInt(line[1]);\n \n // Local variable containing the country.\n String country = line[2];\n \n // Local variable containing the lenders.\n int lenders = Integer.parseInt(line[5]);\n \n // Local variable containing the difference in days.\n int differenceInDays = Integer.parseInt(line[4])/86400;\n \n // Add the loan to the arraylist.\n list.add(new Loan(ID, amount, country, differenceInDays, lenders)); \n \n }\n // Return the completed ArrayLists.\n return list;\n }", "public static ArrayList<ArrayList<String>> getAllDataFromFile(String csvInputPath, char sep) {\n ArrayList<ArrayList<String>> allData = new ArrayList<>();\r\n try (CSVReader reader = new CSVReader(new InputStreamReader(new FileInputStream(csvInputPath)), sep, '\"', '|');) {\r\n String[] nextLine;\r\n int numRow = 0;\r\n while ((nextLine = reader.readNext()) != null && numRow < MAX_ROW_NUMBER) {\r\n ArrayList<String> allRow = new ArrayList<>();\r\n allRow.addAll(Arrays.asList(nextLine));\r\n allData.add(allRow);\r\n numRow += 1;\r\n }\r\n } catch (FileNotFoundException ex) {\r\n Logger.getLogger(ManageExcel.class\r\n .getName()).log(Level.SEVERE, null, ex);\r\n\r\n } catch (IOException ex) {\r\n Logger.getLogger(ManageExcel.class\r\n .getName()).log(Level.SEVERE, null, ex);\r\n }\r\n return allData;\r\n }", "private static Wine[] read() {\r\n\t\t// We can add files we would like to parse in the following array. We use an array list\r\n\t\t// because it allows us to add dynamically.\r\n\t\tString[] file_adr = { \"data/winemag-data_first150k.txt\", \"data/winemag-data-130k-v2.csv\" };\r\n\t\tArrayList<Wine> arr_list = new ArrayList<Wine>();\r\n\t\t\r\n\t\tint k = 0;\r\n\t\twhile (k < file_adr.length) {\r\n\t\t\tboolean flag = false;\r\n\t\t\tif (file_adr[k].endsWith(\".csv\")) {\r\n\t\t\t\tflag = true;\r\n\t\t\t}\r\n\t\t\tFile f = new File(file_adr[k]);\r\n\t\t\tScanner sc = null;\r\n\t\t\ttry {\r\n\t\t\t\tsc = new Scanner(f, \"UTF-8\");\r\n\t\t\t} catch (FileNotFoundException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\tsc.nextLine();\r\n\t\t\tInteger id_count = 0;\r\n\t\t\tif(!flag) {\r\n\t\t\t\twhile (sc.hasNextLine()) {\r\n\t\t\t\t\tString scanned = sc.nextLine();\r\n\t\t\t\t\t// if there is a blank line, skip it before a fail.\r\n\t\t\t\t\tif (scanned.isEmpty()) {\r\n\t\t\t\t\t\tscanned = sc.nextLine();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// use this instead of StringTokenizer because it won't skip empty fields.\r\n\t\t\t\t\tString[] st = scanned.split(\",\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t/* was put here to make sure all fields show up.\r\n\t\t\t\t\tString toString = \"\";\r\n\t\t\t\t\tfor (int i = 0; i < st.length; i++) {\r\n\t\t\t\t\t\ttoString += st[i] + \", \";\r\n\t\t\t\t\t}\r\n\t\t\t\t\t*/\r\n\t\r\n\t\t\t\t\tString country = st[1];\r\n\t\t\t\t\tString description = \"\";\r\n\t\t\t\t\t// This piece grabs our entire description! this paragraph has our delimiters so it gets split.\r\n\t\t\t\t\tint count = 0;\r\n\t\t\t\t\tfor (int i = 2; i < (st.length - 10) + 2; i++) {\r\n\t\t\t\t\t\tif (st[i].endsWith(\"\\\"\")) {\r\n\t\t\t\t\t\t\tdescription += st[i];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tdescription += st[i] + \", \";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcount++;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tString designation = st[count+2];\r\n\t\t\t\t\t\r\n\t\t\t\t\t// next two fields will fail if the field is empty, so make sure we assign it something.\r\n\t\t\t\t\tInteger points = !(st[count+3].isEmpty()) ? Integer.parseInt(st[count+3]) : -1;\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble price = !(st[count+4].isEmpty()) ? Double.parseDouble(st[count+4]) : -1.0;\r\n\t\t\t\t\t\r\n\t\t\t\t\tString province = st[count+5];\r\n\t\t\t\t\tString[] region = {\r\n\t\t\t\t\t\t\tst[count+6],\r\n\t\t\t\t\t\t\tst[count+7]\r\n\t\t\t\t\t};\r\n\t\t\t\t\tString variety = st[count+8];\r\n\t\t\t\t\tString winery = st[count+9];\r\n\t\t\t\t\t//System.out.println(id_count);\r\n\t\t\t\t\t// unique ID system because some wine bottles have empty names.\r\n\t\t\t\t\tInteger unique_id = id_count++;\r\n\t\t\t\t\t\r\n\t\t\t\t\tString[] items = {\r\n\t\t\t\t\t\t\tcountry,\r\n\t\t\t\t\t\t\tdescription,\r\n\t\t\t\t\t\t\tdesignation,\r\n\t\t\t\t\t\t\tprovince,\r\n\t\t\t\t\t\t\twinery,\r\n\t\t\t\t\t\t\tvariety\r\n\t\t\t\t\t};\r\n\t\t\t\t\t\r\n\t\t\t\t\tString[] reviewer = {\r\n\t\t\t\t\t\t\t\"\",\r\n\t\t\t\t\t\t\t\"\"\r\n\t\t\t\t\t};\r\n\t\t\t\t\t\r\n\t\t\t\t\tString[] taste = {};\r\n\t\t\t\t\t// Object constructor.\r\n\t\t\t\t\tWine curr_obj = new Wine(items, taste, region, points, unique_id, price, reviewer);\r\n\t\t\t\t\t\r\n\t\t\t\t\tarr_list.add(curr_obj);\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tk++;\r\n\t\t\t\tsc.close();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\twhile (sc.hasNextLine()) {\r\n\t\t\t\t\tString scanned = sc.nextLine();\r\n\t\t\t\t\t// if there is a blank line, skip it before a fail.\r\n\t\t\t\t\tif (scanned.isEmpty()) {\r\n\t\t\t\t\t\tscanned = sc.nextLine();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// use this instead of StringTokenizer because it won't skip empty fields.\r\n\t\t\t\t\tString[] st = scanned.split(\",\");\r\n\t\t\t\t\t//System.out.println(arr_list.size());\r\n\t\t\t\t\tid_count = arr_list.size();\r\n\t\t\t\t\t/* was put here to make sure all fields show up.\r\n\t\t\t\t\tString toString = \"\";\r\n\t\t\t\t\tfor (int i = 0; i < st.length; i++) {\r\n\t\t\t\t\t\ttoString += st[i] + \", \";\r\n\t\t\t\t\t}\r\n\t\t\t\t\t*/\r\n\t\t\t\t\t//System.out.println(st[0]);\r\n\t\t\t\t\t/*if(Integer.parseInt(st[0]) == 30350) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t*/\r\n\t\t\t\t\tString country = st[1];\r\n\t\t\t\t\tString description = \"\";\r\n\t\t\t\t\t// This piece grabs our entire description! this paragraph has our delimiters so it gets split.\r\n\t\t\t\t\tint count = 0;\r\n\t\t\t\t\tfor (int i = 2; i < (st.length - 12) + 2; i++) {\r\n\t\t\t\t\t\tif (st[i].endsWith(\"\\\"\")) {\r\n\t\t\t\t\t\t\tdescription += st[i];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tdescription += st[i] + \", \";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcount++;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tString designation = st[count+2];\r\n\t\t\t\t\t\r\n\t\t\t\t\t// next two fields will fail if the field is empty, so make sure we assign it something.\r\n\t\t\t\t\tInteger points = !(st[count+3].isEmpty()) ? Integer.parseInt(st[count+3]) : -1;\r\n\t\t\t\t\t\r\n\t\t\t\t\tDouble price = !(st[count+4].isEmpty()) ? Double.parseDouble(st[count+4]) : -1.0;\r\n\t\t\t\t\t\r\n\t\t\t\t\tString province = st[count+5];\r\n\t\t\t\t\tString[] region = {\r\n\t\t\t\t\t\t\tst[count+6],\r\n\t\t\t\t\t\t\tst[count+7]\r\n\t\t\t\t\t};\r\n\t\t\t\t\tString taster_name = st[count+8];\r\n\t\t\t\t\tString taster_handle = st[count+9];\r\n\t\t\t\t\tString variety = st[count+10];\r\n\t\t\t\t\tString winery = st[count+11];\r\n\t\t\t\t\t//System.out.println(id_count);\r\n\t\t\t\t\t// unique ID system because some wine bottles have empty names.\r\n\t\t\t\t\tInteger unique_id = id_count++;\r\n\t\t\t\t\t\r\n\t\t\t\t\tString[] items = {\r\n\t\t\t\t\t\t\tcountry,\r\n\t\t\t\t\t\t\tdescription,\r\n\t\t\t\t\t\t\tdesignation,\r\n\t\t\t\t\t\t\tprovince,\r\n\t\t\t\t\t\t\twinery,\r\n\t\t\t\t\t\t\tvariety\r\n\t\t\t\t\t};\r\n\t\t\t\t\tString[] reviewer = {\r\n\t\t\t\t\t\t\ttaster_name,\r\n\t\t\t\t\t\t\ttaster_handle\r\n\t\t\t\t\t};\r\n\t\t\t\t\t\r\n\t\t\t\t\tString[] taste = {};\r\n\t\t\t\t\t// Object constructor.\r\n\t\t\t\t\tWine curr_obj = new Wine(items, taste, region, points, unique_id, price, reviewer);\r\n\t\t\t\t\t\r\n\t\t\t\t\tarr_list.add(curr_obj);\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tk++;\r\n\t\t\t\tsc.close();\r\n\t\t\t}\r\n\t\t}\r\n\t\t// We no longer need an array list. we have our size required. Put into an array.\r\n\t\tWine[] array_wines = new Wine[arr_list.size()];\r\n\t\tarray_wines = arr_list.toArray(array_wines);\r\n\t\t\r\n\t\treturn array_wines;\r\n\t\r\n\t}", "public static List read(String file){\n\t\tLinkedList<String> data =\tnew LinkedList<String>();\n\t\tString dataRow;\n\t\t\n\t\ttry {\n\t\t\t\n\t\tBufferedReader br = new BufferedReader(new FileReader(file));\n\t\t\n\t\twhile((dataRow = br.readLine())!=null);{\t\n\t\t\tString[] dataRecord = dataRow.split(\",\");\n\t\t\tdata.addAll(dataRecord);\n\t\t}\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.out.println(\"Could not found file\");\n\t\t\te.printStackTrace();\n\t\t}catch (IOException e) {\n\t\tSystem.out.println(\"Could Not read file\");\n\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t\n\t}", "public static void readCSV() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(f));\n\t\tString line;\n\t\tif((line = br.readLine()) != null) {\n\t\t\tsetCSVorder(line);\n\t\t}\n\t\t\n\t\twhile((line = br.readLine()) != null) {\n\t\t\tFlightState fs = getStateFromCSV(line);\n\t\t\tsendToKafka(fs);\n\t\t}\n\t\t\n\t\tbr.close();\n\t}", "public List<Airport> getLocationListFromCsv() {\n\t\treturn this.airportList;\n\t}", "List<CountryEntity> parseLines(List<String> line);", "public static List readCsvFile(String fileName) {\n logger.info(\"Start executing readCsvFile method !!!\");\n FileReader fileReader = null;\n CSVParser csvFileParser = null;\n List csvRecords = null;\n try {\n //initialize FileReader object\n fileReader = new FileReader(fileName);\n //initialize CSVParser object\n csvFileParser = new CSVParser(fileReader, CSVFormat.EXCEL);\n //Get a list of CSV file records\n csvRecords = csvFileParser.getRecords();\n } catch (Exception e) {\n logger.error(\"Error in CsvFileReader !!!\");\n e.printStackTrace();\n logger.error(\"Exception : \", e);\n } finally {\n try {\n fileReader.close();\n csvFileParser.close();\n } catch (IOException e) {\n logger.error(\"Error while closing fileReader/csvFileParser !!!\");\n e.printStackTrace();\n logger.error(\"IOException : \", e);\n }\n }\n return csvRecords;\n }", "private ArrayList<String> getFileData(InputStream is) {\n ArrayList<String> restaurantData = new ArrayList<>();\n\n // Initialize the reader for the csv file\n BufferedReader reader = new BufferedReader(new InputStreamReader(is,\n Charset.forName(\"UTF-8\")));\n\n // Read each line into the ArrayList\n try {\n // Read the file\n String row;\n while ((row = reader.readLine()) != null) {\n restaurantData.add(row);\n }\n } catch (IOException ex) {\n Log.i(TAG, \"Error reading line\", ex);\n } finally {\n try {\n // Close the file\n reader.close();\n } catch (IOException ex) {\n Log.i(TAG, \"Error closing file\", ex);\n }\n }\n\n // Return data\n return restaurantData;\n }", "List<String[]> readCsv(String inputFilePath, char separator)throws IOException;", "public ArrayList<Employee> parseData(ArrayList<String> data) {\n ArrayList<Employee> employees = new ArrayList<>();\n String[] buf;\n\n for (String line : data) {\n buf = line.split(delimiter);\n employees.add(new Employee(buf[1], buf[0], Integer.parseInt(buf[2])));\n }\n\n return employees;\n }", "@Test\r\n public void readCsvFile() throws FileNotFoundException, IOException { \r\n CsvReader csvr = new CsvReader(CSV_FILE);\r\n \r\n List<NetworkElement> nes = csvr.getNetworkElements();\r\n assertEquals(55,nes.size()); \r\n }", "public List<Student> importStudent(String filename) throws FileNotFoundException {\n List<Student> students = new ArrayList<>();\n FileReader fileReader = new FileReader(DATA_PATH + filename);\n Scanner scanner = new Scanner(fileReader);\n //skip first line\n String firstLine = scanner.nextLine();\n Log.i(\"first line: \" + firstLine);\n\n while (scanner.hasNextLine()) {\n String[] s = scanner.nextLine().split(\",\");\n String fullName = s[0];\n int yearLevel = Integer.parseInt(s[1]);\n Student student = new Student(fullName, yearLevel);\n students.add(student);\n }\n\n scanner.close();\n return students;\n }", "public static List<Contract> readFromFile(String filename) {\n List<Contract> contracts = new ArrayList<>();\n\n InputStreamReader inputStreamReader = null;\n try {\n inputStreamReader = new InputStreamReader(new FileInputStream(new File(filename)),\"cp1251\");\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n String [] lines = null;\n String line = null;\n try{\n while ((line = bufferedReader.readLine()) != null) {\n\n lines= line.split(\",\");\n\n\n LocalDate conc = LocalDate.parse(lines[1], DateTimeFormatter.ofPattern(\"dd.MM.yyyy\"));\n LocalDate start = LocalDate.parse(lines[2], DateTimeFormatter.ofPattern(\"dd.MM.yyyy\"));\n LocalDate end = LocalDate.parse(lines[3], DateTimeFormatter.ofPattern(\"dd.MM.yyyy\"));\n\n Client client=new Client(ClientType.valueOf(lines[4]),lines[5],lines[6]);\n\n ArrayList<InsuredPerson>insuredPeople=new ArrayList<>();\n for(int i=7; i<lines.length; i+=4 ){\n LocalDate d=LocalDate.parse(lines[i+2],DateTimeFormatter.ofPattern(\"dd.MM.yyyy\"));\n InsuredPerson person = new InsuredPerson(Integer.valueOf(lines[i]),lines[i+1],d,Double.valueOf(lines[i+3]));\n insuredPeople.add(person);\n\n\n }\n Contract contract=new Contract(Integer.valueOf(lines[0]),conc,start,end,client,insuredPeople);\n contracts.add(contract);\n }\n bufferedReader.close();}\n catch (IOException e){\n System.out.println(e.getMessage());\n e.printStackTrace();\n }\n return contracts;\n\n }", "public void fillBoardFromCSV(String pathToCSV){\r\n \r\n BufferedReader br = null;\r\n String line = \" \";\r\n int index = 0;\r\n \r\n \r\n try{\r\n br = new BufferedReader(new FileReader(pathToCSV));\r\n while ((line = br.readLine()) != null) {\r\n String[] lines = line.split(\",\");\r\n System.out.println(lines.length);\r\n for(int i = 0; i < 11; i++){\r\n if(lines[i].equals(\"f\")){\r\n board[index][i] = new Flat(index,i);\r\n }\r\n if(lines[i].equals(\"s\")){\r\n board[index][i] = new Slot(index,i);\r\n }\r\n }\r\n index++; \r\n }\r\n } catch (FileNotFoundException e) {\r\n e.printStackTrace();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } finally {\r\n if (br != null) {\r\n try {\r\n br.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n }\r\n \r\n \r\n }", "public ArrayList<Invoice> readFromCsv() throws IOException {\n if (!FileIOHelper.exists(this.orderCsv)) return new ArrayList<>(); // Empty array list\n BufferedReader csvFile = FileIOHelper.getFileBufferedReader(this.orderCsv);\n List<String[]> csvLines = readAll(csvFile, 1);\n ArrayList<Invoice> items = new ArrayList<>();\n if (csvLines.size() == 0) return items;\n csvLines.forEach((str) -> items.add(new Invoice(str)));\n return items;\n }", "public void readInCategories() {\n // read CSV file for Categories\n allCategories = new ArrayList<Category>();\n InputStream inputStream = getResources().openRawResource(R.raw.categories);\n CSVFile csvFile = new CSVFile(inputStream);\n List scoreList = csvFile.read();\n // ignore first row because it is the title row\n for (int i = 1; i < scoreList.size(); i++) {\n String[] categoryInfo = (String[]) scoreList.get(i);\n\n // inputs to Category constructor:\n // String name, int smallPhotoID, int bannerPhotoID\n\n // get all image IDs according to the names\n int smallPhotoID = context.getResources().getIdentifier(categoryInfo[1], \"drawable\", context.getPackageName());\n int bannerPhotoID = context.getResources().getIdentifier(categoryInfo[2], \"drawable\", context.getPackageName());\n allCategories.add(new Category(categoryInfo[0],smallPhotoID, bannerPhotoID));\n\n //System.out.println(\"categoryInfo: \" + categoryInfo[0] + \" \" + categoryInfo[1] + \" \" + categoryInfo[2]);\n }\n }", "public List<LevelInformation> fromReader(Reader reader) {\n BufferedReader br = null;\n ArrayList<ArrayList<String>> listOfLevels =\n new ArrayList<ArrayList<String>>();\n try {\n br = new BufferedReader(reader);\n String line;\n line = br.readLine();\n while (line != null) {\n List<String> level = new ArrayList<String>();\n level.add(line);\n while (!line.equals(\"END_LEVEL\")) {\n line = br.readLine();\n level.add(line);\n }\n listOfLevels.add(new ArrayList<String>(level));\n line = br.readLine();\n }\n } catch (IOException e) {\n System.err.println(\"Failed read from reader: reader \"\n + \", message:\" + e.getMessage());\n e.printStackTrace(System.err);\n } finally {\n try {\n if (br != null) {\n br.close();\n }\n } catch (IOException e) {\n System.err.println(\"Failed closing buffer: br\");\n }\n }\n List<LevelInformation> levelsList = new ArrayList<LevelInformation>();\n for (int i = 0; i < listOfLevels.size(); i++) {\n ParseLevelSpecification parseLevelSpecification =\n new ParseLevelSpecification();\n parseLevelSpecification.collectInformaOfLevel(listOfLevels.get(i));\n boolean checkFlag = LevelSpecificationReader\n .islevelsFileValid(parseLevelSpecification);\n if (checkFlag) {\n throw new RuntimeException(\"level definitions file is invalid\");\n }\n CreateLevel newLevel = new CreateLevel(parseLevelSpecification);\n levelsList.add(newLevel);\n }\n return levelsList;\n }", "public void readReports (BufferedReader reader) {\n try {\n // Each line of CSV will be stored in this String\n String line = \"\";\n reader.readLine();\n while ((line = reader.readLine()) != null) {\n // line will be split by \",\", into an array of String\n String[] eachDetailOfReportLine = line.split(\",(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\n\n if (eachDetailOfReportLine.length == 0) {\n continue;\n }\n\n // removing unnecessary quotation marks\n for (int i = 0; i < eachDetailOfReportLine.length; i++) {\n eachDetailOfReportLine[i] = eachDetailOfReportLine[i].replaceAll(\"\\\"\", \"\");\n }\n\n\n // finds restaurant using tracking code from restaurants' list\n Restaurant restaurant = null;\n for (Restaurant R : restaurants) {\n if (R.getTrackingNumber().equals(eachDetailOfReportLine[0])) {\n restaurant = R;\n break;\n }\n }\n\n if (restaurant == null) {\n continue;\n }\n\n// Log.e(\"checking..............\", restaurant.getName());\n\n // setting other values\n Integer day = Integer.parseInt(eachDetailOfReportLine[1]);\n Report reportToAdd = new Report(day, eachDetailOfReportLine[2]);\n\n String thatDay = day.toString();\n Date thatDayCalendar = new SimpleDateFormat(\"yyyyMMdd\").parse(thatDay);\n if (oldUpdateTime > 0) {\n if (thatDayCalendar.getTime() > oldUpdateTime) {\n restaurant.setHasUpdate(true);\n }\n }\n\n\n Integer numCriticalIssues = Integer.parseInt(eachDetailOfReportLine[3]);\n reportToAdd.setCritIssues(numCriticalIssues);\n\n Integer numNonCriticalIssues = Integer.parseInt(eachDetailOfReportLine[4]);\n reportToAdd.setNonCritIssues(numNonCriticalIssues);\n\n try {\n long daysSinceOccurrence = reportToAdd.getDaysSinceOccurrence();\n if (daysSinceOccurrence <= 365) {\n restaurant.addTotalCritViolations(numCriticalIssues);\n }\n } catch (ParseException e) {\n// e.printStackTrace();\n }\n\n // if there is any violation, then make a list of them\n // using processViolations method.\n // and set the list as restaurant's violation list\n if (eachDetailOfReportLine.length > 5) {\n\n List<Violation> violationsOfOneInspection =\n processViolations(eachDetailOfReportLine[5]);\n reportToAdd.setViolations(violationsOfOneInspection);\n } else {\n List<Violation> violationsOfOneInspection =\n processViolations(\"\");\n reportToAdd.setViolations(violationsOfOneInspection);\n }\n if (eachDetailOfReportLine.length > 6) {\n reportToAdd.setHazardLevel(eachDetailOfReportLine[6]);\n } else {\n reportToAdd.setHazardLevel(\"Low\");\n }\n\n restaurant.addReport(reportToAdd);\n }\n } catch (IOException e) {\n// e.printStackTrace();\n } catch (ParseException e) {\n// e.printStackTrace();\n }\n\n // sort alphabetically, using overridden compareTo\n for (int i = 0; i < restaurants.size(); i++) {\n Collections.sort(restaurants.get(i).getReportsList());\n }\n }", "public ArrayList<User> readUsers()\n {\n String dataLines[]; /* Data read from line */\n boolean bNotNull = true; /* Indicate line null error */\n int count = 0; /* No. of user */\n ArrayList<User> userList = new ArrayList<User>();\n \n /* Open file. If cannot open, return null; */\n TextFileReader reader = new TextFileReader(userFileName);\n if (reader.open() == false)\n return null;\n \n /* Read number of data */\n String line;\n line = reader.readLine();\n try\n {\n count = Integer.parseInt(line);\n }\n catch (Exception e)\n {\n return null;\n }\n \n /* Loop get user and add user to list */\n int numTag = tagUser.length;\n for (int i = 0; i < count && bNotNull; i++)\n {\n dataLines = new String[numTag];\n /* Loop read follow number of tag */\n for (int j = 0; j < numTag && bNotNull; j++)\n {\n dataLines[j] = reader.readLine();\n if (dataLines[j] == null)\n bNotNull = false;\n }\n User user = parseUser(dataLines);\n if (user != null) /* If data is correct, add to user list */\n userList.add(user);\n }\n reader.close();\n return userList;\n }", "public static List<String> extractData_CSV(String csvFile, String rowID) throws Exception {\n List<String> rows = new ArrayList<>();\n\n BufferedReader reader = new BufferedReader(new FileReader(csvFile));\n String line = \"\";\n\n while ( (line = reader.readLine()) != null) {\n if (line.startsWith(rowID)){\n rows.add(line);\n }\n }\n reader.close();\n return rows;\n }", "public static ArrayList<Student> loadListOfStudents(String fileName) {\n ArrayList<Student> students = new ArrayList<>();\r\n String str = TextReader.StringFromFile(fileName);//Uses the method that returns a complete string with newlines for each studentline.\r\n if (validateInput(str)) {//Uses the validation method to check that the input is valid.\r\n String[] lines = str.split(\"\\n\");\r\n String[] lineParameters;\r\n int countFor = 0;\r\n for (String line : lines) {\r\n if(countFor > 1){\r\n lineParameters = line.split(\",\");\r\n Vote vote = new Vote(new Subject(lineParameters[1]), new Subject(lineParameters[2]), new Subject(lineParameters[3]), new Subject(lineParameters[4]));\r\n Student newStudent = new Student(lineParameters[0], vote);\r\n students.add(newStudent);\r\n }\r\n countFor++;\r\n }\r\n }\r\n\r\n return students;\r\n }", "private void testDataReader() {\n File csv = new File(pathTest);\n try (FileReader fr = new FileReader(csv); BufferedReader bfr = new BufferedReader(fr)) {\n Logger.printInfo(\"Reading test data\");\n for (String line; (line = bfr.readLine()) != null; ) {\n String[] split = line.split(\",\");\n String data = textCleaner(split[indexData].toLowerCase());\n int label = Integer.parseInt(split[indexLabel].toLowerCase());\n\n linesTest.add(data);\n labelsTest.add(label);\n Logger.print(\"Reading size: \" + linesTest.size());\n }\n for (String l : linesTest) {\n matrixTest.add(wordVectorizer(l));\n }\n } catch (IOException ex) {\n Logger.printError(\"!! Test Data Not Reading !!\");\n System.exit(0);\n }\n }", "public List<Utilisateur> generateData() throws FileNotFoundException, IOException {\n Reader reader = new FileReader(\"F:\\\\Bibliothèques\\\\Documents\\\\MIAGE M1\\\\WEB\\\\TPWeb\\\\src\\\\main\\\\webapp\\\\data.csv\");\n\n CSVReader<Utilisateur> csvPersonReader = new CSVReaderBuilder<Utilisateur>(reader).entryParser(new UtilisateurEntryParser()).build();\n\n List<Utilisateur> persons = csvPersonReader.readAll();\n\n return persons;\n\n }", "public void readData(InputStream is) {\n BufferedReader reader = new BufferedReader(new InputStreamReader(is));\r\n\r\n String line = \"\";\r\n try {\r\n while ((line = reader.readLine()) != null) {\r\n //Split line by \",\"\r\n String[] fields = line.split(\",\");\r\n //Log.d(\"csvParseFieldLength\", String.valueOf(fields.length));\r\n ArrayList<Race> races = new ArrayList<>();\r\n if (fields[9].equals(\"\"))\r\n break;\r\n else {\r\n Swimmer s = new Swimmer(fields[0],fields[10], fields[9], Integer.parseInt(fields[8]), fields[7], races);\r\n swimmers.add(s);\r\n s.addRace(new Race(Integer.parseInt(fields[2]), Integer.parseInt(fields[3]), 0, null, (fields[4] + \" \" + fields[5])));\r\n \r\n EventID e = new EventID(eventId);\r\n String b = fields[12];\r\n \r\n \r\n if (!b.equals(\" \")) \r\n \te.addNames(b);\r\n \r\n \r\n \r\n }\r\n }\r\n } catch (IOException ex) {\r\n //Log.d(\"csvParseSwim\", \"Error reading data from file on line \" + line);\r\n }\r\n }", "@Override\n public List<TimetableUpload> parseCsvFile(MultipartFile file) {\n try (Reader reader = new BufferedReader(new InputStreamReader(file.getInputStream()))) {\n // create csv bean reader\n CsvToBean<TimetableUpload> csvToBean = new CsvToBeanBuilder(reader)\n .withType(TimetableUpload.class)\n .withIgnoreLeadingWhiteSpace(true)\n .build();\n return csvToBean.parse();\n } catch (IOException e) {\n System.err.println(\"Something went wrong while parsing the csv file\");\n return null;\n }\n }", "public static <T> List<T> readWithCsvBeanReader(String csvFileName, Class<T> type, CellProcessor[] processors)\n\t\t\tthrows FileNotFoundException, IOException {\n\n\t\tICsvBeanReader beanReader = null;\n\t\tList<T> list = new ArrayList<>();\n\t\ttry {\n\t\t\tbeanReader = new CsvBeanReader(new FileReader(csvFileName), CsvPreference.STANDARD_PREFERENCE);\n\t\t\tfinal String[] header = beanReader.getHeader(true);\n\t\t\tT outputContainer;\n\t\t\twhile ((outputContainer = (T) beanReader.read(type, header, processors)) != null) {\n\t\t\t\tlist.add(outputContainer);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (beanReader != null) {\n\t\t\t\tbeanReader.close();\n\t\t\t}\n\t\t}\n\t\treturn list;\n\t}", "private static List<StudentRecord> convert(List<String> lines) {\n\t\tObjects.requireNonNull(lines);\n\t\t\n\t\tArrayList<StudentRecord> result = new ArrayList<>(lines.size());\n\t\t\n\t\tfor(String data : lines) {\n\t\t\tif(data.length() == 0) continue; //preskoci prazne linije\n\t\t\tScanner sc = new Scanner(data);\n\t\t\tsc.useDelimiter(\"\\t\");\n\t\t\t\n\t\t\ttry {\n\t\t\t\tresult.add(new StudentRecord(sc.next(), sc.next(), sc.next(), sc.next(), sc.next(), sc.next(), sc.next()));\n\t\t\t}catch(NoSuchElementException e) {\n\t\t\t\tsc.close();\n\t\t\t\tthrow new NoSuchElementException(\"Data not formatted correctly.\");\n\t\t\t}\n\t\t\tsc.close();\n\t\t}\n\t\t\n\t\treturn result;\n\t}", "private void readNodes() throws FileNotFoundException{\n\t\tScanner sc = new Scanner(new File(\"Resources\\\\ListOfNodes.csv\"));\n\t\tsc.nextLine(); //Skip first line of headers\n\t\twhile(sc.hasNext()) { \n\t\t\tCSVdata = sc.nextLine().split(\",\"); // Add contents of each row to String[]\n\t\t\tnodes.add(new GraphNode<String>(CSVdata[0], CSVdata[1])); // Add new node to object list\n\t\t}\n\t\tsc.close();\n\t}", "public List<Event> fillArrayList()\r\n {\r\n List<Event> list1=new ArrayList<>();\r\n FileReader fr=null;\r\n \r\n try{\r\n \r\n fr=new FileReader(\"./event.txt\");\r\n BufferedReader bf=new BufferedReader(fr);\r\n String s;\r\n \r\n while((s=bf.readLine())!=null)\r\n {\r\n Event event=new Event();\r\n String s1[]=new String[7];\r\n for(int i=0;i<s1.length;i++)\r\n {\r\n s1=s.split(\",\");\r\n \r\n event.setId(Integer.parseInt(s1[0]));\r\n \r\n event.setName(s1[1]);\r\n \r\n event.setOrganizer(s1[2]);\r\n \r\n Date date=Date.valueOf(s1[3]);\r\n \r\n event.setDate(date);\r\n \r\n event.setFees(Double.parseDouble(s1[4]));\r\n \r\n } \r\n list1.add(event);\r\n }\r\n \r\n bf.close();\r\n \r\n }catch(Exception e){e.printStackTrace();}\r\n return list1;\r\n\r\n }", "@Override\n\tpublic List<double[]> read(String fileName) {\n\t\tlogger.info(\"Loading data from \" + fileName);\n\t\tList<double[]> records = new ArrayList<double[]>();\n\t\tCsvReader csvReader = null;\n\t\ttry{\n\t\t\tcsvReader = new CsvReader(fileName);\n\t\t\t\n\t\t\t\n\t\t\twhile(csvReader.readRecord()){\n\t\t\t\tint cols = csvReader.getColumnCount();\n\t\t\t\tdouble[] record = new double[cols];\n\t\t\t\tfor(int i=0; i< cols; i++){\n\t\t\t\t\trecord[i] = Double.parseDouble(csvReader.get(i));\n\t\t\t\t}\n\t\t\t\trecords.add(record);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\tthrow new LoadDataException(e);\n\t\t}finally{\n\t\t\tif(csvReader != null){\n\t\t\t\tcsvReader.close();\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn records;\n\t}", "public List<Grade> importGrade(String filename) throws FileNotFoundException {\n List<Grade> grades = new ArrayList<>();\n FileReader fileReader = new FileReader(DATA_PATH + filename);\n Scanner scanner = new Scanner(fileReader);\n //skip first line\n String firstLine = scanner.nextLine();\n Log.i(\"first line: \" + firstLine);\n\n while (scanner.hasNextLine()) {\n String[] s = scanner.nextLine().split(\",\");\n String degree = s[0];\n String knowledge = s[1];\n String skill = s[2];\n Grade grade = new Grade(degree, knowledge, skill);\n grades.add(grade);\n }\n\n scanner.close();\n return grades;\n }", "public static List<CoffeeShop> readCSVFile(String filePath) {\n\t\tList<CoffeeShop> coffeeShopList = new ArrayList<>();\n\t\tString fileContent = readFile(filePath);\n\t\ttry{\n\t\t\tString[] coffeeStrings = fileContent.split(LINE_SEPARATOR);\n\t\t\tfor(String coffeeString : coffeeStrings){\n\t\t\t\tString[] shopValues = coffeeString.split(FILE_SEPARATOR);\n\t\t\t\tcoffeeShopList.add(new CoffeeShop(shopValues[0], Double.parseDouble(shopValues[1]), Double.parseDouble(shopValues[2])));\n\t\t\t}\n\t\t}catch(Exception e){\n\t\t\tSystem.out.println(\"Cannot read CSV file as it is Malformed \" +e.getMessage());\n\t\t}\n\t\t\n\t\treturn coffeeShopList;\n\t}", "public static ArrayList<String> CSVtoArrayList(String Line) {\n\t\tArrayList<String> Result = new ArrayList<String>();\n\t\t\n\t\tif (Line != null) \n {\n\t\t\tString[] splitData = Line.split(\"\\\\s*,\\\\s*\");\n\t\t\tfor (int i = 0; i < splitData.length; i++) \n {\n\t\t\t\tif (!(splitData[i] == null) || !(splitData[i].length() == 0)) {\n\t\t\t\t\tResult.add(splitData[i].trim());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn Result;\n\t}", "@Override\n\tpublic void executeParser() {\n\t\tString filepath = (!filePath.isEmpty() && !filePath.equals(null)) ? filePath : \"faculty.csv\";\n\n\t\tList<String> linesFromFile = loadLinesFromFile(filepath);\n\t\t// Convert the list to an Array of Strings.\n\t\tString[] lines = linesFromFile.toArray(new String[0]);\n\t\tList<AuthorAffiliation> authorAffiliationList = new ArrayList<AuthorAffiliation>();\n\n\t\tfor (int i = 1; i < lines.length; i++) {\n\t\t\tString[] nameAffiliation = lines[i].split(\",\");\n\n\t\t\tif (nameAffiliation.length == 2) {\n\t\t\t\tAuthorAffiliation authorAffiliation = new AuthorAffiliation();\n\t\t\t\tauthorAffiliation.setName(nameAffiliation[0]);\n\t\t\t\tauthorAffiliation.setAffiliation(nameAffiliation[1]);\n\t\t\t\tauthorAffiliationList.add(authorAffiliation);\n\t\t\t}\n\t\t}\n\n\t\tHandleFacultyAffiliation facultyAffiliation;\n\t\ttry {\n\t\t\tfacultyAffiliation = new HandleFacultyAffiliation();\n\t\t\tfacultyAffiliation.insertRecords(authorAffiliationList);\n\t\t} catch (SQLException e) {\n\t\t\tSystem.out.println(\"Error while processing faculty affilications.\");\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "@Override\n public void importCSV(File file) {\n System.out.println(\"oi\");\n System.out.println(file.isFile()+\" \"+file.getAbsolutePath());\n if(file.isFile() && file.getPath().toLowerCase().contains(\".csv\")){\n System.out.println(\"Entro\");\n try {\n final Reader reader = new FileReader(file);\n final BufferedReader bufferReader = new BufferedReader(reader);\n String[] cabecalho = bufferReader.readLine().split(\",\");\n int tipo;\n if(cabecalho.length == 3){\n if(cabecalho[2].equalsIgnoreCase(\"SIGLA\")){\n tipo = 1;\n System.out.println(\"TIPO PAIS\");\n }\n else {\n tipo = 2;\n System.out.println(\"TIPO CIDADE\");\n }\n }else {\n tipo = 3;\n System.out.println(\"TIPO ESTADO\");\n }\n \n while(true){\n String linha = bufferReader.readLine();\n if(linha == null){\n break;\n }\n String[] row = linha.split(\",\");\n switch (tipo) {\n case 1:\n Pais pais = new Pais();\n pais.setId(Long.parseLong(row[0]));\n pais.setNome(row[1]);\n pais.setSigla(row[2]);\n new PaisDaoImpl().insert(pais);\n break;\n case 2:\n Cidade cidade = new Cidade();\n cidade.setId(Long.parseLong(row[0]));\n cidade.setNome(row[1]);\n cidade.setEstado(Long.parseLong(row[2]));\n new CidadeDaoImpl().insert(cidade);\n break;\n default:\n Estado estado = new Estado();\n estado.setId(Long.parseLong(row[0]));\n estado.setNome(row[1]);\n estado.setUf(row[2]);\n estado.setPais(Long.parseLong(row[3]));\n new EstadoDaoImpl().insert(estado);\n break;\n }\n }\n \n } catch (FileNotFoundException ex) {\n Logger.getLogger(SQLUtilsImpl.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(SQLUtilsImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }", "@Override\n DBO consume(String csv) throws TransformerException;", "public static void loadcars() {\n Cars xx = new Cars();\n System.out.println(\"Load cars\");\n listcars.clear();\n try {\n File fileload = new File(\"cars.csv\");\n BufferedReader in = new BufferedReader(new FileReader(fileload));\n String st;\n while((st = in.readLine()) != null) {\n String[] strs = st.split(\"[,//;]\");\n addcar(strs[0], strs[1], strs[2],Integer.parseInt(strs[3]));\n }\n in.close();\n System.out.println(\"cars data restored from cars.csv\");\n } catch (IOException i) {\n i.printStackTrace();\n }\n\n\n }", "@Test\n\tpublic void testReadCsvFile() throws FileNotFoundException {\n\t\tFileParser fp = new FileParser();\n\t\tArrayList<String> parsedLines = fp.readCsvFile(\"movies.csv\");\n\t\tassertEquals(\"toy story\", parsedLines.get(0));\n\t}", "public static void readRecord(Calendar cal) {\n\n boolean firstLine = true;\n boolean found = false;\n String ActivityName = \" \";\n Role r;\n String Month = \" \";\n\n int Year = 0;\n\n try {\n\n Scanner x = new Scanner(new File(\"P5Calendar.csv\"));\n\n while (x.hasNext() && !found) {\n\n String[] line = x.nextLine().split(\",\");\n\n if (firstLine) {\n firstLine = false;\n continue;\n }\n\n Year = Integer.parseInt(line[0]);\n Month = line[1];\n ActivityName = line[2];\n\n r = new Role(line[3].replaceAll(\"\\\\(.*\\\\)\", \"\"),\n line[3].substring(line[3].indexOf(\"(\") + 1, line[3].indexOf(\")\")));\n\n Activity act = new Activity(Year, Month, ActivityName, r);\n\n cal.addActivity(act);\n\n }\n\n x.close();\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "private ArrayList<Entrant> getEntrants(File path,ArrayList<Course> courses)\n {\n Start.log(\"Getting Entrants\");\n ArrayList<Entrant> tempEntrants = new ArrayList<Entrant>();\n ArrayList<String> file = getFile(path);\n for (int i = 0; i < file.size();i++)\n {\n //scan and pharse the data into th relivant feilds\n Scanner scan = new Scanner(file.get(i));\n int entrantNo = scan.nextInt();\n char course = scan.next().charAt(0);\n String name = scan.next() + \" \" + scan.next();\n Course tcourse = null;\n //find the correct course for the entrant and add it in \n for (int j = 0;j < courses.size();j++)\n {\n if (courses.get(j).getIdent() == course)\n {\n tcourse = courses.get(j);\n break; \n }\n } \n tempEntrants.add(new Entrant(entrantNo,tcourse,name));\n }\n \n return tempEntrants;\n }", "public <T> List<T> readCsvFile(String filePath, Class<T> classType) {\n\t\tString className = classType.getSimpleName();\n\t\tList<T> csvFileEntries = new ArrayList<T>();\n\n\t\tString line = \"\";\n\t\tint index = 0;\n\t\tBufferedReader fileScanner;\n\n\t\ttry {\n\t\t\tfileScanner = new BufferedReader(new FileReader(filePath));\n\n\t\t\twhile ((line = fileScanner.readLine()) != null) {\n\t\t\t\tif (index != 0) {\n\t\t\t\t\tString[] currentEntry = line.split(\",\");\n\n\t\t\t\t\tif (className.equals(\"Agent\")) {\n\t\t\t\t\t\tAgent newAgent = new Agent(currentEntry);\n\t\t\t\t\t\tcsvFileEntries.add((T) newAgent);\n\t\t\t\t\t} else if (className.equals(\"Claim\")) {\n\t\t\t\t\t\tClaim newClaim = new Claim(currentEntry);\n\t\t\t\t\t\tcsvFileEntries.add((T) newClaim);\n\t\t\t\t\t} else if (className.equals(\"Customer\")) {\n\t\t\t\t\t\tCustomer newCustomer = new Customer(currentEntry);\n\t\t\t\t\t\tcsvFileEntries.add((T) newCustomer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tindex += 1;\n\t\t\t}\n\n\t\t\tfileScanner.close();\n\t\t} catch (IOException error) {\n\t\t\terror.printStackTrace();\n\t\t} catch (SecurityException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\treturn csvFileEntries;\n\t}", "public void setReaderToArray(){\n try{\n String client, number = null;\n\n File reader = new File(\"clientFile/clientInfo.txt\");\n\n Scanner scn = new Scanner(reader);\n scn.useDelimiter(\",\");\n\n while(scn.hasNext()){\n number = scn.next();\n client = scn.next();\n\n clientList.add(client + \" - \" + number);\n }\n scn.close();\n }catch (FileNotFoundException exception){\n System.out.println(\"An error occurred.\");\n }\n }" ]
[ "0.6655667", "0.6651281", "0.65776753", "0.65264034", "0.6221155", "0.618167", "0.61750364", "0.6161453", "0.6104785", "0.6097387", "0.6085629", "0.6066541", "0.6064003", "0.6055827", "0.6042803", "0.6025385", "0.59851867", "0.59638435", "0.59161204", "0.5915106", "0.5880768", "0.58603454", "0.5832742", "0.58159465", "0.5815736", "0.58011526", "0.57972026", "0.57950926", "0.57743174", "0.57612276", "0.5758033", "0.57473004", "0.57431924", "0.57180995", "0.5711379", "0.5708255", "0.57060516", "0.57021827", "0.568385", "0.5683658", "0.5680287", "0.5672764", "0.56591624", "0.56544495", "0.5630866", "0.56298953", "0.5625776", "0.5615563", "0.56129986", "0.5610292", "0.5608715", "0.5608224", "0.56071305", "0.55982435", "0.5587174", "0.5576438", "0.5571885", "0.55636513", "0.5541072", "0.55358964", "0.5535369", "0.55335695", "0.5531526", "0.5529897", "0.5522584", "0.55213517", "0.55117834", "0.55103844", "0.5492586", "0.5487995", "0.54693687", "0.54654795", "0.546282", "0.54627395", "0.546051", "0.5459586", "0.5452462", "0.5452461", "0.5445935", "0.54449505", "0.5433598", "0.5432573", "0.5432496", "0.5428437", "0.54242235", "0.54170096", "0.5415692", "0.5411204", "0.5403827", "0.5390607", "0.53895944", "0.53867763", "0.5385317", "0.53835785", "0.5383476", "0.53770286", "0.5372418", "0.53716904", "0.5359668", "0.5349965" ]
0.6874808
0
test the preflight is working
@Test public void testPreflight() throws Exception { final HttpResponse response = Request.Options("http://localhost:" + httpPort.getValue() + CORS_CONFIGURED_ENDPOINT_PATH) .addHeader("Origin", CORS_TEST_ORIGIN) .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_METHOD, "GET") .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_HEADERS, "X-Allow-Origin") .execute().returnResponse(); Header allowOrigin = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN); Header allowMethods = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_METHODS); assertNotNull(allowOrigin); assertNotNull(allowMethods); assertThat(allowOrigin.getValue(), equalTo(CORS_TEST_ORIGIN)); assertThat(allowMethods.getValue(), containsString("GET")); assertThat(allowMethods.getValue(), containsString("PUT")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n void preFlightTestFromAllowedOrigin() {\n ResponseSpec response = client.options()\n .uri(BASE_GUESTBOOK_URL)\n .header(\"Access-Control-Request-Method\", \"GET\")\n .header(\"Origin\", \"http://allowed-origin.ca\")\n .exchange();\n\n response.expectHeader().valueEquals(\"Access-Control-Allow-Methods\", \"GET,POST\")\n .expectHeader().valueEquals(\"Access-Control-Allow-Origin\", \"http://allowed-origin.ca\");\n }", "private boolean isPreflight(HttpServletRequest request) {\n return request.getMethod().equals(\"OPTIONS\");\n }", "@Test\n public void testDefaultOriginMethodNotAllowed() throws Exception {\n final HttpResponse response = Request.Post(\"http://localhost:\" + httpPort.getValue() + CORS_DEFAULT_ENDPOINT_PATH).addHeader(\"Origin\", CORS_DEFAULT_ORIGIN).execute().returnResponse();\n\n //a well behaved client should have sent a preflight\n //but we don't want to be well behaved\n assertNull(\"Allowed origin should NOT be present\", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN));\n\n //the payload should NOT be the expected response\n assertThat(IOUtils.toString(response.getEntity().getContent()), not(equalTo(EXPECTED_RETURN)));\n\n }", "@Test(groups = { TestGroup.REST_API, TestGroup.SANITY, TestGroup.CORE})\n\tpublic void assertCORSisEnabledAndWorking()\n\t{\n\t\tString validOriginUrl = \"http://localhost:4200\";\n\t\tString invalidOriginUrl1 = \"http://localhost:4201\";\n\t\tString invalidOriginUrl2 = \"http://example.com\";\n\t\tRestAssured.basePath = \"alfresco/api/-default-/public/authentication/versions/1\";\n\t\trestClient.configureRequestSpec().setBasePath(RestAssured.basePath);\n\n\t\tRestRequest request = RestRequest.simpleRequest(HttpMethod.OPTIONS, \"tickets\");\n\n\t\t// Don't specify header Access-Control-Request-Method\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);\n\n\t\t// request not allowed method\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"PATCH\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);\n\n\t\t// request invalid method\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"invalid\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);\n\n\t\t// use invalidOriginUrl1 as origin\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"POST\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", invalidOriginUrl1);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);\n\n\t\t// use invalidOriginUrl2 as origin\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", invalidOriginUrl2);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);\n\n\t\t// use validOriginUrl\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"POST\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\t\trestClient.process(request);\n\n\t\trestClient.assertStatusCodeIs(HttpStatus.OK);\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Origin\", validOriginUrl);\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Credentials\", \"true\");\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Max-Age\", \"10\");\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Methods\", \"POST\");\n\t}", "@Test\n public void testBasicAuthAccountSuccess() {\n HttpAuthenticationFeature feature = \n HttpAuthenticationFeature.basic(\"admin\", \"admin\");\n Client client = ClientBuilder.newClient();\n URI uri = UriBuilder\n .fromUri(APPLICATION_NAME + APPLICATION_API_VERSION)\n .scheme(\"http\")\n .host(\"localhost\")\n .port(8080)\n .build();\n WebTarget webTarget = client\n .register(feature)\n .target(uri)\n .path(\"account\");\n Response response = webTarget\n .request(APPLICATION_JSON)\n .get();\n assertThat(response.getStatus(), is(200));\n }", "@Test\n public void testDefaultOriginMethod() throws Exception {\n final HttpResponse response = Request.Get(\"http://localhost:\" + httpPort.getValue() + CORS_DEFAULT_ENDPOINT_PATH).addHeader(\"Origin\", CORS_DEFAULT_ORIGIN).execute().returnResponse();\n\n assertNotNull(\"Response should not be null\", response);\n\n //we should have an access control allow origin\n assertNotNull(\"Allowed origin should be present\", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN));\n assertThat(IOUtils.toString(response.getEntity().getContent()), equalTo(EXPECTED_RETURN));\n\n }", "@Test\n public void testPublicResource() throws Exception {\n final HttpResponse response = Request.Post(\"http://localhost:\" + httpPort.getValue() + CORS_PUBLIC_ENDPOINT_PATH).addHeader(\"Origin\", \"null\").execute().returnResponse();\n\n assertNotNull(\"Response should not be null\", response);\n\n //allow origin should be *\n Header allowOrigin = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN);\n\n assertNotNull(allowOrigin);\n assertThat(allowOrigin.getValue(), equalTo(\"*\"));\n\n assertThat(IOUtils.toString(response.getEntity().getContent()), equalTo(EXPECTED_RETURN));\n }", "@Test\n public void testBasicAuthAccountFail() {\n HttpAuthenticationFeature feature = \n HttpAuthenticationFeature.basic(\"NOTadmin\", \"admin\");\n Client client = ClientBuilder.newClient();\n URI uri = UriBuilder\n .fromUri(APPLICATION_NAME + APPLICATION_API_VERSION)\n .scheme(\"http\")\n .host(\"localhost\")\n .port(8080)\n .build();\n WebTarget webTarget = client\n .register(feature)\n .target(uri)\n .path(\"account\");\n Response response = webTarget\n .request(APPLICATION_JSON)\n .get();\n assertThat(response.getStatus(), is(401));\n }", "@Test\n public void testBasicAuthUserSuccess() {\n HttpAuthenticationFeature feature = \n HttpAuthenticationFeature.basic(\"admin\", \"admin\");\n Client client = ClientBuilder.newClient();\n URI uri = UriBuilder\n .fromUri(APPLICATION_NAME + APPLICATION_API_VERSION)\n .scheme(\"http\")\n .host(\"localhost\")\n .port(8080)\n .build();\n WebTarget webTarget = client\n .register(feature)\n .target(uri)\n .path(\"user\");\n Response response = webTarget\n .request(APPLICATION_JSON)\n .get();\n assertThat(response.getStatus(), is(200));\n }", "@Test\n public void testTokenEndPointNoParams() throws Exception {\n refreshRequestAndResponse();\n request.setRequestURI(\"/v2/token\");\n request.setMethod(\"POST\");\n handlerAdapter.handle(request, response, controller);\n logger.info(\"testTokenEndPointNoParams() => \" + response.getContentAsString());\n \n assertTrue(response.getContentAsString().contains(ERR_RESPONSE));\n assertTrue( response.getStatus() == HttpServletResponse.SC_BAD_REQUEST ||\n response.getStatus() == HttpServletResponse.SC_UNAUTHORIZED );\n }", "@Test\n public void testEmptyConfigPublicResource() throws Exception {\n final HttpResponse response = Request.Options(\"http://localhost:\" + httpPort.getValue() + CORS_PUBLIC_EMPTY_ENDPOINT_PATH).addHeader(\"Origin\", CORS_TEST_ORIGIN)\n .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_METHOD, \"GET\").execute().returnResponse();\n\n Header allowOrigin = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN);\n Header allowMethods = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_METHODS);\n\n assertNotNull(allowOrigin);\n assertThat(allowOrigin.getValue(), equalTo(\"*\"));\n }", "@Test(groups = { TestGroup.REST_API, TestGroup.SANITY, TestGroup.CORE})\n\tpublic void assertCORSisEnabledAndWorkingForDiscovery()\n\t{\n\t\tString validOriginUrl = \"http://localhost:4200\";\n\t\tRestAssured.basePath = \"alfresco/api\";\n\t\trestClient.configureRequestSpec().setBasePath(RestAssured.basePath);\n\n\t\tRestRequest request = RestRequest.simpleRequest(HttpMethod.GET, \"discovery\");\n\n\t\t// use validOriginUrl\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"GET\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\n\t\tUserModel userModel = dataUser.createRandomTestUser();\n\t\trestClient.authenticateUser(userModel).process(request);\n\n\t\trestClient.assertStatusCodeIs(HttpStatus.OK);\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Origin\", validOriginUrl);\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Credentials\", \"true\");\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Expose-Headers\", \"Access-Control-Allow-Origin,Access-Control-Allow-Credentials\");\n\t}", "@Test\n public void testAllAccountsGET() {\n HttpAuthenticationFeature feature = \n HttpAuthenticationFeature.basic(\"admin\", \"admin\");\n Client client = ClientBuilder.newClient();\n URI uri = UriBuilder\n .fromUri(APPLICATION_NAME + APPLICATION_API_VERSION)\n .scheme(\"http\")\n .host(\"localhost\")\n .port(8080)\n .build();\n WebTarget webTarget = client\n .register(feature)\n .target(uri)\n .path(\"account\");\n Response response = webTarget\n .request(APPLICATION_JSON)\n .get();\n assertThat(response.getStatus(), is(200));\n }", "@Test\n public void f() {\n\t \n\t RestAssured.baseURI = \"http://restapi.demoqa.com/authentication/CheckForAuthentication\";\n\t PreemptiveBasicAuthScheme authScheme = new PreemptiveBasicAuthScheme();\n\t authScheme.setUserName(\"ToolsQA\");\n\t authScheme.setPassword(\"TestPassword\");\n\t RestAssured.authentication = authScheme;\n\t \n\t RequestSpecification request = RestAssured.given();\n\t \n\t Response response = request.get();\n\t System.out.println(\"Status code: \" + response.getStatusCode());\n\t System.out.println(\"Status message \" + response.body().asString());\n\t \n\t //System.out.println(\"Hai\");\n\t \n }", "@Test\n public void getEndpoint() throws IOException {\n CloseableHttpClient httpclient = HttpClients.createDefault();\n\n //Creating a HttpGet object\n HttpPost httppost = new HttpPost(\"https://api.github.com/user/repos\");\n String auth=Credentials.getEmail()+\":\"+Credentials.getPassWard();\n byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName(\"ISO-8859-1\")));\n String authHeader=\"Basic \"+new String(encodedAuth);\n httppost.setHeader(HttpHeaders.AUTHORIZATION,authHeader);\n String json=\"{\\\"name\\\": \\\"ploiko\\\"}\";\n httppost.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));\n HttpResponse httpresponse = httpclient.execute(httppost);\n System.out.println(httpresponse.getStatusLine());\n int actual=httpresponse.getStatusLine().getStatusCode();\n Assert.assertEquals(actual,201);\n //System.out.println(getHeaders(httpresponse,\"Access-Control-Allow-Methods\"));\n //System.out.println(httpresponse.getAllHeaders().toString());\n\n }", "@Test(priority = 10)\n\tpublic void testGetAllClients2() {\n\t\tResponse response = given().header(\"Authorization\", \"Bad Token\").when().get(URL).then().extract().response();\n\n\t\tassertTrue(response.statusCode() == 401);\n\t\tassertTrue(response.asString().contains(\"Unauthorized\"));\n\n\t\tgiven().header(\"Authorization\", token).when().get(URL + \"/notAURL\").then().assertThat().statusCode(404);\n\n\t\tgiven().header(\"Authorization\", token).when().post(URL).then().assertThat().statusCode(405);\n\t}", "@Test\n void getTest() {\n URI uri = URI.create(endBody + \"/get\");\n\n // get the response\n HttpResponse<String> response = HttpMethods.get(uri);\n\n // check if it received OK\n assertEquals(200, response.statusCode());\n }", "@Test\n void corsTestFromAllowedOrigin() {\n ResponseSpec response = client.get()\n .uri(BASE_GUESTBOOK_URL)\n .header(\"Origin\", \"http://allowed-origin.ca\")\n .exchange();\n\n // we should get our CORS access control header specifying all origins are allowed. If we'd specified a\n // specific set of allowed origins, we'd see that there.\n response.expectHeader()\n .valueEquals(\"Access-Control-Allow-Origin\", \"http://allowed-origin.ca\");\n }", "@Test\n void testGetRequest() {\n String OAUTH_BASE = \"https://api-sandbox.rabobank.nl/openapi/sandbox/oauth2\";\n raboUtilUnderTest.get(OAUTH_BASE, \"/token\", \"payload\");\n\n // Verify the results\n verify(webClient).get(anyString(),any());\n }", "@Test\n public void test_option_with_cors_headers() throws Exception {\n mockMvc.perform(options(\"/users\")).andExpect(header().string(\"Access-Control-Allow-Origin\", \"*\"))\n .andExpect(header().string(\"Access-Control-Allow-Methods\", \"POST, GET, PUT, OPTIONS, DELETE\"))\n .andExpect(header().string(\"Access-Control-Allow-Headers\", \"*\"))\n .andExpect(header().string(\"Access-Control-Max-Age\", \"3600\"));\n }", "@Test\n public void testBasicAuthUserFail() {\n HttpAuthenticationFeature feature = \n HttpAuthenticationFeature.basic(\"NOTadmin\", \"admin\");\n Client client = ClientBuilder.newClient();\n URI uri = UriBuilder\n .fromUri(APPLICATION_NAME + APPLICATION_API_VERSION)\n .scheme(\"http\")\n .host(\"localhost\")\n .port(8080)\n .build();\n WebTarget webTarget = client\n .register(feature)\n .target(uri)\n .path(\"user\");\n Response response = webTarget\n .request(APPLICATION_JSON)\n .get();\n assertThat(response.getStatus(), is(401));\n }", "@Test\n public void getWitheaders(){\n with().accept(ContentType.JSON)\n .when().get(\"http://34.223.219.142:1212/ords/hr/countries/US\")\n .then().statusCode(200);\n }", "@Test\n @OperateOnDeployment(\"server\")\n public void shouldFailToGetResourceWhenHttpMethodIncorrect() {\n given().header(\"Authorization\", \"Bearer access_token\").expect().statusCode(400).when().put(\n getBaseTestUrl() + \"/1/category/get/json/1\");\n }", "@Test // SPR-11443\n\tvoid handleInfoGetCorsFilter() {\n\t\tthis.servletResponse.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, \"foobar:123\");\n\n\t\thandleRequest(\"GET\", \"/echo/info\", HttpStatus.OK);\n\n\t\tassertThat(this.servletResponse.getHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)).isEqualTo(\"foobar:123\");\n\t}", "@Test\n void callWithWebTestClient() {\n webClient.get().uri(\"/\").exchange().expectStatus().isOk().expectBody(String.class)\n .isEqualTo(OK_RESPONSE);\n }", "@Test\n public void testAllUsersGET() {\n HttpAuthenticationFeature feature = \n HttpAuthenticationFeature.basic(\"admin\", \"admin\");\n Client client = ClientBuilder.newClient();\n URI uri = UriBuilder\n .fromUri(APPLICATION_NAME + APPLICATION_API_VERSION)\n .scheme(\"http\")\n .host(\"localhost\")\n .port(8080)\n .build();\n WebTarget webTarget = client\n .register(feature)\n .target(uri)\n .path(\"user\");\n Response response = webTarget\n .request(APPLICATION_JSON)\n .get();\n assertThat(response.getStatus(), is(200));\n }", "@Test\n public void simpleGet(){\n when()\n .get(\"http:://34.223.219.142:1212/ords/hr/employees\")\n .then().statusCode(200);\n\n }", "@Test\n public void testPresence() throws Exception \n {\n System.out.println(\"presence\");\n/*\n Mockito.when(this.accountService.getAccount()).thenReturn(null);\n mvc.perform(MockMvcRequestBuilders.put(\"/api/home/12345/presence\")\n .content(\"{\\\"presence\\\": \\\"AWAY\\\"}\")\n .contentType(MediaType.APPLICATION_JSON)\n .accept(MediaType.APPLICATION_JSON))\n .andExpect(status().isPreconditionFailed())\n .andDo(print())\n .andReturn(); \n*/\n Mockito.when(this.accountService.getAccount()).thenReturn(account);\n mvc.perform(MockMvcRequestBuilders.put(\"/api/home/12345/presence\")\n .contentType(MediaType.APPLICATION_JSON)\n .content(\"{\\\"presence\\\": \\\"AWAY\\\"}\")\n .accept(MediaType.APPLICATION_JSON))\n .andExpect(status().isOk())\n .andDo(print())\n .andReturn(); \n\n }", "@Test\n\tpublic void testLogin() {\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\tHttpEntity<String> entity = new HttpEntity<String>(null, headers);\n\t\tResponseEntity<String> response = restTemplate.exchange(getRootUrl() + \"/login\",HttpMethod.GET, entity, String.class);\n\t\tassertEquals(200, response.getStatusCodeValue());\n\t}", "@Test\n public void testWelcomeMessage() throws Exception {\n mvc.perform(\n MockMvcRequestBuilders.get(\"/hello/welcome\")\n .accept(MediaType.APPLICATION_JSON)\n .header(ACCESS_CONTROL_REQUEST_METHOD, GET)\n .header(ORIGIN, ORIGIN_URL))\n .andExpect(status().isOk())\n .andExpect(content().string(containsString(\"Hello World!\")))\n .andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_URL));\n }", "@Test\n void sendGetRequest() {\n try {\n String response = HttpUtils.sendGet();\n assertFalse(response.contains(\"404\"));\n } catch (IOException e) {\n e.printStackTrace();\n fail();\n }\n }", "@Test\r\n\tpublic void givenResourceUrl_whenSendGetForRequestEntity_thenStatusOk() throws IOException {\n\r\n\t\tfinal Logger log = LoggerFactory.getLogger(UserDataRestTemplateTest.class);\r\n\r\n\t\tRestTemplate restTemplate = new RestTemplate();\r\n\t\tMap<String, String> response = (Map<String, String>) restTemplate\r\n\t\t\t\t.getForObject(\"http://services.groupkt.com/country/get/iso2code/IN\", Map.class);\r\n\t\tlog.info(\"==== RESTful API Response using Spring RESTTemplate START =======\");\r\n\t\tlog.info(response.toString());\r\n\t\tlog.info(\"==== RESTful API Response using Spring RESTTemplate END =======\");\r\n\r\n\t}", "@Test(priority=5)\r\n\tpublic void validateHeader()\r\n\t{\r\n\t\tgiven()\r\n\t\t.get(\"https://reqres.in/api/users/2\")\r\n\t\t.then() \r\n\t \t.header(\"Content-Type\", containsString(\"application/json\")); \r\n\t\t//application/json; charset=utf-8 \r\n\t}", "public static void getMethodTest()\n\t{\n String content = restTemplate.getForObject(baseURL+\"/hello\", String.class);\n System.out.println(\"-------------\");\n \n ResponseEntity<String > s = restTemplate.getForEntity(baseURL+\"/hello\", String.class);\n System.out.println(s.getBody());\n System.out.println(s.getStatusCodeValue());\n System.out.println(s.getHeaders());\n System.out.println(s.getStatusCode());\n\n\t}", "@Test\n public void testOptions() throws Exception {\n\n HttpURLConnection result = HttpUtil.options(\"http://localhost:9090/ehcache/rest/doesnotexist/1\");\n assertEquals(200, result.getResponseCode());\n assertEquals(\"application/vnd.sun.wadl+xml\", result.getContentType());\n\n String responseBody = HttpUtil.inputStreamToText(result.getInputStream());\n assertNotNull(responseBody);\n assertTrue(responseBody.matches(\"(.*)GET(.*)\"));\n assertTrue(responseBody.matches(\"(.*)PUT(.*)\"));\n assertTrue(responseBody.matches(\"(.*)DELETE(.*)\"));\n assertTrue(responseBody.matches(\"(.*)HEAD(.*)\"));\n }", "@Test\n public void authorisedTest() {\n assertTrue(authResponse.isAuthorised());\n }", "@Test\n\tpublic void TCAPIAR_03(){\n\t\taudioControl.addLog(\"ID : TCAPIAR_03 : Verify that Partner user is unable to get audio route detail\");\n\t\t/*\n\t\t\tSend a sample GET request using JssionID and CSRF token of partner user as following:\n\t\t\tGET http://devportal.dts.com/saap/api/route/154?revision=0 HTTP/1.1\n\t\t */\n\t\t// Log into DTS portal as partner user\n\t\tloginControl.login(SUPER_PARTNER_USER, SUPER_PARTNER_PASSWORD);\n\t\t// Get user CSRF token and cookie\n\t\tcsrfToken = audioControl.getCSRFToken();\n\t\tcookie = audioControl.getCookie();\n\t\t// Send a sample GET request using JssionID and CSRF token of partner user as following:\n\t\t// GET http://devportal.dts.com/saap/api/route/154?revision=0 HTTP/1.1\n\t\tJSONObject requestResult = APIUtil.sendGet(APIData.AUDIO_ROUTE_DETAIL_URL, csrfToken, cookie);\n\t\t/*\n\t\t * {\"apiErrorCode\":\"PEMISSION_DENY\",\"message\":\"You don't have permission.\"}\n\t\t */\n\t\tAssert.assertEquals(requestResult.get(\"message\").toString(), APIData.ERROR_MESSAGE);\n\t}", "@GET\n @Path(\"/ping\")\n\tpublic Response ping() {\n\t\tlog.debug(\"Ping check ok\");\n return Response.status(Response.Status.OK).entity(1).build();\n \n\t}", "@Test\n public void VerifyContentTypeWithAssertThat(){\n given().accept(ContentType.JSON)\n .when().get(\"http://34.223.219.142:1212/ords/hr/employees/100\")\n .then().assertThat().statusCode(200)\n .and().contentType(ContentType.JSON);\n }", "@Test\n\t@Ignore\n\tpublic void testResponse() throws UnsupportedEncodingException {\n\t\tws = resource().path(\"omxdata\");\n\t\tClientResponse response = ws.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);\n\t\tassertEquals(200, response.getStatus());\n\t\tSystem.out.println(response.getStatus());\n\t}", "@Test\n\t\tpublic void testRestSuccessfulResponse() throws Exception {\n\n\t\t\tString responseBody = TestUtils.getValidResponse();\n\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tResponseEntity<ResponseWrapper> responseEntity= prepareReponseEntity(responseBody);\n\t\t\t\t\n\t\t\t\tboolean flag=weatherService.checkForErrors(responseEntity);\n\t\t\t\tassertFalse(flag);\n\t\t\t\n\t\t\t\tthis.mockServer.verify();\n\t\t\t} catch (Exception e) {\n\t\t\t\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}", "ResponseEntity<?> verifyOtp(HttpServletRequest request, HttpServletResponse response);", "@Test\n public void testHelloAPI() throws Exception {\n mvc.perform(\n MockMvcRequestBuilders.post(\"/hello\")\n .contentType(MediaType.APPLICATION_JSON)\n .content(content)\n .accept(MediaType.APPLICATION_JSON)\n .header(ACCESS_CONTROL_REQUEST_METHOD, POST)\n .header(ORIGIN, ORIGIN_URL))\n .andExpect(status().isCreated())\n .andExpect(content().string(equalTo(content)))\n .andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_URL));\n\n // retrieve the test message\n mvc.perform(\n MockMvcRequestBuilders.get(\"/hello/test\")\n .accept(MediaType.APPLICATION_JSON)\n .header(ACCESS_CONTROL_REQUEST_METHOD, GET)\n .header(ORIGIN, ORIGIN_URL))\n .andExpect(status().isOk())\n .andExpect(content().string(equalTo(content)))\n .andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_URL));\n\n // update the test message\n mvc.perform(\n MockMvcRequestBuilders.put(\"/hello/test\")\n .contentType(MediaType.APPLICATION_JSON)\n .content(updatedContent)\n .accept(MediaType.APPLICATION_JSON)\n .header(ACCESS_CONTROL_REQUEST_METHOD, PUT)\n .header(ORIGIN, ORIGIN_URL))\n .andExpect(status().isOk())\n .andExpect(content().string(equalTo(updatedContent)))\n .andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_URL));\n\n // retrieve the updated message\n mvc.perform(\n MockMvcRequestBuilders.get(\"/hello/test\")\n .accept(MediaType.APPLICATION_JSON)\n .header(ACCESS_CONTROL_REQUEST_METHOD, GET)\n .header(ORIGIN, ORIGIN_URL))\n .andExpect(status().isOk())\n .andExpect(content().string(equalTo(updatedContent)))\n .andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_URL));\n\n // delete the test message\n mvc.perform(\n MockMvcRequestBuilders.delete(\"/hello/test\")\n .accept(MediaType.APPLICATION_JSON)\n .header(ACCESS_CONTROL_REQUEST_METHOD, DELETE)\n .header(ORIGIN, ORIGIN_URL))\n .andExpect(status().isNoContent())\n .andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_URL));\n\n // ensure that the test message now returns 404\n mvc.perform(\n MockMvcRequestBuilders.get(\"/hello/test\")\n .accept(MediaType.APPLICATION_JSON)\n .header(ACCESS_CONTROL_REQUEST_METHOD, GET)\n .header(ORIGIN, ORIGIN_URL))\n .andExpect(status().isNotFound())\n .andExpect(header().string(ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_URL));\n }", "@Override\r\n\t@Test(groups = {\"function\",\"setting\"} ) \r\n\tpublic boolean checkProtocol() {\n\t\tboolean flag = oTest.checkProtocol();\r\n\t\tAssertion.verifyEquals(flag, true);\r\n\t\treturn false;\r\n\t}", "@Test\n\tpublic void TCAPIAR_02(){\n\t\taudioControl.addLog(\"ID : TCAPIAR_02 : Verify that Partner user is unable to get list of audio route\");\n\t\t/*\n\t\t\tSend a sample GET request using JssionID and CSRF token of partner user as following:\n\t\t\tGET http://devportal.dts.com/saap/api/route HTTP/1.1\n\t\t */\n\t\t// Log into DTS portal as Partner user\n\t\tloginControl.login(SUPER_PARTNER_USER, SUPER_PARTNER_PASSWORD);\n\t\t// Get user CSRF token and cookie\n\t\tcsrfToken = audioControl.getCSRFToken();\n\t\tcookie = audioControl.getCookie();\n\t\t\n\t\t// Send a sample GET request using JssionID and CSRF token of partner user as following: GET http://devportal.dts.com/saap/api/route HTTP/1.1\n\t\tJSONObject requestResult = APIUtil.sendGet(APIData.GET_AUDIO_ROUTES_LIST_URL, csrfToken, cookie);\n\t\t/*\n\t\t * {\"apiErrorCode\":\"PEMISSION_DENY\",\"message\":\"You don't have permission.\"}\n\t\t */\n\t\tAssert.assertEquals(requestResult.get(\"message\").toString(), APIData.ERROR_MESSAGE);\n\t}", "@Test\n public void testHttpApiV11() throws Exception {\n Configuration config = new Configuration(\"pri\", \"http://127.0.0.1:7001\", \"cYjKmvthKqVuFI29l5Xo+LHtkfJlIs0YnwEwXawW4NY=\");\n\n HttpApi api = new HttpApi(config);\n\n // request a withdrawal\n Result<Order> withdrawal = api.requestWithdrawal(0, \"BTC\", \"0.01\", \"mg2bfYdfii2GG13HK94jXBYPPCSWRmSiAS\", null);\n assertEquals(0, withdrawal.getCode().longValue());\n assertEquals(\"OK\", withdrawal.getMessage());\n assertEquals(Order.class, withdrawal.getObject().getClass());\n\n Result<Order> invalidWithdrawal = api.requestWithdrawal(0, \"ABC\", \"0.01\", \"mg2bfYdfii2GG13HK94jXBYPPCSWRmSiAS\", null);\n assertNotEquals(0, invalidWithdrawal.getCode().longValue());\n assertEquals(20000, invalidWithdrawal.getCode().longValue());\n assertNotEquals(\"OK\", invalidWithdrawal.getMessage());\n assertEquals(\"不支持该币种类型\", invalidWithdrawal.getMessage());\n assertNull(invalidWithdrawal.getObject());\n\n //get a new address\n Result<Address> newAddr = api.newAddress(\"TRX\");\n assertEquals(0, newAddr.getCode().longValue());\n assertEquals(\"OK\", newAddr.getMessage());\n assertEquals(Address.class, newAddr.getObject().getClass());\n\n Result<Address> invalidAddr = api.newAddress(\"ABC\");\n assertNotEquals(0, invalidAddr.getCode().longValue());\n assertEquals(20000, invalidAddr.getCode().longValue());\n assertNotEquals(\"OK\", invalidAddr.getMessage());\n assertEquals(\"不支持该币种类型\", invalidAddr.getMessage());\n assertNull(invalidAddr.getObject());\n\n // verify if an address is valid\n Result<Boolean> valid = api.verifyAddress(\"BTC\", newAddr.getObject().getAddress());\n assertEquals(0, valid.getCode().longValue());\n assertEquals(\"OK\", valid.getMessage());\n assertEquals(true, valid.getObject().booleanValue());\n\n Result<Boolean> invalidVerify = api.verifyAddress(\"BTC\", \"hdsdjasdlk\");\n assertNotEquals(0, invalidVerify.getCode().longValue());\n assertEquals(20003, invalidVerify.getCode().longValue());\n assertNotEquals(\"OK\", invalidVerify.getMessage());\n assertEquals(\"地址与类型不匹配\", invalidVerify.getMessage());\n assertNull(invalidVerify.getObject());\n\n // request an audit\n Result<String> auditId = api.requestAudit(\"BTC\", Utils.getTimestamp());\n assertEquals(0, auditId.getCode().longValue());\n assertEquals(\"OK\", auditId.getMessage());\n assertEquals(String.class, auditId.getObject().getClass());\n\n Result<String> invalidAuditId = api.requestAudit(\"ABC\", Utils.getTimestamp());\n assertNotEquals(0, invalidAuditId.getCode().longValue());\n assertEquals(20000, invalidAuditId.getCode().longValue());\n assertNotEquals(\"OK\", invalidAuditId.getMessage());\n assertEquals(\"不支持该币种类型\", invalidAuditId.getMessage());\n assertNull(invalidAuditId.getObject());\n\n // query a order\n Result<Order> order = api.queryOrder(withdrawal.getObject().getId());\n assertEquals(0, order.getCode().longValue());\n assertEquals(\"OK\", order.getMessage());\n assertEquals(Order.class, order.getObject().getClass());\n\n Result<Order> invalidOrder = api.queryOrder(\"-1\");\n assertNotEquals(0, invalidOrder.getCode().longValue());\n assertEquals(40400, invalidOrder.getCode().longValue());\n assertNotEquals(\"OK\", invalidOrder.getMessage());\n assertEquals(\"未找到指定订单号\", invalidOrder.getMessage());\n assertNull(invalidOrder.getObject());\n\n // query an audit order\n Result<Audit> audit = api.queryAudit(auditId.getObject());\n assertEquals(0, audit.getCode().longValue());\n assertEquals(\"OK\", audit.getMessage());\n assertEquals(Audit.class, audit.getObject().getClass());\n\n Result<Audit> invalidAudit = api.queryAudit(\"-fje2je2\");\n assertNotEquals(0, invalidAudit.getCode().longValue());\n assertEquals(500, invalidAudit.getCode().longValue());\n assertNotEquals(\"OK\", invalidAudit.getMessage());\n assertNull(invalidAudit.getObject());\n\n Result<Audit> invalidAudit2 = api.queryAudit(\"5c387ae65a669ac159ba7bcc\");\n assertNotEquals(0, invalidAudit2.getCode().longValue());\n assertEquals(40401, invalidAudit2.getCode().longValue());\n assertNotEquals(\"OK\", invalidAudit2.getMessage());\n assertEquals(\"未找到指定审计信息\", invalidAudit2.getMessage());\n assertNull(invalidAudit2.getObject());\n\n // query wallet balance\n Result<WalletBalance> balance = api.getBalance(\"BTC\");\n assertEquals(0, balance.getCode().longValue());\n assertEquals(\"OK\", balance.getMessage());\n assertEquals(WalletBalance.class, balance.getObject().getClass());\n\n Result<WalletBalance> invalidBalance = api.getBalance(\"ABC\");\n assertNotEquals(0, invalidBalance.getCode().longValue());\n assertEquals(20000, invalidBalance.getCode().longValue());\n assertNotEquals(\"OK\", invalidBalance.getMessage());\n assertEquals(\"不支持该币种类型\", invalidBalance.getMessage());\n assertNull(invalidBalance.getObject());\n }", "@Test\n\tpublic void testPatient() {\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\tHttpEntity<String> entity = new HttpEntity<String>(null, headers);\n\t\tResponseEntity<String> response = restTemplate.exchange(getRootUrl() + \"/edit-patient?id=4\",HttpMethod.GET, entity, String.class);\n\t\tassertEquals(200,response.getStatusCodeValue());\n\t}", "@Test\n public void preauthServlet() throws Exception {\n String testName = getTestName();\n \n String externalPassword = \"test456\";\n String extAcctLocalPart = testName;\n String extAcctName = createExternalAcctEntry(extAcctLocalPart, externalPassword, null);\n \n Map<String, Object> zmailDomainAttrs = commonZmailDomainAttrs();\n // setup auto prov\n // commonZmailDomainAttrs added only LDAP, add preauth here\n StringUtil.addToMultiMap(zmailDomainAttrs, Provisioning.A_zmailAutoProvAuthMech, AutoProvAuthMech.PREAUTH.name());\n zmailDomainAttrs.put(Provisioning.A_zmailAutoProvLdapSearchBase, extDomainDn);\n zmailDomainAttrs.put(Provisioning.A_zmailAutoProvLdapSearchFilter, \"(uid=%u)\");\n // setup external LDAP auth\n zmailDomainAttrs.put(Provisioning.A_zmailAuthMech, AuthMech.ldap.name());\n zmailDomainAttrs.put(Provisioning.A_zmailAuthLdapURL, \"ldap://localhost:389\");\n zmailDomainAttrs.put(Provisioning.A_zmailAuthLdapBindDn, \"uid=%u,ou=people,\" + extDomainDn);\n // setup preauth\n String preAuthKey = PreAuthKey.generateRandomPreAuthKey();\n zmailDomainAttrs.put(Provisioning.A_zmailPreAuthKey, preAuthKey);\n \n Domain zmailDomain = createZmailDomain(testName, zmailDomainAttrs);\n \n String loginName = extAcctLocalPart + \"@\" + zmailDomain.getName();\n \n // preauth data\n String preAuthUrl = TestPreAuthServlet.genPreAuthUrl(preAuthKey, loginName, false, false);\n \n // do the preauth servlet request\n String url = TestUtil.getBaseUrl() + preAuthUrl;\n \n HttpClient client = new HttpClient();\n HttpMethod method = new GetMethod(url);\n \n boolean ok = false;\n try {\n int respCode = HttpClientUtil.executeMethod(client, method);\n int statusCode = method.getStatusCode();\n String statusLine = method.getStatusLine().toString();\n \n ok = (respCode == 200);\n \n /*\n System.out.println(\"respCode=\" + respCode);\n System.out.println(\"statusCode=\" + statusCode);\n System.out.println(\"statusLine=\" + statusLine);\n \n System.out.println(\"Headers\");\n Header[] respHeaders = method.getResponseHeaders();\n for (int i=0; i < respHeaders.length; i++) {\n String header = respHeaders[i].toString();\n System.out.println(header);\n }\n */\n \n /*\n String respBody = method.getResponseBodyAsString();\n System.out.println(respBody);\n */\n \n } catch (HttpException e) {\n throw e;\n } catch (IOException e) {\n throw e;\n } finally {\n method.releaseConnection();\n }\n \n assertTrue(ok);\n \n /*\n String encodedAuthToken = response.getElement(AccountConstants.E_AUTH_TOKEN).getText();\n assertNotNull(encodedAuthToken);\n AuthToken authToken = AuthToken.getAuthToken(encodedAuthToken);\n String acctId = authToken.getAccountId();\n Account acct = prov.get(AccountBy.id, acctId);\n verifyAcctAutoProvisioned(acct, loginName.toLowerCase());\n */\n }", "public void test_02() {\n\n\t\tResponse reponse = given().\n\t\t\t\tbody(\"{\\\"first_name\\\": \\\"updated by PATCH Rahaman\\\"}\").\n\t\t\t\twhen().\n\t\t\t\tcontentType(ContentType.JSON).\n\t\t\t\tpatch(\"http://localhost:3000/posts/05\");\n\n\t\tSystem.out.println(\"updated response data \"+ reponse.asString());\t\t\t\n\t}", "@Test\n void testDoPaymentInitiationRequest() {\n String PIS_BASE = \"https://api-sandbox.rabobank.nl/openapi/sandbox/payments/payment-initiation/pis/v1\";\n raboUtilUnderTest.doPaymentInitiationRequest(PIS_BASE, \"/payments/sepa-credit-transfers\", \"token\", \"payload\", \"redirect\");\n\n // Verify the results\n verify(webClient).post(anyString(),any(),any());\n }", "@Test\n public void liveTest() {\n assertTrue(authResponse.isLive());\n }", "@Test\n public void testClient() {\n try {\n MockWebServer server = new MockWebServer();\n server.enqueue(new MockResponse().setBody(\"hello, world!\"));\n server.start();\n HttpUrl baseUrl = server.url(\"\");\n ConnectionOptions opt = new ConnectionOptions(\"apikey\");\n opt.setHost(baseUrl.toString());\n ApiClientWrapper clientWrapper = new ApiClientWrapper(opt);\n TestApiService testService = clientWrapper.createService(TestApiService.class);\n assertTrue(testService.getEndpointValue().execute().isSuccessful());\n RecordedRequest request = server.takeRequest();\n assertEquals(\"/\" + AN_ENDPOINT_PATH, request.getPath());\n assertNotNull(request.getHeader(\"Authorization\"));\n assertTrue(request.getHeader(\"Authorization\").contains(\"Bearer\"));\n assertNotNull(request.getHeader(\"User-Agent\"));\n assertTrue(request.getHeader(\"User-Agent\").contains(ApiClientWrapper.UserAgent.MBED_CLOUD_SDK_IDENTIFIER));\n server.shutdown();\n } catch (IOException | InterruptedException e) {\n fail(e.getMessage());\n }\n }", "@Test\n\t \n\t public void getApi() {\n\t\t \n\t\t Response getIt=get(\"https://reqres.in/api/users?page=2\");\n\t\t getIt.prettyPrint();\n\t\t System.out.println(getIt.getStatusCode());\n\t\t System.out.println(getIt.getTime());\n\t\t \n\t\t //to validate\n\t\t int validGstatus=getIt.getStatusCode();\n\t\t Assert.assertEquals(validGstatus,200);\n\t\t \n\t }", "@Test\n public void verifyFirstName(){\n given().accept(ContentType.JSON)\n .when().get(\"http://34.223.219.142:1212/ords/hr/employees/100\")\n .then().assertThat().statusCode(200)\n .and().contentType(ContentType.JSON)\n .and().assertThat().body(\"first_name\", Matchers.equalTo(\"Steven\"))\n .and().assertThat().body(\"employee_id\",Matchers.equalTo(\"100\"));\n\n }", "@Test\n public void printResponse(){\n when().get(\"http:://34.223.219.142:1212/ords/hr/countries\")\n .body().prettyPrint();\n\n }", "@POST(\"/TestConnection\")\n\tboolean testConnection() throws UnknownHostException;", "@Test\n public void optionRequest() {\n str = METHOD_OPTION + URI_SAMPLE + \" \" + HTTP_VERSION + ENDL;\n request = new HttpRequest(str, IP_ADDRESS, HOST);\n assertEquals(request.getMethod(), HttpMethod.OPTIONS);\n assertEquals(request.getUrn(), \"www.site.ru/news.html\");\n assertEquals(request.getHeader(NONEXISTENT_VAR), \"\");\n assertEquals(request.getHeader(null), \"\");\n assertEquals(request.getParameter(NONEXISTENT_VAR), \"\");\n assertEquals(request.getParameter(null), \"\");\n }", "@Test\n public void testTokenEndPointAnonymousTokenRequest() throws Exception {\n String callback = \"Backplane.call_back\";\n \n // should return the form:\n // callback({\n // \"access_token\": \"l5feG0KjdXTpgDAfOvN6pU6YWxNb7qyn\",\n // \"expires_in\":3600,\n // \"token_type\": \"Bearer\",\n // \"backplane_channel\": \"Tm5FUzstWmUOdp0xU5UW83r2q9OXrrxt\"\n // })\n \n refreshRequestAndResponse();\n \n request.setRequestURI(\"/v2/token\");\n request.setMethod(\"GET\");\n request.setParameter(\"grant_type\", \"client_credentials\");\n setOAuthBasicAuthentication(request, \"anonymous\", \"\");\n request.setParameter(\"callback\", callback);\n \n handlerAdapter.handle(request, response, controller);\n logger.info(\"testTokenEndPointAnonymousTokenRequest() => \" + response.getContentAsString());\n \n assertTrue(\"Invalid response: \" + response.getContentAsString(), response.getContentAsString().\n matches(callback + \"[(][{]\\\\s*\\\"access_token\\\":\\\\s*\\\".{22}+\\\",\\\\s*\" +\n \"\\\"expires_in\\\":\\\\s*3600,\\\\s*\" +\n \"\\\"token_type\\\":\\\\s*\\\"Bearer\\\",\\\\s*\" +\n \"\\\"backplane_channel\\\":\\\\s*\\\".{32}+\\\"\\\\s*[}][)]\"));\n \n // cleanup test token\n String result = response.getContentAsString().substring(response.getContentAsString().indexOf(\"{\"), response.getContentAsString().indexOf(\")\"));\n Map<String,Object> returnedBody = new ObjectMapper().readValue(result, new TypeReference<Map<String,Object>>() {});\n daoFactory.getTokenDao().delete((String)returnedBody.get(\"access_token\"));\n \n }", "@Test\n public void testGetIt() {\n String responseMsg = target.path(\"service/servertest\").request().get(String.class);\n assertEquals(\"Got it!\", responseMsg);\n }", "@Test\n public void testStatusCode(){\n Assert.assertEquals(resp.getStatusCode(),200, \"Status code does not match\");\n }", "@Test\n public void testWithRestAssured() {\n\t \n\t given() // can be ommited when GET only\n .when() // can be ommited when GET only\n .get(\"http://localhost:8080/restexamples/hello\")\n .then()\n .statusCode(HttpStatus.SC_OK)\n .assertThat()\n\t\t\t\t.body(is(Controller.RESPONSE));\n }", "@Test\r\n\tpublic void testResponseCode(){\r\n\t\t\r\n\t\tint code = get(api1).getStatusCode();\r\n\t\tSystem.out.println(\"Code: \"+code);\r\n\t\tAssert.assertEquals(code, 200);\r\n\t}", "@Test\n public void testHttp405NotAllowedMethod() {\n final NioEventLoopGroup bootGroup = new NioEventLoopGroup();\n final NioEventLoopGroup processGroup = new NioEventLoopGroup();\n final String json = \"{\\\"action\\\":\\\"ping\\\"}\";\n final ByteBuf content = Unpooled.copiedBuffer(json, StandardCharsets.UTF_8);\n\n final ChannelFuture serverChannel = runServer(bootGroup, processGroup);\n runClient(HttpMethod.PUT, content, uri);\n\n serverChannel.awaitUninterruptibly();\n bootGroup.shutdownGracefully();\n processGroup.shutdownGracefully();\n\n final String expected = \"{\\\"action\\\":\\\"error\\\",\\\"content\\\":\\\"Ping Pong server failure\\\",\\\"status\\\":\\\"405 Method Not Allowed\\\"}\";\n final String actual = buffer.toString();\n logger.info(\"Expected result: {}\", expected);\n logger.info(\"Actual result: {}\", actual);\n Assert.assertEquals(\"Hadn't processed the request: 405 Method Not Allowed\", expected, actual);\n }", "@Test\n public void shouldReturnOkStatus() throws Exception {\n mockMvc.perform(get(API_MOOD_TYPE, \"angry\"))\n .andExpect(status().isOk());\n\n mockMvc.perform(get(API_MOOD_TYPE, \"cherry\"))\n .andExpect(status().isOk());\n }", "@Test\n\tpublic void TCAPIAR_04(){\n\t\taudioControl.addLog(\"ID : TCAPIAR_04 : Verify that Partner user is unable to update audio routes\");\n\t\t/*\n\t\t\tSend a sample POST request using JssionID and CSRF token of partner user as following:\n\t\t\tPOST http://devportal.dts.com/saap/api/route HTTP/1.1\n\t\t */\n\t\t// Log into DTS portal as partner user\n\t\tloginControl.login(SUPER_PARTNER_USER, SUPER_PARTNER_PASSWORD);\n\t\t// Get user CSRF token and cookie\n\t\tcsrfToken = audioControl.getCSRFToken();\n\t\tcookie = audioControl.getCookie();\n\t\t// Send a sample POST request using JssionID and CSRF token of partner user as following:\n\t\t// POST http://devportal.dts.com/saap/api/route HTTP/1.1\n\t\tJSONObject requestBody = APIUtil.parseDataToJsonObject(jsonData.get(APIData.AUDIO_ROUTE_DATA).toString());\n\t\tJSONObject requestResult = APIUtil.sendPost(APIData.UPDATE_AUDIO_ROUTES_URL, csrfToken, cookie, requestBody.toJSONString());\n\t\t/*\n\t\t * {\"apiErrorCode\":\"PEMISSION_DENY\",\"message\":\"You don't have permission.\"}\n\t\t */\n\t\tAssert.assertEquals(requestResult.get(\"message\").toString(), APIData.ERROR_MESSAGE);\n\t}", "public void test3(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {\n InetAddress addr = InetAddress.getByName(request.getRemoteAddr());\n if(addr.getCanonicalHostName().equals(\"trustme.com\")){ /* BUG */\n\n }\n }", "@Test\n public void testHttp200AuthorRequest() {\n final NioEventLoopGroup bootGroup = new NioEventLoopGroup(1);\n final NioEventLoopGroup processGroup = new NioEventLoopGroup();\n final String json = \"{\\\"action\\\":\\\"ping\\\"}\";\n final ByteBuf content = Unpooled.copiedBuffer(json, StandardCharsets.UTF_8);\n\n final ChannelFuture serverChannel = runServer(bootGroup, processGroup);\n runClient(HttpMethod.POST, content, \"/author\");\n\n serverChannel.awaitUninterruptibly();\n bootGroup.shutdownGracefully();\n processGroup.shutdownGracefully();\n\n final String expected = \"{\\\"action\\\":\\\"author\\\",\\\"content\\\":\\\"Dmitriy Shishmakov, https://github.com/DmitriySh\\\",\\\"status\\\":\\\"200 OK\\\"}\";\n final String actual = buffer.toString();\n logger.info(\"Expected result: {}\", expected);\n logger.info(\"Actual result: {}\", actual);\n Assert.assertEquals(\"Haven't received info about author\", expected, actual);\n }", "@Test\n\tpublic void getRequestWithQueryParamter() {\n\t\tgiven()\n\t\t.queryParam(\"fullText\", \"true\")\n\t\t.when()\n\t\t.get(\"https://restcountries.eu/rest/v2/name/aruba\")\n\t\t.then()\n\t\t.assertThat()\n\t\t.contentType(ContentType.JSON)\n\t\t.and()\n\t\t.statusCode(HttpStatus.SC_OK)\n\t\t.log().all();\n\t}", "@Test\n public void BasicAuthentication401validation() {\n RestAssured.get(\"https://the-internet.herokuapp.com/basic_auth\").then().assertThat().statusCode(401);\n }", "@Test\n public void testNoAuthorization() {\n Response r = target(\"/token\")\n .request()\n .get();\n\n assertEquals(Status.UNAUTHORIZED.getStatusCode(), r.getStatus());\n }", "@Test\n @OperateOnDeployment(\"server\")\n public void shouldFailToGetResourceWhenEndpointNotMapped() {\n given().header(\"Authorization\", \"Bearer access_token\").expect().statusCode(400).when().get(getBaseTestUrl() + \"/1/user/get/json/1\");\n }", "boolean getAllowCors();", "public StatusLine testHttpEntity(URL url) throws IOException {\r\n Logger.getLogger(TargetAuthenticationStrategy.class).setLevel(Level.ERROR);\r\n Logger.getLogger(RequestTargetAuthentication.class).setLevel(Level.ERROR);\r\n DefaultHttpClient httpclient = new DefaultHttpClient();\r\n\r\n httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);\r\n\r\n String domain = this.domain;\r\n String username = this.username;\r\n String password = this.password;\r\n if (serviceAccountPropertiesFileName != null) {\r\n Properties serviceAccountProperties = new Properties();\r\n if (new File(serviceAccountPropertiesFileName).exists()) {\r\n serviceAccountProperties.load(new FileReader(serviceAccountPropertiesFileName));\r\n } else {\r\n try {\r\n serviceAccountProperties.load(this.getClass().getResourceAsStream(serviceAccountPropertiesFileName));\r\n } catch (Exception e) {\r\n }\r\n }\r\n domain = serviceAccountProperties.getProperty(\"http.serviceaccount.domain\", domain);\r\n username = serviceAccountProperties.getProperty(\"http.serviceaccount.username\", username);\r\n password = serviceAccountProperties.getProperty(\"http.serviceaccount.password\", password);\r\n }\r\n\r\n if (username != null && password != null) {\r\n String decryptedPassword = password;\r\n try {\r\n decryptedPassword = new StringEncrypter().decrypt(password);\r\n } catch (Exception e) {\r\n }\r\n NTCredentials creds = new NTCredentials(username, decryptedPassword, getCanonicalHostName()[0], domain);\r\n httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds);\r\n httpclient.getAuthSchemes().unregister(AuthPolicy.SPNEGO);\r\n httpclient.getAuthSchemes().unregister(AuthPolicy.KERBEROS);\r\n }\r\n HttpHost target = new HttpHost(url.getHost(), url.getPort(), url.getProtocol());\r\n HttpContext localContext = new BasicHttpContext();\r\n HttpGet httpGet = new HttpGet(url.getFile());\r\n HttpResponse httpResponse = httpclient.execute(target, httpGet, localContext);\r\n StatusLine lastStatusLine = httpResponse.getStatusLine();\r\n httpGet.releaseConnection();\r\n\r\n return (this.lastStatusLine = lastStatusLine);\r\n }", "boolean hasListResponse();", "public void test4(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {\n InetAddress addr = InetAddress.getByName(request.getRemoteAddr());\n if(addr.getCanonicalHostName().equalsIgnoreCase(\"trustme.com\")){ /* BUG */\n\n }\n }", "@Test\n @OperateOnDeployment(\"server\")\n public void shouldFailToGetResourceWhenTokenNonCurrent() {\n given().header(\"Authorization\", \"Bearer noncurrent_access_token\").expect().statusCode(401).when().get(\n getBaseTestUrl() + \"/1/category/get/json/1\");\n }", "@Test\n public void basicAuthentication() {\n RestAssured.given().auth().basic(\"admin\",\"admin\").when().get(\"https://the-internet.herokuapp.com/basic_auth\").\n then().assertThat().statusCode(200);\n\n //api key is one type of authentication, we can also be authenticated by providing a name and password.\n }", "@Test\n void getAllProfessors() throws Exception{\n MvcResult result = mvc.perform(get(\"/api/v1/professors\")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)).andReturn();\n System.out.println(result.getResponse().getContentAsString());\n\n }", "@Override\n\tpublic boolean isResponseExpected() {\n\t\treturn false;\n\t}", "public void test1(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {\n InetAddress addr = InetAddress.getByName(request.getRemoteAddr());\n\n if(addr.getCanonicalHostName().contains(\"trustme.com\")){ // disabled\n\n }\n }", "@Test\n public void testAliceAccess() throws IOException {\n HttpResponse response = makeRequest(\"http://localhost:8080/api/alice\", \"alice\", \"alice\");\n assertAccessGranted(response, \"alice\");\n\n // alice can not access information about jdoe\n response = makeRequest(\"http://localhost:8080/api/jdoe\", \"alice\", \"alice\");\n assertEquals(403, response.getStatusLine().getStatusCode());\n }", "@Test\n public void shouldGetMessage() {\n ResponseEntity<AppModel> response = restTemplate.getForEntity(format(\"%s?message=hello world\", BASE_URL), AppModel.class, \"\");\n assertEquals(OK, response.getStatusCode());\n }", "@Test\n\tpublic void testVersion() {\n\t\tassertEquals(\"HTTP/1.0\", myReply.getVersion());\n\t}", "@Test\n public void testAccountDelete() {\n Response response = webTarget\n .path(\"account/1\")\n .request(APPLICATION_JSON)\n .delete();\n assertThat(response.getStatus(), anyOf(is(200), is(202), is(204)));\n }", "@Test\n\tpublic void testScheduleAppointment() {\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\tHttpEntity<String> entity = new HttpEntity<String>(null, headers);\n\t\tResponseEntity<String> response = restTemplate.exchange(getRootUrl() + \"/app1\",HttpMethod.GET, entity, String.class);\n\t\tassertEquals(200, response.getStatusCodeValue());\n\t}", "@Test\n /**\n * Test to check that our WebSecurityConfig is effective.\n */\n public void testUnauthorizedListUsersTankRequest() throws Exception {\n String authToken = \"faked\";\n\n // when this authorized user requests his aquarium list\n HttpHeaders headers = new HttpHeaders();\n // headers.setContentType(MediaType.APPLICATION_JSON);\n headers.add(AUTH_TOKEN, TOKEN_PREFIX + authToken);\n\n HttpEntity<String> requestEntity = new HttpEntity<>(headers);\n ResponseEntity<String> responseEntity = restTemplate.exchange(\"/api/tank/list\", HttpMethod.GET, requestEntity, String.class);\n\n // then we should get a 401 as result.\n assertThat(responseEntity.getStatusCode(), equalTo(HttpStatus.UNAUTHORIZED));\n\n }", "@Test\n public void testConnectionWhenGoodLogs() {\n \tForm form = new Form();\n \tform.param(\"login\", \"user\");\n \tform.param(\"psw\", \"12345\");\n \t\n \tResponse connect = target.path(\"auth\").request().post(Entity.form(form));\n \tassertEquals(230,connect.getStatus());\n }", "@Given(\"^API Headers are set$\")\n public void apiHeadersAreSet(){\n\n myRequest.contentType(ContentType.JSON)\n .baseUri(\"http://10.4.10.105/api/v1/\")\n .header(\"Auth-token\",\"ec6effac-7b12-4021-ba80-c682169cff60\");\n\n }", "@Test\n public void getStatus_StatusIsGot_Passes() throws Exception {\n Assert.assertEquals(test1JsonResponse.getStatus(), test1status);\n }", "@Test\n\tpublic void verifyHeader() {\n\t\t\tHeaders head = response.getHeaders();\n\t\t\tAssert.assertEquals(head.getValues(\"Content-Type\").toString(), \"[application/json; charset=utf-8]\");\n\t\t}", "@Test(priority = 5)\n\tpublic void testGetAllClients1() {\n\t\tResponse response = given().header(\"Authorization\", token).when().get(URL).then().extract().response();\n\n\t\tassertTrue(response.getStatusCode() == 200);\n\t\tassertTrue(response.contentType().equals(\"application/json\"));\n\n\t\tgiven().header(\"Authorization\", token).when().get(URL).then().assertThat().body(\"name\",\n\t\t\t\thasSize(clients.size()));\n\t}", "@Test\n\tpublic void testEsempio() throws UnirestException {\n\t\tHttpResponse<String> response = Unirest.get(\"http://localhost:8080/TrackingVehicle/tracking/tracking/cercaveicolo/QWE123456\")\n\t\t\t\t .header(\"Cache-Control\", \"no-cache\")\n\t\t\t\t .header(\"Postman-Token\", \"b0269d33-a6e2-40f3-9c86-99b27e9ecaee\")\n\t\t\t\t .asString();\n\t}", "@Test\n public void GETProductService_ProductCall() {\n givenHeaders().\n when().\n get(_url_prodservice).//.body().prettyPrint();\n then().\n using().defaultParser(Parser.JSON).\n log().ifError().\n statusCode(200).\n body(\"response\", not(isEmptyString()));\n System.out.print(\"GETProductService_ProductCall Test Run Result\");\n }", "@Test\n\tpublic void listAllPaciente() throws JsonParseException, JsonMappingException, IOException {\n\n\t\tInteger count = 0;\n\t\tInteger id = 10000;\n\t\tRestTemplate restTemplate = new RestTemplate();\n\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.set(\"Header\", \"value\");\n\t\theaders.setContentType(MediaType.APPLICATION_JSON);\n\t\theaders.set(\"Other-Header\", \"othervalue\");\n\t\theaders.set(\"username\", \"[email protected]\");\n\n\t\tMap<String, String> params = new HashMap<String, String>();\n\t\tparams.put(\"username\", \"[email protected]\");\n\t\tparams.put(\"password\", \"[email protected]\");\n\n\t\tRestTemplate rest = new RestTemplate();\n\t\trest.setMessageConverters(Arrays.asList(new StringHttpMessageConverter(), new FormHttpMessageConverter()));\n\t\tMultiValueMap<String, String> paramss = new LinkedMultiValueMap<String, String>();\n\t\tparamss.set(\"username\", \"[email protected]\");\n\t\tparamss.set(\"password\", \"devil\");\n\t\tURI tgtUrl = rest.postForLocation(REST_SERVICE_URI + \"auth/api/authenticate\", paramss, Collections.emptyMap());\n\t\tSystem.out.println(\"[\" + tgtUrl + \"]\");\n\n\t\tSystem.out.println(\"[\" + tgtUrl + \"]\");\n\n\t\tResponseEntity<String> st = rest.postForEntity(REST_SERVICE_URI + \"auth/api/authenticate\", paramss,\n\t\t\t\tString.class);\n\t\tSystem.out.println(\"[\" + st.getBody() + \"]\");\n\t\tSystem.out.println(\"[\" + st + \"]\");\n\t\tString tk = st.getBody();\n\t\tClass<? extends String> mt = tk.getClass();\n\t\tSystem.out.println(\"[\" + mt + \"]\");\n\t\tObjectMapper mapper = new ObjectMapper();\n\t\tModelToken obj = mapper.readValue(st.getBody(), ModelToken.class);\n\n\t\tSystem.out.println(\"[\" + obj.getToken() + \"]\");\n\n\t\theaders = new HttpHeaders();\n\t\theaders.set(\"Header\", \"value\");\n\t\theaders.setContentType(MediaType.APPLICATION_JSON);\n\t\theaders.set(\"Other-Header\", \"othervalue\");\n\t\theaders.set(\"X-Auth-Token\", obj.getToken());\n\t\tString a = \"request:{pageSize: 20, startPage: 2, sortExpressions: null, preQueryCount: true, maxPreQueryCount: 0}, token:[email protected]:1469815365580:33f9281620d9dc7df079e056ad235420, url:pessoa/api/cfop/fetchPage/\";\n\t\tHttpEntity<String> entity = new HttpEntity<String>(\"{}\", headers);\n\n\t\t// =========== fetch\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================FetchALL==============================================\");\n\t\tString jsonInString = mapper.writeValueAsString(new PacienteInquiryRequest());\n\t\tSystem.out.println(jsonInString);\n\t\tHttpEntity<String> entitys = new HttpEntity<String>(jsonInString, headers);\n\t\tPacienteResponse result = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/paciente/fetchPage/\",\n\t\t\t\tentitys, PacienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\tcount = result.getPacienteList().size();\n\n\t\t// =========== Insert\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================INSERT==============================================\");\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertPaciente(id, TabelaEnum.PACIENTE, PersistenceActionEnum.INSERT));\n\t\tSystem.out.println(jsonInString);\n\t\tString requestJson = \"{\\\"paciente\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/paciente/insert/\", entitys,\n\t\t\t\tPacienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\n\t\t// =========== Update\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================UPDATE==============================================\");\n\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertPaciente(id, TabelaEnum.PACIENTE, PersistenceActionEnum.UPDATE));\n\t\trequestJson = \"{\\\"paciente\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/paciente/update/\", entitys,\n\t\t\t\tPacienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\n\t\t// =========== FetchbyID\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================FetchID==============================================\");\n\n\t\tPacienteInquiryRequest request001 = new PacienteInquiryRequest();\n\t\trequest001.setId(id);\n\t\tjsonInString = mapper.writeValueAsString(request001);\n\t\tSystem.out.println(jsonInString);\n\t\tentitys = new HttpEntity<String>(jsonInString, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/paciente/fetchPage/\", entitys,\n\t\t\t\tPacienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\t//Assert.assertEquals(result.getPacienteList().size(), 1);\n\n\t\t//Assert.assertEquals(result.getPacienteList().get(0).getNome(), \"nome_1 - UPDATE\");\n\t\t//Assert.assertEquals(result.getPacienteList().get(0).getNomePai(), \"nomePai_2 - UPDATE\");\n\t\t//Assert.assertEquals(result.getPacienteList().get(0).getNomeMae(), \"nomeMae_3 - UPDATE\");\n\t\t//Assert.assertEquals(result.getPacienteList().get(0).getNomeConjugue(), \"nomeConjugue_4 - UPDATE\");\n\t\t//Assert.assertEquals(result.getPacienteList().get(0).getFoto(), \"foto_8 - UPDATE\");\n\n\t\t// =======================\n\t\tSystem.out.println(\"==================================DELETE==============================================\");\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertPaciente(id, TabelaEnum.PACIENTE, PersistenceActionEnum.DELETE));\n\t\trequestJson = \"{\\\"paciente\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/paciente/delete/\", entitys,\n\t\t\t\tPacienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\t//Assert.assertEquals(result.getPacienteList().size(), count.intValue());\n\n\t}", "@Test\n\tpublic void listAllCliente() throws JsonParseException, JsonMappingException, IOException {\n\n\t\tInteger count = 0;\n\t\tInteger id = 10000;\n\t\tRestTemplate restTemplate = new RestTemplate();\n\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.set(\"Header\", \"value\");\n\t\theaders.setContentType(MediaType.APPLICATION_JSON);\n\t\theaders.set(\"Other-Header\", \"othervalue\");\n\t\theaders.set(\"username\", \"[email protected]\");\n\n\t\tMap<String, String> params = new HashMap<String, String>();\n\t\tparams.put(\"username\", \"[email protected]\");\n\t\tparams.put(\"password\", \"[email protected]\");\n\n\t\tRestTemplate rest = new RestTemplate();\n\t\trest.setMessageConverters(Arrays.asList(new StringHttpMessageConverter(), new FormHttpMessageConverter()));\n\t\tMultiValueMap<String, String> paramss = new LinkedMultiValueMap<String, String>();\n\t\tparamss.set(\"username\", \"[email protected]\");\n\t\tparamss.set(\"password\", \"devil\");\n\t\tURI tgtUrl = rest.postForLocation(REST_SERVICE_URI + \"auth/api/authenticate\", paramss, Collections.emptyMap());\n\t\tSystem.out.println(\"[\" + tgtUrl + \"]\");\n\n\t\tSystem.out.println(\"[\" + tgtUrl + \"]\");\n\n\t\tResponseEntity<String> st = rest.postForEntity(REST_SERVICE_URI + \"auth/api/authenticate\", paramss,\n\t\t\t\tString.class);\n\t\tSystem.out.println(\"[\" + st.getBody() + \"]\");\n\t\tSystem.out.println(\"[\" + st + \"]\");\n\t\tString tk = st.getBody();\n\t\tClass<? extends String> mt = tk.getClass();\n\t\tSystem.out.println(\"[\" + mt + \"]\");\n\t\tObjectMapper mapper = new ObjectMapper();\n\t\tModelToken obj = mapper.readValue(st.getBody(), ModelToken.class);\n\n\t\tSystem.out.println(\"[\" + obj.getToken() + \"]\");\n\n\t\theaders = new HttpHeaders();\n\t\theaders.set(\"Header\", \"value\");\n\t\theaders.setContentType(MediaType.APPLICATION_JSON);\n\t\theaders.set(\"Other-Header\", \"othervalue\");\n\t\theaders.set(\"X-Auth-Token\", obj.getToken());\n\t\tString a = \"request:{pageSize: 20, startPage: 2, sortExpressions: null, preQueryCount: true, maxPreQueryCount: 0}, token:[email protected]:1469815365580:33f9281620d9dc7df079e056ad235420, url:pessoa/api/cfop/fetchPage/\";\n\t\tHttpEntity<String> entity = new HttpEntity<String>(\"{}\", headers);\n\n\t\t// =========== fetch\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================FetchALL==============================================\");\n\t\tString jsonInString = mapper.writeValueAsString(new ClienteInquiryRequest());\n\t\tSystem.out.println(jsonInString);\n\t\tHttpEntity<String> entitys = new HttpEntity<String>(jsonInString, headers);\n\t\tClienteResponse result = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/cliente/fetchPage/\", entitys,\n\t\t\t\tClienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\tcount = result.getClienteList().size();\n\n\t\t// =========== Insert\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================INSERT==============================================\");\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertCliente(id, TabelaEnum.CLIENTE, PersistenceActionEnum.INSERT));\n\t\tSystem.out.println(jsonInString);\n\t\tString requestJson = \"{\\\"cliente\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/cliente/insert/\", entitys,\n\t\t\t\tClienteResponse.class);\n\t//\tAssert.assertEquals(result.isOperationSuccess(), true);\n\n\t\tSystem.out.println(\"==================================FetchALL==============================================\");\n\t\tjsonInString = mapper.writeValueAsString(new ClienteInquiryRequest());\n\t\tSystem.out.println(jsonInString);\n\t\tentitys = new HttpEntity<String>(jsonInString, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/cliente/fetchPage/\", entitys,\n\t\t\t\tClienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\tcount = result.getClienteList().size();\n\n\t\t// =========== Update\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================UPDATE==============================================\");\n\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertCliente(id, TabelaEnum.CLIENTE, PersistenceActionEnum.UPDATE));\n\t\trequestJson = \"{\\\"cliente\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/cliente/update/\", entitys,\n\t\t\t\tClienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\n\t\t// =========== FetchbyID\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================FetchID==============================================\");\n\n\t\tClienteInquiryRequest request001 = new ClienteInquiryRequest();\n\t\trequest001.setId(id);\n\t\tjsonInString = mapper.writeValueAsString(request001);\n\t\tSystem.out.println(jsonInString);\n\t\tentitys = new HttpEntity<String>(jsonInString, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/cliente/fetchPage/\", entitys,\n\t\t\t\tClienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\t//Assert.assertEquals(result.getClienteList().size(), 1);\n\n\t\t//Assert.assertEquals(result.getClienteList().get(0).getNome(), \"nome_1 - UPDATE\");\n\t\t//Assert.assertEquals(result.getClienteList().get(0).getNomePai(), \"nomePai_2 - UPDATE\");\n\t\t//Assert.assertEquals(result.getClienteList().get(0).getNomeMae(), \"nomeMae_3 - UPDATE\");\n\t\t//Assert.assertEquals(result.getClienteList().get(0).getNomeConjugue(), \"nomeConjugue_4 - UPDATE\");\n\t\t//Assert.assertEquals(result.getClienteList().get(0).getFoto(), \"foto_8 - UPDATE\");\n\n\t\t// =======================\n\t\tSystem.out.println(\"==================================DELETE==============================================\");\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertCliente(id, TabelaEnum.CLIENTE, PersistenceActionEnum.DELETE));\n\t\trequestJson = \"{\\\"cliente\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/cliente/delete/\", entitys,\n\t\t\t\tClienteResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\t//Assert.assertEquals(result.getClienteList().size(), count.intValue());\n\n\t}", "@DisplayName(\"Spartan /api/hello Endpoint Test\")\n @Test\n public void TestHello(){\n Response response = get(\"http://3.95.214.153:8000/api/hello\");\n\n // get status code out of this Response object\n System.out.println(\"response.statusCode() = \" + response.statusCode());//200\n\n // assert the status code is 200\n assertThat(response.statusCode(),is(200));\n\n // how to pretty print entire \"response body\"\n // prettyPrint() -- print and return the body as String\n String responseBodyAsString = response.prettyPrint();//print the body as a String\n\n System.out.println(\"==========================\");\n\n // assertThat the body is Hello from Sparta\n assertThat(responseBodyAsString,is(\"Hello from Sparta\"));\n\n // get the header called ContentType from the response\n //three ways of getting content-Type header in restAssure\n System.out.println(\"response.getHeader(\\\"Content-Type\\\") = \" + response.getHeader(\"Content-Type\"));//text/plain;charset=UTF-8 as String\n System.out.println(\"response.getContentType() = \" + response.getContentType());//text/plain;charset=UTF-8 as String\n System.out.println(\"response.contentType() = \" + response.contentType());//returns text/plain;charset=UTF-8 as String\n System.out.println(\"response.header(\\\"Content-Type\\\") = \" + response.header(\"Content-Type\"));//text/plain;charset=UTF-8\n\n\n // assert That Content-Type is text/plain;charset=UTF-8\n assertThat(response.contentType() , is(\"text/plain;charset=UTF-8\") );\n // assert That Content-Type startWith text\n assertThat(response.contentType(),startsWith(\"text\"));\n\n\n // Easy way to work with Content-type without typing much\n // We can use \"ContentType Enum\" from RestAssured to easily get \"main\" part content-type\n // ContentType.TEXT -->> returns text/plain as Enum(Object) not as String\n // startWith accept a String object\n // so use toString method to convert ContentType.TEXT to String so we can use it startWith\n //response.contentType() ===returns you String\n assertThat(response.contentType(),startsWith(ContentType.TEXT.toString()));// /api/hello end point returns us ONLY plain text\n\n assertThat(response.contentType() , is( not(ContentType.JSON) ) );//since end point does not return us JSON we can assert that this endpoint does not return JSON\n\n\n\n }", "@Test\n\tpublic void listAllFornecedor() throws JsonParseException, JsonMappingException, IOException {\n\n\t\tInteger count = 0;\n\t\tInteger id = 10000;\n\t\tRestTemplate restTemplate = new RestTemplate();\n\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.set(\"Header\", \"value\");\n\t\theaders.setContentType(MediaType.APPLICATION_JSON);\n\t\theaders.set(\"Other-Header\", \"othervalue\");\n\t\theaders.set(\"username\", \"[email protected]\");\n\n\t\tMap<String, String> params = new HashMap<String, String>();\n\t\tparams.put(\"username\", \"[email protected]\");\n\t\tparams.put(\"password\", \"[email protected]\");\n\n\t\tRestTemplate rest = new RestTemplate();\n\t\trest.setMessageConverters(Arrays.asList(new StringHttpMessageConverter(), new FormHttpMessageConverter()));\n\t\tMultiValueMap<String, String> paramss = new LinkedMultiValueMap<String, String>();\n\t\tparamss.set(\"username\", \"[email protected]\");\n\t\tparamss.set(\"password\", \"devil\");\n\t\tURI tgtUrl = rest.postForLocation(REST_SERVICE_URI + \"auth/api/authenticate\", paramss, Collections.emptyMap());\n\t\tSystem.out.println(\"[\" + tgtUrl + \"]\");\n\n\t\tSystem.out.println(\"[\" + tgtUrl + \"]\");\n\n\t\tResponseEntity<String> st = rest.postForEntity(REST_SERVICE_URI + \"auth/api/authenticate\", paramss,\n\t\t\t\tString.class);\n\t\tSystem.out.println(\"[\" + st.getBody() + \"]\");\n\t\tSystem.out.println(\"[\" + st + \"]\");\n\t\tString tk = st.getBody();\n\t\tClass<? extends String> mt = tk.getClass();\n\t\tSystem.out.println(\"[\" + mt + \"]\");\n\t\tObjectMapper mapper = new ObjectMapper();\n\t\tModelToken obj = mapper.readValue(st.getBody(), ModelToken.class);\n\n\t\tSystem.out.println(\"[\" + obj.getToken() + \"]\");\n\n\t\theaders = new HttpHeaders();\n\t\theaders.set(\"Header\", \"value\");\n\t\theaders.setContentType(MediaType.APPLICATION_JSON);\n\t\theaders.set(\"Other-Header\", \"othervalue\");\n\t\theaders.set(\"X-Auth-Token\", obj.getToken());\n\t\tString a = \"request:{pageSize: 20, startPage: 2, sortExpressions: null, preQueryCount: true, maxPreQueryCount: 0}, token:[email protected]:1469815365580:33f9281620d9dc7df079e056ad235420, url:pessoa/api/cfop/fetchPage/\";\n\t\tHttpEntity<String> entity = new HttpEntity<String>(\"{}\", headers);\n\n\t\t// =========== fetch\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================FetchALL==============================================\");\n\t\tString jsonInString = mapper.writeValueAsString(new FornecedorInquiryRequest());\n\t\tSystem.out.println(jsonInString);\n\t\tHttpEntity<String> entitys = new HttpEntity<String>(jsonInString, headers);\n\t\tFornecedorResponse result = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/fornecedor/fetchPage/\",\n\t\t\t\tentitys, FornecedorResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\tcount = result.getFornecedorList().size();\n\n\t\t// =========== Insert\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================INSERT==============================================\");\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertFornecedor(id, TabelaEnum.FORNECEDOR, PersistenceActionEnum.INSERT));\n\t\tSystem.out.println(jsonInString);\n\t\tString requestJson = \"{\\\"fornecedor\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/fornecedor/insert/\", entitys,\n\t\t\t\tFornecedorResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\n\t\t// =========== Update\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================UPDATE==============================================\");\n\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertFornecedor(id, TabelaEnum.FORNECEDOR, PersistenceActionEnum.UPDATE));\n\t\trequestJson = \"{\\\"fornecedor\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/fornecedor/update/\", entitys,\n\t\t\t\tFornecedorResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\n\t\t// =========== FetchbyID\n\t\t// ================================================================\n\t\tSystem.out.println(\"==================================FetchID==============================================\");\n\n\t\tFornecedorInquiryRequest request001 = new FornecedorInquiryRequest();\n\t\trequest001.setId(id);\n\t\tjsonInString = mapper.writeValueAsString(request001);\n\t\tSystem.out.println(jsonInString);\n\t\tentitys = new HttpEntity<String>(jsonInString, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/fornecedor/fetchPage/\", entitys,\n\t\t\t\tFornecedorResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\t//Assert.assertEquals(result.getFornecedorList().size(), 1);\n\n\t\t//Assert.assertEquals(result.getFornecedorList().get(0).getNome(), \"nome_1 - UPDATE\");\n\t\t//Assert.assertEquals(result.getFornecedorList().get(0).getNomePai(), \"nomePai_2 - UPDATE\");\n\t\t//Assert.assertEquals(result.getFornecedorList().get(0).getNomeMae(), \"nomeMae_3 - UPDATE\");\n\t\t//Assert.assertEquals(result.getFornecedorList().get(0).getNomeConjugue(), \"nomeConjugue_4 - UPDATE\");\n\t\t//Assert.assertEquals(result.getFornecedorList().get(0).getFoto(), \"foto_8 - UPDATE\");\n\n\t\t// =======================\n\t\tSystem.out.println(\"==================================DELETE==============================================\");\n\t\tjsonInString = mapper\n\t\t\t\t.writeValueAsString(Objects.insertFornecedor(id, TabelaEnum.FORNECEDOR, PersistenceActionEnum.DELETE));\n\t\trequestJson = \"{\\\"fornecedor\\\":\" + jsonInString + \"}\";\n\t\tentitys = new HttpEntity<String>(requestJson, headers);\n\t\tresult = restTemplate.postForObject(REST_SERVICE_URI + \"pessoa/api/fornecedor/delete/\", entitys,\n\t\t\t\tFornecedorResponse.class);\n\t\t//Assert.assertEquals(result.isOperationSuccess(), true);\n\t\t//Assert.assertEquals(result.getFornecedorList().size(), count.intValue());\n\n\t}", "@Test\n public void testExceptionThrown() throws Exception {\n final HttpResponse response = Request.Get(\"http://localhost:\" + httpPort.getValue() + CORS_EXCEPTION_ENDPOINT_PATH).addHeader(\"Origin\", CORS_DEFAULT_ORIGIN).execute().returnResponse();\n\n assertNotNull(\"Response should not be null\", response);\n\n //we should have an access control allow origin\n assertNotNull(\"Allowed origin should be present\", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN));\n }", "@Test\n public void testGetIt() {\n String responseMsg = target.path(\"myresource\").request().get(String.class);\n assertEquals(\"Got it!\", responseMsg);\n }", "@Test\n\tpublic void checkStatus() {\n\t\tclient.execute(\"1095C-16-111111\");\n\t}" ]
[ "0.6990167", "0.6845425", "0.66727465", "0.654138", "0.62786746", "0.6211294", "0.61422396", "0.61034095", "0.60768837", "0.6026654", "0.60249853", "0.6021717", "0.60205984", "0.5982409", "0.59256977", "0.59157264", "0.59077084", "0.58940667", "0.5861284", "0.5850688", "0.58299434", "0.582132", "0.580007", "0.57472366", "0.57257664", "0.5700734", "0.5698457", "0.5652464", "0.56451184", "0.56353813", "0.5632313", "0.5610755", "0.5599894", "0.5596115", "0.5590257", "0.5580778", "0.5570035", "0.5556768", "0.5549698", "0.5542441", "0.5530724", "0.5511352", "0.5504563", "0.54978377", "0.54932714", "0.54891425", "0.5483852", "0.54745406", "0.5459378", "0.54590803", "0.5452497", "0.5445907", "0.5436888", "0.54367745", "0.5427071", "0.5424818", "0.54232603", "0.54214096", "0.54109323", "0.54101443", "0.54089594", "0.5408061", "0.5408053", "0.5405341", "0.53839916", "0.5382379", "0.53803915", "0.53795284", "0.53784525", "0.53777856", "0.53746396", "0.5371496", "0.5368011", "0.5360389", "0.53602606", "0.53574216", "0.5355104", "0.53423786", "0.5339136", "0.5331449", "0.5326806", "0.5310574", "0.5308274", "0.53059244", "0.53016776", "0.53015333", "0.5290291", "0.5290053", "0.5283424", "0.5282437", "0.52800125", "0.5269992", "0.52677333", "0.5265646", "0.52648944", "0.5256993", "0.52515686", "0.52479714", "0.52401805", "0.5240104" ]
0.7663189
0
configure any origin some not allowed method even without preflight we should be allowed to access the resource
@Test public void testPublicResource() throws Exception { final HttpResponse response = Request.Post("http://localhost:" + httpPort.getValue() + CORS_PUBLIC_ENDPOINT_PATH).addHeader("Origin", "null").execute().returnResponse(); assertNotNull("Response should not be null", response); //allow origin should be * Header allowOrigin = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN); assertNotNull(allowOrigin); assertThat(allowOrigin.getValue(), equalTo("*")); assertThat(IOUtils.toString(response.getEntity().getContent()), equalTo(EXPECTED_RETURN)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testPreflight() throws Exception {\n final HttpResponse response = Request.Options(\"http://localhost:\" + httpPort.getValue() + CORS_CONFIGURED_ENDPOINT_PATH)\n .addHeader(\"Origin\", CORS_TEST_ORIGIN)\n .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_METHOD, \"GET\")\n .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_HEADERS, \"X-Allow-Origin\")\n .execute().returnResponse();\n\n Header allowOrigin = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN);\n Header allowMethods = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_METHODS);\n\n assertNotNull(allowOrigin);\n assertNotNull(allowMethods);\n assertThat(allowOrigin.getValue(), equalTo(CORS_TEST_ORIGIN));\n assertThat(allowMethods.getValue(), containsString(\"GET\"));\n assertThat(allowMethods.getValue(), containsString(\"PUT\"));\n }", "@Test\n void preFlightTestFromAllowedOrigin() {\n ResponseSpec response = client.options()\n .uri(BASE_GUESTBOOK_URL)\n .header(\"Access-Control-Request-Method\", \"GET\")\n .header(\"Origin\", \"http://allowed-origin.ca\")\n .exchange();\n\n response.expectHeader().valueEquals(\"Access-Control-Allow-Methods\", \"GET,POST\")\n .expectHeader().valueEquals(\"Access-Control-Allow-Origin\", \"http://allowed-origin.ca\");\n }", "@Test\n public void testDefaultOriginMethodNotAllowed() throws Exception {\n final HttpResponse response = Request.Post(\"http://localhost:\" + httpPort.getValue() + CORS_DEFAULT_ENDPOINT_PATH).addHeader(\"Origin\", CORS_DEFAULT_ORIGIN).execute().returnResponse();\n\n //a well behaved client should have sent a preflight\n //but we don't want to be well behaved\n assertNull(\"Allowed origin should NOT be present\", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN));\n\n //the payload should NOT be the expected response\n assertThat(IOUtils.toString(response.getEntity().getContent()), not(equalTo(EXPECTED_RETURN)));\n\n }", "private void setUpForCrossBrowser() {\n String origin = request.getHeader(\"Origin\");\n if (origin==null || origin.length()==0) {\n //this does not always work, but what else can we do?\n origin=\"*\";\n }\n response.setHeader(\"Access-Control-Allow-Origin\", origin);\n response.setHeader(\"Access-Control-Allow-Credentials\", \"true\");\n response.setHeader(\"Access-Control-Allow-Methods\", \"GET, POST, OPTIONS, PUT, DELETE\");\n response.setHeader(\"Access-Control-Allow-Headers\", \"Origin, X-Requested-With, Content-Type, Accept, Authorization, If-Modified-Since\");\n response.setHeader(\"Access-Control-Max-Age\", \"1\");\n response.setHeader(\"Vary\", \"*\");\n\n //default content type is JSON set it otherwise if you need something different\n response.setContentType(\"application/json; charset=utf-8\");\n }", "@Override\r\n\tprotected void doFilterInternal(HttpServletRequest request,\r\n\t\t\tHttpServletResponse response, FilterChain filterChain)\r\n\t\t\tthrows ServletException, IOException {\n\t\tString origin = request.getHeader(\"Origin\");\r\n\t\tif(null != origin && !\"\".equals(origin)){\r\n\t\t\tlogger.debug(\"跨域资源共享 解决前后端分离Access-Control-Allow-Origin:\"+origin+\"请求uri:\" + request.getRequestURI());\r\n\t\t\tresponse.addHeader(\"Access-Control-Allow-Origin\",origin);\r\n\t\t\tresponse.addHeader(\"Access-Control-Allow-Credentials\",\"true\");//允许携带cookie\r\n\t\t\tresponse.setHeader(\"Access-Control-Allow-Headers\", \"Content-Type,x-requested-with\");\r\n\t\t\tresponse.setHeader(\"Access-Control-Allow-Methods\", \"OPTIONS, GET, PUT, POST, DELETE\");\r\n\t\t\tif(request.getMethod().equals(RequestMethod.OPTIONS.name())){\r\n\t\t\t\tresponse.setStatus(200);\r\n\t\t\t\tresponse.setHeader(\"Access-Control-Max-Age\", \"86400\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t filterChain.doFilter(request,response);\r\n\t}", "@Test\n public void testDefaultOriginMethod() throws Exception {\n final HttpResponse response = Request.Get(\"http://localhost:\" + httpPort.getValue() + CORS_DEFAULT_ENDPOINT_PATH).addHeader(\"Origin\", CORS_DEFAULT_ORIGIN).execute().returnResponse();\n\n assertNotNull(\"Response should not be null\", response);\n\n //we should have an access control allow origin\n assertNotNull(\"Allowed origin should be present\", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN));\n assertThat(IOUtils.toString(response.getEntity().getContent()), equalTo(EXPECTED_RETURN));\n\n }", "private static void enableCORS(final String origin, final String methods, final String headers) {\n\n\t\toptions(\"/*\", (request, response) -> {\n\n\t\t\tString accessControlRequestHeaders = request.headers(\"Access-Control-Request-Headers\");\n\t\t\tif (accessControlRequestHeaders != null) {\n\t\t\t\tresponse.header(\"Access-Control-Allow-Headers\", accessControlRequestHeaders);\n\t\t\t}\n\t\t\tString accessControlRequestMethod = request.headers(\"Access-Control-Request-Method\");\n\t\t\tif (accessControlRequestMethod != null) {\n\t\t\t\tresponse.header(\"Access-Control-Allow-Methods\", accessControlRequestMethod);\n\t\t\t}\n\n\t\t\tresponse.header(\"Access-Control-Max-Age\", \"86400\");\n\n\t\t\treturn \"OK\";\n\t\t});\n\n\t\tbefore((request, response) -> {\n\t\t\tresponse.header(\"Access-Control-Allow-Origin\", origin);\n\t\t\tresponse.header(\"Access-Control-Request-Method\", methods);\n\t\t\tresponse.header(\"Access-Control-Allow-Headers\", headers);\n\t\t\t// Note: this may or may not be necessary in your particular application\n\t\t\tresponse.type(\"application/json\");\n\t\t});\n\t}", "private boolean isPreflight(HttpServletRequest request) {\n return request.getMethod().equals(\"OPTIONS\");\n }", "@Test\n public void testEmptyConfigPublicResource() throws Exception {\n final HttpResponse response = Request.Options(\"http://localhost:\" + httpPort.getValue() + CORS_PUBLIC_EMPTY_ENDPOINT_PATH).addHeader(\"Origin\", CORS_TEST_ORIGIN)\n .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_METHOD, \"GET\").execute().returnResponse();\n\n Header allowOrigin = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN);\n Header allowMethods = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_METHODS);\n\n assertNotNull(allowOrigin);\n assertThat(allowOrigin.getValue(), equalTo(\"*\"));\n }", "boolean getAllowCors();", "@Test\n void corsTestFromAllowedOrigin() {\n ResponseSpec response = client.get()\n .uri(BASE_GUESTBOOK_URL)\n .header(\"Origin\", \"http://allowed-origin.ca\")\n .exchange();\n\n // we should get our CORS access control header specifying all origins are allowed. If we'd specified a\n // specific set of allowed origins, we'd see that there.\n response.expectHeader()\n .valueEquals(\"Access-Control-Allow-Origin\", \"http://allowed-origin.ca\");\n }", "private void setAccessControlHeaders(HttpServletResponse response) {\r\n\t response.setHeader(\"Access-Control-Allow-Origin\", \"*\");\r\n\t response.setHeader(\"Access-Control-Allow-Methods\", \"GET, PUT, POST, DELETE\");\r\n\t }", "@Override\n\tpublic boolean preHandle(HttpServletRequest request,\n\t\t\tHttpServletResponse response, Object handler) throws Exception {\n response.addHeader(\"Access-Control-Allow-Origin\", \"*\");\n response.addHeader(\"Access-Control-Allow-Methods\", \"POST,GET\");\n response.addHeader(\"Access-Control-Allow-Credentials\", \"true\");\n response.addHeader(\"Access-Control-Allow-Headers\",\"x-requested-with,content-type\");\n\t\treturn true;\n\t}", "CorsHandler getCorsHandler();", "@Test(groups = { TestGroup.REST_API, TestGroup.SANITY, TestGroup.CORE})\n\tpublic void assertCORSisEnabledAndWorking()\n\t{\n\t\tString validOriginUrl = \"http://localhost:4200\";\n\t\tString invalidOriginUrl1 = \"http://localhost:4201\";\n\t\tString invalidOriginUrl2 = \"http://example.com\";\n\t\tRestAssured.basePath = \"alfresco/api/-default-/public/authentication/versions/1\";\n\t\trestClient.configureRequestSpec().setBasePath(RestAssured.basePath);\n\n\t\tRestRequest request = RestRequest.simpleRequest(HttpMethod.OPTIONS, \"tickets\");\n\n\t\t// Don't specify header Access-Control-Request-Method\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);\n\n\t\t// request not allowed method\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"PATCH\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);\n\n\t\t// request invalid method\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"invalid\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);\n\n\t\t// use invalidOriginUrl1 as origin\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"POST\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", invalidOriginUrl1);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);\n\n\t\t// use invalidOriginUrl2 as origin\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", invalidOriginUrl2);\n\t\trestClient.process(request);\n\t\trestClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);\n\n\t\t// use validOriginUrl\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"POST\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\t\trestClient.process(request);\n\n\t\trestClient.assertStatusCodeIs(HttpStatus.OK);\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Origin\", validOriginUrl);\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Credentials\", \"true\");\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Max-Age\", \"10\");\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Methods\", \"POST\");\n\t}", "@Override\n\t public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException\n\t {\n\t \t HttpServletRequest request = (HttpServletRequest) req;\n\t \t HttpServletResponse response = (HttpServletResponse) res;\n\n\t \t response.setHeader(\"Access-Control-Allow-Origin\", request.getHeader(\"Origin\"));\n\t \t response.setHeader(\"Access-Control-Allow-Credentials\", \"true\");\n\t \t response.setHeader(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, DELETE,PUT\");\n\t \t response.setHeader(\"Access-Control-Max-Age\", \"3600000\");\n\t \t response.setHeader(\"Access-Control-Allow-Headers\", \"Content-Type, Accept, X-Requested-With, remember-me, Authorization\");\n\n\t \t chain.doFilter(req, res);\n\t }", "@RequestMapping(value = \"/GatewayServicesUsersISoftProfile/**\", method = RequestMethod.OPTIONS)\n public void corsHeaders(HttpServletResponse response)\n {\n response.addHeader(\"Access-Control-Allow-Origin\", \"*\");\n //response.addHeader(\"Access-Control-Allow-Methods\", \"GET, POST, PUT, DELETE, OPTIONS\");\n response.addHeader(\"Access-Control-Allow-Methods\", \"GET, POST\");\n response.addHeader(\"Access-Control-Allow-Headers\", \"origin, content-type, accept, x-requested-with\");\n response.addHeader(\"Access-Control-Max-Age\", \"3600\");\n }", "@Override\n\tprotected boolean sameOriginDisabled() {\n\t\treturn true;\n\t}", "private boolean checkOrigin(InetSocketAddress remoteAddress, boolean isSecured) {\n try {\n if (GlobalSettingsAndNotifier.singleton.getSetting(\"RESTRICT_SECURE\").equals(\"true\") && !isSecured) {\n return false;\n }\n String mode = GlobalSettingsAndNotifier.singleton.getSetting(\"NET_ORIGIN\");\n if (mode.equals(\"NO_RESTRICTIONS\")) {\n return true;\n }\n String a = remoteAddress.getAddress().toString().split(\"/\")[1];\n String add = a.split(\":\")[0];\n if (add == null) {\n add = a;\n }\n System.out.println(add);\n String[] parts = null;\n if (add.contains(\"-\")) {\n\n parts = add.split(\"-\");\n }\n if (add.contains('.' + \"\")) {\n\n parts = add.split(\"\\\\.\");\n }\n\n if (parts == null) {\n\n return false;\n }\n if (parts.length != 4) {\n\n return false;\n }\n final int[] remote = new int[]{Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3])};\n if (mode.equals(\"RESTRICT_LAN\")) {\n return networkAddressRange.isOnLAN(remote);\n }\n Iterator<networkAddressRange> inar = GlobalSettingsAndNotifier.singleton.permited.iterator();\n System.out.println(\"NrOf rules \" + GlobalSettingsAndNotifier.singleton.permited.size());\n while (inar.hasNext()) {\n\n networkAddressRange n = inar.next();\n System.out.println(\"Check\" + n.getNetworkForHumans());\n n.getAction();\n switch (n.isAllowed(new int[]{Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3])}, isSecured)) {\n case 1:\n return true;\n case -1:\n return false;\n\n }\n }\n } catch (Exception ex) {\n System.out.println(ex.toString());\n\n }\n\n if (GlobalSettingsAndNotifier.singleton.getSetting(\"IMPLICIT_ALLOW\").equalsIgnoreCase(\"true\")) {\n\n return true;\n }\n\n return false;\n }", "protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException \r\n\t{\n ((HttpServletResponse) response).addHeader(\"Access-Control-Allow-Origin\", \"*\");\r\n \r\n //TODO: create update option\r\n\t}", "Set<HttpMethod> optionsForAllow(URI url) throws RestClientException;", "@Override\n public void addCorsMappings(CorsRegistry registry) {\n registry.addMapping(\"/**\")\n// .allowedOrigins(\"*\")\n .allowedOriginPatterns(\"*\") // Since Spring Boot 2.4.0\n .allowedMethods(\"*\")\n .allowedHeaders(\"*\")\n .allowCredentials(true)\n .maxAge(3600L);\n }", "@Test(groups = { TestGroup.REST_API, TestGroup.SANITY, TestGroup.CORE})\n\tpublic void assertCORSisEnabledAndWorkingForDiscovery()\n\t{\n\t\tString validOriginUrl = \"http://localhost:4200\";\n\t\tRestAssured.basePath = \"alfresco/api\";\n\t\trestClient.configureRequestSpec().setBasePath(RestAssured.basePath);\n\n\t\tRestRequest request = RestRequest.simpleRequest(HttpMethod.GET, \"discovery\");\n\n\t\t// use validOriginUrl\n\t\trestClient.configureRequestSpec().addHeader(\"Access-Control-Request-Method\", \"GET\");\n\t\trestClient.configureRequestSpec().addHeader(\"Origin\", validOriginUrl);\n\n\t\tUserModel userModel = dataUser.createRandomTestUser();\n\t\trestClient.authenticateUser(userModel).process(request);\n\n\t\trestClient.assertStatusCodeIs(HttpStatus.OK);\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Origin\", validOriginUrl);\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Allow-Credentials\", \"true\");\n\t\trestClient.assertHeaderValueContains(\"Access-Control-Expose-Headers\", \"Access-Control-Allow-Origin,Access-Control-Allow-Credentials\");\n\t}", "@Override\n\tpublic void invoke(String origin, boolean allow, boolean remember) {\n\t\t\n\t}", "@Override\n protected void configure(HttpSecurity http) throws Exception {\n\n http.cors().configurationSource(request -> new CorsConfiguration().applyPermitDefaultValues())\n .and().csrf().disable()\n .authorizeRequests()\n .antMatchers(HttpMethod.GET, Security.SING_UP_URL).permitAll()\n .and()\n .addFilter(new JWTAuthenticationFilter(authenticationManager()))\n .addFilter(new JWTAuthorizationFilter(authenticationManager(), userService));\n }", "@Test // SPR-11443\n\tvoid handleInfoGetCorsFilter() {\n\t\tthis.servletResponse.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, \"foobar:123\");\n\n\t\thandleRequest(\"GET\", \"/echo/info\", HttpStatus.OK);\n\n\t\tassertThat(this.servletResponse.getHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)).isEqualTo(\"foobar:123\");\n\t}", "@Bean\n\tCorsConfigurationSource corsConfigurationSource() {\n\t\tCorsConfiguration config = new CorsConfiguration();\n\t\tconfig.addAllowedOrigin(\"http://127.0.0.1:5000\");\n\t\t\n\t\tconfig.addAllowedMethod(\"HEAD\");\n\t\tconfig.addAllowedMethod(\"PUT\");\n\t\tconfig.addAllowedMethod(\"POST\");\n\t\tconfig.addAllowedMethod(\"DELETE\");\n\t\tconfig.addAllowedMethod(\"GET\");\n\t\tconfig.addAllowedMethod(\"PATCH\");\n\t\t\n\t\tconfig.addAllowedOrigin(\"*\");\n\t\tconfig.addAllowedHeader(\"*\");\n\t\t\n\t\tconfig.setAllowCredentials(true);\n\t\t\n\t\tconfig.setAllowedHeaders(Arrays.asList(\"Accept\", \"Authorization\", \"Cache-Control\", \"Content-Type\"));\n\t\t\n\t\tconfig.setExposedHeaders(Arrays.asList(\"Accept\", \"accept\", \"Authorization\", \"authorization\"));\n\t\t\n\t\tUrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n\t\tsource.registerCorsConfiguration(\"/**\", config);\n\t\treturn source;\n\t}", "@Test\n public void test_option_with_cors_headers() throws Exception {\n mockMvc.perform(options(\"/users\")).andExpect(header().string(\"Access-Control-Allow-Origin\", \"*\"))\n .andExpect(header().string(\"Access-Control-Allow-Methods\", \"POST, GET, PUT, OPTIONS, DELETE\"))\n .andExpect(header().string(\"Access-Control-Allow-Headers\", \"*\"))\n .andExpect(header().string(\"Access-Control-Max-Age\", \"3600\"));\n }", "@Override\n public void addCorsMappings(CorsRegistry registry) {\n registry.addMapping(\"/**\").allowedOrigins(\"*\").allowedHeaders(\"*\").allowedMethods(\"*\");\n }", "public DefaultCorsPolicy(Set<String> allowOrigin,\n Boolean allowCredentials,\n Set<String> exposeHeaders,\n int maxAge,\n Set<String> allowMethods,\n Set<String> allowHeaders) {\n this.allowOrigin = allowOrigin;\n this.allowCredentials = allowCredentials;\n this.exposeHeaders = exposeHeaders;\n this.maxAge = maxAge;\n setAllowMethods(allowMethods);\n this.allowHeaders = allowHeaders;\n }", "@Override\n\tpublic void addCorsMappings(CorsRegistry registry) {\n\t\tregistry.addMapping(\"/**\")// 设置允许跨域的路径\n\t\t\t\t.allowedOrigins(\"*\")// 设置允许跨域请求的域名\n\t\t\t\t.allowCredentials(true)// 是否允许证书 不再默认开启\n\t\t\t\t.allowedMethods(\"GET\", \"POST\", \"PUT\", \"DELETE\")// 设置允许的方法\n\t\t\t\t.maxAge(3600);// 跨域允许时间\n\t}", "String decideResponseOriginHeader(List<String> allowed, String origin) {\n\t\tif (allowed == null || allowed.isEmpty()) {\n\t\t\treturn null;\n\t\t}\n\t\tif (allowed.contains(\"*\")) {\n\t\t\treturn \"*\";\n\t\t}\n\t\tif (allowed.contains(origin)) {\n\t\t\treturn origin;\n\t\t}\n\t\treturn null;\n\t}", "@Override\n\tpublic void addCorsMappings(CorsRegistry registry) {\n\t\tregistry.addMapping(\"/**\")\n\t\t\t\t.allowedOrigins(\"http://localhost:4200\")\n\t\t\t\t.allowedMethods(\"GET\", \"POST\", \"PUT\", \"DELETE\")\n\t\t\t\t.allowCredentials(true);\n\t}", "@Bean\n public CorsFilter corsFilter() {\n\n CorsConfiguration corsConfiguration = new CorsConfiguration();\n corsConfiguration.addAllowedOrigin(\"*\");\n corsConfiguration.addAllowedHeader(\"*\");\n corsConfiguration.addAllowedMethod(\"*\");\n\n\t UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n source.registerCorsConfiguration(\"/**\", corsConfiguration);\n return new CorsFilter(source);\n }", "@Override\n\tpublic void addCorsMappings(CorsRegistry registry) {\n\t\tregistry.addMapping(\"/**\").allowedMethods(\"GET\", \"POST\", \"PUT\", \"DELETE\",\"PATCH\").allowedOrigins(\"*\")\n .allowedHeaders(\"*\");\n\t}", "@Bean\n CorsConfigurationSource corsConfigurationSource() {\n final CorsConfiguration configuration = new CorsConfiguration();\n configuration.setAllowedOrigins(Collections.singletonList(\"http://localhost:4200\"));\n configuration.setAllowedMethods(Collections.singletonList(ALL));\n configuration.setAllowedHeaders(Collections.singletonList(ALL));\n configuration.setAllowCredentials(true);\n configuration.setExposedHeaders(Arrays.asList(\"token\", \"Set-Cookie\", \"Access-Control-Allow-Origin\"));\n final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n source.registerCorsConfiguration(\"/**\", configuration);\n return source;\n }", "@Bean\n\tprotected CorsConfigurationSource corsConfigurationSource() {\n\t\tCorsConfiguration configuration = new CorsConfiguration().applyPermitDefaultValues();\n\t final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n\t configuration.setAllowedMethods(Arrays.asList(\"POST\",\"GET\",\"PUT\",\"DELETE\",\"OPTIONS\"));\n\t //o método applyPermitDefaultValues() não inclui os métodos PUT, DELETE e OPTIONS do html.\n\t source.registerCorsConfiguration(\"/**\", configuration);\n\t return source;\n\t }", "private void createDelegate() throws ServletException {\n if (enabled == null || !enabled) {\n log.info(\"CORS support is disabled.\");\n return;\n }\n\n // Get the allowed origins from the backend configuration:\n final String allowedOriginsConfig = (String) getBackendParameter(ConfigValues.CORSAllowedOrigins);\n final Set<String> allowedDefaultOrigins = getDefaultAllowedOrigins();\n final String allowedOrigins = mergeOrigins(allowedOriginsConfig, allowedDefaultOrigins);\n if (StringUtils.isEmpty(allowedOrigins)) {\n log.warn(\n \"The CORS support has been enabled, but the list of allowed origins is empty. This means that CORS \" +\n \"support will actually be disabled.\"\n );\n return;\n }\n log.info(\"CORS support is enabled for origins \\\"{}\\\".\", allowedOrigins);\n\n if (delegate == null || !allowedDefaultOrigins.equals(oldAllowedOrigins)) {\n // Create new CORSFilter() only if needed\n oldAllowedOrigins = allowedDefaultOrigins;\n\n // Populate the parameters for the delegate:\n final Map<String, String> parameters = new HashMap<>();\n parameters.put(CORSFilter.PARAM_CORS_ALLOWED_METHODS, \"GET,POST,PUT,DELETE\");\n parameters.put(CORSFilter.PARAM_CORS_ALLOWED_HEADERS, \"Accept,Authorization,Content-Type\");\n parameters.put(CORSFilter.PARAM_CORS_ALLOWED_ORIGINS, allowedOrigins);\n\n // Add all the parameters of this filter to those passed to the delegate, so that the user can override the\n // configuration modifying the web.xml file:\n final Enumeration<String> names = config.getInitParameterNames();\n while (names.hasMoreElements()) {\n final String name = names.nextElement();\n final String value = config.getInitParameter(name);\n parameters.put(name, value);\n }\n\n // Create the delegate and initialize with the prepared parameters:\n delegate = new CORSFilter();\n delegate.init(\n new FilterConfig() {\n @Override\n public String getFilterName() {\n return config.getFilterName();\n }\n\n @Override\n public ServletContext getServletContext() {\n return config.getServletContext();\n }\n\n @Override\n public String getInitParameter(String name) {\n return parameters.get(name);\n }\n\n @Override\n public Enumeration<String> getInitParameterNames() {\n return Collections.enumeration(parameters.keySet());\n }\n }\n );\n }\n }", "public void setOrigin(String origin) {\n this.origin = origin;\n }", "public void setOrigin(String origin) {\n this.origin = origin;\n }", "public void setCrossOriginResourceSharing(boolean enable) {\n\t\tenableCrossOriginResourceSharing = enable;\n\t}", "@Override\n public void configure(AuthorizationServerSecurityConfigurer security) {\n //allow send client_id and client_secret in params\n //otherwise headers:{Authorization: 'Basic client_id:client_secret in base64}\n security.allowFormAuthenticationForClients();\n security.checkTokenAccess(\"isAuthenticated()\");\n// security.checkTokenAccess(\"permitAll()\");\n }", "@Override\n\tprotected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)\n\t\t\tthrows ServletException, IOException {\n\t\tresponse.addHeader(\"Access-Control-Allow-Origin\", \"*\");\n\t\tresponse.addHeader(\"Access-Control-Allow-Headers\", \n\t\t\t\t\"Origin, Accept, X-Requested-With, Content-Type,\"\n\t\t\t\t+ \"Access-Control-Request-Method, \"\n\t\t\t\t+ \"Access-Control-Request- Headers,\"\n\t\t\t\t+ \"Authorization\");\n\t\t\n\t\tresponse.addHeader(\"Access-Control-Expose-Headers\", \"Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Authorization\");\n\t\t \n\t\t//Verifier si le token exist dans la requette header et le prefix \n\t\tString jwt = request.getHeader(SecurityConstants.HEADER_STRING);\n\t\tSystem.out.println(jwt);\n\t\tif(request.getMethod().equals(\"OPTIONS\")) {\n\t\t\tresponse.setStatus(HttpServletResponse.SC_OK);\n\t\t} \n\t\telse {\n\t\t\tif(jwt == null || !jwt.startsWith(SecurityConstants.TOKEN_PREFIX)) {\n\t\t\t\tfilterChain.doFilter(request, response);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tClaims claims = Jwts.parser()\n\t\t\t\t.setSigningKey(SecurityConstants.SECRET)\n\t\t\t\t.parseClaimsJws(jwt.replace(SecurityConstants.TOKEN_PREFIX, \"\"))\n\t\t\t\t.getBody();\n\t\t\t\t\n\t\t\t\t// Subject contient le username a recuperer\n\t\t\t\tString username = claims.getSubject();\n\t\t\t\tArrayList<Map<String, String>> roles = (ArrayList<Map<String, String>>) claims.get(\"roles\");\n\t\t\t\t//auhorities define le role de l'utilisateur \n\t\t\t\tCollection<GrantedAuthority> authorities = new ArrayList<>();\n\t\t\t\troles.forEach(r -> {\n\t\t\t\tauthorities.add(new SimpleGrantedAuthority(r.get(\"authority\")));\t\t\n\t\t\t\t});\n\t\t\t\t//Recuperer l'identité de l'utilisateur qui a envoyer la requette \n\t\t\t\tUsernamePasswordAuthenticationToken authenticateUser = \n\t\t\t\t\t\tnew UsernamePasswordAuthenticationToken(username , null, authorities);\n\t\t\t\t\t\tSecurityContextHolder.getContext().setAuthentication(authenticateUser);\n\t\t\t\t\t\tfilterChain.doFilter(request, response);\t\t\t\t\t\n\t\t}\n\t\t\n\t}", "@Override\r\n public void configure(WebSecurity web) throws Exception {\r\n web.ignoring().antMatchers(HttpMethod.OPTIONS, \"/**\");\r\n }", "Origins(String origin){\n\t\tthis.origin = origin;\n\t}", "@java.lang.Override\n public boolean hasOrigin() {\n return origin_ != null;\n }", "@java.lang.Override\n public boolean hasOrigin() {\n return origin_ != null;\n }", "@Override\n\tpublic void addCorsMappings(CorsRegistry registry) {\n\t\tregistry.addMapping(\"/**\").allowedMethods(\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\");\n\t}", "@Override\n public void addCorsMappings(CorsRegistry registry) {\n registry.addMapping(\"/**\")\n .allowedMethods(\"GET\", \"POST\");\n }", "@Override\n protected void configure(HttpSecurity http) throws Exception {\n\n http.csrf().disable().cors().and().authorizeRequests().anyRequest().authenticated().and().httpBasic(); //csrf().disable()\n\n }", "public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {\n\n HttpServletResponse response = (HttpServletResponse) res;\n response.setHeader(\"Access-Control-Allow-Origin\", \"*\");\n response.setHeader(\"Access-Control-Allow-Methods\", \"POST, GET, PUT, OPTIONS, DELETE\");\n response.setHeader(\"Access-Control-Max-Age\", \"3600\");\n response.setHeader(\"Access-Control-Allow-Headers\", \"x-requested-with\");\n chain.doFilter(req, res);\n }", "public CorsPolicy corsPolicy() {\n return this.corsPolicy;\n }", "protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException \r\n\t{\n ((HttpServletResponse) response).addHeader(\"Access-Control-Allow-Origin\", \"*\");\r\n \r\n //TODO: create delete option\r\n\t}", "private static void hackRequestForSwitchingInsecureScheme() {\n// Logger.debug(\"SCOPE -> hackRequestForSwitchingInsecureScheme\");\n Http.Request.current().secure = false;\n hackRequestPort();\n }", "private void authorize() {\r\n\r\n\t}", "@Override\n public void onRequestAllow(String permissionName) {\n }", "default void setAcceptedOrigins(List<String> origins) {\n acceptedOrigins.clear();\n acceptedOrigins.addAll(origins);\n }", "public void test1(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {\n InetAddress addr = InetAddress.getByName(request.getRemoteAddr());\n\n if(addr.getCanonicalHostName().contains(\"trustme.com\")){ // disabled\n\n }\n }", "public ServerName getOrigin() {\n return origin;\n }", "@Override\n\tpublic void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)\n\t\t\tthrows IOException, ServletException {\n\t\tHttpServletRequest request = (HttpServletRequest) req;\n\t\t// Solo se interceptan las peticiones de tipo GET, POST, UPDATE o DELETE\n\t\t// ya que los navegadores pueden utilizar OPTIONS u otro tipo de peticion para\n\t\t// verificar el estado del servicio\n\t\tString metodo = request.getMethod().toUpperCase();\n\t\t\n\t\t\n\t\tif (metodo.equals(\"GET\") || metodo.equals(\"POST\") || metodo.equals(\"PUT\") || metodo.equals(\"UPDATE\")\n\t\t\t|| metodo.equals(\"DELETE\")) {\n\t\t\n\t\t\t//TODO logica para bloqueo de peticiones por IP's\n\t\t\tLong peticiones = seguridadControlService.contarPorIpYRangoFecha(req.getRemoteAddr(), new Date(System.currentTimeMillis() - 300 * 1000), new Date());\n\t\t\tSeguridadControl seg = new SeguridadControl();\n\t\t\tseg.setFecha(new Date());\n\t\t\tseg.setIp(req.getRemoteAddr());\n\t\t\tseguridadControlService.guardarRegistro(seg);\n\t\t\n\t\t\tif (validarEInyectarAutorizacion(request)) {\n\t\t\t\tchain.doFilter(req, res);\n\t\t\t} else {\n\t\t\t\tHttpServletResponse response = (HttpServletResponse) res;\n\t\t\t\tresponse.sendError(FORBIDDEN, \"No permitido, autenticación inválida\");\t\t\t\t\n\t\t\t}\n\t\t} else {\n\t\t\tchain.doFilter(req, res);\n\t\t}\n\t}", "Set<HttpMethod> optionsForAllow(String url, Object... uriVariables) throws RestClientException;", "@Override\n public void configure(final WebSecurity web) throws Exception {\n web.ignoring()\n .antMatchers(HttpMethod.OPTIONS, \"/**\")\n .antMatchers(HttpMethod.POST, \"/api/v1/user\")\n .antMatchers(HttpMethod.GET, \"/api/v1/*/public**\")\n .antMatchers(HttpMethod.GET, \"/api/v1/*/public/**\");\n }", "private static void hackRequestForSwitchingSecureScheme() {\n// Logger.debug(\"SCOPE -> hackRequestForSwitchingSecureScheme\");\n Http.Request.current().secure = true;\n hackRequestPort();\n }", "private String calculateAllowHeaders(Map<String, String> queryHeaders) {\n\t\t\treturn System.getProperty(ACCESS_CONTROL_ALLOW_HEADER_PROPERTY_NAME,\n\t\t\t\t\tDEFAULT_ALLOWED_HEADERS);\n\t\t}", "public CorsRules cors() {\n return this.cors;\n }", "@Override\n public void registerStompEndpoints(StompEndpointRegistry registry) {\n registry.addEndpoint(\"/ws\")\n .setAllowedOrigins(\"*\");\n }", "@Override\r\n\tprotected ResponseEntity<Object> handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException ex,\r\n\t\t\tHttpHeaders headers, HttpStatus status, WebRequest request) {\n\t\treturn super.handleHttpRequestMethodNotSupported(ex, headers, status, request);\r\n\t}", "public void setAllow(Set<HttpMethod> allowedMethods)\r\n/* 132: */ {\r\n/* 133:200 */ set(\"Allow\", StringUtils.collectionToCommaDelimitedString(allowedMethods));\r\n/* 134: */ }", "@Override\n\tpublic void authorize(String resourceName, String action, String rpcName)\n\t\t\tthrows Exception {\n\t}", "@Override\n protected Representation options() throws ResourceException {\n System.out.println(\"The OPTIONS method of root resource was invoked.\");\n throw new RuntimeException(\"Not yet implemented\");\n }", "@Override\n\t public void configure(WebSecurity web) {\n\t web.httpFirewall(allowUrlEncodedSlashHttpFirewall());\n\t }", "@Bean\n\tpublic WebMvcConfigurer corsConfigurer() {\n\t\treturn new WebMvcConfigurerAdapter() {\n\t\t\t@Override\n\t\t\tpublic void addCorsMappings(CorsRegistry registry) {\n\n\t\t\t\tif (StringUtils.isBlank(reactAppPath)) {\n\t\t\t\t\treturn; // provides no access to a front end tool if the property is not set\n\t\t\t\t}\n\n\t\t\t\tregistry\n\t\t\t\t\t\t.addMapping(\"/**\")\n//\t\t\t\t\t\t.allowedOrigins(reactAppPath) // since I proxied react this breaks it\n\t\t\t\t\t\t.allowedMethods(\"GET\", \"POST\", \"PUT\", \"DELETE\");\n\t\t\t}\n\t\t};\n\t}", "private void setProxySpecificHeaders(HttpMethod method, HttpServletRequest request) throws HttpException {\n String serverHostName = \"jEasyExtensibleProxy\";\n try {\n serverHostName = InetAddress.getLocalHost().getHostName(); \n } catch (UnknownHostException e) {\n log.error(\"Couldn't get the hostname needed for headers x-forwarded-server and Via\", e);\n }\n \n String originalVia = request.getHeader(\"via\");\n StringBuffer via = new StringBuffer(\"\");\n if (originalVia != null) {\n if (originalVia.indexOf(serverHostName) != -1) {\n log.error(\"This proxy has already handled the request, will abort.\");\n throw new HttpException(\"Request has a cyclic dependency on this proxy.\");\n }\n via.append(originalVia).append(\", \");\n }\n via.append(request.getProtocol()).append(\" \").append(serverHostName);\n \n method.setRequestHeader(\"via\", via.toString());\n method.setRequestHeader(\"x-forwarded-for\", request.getRemoteAddr()); \n method.setRequestHeader(\"x-forwarded-host\", request.getServerName());\n method.setRequestHeader(\"x-forwarded-server\", serverHostName);\n \n method.setRequestHeader(\"accept-encoding\", \"\");\n }", "@Override\n public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {\n\n if (((HttpServletRequest) servletRequest).getRequestURI().contains(\"favicon.ico\")) {\n ((HttpServletResponse) servletResponse).setStatus(404);\n servletResponse.getWriter().close();\n }\n\n // These headers allow CORS requests.\n ((HttpServletResponse) servletResponse).addHeader(\"Access-Control-Allow-Origin\", \"*\");\n ((HttpServletResponse) servletResponse).addHeader(\"Access-Control-Allow-Headers\", \"Origin, X-Requested-With, Content-Type, Accept, x-Authentication\");\n ((HttpServletResponse) servletResponse).addHeader(\"Server\", \"Whitespell Server\");\n //((HttpServletResponse) servletResponse).addHeader(\"WWW-Authenticate\", \"Basic realm=\\\"0\\\"\");\n servletResponse.setContentType(\"application/json\");\n filterChain.doFilter(servletRequest, servletResponse);\n }", "@Bean\n CorsConfigurationSource corsConfigurationSource() {\n final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n source.registerCorsConfiguration(\"/**\", new CorsConfiguration().applyPermitDefaultValues());\n return source;\n }", "public void addCorsMappings(CorsRegistry registry) {\n registry.addMapping(\"/**\")\n .allowedOrigins(\"*\")\n .allowedMethods(\"GET\", \"POST\", \"PUT\", \"DELETE\");\n\n }", "@Bean\n CorsConfigurationSource corsConfigurationSource() {\n final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n\n CorsConfiguration corsConfiguration = new CorsConfiguration().applyPermitDefaultValues();\n source.registerCorsConfiguration(\"/**\", corsConfiguration);\n\n return source;\n }", "public void test5(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {\n InetAddress addr = InetAddress.getByName(request.getRemoteAddr());\n if(addr.getCanonicalHostName().matches(\"trustme.com\")){ // disabled\n\n }\n }", "@Override\n protected void configure(HttpSecurity httpSecurity) throws Exception {\n httpSecurity.cors().configurationSource(request -> {\n var cors = new CorsConfiguration();\n cors.setAllowedOrigins(List.of(\"*\"));\n cors.setAllowedMethods(List.of(\"GET\",\"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"));\n cors.setAllowedHeaders(List.of(\"*\"));\n return cors;\n })\n .and()\n .csrf()\n .disable()\n .authorizeRequests()\n .antMatchers(DOCS_WHITELIST).permitAll()\n\n .antMatchers(HttpMethod.POST, jwtConfig.getUri() + \"/login\").permitAll()\n\n .antMatchers(HttpMethod.POST, \"/users/**\").permitAll()\n .antMatchers(HttpMethod.GET, \"/users/me/\").permitAll()\n .antMatchers(HttpMethod.GET, \"/users/**\").hasAnyRole(\"USER\", \"MODERATOR\", \"ADMIN\")\n .antMatchers(HttpMethod.DELETE, \"/users/**\").hasAnyRole(\"ADMIN\")\n .antMatchers(HttpMethod.PUT, \"/users/{userId}/\").hasAnyRole(\"ADMIN\")\n\n .antMatchers(\"/rooms/{roomId}/reservations/\").permitAll()\n\n .antMatchers(HttpMethod.GET, \"/buildings/**\").hasAnyRole(\"USER\", \"MODERATOR\", \"ADMIN\")\n .antMatchers(HttpMethod.POST,\"/buildings/**\").hasAnyRole(\"ADMIN\", \"MODERATOR\")\n .antMatchers(HttpMethod.PUT,\"/buildings/**\").hasAnyRole(\"ADMIN\", \"MODERATOR\")\n .antMatchers(HttpMethod.DELETE, \"/buildings/**\").hasRole(\"ADMIN\")\n\n .antMatchers(HttpMethod.GET, \"/rooms/**\").hasAnyRole(\"USER\", \"MODERATOR\", \"ADMIN\")\n .antMatchers(HttpMethod.POST,\"/rooms/**\").hasAnyRole(\"ADMIN\", \"MODERATOR\")\n .antMatchers(HttpMethod.PUT,\"/rooms/**\").hasAnyRole(\"ADMIN\", \"MODERATOR\")\n .antMatchers(HttpMethod.DELETE, \"/rooms/**\").hasRole(\"ADMIN\")\n\n .antMatchers(HttpMethod.GET, \"/sections/**\").hasAnyRole(\"USER\", \"MODERATOR\", \"ADMIN\")\n .antMatchers(HttpMethod.POST,\"/sections/**\").hasAnyRole(\"ADMIN\", \"MODERATOR\")\n .antMatchers(HttpMethod.PUT,\"/sections/**\").hasAnyRole(\"ADMIN\", \"MODERATOR\")\n .antMatchers(HttpMethod.DELETE, \"/sections/**\").hasRole(\"ADMIN\")\n\n .antMatchers(\"/admin/**\").hasRole(\"ADMIN\")\n\n .anyRequest()\n .authenticated()\n .and()\n .exceptionHandling()\n .authenticationEntryPoint(\n (req, res, e) -> {\n res.setContentType(\"application/json\");\n res.setStatus(HttpServletResponse.SC_UNAUTHORIZED);\n res.getOutputStream().println(\"{ \\\"message\\\": \\\"Brukernavn eller passord er feil\\\"}\");\n })\n .and()\n .addFilter(new JWTUsernamePasswordAuthenticationFilter(refreshTokenService, authenticationManager(), jwtConfig))\n .addFilterAfter(new JWTAuthenticationFilter(jwtConfig, jwtUtil, userDetailsService), UsernamePasswordAuthenticationFilter.class)\n .sessionManagement()\n .sessionCreationPolicy(SessionCreationPolicy.STATELESS);\n }", "@Test\n public void testExceptionThrown() throws Exception {\n final HttpResponse response = Request.Get(\"http://localhost:\" + httpPort.getValue() + CORS_EXCEPTION_ENDPOINT_PATH).addHeader(\"Origin\", CORS_DEFAULT_ORIGIN).execute().returnResponse();\n\n assertNotNull(\"Response should not be null\", response);\n\n //we should have an access control allow origin\n assertNotNull(\"Allowed origin should be present\", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN));\n }", "@Override\n\tpublic boolean isSafeOrigin(URL linkedURL) {\n\t\tURL base = getBaseURL();\n\t\tString docHost = base.getHost();\n\t\tint docPort = base.getPort();\n\t\tif (docPort == -1) {\n\t\t\tdocPort = base.getDefaultPort();\n\t\t}\n\t\tString linkedHost = linkedURL.getHost();\n\t\tint linkedPort = linkedURL.getPort();\n\t\tif (linkedPort == -1) {\n\t\t\tlinkedPort = linkedURL.getDefaultPort();\n\t\t}\n\t\treturn (docHost.equalsIgnoreCase(linkedHost) || linkedHost.endsWith(docHost)) && docPort == linkedPort;\n\t}", "protected void setBasicAuthorization(String hostName, int hostPort, String realm, String userid, String pswd)\r\n {\r\n\r\n AuthorizationInfo.addBasicAuthorization(hostName, hostPort, realm, userid, pswd);\r\n // Inform the HTTPConnection that our Proxy Host,\r\n // Port is a proxyServer.\r\n HTTPConnection.setProxyServer(hostName, hostPort);\r\n }", "public void setRemoteAccessAllowed(Boolean remoteAccessAllowed) {\n this.remoteAccessAllowed = remoteAccessAllowed;\n }", "@Override\n protected void configure(HttpSecurity http) throws Exception {\n http\n // comunication between client and server is stateless\n .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()\n\n // for unauthorized request send 401 error\n .exceptionHandling().authenticationEntryPoint(restAuthenticationEntryPoint).and()\n\n // don't authenticate this particular request\n .authorizeRequests()\n .antMatchers(HttpMethod.GET, \"/hello\").permitAll()\n\n\n // all other requests need to be authenticated\n .anyRequest().authenticated().and();\n\n // intercept every request and add filter\n http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);\n\n //http.csrf().disable();\n http.cors().and().csrf().disable();\n\n\t\t/* http.headers().addHeaderWriter(\n new StaticHeadersWriter(\"Access-Control-Allow-Origin\", \"*\"));*/\n\n }", "@Bean\n\tCorsConfigurationSource corsConfigurationSource() {\n\t\tfinal UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n\t\tsource.registerCorsConfiguration(\"/**\", new CorsConfiguration().applyPermitDefaultValues());\n\t\treturn source;\n\t}", "public void getRequest_withBasicAuth() {\n apiUtil = new APIUtil();\n // As this is an API call , we are not setting up any base url but defining the individual calls\n apiUtil.setBaseURI(configurationReader.get(\"BaseURL\"));\n //This is used to validate the get call protected with basic authentication mechanism\n basicAuthValidation();\n }", "public void checkAuthority() {\n }", "@Override\n\tpublic boolean checkAuthorization(HttpServletRequest request) {\n\t\treturn true;\n\t}", "@O2Client(permitPrivate = false)\n @POST\n @Path(\"/client/public\")\n public Response authorizedPublicPOST(@Context final SecurityContext c) {\n return Response.ok().build();\n }", "@Override\n\t\tpublic void configure(HttpSecurity http) throws Exception {\n\n\t\t\thttp.csrf().disable();\n\n\t\t\thttp.authorizeRequests().antMatchers(\"/oauth/token\").anonymous();\n\n\t\t\t// TODO: Why we cannot just use @PreAuthorize() ?\n\n\t\t\t// Require all GET requests to have client \"read\" scope\n\t\t\thttp.authorizeRequests().antMatchers(HttpMethod.GET, \"/rest/**\").access(\"#oauth2.hasScope('read')\");\n\t\t\t// Require all other requests to have \"write\" scope\n//\t\t\thttp.authorizeRequests().antMatchers(\"/rest/**\").access(\"#oauth2.hasScope('write')\");\n\t\t}", "@RequestMapping(value = \"/\", method = RequestMethod.OPTIONS)\n @LoginRequired(false)\n public HttpEntity<String> options() {\n MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();\n map.add(\"allow\", \"HEAD,GET,PUT,DELETE,POST,OPTIONS\");\n return new ResponseEntity<>(map, HttpStatus.OK);\n }", "public SpecificIPAllowedWebActivityServlet() {\n super();\n }", "@RequestMapping(\"/\")\n //@CrossOrigin(origins = \"http://localhost:3000\")\n @ResponseBody\n public String Welcome() {\n return \"This is RestEmployee example\";\n }", "@Bean\n public WebMvcConfigurer corsConfigurer() {\n return new WebMvcConfigurer() {\n @Override\n public void addCorsMappings(CorsRegistry registry) {\n registry.addMapping(\"/api/**\").allowedOrigins(\"*\");\n }\n };\n }", "@Test\n public void testExceptionThrownInFlowRef() throws Exception {\n final HttpResponse response =\n Request.Get(\"http://localhost:\" + httpPort.getValue() + CORS_MAIN_FLOW_ENDPOINT_PATH)\n .addHeader(\"Origin\", CORS_DEFAULT_ORIGIN).execute().returnResponse();\n\n assertNotNull(\"Response should not be null\", response);\n\n //we should have an access control allow origin\n assertNotNull(\"Allowed origin should be present\", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN));\n }", "public void setCrossOriginResourceDomain(String cord) {\n\t\tcrossOriginResourceDomain = cord;\n\t}", "private void mimicSunRequestHeaders() {\n if (!isHeaderSet(method.getRequestHeader(\"Accept\"))) {\n setRequestProperty(\"Accept\", acceptHeader);\n }\n if (!isHeaderSet(method.getRequestHeader(\"Connection\"))) {\n setRequestProperty(\"Connection\", \"keep-alive\");\n }\n }", "@Override\n public Origin getOrigin() {\n return Origin.unknown();\n }", "@Override\n public boolean isClientAuthEnabled() {\n return true;\n }", "Origin getOrigin();" ]
[ "0.7367805", "0.71910596", "0.7064029", "0.6846067", "0.6800219", "0.679093", "0.6764577", "0.6682165", "0.66686046", "0.663499", "0.6617998", "0.6605534", "0.6482055", "0.64345294", "0.63636655", "0.6294205", "0.6251003", "0.6246772", "0.608295", "0.6050665", "0.6043714", "0.60076165", "0.59584105", "0.59560823", "0.58788794", "0.58788216", "0.58588904", "0.5819864", "0.5802029", "0.57929504", "0.5791871", "0.57889736", "0.57575387", "0.57246166", "0.57180595", "0.569511", "0.56827205", "0.56672937", "0.5661602", "0.5661602", "0.562848", "0.5623369", "0.5590902", "0.5576282", "0.5549115", "0.5528987", "0.5528987", "0.54964477", "0.5493891", "0.54910207", "0.5478382", "0.5472559", "0.54701364", "0.5465137", "0.5454501", "0.5439382", "0.54371345", "0.5436914", "0.54273534", "0.5375768", "0.53611463", "0.53310806", "0.53131086", "0.5306009", "0.5265958", "0.5257536", "0.5256319", "0.52247816", "0.520426", "0.5203587", "0.5202359", "0.5181937", "0.51764846", "0.5167956", "0.51620126", "0.51614076", "0.5160639", "0.5159952", "0.5159701", "0.5157894", "0.5123883", "0.51220024", "0.51208836", "0.51165456", "0.51151913", "0.51064557", "0.5084451", "0.5079042", "0.50665367", "0.50639886", "0.5063323", "0.50602466", "0.50379986", "0.5031549", "0.5026443", "0.5024037", "0.501814", "0.50167567", "0.50140727", "0.500939" ]
0.60475713
20
send a request to get (no preflight)
@Test public void testDefaultOriginMethod() throws Exception { final HttpResponse response = Request.Get("http://localhost:" + httpPort.getValue() + CORS_DEFAULT_ENDPOINT_PATH).addHeader("Origin", CORS_DEFAULT_ORIGIN).execute().returnResponse(); assertNotNull("Response should not be null", response); //we should have an access control allow origin assertNotNull("Allowed origin should be present", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN)); assertThat(IOUtils.toString(response.getEntity().getContent()), equalTo(EXPECTED_RETURN)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static HttpResponse sendGet() throws Exception {\n // Create the Call using the URL\n HttpGet http = new HttpGet(url);\n // Set the credentials set earlier into the headers\n Header header = new BasicScheme(StandardCharsets.UTF_8).authenticate(creds, http, null);\n // Set the header into the HTTP request\n http.addHeader(header);\n // Print the response\n return httpClient.execute(http);\n }", "HttpGet getRequest(HttpServletRequest request, String address) throws IOException;", "@Override\n\tprotected Method getMethod() {\n\t\treturn Method.GET;\n\t}", "private static String get_request(String uri, boolean isChecking, String token) throws IOException {\r\n URL url = new URL(uri);\r\n HttpURLConnection connection = (HttpURLConnection) url.openConnection();\r\n connection.setRequestProperty(\"Content-Type\", \"application/json\");\r\n connection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74\");\r\n if (isChecking) {\r\n connection.setRequestProperty(\"Authorization\", token);\r\n }\r\n connection.setRequestMethod(\"GET\");\r\n InputStream responseStream = connection.getInputStream();\r\n if (debug) {\r\n System.out.println(\"GET - \"+connection.getResponseCode());\r\n }\r\n try (Scanner scanner = new Scanner(responseStream)) {\r\n String responseBody = scanner.useDelimiter(\"\\\\A\").next();\r\n if (debug) {\r\n System.out.println(responseBody);\r\n }\r\n return responseBody;\r\n } catch (Exception e) {\r\n return \"ERROR\";\r\n }\r\n }", "@Override\n\tprotected void executeGet(GetRequest request, OperationResponse response) {\n\t}", "private HttpResponse executeHttpGet(String apiUrl) throws OAuthMessageSignerException,\r\n\t\t\tOAuthExpectationFailedException, OAuthCommunicationException, IOException {\r\n\t\tHttpGet httprequest = new HttpGet(apiUrl);\r\n\t\tgetOAuthConsumer().sign(httprequest);\r\n\t\tHttpClient client = new DefaultHttpClient();\r\n\t\tHttpResponse httpresponse = client.execute(httprequest);\r\n\t\tint statusCode = httpresponse.getStatusLine().getStatusCode();\r\n\t\tSystem.out.println(statusCode + \":\" + httpresponse.getStatusLine().getReasonPhrase());\r\n\t\treturn httpresponse;\r\n\t}", "public Result get(Get get) throws IOException;", "private static String sendGET(String getURL) throws IOException {\n\t\tURL obj = new URL(getURL);\n\t\tHttpURLConnection con = (HttpURLConnection) obj.openConnection();\n\t\tcon.setRequestMethod(\"GET\");\n\t\tString finalResponse = \"\";\n\n\t\t//This way we know if the request was processed successfully or there was any HTTP error message thrown.\n\t\tint responseCode = con.getResponseCode();\n\t\tSystem.out.println(\"GET Response Code : \" + responseCode);\n\t\tif (responseCode == HttpURLConnection.HTTP_OK) { // success\n\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n\t\t\tString inputLine;\n\t\t\tStringBuffer buffer = new StringBuffer();\n\n\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\tbuffer.append(inputLine);\n\t\t\t}\n\t\t\tin.close();\n\n\t\t\t// print result\n\t\t\tfinalResponse = buffer.toString();\n\t\t} else {\n\t\t\tSystem.out.println(\"GET request not worked\");\n\t\t}\n\t\treturn finalResponse;\n\t}", "public HttpResponseWrapper invokeGET(String path) {\n\t\treturn invokeHttpMethod(HttpMethodType.HTTP_GET, path, \"\");\n\t}", "public void doGet( )\n {\n \n }", "@Override\n\tpublic HttpResponse get(final String endpoint) {\n\t\treturn httpRequest(HTTP_GET, endpoint, null);\n\t}", "@Test\r\n\tpublic void doGet() throws Exception {\n\t\tCloseableHttpClient httpClient = HttpClients.createDefault();\r\n\t\t// Create a GET object and pass a url to it\r\n\t\tHttpGet get = new HttpGet(\"http://www.google.com\");\r\n\t\t// make a request\r\n\t\tCloseableHttpResponse response = httpClient.execute(get);\r\n\t\t// get response as result\r\n\t\tSystem.out.println(response.getStatusLine().getStatusCode());\r\n\t\tHttpEntity entity = response.getEntity();\r\n\t\tSystem.out.println(EntityUtils.toString(entity));\r\n\t\t// close HttpClient\r\n\t\tresponse.close();\r\n\t\thttpClient.close();\r\n\t}", "private void requestGet(String endpoint, Map<String, String> params, RequestListener listener) throws Exception {\n String requestUri = Constant.API_BASE_URL + ((endpoint.indexOf(\"/\") == 0) ? endpoint : \"/\" + endpoint);\n get(requestUri, params, listener);\n }", "public static String sendGetRequest(String addr,String[] head)\n\t{\n\t\tString response = null;\n\t\n\t\ttry\n\t\t{\n\t\t\tURL url = new URL(addr);\n\t\t\tHttpURLConnection connection = (HttpURLConnection) url.openConnection();\n\t\t\t//String encoding = new sun.misc.BASE64Encoder().encode(\"username \t assword\".getBytes());\n\t\t\t//conn.setRequestProperty (\"Authorization\", \"Basic \" + encoding);\n\t\t\tif(head!=null)\n {\n\t for(int i=0;i<head.length;i=i+2)\n\t {\n\t \tconnection.setRequestProperty(head[i], head[i+1]);\n\t \t\n\t }\n }\n\t\t\tconnection.setRequestMethod(\"GET\");\n\t\t\n\t\t\tconnection.connect();\n\t\t\tInputStream in = connection.getInputStream();\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\t\t\tconnection.disconnect();\n\t\t\tresponse = reader.readLine();\n\t\t\t//System.out.println(text);\n\t\t\n\t\t\t\n\t\t\t}catch(IOException ex)\n\t\t\t{\n\t\t\tex.printStackTrace();\n\t\t\tSystem.out.println(\"made it here\");\n\t\t}\n\treturn response;\n\t\n\t}", "GetResponse() {\n\t}", "public void sendRequest() {\n\t\tURL obj;\n\t\ttry {\n\t\t\t// Instantiating HttpURLConnection object for making GET request.\n\t\t\tobj = new URL(REQUEST_URL);\n\t\t HttpURLConnection connection = (HttpURLConnection) obj.openConnection();\n\t\t connection.setRequestMethod(REQUEST_METHOD);\n\t\t connection.setRequestProperty(\"User-Agent\", USER_AGENT);\n\t\t connection.setInstanceFollowRedirects(FOLLOW_REDIRECTS);\n\t\t\tHttpURLConnection.setFollowRedirects(FOLLOW_REDIRECTS);\n\t\t\n\t\t\t// Checking response code for successful request.\n\t\t\t// If responseCode==200, read the response,\n\t\t\t// if responseCode==3xx, i.e., a redirect, then make the request to \n\t\t\t// new redirected link, specified by 'Location' field. \n\t\t\t// NOTE: Only one level of redirection is supported for now. \n\t\t\t// Can be modified to support multiple levels of Redirections.\n\t\t\tint responseCode = connection.getResponseCode();\n\t\t\tif(responseCode == HttpURLConnection.HTTP_MOVED_PERM ||\n\t\t\t\t\tresponseCode == HttpURLConnection.HTTP_MOVED_TEMP ||\n\t\t\t\t\tresponseCode == HttpURLConnection.HTTP_SEE_OTHER) {\n\t\t\t\tlogger.info(\"Redirect received in responseCode\");\n\t\t\t\tString newUrl = connection.getHeaderField(\"Location\");\n\t\t\t\tconnection = (HttpURLConnection) new URL(newUrl).openConnection();\n\t\t\t}\n\t\t\tresponseCode = connection.getResponseCode();\n\t\t\t\n\t\t\t// process response message if responseCode==200 i.e., success.\n\t\t\tif (responseCode == HttpURLConnection.HTTP_OK) {\n\t\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(\n\t\t\t\t\t\tconnection.getInputStream()));\n\t\t\t\tString inputLine;\n\t\t\t\tStringBuffer response = new StringBuffer();\n\t\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\t\tresponse.append(inputLine);\n\t\t\t\t}\n\t\t\t\tin.close();\n\t\t\t\t//Uncomment following line to log response data.\n\t\t\t\t//logger.info(response.toString());\n\t\t\t} else {\n\t\t\t\tlogger.warning(\"Http GET request was unsuccessful!\");\n\t\t\t}\n\t\t} catch (MalformedURLException e) {\n\t\t\tlogger.severe(\"MalformedURLException: \" + e.getMessage());\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\tlogger.severe(\"IOException: \" + e.getMessage());\n\t\t\te.printStackTrace();\n\t\t}\n }", "R get() throws IOException, ClientProtocolException;", "public CompletableFuture<GetResponse> get(GetRequest request) throws IOException {\n\t\treturn this.transport.performRequestAsync(request, GetRequest.ENDPOINT, this.requestOptions);\n\t}", "public String request(String method, String url, String data) {\n HttpURLConnection connection = null;\n try {\n if ((method.compareTo(\"GET\") == 0) && (data != null) && (!data.isEmpty())) {\n if (url.contains(\"?\"))\n url = url.concat(\"&\");\n else\n url = url.concat(\"?\");\n url = url.concat(data);\n }\n // Create connection\n URL requestUrl = new URL(url);\n connection = (HttpURLConnection) requestUrl.openConnection();\n connection.setRequestProperty(\"Veridu-Client\", this.key);\n if ((this.storage.getSessionToken() != null) && (!this.storage.getSessionToken().isEmpty()))\n connection.setRequestProperty(\"Veridu-Session\", this.storage.getSessionToken());\n connection.setRequestMethod(method);\n connection.setConnectTimeout(10000);\n connection.setReadTimeout(10000);\n connection.setUseCaches(false);\n connection.setDoOutput(true);\n // Send request\n if ((method.compareTo(\"GET\") != 0) && (data != null) && (!data.isEmpty())) {\n connection.setRequestProperty(\"Content-Type\", \"application/x-www-form-urlencoded\");\n connection.setRequestProperty(\"Content-Length\", Integer.toString(data.getBytes().length));\n connection.setDoInput(true);\n DataOutputStream wr = new DataOutputStream(connection.getOutputStream());\n wr.writeBytes(data);\n wr.flush();\n wr.close();\n }\n\n // Get Response\n this.lastCode = connection.getResponseCode();\n InputStream is;\n if (this.lastCode >= 400)\n is = connection.getErrorStream();\n else\n is = connection.getInputStream();\n BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n String line;\n StringBuilder response = new StringBuilder();\n while ((line = rd.readLine()) != null) {\n response.append(line);\n response.append('\\r');\n }\n rd.close();\n return response.toString();\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (connection != null)\n connection.disconnect();\n }\n return null;\n }", "public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException {\r\n\tlogTrace( req, \"GET log\" );\r\n\tString requestId = req.getQueryString();\r\n\tif (requestId == null) return;\r\n\tif (\"get-response\".equals( requestId )) {\r\n\t try {\r\n\t\tonMEVPollsForResponse( req, resp );\r\n\t } catch (Exception e) {\r\n\t\tlogError( req, resp, e, \"MEV polling error\" );\r\n\t\tsendError( resp, \"MEV polling error: \" + e.toString() );\r\n\t }\r\n\t}\r\n }", "static String sendGET(String GET_URL) throws IOException, JSONException {\n\t\t// Check URL is valid or not.\n\t\tif (isValidURL(GET_URL)) {\n\t\t\ttry {\n\t\t\t\tURL obj = new URL(GET_URL);\n\t\t\t\tHttpURLConnection con = (HttpURLConnection) obj.openConnection();\n\t\t\t\tcon.setRequestMethod(\"GET\");\n\t\t\t\tcon.setRequestProperty(\"User-Agent\", USER_AGENT);\n\t\t\t\tint responseCode = con.getResponseCode();\n\t\t\t\tSystem.out.println(\"GET Response Code :: \" + responseCode);\n\t\t\t\tif (responseCode == HttpURLConnection.HTTP_OK) { // success\n\t\t\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n\t\t\t\t\tString inputLine;\n\t\t\t\t\tStringBuffer response = new StringBuffer();\n\n\t\t\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\t\t\tresponse.append(inputLine);\n\t\t\t\t\t}\n\t\t\t\t\tin.close();\n\t\t\t\t\t// Convert to json object and get specified data from it. Then you can print if the response is json type.\n\t\t\t\t\tString list = getList(response.toString());\n\t\t\t\t\tSystem.out.println(list);\n\t\t\t\t\t// print result\n\t\t\t\t\tSystem.out.println(response.toString());\n\t\t\t\t\treturn \"GET request worked\"; // Added for testing.\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"GET request not worked\");\n\t\t\t\t\treturn \"GET request not worked\";\n\t\t\t\t}\n\t\t\t} catch (MalformedURLException e) {\n\t\t\t\treturn \"URL is valid but connection could not be established.\";\n\t\t\t} catch (IOException e) {\n\t\t\t\treturn \"URL is valid but connection could not be established.\";\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"URL is not valid.\";\n\t\t}\n\t}", "@Override\r\n\tprotected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoGet(req, resp);\r\n\t}", "public ResponseTranslator get() {\n setMethod(\"GET\");\n return doRequest();\n }", "public static Response doGetRequest(String url) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException {\n try {\n Request request = new Request.Builder()\n .url(url).addHeader(\"Content-Type\", \"text/plain\")\n .build();\n Response response = client.newCall(request).execute();\n return response;\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n }", "@Override\n\tpublic InputStream doGet(String url) {\n\t\tInputStream in = null;\n\t\tHttpGet getRequest = new HttpGet(url);\n\t\tgetRequest.addHeader(\"charset\", HTTP.UTF_8);\n\t\tHttpClient client = new DefaultHttpClient();\n\t\tclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 6000);\n\t\tclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 8000);\n\t\tHttpResponse response = null;\n\t\ttry {\n\t\t\tresponse = client.execute(getRequest);\n\t\t\tif(null != response && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){\n\t\t\t\tin = response.getEntity().getContent();\n\t\t\t}\n\t\t} catch (ClientProtocolException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn in;\n\t}", "String getRequest(String url);", "Response get(URL target, QueryInput input, List<? extends HttpAuthentication> auth)\n throws IOException, DataRetrievalException;", "@Test\r\n\tpublic void doGetWithParams() throws Exception {\n\t\tCloseableHttpClient httpClient = HttpClients.createDefault();\r\n\t\t// Create a GET object and pass a url to it\r\n\t\tURIBuilder uriBuilder = new URIBuilder(\"http://www.google.com/search\");\r\n\t\turiBuilder.addParameter(\"query\", \"Bingyang Wei\");\r\n\t\tHttpGet get = new HttpGet(uriBuilder.build());\r\n\r\n\t\t// make a request\r\n\t\tCloseableHttpResponse response = httpClient.execute(get);\r\n\t\t// get response as result\r\n\t\tSystem.out.println(response.getStatusLine().getStatusCode());\r\n\t\tHttpEntity entity = response.getEntity();\r\n\t\tSystem.out.println(EntityUtils.toString(entity));\r\n\t\t// close HttpClient\r\n\t\tresponse.close();\r\n\t\thttpClient.close();\r\n\t}", "public Response get(Cluster c, String path, Header[] headers) \n throws IOException {\n GetMethod method = new GetMethod();\n try {\n int code = execute(c, method, headers, path);\n headers = method.getResponseHeaders();\n byte[] body = method.getResponseBody();\n InputStream in = method.getResponseBodyAsStream();\n return new Response(code, headers, body, in);\n } finally {\n method.releaseConnection();\n }\n }", "public void GetCall(String url) throws ClientProtocolException, IOException {\n\t\tCloseableHttpClient httpclient=HttpClients.createDefault();\n\t\tHttpGet httpget=new HttpGet(url);\n\t//lohith\n\t\tCloseableHttpResponse closeablehttpresponse=httpclient.execute(httpget);\n\t\tint responsestatuscode=closeablehttpresponse.getStatusLine().getStatusCode();\n\t\tSystem.out.println(\"responsestatuscode: \"+responsestatuscode);\n\t\t\n\t\tString response=EntityUtils.toString(closeablehttpresponse.getEntity(),\"UTF-8\");\n\t\tSystem.out.println(\"ClientResponse: \"+response);\n\t\tJSONObject jsonobject= new JSONObject(response);\n\t\t\n\t\tSystem.out.println(\"jsonobject: \"+jsonobject);\n\t\t\n\t\t\n\t}", "private String doHttpClientGet() {\n\t\t\r\n\t\tHttpGet httpGet=new HttpGet(url);\r\n\t\tHttpClient client=new DefaultHttpClient();\r\n\t\ttry {\r\n\t\t\tHttpResponse response=client.execute(httpGet);\r\n\t\t\tif(response.getStatusLine().getStatusCode()==HttpStatus.SC_OK){\r\n\t\t\t\tresult=EntityUtils.toString(response.getEntity());\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"content----->\"+result);\r\n\t\t} catch (ClientProtocolException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "@Override\n\tprotected HttpResponse doHttpRequest() throws ClientProtocolException, IOException {\n\t\tHttpRequestGenerator requestor = new HttpRequestGenerator(username, password);\n\t\treturn requestor.makeKeyFetchRequest(keyServerUrl, null);\n\t}", "private static String sendGET(final Long id) {\n return \"\";\r\n }", "public ServiceResponse getRequest(String url) throws IOException {\n HttpClient client = HttpClientBuilder.create().build();\n HttpGet request = new HttpGet(url);\n HttpResponse httpResponse = client.execute(request);\n ServiceResponse response = new ServiceResponse(httpResponse.getStatusLine().getStatusCode());\n response.setReader(new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent())));\n return response;\n }", "public void doGet() throws IOException {\n\n // search ressource\n byte[] contentByte = null;\n try {\n contentByte = ToolBox.readFileByte(RESOURCE_DIRECTORY, this.url);\n this.statusCode = OK;\n ContentType contentType = new ContentType(this.extension);\n sendHeader(statusCode, contentType.getContentType(), contentByte.length);\n } catch (IOException e) {\n System.out.println(\"Ressource non trouvé\");\n statusCode = NOT_FOUND;\n contentByte = ToolBox.readFileByte(RESPONSE_PAGE_DIRECTORY, \"pageNotFound.html\");\n sendHeader(statusCode, \"text/html\", contentByte.length);\n }\n\n this.sendBodyByte(contentByte);\n }", "@Override\n\tpublic WebApiRequest getRequest() {\n\t\tString category = \"\";\n\t\tString destination = \"\";\n\t\tJSONObject para = new JSONObject();\n\t\tif (taskFlag == GET_BALANCE_DETAIL_FLAG) {\n\t\t\tcategory = CATEGORY_NAME;\n\t\t\tdestination = GET_BALANCE_Detail;\n\t\t\ttry {\n\t\t\t\tpara.put(\"ID\", getIntent().getIntExtra(\"BalanceID\", 0));\n\t\t\t\tpara.put(\"CardType\", getIntent().getIntExtra(\"CardType\", 1));\n\t\t\t\tpara.put(\"ChangeType\", getIntent().getIntExtra(\"ChangeType\", 0));\n\t\t\t} catch (JSONException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tWebApiHttpHead header = mApp.createNeededCheckingWebConnectHead(category, destination, para.toString());\n\t\tWebApiRequest request = new WebApiRequest(category, destination,para.toString(), header);\n\t\treturn request;\n\t}", "private String sendGetRequest() throws IOException {\n\t\tString inline = \"\";\n\t\tURL url = new URL(COUNTRYAPI);\n\t\tHttpURLConnection conn = (HttpURLConnection) url.openConnection();\n\t\tconn.setRequestMethod(\"GET\");\n\t\tconn.connect();\n\t\tint responsecode = conn.getResponseCode();\n\t\tif (responsecode != 200) {\n\t\t\tthrow new RuntimeException(\"HttpResponseCode: \" + responsecode);\n\t\t} else {\n\t\t\tScanner sc = new Scanner(url.openStream());\n\t\t\twhile (sc.hasNext()) {\n\t\t\t\tinline += sc.nextLine();\n\t\t\t}\n\t\t\tsc.close();\n\t\t}\n\t\treturn inline.toString();\n\t}", "private RawHttpResponse<?> executeRequest(String method, String path) throws IOException {\r\n\t\tSocket socket = new Socket(\"localhost\", 8080);\r\n\t\treturn executeRequest(method, path, \"\", socket);\r\n\t}", "public String doHttpGet(String url, final String ...head);", "void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;", "public EntityType2 get() throws ClientException {\n return send(HttpMethod.GET, null);\n }", "public BufferedReader reqGet(final String route) throws\n ServerStatusException, IOException {\n System.out.println(\"first reqGet\");\n return reqGet(route, USER_AGENT);\n }", "@NonNull\n public String getAction() {\n return \"GET\";\n }", "private synchronized String execute(final HttpUriRequest request) {\n request.setParams(params);\n\n // Set the request's headers\n for (Entry<String, String> header : headers.entrySet()) {\n request.setHeader(header.getKey(), header.getValue());\n }\n\n // Execute the request and get it's content\n HttpResponse response;\n String content;\n try {\n\n // Execute the request\n response = getClient().execute(request);\n\n // Get the response content\n content = EntityUtils.toString(response.getEntity(), charset);\n } catch (IOException e) {\n throw new JsogClientException(\"Get request failed.\", e);\n }\n\n // Check the response code\n StatusLine sl = response.getStatusLine();\n if (sl.getStatusCode() != 200) {\n throw new Non200ResponseCodeException(\n sl.getStatusCode(),\n sl.getReasonPhrase(),\n content);\n }\n\n return content;\n }", "public String getResultFromGET() \r\n\t{\r\n\t\tString resultstring = null;\r\n\t\t\r\n\t\t// Use BasicNameValuePair to create GET data\r\n\t\tList<NameValuePair> pairs = new ArrayList<NameValuePair>();\r\n\t\tpairs.add(new BasicNameValuePair(\"token\", user.getTokenkey()));\r\n\t\tpairs.add(new BasicNameValuePair(\"method\", \"accountapi.getNotifications\"));\r\n\t\t\r\n\t\t// url request\r\n\t\tString URL = null;\r\n\t\tif (Config.CORE_URL == null) {\r\n\t\t\tURL = Config.makeUrl(user.getCoreUrl(), null, false);\t\r\n\t\t} else {\r\n\t\t\tURL = Config.makeUrl(Config.CORE_URL, null, false);\r\n\t\t}\r\n\t\t\r\n\t\t// request GET method to server\r\n\t\tresultstring = networkUntil.makeHttpRequest(URL, \"GET\", pairs);\r\n\t\t\r\n\t\tLog.i(\"DEBUG\", resultstring);\r\n\t\t\r\n\t\treturn resultstring;\r\n\t}", "@Test\n\t \n\t public void getApi() {\n\t\t \n\t\t Response getIt=get(\"https://reqres.in/api/users?page=2\");\n\t\t getIt.prettyPrint();\n\t\t System.out.println(getIt.getStatusCode());\n\t\t System.out.println(getIt.getTime());\n\t\t \n\t\t //to validate\n\t\t int validGstatus=getIt.getStatusCode();\n\t\t Assert.assertEquals(validGstatus,200);\n\t\t \n\t }", "protected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tcontact.forward(req, resp);\n\n\t}", "@RequestMapping(method=RequestMethod.GET)\n public @ResponseBody void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, JSONException, ParserConfigurationException {\n LOG.debug(\"doGet wgetproxy\");\n createWGET(request, response);\n }", "public void getRequest_withBasicAuth() {\n apiUtil = new APIUtil();\n // As this is an API call , we are not setting up any base url but defining the individual calls\n apiUtil.setBaseURI(configurationReader.get(\"BaseURL\"));\n //This is used to validate the get call protected with basic authentication mechanism\n basicAuthValidation();\n }", "public BufferedReader reqGet(final String route,\n final String userAgent)\n throws ServerStatusException, IOException {\n System.out.println(\"reqGet\");\n URL inputUrl = new URL(domain + route);\n HttpURLConnection con = (HttpURLConnection) inputUrl.openConnection();\n System.out.println(con);\n con.setRequestMethod(\"GET\");\n con.setRequestProperty(\"User-Agent\", userAgent);\n System.out.println(inputUrl);\n return readRes(con);\n }", "public String GET(String uri) {\n String retVal = \"\";\n try {\n request = HttpRequest.newBuilder()\n .GET()\n .uri(new URI(uri))\n .build();\n\n response = HttpClient.newBuilder()\n .build()\n .send(request, HttpResponse.BodyHandlers.ofString());\n\n retVal = response.body().toString();\n }\n catch (Exception e) {\n // correctly handles the exception according to framework\n // for this case, just returns an empty string\n }\n return retVal;\n }", "public static String httpGet(String url) throws Exception {\r\n \t\tDefaultHttpClient client = new DefaultHttpClient();\r\n \t\tHttpResponse response = null;\r\n \t\tString responseString = null;\r\n \t\tHttpUriRequest request = new HttpGet(url);\r\n \t\trequest.setHeader(\"Accept-Encoding\", \"gzip\");\r\n \t\trequest.setHeader(\"User-Agent\", \"gzip\");\r\n\t\tresponse = client.execute(request);\r\n \t\tif (response.getStatusLine().getStatusCode() != 200) {\r\n \t\t\tthrow new HttpException(\"Server error: \"\r\n \t\t\t\t\t+ response.getStatusLine().getStatusCode());\r\n \t\t} else {\r\n \t\t\tresponseString = parseResponse(response);\r\n \r\n \t\t}\r\n \t\treturn responseString;\r\n \t}", "public String issueGetRequest(String query) {\n URL url;\n String result = \"\";\n\n return \"valid\";\n /**\n * Todo: When server API is up and running uncomment this.\n *\n * try { url = new URL(server + \"?\" + query); BufferedReader br = new\n * BufferedReader(new InputStreamReader(url.openStream())); String\n * strTemp = \"\";\n * \n * while (null != (strTemp = br.readLine())) { result = strTemp; }\n * \n * } catch (Exception e) { e.printStackTrace(); }\n * \n * return result;\n */\n }", "public ClientResponse performGetRequest(String clientRegistrationID, URL url, Map<String, String> headers, Map<String, String> queryParameters);", "@Override\r\n\tpublic void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tString from = request.getRemoteAddr();\r\n\t\t\t\r\n\t\t\twriteLog(new StringBuilder(\"GET 请求 来自:\").append(from).append(request.getQueryString()));\r\n\r\n\t\t\tdoPost(request,response);\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public Response get(String path, Header[] headers) throws IOException {\n return get(cluster, path, headers);\n }", "@Override\n protected void doGet(HttpServletRequest req, HttpServletResponse resp)\n throws IOException {\n resp.setStatus(200);\n resp.setContentType(\"text/plain\");\n resp.getOutputStream().print(req.getParameter(\"hub.challenge\"));\n resp.getOutputStream().flush();\n\n JID user = new JID(req.getPathInfo().substring(1));\n\n if (req.getParameter(\"hub.mode\").equals(\"subscribe\")) {\n Xmpp.sendMessage(user, \"Subscribed to \" + req.getParameter(\"hub.topic\"));\n } else if (req.getParameter(\"hub.mode\").equals(\"unsubscribe\")) {\n Xmpp.sendMessage(\n user, \"Unsubscribed from \" + req.getParameter(\"hub.topic\")); \n }\n }", "@Override\n public void doGet(HttpServletRequest request, HttpServletResponse response) {\n System.out.println(\"[Servlet] GET request \" + request.getRequestURI());\n\n response.setContentType(FrontEndServiceDriver.APP_TYPE);\n response.setStatus(HttpURLConnection.HTTP_BAD_REQUEST);\n\n try {\n String url = FrontEndServiceDriver.primaryEventService +\n request.getRequestURI().replaceFirst(\"/events\", \"\");\n HttpURLConnection connection = doGetRequest(url);\n\n if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {\n PrintWriter pw = response.getWriter();\n JsonObject responseBody = (JsonObject) parseResponse(connection);\n\n response.setStatus(HttpURLConnection.HTTP_OK);\n pw.println(responseBody.toString());\n }\n }\n catch (Exception ignored) {}\n }", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tcommandAction(request,response);\r\n\t}", "@Test\n public void getRequest1() {\n str = METHOD_GET + \"/JavaPower.gif \" + HTTP_VERSION + ENDL +\n HOST_HEADER + \": www.devresource.org\" + ENDL +\n ACCEPT + \": text/html\" + ENDL +\n \"Range-Unit: 3388 | 1024\";\n request = new HttpRequest(str, IP_ADDRESS, HOST);\n\n assertEquals(request.getMethod(), HttpMethod.GET);\n assertEquals(request.getUrn(), \"/JavaPower.gif\");\n assertEquals(request.getHeader(ACCEPT), \"text/html\");\n assertEquals(request.getHeader(\"Range-Unit\"), \"3388 | 1024\");\n assertEquals(request.getHeader(NONEXISTENT_VAR), \"\");\n assertEquals(request.getParameter(NONEXISTENT_VAR), \"\");\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\r\n\t\t\tthrows ServletException, IOException {\n\t\tthis.service(req, resp);\r\n\t}", "@Override\n\tprotected String doInBackground(String... params) {\n\t\t RESTClient request=new RESTClient(getURL());\n\t try {\n\t\t\t\trequest.Execute(RequestMethod.GET);\n\t\t\t\treturn request.getResponse();\n\t\t\t} \n\t catch (Exception e) \n\t\t\t{\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn null;\n\t\t\t}\n\t \n\t}", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tSystem.out.println(\"请求AdminGetData成功\");\r\n//\t\tString userid = request.getHeader(\"userid\");\r\n//\t\tSystem.out.println(\"1231231::\"+userid);\r\n// \tif(userid==\"\"||userid==null) {\r\n//\t\t\tMap<String, Object> map = new HashMap<String, Object>();\r\n//\t\t\tSystem.out.println(\"userid为空\");\r\n//\t\t\tmap.put(\"code\", 0);\r\n//\t\t\tmap.put(\"data\", \"\");\r\n//\t\t\tmap.put(\"count\",0);\r\n//\t\t\tresponse.getWriter().write(JSON.toJSONString(map));\r\n// \t}else {\r\n\t\t\r\n\t\t//获取URI并进行截取方法名进行方法请求\r\n\t\t\tString requestURI = request.getRequestURI();\r\n\t\t\tSystem.out.println(\"地址截取前:\"+requestURI);\r\n\t\t\tString method = requestURI.substring(13, requestURI.length()-4);\r\n\t\t\tSystem.out.println(\"地址截取后:\"+method);\r\n\t\t\t\r\n\t\t\t//搜索单选选项条件值\r\n//\t\t\tString check = request.getParameter(\"check\");\r\n//\t\t\tSystem.out.println(\"单选check值:\"+check);\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\tMethod declaredMethod = this.getClass().getDeclaredMethod(method, HttpServletRequest.class,HttpServletResponse.class);\r\n\t\t\t\tdeclaredMethod.invoke(this,request, response);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t} \r\n// \t}\r\n\t}", "public static void GET(String url, RequestParams params, RestResponseHandler responseHandler) {\n client.get(getAbsoluteUrl(url), params, responseHandler);\n }", "public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/plain\");\n // Actual logic goes here.\n PrintWriter out = response.getWriter();\n out.println(\"Wolken,5534-0848-5100,0299-6830-9164\");\n\ttry \n\t{\n Get g = new Get(Bytes.toBytes(request.getParameter(\"userid\")));\n Result r = table.get(g);\n byte [] value = r.getValue(Bytes.toBytes(\"v\"),\n Bytes.toBytes(\"\"));\n\t\tString valueStr = Bytes.toString(value);\n\t\tout.println(valueStr);\n\t}\n\tcatch (Exception e)\n\t{\n\t\tout.println(e);\n\t}\n }", "private HttpResponse httpRequest(URL url, List<Header> headers, String method) throws IOException {\n\n BufferedReader streamReader;\n\n HttpURLConnection connection = setupConnection(url,headers,method);\n connection.setDoOutput(false);\n connection.connect();\n\n final int httpResponseCode = connection.getResponseCode();\n final List<Header> responseHeaders = Header.getHeaders(connection.getHeaderFields());\n\n try {\n streamReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n }\n catch (IOException e) {\n streamReader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));\n }\n\n StringBuilder sb = new StringBuilder();\n String currentLine;\n\n while((currentLine = streamReader.readLine()) != null) {\n sb.append(currentLine).append(\"\\n\");\n }\n\n connection.disconnect();\n\n try {\n Objects.requireNonNull(streamReader).close();\n }\n catch (IOException ignored){ }\n\n return new HttpResponse(responseHeaders,httpResponseCode,sb.toString().trim());\n }", "public static Response doGetRequest(String url, String token, String app_type) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException {\n try {\n Request request = new Request.Builder()\n .url(url).addHeader(\"cache-control\", \"no-cache\").\n addHeader(\"Authorization\", token).addHeader(\"app_type\", app_type).\n addHeader(\"access_token\", RestTags.PUBLIC_KEY)\n .build();\n Response response = client.newCall(request).execute();\n Log.e(\"RESPONSE:\", response.body() + \"Code:\" + response.code() + \"Message:\" + response.message());\n return response;\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n }", "public PersonName get() throws ClientException {\n return send(HttpMethod.GET, null);\n }", "public Response get(String path) throws IOException {\n return get(cluster, path);\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\r\n\t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\r\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tSystem.out.println(\"get\");\n\t\tthis.doPost(req, resp);\n\t}", "public String get(String path)\n {\n\n Client client = Client.create();\n\n WebResource webResource = client.resource(getHostAddress() + \":\" + getPort() + \"/api/\" + path);\n ClientResponse response = webResource.type(\"application/json\").get(ClientResponse.class);\n\n String message = response.getEntity(String.class);\n\n return message;\n }", "public void httpclient(String url){\n\t\t\r\n\t\t\r\n\t\tString httpUrl =BASIC_URL+url;\r\n\t\t\r\n\t\tSystem.out.println(httpUrl);\r\n\t\t\r\n\t\tHttpGet method =new HttpGet(httpUrl);\r\n\t\t\r\n\t\tmethod.setHeader(\"Content-Type\",\"application/json\");\r\n\t\tmethod.setHeader(\"charset\",\"UTF-8\");\r\n\t\t\r\n\t\ttry {\r\n\t\t\tCloseableHttpResponse res =client.execute(method,context);\r\n\r\n\t\t AuthState targetAuthState = context.getTargetAuthState();\r\n\t\t System.out.println(\"Target auth state: \" + targetAuthState.getState());\r\n\t\t System.out.println(\"Target auth scheme: \" + targetAuthState.getAuthScheme());\r\n\t\t System.out.println(\"Target auth credentials: \" + targetAuthState.getCredentials());\r\n\t\t\t\r\n\t\t HttpEntity ent =res.getEntity();\r\n\t\t \r\n\t\t if (ent != null) { \r\n System.out.println(\"Response content length: \" + ent.getContentLength()); \r\n System.out.println(ent+\"3214242423\");\r\n \r\n System.out.println(EntityUtils.toString(ent));\r\n } \r\n\t\t \r\n\t\t} catch (IOException e) {\r\n\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n }", "public static String executeGet(String targetURL) {\t\n\t\t HttpURLConnection connection = null; \n\t\t try {\n\t\t //Create connection\n\t\t URL url = new URL(targetURL);\n\t\t connection = (HttpURLConnection)url.openConnection();\n\t\t connection.setRequestMethod(\"GET\");\n\t\t connection.setRequestProperty(\"Content-Type\", \"application/json\");\n\t\t connection.setRequestProperty(\"Content-Language\", \"en-US\"); \n\n\t\t connection.setUseCaches(false);\n\t\t connection.setDoOutput(true);\n\n\n\t\t //Get Response \n\t\t InputStream is = connection.getInputStream();\n\t\t BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\t\t StringBuilder response = new StringBuilder(); // or StringBuffer if not Java 5+ \n\t\t String line;\n\t\t while((line = rd.readLine()) != null) {\n\t\t response.append(line);\n\t\t response.append('\\r');\n\t\t }\n\t\t rd.close();\n\t\t return response.toString();\n\t\t } catch (Exception e) {\n\t\t return e.getMessage();\n\t\t } finally {\n\t\t if(connection != null) {\n\t\t connection.disconnect(); \n\t\t }\n\t\t }\n\t\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t\t\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response)\r\n\t\t\tthrows ServletException, IOException {}", "@Override\n public final void doGet() {\n try {\n checkPermissions(getRequest());\n // GET one\n if (id != null) {\n output(api.runGet(id, getParameterAsList(PARAMETER_DEPLOY), getParameterAsList(PARAMETER_COUNTER)));\n } else if (countParameters() == 0) {\n throw new APIMissingIdException(getRequestURL());\n }\n // Search\n else {\n\n final ItemSearchResult<?> result = api.runSearch(Integer.parseInt(getParameter(PARAMETER_PAGE, \"0\")),\n Integer.parseInt(getParameter(PARAMETER_LIMIT, \"10\")), getParameter(PARAMETER_SEARCH),\n getParameter(PARAMETER_ORDER), parseFilters(getParameterAsList(PARAMETER_FILTER)),\n getParameterAsList(PARAMETER_DEPLOY), getParameterAsList(PARAMETER_COUNTER));\n\n head(\"Content-Range\", result.getPage() + \"-\" + result.getLength() + \"/\" + result.getTotal());\n\n output(result.getResults());\n }\n } catch (final APIException e) {\n e.setApi(apiName);\n e.setResource(resourceName);\n throw e;\n }\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n metGet(request, response);\n }", "void getRequests();", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\t\n\t}", "public static HttpResponse<JsonNode> sendRequest(String path, Map params) {\n String apiUrl = ConfigReader.getPropValues().getProperty(\"transit.url\");\n String apiKey = ConfigReader.getPropValues().getProperty(\"transit.key\");\n String jsonExtension = \".json\";\n HttpResponse<JsonNode> response = null;\n\n try {\n String fullPath = apiUrl + path;\n response = Unirest.get(fullPath + jsonExtension)\n .queryString(params)\n .queryString(\"api-key\", apiKey).asJson();\n BotLogger.info(LOG, \"Sent request: \" + fullPath);\n BotLogger.info(LOG, \"Params: \" + params);\n } catch (UnirestException e) {\n e.printStackTrace();\n }\n return response;\n\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t}", "private HttpResponse httpRequest(URL url, List<Header> headers, String method, byte[] data) throws IOException {\n\n BufferedReader streamReader;\n\n HttpURLConnection connection = setupConnection(url,headers,method);\n connection.setDoOutput(true);\n connection.connect();\n\n OutputStream outputStream = connection.getOutputStream();\n outputStream.write(data);\n outputStream.flush();\n outputStream.close();\n\n final int httpResponseCode = connection.getResponseCode();\n final List<Header> responseHeaders = Header.getHeaders(connection.getHeaderFields());\n\n try {\n streamReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n }\n catch (IOException e) {\n streamReader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));\n }\n\n StringBuilder sb = new StringBuilder();\n String currentLine;\n\n while((currentLine = streamReader.readLine()) != null) {\n sb.append(currentLine).append(\"\\n\");\n }\n\n connection.disconnect();\n\n try {\n Objects.requireNonNull(streamReader).close();\n }\n catch (IOException ignored){ }\n\n return new HttpResponse(responseHeaders,httpResponseCode,sb.toString().trim());\n }", "@Override\n\tpublic void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "@Test\n void getTest() {\n URI uri = URI.create(endBody + \"/get\");\n\n // get the response\n HttpResponse<String> response = HttpMethods.get(uri);\n\n // check if it received OK\n assertEquals(200, response.statusCode());\n }", "protected XCapHttpResponse get(URI uri)\n throws XCapException\n {\n DefaultHttpClient httpClient = null;\n try\n {\n httpClient = createHttpClient();\n\n HttpGet getMethod = new HttpGet(uri);\n getMethod.setHeader(\"Connection\", \"close\");\n\n HttpResponse response = httpClient.execute(getMethod);\n XCapHttpResponse result = createResponse(response);\n if (logger.isDebugEnabled())\n {\n byte[] contentBytes = result.getContent();\n String contenString;\n // for debug purposes print only xmls\n // skip the icon queries\n if(contentBytes != null && result.getContentType() != null\n && !result.getContentType()\n .startsWith(PresContentClient.CONTENT_TYPE))\n contenString = new String(contentBytes);\n else\n contenString = \"\";\n\n String logMessage = String.format(\n \"Getting resource %1s from the server content:%2s\",\n uri.toString(),\n contenString\n );\n logger.debug(logMessage);\n }\n return result;\n }\n catch(UnknownHostException uhe)\n {\n showError(uhe, null, null);\n disconnect();\n throw new XCapException(uhe.getMessage(), uhe);\n }\n catch (IOException e)\n {\n String errorMessage =\n SipActivator.getResources().getI18NString(\n \"impl.protocol.sip.XCAP_ERROR_RESOURCE_ERR\",\n new String[]{uri.toString(),\n userAddress.getDisplayName()});\n showError(e, null, errorMessage);\n throw new XCapException(errorMessage, e);\n }\n finally\n {\n if(httpClient != null)\n httpClient.getConnectionManager().shutdown();\n }\n }", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t}", "@Override\n protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n // Empty list of to hold the people\n List<Person> people = null;\n\n // Make the call to the API (Deployed on AWS)\n Client client1 = ClientBuilder.newClient();\n WebTarget serviceWeb1 = client1.target(\"http://18.221.209.59:8080/kmf/api/person\");\n Response response1 = serviceWeb1.request().get();\n\n // Take the response and map it into people objects\n ObjectMapper objectMapper = new ObjectMapper();\n people = objectMapper.readValue(response1.readEntity(String.class), new TypeReference<List<Person>>() {});\n\n // Send the people to the webpage to be displayed\n HttpSession session = req.getSession();\n session.setAttribute(\"people\", people);\n RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(\"/persons.jsp\");\n dispatcher.forward(req, resp);\n }", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t}", "private String sendRequest(String requestUrl) throws Exception {\n\t\t \n\t\tURL url = new URL(requestUrl);\n\t\tHttpURLConnection connection = (HttpURLConnection) url.openConnection();\n\n\t\tconnection.setRequestMethod(\"GET\");\n\t\tconnection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0\");\n \n\t\tBufferedReader in = new BufferedReader(\n\t\t\t\t\tnew InputStreamReader(connection.getInputStream(), \"UTF-8\"));\n\t\t\n\t\tString responseCode = Integer.toString(connection.getResponseCode());\n\t\tif(responseCode.startsWith(\"2\")){\n\t\t\tString inputLine;\n\t\t\tStringBuffer response = new StringBuffer();\n \n\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\tresponse.append(inputLine);\n\t\t\t}\n\t\t\tin.close();\n\t\t\tconnection.disconnect();\n\t\t\treturn response.toString();\n \t} else {\n \t\tSystem.out.println(\"Unable to connect to \"+requestUrl+\n \t\t\". Please check whether the instance is up and also the security group settings\"); \n\t\t\tconnection.disconnect();\n \t\treturn null;\n\t \t} \n\t}", "public final CompletableFuture<GetResponse> get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn)\n\t\t\tthrows IOException {\n\t\treturn get(fn.apply(new GetRequest.Builder()).build());\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "public static String executeHttpGet(String uri) throws Exception {\r\n\t\t\r\n\t\tHttpGet req = new HttpGet(uri);\r\n\t\tHttpClient client = new DefaultHttpClient();\r\n\t\tHttpResponse resLogin = client.execute(req);\r\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(resLogin\r\n\t\t\t\t.getEntity().getContent()));\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tString s = null;\r\n\t\twhile ((s = r.readLine()) != null) {\r\n\t\t\tsb.append(s);\r\n\t\t}\r\n\t\t\r\n\t\treturn sb.toString();\r\n\t}", "public void sendGetRequest(String urlResource,RequestCallback callback){\t\t\r\n\t\trequestBuilder = new RequestBuilder(RequestBuilder.GET, dispatcherURL + urlResource);\r\n\t\trequestBuilder.setHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\r\n\t\ttry {\t\t\t\r\n\t\t\trequestBuilder.sendRequest(\"\", callback);\r\n\t\t} catch (RequestException e) {\r\n\t\t\tWindow.alert(e.getMessage());\r\n\t\t}\r\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {\n //parsing request parameters in order to match operation to implement\n\n this.serverManager.execute(request, response);\n }", "@Test\n public void getEndpoint() throws IOException {\n CloseableHttpClient httpclient = HttpClients.createDefault();\n\n //Creating a HttpGet object\n HttpPost httppost = new HttpPost(\"https://api.github.com/user/repos\");\n String auth=Credentials.getEmail()+\":\"+Credentials.getPassWard();\n byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName(\"ISO-8859-1\")));\n String authHeader=\"Basic \"+new String(encodedAuth);\n httppost.setHeader(HttpHeaders.AUTHORIZATION,authHeader);\n String json=\"{\\\"name\\\": \\\"ploiko\\\"}\";\n httppost.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));\n HttpResponse httpresponse = httpclient.execute(httppost);\n System.out.println(httpresponse.getStatusLine());\n int actual=httpresponse.getStatusLine().getStatusCode();\n Assert.assertEquals(actual,201);\n //System.out.println(getHeaders(httpresponse,\"Access-Control-Allow-Methods\"));\n //System.out.println(httpresponse.getAllHeaders().toString());\n\n }", "@Test\n public void getRequest2() {\n str = METHOD_GET + \"/wiki/page.html \" + HTTP_VERSION + ENDL +\n HOST_HEADER + \": ru.wikipedia.org\" + ENDL +\n USER_AGENT + \": Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5\" + ENDL +\n ACCEPT + \": text/html\" + ENDL +\n CONNECTION_CLOSE;\n request = new HttpRequest(str, IP_ADDRESS, HOST);\n\n assertEquals(request.getMethod(), HttpMethod.GET);\n assertEquals(request.getUrn(), \"/wiki/page.html\");\n assertEquals(request.getHeader(HOST_HEADER), \"ru.wikipedia.org\");\n assertEquals(request.getHeader(USER_AGENT),\n \"Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5\");\n assertEquals(request.getHeader(ACCEPT), \"text/html\");\n assertEquals(request.getHeader(CONNECTION), CLOSE_STR);\n assertEquals(request.getHeader(NONEXISTENT_VAR), \"\");\n assertEquals(request.getParameter(NONEXISTENT_VAR), \"\");\n }", "protected void doGet(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\n String action = request.getParameter(\"action\");\r\n\r\n try {\r\n switch (action)\r\n {\r\n case \"/getUser\":\r\n \tgetUser(request, response);\r\n break;\r\n \r\n }\r\n } catch (Exception ex) {\r\n throw new ServletException(ex);\r\n }\r\n }" ]
[ "0.72099185", "0.6887084", "0.6577497", "0.6456418", "0.64498824", "0.64131236", "0.6404304", "0.6390762", "0.6385095", "0.6383808", "0.63729286", "0.6361075", "0.63253754", "0.6189557", "0.6171696", "0.61331344", "0.6086774", "0.60610867", "0.605252", "0.6019567", "0.6010914", "0.59858704", "0.5973391", "0.5903497", "0.5902158", "0.5898132", "0.58837813", "0.5878814", "0.58773595", "0.5858673", "0.585708", "0.5851317", "0.58411604", "0.5838438", "0.58375096", "0.58245623", "0.58195204", "0.58140266", "0.5811135", "0.58053404", "0.58031636", "0.5786981", "0.57861733", "0.5780614", "0.576829", "0.57612604", "0.5745685", "0.5740744", "0.5737174", "0.57261467", "0.5712216", "0.57097805", "0.5699164", "0.5698824", "0.56775004", "0.5664417", "0.5661598", "0.56591827", "0.56564724", "0.56497455", "0.56483555", "0.56451386", "0.5625633", "0.5623305", "0.5609429", "0.56089634", "0.56075895", "0.55904925", "0.55893826", "0.5586245", "0.5586245", "0.5580404", "0.5579415", "0.5572258", "0.5570358", "0.5569428", "0.5561329", "0.5555995", "0.5549359", "0.55479723", "0.5547953", "0.55454165", "0.55443764", "0.55319387", "0.55315036", "0.5529184", "0.5526185", "0.55261165", "0.55140907", "0.55066204", "0.5506216", "0.5497453", "0.5496383", "0.54960173", "0.54960173", "0.5491779", "0.5490284", "0.54894495", "0.5480888", "0.54798084", "0.547699" ]
0.0
-1
send a method not allowed and verify the module is filtering the request send a request to get (no preflight)
@Test public void testDefaultOriginMethodNotAllowed() throws Exception { final HttpResponse response = Request.Post("http://localhost:" + httpPort.getValue() + CORS_DEFAULT_ENDPOINT_PATH).addHeader("Origin", CORS_DEFAULT_ORIGIN).execute().returnResponse(); //a well behaved client should have sent a preflight //but we don't want to be well behaved assertNull("Allowed origin should NOT be present", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN)); //the payload should NOT be the expected response assertThat(IOUtils.toString(response.getEntity().getContent()), not(equalTo(EXPECTED_RETURN))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkRequest(Request req) throws MethodNotAllowed, NotFound {\n if (!req.getHeader(\"Method\").equals(\"GET\") ||\n !req.getHeader(\"Version\").equals(\"HTTP/1.1\")) {\n throw new MethodNotAllowed();\n }\n if (req.getHeader(\"Path\").endsWith(\"/\")) {\n throw new NotFound();\n }\n }", "protected boolean methodForbidden() {\n return methodToTest.getName().equals(\"getClassNull\")\n || methodToTest.getName().startsWith(\"isA\")\n || methodToTest.getName().equals(\"create\")\n || methodToTest.getName().equals(\"getTipString\")\n || methodToTest.getName().equals(\"toString\");\n }", "private boolean isPreflight(HttpServletRequest request) {\n return request.getMethod().equals(\"OPTIONS\");\n }", "private void sendNoSuchMethod(HttpRequest request, HttpResponse response) {\n\t\tresponse.clearContent();\n\t\tresponse.setStatus( HttpResponse.STATUS_NOT_FOUND );\n\t\tresponse.setContentType( \"text/plain\" );\n\t\tresponse.println ( \"The method you requested is not known to this service!\" );\n\t\tconnector.logError(\"Invocation request \" + request.getPath() + \" for unknown service method\");\n\t}", "public static ChannelFuture send405MethodNotAllowed(ChannelHandlerContext ctx, Map<String, String> headersMap, byte[] data, boolean useDefaultListener) {\n return checkBeforeSend(ctx, METHOD_NOT_ALLOWED, headersMap, data, useDefaultListener, \"METHOD NOT ALLOWED\");\n }", "@ResponseStatus (HttpStatus.METHOD_NOT_ALLOWED)\n\t@ExceptionHandler (HttpRequestMethodNotSupportedException.class)\n\tpublic Result handleHttpRequestMethodNotSupportedException (HttpRequestMethodNotSupportedException e)\n\t{\n\t\treturn new Result ().failure (\"request_method_not_supported\");\n\t}", "@Override\r\n\tpublic void list_privateWithoutViewPrivate() throws Exception {\n\t\tif (JavastravaApplicationConfig.STRAVA_ALLOWS_CHALLENGES_ENDPOINT) {\r\n\t\t\tsuper.list_privateWithoutViewPrivate();\r\n\t\t}\r\n\t}", "@Override\r\n\tprotected ResponseEntity<Object> handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException ex,\r\n\t\t\tHttpHeaders headers, HttpStatus status, WebRequest request) {\n\t\treturn super.handleHttpRequestMethodNotSupported(ex, headers, status, request);\r\n\t}", "@Test\n\tpublic void othersShouldNotBeAbleToLookAtLeonardsQueryByItsPrivateId() throws Exception {\n\t\tthis.mockMvc.perform(get(\"/user/me/queries/123456789\").accept(MediaType.APPLICATION_JSON)).\n\t\t\t\tandExpect(status().isForbidden());\n\t}", "@Override\r\n public boolean isRequest() {\n return false;\r\n }", "@Override\r\n\tprotected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex,\r\n\t\t\tHttpHeaders headers, HttpStatus status, WebRequest request) {\n\t\treturn super.handleMethodArgumentNotValid(ex, headers, status, request);\r\n\t}", "private void defaultMalwareShouldNotBeFound(String filter) throws Exception {\n restMalwareMockMvc.perform(get(\"/api/malwares?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))\n .andExpect(jsonPath(\"$\").isArray())\n .andExpect(jsonPath(\"$\").isEmpty());\n }", "@Test\n void preFlightTestFromAllowedOrigin() {\n ResponseSpec response = client.options()\n .uri(BASE_GUESTBOOK_URL)\n .header(\"Access-Control-Request-Method\", \"GET\")\n .header(\"Origin\", \"http://allowed-origin.ca\")\n .exchange();\n\n response.expectHeader().valueEquals(\"Access-Control-Allow-Methods\", \"GET,POST\")\n .expectHeader().valueEquals(\"Access-Control-Allow-Origin\", \"http://allowed-origin.ca\");\n }", "public void testCheckTokenEndPointIsDisabled() throws Exception {\n // perform POST to /oauth/check_token endpoint with authentication\n this.mockMvc\n .perform(MockMvcRequestBuilders.post(\"/oauth/check_token\").param(\"token\", \"some random value\")\n .principal(new UsernamePasswordAuthenticationToken(testClientId, \"\",\n Arrays.asList(new SimpleGrantedAuthority(\"ROLE_USER\")))))\n // we expect a 403 not authorized\n .andExpect(MockMvcResultMatchers.status().is(403));\n }", "@ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)\n @ExceptionHandler(HttpRequestMethodNotSupportedException.class)\n public Result<Object> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {\n logger.error(\"\", e);\n return new Result<Object>(405,\"不支持当前请求方法\");\n }", "public boolean isRequest(){\n return false;\n }", "void blocked(HttpServletRequest request, HttpServletResponse response) throws IOException;", "protected abstract String getAllowedRequests();", "public void test5(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {\n InetAddress addr = InetAddress.getByName(request.getRemoteAddr());\n if(addr.getCanonicalHostName().matches(\"trustme.com\")){ // disabled\n\n }\n }", "public void test1(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {\n InetAddress addr = InetAddress.getByName(request.getRemoteAddr());\n\n if(addr.getCanonicalHostName().contains(\"trustme.com\")){ // disabled\n\n }\n }", "@Override\n protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {\n final String method = req.getParameter(METHOD);\n if (GET.equals(method)) {\n doGet(req, resp);\n } else {\n resp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);\n }\n }", "@ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)\n @ExceptionHandler(HttpRequestMethodNotSupportedException.class)\n public String handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {\n log.error(\"不支持当前请求方法\", e);\n return new Msg().fail().addVal(Msg.msg, \"request_method_not_supported\").toJson();\n }", "@Override\n\tpublic boolean isDenied();", "@Override\n\tprotected Method getMethod() {\n\t\treturn Method.GET;\n\t}", "boolean hasHttpMethod();", "@Override\r\n protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws IOException {\n \tboolean b = WebUtil.isAjax((HttpServletRequest)request);\r\n \tif(b){//ajax請求,没有权限操作的\r\n JSONObject js = new JSONObject();\r\n js.put(\"isDenied\", true);\r\n js.put(\"message\", \"沒有权限执行该操作\");\r\n WebUtil.printJson(response, js);\r\n return false;\r\n \t}\r\n \treturn super.onAccessDenied(request, response);\r\n }", "Set<HttpMethod> optionsForAllow(URI url) throws RestClientException;", "public String formNotAllowed()\r\n {\r\n return formError(\"403 Access Denied\",\"Access is not allowed\");\r\n }", "@ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)\n @ExceptionHandler(HttpRequestMethodNotSupportedException.class)\n public AjaxResult<String> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {\n log.error(\"不支持当前请求方法\", e);\n return new AjaxResult<String>(ResultStatusCode.METHOD_NOT_ALLOWED.getCode(), ResultStatusCode.METHOD_NOT_ALLOWED.getMsg());\n }", "@Override\n public ServiceResponse allowedMethods(final ServiceRequest request) throws SOAPException {\n return this.soapClient.allowedMethods(request, this.getTargetUrl());\n }", "public String formForbidden()\r\n {\r\n return formError(\"403 Forbidden\",\"You need permission for this service\");\r\n }", "@Override\r\n\tpublic void list_private() throws Exception {\n\t\tif (JavastravaApplicationConfig.STRAVA_ALLOWS_CHALLENGES_ENDPOINT) {\r\n\t\t\tsuper.list_private();\r\n\t\t}\r\n\t}", "@Override\n\tboolean isRegistedMethodNotNeed() {\n\t\treturn true;\n\t}", "@Override\n\tpublic String getRequestMethod() {\n\t\treturn requestMethod;\n\t}", "@Override\n\tprotected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue)\n\t\t\tthrows Exception {\n\t\treturn false;\n\t}", "@Bean\n public HiddenHttpMethodFilter hiddenHttpMethodFilter() {\n return new HiddenHttpMethodFilter() {\n @Override\n public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {\n return chain.filter(exchange);\n }\n };\n }", "@Test\n @OperateOnDeployment(\"server\")\n public void shouldFailToGetResourceWhenHttpMethodIncorrect() {\n given().header(\"Authorization\", \"Bearer access_token\").expect().statusCode(400).when().put(\n getBaseTestUrl() + \"/1/category/get/json/1\");\n }", "@Test\n public void testPreflight() throws Exception {\n final HttpResponse response = Request.Options(\"http://localhost:\" + httpPort.getValue() + CORS_CONFIGURED_ENDPOINT_PATH)\n .addHeader(\"Origin\", CORS_TEST_ORIGIN)\n .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_METHOD, \"GET\")\n .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_HEADERS, \"X-Allow-Origin\")\n .execute().returnResponse();\n\n Header allowOrigin = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN);\n Header allowMethods = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_METHODS);\n\n assertNotNull(allowOrigin);\n assertNotNull(allowMethods);\n assertThat(allowOrigin.getValue(), equalTo(CORS_TEST_ORIGIN));\n assertThat(allowMethods.getValue(), containsString(\"GET\"));\n assertThat(allowMethods.getValue(), containsString(\"PUT\"));\n }", "@ExceptionHandler(HttpRequestMethodNotSupportedException.class)\r\n public ResponseEntity<DefaultErrorList> handlerMethodNotSupported(HttpRequestMethodNotSupportedException ex, HttpServletRequest request) {\r\n\t\tLOGGER.error(\"Error metodo HTTP no soportado para este endpoint, {}\", request.getRequestURL().toString());\r\n\t\treturn new ResponseEntity<DefaultErrorList>(new DefaultErrorList(new DefaultError\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(GeneralCatalog.GRAL001.getCode(),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGeneralCatalog.GRAL001.getMessage(),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGeneralCatalog.GRAL001.getLevelException().toString(),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"Metodo HTTP no soportado para este endpoint\",\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trequest.getRequestURL().toString()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)), HttpStatus.INTERNAL_SERVER_ERROR);\r\n }", "@Test\n public void testTokenEndPointNoParams() throws Exception {\n refreshRequestAndResponse();\n request.setRequestURI(\"/v2/token\");\n request.setMethod(\"POST\");\n handlerAdapter.handle(request, response, controller);\n logger.info(\"testTokenEndPointNoParams() => \" + response.getContentAsString());\n \n assertTrue(response.getContentAsString().contains(ERR_RESPONSE));\n assertTrue( response.getStatus() == HttpServletResponse.SC_BAD_REQUEST ||\n response.getStatus() == HttpServletResponse.SC_UNAUTHORIZED );\n }", "public Boolean isProhibited() {\n throw new NotImplementedException();\n }", "Method getMethod(int id, boolean filterObsolete);", "@RequestMapping\n public void othersRooms() throws MethodNotAllowedException {\n throw new MethodNotAllowedException();\n }", "@Test\n public void testHttp405NotAllowedMethod() {\n final NioEventLoopGroup bootGroup = new NioEventLoopGroup();\n final NioEventLoopGroup processGroup = new NioEventLoopGroup();\n final String json = \"{\\\"action\\\":\\\"ping\\\"}\";\n final ByteBuf content = Unpooled.copiedBuffer(json, StandardCharsets.UTF_8);\n\n final ChannelFuture serverChannel = runServer(bootGroup, processGroup);\n runClient(HttpMethod.PUT, content, uri);\n\n serverChannel.awaitUninterruptibly();\n bootGroup.shutdownGracefully();\n processGroup.shutdownGracefully();\n\n final String expected = \"{\\\"action\\\":\\\"error\\\",\\\"content\\\":\\\"Ping Pong server failure\\\",\\\"status\\\":\\\"405 Method Not Allowed\\\"}\";\n final String actual = buffer.toString();\n logger.info(\"Expected result: {}\", expected);\n logger.info(\"Actual result: {}\", actual);\n Assert.assertEquals(\"Hadn't processed the request: 405 Method Not Allowed\", expected, actual);\n }", "private void sendSecurityProblems(HttpRequest request,\n\t\t\tHttpResponse response, L2pSecurityException e) {\n\t\tresponse.clearContent();\n\t\tresponse.setStatus( HttpResponse.STATUS_FORBIDDEN );\n\t\tresponse.setContentType( \"text/plain\" );\n\t\tresponse.println ( \"You don't have access to the method you requested\" );\n\t\tconnector.logError(\"Security exception in invocation request \" + request.getPath());\n\t\t\n\t\tif ( System.getProperty(\"http-connector.printSecException\") != null\n\t\t\t\t&& System.getProperty( \"http-connector.printSecException\").equals ( \"true\" ) )\n\t\t\te.printStackTrace();\n\t}", "@Override\n\tprotected boolean onAccessDenied(ServletRequest arg0, ServletResponse arg1) throws Exception {\n\t\treturn false;\n\t}", "@Test\r\n\tpublic void testDenyFriendRequest() {\r\n\t\tPerson p1 = new Person(0);\r\n\t\tp1.receiveFriendRequest(\"JavaLord\", \"JavaLordDisplayName\");\r\n\t\tassertTrue(p1.hasFriendRequest(\"JavaLord\"));\r\n\t\tassertTrue(p1.denyFriendRequest(\"JavaLord\"));\r\n\t\tassertFalse(p1.denyFriendRequest(\"JavaLord\"));\r\n\t}", "@Test\n void sendGetRequest() {\n try {\n String response = HttpUtils.sendGet();\n assertFalse(response.contains(\"404\"));\n } catch (IOException e) {\n e.printStackTrace();\n fail();\n }\n }", "@Test\n\t@WithMockUser(username = \"cadmin\", password = \"test\", roles = \"CADMIN\")\n\tpublic void testSendRequestNotAuthorized() throws Exception {\n\n\t\tJSONObject obj = new JSONObject();\n\t\tobj.put(\"idNextProcedure\", 2);\n\t\tobj.put(\"idRoom\", 9);\n\t\tobj.put(\"date\", \"05.03.2020\");\n\t\tobj.put(\"time\", \"\");\n\t\tobj.put(\"idDoctorNew\", \"none\");\n\t\tString json = obj.toString();\n\n\t\tPrincipal mockPrincipal = Mockito.mock(Principal.class);\n\n\t\tMockito.when(nextExaminationService.arrangeExamination(json, null)).thenReturn(false);\n\t\tthis.mockMvc.perform(MockMvcRequestBuilders.post(\"/ca/arrangeExamination\").principal(mockPrincipal)\n\t\t\t\t.content(json).contentType(MediaType.APPLICATION_JSON))\n\t\t.andExpect(MockMvcResultMatchers.status().isBadRequest());\n\n\t}", "@Override\n public void onRequestNoAsk(String permissionName) {\n }", "public String getRequestMethod(){\n return this.requestMethod;\n }", "public HTTPRequestMethod getMethod();", "@Override\n public void onRequestAllow(String permissionName) {\n }", "private AylaCallResponse checkRequest(int method, AylaRestService rs) {\n\t\tBundle responseBundle = null;\n\t\tAylaCallResponse commitResponse = null;\n\n\t\t// If this is a LAN mode request other than a notification, and we are not on the LAN, then fail immediately\n\t\tif ( (method != AylaRestService.PROPERTY_CHANGE_NOTIFIER) &&\n (method != AylaRestService.SEND_NETWORK_PROFILE_LANMODE) &&\n\t\t\t\tsupportsLanModeResponse(method) &&\n\t\t\t\t!AylaReachability.isWiFiConnected(null) &&\n // While we are in secure setup mode, wifi connectivity can report strange things\n AylaLanMode.getSecureSetupDevice() == null) {\n\t\t\tAylaSystemUtils.saveToLog(\"%s, %s, %s:%d, %s\", \"E\", \"ExecuteRequest\", \"!LAN && supportsLanModeResponse\", method, \"execute\");\n\t\t\tresponseBundle = new Bundle();\n\t\t\tresponseBundle.putString(\"result\", rs.jsonResults); // response v3.07\n\t\t\tresponseBundle.putInt(\"subTask\", rs.subTaskFailed);\n\t\t\tresponseCode = AylaNetworks.AML_ERROR_UNREACHABLE;\n\n\t\t\tif (async) {\n\t\t\t\treceiver.send(responseCode, responseBundle);\n\t\t\t} else {\n\t\t\t\tcommitResponse = new AylaCallResponse(responseCode, responseBundle);\n\t\t\t}\n\t\t\treturn commitResponse;\n\t\t}\n\n\t\t// If this is request is going to a device directly, make sure the device we want to\n\t\t// contact is reachable. First get the URL from the rest service and see if it's a real\n\t\t// URL. If so, we'll see if it's addressed to one of our local devices.\n\t\tURL destinationURL;\n\t\ttry {\n\t\t\tdestinationURL = new URL(this.url);\n\t\t} catch (MalformedURLException ex) {\n\t\t\t// Ignore\n\t\t\tdestinationURL = null;\n\t\t}\n\n\t\t// If we got a valid URL for the destination, see if it's destined for a local device.\n\t\t// We will know that if DeviceManager finds it by the URL host, which will be the\n\t\t// device's IP address if this is in fact destined for a device.\n\t\tAylaDevice targetDevice = null;\n\t\tif ( destinationURL != null ) {\n\t\t\ttargetDevice = AylaDeviceManager.sharedManager().deviceWithLanIP(destinationURL.getHost());\n\t\t\tif ( targetDevice != null\n\t\t\t // Special case for getting the new device registration token during same lan registration flow\n\t\t\t && method != AylaRestService.GET_MODULE_REGISTRATION_TOKEN\n\t\t\t) {\n\t\t\t\t// Make sure the target device is reachable via the LAN\n\t\t\t\tint canReach = AylaReachability.getDeviceReachability(targetDevice);\n\t\t\t\tif ( canReach != AylaNetworks.AML_REACHABILITY_REACHABLE ) {\n\t\t\t\t\t// Throw out this request- we know now that it will fail, and don't want to\n\t\t\t\t\t// take the time to wait for it to do so.\n\t\t\t\t\tAylaSystemUtils.saveToLog(\"%s, %s, %s:%s, %s, %s.\", \"E\", \"ExecuteRequest\",\n\t\t\t\t\t\t\t\"LM device not reachable\", destinationURL.toString(),\n\t\t\t\t\t\t\t\"canReach:\" + canReach, \"execute\");\n\t\t\t\t\tresponseBundle = new Bundle();\n\t\t\t\t\tresponseBundle.putString(\"result\", rs.jsonResults); // response v3.07\n\t\t\t\t\tresponseBundle.putInt(\"subTask\", rs.subTaskFailed);\n\t\t\t\t\tresponseCode = AylaNetworks.AML_ERROR_UNREACHABLE;\n\n\t\t\t\t\tif (async) {\n\t\t\t\t\t\treceiver.send(responseCode, responseBundle);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcommitResponse = new AylaCallResponse(responseCode, responseBundle);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If this is a cloud request, and we can't reach the cloud, fail immediately\n\t\tif (!AylaReachability.isCloudServiceAvailable()) {\n\t\t\tif (AylaReachability.isDeviceLanModeAvailable(null) && supportsLanModeResponse(method)) {\n\t\t\t\t// We aren't connected to the cloud, but we are connected to the LAN mode device\n\t\t\t\tAylaSystemUtils.saveToLog(\"%s, %s, %s:%d, %s\", \"V\", \"ExecuteRequest\", \"lanMode\", method, \"execute\");\n\t\t\t} else if (!supportsOfflineResponse(method)) {\n\t\t\t\t// Make sure the method supports cached results if we cannot reach the service.\\\n\t\t\t\t// return failure here\n\t\t\t\tAylaSystemUtils.saveToLog(\"%s, %s, %s:%d, %s\", \"E\", \"ExecuteRequest\", \"!cloud && !supportOffline\", method, \"execute\");\n\t\t\t\tresponseBundle = new Bundle();\n\t\t\t\tresponseBundle.putString(\"result\", rs.jsonResults); // response v3.07\n\t\t\t\tresponseBundle.putInt(\"subTask\", rs.subTaskFailed);\n\t\t\t\tresponseCode = AylaNetworks.AML_ERROR_UNREACHABLE;\n\n\t\t\t\tif (async) {\n\t\t\t\t\treceiver.send(responseCode, responseBundle);\n\t\t\t\t} else {\n\t\t\t\t\tcommitResponse = new AylaCallResponse(responseCode, responseBundle);\n\t\t\t\t}\n\t\t\t\treturn commitResponse;\n\t\t\t} else {\n\t\t\t\tAylaSystemUtils.saveToLog(\"%s, %s, %s:%d, %s\", \"V\", \"ExecuteRequest\", \"cached\", method, \"execute\");\n\t\t\t}\n\t\t}\n\n\t\treturn commitResponse;\n\t}", "@Override\n\tpublic boolean checkAuthorization(HttpServletRequest request) {\n\t\treturn true;\n\t}", "@Override\n\tpublic void beforeAction(String method, HttpServletRequest request, HttpServletResponse response) {\n\t\t// Default behavior : nothing to do \n\t}", "@Override\n\tprotected boolean isAccessAllowed(ServletRequest request,\n\t\t\tServletResponse response, Object mappedValue) {\n\t\treturn false;\n\t}", "@Test\n public void testNoAuthorization() {\n Response r = target(\"/token\")\n .request()\n .get();\n\n assertEquals(Status.UNAUTHORIZED.getStatusCode(), r.getStatus());\n }", "public SimpleResponse NOT_AUTHORIZED() {\n this.state = NOT_AUTHORIZED;\n return ERROR_CUSTOM();\n }", "private void defaultIndActivationShouldNotBeFound(String filter) throws Exception {\n restIndActivationMockMvc\n .perform(get(ENTITY_API_URL + \"?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))\n .andExpect(jsonPath(\"$\").isArray())\n .andExpect(jsonPath(\"$\").isEmpty());\n\n // Check, that the count call also returns 0\n restIndActivationMockMvc\n .perform(get(ENTITY_API_URL + \"/count?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))\n .andExpect(content().string(\"0\"));\n }", "@ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)\n @ExceptionHandler(HttpRequestMethodNotSupportedException.class)\n public ModelAndView handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {\n //log.error(\"不支持当前请求方法\", e);\n String message = \"【不支持当前请求方法】\" + e.getMessage();\n ModelAndView modelAndView = new ModelAndView(\"error/error\");\n modelAndView.addObject(\"message\", message);\n modelAndView.addObject(\"code\", 405);\n modelAndView.addObject(\"exception\", e);\n return modelAndView;\n }", "public HttpMethod getMethod()\r\n/* 31: */ {\r\n/* 32:60 */ return HttpMethod.valueOf(this.httpRequest.getMethod());\r\n/* 33: */ }", "public boolean hasHttpMethod() {\n return ((bitField0_ & 0x00000002) == 0x00000002);\n }", "@Test\n\tpublic void testUpdateActionIsNotPerformedWhenPermissionInheritedAndRequestIsDevoidOfAuthInfos()\n\t\t\tthrows Throwable {\n\t\tcheck(null, new ResponseHandler() {\n\t\t\tpublic void handleResponse(HttpResponse response)\n\t\t\t\t\tthrows Throwable {\n\t\t\t\tassertIsUnauthorized(response);\n\t\t\t\tassertFirstErrorOfEntityEquals(response, ErrorCode.NO_PERM_UPDATE);\n\t\t\t}\n\t\t});\n\t}", "public boolean logAccess() {\n Map<String, String> response;\n try {\n response = logMessageService.sendRequestMessage(\"\");\n } catch (Exception exception) {\n LOGGER.warn(\"Log message could not be sent. [exception=({})]\", exception.getMessage());\n return allowAccess();\n }\n if (response != null) {\n return allowAccess();\n } else {\n LOGGER.warn(\"No response received.\");\n return allowAccess();\n }\n }", "public String formUnauthorized()\r\n {\r\n return formError(\"401 Unauthorized\",\"Unauthorized use of this service\");\r\n }", "@Test\n\tpublic void testUpdateActionIsNotPerformedWhenPermissionInheritedAndUserAuthenticatedButNotAllowed()\n\t\t\tthrows Throwable {\n\t\tcheck(getAuthenticatedButNotAllowedUser(), new ResponseHandler() {\n\t\t\tpublic void handleResponse(HttpResponse response)\n\t\t\t\t\tthrows Throwable {\n\t\t\t\tassertIsUnauthorized(response);\n\t\t\t\tassertFirstErrorOfEntityEquals(response, ErrorCode.NO_PERM_UPDATE);\n\t\t\t}\n\t\t});\n\t}", "public RestUtils setMethodGet()\n\t{\n\t\trestMethodDef.setHttpMethodPost(false);\n\t\treturn this;\n\t}", "@ExceptionHandler(MethodNotAllowedException.class)\n @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)\n public ExceptionResponse methodNotAllowedException(final MethodNotAllowedException notAllowedException) {\n return processError(notAllowedException, HttpStatus.METHOD_NOT_ALLOWED);\n }", "@Override\n\tprotected boolean isAccessAllowed(ServletRequest arg0, ServletResponse arg1, Object arg2) throws Exception {\n\t\tString header = ((HttpServletRequest) arg0).getHeader(\"X-Requested-With\");\n\t\tif (ShiroUtil.getShiroUser() != null) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tif (\"XMLHttpRequest\".equalsIgnoreCase(header)) {\n\t\t\t\t// ajax判断是否登陆,并可返回json\n\t\t\t\targ1.setCharacterEncoding(\"utf-8\");\n\t\t\t\targ1.getWriter().write(\"用户登录失效,重新登录\");\n\t\t\t}\n\n\t\t}\n\t\treturn false;\n\n\t}", "@JsonIgnore\n public boolean isAccesible() {\n return isGateway();\n }", "public String getRequestMethod()\n {\n return requestMethod;\n }", "private boolean checkForAjax(HttpServletRequest request, HttpServletResponse response) {\n if (!\"XMLHttpRequest\".equals(request.getHeader(\"X-Requested-With\"))) {\n log.log(\n Level.SEVERE, \"Received unexpected non-XMLHttpRequest command. Possible CSRF attack.\");\n try {\n response.sendError(HttpServletResponse.SC_FORBIDDEN,\n \"Received unexpected non-XMLHttpRequest command.\");\n } catch (IOException ioe) {\n throw new RuntimeException(\"Encountered error writing error\", ioe);\n }\n return false;\n }\n return true;\n }", "public boolean hasHttpMethod() {\n return ((bitField0_ & 0x00000002) == 0x00000002);\n }", "@PreAuthorize(\"hasAuthority('ROLE_USER')\") //got a 401 event though my antMatcher was set to allow all for dist\n @GetMapping(\"distance/{id}\")\n public ResponseEntity<?> getDistanceById(@PathVariable(\"id\") Integer id) throws ResourceNotFoundException{\n log.info(\"getDistanceById\");\n Distance distance = distanceService.getDistanceById(id);\n if (distance == null){\n // return new ResponseEntity<CustomErrorMsg>(new CustomErrorMsg(\"Distance ID \" + id + \" Not Found\"),HttpStatus.NOT_FOUND);\n throw new ResourceNotFoundException(\"Distance ID \" + id + \" Not Found\");\n }\n return new ResponseEntity<Distance>(distance, HttpStatus.OK);\n }", "private boolean allowFeedsCollectionAccess(AuthzResource resource,\tString method, String subject, String subjectgroup) {\n\t\treturn method != null && (method.equalsIgnoreCase(\"GET\") || method.equalsIgnoreCase(\"POST\"));\n\t}", "@Test\n\tpublic void testFilteredRequest() {\n\n\t\tHttpRepublisher testerRepublisher = PowerMockito.spy(republisher);\n\t\ttesterRepublisher.setPathFilter(\"^/api.*\");\n\t\tWhitebox.setInternalState(testerRepublisher, ExecutorService.class, executorMock);\n\t\t//force API to not match pattern\n\t\tInvokedRequestDetails dummyRequestDetails = new InvokedRequestDetails(\"/notAPI\", httpRequest, httpHeaders,\n\t\t\t\t\"dummyBody\", false);\n\n\t\twhen(actionedRequest.getRequest()).thenReturn(dummyRequestDetails);\n\t\ttesterRepublisher.submitRequest(actionedRequest);\n\t\t//it should never get onto executor\n\t\tverify(actionedRequest,times(1)).setIgnored();\n\n\t}", "@Test\n public void testAliceAccess() throws IOException {\n HttpResponse response = makeRequest(\"http://localhost:8080/api/alice\", \"alice\", \"alice\");\n assertAccessGranted(response, \"alice\");\n\n // alice can not access information about jdoe\n response = makeRequest(\"http://localhost:8080/api/jdoe\", \"alice\", \"alice\");\n assertEquals(403, response.getStatusLine().getStatusCode());\n }", "@Override\n\t\tpublic String getMethod() {\n\t\t\treturn null;\n\t\t}", "private void filterAndHandleRequest () {\n\t// Filter the request based on the header.\n\t// A response means that the request is blocked.\n\t// For ad blocking, bad header configuration (http/1.1 correctness) ... \n\tHttpHeaderFilterer filterer = proxy.getHttpHeaderFilterer ();\n\tHttpHeader badresponse = filterer.filterHttpIn (this, channel, request);\n\tif (badresponse != null) {\n\t statusCode = badresponse.getStatusCode ();\n\t sendAndClose (badresponse);\n\t} else {\n\t status = \"Handling request\";\n\t if (getMeta ())\n\t\thandleMeta ();\n\t else\n\t\thandleRequest ();\n\t}\n }", "@Test\n public void testReceiverDonorEndpointNoFilters() {\n ResponseEntity response = dataController.getDonorDataRegion(null, null, null);\n assertNotNull(response.getBody());\n assertEquals(HttpStatus.OK, response.getStatusCode());\n }", "void checkPermission(T request) throws AuthorizationException;", "@Override\n\tprotected Set<RequestTypeEnum> provideAllowableRequestTypes() {\n\t\treturn Collections.singleton(RequestTypeEnum.POST);\n\t}", "@Test\n\tpublic void testUpdateActionIsNotPerformedWhenPermissionInheritedAndUserNotAuthenticated()\n\t\t\tthrows Throwable {\n\t\tcheck(getNonAuthenticatedUser(), HttpStatus.SC_UNAUTHORIZED);\n\t}", "@Override\r\n\tprotected ResponseEntity<Object> handleMethodArgumentNotValid(\r\n\t MethodArgumentNotValidException ex, \r\n\t HttpHeaders headers, \r\n\t HttpStatus status, \r\n\t WebRequest request) {\r\n\t List<String> errors = new ArrayList<String>();\r\n\t for (FieldError error : ex.getBindingResult().getFieldErrors()) {\r\n\t errors.add(error.getField() + \": \" + error.getDefaultMessage());\r\n\t }\r\n\t for (ObjectError error : ex.getBindingResult().getGlobalErrors()) {\r\n\t errors.add(error.getObjectName() + \": \" + error.getDefaultMessage());\r\n\t }\r\n\t \r\n\t ApiError apiError = \r\n\t new ApiError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), errors);\r\n\t return handleExceptionInternal(\r\n\t ex, apiError, headers, apiError.getStatus(), request);\r\n\t}", "private void defaultSuiviModuleShouldNotBeFound(String filter) throws Exception {\n restSuiviModuleMockMvc.perform(get(\"/api/suivi-modules?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))\n .andExpect(jsonPath(\"$\").isArray())\n .andExpect(jsonPath(\"$\").isEmpty());\n\n // Check, that the count call also returns 0\n restSuiviModuleMockMvc.perform(get(\"/api/suivi-modules/count?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))\n .andExpect(content().string(\"0\"));\n }", "@Override\n public List<CryptoAddressRequest> listPendingCryptoAddressRequests() throws CantListPendingCryptoAddressRequestsException {\n try {\n\n return cryptoAddressesNetworkServiceDao.listPendingRequestsByProtocolStateAndAction(ProtocolState.PENDING_ACTION, RequestAction.REQUEST);\n\n } catch (CantListPendingCryptoAddressRequestsException e){\n\n errorManager.reportUnexpectedPluginException(this.getPluginVersionReference(), UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, e);\n throw e;\n } catch (Exception e){\n\n errorManager.reportUnexpectedPluginException(this.getPluginVersionReference(), UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, e);\n throw new CantListPendingCryptoAddressRequestsException(FermatException.wrapException(e), null, \"Unhandled Exception.\");\n }\n }", "@RequestMapping(value = \"/access-denied.do\", method = RequestMethod.GET)\n public String accessDenied(HttpServletRequest request, Model model) {\n logger.debug(\"SMNLOG:ACCESS DENIED\");\n return \"accessDenied\";\n }", "private void defaultKpiShouldNotBeFound(String filter) throws Exception {\n restKpiMockMvc\n .perform(get(ENTITY_API_URL + \"?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))\n .andExpect(jsonPath(\"$\").isArray())\n .andExpect(jsonPath(\"$\").isEmpty());\n\n // Check, that the count call also returns 0\n restKpiMockMvc\n .perform(get(ENTITY_API_URL + \"/count?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))\n .andExpect(content().string(\"0\"));\n }", "void permissionDenied(int requestCode, boolean willShowCheckBoxNextTime);", "@Test\n @OperateOnDeployment(\"server\")\n public void shouldFailToGetResourceWhenTokenNonCurrent() {\n given().header(\"Authorization\", \"Bearer noncurrent_access_token\").expect().statusCode(401).when().get(\n getBaseTestUrl() + \"/1/category/get/json/1\");\n }", "public boolean hasReqMethod() {\n return fieldSetFlags()[6];\n }", "private boolean checkPermissions(HttpServletRequest request, RouteAction route) {\n\t\treturn true;\n\t}", "Set<HttpMethod> optionsForAllow(String url, Object... uriVariables) throws RestClientException;", "@Override\n\tpublic void commence(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response,\n\t\t\tAuthenticationException authException) throws IOException, javax.servlet.ServletException {\n\t\tfinal String header = request.getHeader(\"X-Requested-With\");\n\t\tfinal boolean isAjaxRequest = \"XMLHttpRequest\".equalsIgnoreCase(header);\n\n\t\tif (isAjaxRequest) {\n\t\t\tresponse.sendError(HttpStatus.UNAUTHORIZED.value());\n\t\t} else {\n\t\t\tsuper.commence(request, response, authException);\n\t\t}\n\t}", "boolean getAllowCors();", "public void setReqMethod(java.lang.String value) {\n this.req_method = value;\n }", "private void defaultIndContactCharShouldNotBeFound(String filter) throws Exception {\n restIndContactCharMockMvc\n .perform(get(ENTITY_API_URL + \"?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))\n .andExpect(jsonPath(\"$\").isArray())\n .andExpect(jsonPath(\"$\").isEmpty());\n\n // Check, that the count call also returns 0\n restIndContactCharMockMvc\n .perform(get(ENTITY_API_URL + \"/count?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))\n .andExpect(content().string(\"0\"));\n }", "public void checkRequest(String theRequest, HttpServletRequest request, HttpServletResponse response) {\n try {\n\n Method requestMethod = this.getClass().getDeclaredMethod(theRequest, HttpServletRequest.class, HttpServletResponse.class);\n requestMethod.invoke(this, request, response);\n\n } catch (IllegalAccessException ex) {\n System.err.println(\"IllegalAccessException Error: \" + ex.getCause());\n } catch (IllegalArgumentException ex) {\n System.err.println(\"IllegalArgumentException Error: \" + ex.getCause());\n } catch (NoSuchMethodException ex) {\n System.err.println(\"NoSuchMethodException Error: \" + ex.getCause());\n } catch (SecurityException ex) {\n System.err.println(\"SecurityException Error: \" + ex.getCause());\n } catch (InvocationTargetException ex) {\n System.err.println(\"InvocationTargetException Error: \" + ex.getCause());\n }\n }", "private void defaultPaymentShouldNotBeFound(String filter) throws Exception {\n restPaymentMockMvc.perform(get(\"/api/payments?sort=id,desc&\" + filter))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))\n .andExpect(jsonPath(\"$\").isArray())\n .andExpect(jsonPath(\"$\").isEmpty());\n }" ]
[ "0.6732682", "0.65733624", "0.63028854", "0.6264074", "0.62572175", "0.61559224", "0.61428154", "0.60955983", "0.6054059", "0.6047982", "0.6040786", "0.6031932", "0.59859055", "0.5976106", "0.59505546", "0.5902872", "0.5899868", "0.58991176", "0.58926123", "0.58922", "0.5875114", "0.5872873", "0.5863966", "0.5860645", "0.5856273", "0.58524996", "0.58490694", "0.58472097", "0.57974035", "0.57892144", "0.5777361", "0.5720933", "0.5714699", "0.5708195", "0.5683879", "0.56824917", "0.56705236", "0.56626844", "0.5638651", "0.5638531", "0.5633661", "0.56312", "0.5626083", "0.5615333", "0.5612931", "0.5602474", "0.5575486", "0.55751336", "0.5569004", "0.55533636", "0.55210227", "0.5509275", "0.55054855", "0.550387", "0.5503196", "0.5485159", "0.5483552", "0.54763633", "0.54575926", "0.5443906", "0.5441471", "0.5426434", "0.5424612", "0.54233116", "0.5418525", "0.54144025", "0.54082304", "0.5404392", "0.539609", "0.53930146", "0.53875566", "0.5378307", "0.5375665", "0.53673655", "0.5356501", "0.53560835", "0.53539664", "0.534828", "0.53424853", "0.5330211", "0.5327241", "0.5312304", "0.5305488", "0.5305276", "0.52990234", "0.529642", "0.5291691", "0.52903783", "0.5289041", "0.52882457", "0.52814084", "0.5280258", "0.52763075", "0.52697796", "0.5266372", "0.526405", "0.52594453", "0.525164", "0.52488035", "0.5246775" ]
0.5905127
15
this is a valid scenario but it seems it produces some exceptions.
@Test public void testEmptyConfigPublicResource() throws Exception { final HttpResponse response = Request.Options("http://localhost:" + httpPort.getValue() + CORS_PUBLIC_EMPTY_ENDPOINT_PATH).addHeader("Origin", CORS_TEST_ORIGIN) .addHeader(HttpHeaders.Names.ACCESS_CONTROL_REQUEST_METHOD, "GET").execute().returnResponse(); Header allowOrigin = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN); Header allowMethods = response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_METHODS); assertNotNull(allowOrigin); assertThat(allowOrigin.getValue(), equalTo("*")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void m9741j() throws cf {\r\n }", "@Test(timeout = 4000)\n public void test069() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.mutatesStructure((String) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "public void mo1976s() throws cf {\r\n }", "public void mo1964g() throws cf {\r\n }", "public void mo1962e() throws cf {\r\n }", "@Test(timeout = 4000)\n public void test035() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.mutatesStructure((String) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Test(timeout = 4000)\n public void test13() throws Throwable {\n FileSystemHandling.setPermissions((EvoSuiteFile) null, true, true, true);\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n FBObjectListener.FetcherListener fBObjectListener_FetcherListener0 = null;\n FileSystemHandling.shouldAllThrowIOExceptions();\n linkedList0.add((byte[][]) null);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n // Undeclared exception!\n try { \n fBCachedFetcher0.relative(1433);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.firebirdsql.jdbc.FBCachedFetcher\", e);\n }\n }", "@Test(timeout = 4000)\n public void test098() throws Throwable {\n Frame frame0 = new Frame();\n FileSystemHandling fileSystemHandling0 = new FileSystemHandling();\n ClassWriter classWriter0 = new ClassWriter(16777228);\n ClassWriter classWriter1 = new ClassWriter(2);\n ClassWriter classWriter2 = new ClassWriter(2);\n Item item0 = classWriter2.newLong(2);\n classWriter1.newLong(2178L);\n classWriter2.toByteArray();\n // Undeclared exception!\n try { \n frame0.execute(197, (-5054), classWriter2, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Override\n\t\tpublic void checkPreconditions() {\n\t\t}", "@Test(timeout = 4000)\n public void test155() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"4_R]T<#2)Q?]R7Ut\");\n Submit submit0 = new Submit(xmlEntityRef0, \"\\\"8[P\", \"\\\"8[P\");\n // Undeclared exception!\n try { \n submit0.dfn((Object) null);\n fail(\"Expecting exception: ClassCastException\");\n \n } catch(ClassCastException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "public void mo1944a() throws cf {\r\n }", "@Test(timeout = 4000)\n public void test285() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"z=OF5Ty4t\");\n // Undeclared exception!\n try { \n xmlEntityRef0.small((Object) \"cript\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test108() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(159);\n ClassWriter classWriter1 = new ClassWriter(2);\n classWriter1.newFieldItem(\"y])rS3DhfdTg\", \"y])rS3DhfdTg\", \"\");\n Item item0 = classWriter0.newLong(1);\n classWriter0.newLong(2);\n Item item1 = classWriter0.key2;\n // Undeclared exception!\n try { \n frame0.execute(159, 1, classWriter1, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test254() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"x0\");\n // Undeclared exception!\n try { \n xmlEntityRef0.big((Object) \"x0\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test034() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.mutatesDataOrStructure((String) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Test(timeout = 4000)\n public void test368() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef((String) null);\n // Undeclared exception!\n try { \n xmlEntityRef0.map((String) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test122() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(3131);\n FieldWriter fieldWriter0 = (FieldWriter)classWriter0.visitField(182, \"IK\", \"IK\", \"IK\", \"The FileFilter must not be null\");\n classWriter0.firstField = fieldWriter0;\n ClassWriter classWriter1 = new ClassWriter(1);\n Item item0 = classWriter0.key2;\n fieldWriter0.getSize();\n fieldWriter0.visitAnnotation(\"Exceptions\", false);\n classWriter1.newFloat((-2110.0F));\n item0.hashCode = 231;\n // Undeclared exception!\n try { \n frame0.execute(182, 1, classWriter1, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test037() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.mutatesDataOrStructure((String) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Test(timeout = 4000)\n public void test033() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.mutatesStructure((String) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Test(timeout = 4000)\n public void test081() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(0);\n int int0 = 251658240;\n ClassWriter classWriter1 = new ClassWriter(251658240);\n ClassWriter classWriter2 = new ClassWriter(1);\n Type type0 = Type.SHORT_TYPE;\n Class<Object> class0 = Object.class;\n Type.getType(class0);\n Item item0 = classWriter0.key;\n // Undeclared exception!\n try { \n frame0.execute(172, 168, classWriter1, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test104() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(0);\n ClassWriter classWriter1 = new ClassWriter(2);\n classWriter0.visitSource(\"&l{u&egzGn.@\", \"&l{u&egzGn.@\");\n ClassWriter classWriter2 = new ClassWriter(0);\n ClassWriter classWriter3 = new ClassWriter(1);\n Item item0 = classWriter1.newLong(1);\n Item item1 = new Item(1, item0);\n // Undeclared exception!\n try { \n frame0.execute(194, 1, classWriter0, item1);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test\n\tpublic void test04() throws Throwable {\n\t}", "@Test(timeout = 4000)\n public void test188() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"4_R]T<#2)Q?]R7Ut\");\n Hidden hidden0 = new Hidden(xmlEntityRef0, \"/\", \"org.mvel.conversion.CharArrayCH$1\");\n // Undeclared exception!\n try { \n hidden0.getPage();\n fail(\"Expecting exception: ClassCastException\");\n \n } catch(ClassCastException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test26() throws Throwable {\n PipedWriter pipedWriter0 = new PipedWriter();\n PipedReader pipedReader0 = new PipedReader(pipedWriter0);\n StreamTokenizer streamTokenizer0 = new StreamTokenizer(pipedReader0);\n DBCatalog dBCatalog0 = new DBCatalog();\n SQLUtil.ownerDotComponent(dBCatalog0);\n DefaultDBTable defaultDBTable0 = new DefaultDBTable();\n MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream(\"null\", true);\n // Undeclared exception!\n try { \n DBDataType.getInstance((String) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.model.DBDataType\", e);\n }\n }", "@Test(timeout = 4000)\n public void test36() throws Throwable {\n StringReader stringReader0 = new StringReader(\"0(Hu\");\n StreamTokenizer streamTokenizer0 = new StreamTokenizer(stringReader0);\n StreamTokenizer streamTokenizer1 = new StreamTokenizer(stringReader0);\n StreamTokenizer streamTokenizer2 = new StreamTokenizer(stringReader0);\n JSTerm jSTerm0 = new JSTerm(streamTokenizer1);\n jSTerm0.add((Object) null);\n // Undeclared exception!\n try { \n jSTerm0.clonePF();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"umd.cs.shop.JSPredicateForm\", e);\n }\n }", "@Test(timeout = 4000)\n public void test063() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(16777267);\n Class<Object> class0 = Object.class;\n Type.getType(class0);\n Type type0 = Type.BYTE_TYPE;\n Type.getObjectType(\"zuQ-ES@*gn\");\n Type type1 = Type.INT_TYPE;\n Item item0 = new Item();\n // Undeclared exception!\n try { \n frame0.execute(22, 1, classWriter0, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test059() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(1048575);\n ClassWriter classWriter1 = new ClassWriter(285212648);\n String[] stringArray0 = new String[5];\n stringArray0[0] = \"\";\n stringArray0[1] = \"{uh\";\n stringArray0[2] = \"\";\n stringArray0[3] = \"i&b}d$\";\n stringArray0[4] = \"{uh\";\n classWriter0.visit(285212648, 184, \"{uh\", \"i&b}d$\", \"\", stringArray0);\n classWriter0.newClassItem(\"The size must be non-negative\");\n Item item0 = classWriter0.newLong(1048575);\n Item item1 = new Item(159, item0);\n // Undeclared exception!\n try { \n frame0.execute(195, 285212648, classWriter0, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test201() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"4_R]T<#2)Q?]R7Ut\");\n // Undeclared exception!\n try { \n xmlEntityRef0.head();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test013() throws Throwable {\n Object object0 = new Object();\n // Undeclared exception!\n try { \n Range.of((Range.CoordinateSystem) null, 1226L, 2776L);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // CoordinateSystem can not be null\n //\n verifyException(\"org.jcvi.jillion.core.Range$Builder\", e);\n }\n }", "@Test(timeout = 4000)\n public void test105() throws Throwable {\n Frame frame0 = new Frame();\n FileSystemHandling fileSystemHandling0 = new FileSystemHandling();\n Type type0 = Type.DOUBLE_TYPE;\n Type type1 = Type.VOID_TYPE;\n Type type2 = Type.BOOLEAN_TYPE;\n Type type3 = Type.FLOAT_TYPE;\n Type type4 = Type.SHORT_TYPE;\n ClassWriter classWriter0 = new ClassWriter(158);\n Item item0 = classWriter0.key2;\n Item item1 = new Item(10);\n // Undeclared exception!\n try { \n frame0.execute(176, 0, classWriter0, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test070() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.mutatesDataOrStructure((String) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Test(timeout = 4000)\n public void test26() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter(131072);\n FieldWriter fieldWriter0 = (FieldWriter)classWriter0.visitField(2, \"\", \"\", (String) null, \"\");\n Attribute attribute0 = new Attribute(\"\");\n fieldWriter0.visitAttribute(attribute0);\n ByteVector byteVector0 = classWriter0.pool;\n // Undeclared exception!\n try { \n fieldWriter0.put(byteVector0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Attribute\", e);\n }\n }", "@Test(timeout = 4000)\n public void test323() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef((String) null);\n // Undeclared exception!\n try { \n xmlEntityRef0.base((CharSequence) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test089() throws Throwable {\n Frame frame0 = new Frame();\n Type[] typeArray0 = new Type[9];\n Type type0 = Type.getReturnType(\"Zu.y \");\n typeArray0[0] = type0;\n Type type1 = Type.DOUBLE_TYPE;\n ClassWriter classWriter0 = new ClassWriter(173);\n Item item0 = classWriter0.newLong(16777221);\n Item item1 = new Item(4487, item0);\n Item item2 = classWriter0.key3;\n // Undeclared exception!\n try { \n frame0.execute(50, 3, classWriter0, item2);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test211() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"http://xmlpull.org/v1/doc/properties.html#serializer-indentation\");\n Submit submit0 = new Submit(xmlEntityRef0, \":\", \"java.lang.String@0000000005\");\n // Undeclared exception!\n try { \n submit0.end(\"? fOYd~2\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n }\n }", "@Test(timeout = 4000)\n public void test287() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"4_R]T<#2)Q?]R7Ut\");\n // Undeclared exception!\n try { \n xmlEntityRef0.sub((Object) \"4_R]T<#2)Q?]R7Ut\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "zzafe mo29840Y() throws RemoteException;", "@Test(timeout = 4000)\n public void test299() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"{\");\n // Undeclared exception!\n try { \n xmlEntityRef0.span((Object) \"{\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "void m5770d() throws C0841b;", "@Test(timeout = 4000)\n public void test029() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(16777267);\n Type type0 = Type.VOID_TYPE;\n Type type1 = Type.BYTE_TYPE;\n Type.getObjectType(\"The prefix must not be null\");\n Type type2 = Type.INT_TYPE;\n Item item0 = new Item();\n frame0.execute(132, 164, classWriter0, item0);\n Class<ObjectInputStream> class0 = ObjectInputStream.class;\n Type.getType(class0);\n Type.getType(\")UBbE;._%G\");\n Type type3 = Type.BYTE_TYPE;\n Type type4 = Type.INT_TYPE;\n // Undeclared exception!\n try { \n type0.getElementType();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test71() throws Throwable {\n DefaultDBTable defaultDBTable0 = new DefaultDBTable();\n FileSystemHandling.shouldThrowIOException((EvoSuiteFile) null);\n TableContainer tableContainer0 = new TableContainer(\"-KwE,kZ\");\n DefaultDBTable defaultDBTable1 = new DefaultDBTable();\n DBDataType.getInstance((-1717986917), \"%~-1t&Ncqx{&'OP~@\");\n tableContainer0.getSchema();\n Integer integer0 = RawTransaction.SAVEPOINT_ROLLBACK;\n Integer integer1 = RawTransaction.LOCK_ESCALATE;\n SQLUtil.removeComments(\"/**/\");\n System.setCurrentTimeMillis(1722L);\n // Undeclared exception!\n try { \n SQLUtil.normalize((String) null, false);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"java.io.StringReader\", e);\n }\n }", "public abstract void mo133131c() throws InvalidDataException;", "void m5771e() throws C0841b;", "@Test(timeout = 4000)\n public void test18() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n FileSystemHandling.shouldThrowIOException((EvoSuiteFile) null);\n linkedList0.add((byte[][]) null);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n FileSystemHandling.shouldAllThrowIOExceptions();\n // Undeclared exception!\n try { \n fBCachedFetcher0.relative((-513));\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.firebirdsql.jdbc.FBCachedFetcher\", e);\n }\n }", "@Test(timeout = 4000)\n public void test078() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"]f '8Drr>Uj1==M2\");\n Hidden hidden0 = new Hidden(xmlEntityRef0, \"4wW\", \"java.lang.String@0000000002\");\n // Undeclared exception!\n try { \n hidden0.s();\n fail(\"Expecting exception: ClassCastException\");\n \n } catch(ClassCastException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test\n void test011_setCentralUserIllegalNullArgumentException() {\n try {\n christmasBuddENetwork.addUser(\"Santa Claus\");\n christmasBuddENetwork.addUser(\"Grinch\");\n christmasBuddENetwork.addUser(\"Comet\");\n christmasBuddENetwork.addUser(\"Rudolph\");\n christmasBuddENetwork.addUser(\"Prancer\");\n christmasBuddENetwork.addUser(\"Blitzen\");\n christmasBuddENetwork.addUser(\"Donder\");\n christmasBuddENetwork.addUser(\"Vixen\");\n christmasBuddENetwork.addUser(\"Dancer\");\n christmasBuddENetwork.addUser(\"Cupid\");\n christmasBuddENetwork.addUser(\"Dasher\");\n christmasBuddENetwork.setCentralUser(\"\"); // making empty string the\n // central user\n\n // if we get here, then we did not properly throw an\n // IllegalNullArgumentException on empty string,\n // so we failed tests.\n fail(\"test011_setCentralUserIllegalNullArgumentException(): FAILED :(. \"\n + \"Did NOT throw an IllegalNullArgumentException when finding central\"\n + \" user of empty string.\");\n } catch (UserNotFoundException e1) {\n fail(\"test011_setCentralUserIllegalNullArgumentException(): FAILED :(. \"\n + \"Threw a UserNotFoundException instead of an \"\n + \"IllegalNullArgumentException when making the central user an empty\"\n + \" string!\");\n } catch (IllegalNullArgumentException e2) {\n // properly caught this Exception :) for empty string\n try {\n christmasBuddENetwork.setCentralUser(null); // making a null buddE the\n // central user\n fail(\"test011_setCentralUserIllegalNullArgumentException(): FAILED :(.\"\n + \" Did NOT throw an IllegalNullArgumentException when calling \"\n + \"setCentralUser(null)!\");\n\n } catch (UserNotFoundException e2a) {\n fail(\"test011_setCentralUserIllegalNullArgumentException(): FAILED :(.\"\n + \" Threw a UserNotFoundException instead of an \"\n + \"IllegalNullArgumentException when calling \"\n + \"setCentralUser(null)!\");\n } catch (IllegalNullArgumentException e2b) {\n } catch (Exception e2c) {\n fail(\"test011_setCentralUserIllegalNullArgumentException(): FAILED :(.\"\n + \" Threw another Exception instead of an \"\n + \"IllegalNullArgumentException when calling \"\n + \"setCentralUser(null)!\");\n }\n\n } catch (Exception e3) {\n fail(\"test011_setCentralUserIllegalNullArgumentException(): FAILED :( \"\n + \"Threw another Exception instead of an IllegalNullArgumentException\"\n + \" when calling setCentralUser for an empty String!\");\n }\n }", "@Test(timeout = 4000)\n public void test034() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(1048576);\n ClassWriter classWriter1 = new ClassWriter(285212630);\n Item item0 = classWriter1.newFieldItem(\"%B\\\"F$,FHLc-:\", \"%B\\\"F$,FHLc-:\", \"%B\\\"F$,FHLc-:\");\n classWriter1.toByteArray();\n FileSystemHandling fileSystemHandling0 = new FileSystemHandling();\n Frame frame1 = new Frame();\n classWriter0.visitField(1048576, \"%B\\\"F$,FHLc-:\", \"%B\\\"F$,FHLc-:\", \"u1;`1Jz{4~0\", (Object) null);\n // Undeclared exception!\n try { \n frame1.execute(191, 1, classWriter0, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "public void testEntrySetIteratorHasProperMappings() {\n return;\r\n }", "@Test(timeout = 4000)\n public void test09() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter(8);\n FieldWriter fieldWriter0 = new FieldWriter(classWriter0, 8, \"\", \"\", \"\", \"\");\n Attribute attribute0 = new Attribute(\"Signature\");\n fieldWriter0.visitAttribute(attribute0);\n ByteVector byteVector0 = classWriter0.pool;\n // Undeclared exception!\n try { \n fieldWriter0.put(byteVector0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Attribute\", e);\n }\n }", "@Test(timeout = 4000)\n public void test088() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"java.lang.String@0000000005\");\n // Undeclared exception!\n try { \n xmlEntityRef0.pre();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test11() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter((-984));\n FieldWriter fieldWriter0 = new FieldWriter(classWriter0, (-984), \"\", \"\", \"\", \"\");\n Attribute attribute0 = new Attribute(\"\");\n fieldWriter0.visitAttribute(attribute0);\n // Undeclared exception!\n try { \n fieldWriter0.getSize();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Attribute\", e);\n }\n }", "@Test(timeout = 4000)\n public void test46() throws Throwable {\n PipedWriter pipedWriter0 = new PipedWriter();\n PipedReader pipedReader0 = new PipedReader();\n Boolean boolean0 = Boolean.FALSE;\n SQLUtil.isQuery(\"selectntowrong c|ck\");\n Boolean.valueOf(true);\n DefaultDBTable defaultDBTable0 = new DefaultDBTable(\"selectntowrong c|ck\");\n // Undeclared exception!\n try { \n defaultDBTable0.getUniqueConstraint(\"^h=wZ>:9%}Pj6(#%M\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.model.DefaultDBTable\", e);\n }\n }", "@Test(timeout = 4000)\n public void test057() throws Throwable {\n Label label0 = new Label();\n label0.getFirst();\n ClassWriter classWriter0 = new ClassWriter(3002);\n Item item0 = classWriter0.newFieldItem(\"zOfq\", \"zv)])\\\"nPel4&5\", \"\");\n ClassWriter classWriter1 = new ClassWriter(1);\n ClassWriter classWriter2 = new ClassWriter((-201));\n int int0 = Frame.INTEGER;\n classWriter1.newInteger(172);\n Frame frame0 = new Frame();\n // Undeclared exception!\n try { \n frame0.execute(12, (-1108), classWriter1, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test076() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(3131);\n classWriter0.visitField(182, \"IK\", \"IK\", \"IK\", \"The FileFilter must not be null\");\n ClassWriter classWriter1 = new ClassWriter(1);\n Item item0 = classWriter0.key2;\n FileSystemHandling.createFolder((EvoSuiteFile) null);\n int int0 = 0;\n item0.set(16777219);\n // Undeclared exception!\n try { \n frame0.execute(3131, 0, classWriter1, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test131() throws Throwable {\n Frame frame0 = new Frame();\n int int0 = 16777287;\n ClassWriter classWriter0 = new ClassWriter(16777287);\n ClassWriter classWriter1 = new ClassWriter(110);\n Item item0 = classWriter1.newClassItem(\"OpVolEsG~uZ'SU\");\n // Undeclared exception!\n try { \n frame0.execute(2, 1, classWriter0, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test046() throws Throwable {\n Frame frame0 = new Frame();\n FileSystemHandling fileSystemHandling0 = new FileSystemHandling();\n ClassWriter classWriter0 = new ClassWriter(16777228);\n ClassWriter classWriter1 = new ClassWriter(2);\n Item item0 = classWriter0.newFieldItem(\"\", \"\", \"T~1S2uS7<aMtHqcUL\");\n Frame frame1 = new Frame();\n // Undeclared exception!\n try { \n frame1.execute(154, 1, classWriter1, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "public void mo1972o() throws cf {\r\n }", "@Test(timeout = 4000)\n public void test341() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"{\");\n // Undeclared exception!\n try { \n xmlEntityRef0.i((Object) \"{\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test132() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(1048575);\n int int0 = 184;\n String[] stringArray0 = new String[9];\n stringArray0[0] = \"\";\n stringArray0[1] = \"k58&{\";\n stringArray0[2] = \"{uh\";\n stringArray0[3] = \"\";\n stringArray0[4] = \"org.apache.commons.io.filefilter.NameFileFilter\";\n stringArray0[5] = \"k58&{\";\n ClassWriter classWriter1 = new ClassWriter(184);\n Item item0 = classWriter0.key2;\n Item item1 = new Item((-2319));\n // Undeclared exception!\n try { \n frame0.execute(1, 184, classWriter0, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test304() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"'H,u&*QAP\");\n // Undeclared exception!\n try { \n xmlEntityRef0.encode(\"java.lang.String@0000000005\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.components.Component\", e);\n }\n }", "public void mo1974q() throws cf {\r\n }", "@Test(timeout = 4000)\n public void test147() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"java.lang.String@0000000005\");\n Boolean boolean0 = new Boolean(\"java.lang.String@0000000005\");\n // Undeclared exception!\n try { \n xmlEntityRef0.em((Object) boolean0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "private void validCheck ()\n\t{\n\t\tassert allButLast != null || cachedFlatListOrMore != null;\n\t}", "@Test(timeout = 4000)\n public void test003() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(3131);\n classWriter0.visitField(182, \"IK\", \"IK\", \"IK\", \"The FileFilter must not be null\");\n ClassWriter classWriter1 = new ClassWriter(1);\n Item item0 = classWriter0.key2;\n FileSystemHandling.setPermissions((EvoSuiteFile) null, false, false, false);\n Item item1 = classWriter0.newLong((byte) (-99));\n Item item2 = new Item(189, item1);\n Item item3 = classWriter1.key3;\n Item item4 = new Item();\n // Undeclared exception!\n try { \n frame0.execute(73, 10, classWriter1, item4);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test054() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(1048575);\n ClassWriter classWriter1 = new ClassWriter(1);\n ClassWriter classWriter2 = new ClassWriter((-719));\n Item item0 = classWriter2.newClassItem(\"n0*\");\n Item item1 = new Item(2, item0);\n Item item2 = new Item(184, item0);\n classWriter2.toByteArray();\n // Undeclared exception!\n try { \n frame0.execute(179, 1048575, classWriter2, item1);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test054() throws Throwable {\n Form form0 = new Form(\"null\");\n Hidden hidden0 = new Hidden(form0, \"null\", \"null\");\n // Undeclared exception!\n try { \n hidden0.sub((Object) \"null\");\n fail(\"Expecting exception: ClassCastException\");\n \n } catch(ClassCastException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test008() throws Throwable {\n Frame frame0 = new Frame();\n Type type0 = Type.BYTE_TYPE;\n ClassWriter classWriter0 = new ClassWriter(5);\n Item item0 = classWriter0.newClassItem(\"=\");\n Item item1 = new Item(10, item0);\n classWriter0.toByteArray();\n Item item2 = null;\n // Undeclared exception!\n try { \n frame0.execute(37, 187, classWriter0, (Item) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test087() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(1048575);\n ClassWriter classWriter1 = new ClassWriter(285212648);\n String[] stringArray0 = new String[5];\n stringArray0[0] = \"\";\n stringArray0[1] = \"{uh\";\n stringArray0[2] = \"\";\n stringArray0[3] = \"i&b}d$\";\n stringArray0[4] = \"{uh\";\n classWriter0.visit(285212648, 184, \"{uh\", \"i&b}d$\", \"\", stringArray0);\n classWriter0.newClassItem(\"The size must be non-negative\");\n Item item0 = classWriter0.newLong(1048575);\n Item item1 = new Item(159, item0);\n classWriter1.toByteArray();\n // Undeclared exception!\n try { \n frame0.execute(14, 14, classWriter0, item1);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test367() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"W,eg{\");\n // Undeclared exception!\n try { \n xmlEntityRef0.label();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "public boolean method_2453() {\r\n return false;\r\n }", "@Test(timeout = 4000)\n public void test068() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.ownerDotComponent((DBObject) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Test(timeout = 4000)\n public void test018() throws Throwable {\n Label label0 = new Label();\n Label label1 = new Label();\n ClassWriter classWriter0 = new ClassWriter(3002);\n classWriter0.newFieldItem(\"zOfq\", \"zv)])\\\"nPel4&5\", \"\");\n ClassWriter classWriter1 = new ClassWriter(162);\n classWriter1.toByteArray();\n Type type0 = Type.VOID_TYPE;\n Type type1 = Type.BOOLEAN_TYPE;\n Type type2 = Type.FLOAT_TYPE;\n Type type3 = Type.SHORT_TYPE;\n ClassWriter classWriter2 = new ClassWriter(40);\n Item item0 = classWriter0.key2;\n Item item1 = new Item(2);\n Frame frame0 = new Frame();\n // Undeclared exception!\n try { \n frame0.execute(26, (-345), classWriter2, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test362() throws Throwable {\n Form form0 = new Form(\"\\r\");\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"\\r\");\n // Undeclared exception!\n try { \n form0.sup((Object) xmlEntityRef0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test096() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = null;\n Type[] typeArray0 = new Type[9];\n Type type0 = Type.getReturnType(\"Zu.y \");\n typeArray0[0] = type0;\n Type type1 = Type.DOUBLE_TYPE;\n typeArray0[1] = type1;\n Type type2 = Type.DOUBLE_TYPE;\n Type type3 = Type.DOUBLE_TYPE;\n Item item0 = new Item((-532));\n int int0 = 180;\n // Undeclared exception!\n try { \n frame0.execute(180, 4, (ClassWriter) null, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test10() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter(953);\n FieldWriter fieldWriter0 = new FieldWriter(classWriter0, 0, \"O8\", \"\", \"O8\", \"O8\");\n Attribute attribute0 = new Attribute(\"O8\");\n fieldWriter0.visitAttribute(attribute0);\n ByteVector byteVector0 = classWriter0.pool;\n // Undeclared exception!\n try { \n fieldWriter0.put(byteVector0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Attribute\", e);\n }\n }", "@Test(timeout = 4000)\n public void test358() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef((String) null);\n // Undeclared exception!\n try { \n xmlEntityRef0.s();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test032() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.ownerDotComponent((DBObject) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Test(timeout = 4000)\n public void test032() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.ownerDotComponent((DBObject) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Test(timeout = 4000)\n public void test021() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(0);\n ClassWriter classWriter1 = new ClassWriter(2);\n classWriter1.toByteArray();\n FileSystemHandling fileSystemHandling0 = new FileSystemHandling();\n FileSystemHandling.setPermissions((EvoSuiteFile) null, false, false, false);\n Item item0 = classWriter1.newDouble((-1.0));\n ClassWriter classWriter2 = new ClassWriter(191);\n // Undeclared exception!\n try { \n frame0.execute(150, 22, classWriter2, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test118() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(0);\n ClassWriter classWriter1 = new ClassWriter(2);\n Type type0 = Type.CHAR_TYPE;\n Class<Integer> class0 = Integer.class;\n Class<Object> class1 = Object.class;\n Type.getType(class1);\n Type.getType(class0);\n Type.getObjectType(\"The prefix must not be null\");\n Type type1 = Type.INT_TYPE;\n int[] intArray0 = new int[6];\n intArray0[0] = 4;\n type1.getDescriptor();\n intArray0[1] = 2;\n intArray0[2] = 7;\n intArray0[3] = 4;\n intArray0[4] = 1;\n intArray0[5] = 0;\n frame0.inputStack = intArray0;\n Item item0 = classWriter0.newFieldItem(\"%B\\\"F$,FHLc-:\", \"The prefix must not be null\", \"The prefix must not be null\");\n classWriter1.toByteArray();\n FileSystemHandling fileSystemHandling0 = new FileSystemHandling();\n // Undeclared exception!\n try { \n frame0.execute(192, 4, classWriter1, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "public boolean method_2434() {\r\n return false;\r\n }", "@Test(timeout = 4000)\n public void test082() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"java.lang.String@0000000005\");\n Submit submit0 = new Submit(xmlEntityRef0, \"java.lang.String@0000000005\", \"java.lang.String@0000000005\");\n // Undeclared exception!\n try { \n submit0.rawText(\"java.lang.String@0000000005\");\n fail(\"Expecting exception: ClassCastException\");\n \n } catch(ClassCastException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test248() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"x0\");\n // Undeclared exception!\n try { \n xmlEntityRef0.body();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "private void correctError()\r\n\t{\r\n\t\t\r\n\t}", "@Test(timeout = 4000)\n public void test162() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"vhe\");\n // Undeclared exception!\n try { \n xmlEntityRef0.code();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test292() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"0+_/OK]Z5%q-UP hR\");\n // Undeclared exception!\n try { \n xmlEntityRef0.code((Object) \"0+_/OK]Z5%q-UP hR\");\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test118() throws Throwable {\n NameSpec nameSpec0 = NameSpec.IF_REPRODUCIBLE;\n // Undeclared exception!\n try { \n SQLUtil.pkSpec((DBPrimaryKeyConstraint) null, nameSpec0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }", "@Test\n public void testIOExceptionWhileEvaluatingQueries() {\n assertStackTraceOfIOExceptionWhileEvaluatingQueries(PROJOG_DEFAULT_PROPERTIES);\n }", "@Test(timeout = 4000)\n public void test032() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(0);\n Type type0 = Type.CHAR_TYPE;\n Class<Object> class0 = Object.class;\n Type.getType(class0);\n Type type1 = Type.CHAR_TYPE;\n Type.getObjectType(\"The prefix must not be null\");\n Type type2 = Type.INT_TYPE;\n Item item0 = classWriter0.newFieldItem(\"%B\\\"F$,FHLc-:\", \"The prefix must not be null\", \"The prefix must not be null\");\n classWriter0.toByteArray();\n Label label0 = new Label();\n Label label1 = label0.next;\n Frame frame1 = label0.frame;\n ClassWriter classWriter1 = new ClassWriter(9);\n // Undeclared exception!\n try { \n frame0.execute(185, 1455, classWriter0, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "protected boolean func_70041_e_() { return false; }", "@Test(timeout = 4000)\n public void test131() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"/\");\n // Undeclared exception!\n try { \n xmlEntityRef0.h3((Object) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test077() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(1048575);\n ClassWriter classWriter1 = new ClassWriter(1);\n String[] stringArray0 = new String[9];\n stringArray0[0] = \"\";\n stringArray0[1] = \"{uh\";\n stringArray0[5] = \"{uh\";\n stringArray0[3] = \"\";\n stringArray0[4] = \"5A4qe@&:J-\\\"zg|\";\n stringArray0[5] = \"k58&{\";\n stringArray0[6] = \"i&b}d$\";\n stringArray0[7] = \"k58&{\";\n stringArray0[8] = \"i&b}d$\";\n Item item0 = classWriter1.newLong(16777221);\n Item item1 = new Item(184, item0);\n Item item2 = classWriter0.key3;\n // Undeclared exception!\n try { \n frame0.execute(199, 1, classWriter0, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test193() throws Throwable {\n ErrorPage errorPage0 = new ErrorPage();\n // Undeclared exception!\n try { \n errorPage0.id(\"O=V>!a<w512kq\");\n fail(\"Expecting exception: UnsupportedOperationException\");\n \n } catch(UnsupportedOperationException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"java.util.AbstractMap\", e);\n }\n }", "@Override\n\t\t\t\tpublic void doFail() {\n\t\t\t\t}", "@Test(timeout = 4000)\n public void test102() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"g+0=\");\n // Undeclared exception!\n try { \n xmlEntityRef0.map(\"y%G\");\n fail(\"Expecting exception: RuntimeException\");\n \n } catch(RuntimeException e) {\n //\n // No top level component found.\n //\n verifyException(\"wheel.components.Component\", e);\n }\n }", "@Test(timeout = 4000)\n public void test249() throws Throwable {\n XmlEntityRef xmlEntityRef0 = new XmlEntityRef(\"&!a0Q!<8UDk+%_*<Z'\");\n // Undeclared exception!\n try { \n xmlEntityRef0.a((Object) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n }\n }", "@Test(timeout = 4000)\n public void test019() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(3131);\n classWriter0.visitField(182, \"IK\", \"IK\", \"IK\", \"The FileFilter must not be null\");\n Item item0 = classWriter0.newFieldItem(\"The FileFilter must not be null\", \"\", \"Insensitive\");\n ClassWriter classWriter1 = new ClassWriter(182);\n classWriter1.toByteArray();\n Type type0 = Type.VOID_TYPE;\n Type type1 = Type.BOOLEAN_TYPE;\n Type type2 = Type.FLOAT_TYPE;\n Type type3 = Type.SHORT_TYPE;\n ClassWriter classWriter2 = new ClassWriter(3034);\n ClassWriter classWriter3 = new ClassWriter(2);\n Item item1 = classWriter3.key2;\n Item item2 = new Item(6);\n Frame frame1 = new Frame();\n // Undeclared exception!\n try { \n frame1.execute(173, 6, classWriter3, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "@Test(timeout = 4000)\n public void test069() throws Throwable {\n Frame frame0 = new Frame();\n ClassWriter classWriter0 = new ClassWriter(1048575);\n classWriter0.visitSource(\"JSR/RET are not suppPrtej with computeFrames option\", (String) null);\n ClassWriter classWriter1 = new ClassWriter((-2425));\n Item item0 = classWriter1.newLong(1);\n Item item1 = new Item((-1981), item0);\n item1.next = item0;\n // Undeclared exception!\n try { \n frame0.execute(156, 156, classWriter1, item0);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"wheel.asm.Frame\", e);\n }\n }", "private void checkNotUnknown() {\n if (isUnknown())\n throw new AnalysisException(\"Unexpected 'unknown' value!\");\n }", "@Test(timeout = 4000)\n public void test019() throws Throwable {\n // Undeclared exception!\n try { \n SQLUtil.renderNumber((StreamTokenizer) null);\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.databene.jdbacl.SQLUtil\", e);\n }\n }" ]
[ "0.6095937", "0.6022495", "0.59587806", "0.5872536", "0.58521444", "0.5846407", "0.5841461", "0.58392644", "0.5838282", "0.58230364", "0.5816015", "0.5799414", "0.5792861", "0.5791694", "0.5788395", "0.57820004", "0.5775838", "0.5773899", "0.57708186", "0.5764437", "0.5763454", "0.57516867", "0.5751483", "0.57514", "0.57460874", "0.5745936", "0.57425016", "0.5739006", "0.5737987", "0.57366055", "0.57258195", "0.5724768", "0.5724102", "0.57226115", "0.57151437", "0.5714519", "0.57090557", "0.57073337", "0.5705529", "0.5702706", "0.5701432", "0.5701295", "0.57006544", "0.5700205", "0.56986755", "0.5696292", "0.569551", "0.5695399", "0.56931555", "0.56931406", "0.5691361", "0.56896555", "0.5687864", "0.56839603", "0.5682241", "0.5682029", "0.56819314", "0.5673225", "0.56724435", "0.56723565", "0.567049", "0.5668161", "0.5666937", "0.5666079", "0.5665415", "0.56614465", "0.56591845", "0.56588334", "0.5658204", "0.5656278", "0.56529933", "0.56525683", "0.56512123", "0.5649611", "0.5649393", "0.5648829", "0.5647428", "0.56412756", "0.56412756", "0.56383634", "0.5636624", "0.563502", "0.5631914", "0.5631733", "0.5630848", "0.56261903", "0.56244266", "0.56233555", "0.56230235", "0.56213903", "0.56190145", "0.5616421", "0.56160927", "0.56160164", "0.56130123", "0.5611789", "0.5610882", "0.5609504", "0.5609225", "0.56073564", "0.56062406" ]
0.0
-1
send a request to get (no preflight)
@Test public void testExceptionThrown() throws Exception { final HttpResponse response = Request.Get("http://localhost:" + httpPort.getValue() + CORS_EXCEPTION_ENDPOINT_PATH).addHeader("Origin", CORS_DEFAULT_ORIGIN).execute().returnResponse(); assertNotNull("Response should not be null", response); //we should have an access control allow origin assertNotNull("Allowed origin should be present", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static HttpResponse sendGet() throws Exception {\n // Create the Call using the URL\n HttpGet http = new HttpGet(url);\n // Set the credentials set earlier into the headers\n Header header = new BasicScheme(StandardCharsets.UTF_8).authenticate(creds, http, null);\n // Set the header into the HTTP request\n http.addHeader(header);\n // Print the response\n return httpClient.execute(http);\n }", "HttpGet getRequest(HttpServletRequest request, String address) throws IOException;", "@Override\n\tprotected Method getMethod() {\n\t\treturn Method.GET;\n\t}", "private static String get_request(String uri, boolean isChecking, String token) throws IOException {\r\n URL url = new URL(uri);\r\n HttpURLConnection connection = (HttpURLConnection) url.openConnection();\r\n connection.setRequestProperty(\"Content-Type\", \"application/json\");\r\n connection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74\");\r\n if (isChecking) {\r\n connection.setRequestProperty(\"Authorization\", token);\r\n }\r\n connection.setRequestMethod(\"GET\");\r\n InputStream responseStream = connection.getInputStream();\r\n if (debug) {\r\n System.out.println(\"GET - \"+connection.getResponseCode());\r\n }\r\n try (Scanner scanner = new Scanner(responseStream)) {\r\n String responseBody = scanner.useDelimiter(\"\\\\A\").next();\r\n if (debug) {\r\n System.out.println(responseBody);\r\n }\r\n return responseBody;\r\n } catch (Exception e) {\r\n return \"ERROR\";\r\n }\r\n }", "@Override\n\tprotected void executeGet(GetRequest request, OperationResponse response) {\n\t}", "private HttpResponse executeHttpGet(String apiUrl) throws OAuthMessageSignerException,\r\n\t\t\tOAuthExpectationFailedException, OAuthCommunicationException, IOException {\r\n\t\tHttpGet httprequest = new HttpGet(apiUrl);\r\n\t\tgetOAuthConsumer().sign(httprequest);\r\n\t\tHttpClient client = new DefaultHttpClient();\r\n\t\tHttpResponse httpresponse = client.execute(httprequest);\r\n\t\tint statusCode = httpresponse.getStatusLine().getStatusCode();\r\n\t\tSystem.out.println(statusCode + \":\" + httpresponse.getStatusLine().getReasonPhrase());\r\n\t\treturn httpresponse;\r\n\t}", "public Result get(Get get) throws IOException;", "private static String sendGET(String getURL) throws IOException {\n\t\tURL obj = new URL(getURL);\n\t\tHttpURLConnection con = (HttpURLConnection) obj.openConnection();\n\t\tcon.setRequestMethod(\"GET\");\n\t\tString finalResponse = \"\";\n\n\t\t//This way we know if the request was processed successfully or there was any HTTP error message thrown.\n\t\tint responseCode = con.getResponseCode();\n\t\tSystem.out.println(\"GET Response Code : \" + responseCode);\n\t\tif (responseCode == HttpURLConnection.HTTP_OK) { // success\n\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n\t\t\tString inputLine;\n\t\t\tStringBuffer buffer = new StringBuffer();\n\n\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\tbuffer.append(inputLine);\n\t\t\t}\n\t\t\tin.close();\n\n\t\t\t// print result\n\t\t\tfinalResponse = buffer.toString();\n\t\t} else {\n\t\t\tSystem.out.println(\"GET request not worked\");\n\t\t}\n\t\treturn finalResponse;\n\t}", "public HttpResponseWrapper invokeGET(String path) {\n\t\treturn invokeHttpMethod(HttpMethodType.HTTP_GET, path, \"\");\n\t}", "public void doGet( )\n {\n \n }", "@Override\n\tpublic HttpResponse get(final String endpoint) {\n\t\treturn httpRequest(HTTP_GET, endpoint, null);\n\t}", "@Test\r\n\tpublic void doGet() throws Exception {\n\t\tCloseableHttpClient httpClient = HttpClients.createDefault();\r\n\t\t// Create a GET object and pass a url to it\r\n\t\tHttpGet get = new HttpGet(\"http://www.google.com\");\r\n\t\t// make a request\r\n\t\tCloseableHttpResponse response = httpClient.execute(get);\r\n\t\t// get response as result\r\n\t\tSystem.out.println(response.getStatusLine().getStatusCode());\r\n\t\tHttpEntity entity = response.getEntity();\r\n\t\tSystem.out.println(EntityUtils.toString(entity));\r\n\t\t// close HttpClient\r\n\t\tresponse.close();\r\n\t\thttpClient.close();\r\n\t}", "private void requestGet(String endpoint, Map<String, String> params, RequestListener listener) throws Exception {\n String requestUri = Constant.API_BASE_URL + ((endpoint.indexOf(\"/\") == 0) ? endpoint : \"/\" + endpoint);\n get(requestUri, params, listener);\n }", "public static String sendGetRequest(String addr,String[] head)\n\t{\n\t\tString response = null;\n\t\n\t\ttry\n\t\t{\n\t\t\tURL url = new URL(addr);\n\t\t\tHttpURLConnection connection = (HttpURLConnection) url.openConnection();\n\t\t\t//String encoding = new sun.misc.BASE64Encoder().encode(\"username \t assword\".getBytes());\n\t\t\t//conn.setRequestProperty (\"Authorization\", \"Basic \" + encoding);\n\t\t\tif(head!=null)\n {\n\t for(int i=0;i<head.length;i=i+2)\n\t {\n\t \tconnection.setRequestProperty(head[i], head[i+1]);\n\t \t\n\t }\n }\n\t\t\tconnection.setRequestMethod(\"GET\");\n\t\t\n\t\t\tconnection.connect();\n\t\t\tInputStream in = connection.getInputStream();\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\t\t\tconnection.disconnect();\n\t\t\tresponse = reader.readLine();\n\t\t\t//System.out.println(text);\n\t\t\n\t\t\t\n\t\t\t}catch(IOException ex)\n\t\t\t{\n\t\t\tex.printStackTrace();\n\t\t\tSystem.out.println(\"made it here\");\n\t\t}\n\treturn response;\n\t\n\t}", "GetResponse() {\n\t}", "public void sendRequest() {\n\t\tURL obj;\n\t\ttry {\n\t\t\t// Instantiating HttpURLConnection object for making GET request.\n\t\t\tobj = new URL(REQUEST_URL);\n\t\t HttpURLConnection connection = (HttpURLConnection) obj.openConnection();\n\t\t connection.setRequestMethod(REQUEST_METHOD);\n\t\t connection.setRequestProperty(\"User-Agent\", USER_AGENT);\n\t\t connection.setInstanceFollowRedirects(FOLLOW_REDIRECTS);\n\t\t\tHttpURLConnection.setFollowRedirects(FOLLOW_REDIRECTS);\n\t\t\n\t\t\t// Checking response code for successful request.\n\t\t\t// If responseCode==200, read the response,\n\t\t\t// if responseCode==3xx, i.e., a redirect, then make the request to \n\t\t\t// new redirected link, specified by 'Location' field. \n\t\t\t// NOTE: Only one level of redirection is supported for now. \n\t\t\t// Can be modified to support multiple levels of Redirections.\n\t\t\tint responseCode = connection.getResponseCode();\n\t\t\tif(responseCode == HttpURLConnection.HTTP_MOVED_PERM ||\n\t\t\t\t\tresponseCode == HttpURLConnection.HTTP_MOVED_TEMP ||\n\t\t\t\t\tresponseCode == HttpURLConnection.HTTP_SEE_OTHER) {\n\t\t\t\tlogger.info(\"Redirect received in responseCode\");\n\t\t\t\tString newUrl = connection.getHeaderField(\"Location\");\n\t\t\t\tconnection = (HttpURLConnection) new URL(newUrl).openConnection();\n\t\t\t}\n\t\t\tresponseCode = connection.getResponseCode();\n\t\t\t\n\t\t\t// process response message if responseCode==200 i.e., success.\n\t\t\tif (responseCode == HttpURLConnection.HTTP_OK) {\n\t\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(\n\t\t\t\t\t\tconnection.getInputStream()));\n\t\t\t\tString inputLine;\n\t\t\t\tStringBuffer response = new StringBuffer();\n\t\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\t\tresponse.append(inputLine);\n\t\t\t\t}\n\t\t\t\tin.close();\n\t\t\t\t//Uncomment following line to log response data.\n\t\t\t\t//logger.info(response.toString());\n\t\t\t} else {\n\t\t\t\tlogger.warning(\"Http GET request was unsuccessful!\");\n\t\t\t}\n\t\t} catch (MalformedURLException e) {\n\t\t\tlogger.severe(\"MalformedURLException: \" + e.getMessage());\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\tlogger.severe(\"IOException: \" + e.getMessage());\n\t\t\te.printStackTrace();\n\t\t}\n }", "R get() throws IOException, ClientProtocolException;", "public CompletableFuture<GetResponse> get(GetRequest request) throws IOException {\n\t\treturn this.transport.performRequestAsync(request, GetRequest.ENDPOINT, this.requestOptions);\n\t}", "public String request(String method, String url, String data) {\n HttpURLConnection connection = null;\n try {\n if ((method.compareTo(\"GET\") == 0) && (data != null) && (!data.isEmpty())) {\n if (url.contains(\"?\"))\n url = url.concat(\"&\");\n else\n url = url.concat(\"?\");\n url = url.concat(data);\n }\n // Create connection\n URL requestUrl = new URL(url);\n connection = (HttpURLConnection) requestUrl.openConnection();\n connection.setRequestProperty(\"Veridu-Client\", this.key);\n if ((this.storage.getSessionToken() != null) && (!this.storage.getSessionToken().isEmpty()))\n connection.setRequestProperty(\"Veridu-Session\", this.storage.getSessionToken());\n connection.setRequestMethod(method);\n connection.setConnectTimeout(10000);\n connection.setReadTimeout(10000);\n connection.setUseCaches(false);\n connection.setDoOutput(true);\n // Send request\n if ((method.compareTo(\"GET\") != 0) && (data != null) && (!data.isEmpty())) {\n connection.setRequestProperty(\"Content-Type\", \"application/x-www-form-urlencoded\");\n connection.setRequestProperty(\"Content-Length\", Integer.toString(data.getBytes().length));\n connection.setDoInput(true);\n DataOutputStream wr = new DataOutputStream(connection.getOutputStream());\n wr.writeBytes(data);\n wr.flush();\n wr.close();\n }\n\n // Get Response\n this.lastCode = connection.getResponseCode();\n InputStream is;\n if (this.lastCode >= 400)\n is = connection.getErrorStream();\n else\n is = connection.getInputStream();\n BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n String line;\n StringBuilder response = new StringBuilder();\n while ((line = rd.readLine()) != null) {\n response.append(line);\n response.append('\\r');\n }\n rd.close();\n return response.toString();\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (connection != null)\n connection.disconnect();\n }\n return null;\n }", "public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException {\r\n\tlogTrace( req, \"GET log\" );\r\n\tString requestId = req.getQueryString();\r\n\tif (requestId == null) return;\r\n\tif (\"get-response\".equals( requestId )) {\r\n\t try {\r\n\t\tonMEVPollsForResponse( req, resp );\r\n\t } catch (Exception e) {\r\n\t\tlogError( req, resp, e, \"MEV polling error\" );\r\n\t\tsendError( resp, \"MEV polling error: \" + e.toString() );\r\n\t }\r\n\t}\r\n }", "static String sendGET(String GET_URL) throws IOException, JSONException {\n\t\t// Check URL is valid or not.\n\t\tif (isValidURL(GET_URL)) {\n\t\t\ttry {\n\t\t\t\tURL obj = new URL(GET_URL);\n\t\t\t\tHttpURLConnection con = (HttpURLConnection) obj.openConnection();\n\t\t\t\tcon.setRequestMethod(\"GET\");\n\t\t\t\tcon.setRequestProperty(\"User-Agent\", USER_AGENT);\n\t\t\t\tint responseCode = con.getResponseCode();\n\t\t\t\tSystem.out.println(\"GET Response Code :: \" + responseCode);\n\t\t\t\tif (responseCode == HttpURLConnection.HTTP_OK) { // success\n\t\t\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n\t\t\t\t\tString inputLine;\n\t\t\t\t\tStringBuffer response = new StringBuffer();\n\n\t\t\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\t\t\tresponse.append(inputLine);\n\t\t\t\t\t}\n\t\t\t\t\tin.close();\n\t\t\t\t\t// Convert to json object and get specified data from it. Then you can print if the response is json type.\n\t\t\t\t\tString list = getList(response.toString());\n\t\t\t\t\tSystem.out.println(list);\n\t\t\t\t\t// print result\n\t\t\t\t\tSystem.out.println(response.toString());\n\t\t\t\t\treturn \"GET request worked\"; // Added for testing.\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"GET request not worked\");\n\t\t\t\t\treturn \"GET request not worked\";\n\t\t\t\t}\n\t\t\t} catch (MalformedURLException e) {\n\t\t\t\treturn \"URL is valid but connection could not be established.\";\n\t\t\t} catch (IOException e) {\n\t\t\t\treturn \"URL is valid but connection could not be established.\";\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"URL is not valid.\";\n\t\t}\n\t}", "@Override\r\n\tprotected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoGet(req, resp);\r\n\t}", "public ResponseTranslator get() {\n setMethod(\"GET\");\n return doRequest();\n }", "public static Response doGetRequest(String url) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException {\n try {\n Request request = new Request.Builder()\n .url(url).addHeader(\"Content-Type\", \"text/plain\")\n .build();\n Response response = client.newCall(request).execute();\n return response;\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n }", "@Override\n\tpublic InputStream doGet(String url) {\n\t\tInputStream in = null;\n\t\tHttpGet getRequest = new HttpGet(url);\n\t\tgetRequest.addHeader(\"charset\", HTTP.UTF_8);\n\t\tHttpClient client = new DefaultHttpClient();\n\t\tclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 6000);\n\t\tclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 8000);\n\t\tHttpResponse response = null;\n\t\ttry {\n\t\t\tresponse = client.execute(getRequest);\n\t\t\tif(null != response && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){\n\t\t\t\tin = response.getEntity().getContent();\n\t\t\t}\n\t\t} catch (ClientProtocolException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn in;\n\t}", "String getRequest(String url);", "Response get(URL target, QueryInput input, List<? extends HttpAuthentication> auth)\n throws IOException, DataRetrievalException;", "@Test\r\n\tpublic void doGetWithParams() throws Exception {\n\t\tCloseableHttpClient httpClient = HttpClients.createDefault();\r\n\t\t// Create a GET object and pass a url to it\r\n\t\tURIBuilder uriBuilder = new URIBuilder(\"http://www.google.com/search\");\r\n\t\turiBuilder.addParameter(\"query\", \"Bingyang Wei\");\r\n\t\tHttpGet get = new HttpGet(uriBuilder.build());\r\n\r\n\t\t// make a request\r\n\t\tCloseableHttpResponse response = httpClient.execute(get);\r\n\t\t// get response as result\r\n\t\tSystem.out.println(response.getStatusLine().getStatusCode());\r\n\t\tHttpEntity entity = response.getEntity();\r\n\t\tSystem.out.println(EntityUtils.toString(entity));\r\n\t\t// close HttpClient\r\n\t\tresponse.close();\r\n\t\thttpClient.close();\r\n\t}", "public Response get(Cluster c, String path, Header[] headers) \n throws IOException {\n GetMethod method = new GetMethod();\n try {\n int code = execute(c, method, headers, path);\n headers = method.getResponseHeaders();\n byte[] body = method.getResponseBody();\n InputStream in = method.getResponseBodyAsStream();\n return new Response(code, headers, body, in);\n } finally {\n method.releaseConnection();\n }\n }", "public void GetCall(String url) throws ClientProtocolException, IOException {\n\t\tCloseableHttpClient httpclient=HttpClients.createDefault();\n\t\tHttpGet httpget=new HttpGet(url);\n\t//lohith\n\t\tCloseableHttpResponse closeablehttpresponse=httpclient.execute(httpget);\n\t\tint responsestatuscode=closeablehttpresponse.getStatusLine().getStatusCode();\n\t\tSystem.out.println(\"responsestatuscode: \"+responsestatuscode);\n\t\t\n\t\tString response=EntityUtils.toString(closeablehttpresponse.getEntity(),\"UTF-8\");\n\t\tSystem.out.println(\"ClientResponse: \"+response);\n\t\tJSONObject jsonobject= new JSONObject(response);\n\t\t\n\t\tSystem.out.println(\"jsonobject: \"+jsonobject);\n\t\t\n\t\t\n\t}", "private String doHttpClientGet() {\n\t\t\r\n\t\tHttpGet httpGet=new HttpGet(url);\r\n\t\tHttpClient client=new DefaultHttpClient();\r\n\t\ttry {\r\n\t\t\tHttpResponse response=client.execute(httpGet);\r\n\t\t\tif(response.getStatusLine().getStatusCode()==HttpStatus.SC_OK){\r\n\t\t\t\tresult=EntityUtils.toString(response.getEntity());\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"content----->\"+result);\r\n\t\t} catch (ClientProtocolException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "@Override\n\tprotected HttpResponse doHttpRequest() throws ClientProtocolException, IOException {\n\t\tHttpRequestGenerator requestor = new HttpRequestGenerator(username, password);\n\t\treturn requestor.makeKeyFetchRequest(keyServerUrl, null);\n\t}", "private static String sendGET(final Long id) {\n return \"\";\r\n }", "public ServiceResponse getRequest(String url) throws IOException {\n HttpClient client = HttpClientBuilder.create().build();\n HttpGet request = new HttpGet(url);\n HttpResponse httpResponse = client.execute(request);\n ServiceResponse response = new ServiceResponse(httpResponse.getStatusLine().getStatusCode());\n response.setReader(new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent())));\n return response;\n }", "public void doGet() throws IOException {\n\n // search ressource\n byte[] contentByte = null;\n try {\n contentByte = ToolBox.readFileByte(RESOURCE_DIRECTORY, this.url);\n this.statusCode = OK;\n ContentType contentType = new ContentType(this.extension);\n sendHeader(statusCode, contentType.getContentType(), contentByte.length);\n } catch (IOException e) {\n System.out.println(\"Ressource non trouvé\");\n statusCode = NOT_FOUND;\n contentByte = ToolBox.readFileByte(RESPONSE_PAGE_DIRECTORY, \"pageNotFound.html\");\n sendHeader(statusCode, \"text/html\", contentByte.length);\n }\n\n this.sendBodyByte(contentByte);\n }", "@Override\n\tpublic WebApiRequest getRequest() {\n\t\tString category = \"\";\n\t\tString destination = \"\";\n\t\tJSONObject para = new JSONObject();\n\t\tif (taskFlag == GET_BALANCE_DETAIL_FLAG) {\n\t\t\tcategory = CATEGORY_NAME;\n\t\t\tdestination = GET_BALANCE_Detail;\n\t\t\ttry {\n\t\t\t\tpara.put(\"ID\", getIntent().getIntExtra(\"BalanceID\", 0));\n\t\t\t\tpara.put(\"CardType\", getIntent().getIntExtra(\"CardType\", 1));\n\t\t\t\tpara.put(\"ChangeType\", getIntent().getIntExtra(\"ChangeType\", 0));\n\t\t\t} catch (JSONException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tWebApiHttpHead header = mApp.createNeededCheckingWebConnectHead(category, destination, para.toString());\n\t\tWebApiRequest request = new WebApiRequest(category, destination,para.toString(), header);\n\t\treturn request;\n\t}", "private String sendGetRequest() throws IOException {\n\t\tString inline = \"\";\n\t\tURL url = new URL(COUNTRYAPI);\n\t\tHttpURLConnection conn = (HttpURLConnection) url.openConnection();\n\t\tconn.setRequestMethod(\"GET\");\n\t\tconn.connect();\n\t\tint responsecode = conn.getResponseCode();\n\t\tif (responsecode != 200) {\n\t\t\tthrow new RuntimeException(\"HttpResponseCode: \" + responsecode);\n\t\t} else {\n\t\t\tScanner sc = new Scanner(url.openStream());\n\t\t\twhile (sc.hasNext()) {\n\t\t\t\tinline += sc.nextLine();\n\t\t\t}\n\t\t\tsc.close();\n\t\t}\n\t\treturn inline.toString();\n\t}", "private RawHttpResponse<?> executeRequest(String method, String path) throws IOException {\r\n\t\tSocket socket = new Socket(\"localhost\", 8080);\r\n\t\treturn executeRequest(method, path, \"\", socket);\r\n\t}", "public String doHttpGet(String url, final String ...head);", "void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;", "public EntityType2 get() throws ClientException {\n return send(HttpMethod.GET, null);\n }", "public BufferedReader reqGet(final String route) throws\n ServerStatusException, IOException {\n System.out.println(\"first reqGet\");\n return reqGet(route, USER_AGENT);\n }", "@NonNull\n public String getAction() {\n return \"GET\";\n }", "private synchronized String execute(final HttpUriRequest request) {\n request.setParams(params);\n\n // Set the request's headers\n for (Entry<String, String> header : headers.entrySet()) {\n request.setHeader(header.getKey(), header.getValue());\n }\n\n // Execute the request and get it's content\n HttpResponse response;\n String content;\n try {\n\n // Execute the request\n response = getClient().execute(request);\n\n // Get the response content\n content = EntityUtils.toString(response.getEntity(), charset);\n } catch (IOException e) {\n throw new JsogClientException(\"Get request failed.\", e);\n }\n\n // Check the response code\n StatusLine sl = response.getStatusLine();\n if (sl.getStatusCode() != 200) {\n throw new Non200ResponseCodeException(\n sl.getStatusCode(),\n sl.getReasonPhrase(),\n content);\n }\n\n return content;\n }", "public String getResultFromGET() \r\n\t{\r\n\t\tString resultstring = null;\r\n\t\t\r\n\t\t// Use BasicNameValuePair to create GET data\r\n\t\tList<NameValuePair> pairs = new ArrayList<NameValuePair>();\r\n\t\tpairs.add(new BasicNameValuePair(\"token\", user.getTokenkey()));\r\n\t\tpairs.add(new BasicNameValuePair(\"method\", \"accountapi.getNotifications\"));\r\n\t\t\r\n\t\t// url request\r\n\t\tString URL = null;\r\n\t\tif (Config.CORE_URL == null) {\r\n\t\t\tURL = Config.makeUrl(user.getCoreUrl(), null, false);\t\r\n\t\t} else {\r\n\t\t\tURL = Config.makeUrl(Config.CORE_URL, null, false);\r\n\t\t}\r\n\t\t\r\n\t\t// request GET method to server\r\n\t\tresultstring = networkUntil.makeHttpRequest(URL, \"GET\", pairs);\r\n\t\t\r\n\t\tLog.i(\"DEBUG\", resultstring);\r\n\t\t\r\n\t\treturn resultstring;\r\n\t}", "@Test\n\t \n\t public void getApi() {\n\t\t \n\t\t Response getIt=get(\"https://reqres.in/api/users?page=2\");\n\t\t getIt.prettyPrint();\n\t\t System.out.println(getIt.getStatusCode());\n\t\t System.out.println(getIt.getTime());\n\t\t \n\t\t //to validate\n\t\t int validGstatus=getIt.getStatusCode();\n\t\t Assert.assertEquals(validGstatus,200);\n\t\t \n\t }", "protected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tcontact.forward(req, resp);\n\n\t}", "@RequestMapping(method=RequestMethod.GET)\n public @ResponseBody void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, JSONException, ParserConfigurationException {\n LOG.debug(\"doGet wgetproxy\");\n createWGET(request, response);\n }", "public void getRequest_withBasicAuth() {\n apiUtil = new APIUtil();\n // As this is an API call , we are not setting up any base url but defining the individual calls\n apiUtil.setBaseURI(configurationReader.get(\"BaseURL\"));\n //This is used to validate the get call protected with basic authentication mechanism\n basicAuthValidation();\n }", "public BufferedReader reqGet(final String route,\n final String userAgent)\n throws ServerStatusException, IOException {\n System.out.println(\"reqGet\");\n URL inputUrl = new URL(domain + route);\n HttpURLConnection con = (HttpURLConnection) inputUrl.openConnection();\n System.out.println(con);\n con.setRequestMethod(\"GET\");\n con.setRequestProperty(\"User-Agent\", userAgent);\n System.out.println(inputUrl);\n return readRes(con);\n }", "public String GET(String uri) {\n String retVal = \"\";\n try {\n request = HttpRequest.newBuilder()\n .GET()\n .uri(new URI(uri))\n .build();\n\n response = HttpClient.newBuilder()\n .build()\n .send(request, HttpResponse.BodyHandlers.ofString());\n\n retVal = response.body().toString();\n }\n catch (Exception e) {\n // correctly handles the exception according to framework\n // for this case, just returns an empty string\n }\n return retVal;\n }", "public static String httpGet(String url) throws Exception {\r\n \t\tDefaultHttpClient client = new DefaultHttpClient();\r\n \t\tHttpResponse response = null;\r\n \t\tString responseString = null;\r\n \t\tHttpUriRequest request = new HttpGet(url);\r\n \t\trequest.setHeader(\"Accept-Encoding\", \"gzip\");\r\n \t\trequest.setHeader(\"User-Agent\", \"gzip\");\r\n\t\tresponse = client.execute(request);\r\n \t\tif (response.getStatusLine().getStatusCode() != 200) {\r\n \t\t\tthrow new HttpException(\"Server error: \"\r\n \t\t\t\t\t+ response.getStatusLine().getStatusCode());\r\n \t\t} else {\r\n \t\t\tresponseString = parseResponse(response);\r\n \r\n \t\t}\r\n \t\treturn responseString;\r\n \t}", "public String issueGetRequest(String query) {\n URL url;\n String result = \"\";\n\n return \"valid\";\n /**\n * Todo: When server API is up and running uncomment this.\n *\n * try { url = new URL(server + \"?\" + query); BufferedReader br = new\n * BufferedReader(new InputStreamReader(url.openStream())); String\n * strTemp = \"\";\n * \n * while (null != (strTemp = br.readLine())) { result = strTemp; }\n * \n * } catch (Exception e) { e.printStackTrace(); }\n * \n * return result;\n */\n }", "public ClientResponse performGetRequest(String clientRegistrationID, URL url, Map<String, String> headers, Map<String, String> queryParameters);", "@Override\r\n\tpublic void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tString from = request.getRemoteAddr();\r\n\t\t\t\r\n\t\t\twriteLog(new StringBuilder(\"GET 请求 来自:\").append(from).append(request.getQueryString()));\r\n\r\n\t\t\tdoPost(request,response);\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public Response get(String path, Header[] headers) throws IOException {\n return get(cluster, path, headers);\n }", "@Override\n protected void doGet(HttpServletRequest req, HttpServletResponse resp)\n throws IOException {\n resp.setStatus(200);\n resp.setContentType(\"text/plain\");\n resp.getOutputStream().print(req.getParameter(\"hub.challenge\"));\n resp.getOutputStream().flush();\n\n JID user = new JID(req.getPathInfo().substring(1));\n\n if (req.getParameter(\"hub.mode\").equals(\"subscribe\")) {\n Xmpp.sendMessage(user, \"Subscribed to \" + req.getParameter(\"hub.topic\"));\n } else if (req.getParameter(\"hub.mode\").equals(\"unsubscribe\")) {\n Xmpp.sendMessage(\n user, \"Unsubscribed from \" + req.getParameter(\"hub.topic\")); \n }\n }", "@Override\n public void doGet(HttpServletRequest request, HttpServletResponse response) {\n System.out.println(\"[Servlet] GET request \" + request.getRequestURI());\n\n response.setContentType(FrontEndServiceDriver.APP_TYPE);\n response.setStatus(HttpURLConnection.HTTP_BAD_REQUEST);\n\n try {\n String url = FrontEndServiceDriver.primaryEventService +\n request.getRequestURI().replaceFirst(\"/events\", \"\");\n HttpURLConnection connection = doGetRequest(url);\n\n if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {\n PrintWriter pw = response.getWriter();\n JsonObject responseBody = (JsonObject) parseResponse(connection);\n\n response.setStatus(HttpURLConnection.HTTP_OK);\n pw.println(responseBody.toString());\n }\n }\n catch (Exception ignored) {}\n }", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tcommandAction(request,response);\r\n\t}", "@Test\n public void getRequest1() {\n str = METHOD_GET + \"/JavaPower.gif \" + HTTP_VERSION + ENDL +\n HOST_HEADER + \": www.devresource.org\" + ENDL +\n ACCEPT + \": text/html\" + ENDL +\n \"Range-Unit: 3388 | 1024\";\n request = new HttpRequest(str, IP_ADDRESS, HOST);\n\n assertEquals(request.getMethod(), HttpMethod.GET);\n assertEquals(request.getUrn(), \"/JavaPower.gif\");\n assertEquals(request.getHeader(ACCEPT), \"text/html\");\n assertEquals(request.getHeader(\"Range-Unit\"), \"3388 | 1024\");\n assertEquals(request.getHeader(NONEXISTENT_VAR), \"\");\n assertEquals(request.getParameter(NONEXISTENT_VAR), \"\");\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\r\n\t\t\tthrows ServletException, IOException {\n\t\tthis.service(req, resp);\r\n\t}", "@Override\n\tprotected String doInBackground(String... params) {\n\t\t RESTClient request=new RESTClient(getURL());\n\t try {\n\t\t\t\trequest.Execute(RequestMethod.GET);\n\t\t\t\treturn request.getResponse();\n\t\t\t} \n\t catch (Exception e) \n\t\t\t{\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn null;\n\t\t\t}\n\t \n\t}", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tSystem.out.println(\"请求AdminGetData成功\");\r\n//\t\tString userid = request.getHeader(\"userid\");\r\n//\t\tSystem.out.println(\"1231231::\"+userid);\r\n// \tif(userid==\"\"||userid==null) {\r\n//\t\t\tMap<String, Object> map = new HashMap<String, Object>();\r\n//\t\t\tSystem.out.println(\"userid为空\");\r\n//\t\t\tmap.put(\"code\", 0);\r\n//\t\t\tmap.put(\"data\", \"\");\r\n//\t\t\tmap.put(\"count\",0);\r\n//\t\t\tresponse.getWriter().write(JSON.toJSONString(map));\r\n// \t}else {\r\n\t\t\r\n\t\t//获取URI并进行截取方法名进行方法请求\r\n\t\t\tString requestURI = request.getRequestURI();\r\n\t\t\tSystem.out.println(\"地址截取前:\"+requestURI);\r\n\t\t\tString method = requestURI.substring(13, requestURI.length()-4);\r\n\t\t\tSystem.out.println(\"地址截取后:\"+method);\r\n\t\t\t\r\n\t\t\t//搜索单选选项条件值\r\n//\t\t\tString check = request.getParameter(\"check\");\r\n//\t\t\tSystem.out.println(\"单选check值:\"+check);\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\tMethod declaredMethod = this.getClass().getDeclaredMethod(method, HttpServletRequest.class,HttpServletResponse.class);\r\n\t\t\t\tdeclaredMethod.invoke(this,request, response);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t} \r\n// \t}\r\n\t}", "public static void GET(String url, RequestParams params, RestResponseHandler responseHandler) {\n client.get(getAbsoluteUrl(url), params, responseHandler);\n }", "public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/plain\");\n // Actual logic goes here.\n PrintWriter out = response.getWriter();\n out.println(\"Wolken,5534-0848-5100,0299-6830-9164\");\n\ttry \n\t{\n Get g = new Get(Bytes.toBytes(request.getParameter(\"userid\")));\n Result r = table.get(g);\n byte [] value = r.getValue(Bytes.toBytes(\"v\"),\n Bytes.toBytes(\"\"));\n\t\tString valueStr = Bytes.toString(value);\n\t\tout.println(valueStr);\n\t}\n\tcatch (Exception e)\n\t{\n\t\tout.println(e);\n\t}\n }", "private HttpResponse httpRequest(URL url, List<Header> headers, String method) throws IOException {\n\n BufferedReader streamReader;\n\n HttpURLConnection connection = setupConnection(url,headers,method);\n connection.setDoOutput(false);\n connection.connect();\n\n final int httpResponseCode = connection.getResponseCode();\n final List<Header> responseHeaders = Header.getHeaders(connection.getHeaderFields());\n\n try {\n streamReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n }\n catch (IOException e) {\n streamReader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));\n }\n\n StringBuilder sb = new StringBuilder();\n String currentLine;\n\n while((currentLine = streamReader.readLine()) != null) {\n sb.append(currentLine).append(\"\\n\");\n }\n\n connection.disconnect();\n\n try {\n Objects.requireNonNull(streamReader).close();\n }\n catch (IOException ignored){ }\n\n return new HttpResponse(responseHeaders,httpResponseCode,sb.toString().trim());\n }", "public static Response doGetRequest(String url, String token, String app_type) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException {\n try {\n Request request = new Request.Builder()\n .url(url).addHeader(\"cache-control\", \"no-cache\").\n addHeader(\"Authorization\", token).addHeader(\"app_type\", app_type).\n addHeader(\"access_token\", RestTags.PUBLIC_KEY)\n .build();\n Response response = client.newCall(request).execute();\n Log.e(\"RESPONSE:\", response.body() + \"Code:\" + response.code() + \"Message:\" + response.message());\n return response;\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n }", "public PersonName get() throws ClientException {\n return send(HttpMethod.GET, null);\n }", "public Response get(String path) throws IOException {\n return get(cluster, path);\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\r\n\t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\r\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tSystem.out.println(\"get\");\n\t\tthis.doPost(req, resp);\n\t}", "public String get(String path)\n {\n\n Client client = Client.create();\n\n WebResource webResource = client.resource(getHostAddress() + \":\" + getPort() + \"/api/\" + path);\n ClientResponse response = webResource.type(\"application/json\").get(ClientResponse.class);\n\n String message = response.getEntity(String.class);\n\n return message;\n }", "public void httpclient(String url){\n\t\t\r\n\t\t\r\n\t\tString httpUrl =BASIC_URL+url;\r\n\t\t\r\n\t\tSystem.out.println(httpUrl);\r\n\t\t\r\n\t\tHttpGet method =new HttpGet(httpUrl);\r\n\t\t\r\n\t\tmethod.setHeader(\"Content-Type\",\"application/json\");\r\n\t\tmethod.setHeader(\"charset\",\"UTF-8\");\r\n\t\t\r\n\t\ttry {\r\n\t\t\tCloseableHttpResponse res =client.execute(method,context);\r\n\r\n\t\t AuthState targetAuthState = context.getTargetAuthState();\r\n\t\t System.out.println(\"Target auth state: \" + targetAuthState.getState());\r\n\t\t System.out.println(\"Target auth scheme: \" + targetAuthState.getAuthScheme());\r\n\t\t System.out.println(\"Target auth credentials: \" + targetAuthState.getCredentials());\r\n\t\t\t\r\n\t\t HttpEntity ent =res.getEntity();\r\n\t\t \r\n\t\t if (ent != null) { \r\n System.out.println(\"Response content length: \" + ent.getContentLength()); \r\n System.out.println(ent+\"3214242423\");\r\n \r\n System.out.println(EntityUtils.toString(ent));\r\n } \r\n\t\t \r\n\t\t} catch (IOException e) {\r\n\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n }", "public static String executeGet(String targetURL) {\t\n\t\t HttpURLConnection connection = null; \n\t\t try {\n\t\t //Create connection\n\t\t URL url = new URL(targetURL);\n\t\t connection = (HttpURLConnection)url.openConnection();\n\t\t connection.setRequestMethod(\"GET\");\n\t\t connection.setRequestProperty(\"Content-Type\", \"application/json\");\n\t\t connection.setRequestProperty(\"Content-Language\", \"en-US\"); \n\n\t\t connection.setUseCaches(false);\n\t\t connection.setDoOutput(true);\n\n\n\t\t //Get Response \n\t\t InputStream is = connection.getInputStream();\n\t\t BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\t\t StringBuilder response = new StringBuilder(); // or StringBuffer if not Java 5+ \n\t\t String line;\n\t\t while((line = rd.readLine()) != null) {\n\t\t response.append(line);\n\t\t response.append('\\r');\n\t\t }\n\t\t rd.close();\n\t\t return response.toString();\n\t\t } catch (Exception e) {\n\t\t return e.getMessage();\n\t\t } finally {\n\t\t if(connection != null) {\n\t\t connection.disconnect(); \n\t\t }\n\t\t }\n\t\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t\t\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response)\r\n\t\t\tthrows ServletException, IOException {}", "@Override\n public final void doGet() {\n try {\n checkPermissions(getRequest());\n // GET one\n if (id != null) {\n output(api.runGet(id, getParameterAsList(PARAMETER_DEPLOY), getParameterAsList(PARAMETER_COUNTER)));\n } else if (countParameters() == 0) {\n throw new APIMissingIdException(getRequestURL());\n }\n // Search\n else {\n\n final ItemSearchResult<?> result = api.runSearch(Integer.parseInt(getParameter(PARAMETER_PAGE, \"0\")),\n Integer.parseInt(getParameter(PARAMETER_LIMIT, \"10\")), getParameter(PARAMETER_SEARCH),\n getParameter(PARAMETER_ORDER), parseFilters(getParameterAsList(PARAMETER_FILTER)),\n getParameterAsList(PARAMETER_DEPLOY), getParameterAsList(PARAMETER_COUNTER));\n\n head(\"Content-Range\", result.getPage() + \"-\" + result.getLength() + \"/\" + result.getTotal());\n\n output(result.getResults());\n }\n } catch (final APIException e) {\n e.setApi(apiName);\n e.setResource(resourceName);\n throw e;\n }\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n metGet(request, response);\n }", "void getRequests();", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\t\n\t}", "public static HttpResponse<JsonNode> sendRequest(String path, Map params) {\n String apiUrl = ConfigReader.getPropValues().getProperty(\"transit.url\");\n String apiKey = ConfigReader.getPropValues().getProperty(\"transit.key\");\n String jsonExtension = \".json\";\n HttpResponse<JsonNode> response = null;\n\n try {\n String fullPath = apiUrl + path;\n response = Unirest.get(fullPath + jsonExtension)\n .queryString(params)\n .queryString(\"api-key\", apiKey).asJson();\n BotLogger.info(LOG, \"Sent request: \" + fullPath);\n BotLogger.info(LOG, \"Params: \" + params);\n } catch (UnirestException e) {\n e.printStackTrace();\n }\n return response;\n\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t}", "private HttpResponse httpRequest(URL url, List<Header> headers, String method, byte[] data) throws IOException {\n\n BufferedReader streamReader;\n\n HttpURLConnection connection = setupConnection(url,headers,method);\n connection.setDoOutput(true);\n connection.connect();\n\n OutputStream outputStream = connection.getOutputStream();\n outputStream.write(data);\n outputStream.flush();\n outputStream.close();\n\n final int httpResponseCode = connection.getResponseCode();\n final List<Header> responseHeaders = Header.getHeaders(connection.getHeaderFields());\n\n try {\n streamReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n }\n catch (IOException e) {\n streamReader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));\n }\n\n StringBuilder sb = new StringBuilder();\n String currentLine;\n\n while((currentLine = streamReader.readLine()) != null) {\n sb.append(currentLine).append(\"\\n\");\n }\n\n connection.disconnect();\n\n try {\n Objects.requireNonNull(streamReader).close();\n }\n catch (IOException ignored){ }\n\n return new HttpResponse(responseHeaders,httpResponseCode,sb.toString().trim());\n }", "@Override\n\tpublic void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "@Test\n void getTest() {\n URI uri = URI.create(endBody + \"/get\");\n\n // get the response\n HttpResponse<String> response = HttpMethods.get(uri);\n\n // check if it received OK\n assertEquals(200, response.statusCode());\n }", "protected XCapHttpResponse get(URI uri)\n throws XCapException\n {\n DefaultHttpClient httpClient = null;\n try\n {\n httpClient = createHttpClient();\n\n HttpGet getMethod = new HttpGet(uri);\n getMethod.setHeader(\"Connection\", \"close\");\n\n HttpResponse response = httpClient.execute(getMethod);\n XCapHttpResponse result = createResponse(response);\n if (logger.isDebugEnabled())\n {\n byte[] contentBytes = result.getContent();\n String contenString;\n // for debug purposes print only xmls\n // skip the icon queries\n if(contentBytes != null && result.getContentType() != null\n && !result.getContentType()\n .startsWith(PresContentClient.CONTENT_TYPE))\n contenString = new String(contentBytes);\n else\n contenString = \"\";\n\n String logMessage = String.format(\n \"Getting resource %1s from the server content:%2s\",\n uri.toString(),\n contenString\n );\n logger.debug(logMessage);\n }\n return result;\n }\n catch(UnknownHostException uhe)\n {\n showError(uhe, null, null);\n disconnect();\n throw new XCapException(uhe.getMessage(), uhe);\n }\n catch (IOException e)\n {\n String errorMessage =\n SipActivator.getResources().getI18NString(\n \"impl.protocol.sip.XCAP_ERROR_RESOURCE_ERR\",\n new String[]{uri.toString(),\n userAddress.getDisplayName()});\n showError(e, null, errorMessage);\n throw new XCapException(errorMessage, e);\n }\n finally\n {\n if(httpClient != null)\n httpClient.getConnectionManager().shutdown();\n }\n }", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t}", "@Override\n protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n // Empty list of to hold the people\n List<Person> people = null;\n\n // Make the call to the API (Deployed on AWS)\n Client client1 = ClientBuilder.newClient();\n WebTarget serviceWeb1 = client1.target(\"http://18.221.209.59:8080/kmf/api/person\");\n Response response1 = serviceWeb1.request().get();\n\n // Take the response and map it into people objects\n ObjectMapper objectMapper = new ObjectMapper();\n people = objectMapper.readValue(response1.readEntity(String.class), new TypeReference<List<Person>>() {});\n\n // Send the people to the webpage to be displayed\n HttpSession session = req.getSession();\n session.setAttribute(\"people\", people);\n RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(\"/persons.jsp\");\n dispatcher.forward(req, resp);\n }", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t}", "private String sendRequest(String requestUrl) throws Exception {\n\t\t \n\t\tURL url = new URL(requestUrl);\n\t\tHttpURLConnection connection = (HttpURLConnection) url.openConnection();\n\n\t\tconnection.setRequestMethod(\"GET\");\n\t\tconnection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0\");\n \n\t\tBufferedReader in = new BufferedReader(\n\t\t\t\t\tnew InputStreamReader(connection.getInputStream(), \"UTF-8\"));\n\t\t\n\t\tString responseCode = Integer.toString(connection.getResponseCode());\n\t\tif(responseCode.startsWith(\"2\")){\n\t\t\tString inputLine;\n\t\t\tStringBuffer response = new StringBuffer();\n \n\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\tresponse.append(inputLine);\n\t\t\t}\n\t\t\tin.close();\n\t\t\tconnection.disconnect();\n\t\t\treturn response.toString();\n \t} else {\n \t\tSystem.out.println(\"Unable to connect to \"+requestUrl+\n \t\t\". Please check whether the instance is up and also the security group settings\"); \n\t\t\tconnection.disconnect();\n \t\treturn null;\n\t \t} \n\t}", "public final CompletableFuture<GetResponse> get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn)\n\t\t\tthrows IOException {\n\t\treturn get(fn.apply(new GetRequest.Builder()).build());\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "public static String executeHttpGet(String uri) throws Exception {\r\n\t\t\r\n\t\tHttpGet req = new HttpGet(uri);\r\n\t\tHttpClient client = new DefaultHttpClient();\r\n\t\tHttpResponse resLogin = client.execute(req);\r\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(resLogin\r\n\t\t\t\t.getEntity().getContent()));\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tString s = null;\r\n\t\twhile ((s = r.readLine()) != null) {\r\n\t\t\tsb.append(s);\r\n\t\t}\r\n\t\t\r\n\t\treturn sb.toString();\r\n\t}", "public void sendGetRequest(String urlResource,RequestCallback callback){\t\t\r\n\t\trequestBuilder = new RequestBuilder(RequestBuilder.GET, dispatcherURL + urlResource);\r\n\t\trequestBuilder.setHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\r\n\t\ttry {\t\t\t\r\n\t\t\trequestBuilder.sendRequest(\"\", callback);\r\n\t\t} catch (RequestException e) {\r\n\t\t\tWindow.alert(e.getMessage());\r\n\t\t}\r\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {\n //parsing request parameters in order to match operation to implement\n\n this.serverManager.execute(request, response);\n }", "@Test\n public void getEndpoint() throws IOException {\n CloseableHttpClient httpclient = HttpClients.createDefault();\n\n //Creating a HttpGet object\n HttpPost httppost = new HttpPost(\"https://api.github.com/user/repos\");\n String auth=Credentials.getEmail()+\":\"+Credentials.getPassWard();\n byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName(\"ISO-8859-1\")));\n String authHeader=\"Basic \"+new String(encodedAuth);\n httppost.setHeader(HttpHeaders.AUTHORIZATION,authHeader);\n String json=\"{\\\"name\\\": \\\"ploiko\\\"}\";\n httppost.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));\n HttpResponse httpresponse = httpclient.execute(httppost);\n System.out.println(httpresponse.getStatusLine());\n int actual=httpresponse.getStatusLine().getStatusCode();\n Assert.assertEquals(actual,201);\n //System.out.println(getHeaders(httpresponse,\"Access-Control-Allow-Methods\"));\n //System.out.println(httpresponse.getAllHeaders().toString());\n\n }", "@Test\n public void getRequest2() {\n str = METHOD_GET + \"/wiki/page.html \" + HTTP_VERSION + ENDL +\n HOST_HEADER + \": ru.wikipedia.org\" + ENDL +\n USER_AGENT + \": Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5\" + ENDL +\n ACCEPT + \": text/html\" + ENDL +\n CONNECTION_CLOSE;\n request = new HttpRequest(str, IP_ADDRESS, HOST);\n\n assertEquals(request.getMethod(), HttpMethod.GET);\n assertEquals(request.getUrn(), \"/wiki/page.html\");\n assertEquals(request.getHeader(HOST_HEADER), \"ru.wikipedia.org\");\n assertEquals(request.getHeader(USER_AGENT),\n \"Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5\");\n assertEquals(request.getHeader(ACCEPT), \"text/html\");\n assertEquals(request.getHeader(CONNECTION), CLOSE_STR);\n assertEquals(request.getHeader(NONEXISTENT_VAR), \"\");\n assertEquals(request.getParameter(NONEXISTENT_VAR), \"\");\n }", "protected void doGet(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\n String action = request.getParameter(\"action\");\r\n\r\n try {\r\n switch (action)\r\n {\r\n case \"/getUser\":\r\n \tgetUser(request, response);\r\n break;\r\n \r\n }\r\n } catch (Exception ex) {\r\n throw new ServletException(ex);\r\n }\r\n }" ]
[ "0.72099185", "0.6887084", "0.6577497", "0.6456418", "0.64498824", "0.64131236", "0.6404304", "0.6390762", "0.6385095", "0.6383808", "0.63729286", "0.6361075", "0.63253754", "0.6189557", "0.6171696", "0.61331344", "0.6086774", "0.60610867", "0.605252", "0.6019567", "0.6010914", "0.59858704", "0.5973391", "0.5903497", "0.5902158", "0.5898132", "0.58837813", "0.5878814", "0.58773595", "0.5858673", "0.585708", "0.5851317", "0.58411604", "0.5838438", "0.58375096", "0.58245623", "0.58195204", "0.58140266", "0.5811135", "0.58053404", "0.58031636", "0.5786981", "0.57861733", "0.5780614", "0.576829", "0.57612604", "0.5745685", "0.5740744", "0.5737174", "0.57261467", "0.5712216", "0.57097805", "0.5699164", "0.5698824", "0.56775004", "0.5664417", "0.5661598", "0.56591827", "0.56564724", "0.56497455", "0.56483555", "0.56451386", "0.5625633", "0.5623305", "0.5609429", "0.56089634", "0.56075895", "0.55904925", "0.55893826", "0.5586245", "0.5586245", "0.5580404", "0.5579415", "0.5572258", "0.5570358", "0.5569428", "0.5561329", "0.5555995", "0.5549359", "0.55479723", "0.5547953", "0.55454165", "0.55443764", "0.55319387", "0.55315036", "0.5529184", "0.5526185", "0.55261165", "0.55140907", "0.55066204", "0.5506216", "0.5497453", "0.5496383", "0.54960173", "0.54960173", "0.5491779", "0.5490284", "0.54894495", "0.5480888", "0.54798084", "0.547699" ]
0.0
-1
send a request to get (no preflight)
@Test public void testExceptionThrownInFlowRef() throws Exception { final HttpResponse response = Request.Get("http://localhost:" + httpPort.getValue() + CORS_MAIN_FLOW_ENDPOINT_PATH) .addHeader("Origin", CORS_DEFAULT_ORIGIN).execute().returnResponse(); assertNotNull("Response should not be null", response); //we should have an access control allow origin assertNotNull("Allowed origin should be present", response.getFirstHeader(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static HttpResponse sendGet() throws Exception {\n // Create the Call using the URL\n HttpGet http = new HttpGet(url);\n // Set the credentials set earlier into the headers\n Header header = new BasicScheme(StandardCharsets.UTF_8).authenticate(creds, http, null);\n // Set the header into the HTTP request\n http.addHeader(header);\n // Print the response\n return httpClient.execute(http);\n }", "HttpGet getRequest(HttpServletRequest request, String address) throws IOException;", "@Override\n\tprotected Method getMethod() {\n\t\treturn Method.GET;\n\t}", "private static String get_request(String uri, boolean isChecking, String token) throws IOException {\r\n URL url = new URL(uri);\r\n HttpURLConnection connection = (HttpURLConnection) url.openConnection();\r\n connection.setRequestProperty(\"Content-Type\", \"application/json\");\r\n connection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36 Edg/88.0.705.74\");\r\n if (isChecking) {\r\n connection.setRequestProperty(\"Authorization\", token);\r\n }\r\n connection.setRequestMethod(\"GET\");\r\n InputStream responseStream = connection.getInputStream();\r\n if (debug) {\r\n System.out.println(\"GET - \"+connection.getResponseCode());\r\n }\r\n try (Scanner scanner = new Scanner(responseStream)) {\r\n String responseBody = scanner.useDelimiter(\"\\\\A\").next();\r\n if (debug) {\r\n System.out.println(responseBody);\r\n }\r\n return responseBody;\r\n } catch (Exception e) {\r\n return \"ERROR\";\r\n }\r\n }", "@Override\n\tprotected void executeGet(GetRequest request, OperationResponse response) {\n\t}", "private HttpResponse executeHttpGet(String apiUrl) throws OAuthMessageSignerException,\r\n\t\t\tOAuthExpectationFailedException, OAuthCommunicationException, IOException {\r\n\t\tHttpGet httprequest = new HttpGet(apiUrl);\r\n\t\tgetOAuthConsumer().sign(httprequest);\r\n\t\tHttpClient client = new DefaultHttpClient();\r\n\t\tHttpResponse httpresponse = client.execute(httprequest);\r\n\t\tint statusCode = httpresponse.getStatusLine().getStatusCode();\r\n\t\tSystem.out.println(statusCode + \":\" + httpresponse.getStatusLine().getReasonPhrase());\r\n\t\treturn httpresponse;\r\n\t}", "public Result get(Get get) throws IOException;", "private static String sendGET(String getURL) throws IOException {\n\t\tURL obj = new URL(getURL);\n\t\tHttpURLConnection con = (HttpURLConnection) obj.openConnection();\n\t\tcon.setRequestMethod(\"GET\");\n\t\tString finalResponse = \"\";\n\n\t\t//This way we know if the request was processed successfully or there was any HTTP error message thrown.\n\t\tint responseCode = con.getResponseCode();\n\t\tSystem.out.println(\"GET Response Code : \" + responseCode);\n\t\tif (responseCode == HttpURLConnection.HTTP_OK) { // success\n\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n\t\t\tString inputLine;\n\t\t\tStringBuffer buffer = new StringBuffer();\n\n\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\tbuffer.append(inputLine);\n\t\t\t}\n\t\t\tin.close();\n\n\t\t\t// print result\n\t\t\tfinalResponse = buffer.toString();\n\t\t} else {\n\t\t\tSystem.out.println(\"GET request not worked\");\n\t\t}\n\t\treturn finalResponse;\n\t}", "public HttpResponseWrapper invokeGET(String path) {\n\t\treturn invokeHttpMethod(HttpMethodType.HTTP_GET, path, \"\");\n\t}", "public void doGet( )\n {\n \n }", "@Override\n\tpublic HttpResponse get(final String endpoint) {\n\t\treturn httpRequest(HTTP_GET, endpoint, null);\n\t}", "@Test\r\n\tpublic void doGet() throws Exception {\n\t\tCloseableHttpClient httpClient = HttpClients.createDefault();\r\n\t\t// Create a GET object and pass a url to it\r\n\t\tHttpGet get = new HttpGet(\"http://www.google.com\");\r\n\t\t// make a request\r\n\t\tCloseableHttpResponse response = httpClient.execute(get);\r\n\t\t// get response as result\r\n\t\tSystem.out.println(response.getStatusLine().getStatusCode());\r\n\t\tHttpEntity entity = response.getEntity();\r\n\t\tSystem.out.println(EntityUtils.toString(entity));\r\n\t\t// close HttpClient\r\n\t\tresponse.close();\r\n\t\thttpClient.close();\r\n\t}", "private void requestGet(String endpoint, Map<String, String> params, RequestListener listener) throws Exception {\n String requestUri = Constant.API_BASE_URL + ((endpoint.indexOf(\"/\") == 0) ? endpoint : \"/\" + endpoint);\n get(requestUri, params, listener);\n }", "public static String sendGetRequest(String addr,String[] head)\n\t{\n\t\tString response = null;\n\t\n\t\ttry\n\t\t{\n\t\t\tURL url = new URL(addr);\n\t\t\tHttpURLConnection connection = (HttpURLConnection) url.openConnection();\n\t\t\t//String encoding = new sun.misc.BASE64Encoder().encode(\"username \t assword\".getBytes());\n\t\t\t//conn.setRequestProperty (\"Authorization\", \"Basic \" + encoding);\n\t\t\tif(head!=null)\n {\n\t for(int i=0;i<head.length;i=i+2)\n\t {\n\t \tconnection.setRequestProperty(head[i], head[i+1]);\n\t \t\n\t }\n }\n\t\t\tconnection.setRequestMethod(\"GET\");\n\t\t\n\t\t\tconnection.connect();\n\t\t\tInputStream in = connection.getInputStream();\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\t\t\tconnection.disconnect();\n\t\t\tresponse = reader.readLine();\n\t\t\t//System.out.println(text);\n\t\t\n\t\t\t\n\t\t\t}catch(IOException ex)\n\t\t\t{\n\t\t\tex.printStackTrace();\n\t\t\tSystem.out.println(\"made it here\");\n\t\t}\n\treturn response;\n\t\n\t}", "GetResponse() {\n\t}", "public void sendRequest() {\n\t\tURL obj;\n\t\ttry {\n\t\t\t// Instantiating HttpURLConnection object for making GET request.\n\t\t\tobj = new URL(REQUEST_URL);\n\t\t HttpURLConnection connection = (HttpURLConnection) obj.openConnection();\n\t\t connection.setRequestMethod(REQUEST_METHOD);\n\t\t connection.setRequestProperty(\"User-Agent\", USER_AGENT);\n\t\t connection.setInstanceFollowRedirects(FOLLOW_REDIRECTS);\n\t\t\tHttpURLConnection.setFollowRedirects(FOLLOW_REDIRECTS);\n\t\t\n\t\t\t// Checking response code for successful request.\n\t\t\t// If responseCode==200, read the response,\n\t\t\t// if responseCode==3xx, i.e., a redirect, then make the request to \n\t\t\t// new redirected link, specified by 'Location' field. \n\t\t\t// NOTE: Only one level of redirection is supported for now. \n\t\t\t// Can be modified to support multiple levels of Redirections.\n\t\t\tint responseCode = connection.getResponseCode();\n\t\t\tif(responseCode == HttpURLConnection.HTTP_MOVED_PERM ||\n\t\t\t\t\tresponseCode == HttpURLConnection.HTTP_MOVED_TEMP ||\n\t\t\t\t\tresponseCode == HttpURLConnection.HTTP_SEE_OTHER) {\n\t\t\t\tlogger.info(\"Redirect received in responseCode\");\n\t\t\t\tString newUrl = connection.getHeaderField(\"Location\");\n\t\t\t\tconnection = (HttpURLConnection) new URL(newUrl).openConnection();\n\t\t\t}\n\t\t\tresponseCode = connection.getResponseCode();\n\t\t\t\n\t\t\t// process response message if responseCode==200 i.e., success.\n\t\t\tif (responseCode == HttpURLConnection.HTTP_OK) {\n\t\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(\n\t\t\t\t\t\tconnection.getInputStream()));\n\t\t\t\tString inputLine;\n\t\t\t\tStringBuffer response = new StringBuffer();\n\t\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\t\tresponse.append(inputLine);\n\t\t\t\t}\n\t\t\t\tin.close();\n\t\t\t\t//Uncomment following line to log response data.\n\t\t\t\t//logger.info(response.toString());\n\t\t\t} else {\n\t\t\t\tlogger.warning(\"Http GET request was unsuccessful!\");\n\t\t\t}\n\t\t} catch (MalformedURLException e) {\n\t\t\tlogger.severe(\"MalformedURLException: \" + e.getMessage());\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\tlogger.severe(\"IOException: \" + e.getMessage());\n\t\t\te.printStackTrace();\n\t\t}\n }", "R get() throws IOException, ClientProtocolException;", "public CompletableFuture<GetResponse> get(GetRequest request) throws IOException {\n\t\treturn this.transport.performRequestAsync(request, GetRequest.ENDPOINT, this.requestOptions);\n\t}", "public String request(String method, String url, String data) {\n HttpURLConnection connection = null;\n try {\n if ((method.compareTo(\"GET\") == 0) && (data != null) && (!data.isEmpty())) {\n if (url.contains(\"?\"))\n url = url.concat(\"&\");\n else\n url = url.concat(\"?\");\n url = url.concat(data);\n }\n // Create connection\n URL requestUrl = new URL(url);\n connection = (HttpURLConnection) requestUrl.openConnection();\n connection.setRequestProperty(\"Veridu-Client\", this.key);\n if ((this.storage.getSessionToken() != null) && (!this.storage.getSessionToken().isEmpty()))\n connection.setRequestProperty(\"Veridu-Session\", this.storage.getSessionToken());\n connection.setRequestMethod(method);\n connection.setConnectTimeout(10000);\n connection.setReadTimeout(10000);\n connection.setUseCaches(false);\n connection.setDoOutput(true);\n // Send request\n if ((method.compareTo(\"GET\") != 0) && (data != null) && (!data.isEmpty())) {\n connection.setRequestProperty(\"Content-Type\", \"application/x-www-form-urlencoded\");\n connection.setRequestProperty(\"Content-Length\", Integer.toString(data.getBytes().length));\n connection.setDoInput(true);\n DataOutputStream wr = new DataOutputStream(connection.getOutputStream());\n wr.writeBytes(data);\n wr.flush();\n wr.close();\n }\n\n // Get Response\n this.lastCode = connection.getResponseCode();\n InputStream is;\n if (this.lastCode >= 400)\n is = connection.getErrorStream();\n else\n is = connection.getInputStream();\n BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n String line;\n StringBuilder response = new StringBuilder();\n while ((line = rd.readLine()) != null) {\n response.append(line);\n response.append('\\r');\n }\n rd.close();\n return response.toString();\n\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (connection != null)\n connection.disconnect();\n }\n return null;\n }", "public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException {\r\n\tlogTrace( req, \"GET log\" );\r\n\tString requestId = req.getQueryString();\r\n\tif (requestId == null) return;\r\n\tif (\"get-response\".equals( requestId )) {\r\n\t try {\r\n\t\tonMEVPollsForResponse( req, resp );\r\n\t } catch (Exception e) {\r\n\t\tlogError( req, resp, e, \"MEV polling error\" );\r\n\t\tsendError( resp, \"MEV polling error: \" + e.toString() );\r\n\t }\r\n\t}\r\n }", "static String sendGET(String GET_URL) throws IOException, JSONException {\n\t\t// Check URL is valid or not.\n\t\tif (isValidURL(GET_URL)) {\n\t\t\ttry {\n\t\t\t\tURL obj = new URL(GET_URL);\n\t\t\t\tHttpURLConnection con = (HttpURLConnection) obj.openConnection();\n\t\t\t\tcon.setRequestMethod(\"GET\");\n\t\t\t\tcon.setRequestProperty(\"User-Agent\", USER_AGENT);\n\t\t\t\tint responseCode = con.getResponseCode();\n\t\t\t\tSystem.out.println(\"GET Response Code :: \" + responseCode);\n\t\t\t\tif (responseCode == HttpURLConnection.HTTP_OK) { // success\n\t\t\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n\t\t\t\t\tString inputLine;\n\t\t\t\t\tStringBuffer response = new StringBuffer();\n\n\t\t\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\t\t\tresponse.append(inputLine);\n\t\t\t\t\t}\n\t\t\t\t\tin.close();\n\t\t\t\t\t// Convert to json object and get specified data from it. Then you can print if the response is json type.\n\t\t\t\t\tString list = getList(response.toString());\n\t\t\t\t\tSystem.out.println(list);\n\t\t\t\t\t// print result\n\t\t\t\t\tSystem.out.println(response.toString());\n\t\t\t\t\treturn \"GET request worked\"; // Added for testing.\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"GET request not worked\");\n\t\t\t\t\treturn \"GET request not worked\";\n\t\t\t\t}\n\t\t\t} catch (MalformedURLException e) {\n\t\t\t\treturn \"URL is valid but connection could not be established.\";\n\t\t\t} catch (IOException e) {\n\t\t\t\treturn \"URL is valid but connection could not be established.\";\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"URL is not valid.\";\n\t\t}\n\t}", "@Override\r\n\tprotected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoGet(req, resp);\r\n\t}", "public ResponseTranslator get() {\n setMethod(\"GET\");\n return doRequest();\n }", "public static Response doGetRequest(String url) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException {\n try {\n Request request = new Request.Builder()\n .url(url).addHeader(\"Content-Type\", \"text/plain\")\n .build();\n Response response = client.newCall(request).execute();\n return response;\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n }", "@Override\n\tpublic InputStream doGet(String url) {\n\t\tInputStream in = null;\n\t\tHttpGet getRequest = new HttpGet(url);\n\t\tgetRequest.addHeader(\"charset\", HTTP.UTF_8);\n\t\tHttpClient client = new DefaultHttpClient();\n\t\tclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 6000);\n\t\tclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 8000);\n\t\tHttpResponse response = null;\n\t\ttry {\n\t\t\tresponse = client.execute(getRequest);\n\t\t\tif(null != response && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){\n\t\t\t\tin = response.getEntity().getContent();\n\t\t\t}\n\t\t} catch (ClientProtocolException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn in;\n\t}", "String getRequest(String url);", "Response get(URL target, QueryInput input, List<? extends HttpAuthentication> auth)\n throws IOException, DataRetrievalException;", "@Test\r\n\tpublic void doGetWithParams() throws Exception {\n\t\tCloseableHttpClient httpClient = HttpClients.createDefault();\r\n\t\t// Create a GET object and pass a url to it\r\n\t\tURIBuilder uriBuilder = new URIBuilder(\"http://www.google.com/search\");\r\n\t\turiBuilder.addParameter(\"query\", \"Bingyang Wei\");\r\n\t\tHttpGet get = new HttpGet(uriBuilder.build());\r\n\r\n\t\t// make a request\r\n\t\tCloseableHttpResponse response = httpClient.execute(get);\r\n\t\t// get response as result\r\n\t\tSystem.out.println(response.getStatusLine().getStatusCode());\r\n\t\tHttpEntity entity = response.getEntity();\r\n\t\tSystem.out.println(EntityUtils.toString(entity));\r\n\t\t// close HttpClient\r\n\t\tresponse.close();\r\n\t\thttpClient.close();\r\n\t}", "public Response get(Cluster c, String path, Header[] headers) \n throws IOException {\n GetMethod method = new GetMethod();\n try {\n int code = execute(c, method, headers, path);\n headers = method.getResponseHeaders();\n byte[] body = method.getResponseBody();\n InputStream in = method.getResponseBodyAsStream();\n return new Response(code, headers, body, in);\n } finally {\n method.releaseConnection();\n }\n }", "public void GetCall(String url) throws ClientProtocolException, IOException {\n\t\tCloseableHttpClient httpclient=HttpClients.createDefault();\n\t\tHttpGet httpget=new HttpGet(url);\n\t//lohith\n\t\tCloseableHttpResponse closeablehttpresponse=httpclient.execute(httpget);\n\t\tint responsestatuscode=closeablehttpresponse.getStatusLine().getStatusCode();\n\t\tSystem.out.println(\"responsestatuscode: \"+responsestatuscode);\n\t\t\n\t\tString response=EntityUtils.toString(closeablehttpresponse.getEntity(),\"UTF-8\");\n\t\tSystem.out.println(\"ClientResponse: \"+response);\n\t\tJSONObject jsonobject= new JSONObject(response);\n\t\t\n\t\tSystem.out.println(\"jsonobject: \"+jsonobject);\n\t\t\n\t\t\n\t}", "private String doHttpClientGet() {\n\t\t\r\n\t\tHttpGet httpGet=new HttpGet(url);\r\n\t\tHttpClient client=new DefaultHttpClient();\r\n\t\ttry {\r\n\t\t\tHttpResponse response=client.execute(httpGet);\r\n\t\t\tif(response.getStatusLine().getStatusCode()==HttpStatus.SC_OK){\r\n\t\t\t\tresult=EntityUtils.toString(response.getEntity());\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"content----->\"+result);\r\n\t\t} catch (ClientProtocolException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "@Override\n\tprotected HttpResponse doHttpRequest() throws ClientProtocolException, IOException {\n\t\tHttpRequestGenerator requestor = new HttpRequestGenerator(username, password);\n\t\treturn requestor.makeKeyFetchRequest(keyServerUrl, null);\n\t}", "private static String sendGET(final Long id) {\n return \"\";\r\n }", "public ServiceResponse getRequest(String url) throws IOException {\n HttpClient client = HttpClientBuilder.create().build();\n HttpGet request = new HttpGet(url);\n HttpResponse httpResponse = client.execute(request);\n ServiceResponse response = new ServiceResponse(httpResponse.getStatusLine().getStatusCode());\n response.setReader(new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent())));\n return response;\n }", "public void doGet() throws IOException {\n\n // search ressource\n byte[] contentByte = null;\n try {\n contentByte = ToolBox.readFileByte(RESOURCE_DIRECTORY, this.url);\n this.statusCode = OK;\n ContentType contentType = new ContentType(this.extension);\n sendHeader(statusCode, contentType.getContentType(), contentByte.length);\n } catch (IOException e) {\n System.out.println(\"Ressource non trouvé\");\n statusCode = NOT_FOUND;\n contentByte = ToolBox.readFileByte(RESPONSE_PAGE_DIRECTORY, \"pageNotFound.html\");\n sendHeader(statusCode, \"text/html\", contentByte.length);\n }\n\n this.sendBodyByte(contentByte);\n }", "@Override\n\tpublic WebApiRequest getRequest() {\n\t\tString category = \"\";\n\t\tString destination = \"\";\n\t\tJSONObject para = new JSONObject();\n\t\tif (taskFlag == GET_BALANCE_DETAIL_FLAG) {\n\t\t\tcategory = CATEGORY_NAME;\n\t\t\tdestination = GET_BALANCE_Detail;\n\t\t\ttry {\n\t\t\t\tpara.put(\"ID\", getIntent().getIntExtra(\"BalanceID\", 0));\n\t\t\t\tpara.put(\"CardType\", getIntent().getIntExtra(\"CardType\", 1));\n\t\t\t\tpara.put(\"ChangeType\", getIntent().getIntExtra(\"ChangeType\", 0));\n\t\t\t} catch (JSONException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\tWebApiHttpHead header = mApp.createNeededCheckingWebConnectHead(category, destination, para.toString());\n\t\tWebApiRequest request = new WebApiRequest(category, destination,para.toString(), header);\n\t\treturn request;\n\t}", "private String sendGetRequest() throws IOException {\n\t\tString inline = \"\";\n\t\tURL url = new URL(COUNTRYAPI);\n\t\tHttpURLConnection conn = (HttpURLConnection) url.openConnection();\n\t\tconn.setRequestMethod(\"GET\");\n\t\tconn.connect();\n\t\tint responsecode = conn.getResponseCode();\n\t\tif (responsecode != 200) {\n\t\t\tthrow new RuntimeException(\"HttpResponseCode: \" + responsecode);\n\t\t} else {\n\t\t\tScanner sc = new Scanner(url.openStream());\n\t\t\twhile (sc.hasNext()) {\n\t\t\t\tinline += sc.nextLine();\n\t\t\t}\n\t\t\tsc.close();\n\t\t}\n\t\treturn inline.toString();\n\t}", "private RawHttpResponse<?> executeRequest(String method, String path) throws IOException {\r\n\t\tSocket socket = new Socket(\"localhost\", 8080);\r\n\t\treturn executeRequest(method, path, \"\", socket);\r\n\t}", "public String doHttpGet(String url, final String ...head);", "void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;", "public EntityType2 get() throws ClientException {\n return send(HttpMethod.GET, null);\n }", "public BufferedReader reqGet(final String route) throws\n ServerStatusException, IOException {\n System.out.println(\"first reqGet\");\n return reqGet(route, USER_AGENT);\n }", "@NonNull\n public String getAction() {\n return \"GET\";\n }", "private synchronized String execute(final HttpUriRequest request) {\n request.setParams(params);\n\n // Set the request's headers\n for (Entry<String, String> header : headers.entrySet()) {\n request.setHeader(header.getKey(), header.getValue());\n }\n\n // Execute the request and get it's content\n HttpResponse response;\n String content;\n try {\n\n // Execute the request\n response = getClient().execute(request);\n\n // Get the response content\n content = EntityUtils.toString(response.getEntity(), charset);\n } catch (IOException e) {\n throw new JsogClientException(\"Get request failed.\", e);\n }\n\n // Check the response code\n StatusLine sl = response.getStatusLine();\n if (sl.getStatusCode() != 200) {\n throw new Non200ResponseCodeException(\n sl.getStatusCode(),\n sl.getReasonPhrase(),\n content);\n }\n\n return content;\n }", "public String getResultFromGET() \r\n\t{\r\n\t\tString resultstring = null;\r\n\t\t\r\n\t\t// Use BasicNameValuePair to create GET data\r\n\t\tList<NameValuePair> pairs = new ArrayList<NameValuePair>();\r\n\t\tpairs.add(new BasicNameValuePair(\"token\", user.getTokenkey()));\r\n\t\tpairs.add(new BasicNameValuePair(\"method\", \"accountapi.getNotifications\"));\r\n\t\t\r\n\t\t// url request\r\n\t\tString URL = null;\r\n\t\tif (Config.CORE_URL == null) {\r\n\t\t\tURL = Config.makeUrl(user.getCoreUrl(), null, false);\t\r\n\t\t} else {\r\n\t\t\tURL = Config.makeUrl(Config.CORE_URL, null, false);\r\n\t\t}\r\n\t\t\r\n\t\t// request GET method to server\r\n\t\tresultstring = networkUntil.makeHttpRequest(URL, \"GET\", pairs);\r\n\t\t\r\n\t\tLog.i(\"DEBUG\", resultstring);\r\n\t\t\r\n\t\treturn resultstring;\r\n\t}", "@Test\n\t \n\t public void getApi() {\n\t\t \n\t\t Response getIt=get(\"https://reqres.in/api/users?page=2\");\n\t\t getIt.prettyPrint();\n\t\t System.out.println(getIt.getStatusCode());\n\t\t System.out.println(getIt.getTime());\n\t\t \n\t\t //to validate\n\t\t int validGstatus=getIt.getStatusCode();\n\t\t Assert.assertEquals(validGstatus,200);\n\t\t \n\t }", "protected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tcontact.forward(req, resp);\n\n\t}", "@RequestMapping(method=RequestMethod.GET)\n public @ResponseBody void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, JSONException, ParserConfigurationException {\n LOG.debug(\"doGet wgetproxy\");\n createWGET(request, response);\n }", "public void getRequest_withBasicAuth() {\n apiUtil = new APIUtil();\n // As this is an API call , we are not setting up any base url but defining the individual calls\n apiUtil.setBaseURI(configurationReader.get(\"BaseURL\"));\n //This is used to validate the get call protected with basic authentication mechanism\n basicAuthValidation();\n }", "public BufferedReader reqGet(final String route,\n final String userAgent)\n throws ServerStatusException, IOException {\n System.out.println(\"reqGet\");\n URL inputUrl = new URL(domain + route);\n HttpURLConnection con = (HttpURLConnection) inputUrl.openConnection();\n System.out.println(con);\n con.setRequestMethod(\"GET\");\n con.setRequestProperty(\"User-Agent\", userAgent);\n System.out.println(inputUrl);\n return readRes(con);\n }", "public String GET(String uri) {\n String retVal = \"\";\n try {\n request = HttpRequest.newBuilder()\n .GET()\n .uri(new URI(uri))\n .build();\n\n response = HttpClient.newBuilder()\n .build()\n .send(request, HttpResponse.BodyHandlers.ofString());\n\n retVal = response.body().toString();\n }\n catch (Exception e) {\n // correctly handles the exception according to framework\n // for this case, just returns an empty string\n }\n return retVal;\n }", "public static String httpGet(String url) throws Exception {\r\n \t\tDefaultHttpClient client = new DefaultHttpClient();\r\n \t\tHttpResponse response = null;\r\n \t\tString responseString = null;\r\n \t\tHttpUriRequest request = new HttpGet(url);\r\n \t\trequest.setHeader(\"Accept-Encoding\", \"gzip\");\r\n \t\trequest.setHeader(\"User-Agent\", \"gzip\");\r\n\t\tresponse = client.execute(request);\r\n \t\tif (response.getStatusLine().getStatusCode() != 200) {\r\n \t\t\tthrow new HttpException(\"Server error: \"\r\n \t\t\t\t\t+ response.getStatusLine().getStatusCode());\r\n \t\t} else {\r\n \t\t\tresponseString = parseResponse(response);\r\n \r\n \t\t}\r\n \t\treturn responseString;\r\n \t}", "public String issueGetRequest(String query) {\n URL url;\n String result = \"\";\n\n return \"valid\";\n /**\n * Todo: When server API is up and running uncomment this.\n *\n * try { url = new URL(server + \"?\" + query); BufferedReader br = new\n * BufferedReader(new InputStreamReader(url.openStream())); String\n * strTemp = \"\";\n * \n * while (null != (strTemp = br.readLine())) { result = strTemp; }\n * \n * } catch (Exception e) { e.printStackTrace(); }\n * \n * return result;\n */\n }", "public ClientResponse performGetRequest(String clientRegistrationID, URL url, Map<String, String> headers, Map<String, String> queryParameters);", "@Override\r\n\tpublic void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tString from = request.getRemoteAddr();\r\n\t\t\t\r\n\t\t\twriteLog(new StringBuilder(\"GET 请求 来自:\").append(from).append(request.getQueryString()));\r\n\r\n\t\t\tdoPost(request,response);\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public Response get(String path, Header[] headers) throws IOException {\n return get(cluster, path, headers);\n }", "@Override\n protected void doGet(HttpServletRequest req, HttpServletResponse resp)\n throws IOException {\n resp.setStatus(200);\n resp.setContentType(\"text/plain\");\n resp.getOutputStream().print(req.getParameter(\"hub.challenge\"));\n resp.getOutputStream().flush();\n\n JID user = new JID(req.getPathInfo().substring(1));\n\n if (req.getParameter(\"hub.mode\").equals(\"subscribe\")) {\n Xmpp.sendMessage(user, \"Subscribed to \" + req.getParameter(\"hub.topic\"));\n } else if (req.getParameter(\"hub.mode\").equals(\"unsubscribe\")) {\n Xmpp.sendMessage(\n user, \"Unsubscribed from \" + req.getParameter(\"hub.topic\")); \n }\n }", "@Override\n public void doGet(HttpServletRequest request, HttpServletResponse response) {\n System.out.println(\"[Servlet] GET request \" + request.getRequestURI());\n\n response.setContentType(FrontEndServiceDriver.APP_TYPE);\n response.setStatus(HttpURLConnection.HTTP_BAD_REQUEST);\n\n try {\n String url = FrontEndServiceDriver.primaryEventService +\n request.getRequestURI().replaceFirst(\"/events\", \"\");\n HttpURLConnection connection = doGetRequest(url);\n\n if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {\n PrintWriter pw = response.getWriter();\n JsonObject responseBody = (JsonObject) parseResponse(connection);\n\n response.setStatus(HttpURLConnection.HTTP_OK);\n pw.println(responseBody.toString());\n }\n }\n catch (Exception ignored) {}\n }", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tcommandAction(request,response);\r\n\t}", "@Test\n public void getRequest1() {\n str = METHOD_GET + \"/JavaPower.gif \" + HTTP_VERSION + ENDL +\n HOST_HEADER + \": www.devresource.org\" + ENDL +\n ACCEPT + \": text/html\" + ENDL +\n \"Range-Unit: 3388 | 1024\";\n request = new HttpRequest(str, IP_ADDRESS, HOST);\n\n assertEquals(request.getMethod(), HttpMethod.GET);\n assertEquals(request.getUrn(), \"/JavaPower.gif\");\n assertEquals(request.getHeader(ACCEPT), \"text/html\");\n assertEquals(request.getHeader(\"Range-Unit\"), \"3388 | 1024\");\n assertEquals(request.getHeader(NONEXISTENT_VAR), \"\");\n assertEquals(request.getParameter(NONEXISTENT_VAR), \"\");\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\r\n\t\t\tthrows ServletException, IOException {\n\t\tthis.service(req, resp);\r\n\t}", "@Override\n\tprotected String doInBackground(String... params) {\n\t\t RESTClient request=new RESTClient(getURL());\n\t try {\n\t\t\t\trequest.Execute(RequestMethod.GET);\n\t\t\t\treturn request.getResponse();\n\t\t\t} \n\t catch (Exception e) \n\t\t\t{\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn null;\n\t\t\t}\n\t \n\t}", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tSystem.out.println(\"请求AdminGetData成功\");\r\n//\t\tString userid = request.getHeader(\"userid\");\r\n//\t\tSystem.out.println(\"1231231::\"+userid);\r\n// \tif(userid==\"\"||userid==null) {\r\n//\t\t\tMap<String, Object> map = new HashMap<String, Object>();\r\n//\t\t\tSystem.out.println(\"userid为空\");\r\n//\t\t\tmap.put(\"code\", 0);\r\n//\t\t\tmap.put(\"data\", \"\");\r\n//\t\t\tmap.put(\"count\",0);\r\n//\t\t\tresponse.getWriter().write(JSON.toJSONString(map));\r\n// \t}else {\r\n\t\t\r\n\t\t//获取URI并进行截取方法名进行方法请求\r\n\t\t\tString requestURI = request.getRequestURI();\r\n\t\t\tSystem.out.println(\"地址截取前:\"+requestURI);\r\n\t\t\tString method = requestURI.substring(13, requestURI.length()-4);\r\n\t\t\tSystem.out.println(\"地址截取后:\"+method);\r\n\t\t\t\r\n\t\t\t//搜索单选选项条件值\r\n//\t\t\tString check = request.getParameter(\"check\");\r\n//\t\t\tSystem.out.println(\"单选check值:\"+check);\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\tMethod declaredMethod = this.getClass().getDeclaredMethod(method, HttpServletRequest.class,HttpServletResponse.class);\r\n\t\t\t\tdeclaredMethod.invoke(this,request, response);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t} \r\n// \t}\r\n\t}", "public static void GET(String url, RequestParams params, RestResponseHandler responseHandler) {\n client.get(getAbsoluteUrl(url), params, responseHandler);\n }", "public void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/plain\");\n // Actual logic goes here.\n PrintWriter out = response.getWriter();\n out.println(\"Wolken,5534-0848-5100,0299-6830-9164\");\n\ttry \n\t{\n Get g = new Get(Bytes.toBytes(request.getParameter(\"userid\")));\n Result r = table.get(g);\n byte [] value = r.getValue(Bytes.toBytes(\"v\"),\n Bytes.toBytes(\"\"));\n\t\tString valueStr = Bytes.toString(value);\n\t\tout.println(valueStr);\n\t}\n\tcatch (Exception e)\n\t{\n\t\tout.println(e);\n\t}\n }", "private HttpResponse httpRequest(URL url, List<Header> headers, String method) throws IOException {\n\n BufferedReader streamReader;\n\n HttpURLConnection connection = setupConnection(url,headers,method);\n connection.setDoOutput(false);\n connection.connect();\n\n final int httpResponseCode = connection.getResponseCode();\n final List<Header> responseHeaders = Header.getHeaders(connection.getHeaderFields());\n\n try {\n streamReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n }\n catch (IOException e) {\n streamReader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));\n }\n\n StringBuilder sb = new StringBuilder();\n String currentLine;\n\n while((currentLine = streamReader.readLine()) != null) {\n sb.append(currentLine).append(\"\\n\");\n }\n\n connection.disconnect();\n\n try {\n Objects.requireNonNull(streamReader).close();\n }\n catch (IOException ignored){ }\n\n return new HttpResponse(responseHeaders,httpResponseCode,sb.toString().trim());\n }", "public static Response doGetRequest(String url, String token, String app_type) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException {\n try {\n Request request = new Request.Builder()\n .url(url).addHeader(\"cache-control\", \"no-cache\").\n addHeader(\"Authorization\", token).addHeader(\"app_type\", app_type).\n addHeader(\"access_token\", RestTags.PUBLIC_KEY)\n .build();\n Response response = client.newCall(request).execute();\n Log.e(\"RESPONSE:\", response.body() + \"Code:\" + response.code() + \"Message:\" + response.message());\n return response;\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n }", "public PersonName get() throws ClientException {\n return send(HttpMethod.GET, null);\n }", "public Response get(String path) throws IOException {\n return get(cluster, path);\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\r\n\t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\r\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tSystem.out.println(\"get\");\n\t\tthis.doPost(req, resp);\n\t}", "public String get(String path)\n {\n\n Client client = Client.create();\n\n WebResource webResource = client.resource(getHostAddress() + \":\" + getPort() + \"/api/\" + path);\n ClientResponse response = webResource.type(\"application/json\").get(ClientResponse.class);\n\n String message = response.getEntity(String.class);\n\n return message;\n }", "public void httpclient(String url){\n\t\t\r\n\t\t\r\n\t\tString httpUrl =BASIC_URL+url;\r\n\t\t\r\n\t\tSystem.out.println(httpUrl);\r\n\t\t\r\n\t\tHttpGet method =new HttpGet(httpUrl);\r\n\t\t\r\n\t\tmethod.setHeader(\"Content-Type\",\"application/json\");\r\n\t\tmethod.setHeader(\"charset\",\"UTF-8\");\r\n\t\t\r\n\t\ttry {\r\n\t\t\tCloseableHttpResponse res =client.execute(method,context);\r\n\r\n\t\t AuthState targetAuthState = context.getTargetAuthState();\r\n\t\t System.out.println(\"Target auth state: \" + targetAuthState.getState());\r\n\t\t System.out.println(\"Target auth scheme: \" + targetAuthState.getAuthScheme());\r\n\t\t System.out.println(\"Target auth credentials: \" + targetAuthState.getCredentials());\r\n\t\t\t\r\n\t\t HttpEntity ent =res.getEntity();\r\n\t\t \r\n\t\t if (ent != null) { \r\n System.out.println(\"Response content length: \" + ent.getContentLength()); \r\n System.out.println(ent+\"3214242423\");\r\n \r\n System.out.println(EntityUtils.toString(ent));\r\n } \r\n\t\t \r\n\t\t} catch (IOException e) {\r\n\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n }", "public static String executeGet(String targetURL) {\t\n\t\t HttpURLConnection connection = null; \n\t\t try {\n\t\t //Create connection\n\t\t URL url = new URL(targetURL);\n\t\t connection = (HttpURLConnection)url.openConnection();\n\t\t connection.setRequestMethod(\"GET\");\n\t\t connection.setRequestProperty(\"Content-Type\", \"application/json\");\n\t\t connection.setRequestProperty(\"Content-Language\", \"en-US\"); \n\n\t\t connection.setUseCaches(false);\n\t\t connection.setDoOutput(true);\n\n\n\t\t //Get Response \n\t\t InputStream is = connection.getInputStream();\n\t\t BufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\t\t StringBuilder response = new StringBuilder(); // or StringBuffer if not Java 5+ \n\t\t String line;\n\t\t while((line = rd.readLine()) != null) {\n\t\t response.append(line);\n\t\t response.append('\\r');\n\t\t }\n\t\t rd.close();\n\t\t return response.toString();\n\t\t } catch (Exception e) {\n\t\t return e.getMessage();\n\t\t } finally {\n\t\t if(connection != null) {\n\t\t connection.disconnect(); \n\t\t }\n\t\t }\n\t\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t\t\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response)\r\n\t\t\tthrows ServletException, IOException {}", "@Override\n public final void doGet() {\n try {\n checkPermissions(getRequest());\n // GET one\n if (id != null) {\n output(api.runGet(id, getParameterAsList(PARAMETER_DEPLOY), getParameterAsList(PARAMETER_COUNTER)));\n } else if (countParameters() == 0) {\n throw new APIMissingIdException(getRequestURL());\n }\n // Search\n else {\n\n final ItemSearchResult<?> result = api.runSearch(Integer.parseInt(getParameter(PARAMETER_PAGE, \"0\")),\n Integer.parseInt(getParameter(PARAMETER_LIMIT, \"10\")), getParameter(PARAMETER_SEARCH),\n getParameter(PARAMETER_ORDER), parseFilters(getParameterAsList(PARAMETER_FILTER)),\n getParameterAsList(PARAMETER_DEPLOY), getParameterAsList(PARAMETER_COUNTER));\n\n head(\"Content-Range\", result.getPage() + \"-\" + result.getLength() + \"/\" + result.getTotal());\n\n output(result.getResults());\n }\n } catch (final APIException e) {\n e.setApi(apiName);\n e.setResource(resourceName);\n throw e;\n }\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n metGet(request, response);\n }", "void getRequests();", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\t\n\t}", "public static HttpResponse<JsonNode> sendRequest(String path, Map params) {\n String apiUrl = ConfigReader.getPropValues().getProperty(\"transit.url\");\n String apiKey = ConfigReader.getPropValues().getProperty(\"transit.key\");\n String jsonExtension = \".json\";\n HttpResponse<JsonNode> response = null;\n\n try {\n String fullPath = apiUrl + path;\n response = Unirest.get(fullPath + jsonExtension)\n .queryString(params)\n .queryString(\"api-key\", apiKey).asJson();\n BotLogger.info(LOG, \"Sent request: \" + fullPath);\n BotLogger.info(LOG, \"Params: \" + params);\n } catch (UnirestException e) {\n e.printStackTrace();\n }\n return response;\n\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t}", "private HttpResponse httpRequest(URL url, List<Header> headers, String method, byte[] data) throws IOException {\n\n BufferedReader streamReader;\n\n HttpURLConnection connection = setupConnection(url,headers,method);\n connection.setDoOutput(true);\n connection.connect();\n\n OutputStream outputStream = connection.getOutputStream();\n outputStream.write(data);\n outputStream.flush();\n outputStream.close();\n\n final int httpResponseCode = connection.getResponseCode();\n final List<Header> responseHeaders = Header.getHeaders(connection.getHeaderFields());\n\n try {\n streamReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n }\n catch (IOException e) {\n streamReader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));\n }\n\n StringBuilder sb = new StringBuilder();\n String currentLine;\n\n while((currentLine = streamReader.readLine()) != null) {\n sb.append(currentLine).append(\"\\n\");\n }\n\n connection.disconnect();\n\n try {\n Objects.requireNonNull(streamReader).close();\n }\n catch (IOException ignored){ }\n\n return new HttpResponse(responseHeaders,httpResponseCode,sb.toString().trim());\n }", "@Override\n\tpublic void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "@Test\n void getTest() {\n URI uri = URI.create(endBody + \"/get\");\n\n // get the response\n HttpResponse<String> response = HttpMethods.get(uri);\n\n // check if it received OK\n assertEquals(200, response.statusCode());\n }", "protected XCapHttpResponse get(URI uri)\n throws XCapException\n {\n DefaultHttpClient httpClient = null;\n try\n {\n httpClient = createHttpClient();\n\n HttpGet getMethod = new HttpGet(uri);\n getMethod.setHeader(\"Connection\", \"close\");\n\n HttpResponse response = httpClient.execute(getMethod);\n XCapHttpResponse result = createResponse(response);\n if (logger.isDebugEnabled())\n {\n byte[] contentBytes = result.getContent();\n String contenString;\n // for debug purposes print only xmls\n // skip the icon queries\n if(contentBytes != null && result.getContentType() != null\n && !result.getContentType()\n .startsWith(PresContentClient.CONTENT_TYPE))\n contenString = new String(contentBytes);\n else\n contenString = \"\";\n\n String logMessage = String.format(\n \"Getting resource %1s from the server content:%2s\",\n uri.toString(),\n contenString\n );\n logger.debug(logMessage);\n }\n return result;\n }\n catch(UnknownHostException uhe)\n {\n showError(uhe, null, null);\n disconnect();\n throw new XCapException(uhe.getMessage(), uhe);\n }\n catch (IOException e)\n {\n String errorMessage =\n SipActivator.getResources().getI18NString(\n \"impl.protocol.sip.XCAP_ERROR_RESOURCE_ERR\",\n new String[]{uri.toString(),\n userAddress.getDisplayName()});\n showError(e, null, errorMessage);\n throw new XCapException(errorMessage, e);\n }\n finally\n {\n if(httpClient != null)\n httpClient.getConnectionManager().shutdown();\n }\n }", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t}", "@Override\n protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n // Empty list of to hold the people\n List<Person> people = null;\n\n // Make the call to the API (Deployed on AWS)\n Client client1 = ClientBuilder.newClient();\n WebTarget serviceWeb1 = client1.target(\"http://18.221.209.59:8080/kmf/api/person\");\n Response response1 = serviceWeb1.request().get();\n\n // Take the response and map it into people objects\n ObjectMapper objectMapper = new ObjectMapper();\n people = objectMapper.readValue(response1.readEntity(String.class), new TypeReference<List<Person>>() {});\n\n // Send the people to the webpage to be displayed\n HttpSession session = req.getSession();\n session.setAttribute(\"people\", people);\n RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(\"/persons.jsp\");\n dispatcher.forward(req, resp);\n }", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t}", "private String sendRequest(String requestUrl) throws Exception {\n\t\t \n\t\tURL url = new URL(requestUrl);\n\t\tHttpURLConnection connection = (HttpURLConnection) url.openConnection();\n\n\t\tconnection.setRequestMethod(\"GET\");\n\t\tconnection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0\");\n \n\t\tBufferedReader in = new BufferedReader(\n\t\t\t\t\tnew InputStreamReader(connection.getInputStream(), \"UTF-8\"));\n\t\t\n\t\tString responseCode = Integer.toString(connection.getResponseCode());\n\t\tif(responseCode.startsWith(\"2\")){\n\t\t\tString inputLine;\n\t\t\tStringBuffer response = new StringBuffer();\n \n\t\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\t\tresponse.append(inputLine);\n\t\t\t}\n\t\t\tin.close();\n\t\t\tconnection.disconnect();\n\t\t\treturn response.toString();\n \t} else {\n \t\tSystem.out.println(\"Unable to connect to \"+requestUrl+\n \t\t\". Please check whether the instance is up and also the security group settings\"); \n\t\t\tconnection.disconnect();\n \t\treturn null;\n\t \t} \n\t}", "public final CompletableFuture<GetResponse> get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn)\n\t\t\tthrows IOException {\n\t\treturn get(fn.apply(new GetRequest.Builder()).build());\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doGet(req, resp);\n\t}", "public static String executeHttpGet(String uri) throws Exception {\r\n\t\t\r\n\t\tHttpGet req = new HttpGet(uri);\r\n\t\tHttpClient client = new DefaultHttpClient();\r\n\t\tHttpResponse resLogin = client.execute(req);\r\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(resLogin\r\n\t\t\t\t.getEntity().getContent()));\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\tString s = null;\r\n\t\twhile ((s = r.readLine()) != null) {\r\n\t\t\tsb.append(s);\r\n\t\t}\r\n\t\t\r\n\t\treturn sb.toString();\r\n\t}", "public void sendGetRequest(String urlResource,RequestCallback callback){\t\t\r\n\t\trequestBuilder = new RequestBuilder(RequestBuilder.GET, dispatcherURL + urlResource);\r\n\t\trequestBuilder.setHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\r\n\t\ttry {\t\t\t\r\n\t\t\trequestBuilder.sendRequest(\"\", callback);\r\n\t\t} catch (RequestException e) {\r\n\t\t\tWindow.alert(e.getMessage());\r\n\t\t}\r\n\t}", "public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {\n //parsing request parameters in order to match operation to implement\n\n this.serverManager.execute(request, response);\n }", "@Test\n public void getEndpoint() throws IOException {\n CloseableHttpClient httpclient = HttpClients.createDefault();\n\n //Creating a HttpGet object\n HttpPost httppost = new HttpPost(\"https://api.github.com/user/repos\");\n String auth=Credentials.getEmail()+\":\"+Credentials.getPassWard();\n byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName(\"ISO-8859-1\")));\n String authHeader=\"Basic \"+new String(encodedAuth);\n httppost.setHeader(HttpHeaders.AUTHORIZATION,authHeader);\n String json=\"{\\\"name\\\": \\\"ploiko\\\"}\";\n httppost.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));\n HttpResponse httpresponse = httpclient.execute(httppost);\n System.out.println(httpresponse.getStatusLine());\n int actual=httpresponse.getStatusLine().getStatusCode();\n Assert.assertEquals(actual,201);\n //System.out.println(getHeaders(httpresponse,\"Access-Control-Allow-Methods\"));\n //System.out.println(httpresponse.getAllHeaders().toString());\n\n }", "@Test\n public void getRequest2() {\n str = METHOD_GET + \"/wiki/page.html \" + HTTP_VERSION + ENDL +\n HOST_HEADER + \": ru.wikipedia.org\" + ENDL +\n USER_AGENT + \": Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5\" + ENDL +\n ACCEPT + \": text/html\" + ENDL +\n CONNECTION_CLOSE;\n request = new HttpRequest(str, IP_ADDRESS, HOST);\n\n assertEquals(request.getMethod(), HttpMethod.GET);\n assertEquals(request.getUrn(), \"/wiki/page.html\");\n assertEquals(request.getHeader(HOST_HEADER), \"ru.wikipedia.org\");\n assertEquals(request.getHeader(USER_AGENT),\n \"Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5\");\n assertEquals(request.getHeader(ACCEPT), \"text/html\");\n assertEquals(request.getHeader(CONNECTION), CLOSE_STR);\n assertEquals(request.getHeader(NONEXISTENT_VAR), \"\");\n assertEquals(request.getParameter(NONEXISTENT_VAR), \"\");\n }", "protected void doGet(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\n String action = request.getParameter(\"action\");\r\n\r\n try {\r\n switch (action)\r\n {\r\n case \"/getUser\":\r\n \tgetUser(request, response);\r\n break;\r\n \r\n }\r\n } catch (Exception ex) {\r\n throw new ServletException(ex);\r\n }\r\n }" ]
[ "0.72099185", "0.6887084", "0.6577497", "0.6456418", "0.64498824", "0.64131236", "0.6404304", "0.6390762", "0.6385095", "0.6383808", "0.63729286", "0.6361075", "0.63253754", "0.6189557", "0.6171696", "0.61331344", "0.6086774", "0.60610867", "0.605252", "0.6019567", "0.6010914", "0.59858704", "0.5973391", "0.5903497", "0.5902158", "0.5898132", "0.58837813", "0.5878814", "0.58773595", "0.5858673", "0.585708", "0.5851317", "0.58411604", "0.5838438", "0.58375096", "0.58245623", "0.58195204", "0.58140266", "0.5811135", "0.58053404", "0.58031636", "0.5786981", "0.57861733", "0.5780614", "0.576829", "0.57612604", "0.5745685", "0.5740744", "0.5737174", "0.57261467", "0.5712216", "0.57097805", "0.5699164", "0.5698824", "0.56775004", "0.5664417", "0.5661598", "0.56591827", "0.56564724", "0.56497455", "0.56483555", "0.56451386", "0.5625633", "0.5623305", "0.5609429", "0.56089634", "0.56075895", "0.55904925", "0.55893826", "0.5586245", "0.5586245", "0.5580404", "0.5579415", "0.5572258", "0.5570358", "0.5569428", "0.5561329", "0.5555995", "0.5549359", "0.55479723", "0.5547953", "0.55454165", "0.55443764", "0.55319387", "0.55315036", "0.5529184", "0.5526185", "0.55261165", "0.55140907", "0.55066204", "0.5506216", "0.5497453", "0.5496383", "0.54960173", "0.54960173", "0.5491779", "0.5490284", "0.54894495", "0.5480888", "0.54798084", "0.547699" ]
0.0
-1
Creates new form AddItems
public AddItems() { initComponents(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void addToList(View view) {\n Items newItem = new Items();\n EditText ETNew = (EditText) findViewById(R.id.ETNew);\n newItem.todo = ETNew.getText().toString();\n newItem.done = false;\n helper.create(newItem);\n Toast.makeText(this, \"Item added\", Toast.LENGTH_SHORT).show();\n adaptList2();\n ETNew.setText(\"\");\n ETNew.setHint(\"my new to-do\");\n }", "@RequestMapping(method=RequestMethod.POST, value = \"/item/{id}\", produces = \"application/json\")\n public void addItem(@RequestBody Item itemToAdd)\n {\n this.itemRepository.addItem(itemToAdd);\n }", "public NewItems() {\n super();\n }", "@RequestMapping(value = \"/add\")\n\tpublic String addItem(Model model) {\n\t\tmodel.addAttribute(\"item\", new Item());\n\t\tmodel.addAttribute(\"shops\", srepository.findAll());\n\t\treturn \"additem\";\n\t}", "public AddItem() {\n initComponents();\n }", "public void onClickAdd(View v) {\n Intent intent = new Intent(this, ItemFormActivity.class);\n startActivity(intent);\n }", "public void createItem(View view) {\n \t\n String[] temp = getCurrentItemTypes();\n \n Intent intent = new Intent(this, CreateItem.class);\n intent.putExtra(EDIT, \"no\");\n intent.putExtra(TYPES, temp);\n startActivityForResult(intent, 1);\n }", "public AddItem() {\n initComponents();\n loadAllToTable();\n tblItems.getSelectionModel().addListSelectionListener(new ListSelectionListener() {\n @Override\n public void valueChanged(ListSelectionEvent e) {\n if (tblItems.getSelectedRow() == -1) return;\n \n String itemId= tblItems.getValueAt(tblItems.getSelectedRow(), 0).toString();\n \n String des= tblItems.getValueAt(tblItems.getSelectedRow(), 1).toString();\n String qty= tblItems.getValueAt(tblItems.getSelectedRow(), 2).toString();\n String unitPrice= tblItems.getValueAt(tblItems.getSelectedRow(), 3).toString();\n \n txtItemCode.setText(itemId);\n txtDescription.setText(des);\n \n txtQtyOnHand.setText(qty);\n txtUnitPrice.setText(unitPrice);\n \n }\n \n });\n \n \n }", "@RequestMapping(value = \"/add\", method = RequestMethod.POST)\n\t@ResponseBody\n\tString addItems(HttpServletRequest request, HttpServletResponse response) {\n\n\t\t// Get the Logged in User\n\t\tString name = getLoggedUser();\n\n\t\tString guide = request.getParameter(\"guide\");\n\t\tString description = request.getParameter(\"description\");\n\t\tString status = request.getParameter(\"status\");\n\t\tInjectWorkService iw = new InjectWorkService(env);\n\n\t\t// Create a Work Item object to pass to the injestNewSubmission method\n\t\tWorkItem myWork = new WorkItem();\n\t\tmyWork.setGuide(guide);\n\t\tmyWork.setDescription(description);\n\t\tmyWork.setStatus(status);\n\t\tmyWork.setName(name);\n\n\t\tiw.injestNewSubmission(myWork);\n\t\treturn \"Item added\";\n\t}", "@Override\n\t@RequestMapping(value=ZuelControllerValue.Manage+\"addItem\")\n\tpublic ZuelResult addItem(TbItem item) {\n\t\treturn service.addItem(item);\n\t}", "public void addItem() {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tSystem.out.print(\"Enter Item Name: \");\n\t\tString itemName = scanner.nextLine();\n\t\tSystem.out.print(\"Enter Item Description: \");\n\t\tString itemDescription = scanner.nextLine();\n\t\tSystem.out.print(\"Enter minimum bid price for item: $\");\n\t\tdouble basePrice = scanner.nextDouble();\n\t\tLocalDate createDate = LocalDate.now();\n\t\tItem item = new Item(itemName, itemDescription, basePrice, createDate);\n\t\taddItem(item);\n\t}", "public void createNewItem(ActionEvent actionEvent) {\n // we will create a new item instance here (ideally we would use another window for this)\n // and then we will simply addItem() to the currently selected list\n }", "public void doCreateItem() {\r\n\t\tlogger.info(\"Se procede a crear el book \" + newItem.getDescription());\r\n\t\tBook entity = newItem.getEntity();\r\n\t\tentity.setUser(Global.activeUser());\r\n\t\tentity.setBookBalance(BigDecimal.ZERO);\r\n\t\tentity.setTotalBudget(BigDecimal.ZERO);\r\n\t\tentity.setTotalIncome(BigDecimal.ZERO);\r\n\t\tentity.setTotalExpenses(BigDecimal.ZERO);\r\n\t\tentity = bookService.create(entity);\r\n\r\n\t\t// Actualizar el mapa de books\r\n\t\tGlobalBook.instance().put(new BookData(entity));\r\n\r\n\t\tlogger.info(\"Se ha creado el book \" + newItem.getDescription());\r\n\t\tnewItem = new BookData(new Book());\r\n\t\tFacesContext.getCurrentInstance().addMessage(null,\r\n\t\t\t\tnew FacesMessage(FacesMessage.SEVERITY_INFO, \"Libro creado\", \"Libro creado correctamente\"));\r\n\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\taddNewItem();\n\t\t\t}", "@PostMapping(\"/items\")\n public ResponseEntity<Items> createItems(@RequestBody Items items) throws URISyntaxException {\n log.debug(\"REST request to save Items : {}\", items);\n if (items.getId() != null) {\n throw new BadRequestAlertException(\"A new items cannot already have an ID\", ENTITY_NAME, \"idexists\");\n }\n Items result = itemsRepository.save(items);\n return ResponseEntity.created(new URI(\"/api/items/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "public void btnAddClicked(View view){\n List list = new List(input.getText().toString());\n dbHandler.addProduct(list);\n printDatabase();\n }", "public void addItem() {\r\n\t\tFacesContext fc = FacesContext.getCurrentInstance();\r\n\t\tif (itemInvoice.getQuantidade() <= itemPO.getQuantidadeSaldo()) {\r\n\t\t\tBigDecimal total = itemInvoice.getPrecoUnit().multiply(\r\n\t\t\t\t\tnew BigDecimal(itemInvoice.getQuantidade()));\r\n\t\t\titemInvoice.setTotal(total);\r\n\t\t\tif (!editarItem) {\r\n\r\n\t\t\t\tif (itemInvoice.getPrecoUnit() == null) {\r\n\t\t\t\t\titemInvoice.setPrecoUnit(new BigDecimal(0.0));\r\n\t\t\t\t}\r\n\t\t\t\tif (itemInvoice.getQuantidade() == null) {\r\n\t\t\t\t\titemInvoice.setQuantidade(0);\r\n\t\t\t\t}\r\n\t\t\t\titemInvoice.setInvoice(invoice);\r\n\r\n\t\t\t\tinvoice.getItensInvoice().add(itemInvoice);\r\n\r\n\t\t\t} else {\r\n\t\t\t\tinvoice.getItensInvoice().set(\r\n\t\t\t\t\t\tinvoice.getItensInvoice().indexOf(itemInvoice),\r\n\t\t\t\t\t\titemInvoice);\r\n\t\t\t}\r\n\t\t\tcarregarTotais();\r\n\t\t\tinicializarItemInvoice();\r\n\t\t\trequired = false;\r\n\t\t} else {\r\n\r\n\t\t\tMessages.adicionaMensagemDeInfo(TemplateMessageHelper.getMessage(\r\n\t\t\t\t\tMensagensSistema.INVOICE, \"lblQtdMaioSaldo\", fc\r\n\t\t\t\t\t\t\t.getViewRoot().getLocale()));\r\n\t\t}\r\n\t}", "public void addButtonClicked(View view) {\n\n Products product = new Products(johnsInput.getText().toString());\n\n dbHandler.addProduct(product);\n printDatabase();\n }", "private void addItems() {\n while (true) {\n ClothingItem item = readItem();\n if (item == null || item.getId() < 0) {\n break;\n }\n try {\n ctrl.addItem(item);\n } catch (ValidatorException e) {\n e.printStackTrace();\n }\n }\n }", "public void addItem(ToDoList item) {\n SQLiteDatabase db = this.getWritableDatabase();\n\n ContentValues values = new ContentValues();\n values.put(TITLE, item.getTitle());\n values.put(DETAILS, item.getDetails());\n\n db.insert(TABLE_NAME, null, values); //Insert query to store the record in the database\n db.close();\n\n }", "@attribute(value = \"\", required = false)\r\n\tpublic void addItem(Item i) {\r\n\t}", "public static void addNewItem(String itemName,Context context){\n\t\tItem item=new Item();\n\t\titem.updateName(itemName);\n\t\titem.updateCheckmark(false);\n\t\titem.updateArchived(false);\n\t\tItemListController.getItemListInstance().add(item);\n\t\ttodoList.add(itemName);\n\t\tItemListManager.saveListItem(context);\n\t}", "@Override\n\tpublic void addItems(Session session){\n\t\ttry{\n\t\t\tSystem.out.print(\"+++++++++++Add items here+++++++++++\\n\");\n\t\t\t//scanner class allows the admin to enter his/her input\n\t\t\tScanner scanner = new Scanner(System.in);\n\t\t\t//read input item id, name, price and quantity\n\t\t\tSystem.out.print(\"Enter Item Id: \");\n\t\t\tint itemId = scanner.nextInt();\n\n\t\t\tSystem.out.print(\"Enter Item Name without space: \");\n\t\t\tString itemName = scanner.next();\n\n\t\t\tSystem.out.print(\"Enter Item Type without space: \");\n\t\t\tString itemType = scanner.next();\n\n\t\t\tSystem.out.print(\"Enter Item Price: \");\n\t\t\tString itemPrice = scanner.next();\n\n\t\t\tSystem.out.print(\"Enter Item Quantity: \");\n\t\t\tint itemQuantity = scanner.nextInt();\n\t\t\t//pass these input items to client controller\n\t\t\tsamp=mvc.addItems(session,itemId,itemName,itemType,itemPrice,itemQuantity);\n\t\t\tSystem.out.println(samp);\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.out.println(\"Online Market App- Add Items Exception: \" +e.getMessage());\n\t\t}\n\t}", "@ApiOperation(value = \"Creates a new todo list item.\")\n @ApiResponses(value = {\n @ApiResponse(code = 200, message = \"The todo list item has been successfully created.\"),\n @ApiResponse(code = 400, message = \"The data describing the new todo list item is invalid.\"),\n @ApiResponse(code = 500, message = \"An internal error occured while processing the create item request.\")\n })\n @PostMapping(path = \"/items\", consumes = MediaType.APPLICATION_JSON_VALUE)\n public Future<Void> createItem(@ApiParam(value = \"NewItem\", required = true) @RequestBody @Valid final NewItemRepr newItemRepr) {\n final String itemId = IdentifierFactory.getInstance().generateIdentifier();\n final CreateItemCommand createItemCommand = new CreateItemCommand(itemId, newItemRepr.getDescription());\n return commandGateway.send(createItemCommand);\n }", "void addItem (Item toAdd){\n\t\t\tthis.items.add(toAdd);}", "public void addButtonClicked(){\n Products products = new Products(buckysInput.getText().toString());\n dbHandler.addProduct(products);\n printDatabase();\n }", "private void addNewListItem() {\n\n View view = LayoutInflater.from(CheckboxNoteActivity.this).inflate(R.layout.cell_item_edit, null);\n final CheckBox checkBox = view.findViewById(R.id.chk_edit_item);\n final EditText mEtListItem = view.findViewById(R.id.et_edit_item);\n final ImageView mIvAddItem = view.findViewById(R.id.iv_add_item);\n\n mEtListItem.addTextChangedListener(new TextWatcher() {\n @Override\n public void beforeTextChanged(CharSequence s, int start, int count, int after) {\n\n }\n\n @Override\n public void onTextChanged(CharSequence s, int start, int before, int count) {\n\n }\n\n @Override\n public void afterTextChanged(Editable s) {\n if (s.length() > 1) {\n mIvAddItem.setVisibility(View.VISIBLE);\n } else {\n mIvAddItem.setVisibility(View.INVISIBLE);\n }\n\n }\n });\n //Successfully insert an item\n mIvAddItem.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n mEtListItem.setEnabled(true);\n mRlAddItem.setEnabled(true);\n mIvAddItem.setVisibility(View.INVISIBLE);\n\n Items cbitem = new Items();\n cbitem.itemId = row;\n cbitem.itemName = mEtListItem.getText().toString();\n cbitem.isChecked = false;\n items.add(cbitem);\n\n Toast.makeText(CheckboxNoteActivity.this, \"Items Size = \" + items.size()\n + \"Retrieved Items = \" + retrievedItems.size(), Toast.LENGTH_SHORT).show();\n }\n });\n\n\n mLlDynamicLayout.addView(view);\n }", "ListItem createListItem();", "protected void addInventoryItemType() {\n\t\tProperties props = new Properties();\n\n\t\t/* DEBUG\n\t\t\n\t\tSystem.out.println(typeNameTF.getText());\n\t\tSystem.out.println(unitsTF.getText());\n\t\tSystem.out.println(unitMeasureTF.getText());\n\t\tSystem.out.println(validityDaysTF.getText());\n\t\tSystem.out.println(reorderPointTF.getText());\n\t\tSystem.out.println(notesTF.getText());\n\t\tSystem.out.println(statusCB.getValue());\n\t\n\t\t*/ \n\n\t\t// Set the values.\n\t\tprops.setProperty(\"ItemTypeName\", typeNameTF.getText());\n\t\tprops.setProperty(\"Units\", unitsTF.getText());\n\t\tprops.setProperty(\"UnitMeasure\", unitMeasureTF.getText());\n\t\tprops.setProperty(\"ValidityDays\", validityDaysTF.getText());\n\t\tprops.setProperty(\"ReorderPoint\", reorderPointTF.getText());\n\t\tprops.setProperty(\"Notes\", notesTF.getText());\n\t\tprops.setProperty(\"Status\", (String) statusCB.getValue());\n\n\t\t// Create the inventory item type.\n\t\tInventoryItemType iit = new InventoryItemType(props);\n\n\t\t// Save it into the database.\n\t\tiit.update();\n\n\t\tpopulateFields();\n\t\t\n\t\t// Display message on GUI.\n\t\t//submitBTN.setVisible(false);\n\t\tcancelBTN.setText(\"Back\");\n\t\tmessageLBL.setText(\"Inventory Item Type added.\");\n\t}", "protected abstract IModalView<BeanItem<M>> showAddForm(BeanItem<M> item);", "public void addItem(View v){\n //Creates a new IngredientModel, adds it to the List<IngredientModel>\n IngredientModel ingredientModel = new IngredientModel(ingredientEditText.getText().toString());\n ingredientModelList.add(ingredientModel);\n //Notifies the adapter the data set has changed in order to update the recyclerView\n ingredientSearchAdapter.notifyDataSetChanged();\n }", "public void add() {\n\t\tcart.add(item.createCopy());\n\t}", "private DefaultListModel<String> addItem(DefaultListModel<String> listModel) {\r\n\t\tString newItem = JOptionPane.showInputDialog(null, \"Name of new exercise:\");\r\n\t\tlistModel.addElement(newItem);\r\n\t\treturn listModel;\r\n\t}", "public void onClickAddNewItem(View v) {\n Intent intent = new Intent(EditFoodItemActivity.this, MainActivity.class);\n startActivity(intent);\n }", "void add(Item item);", "void createItem (String name, String description, double price);", "public AlertDialog openAdder() {\n // build the AlertDialog\n AlertDialog.Builder addBuilder = new AlertDialog.Builder(this);\n addBuilder.setTitle(\"Add item\");\n addBuilder.setMessage(\"Name of new item:\");\n\n // have editable text field to specify new item\n final EditText editText = new EditText(this);\n addBuilder.setView(editText);\n\n // add item when positive button is clicked\n addBuilder.setPositiveButton(\"Add\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n items.add(new Item(editText.getText().toString(), false));\n itemsAdapter.notifyDataSetChanged();\n }\n });\n\n // do nothing when negative button is clicked\n addBuilder.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n return;\n }\n });\n\n return addBuilder.create();\n }", "@PermissionStoreItemCreate\n @PostMapping(\"/create/new\")\n public String itemAddControllerPost(@ModelAttribute(\"item\") @Valid ItemCommand itemCommand,\n BindingResult bindingResult) {\n log.debug(\"Posting new item object\");\n if (bindingResult.hasErrors()) {\n bindingResult.getAllErrors().forEach(objectError -> log.error(objectError.toString()));\n log.debug(\"Binding error\");\n return \"item/itemform\";\n }\n Item save = itemService.save(commandToItem.convert(itemCommand));\n log.debug(\"New item object persisted to db \\n \" + save.toString());\n return \"redirect:/item/\" + save.getId() + \"/show\";\n }", "public void onAddButtonClick(View view) {\n\n if (view.getId() == R.id.Badd) {\n\n EditText a = (EditText) findViewById(R.id.TFenterName);\n\n String b = a.getText().toString();\n product.setProductName(b);\n\n a = (EditText) findViewById(R.id.TFenterPrice);\n b = a.getText().toString();\n product.setPrice(b);\n\n a = (EditText) findViewById(R.id.TFenterQuantity);\n b = a.getText().toString();\n product.setQuantity(b);\n\n a = (EditText) findViewById(R.id.TFLocation);\n b = a.getText().toString();\n product.setLocation(b);\n\n a = (EditText) findViewById(R.id.TFExpiration);\n b = a.getText().toString();\n product.setExpiration(b);\n\n helper.insertProduct(product);\n\n Intent i = new Intent(AddProduct.this, WasAdded.class);\n i.putExtra(\"product\", product.getProductName());\n startActivity(i);\n\n }\n }", "public @NotNull Item newItem();", "@Override\r\n\tpublic String InnerAddNewItem() throws ScheduleException\r\n\t{\n\t\tString item = form.ShowInputDialog(\"Nombre del nuevo item:\");\r\n\t\t\r\n\t\t// Si el usuario no cancelo el dialogo, agrego el item\r\n\t\tif(item != null)\r\n\t\t{\r\n\t\t\tschedule.addItem(item);\r\n\t\t}\r\n\t\t\r\n\t\treturn item;\r\n\t}", "public Element addFormItem(Element parent, int commandCount) {\r\n\t\tElement item = mDocument.createElement(\"IppItem\");\r\n\t\titem.setAttribute(\"CommandCount\", String.valueOf(commandCount));\r\n\t\tparent.appendChild(item);\r\n\r\n\t\treturn item;\r\n\t}", "@POST\n @Path(\"{id}\")\n @Produces(MediaType.APPLICATION_XML)\n @Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n public ShoppingList addItemToShoppingList(@PathParam(\"id\") Long id, @QueryParam(\"idItem\") Long idItem, @QueryParam(\"nameItem\") String nameItem, @QueryParam(\"quantityItem\") int quantityItem) throws WebApplicationException {\n boolean b = sls.addItemShoppingList(id, idItem, nameItem, quantityItem);\n if (b == true) {\n return sls.getShoppingList(id);\n } else {\n throw new WebApplicationException(Response.Status.BAD_REQUEST);\n\n }\n }", "public void createItemInInventory(Item newItem) {\n\t\tinventory.createItem(newItem);\n\t}", "@PostMapping(\"/addToDoItem\")\n\tpublic String addToDoItem(@ModelAttribute(\"toDoListForm\") ToDoList toDoListForm) {\n\n\t\tloggedUser = userService.findLoggedUser(); // Access the logged user.\n\n\t\ttoDoListForm.setUser(loggedUser);\n\n\t\ttoDoListForm.setLastUpdate(getDateTime());\n\n\t\ttoDoListService.save(toDoListForm); // Save a new to do list\n\n\t\treturn \"redirect:/welcome\";\n\t}", "@Override\r\n\tpublic void addItem(Items item) throws ToDoListDAOException{\r\n\t\t// TODO Auto-generated method stub\r\n\t\t Session session = factory.openSession();\r\n\t\t List<Items> allItems = new ArrayList<Items>();\r\n\t\t int flag=0;\r\n\t\t try\r\n\t\t {\r\n\t\t\t allItems = session.createQuery(\"from Items\").list();\r\n\t\t\t for (Items item1 : allItems) {\r\n\t\t\t\t\tif(item1.getUserName().equals(item.getUserName()) && item1.getItemName().equals(item.getItemName())){\r\n\t\t\t\t\t\tflag=1;\r\n\t\t\t\t\t\tJOptionPane.showMessageDialog(null, \"You need to choose other name for this task\", \"Error\", JOptionPane.INFORMATION_MESSAGE);\r\n\t\t\t\t break;\r\n\t\t\t\t\t}\t\r\n\t\t\t\t} \r\n\t\t\t if(flag==0)\r\n\t\t\t {\r\n\t\t\t\t session.beginTransaction();\r\n\t\t\t\t session.save(item);\r\n\t\t\t\t session.getTransaction().commit();\r\n\t\t\t }\r\n\t\t }\r\n\t\t catch (HibernateException e)\r\n\t\t {\r\n\t\t e.printStackTrace();\r\n\t\t if(session.getTransaction()!=null) session.getTransaction().rollback();\r\n\t\t }\r\n\t\t finally\r\n\t\t {\r\n\t\t\t if(session != null) \r\n\t\t\t\t{ \r\n\t\t\t\t\tsession.close(); \r\n\t\t\t\t} \r\n\t\t }\t\r\n\t}", "@PostMapping(\"\")\n public ResultEntity<String> addItem(@RequestBody NewItemRequest item, Principal principal) {\n return itemService.addItem(new Item(item, ConstantUtil.TYPE_SALE_RENT, principal.getName()));\n }", "private void addProduct() {\n\n final Dialog dialog = new Dialog(getActivity());\n\n\n //dialog content\n dialog.setContentView(R.layout.add_product_dialog);\n dialog.setTitle(getResources().getString(R.string.add_item));\n\n //Dialog views\n final EditText productName = (EditText)dialog.findViewById(R.id.product_name_dialog_edit_text);\n final EditText productQuantity = (EditText)dialog.findViewById(R.id.product_quantity_dialog_edit_text);\n Button addButton = (Button)dialog.findViewById(R.id.add_button_dialog);\n Button cancelButton = (Button)dialog.findViewById(R.id.cancel_button_dialog);\n final Spinner quantityType = (Spinner)dialog.findViewById(R.id.type_spinner);\n\n //Listeners\n addButton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n //check if product name has been setted\n if (productName.getText().toString().isEmpty()) {\n Toast.makeText(getActivity(), getResources().getString(R.string.need_product_name), Toast.LENGTH_SHORT).show();\n //add product\n } else if (productQuantity.getText().toString().isEmpty()) {\n // add with capitalized name\n productList.add(new Product(WordUtils.capitalize(productName.getText().toString())));\n //update user\n user.setShoppingLists(shoppingLists);\n dataController.saveUser(user);\n } else if (!productQuantity.getText().toString().isEmpty()) {\n productList.add(new Product(WordUtils.capitalize(productName.getText().toString()), Integer.parseInt(productQuantity.getText().toString()), quantityType.getSelectedItemPosition()));\n //update user\n user.setShoppingLists(shoppingLists);\n dataController.saveUser(user);\n }\n //update list\n adapter.notifyDataSetChanged();\n //close dialog\n dialog.dismiss();\n }\n });\n cancelButton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n dialog.dismiss();\n }\n });\n\n dialog.show();\n }", "public void addFileUploaderItem(FileUploaderItem item) {\n m_items.addView(item, new LinearLayout.LayoutParams(\n ViewGroup.LayoutParams.MATCH_PARENT,\n ViewGroup.LayoutParams.WRAP_CONTENT\n ));\n }", "@RequestMapping(value = \"/food/add\", method = RequestMethod.POST)\n\tpublic String add(HttpServletRequest request, Map<String, Object> model) throws JsonProcessingException {\n\t\tFood food = new Food(request.getParameter(\"name\"), request.getParameter(\"brand\"),\n\t\t\t\trequest.getParameter(\"quality\"), request.getParameter(\"type\"));\n\t\tList<Food> foods = foodService.findAll();\n\t\tfoodService.add(food);\n\n\t\tmodel.put(\"foods\", foods);\n\n\t\tmodel.put(\"types\", Food.TYPE.values());\n\t\tmodel.put(\"qualities\", Food.QUALITY.values());\n\t\tmodel.put(\"qualitycounts\", mapper.writeValueAsString(foodService.qualityCounts(foods)));\n\n\t\treturn \"index\";\n\t}", "void onAddClicked();", "private void addProduct()\n {\n System.out.println(\"|➕| Add new Product:\\n\");\n System.out.println(\"|➕| Enter ID\\n\");\n int id = Integer.parseInt(reader.getInput());\n System.out.println(\"|➕| Enter Name\\n\");\n String name = reader.getInput();\n manager.addProduct(id, name);\n }", "public void onAddAgendaItem() {\n AgendaItemDialog agendaItemDialog = AgendaItemDialog.getNewInstance();\n Optional<AgendaItem> result = agendaItemDialog.showAndWait();\n if (!result.isPresent()) {\n return;\n }\n\n if (controller.addAgendaItem(result.get())) {\n return;\n }\n\n AlertHelper.showError(LanguageKey.ERROR_AGENDAITEM_ADD, null);\n }", "public NewItemDlg(Bundle args) {\n this.setArguments(args);}", "public void dialogAddItem(final HashMap<String, String> selectItem) {\n\n\t\tfinal Dialog dialog = new Dialog(getActivity()/* ,R.style.Theme_Dialog */);\n\t\tdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tdialog.setContentView(R.layout.dialog_add_item);\n\n\t\tdialog.findViewById(R.id.savebtn).setOnClickListener(\n\t\t\t\tnew View.OnClickListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\n\t\t\t\t\t\t//changes bya avinash... if already getting excercise id then why we have to access it in excercise table\n/*\t\t\t\t\t\tlong rowid = ActivityModule.execiseinsertion(\n\t\t\t\t\t\t\t\tdatabaseObject, selectItem);\n\t\t\t\t\t\tActivityModule.execiseloginsertion(databaseObject,\n\t\t\t\t\t\t\t\tselectItem, rowid, selectItem.get(\"calories_burned\"));\n*/\n\t\t\t\t\t\tlong rowid = Long.parseLong(selectItem.get(BaseActivity.exercise_id));\n\t\t\t\t\t\tActivityModule.execiseloginsertion(databaseObject,\n\t\t\t\t\t\t\t\tselectItem, rowid, selectItem.get(BaseActivity.total_time_minutes));\n\t\t\t\t\t\tdialog.dismiss();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\tdialog.findViewById(R.id.cancelbtn).setOnClickListener(\n\t\t\t\tnew View.OnClickListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\tdialog.dismiss();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\tdialog.show();\n\t\tDisplayMetrics metrics = getResources().getDisplayMetrics();\n\t\tint width = metrics.widthPixels;\n\t\tint height = metrics.heightPixels;\n\t\tdialog.getWindow()\n\t\t\t\t.setLayout((6 * width) / 7, LayoutParams.WRAP_CONTENT);\n\n\t}", "public void onAddItem(View view) {\n EditText editText = (EditText) findViewById(R.id.editText);\n // get the contents and cast from an Object to a String\n String text = editText.getText().toString();\n mNameMatch = false;\n\n // add the text to our adapter if text isn't blank\n if (text.trim().length() > 0) {\n for (int i = 0; i < mCurrentList.size(); i++) {\n if (text.equals(mCurrentList.get(i).text)) {\n Toast toast = Toast.makeText(NewListActivity.this, \"That option was already inserted previously\", Toast.LENGTH_SHORT);\n toast.setGravity(Gravity.CENTER, 0, 0);\n toast.show();\n mNameMatch = true;\n }\n }\n if (mNameMatch == false) {\n ListItem item = new ListItem(text, mListID, false);\n mAdapter.add(item, mAdapter.getItemCount());\n mCurrentList = mAdapter.getCurrentListItems(mListID, \"\");\n }\n\n } else {\n editText.setError(\"Nothing added because no text was inserted\");\n }\n\n // clear EditText so user won’t add it twice\n editText.setText(\"\");\n }", "private void addNewCoursesOnClick(){\n dataSource.open();\n dataSource.createCourses(editTextCourses.getText().toString(),editTextTeacher.getText().toString(),editTextWhen.getText().toString(),editTextWhere.getText().toString(),editTextGrading.getText().toString(),editTextOther.getText().toString());\n dataSource.close();\n CoursesListElement courses = new CoursesListElement(editTextCourses.getText().toString(),editTextTeacher.getText().toString(),editTextWhen.getText().toString(),editTextWhere.getText().toString(),editTextGrading.getText().toString(),editTextOther.getText().toString(),0);\n listElements.add(courses);\n // setting list adapter\n listView.setAdapter(new ActionListAdapter(getActivity(),R.id.list_courses, listElements));\n newCourses.setVisibility(View.GONE);\n editTextCourses.setText(\"\");\n editTextTeacher.setText(\"\");\n editTextWhen.setText(\"\");\n editTextWhere.setText(\"\");\n editTextGrading.setText(\"\");\n editTextOther.setText(\"\");\n }", "private void newTodo() {\r\n String myTodoName = \"Unknown\";\r\n for (Component component : panelSelectFile.getComponents()) {\r\n if (component instanceof JTextField) {\r\n if (component.getName().equals(\"Name\")) {\r\n JTextField textFieldName = (JTextField) component;\r\n myTodoName = textFieldName.getText();\r\n }\r\n }\r\n }\r\n if (myTodoName == null || myTodoName.isEmpty()) {\r\n JOptionPane.showMessageDialog(null, \"New Todo List name not entered!\");\r\n return;\r\n }\r\n myTodo = new MyTodoList(myTodoName);\r\n int reply = JOptionPane.showConfirmDialog(null, \"Do you want to save this todoList?\",\r\n \"Save New Todolist\", JOptionPane.YES_NO_OPTION);\r\n if (reply == JOptionPane.YES_OPTION) {\r\n saveTodo();\r\n }\r\n fileName = null;\r\n todoListGui();\r\n }", "public void addNewAnimalAction() {\n\t\tAnimalModel newAnimalModel = new AnimalModel(\"\", \"\");\n\n\t\teditAnimalDetail(newAnimalModel, AnimalDetailPanel.NEW_ANIMAL);\n\t}", "private void addItemScreen() {\n \tIntent intent = new Intent(this, ItemEditor.class);\n \tstartActivity(intent);\n }", "public abstract void addItem(AbstractItemAPI item);", "private void addNewFoodItemRefresh() {\n // create a foodItem instance with input information\n FoodItem foodItem = new FoodItem(id.getText(), name.getText());\n foodItem.addNutrient(\"calories\", Double.valueOf(calories.getText()));\n foodItem.addNutrient(\"fat\", Double.valueOf(fat.getText()));\n foodItem.addNutrient(\"carbohydrate\", Double.valueOf(carbohydrate.getText()));\n foodItem.addNutrient(\"fiber\", Double.valueOf(fiber.getText()));\n foodItem.addNutrient(\"protein\", Double.valueOf(protein.getText()));\n this.foodData.addFoodItem(foodItem);// add it to the food data to store\n this.close();// close the addfooditem stage\n this.foodList.refreshAfterAdd(foodItem);// refresh the foodList\n\n }", "public void addItems(String name, String mobile){\n\n\t\tSQLiteDatabase db = this.getWritableDatabase();\n\n\t\tContentValues values = new ContentValues();\n\n\t\tvalues.put(KEY_NAME, name);\n\t\tvalues.put(KEY_PRICE, mobile);\n\n\t\tlong id = db.insert(TABLE_SHOP, null, values); // insert to 1st row\n\t\tdb.close(); // Closing database connection\n\n\t\tLog.d(TAG, \"New products inserted into sqlite: \" + id);\n\n\t}", "private boolean finalizeItemCreation() {\n String itemName = nameField.getText().toString();\n\n // Names must be unique, check to see if it exists\n if(database.checkItemInDB(itemName))\n return false;\n\n // Process Item contents\n item.set_ITEM_NAME(itemName);\n item.set_ITEM_DESC(descField.getText().toString());\n item.set_ITEM_ACCESS(datetime);\n item.set_ITEM_CREATED(datetime);\n item.set_ITEM_VIEW_CNT(0);\n\n boolean success = database.addNewItemToDB(item);\n return success;\n }", "protected void addButtonActionPerformed() {\n\t\tFoodTruckManagementSystem ftms = FoodTruckManagementSystem.getInstance();\n\t\t// Initialize controller\n\t\tMenuController mc = new MenuControllerAdapter();\n\t\t\n\t\t// Get selected supply type\n\t\tSupplyType supply = null;\n\t\ttry {\n\t\t\tsupply = ftms.getSupplyType(selectedSupply);\n\t\t} catch (NullPointerException | IndexOutOfBoundsException e) {\n\t\t}\n\t\t\n\t\t// Get given quantity\n\t\tdouble qty = -1;\n\t\ttry {\n\t\t\tqty = Double.parseDouble(qtyTextField.getText());\n\t\t} catch (NumberFormatException | NullPointerException e) {\n\t\t}\n\t\t\n\t\t// Add supply to item\n\t\ttry {\n\t\t\tmc.addIngredientToItem(item, supply, qty);\n\t\t} catch (InvalidInputException | DuplicateTypeException e) {\n\t\t\terror = e.getMessage();\n\t\t}\n\t\t\n\t\trefreshData();\n\t\t\n\t}", "@Override\r\n\t\tpublic boolean createItem() {\n\t\t\treturn false;\r\n\t\t}", "private void addItem() {\n\n ItemBean bean2 = new ItemBean();\n int drawableId2 = getResources().getIdentifier(\"ic_swrl\", \"drawable\", this.getPackageName());\n bean2.setAddress(drawableId2);\n bean2.setName(getResources().getString(R.string.swrl));\n itemList.add(bean2);\n\n ItemBean bean3 = new ItemBean();\n int drawableId3 = getResources().getIdentifier(\"ic_bianmin\", \"drawable\", this.getPackageName());\n bean3.setAddress(drawableId3);\n bean3.setName(getResources().getString(R.string.bianmin));\n itemList.add(bean3);\n\n ItemBean bean4 = new ItemBean();\n int drawableId4 = getResources().getIdentifier(\"ic_shenghuo\", \"drawable\", this.getPackageName());\n bean4.setAddress(drawableId4);\n bean4.setName(getResources().getString(R.string.shenghuo));\n itemList.add(bean4);\n\n ItemBean bean5 = new ItemBean();\n int drawableId5 = getResources().getIdentifier(\"ic_nxwd\", \"drawable\", this.getPackageName());\n bean5.setAddress(drawableId5);\n bean5.setName(getResources().getString(R.string.nxwd));\n// itemList.add(bean5);\n\n }", "public void addItem() {\n Url url = new Url();\n Venue item = new Venue(venuename.getText().toString(), address.getText().toString(), venueimage.getText().toString(), details.getText().toString());\n Call<Void> additem = url.createInstanceofRetrofit().addNewVenue(item);\n additem.enqueue(new Callback<Void>() {\n @Override\n public void onResponse(Call<Void> call, Response<Void> response) {\n Toast.makeText(VenueAdd.this, \"Venue Added Successfully\", Toast.LENGTH_SHORT).show();\n Intent intent=new Intent(VenueAdd.this, Dash.class);\n startActivity(intent);\n finish();\n }\n\n @Override\n public void onFailure(Call<Void> call, Throwable t) {\n Toast.makeText(VenueAdd.this, \"Error:\"+t, Toast.LENGTH_SHORT).show();\n }\n });\n\n }", "protected void add(HttpServletRequest request) throws ClassNotFoundException, SQLException{\n if(!request.getParameter(\"nome\").equals(\"\")){\n //Adiciona pessoa\n PessoaDAO dao = new PessoaDAO(); \n //String acao = request.getParameter(\"add\");\n int id = 0;\n for(Pessoa t:dao.findAll()){\n id =t.getId();\n }\n id++; \n Pessoa p = new Pessoa(new Integer((String)request.getParameter(\"id\")),request.getParameter(\"nome\"),request.getParameter(\"telefone\"),request.getParameter(\"email\"));\n dao.create(p);\n }\n }", "public void add() {\n preAdd();\n EntitySelect<T> entitySelect = getEntitySelect();\n entitySelect.setMultiSelect(true);\n getEntitySelect().open();\n }", "public void testInsertNewItems()\n\t{\n\t\t// Arrange\n\t\tList<ActivityBean> newItems = new ArrayList<ActivityBean>();\n\n\t\tEntryBean entry = new EntryBean(0, \"entry\", true);\n\t\tCategoryBean cat = new CategoryBean(0, \"category\", CategorySortOrder.Custom);\n\t\tActivityBean act = new ActivityBean(0, \"activity\");\n\n\t\tcat.addEntry(entry);\n\t\tact.addCategory(cat);\n\t\tnewItems.add(act);\n\n\t\t// Act\n\t\tservice.insertNewItems(newItems);\n\t\tActivitiesDataSource allActivities = service.getActivitiesWithChildren(null, true);\n\n\t\t// Assert\n\t\tActivityBean insertedBean = allActivities.getActivity(\"activity\");\n\t\tassertNotNull(insertedBean);\n\t\tassertFalse(insertedBean.getId() == 0);\n\t\tCategoryBean insertedCat = insertedBean.getCategory(\"category\");\n\t\tassertNotNull(insertedCat);\n\t\tassertFalse(insertedCat.getId() == 0);\n\t\tEntryBean insertedEntry = insertedCat.getEntries().get(0);\n\t\tassertNotNull(insertedEntry);\n\t\tassertFalse(insertedEntry.getId() == 0);\n\t\tassertTrue(insertedEntry.getIsSelected());\n\n\t}", "public int addItem(Item i);", "public void addItem(Item item) {\n items.add(item);\n }", "public void addItem(Item item) {\n items.add(item);\n }", "@RequestMapping(value = {\"/add_product\"}, method = RequestMethod.POST)\n public String createProduct(Model model, HttpServletRequest request) {\n boolean isSuccess = addProductByRest(request);\n if (isSuccess) {\n ProductController controller = new ProductController();\n List<Product> productList = controller.getProductList(request, \"products\");\n model.addAttribute(\"products\", productList);\n return \"product_list\";\n } else {\n return \"product_detail_new\";\n }\n }", "static public ApplicationFormItem createNew(int id, String shortname, boolean required, ApplicationFormItemType type,\n\t\t\t\t\t\t\t\t\t\t\t\tString federationAttribute, String perunSourceAttribute, String perunDestinationAttribute, String regex,\n\t\t\t\t\t\t\t\t\t\t\t\tList<Application.ApplicationType> applicationTypes, Integer ordnum, boolean forDelete)\t{\n\t\tApplicationFormItem afi = new JSONObject().getJavaScriptObject().cast();\n\t\tafi.setId(id);\n\t\tafi.setShortname(shortname);\n\t\tafi.setRequired(required);\n\t\tafi.setType(type);\n\t\tafi.setFederationAttribute(federationAttribute);\n\t\tafi.setPerunSourceAttribute(perunSourceAttribute);\n\t\tafi.setPerunDestinationAttribute(perunDestinationAttribute);\n\t\tafi.setRegex(regex);\n\t\tafi.setApplicationTypes(applicationTypes);\n\t\tafi.setOrdnum(ordnum);\n\t\tafi.setForDelete(forDelete);\n\t\treturn afi;}", "public void insertItem(Item item) {\n SQLiteDatabase db = DataBaseManager.getInstance().openDatabase();\n ContentValues values = new ContentValues();\n values.put(KEY_NAME, item.getName());\n values.put(KEY_ARRAY_ID, item.getArrayId());\n values.put(KEY_DESCRIPTION, item.getDescription());\n\n // Inserting Row\n db.insert(TABLE_ITEMS, null, values);\n DataBaseManager.getInstance().closeDatabase();\n }", "public void createNewList(ActionEvent actionEvent) {\n // ideally again, this would have its own window\n // give it a title, and optionally populate it with some items\n }", "CatalogItem addCatalogItem(CatalogItem catalogItem);", "public void addItem(Item e) {\n\t\tItem o = new Item(e);\n\t\titems.add(o);\n\t}", "private void submitItem()\n {\n \n if(verifyData())\n {\n if(isItemExist(jTextFieldNumber.getText()))\n {\n String itemName = jTextFieldName.getText();\n String itemNumber = jTextFieldNumber.getText();\n String itemClass = jComboBox1.getSelectedItem().toString();\n String itemDesc = jTextArea1.getText();\n\n //this is for getting the items that are entered by the keyboard\n try {\n jSpinnerprice.commitEdit();\n\n jSpinnerQuantity.commitEdit();\n } catch (ParseException ex) {\n Logger.getLogger(AddItem.class.getName()).log(Level.SEVERE, null, ex);\n }\n \n \n int itemPrice = (Integer)jSpinnerprice.getValue();\n int itemQuantity = (Integer)jSpinnerQuantity.getValue();\n String itemModel = jTextFieldModel.getText();\n \n byte [] img = null;\n \n\n try {\n Path pth = Paths.get(imagePth);\n img = Files.readAllBytes(pth);\n } catch (FileNotFoundException ex) {\n Logger.getLogger(AddItem.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(AddItem.class.getName()).log(Level.SEVERE, null, ex);\n }\n \n String itemSupplier = jTextFieldSupplier.getText();\n\n \n Items i = new Items(itemModel, itemName, itemNumber, itemClass, img, itemDesc, itemQuantity, itemPrice, adminName, itemSupplier);\n\n ItemQuery Iq = new ItemQuery();\n Iq.insertItem(i);\n \n //Refresh the jtable\n refreshJTable(); \n \n jTextFieldName.setText(\"\");\n jTextFieldNumber.setText(\"\");\n jTextFieldSupplier.setText(\"\");\n jTextArea1.setText(\"\");\n jTextFieldModel.setText(\"\");\n \n \n }\n }\n }", "@Override\n public void onClick(DialogInterface dialog, int which) {\n EditText txtAddItem = (EditText)addItemView.findViewById(R.id.etNewItem);\n String item = txtAddItem.getText().toString();\n Log.println(Log.DEBUG, TAG, \"Added \" + item);\n\n // TextView txtItems = (TextView)findViewById(R.id.Groceries);\n // txtItems.append(\"\\n\\n\" + item);\n\n items.add(new Item(item));\n\n arrayAdapter = new ArrayAdapter<Item>(context, android.R.layout.simple_list_item_multiple_choice, items);\n lvItems.setAdapter(arrayAdapter);\n\n for (int i = 0; i < items.size(); i++)\n {\n lvItems.setItemChecked(i, items.get(i).isChecked);\n }\n\n\n }", "private void addRoomItems(int itemsToAdd)\n {\n\n // Adds up to 3 random items to a random room .\n if (!(itemsToAdd == 0)){\n\n for(int j = 0; j < itemsToAdd; j++){\n Item chooseItem = chooseValidItem(); \n Room chooseRoom = rooms.get(random.nextInt(rooms.size()));\n\n chooseRoom.getInventory().getItems().add(chooseItem);\n System.out.println(chooseRoom.getName()+\": \"+chooseItem.getName());\n\n }\n }\n }", "private void addInventoryInformation() {\r\n \tString[] toolTypeFieldItems = {\"Electrical\", \"Non-Electrical\"};\r\n \t\r\n \taddButton = new JButton (\"Add\");\r\n deleteButton = new JButton (\"Delete\");\r\n clearButton = new JButton (\"Clear\");\r\n decreaseButton = new JButton (\"Buy\");\r\n toolIdText = new JTextField (5);\r\n toolNameText = new JTextField (5);\r\n stockText = new JTextField (5);\r\n priceText = new JTextField (5);\r\n supplierText = new JTextField (5);\r\n toolTypeField = new JComboBox<String> (toolTypeFieldItems); \r\n powerText = new JTextField (5);\r\n\r\n add (addButton);\r\n add (deleteButton);\r\n add (clearButton);\r\n add (decreaseButton);\r\n add (toolIdText);\r\n add (toolNameText);\r\n add (stockText);\r\n add (priceText);\r\n add (supplierText);\r\n add (toolTypeField);\r\n add (powerText);\r\n \r\n addButton.setBounds (585, 590, 100, 25);\r\n deleteButton.setBounds (715, 590, 100, 25);\r\n clearButton.setBounds (650, 630, 100, 25);\r\n decreaseButton.setBounds (650, 670, 100, 25);\r\n toolIdText.setBounds (690, 290, 100, 25);\r\n toolNameText.setBounds (690, 330, 100, 25);\r\n stockText.setBounds (690, 410, 100, 25);\r\n priceText.setBounds (690, 450, 100, 25);\r\n supplierText.setBounds (690, 490, 100, 25);\r\n toolTypeField.setBounds (690, 370, 100, 25);\r\n powerText.setBounds (690, 530, 100, 25);\r\n }", "public void addItem(Object item) {\r\n\t\tlistModel.addElement(item);\r\n\t}", "public void registry(TodoItemForm todoItemForm) throws RecordNotFoundException {\n TodoItem todoItem = new TodoItem();\n if (todoItemForm.getId() != null) {\n todoItem = getTodoItemById(todoItemForm.getId());\n }\n todoItem.setItemName(todoItemForm.getItemName());\n todoItem.setDescription(todoItemForm.getDescription());\n todoItem.setTargetDate(Util.strToDt(todoItemForm.getTargetDate()));\n\n todoItemRepository.save(todoItem);\n }", "@Test\n\tpublic void testAddItem() throws IOException{\n\t\tModel.addItem(item, amount + \"\");\n\t\tassertEquals(amount + \"\", Model.hash.get(item));\n\t\t\n\t}", "private void insertItem() {\n System.out.println(\"What is the priority level of the task: \\n\\tH -> high \\n\\tM -> medium \\n\\tL -> low\");\n char priorityLevel = scanner.next().toUpperCase().charAt(0);\n\n priorityLevel = checkPriorityLevel(priorityLevel);\n Categories category;\n if (priorityLevel == 'H') {\n category = Categories.HIGHPRIORITY;\n } else if (priorityLevel == 'M') {\n category = Categories.MIDPRIORITY;\n } else {\n category = Categories.LOWPRIORITY;\n }\n\n System.out.println(\"Enter the name of the task:\");\n scanner.nextLine();\n String name = scanner.nextLine();\n\n String daysBeforeDue = acceptDaysBeforeDue();\n\n Item item = new Item(name, daysBeforeDue, category);\n toDoList.insert(item);\n System.out.println(\"Added successfully!\");\n\n System.out.println(\"Updated to-do list:\");\n viewList();\n }", "@Override\n public void onClick(View v) {\n CustomAddItemDialog customAddItemDialog = new CustomAddItemDialog(MainActivity.this);\n customAddItemDialog.show();\n }", "public AddList() {\n setTitleText(\"Add new List\");\n addButton = new JButton(\"Add\");\n addButton.addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent actionEvent) {\n addButtonActionPerformed(actionEvent);\n }\n });\n addButton(addButton);\n }", "public void addTodoItem(TodoItem item) {\n todoItems.add(item);\n }", "private void addDeviceItem() throws SQLException {\r\n\t\t// TODO Auto-generated method stub\r\n\t\ttry{\r\n\t\t\tnameDevice = edtNameDevice.getText().toString().trim();\r\n\t\t\tportDevice = Integer.parseInt(edtPortDevice.getText().toString().trim());\r\n\t\t\troomID = getIntent().getExtras().getInt(\"room_id\");\r\n\t\t\t\r\n\t\t\tDeviceItem item = new DeviceItem(roomID, nameDevice, typeDevice, portDevice, statusDevice);\r\n\t\t\tDeviceItemController.getInstance(AddDeviceItemActivity.this).createDeviceItem(item);\r\n\t\t}catch(Exception ex){\r\n\t\t\tex.printStackTrace();\r\n\t\t\tToast.makeText(AddDeviceItemActivity.this, \"Add device item error. Please verify your device infomations!\", Toast.LENGTH_SHORT).show();\r\n\t\t}\r\n\t}", "public BookItemMenu addItems ( Item... items ) {\n\t\tfinal int count = addItemsNotFull ( items );\n\t\tif ( ( items.length - count ) > 0 ) { // if there is no added items\n\t\t\tint pages_amount = getPagesAmount ( ( items.length - count ) , getPagesSize ( ) , getButtonsBarSize ( ) );\n\t\t\tthis.pages = Arrays.copyOfRange ( this.pages , 0 , this.pages.length + pages_amount );\n\t\t\tfor ( int i = 0; i < pages.length; i++ ) {\n\t\t\t\tif ( pages[ i ] == null ) {\n\t\t\t\t\tpages[ i ] = new BookPageItemMenu ( this );\n\t\t\t\t\tpages[ i ].setPageNumber ( i );\n\t\t\t\t\t\n\t\t\t\t\t// here we're registering listener of the new page.\n\t\t\t\t\tif ( getHandler ( ) != null ) {\n\t\t\t\t\t\tpages[ i ].registerListener ( getHandler ( ).getPlugin ( ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\taddItemsNotFull ( Arrays.copyOfRange ( items , count , items.length ) );\n\t\t}\n\t\treturn this;\n\t}", "public static void addOrderedItem() {\n\t\tSystem.out.print(\"\\t\\t\");\n\t\tSystem.out.println(\"************Adding ordered item************\");\n\t\tOrderManager orderManager = new OrderManager();\n\t\tList listOfOrders = orderManager.viewOrder();\n\n\t\tOrderedItemManager orderedItemManager = new OrderedItemManager();\n\t\tList listOfOrderedItems = null;\n\n\t\tItemManager itemManager = new ItemManager();\n\t\tList listOfItems = itemManager.onStartUp();\n\n\t\tint i = 0;\n\t\tint choice = 0;\n\t\tOrder order = null;\n\t\tItem item = null;\n\t\tOrderedItem orderedItem = null;\n\t\tboolean check = false;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tif (listOfOrders.size() == 0) {\n\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\tSystem.out.println(\"There is no orders!\");\n\t\t\treturn;\n\t\t}\n\n\t\tif (listOfItems.size() == 0) {\n\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\tSystem.out.println(\"There is no items!\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tSystem.out.println();\n\t\t\t// print the list of orders for the user to select from.\n\t\t\tfor (i = 0; i < listOfOrders.size(); i++) {\n\t\t\t\torder = (Order) listOfOrders.get(i);\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\tSystem.out.println((i + 1) + \") Order: \" + order.getId()\n\t\t\t\t\t\t+ \" | Table: \" + order.getTable().getId());\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\tSystem.out.print(\"Select an order to add the item ordered: \");\n\t\t\tchoice = Integer.parseInt(sc.nextLine());\n\n\t\t\torder = (Order) listOfOrders.get(choice - 1);\n\n\t\t\tdo {\n\t\t\t\tfor (i = 0; i < listOfItems.size(); i++) {\n\t\t\t\t\titem = (Item) listOfItems.get(i);\n\t\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\t\tSystem.out.println((i + 1) + \") ID: \" + item.getId()\n\t\t\t\t\t\t\t+ \" | Name: \" + item.getName() + \" | Price: $\"\n\t\t\t\t\t\t\t+ item.getPrice());\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\t\tSystem.out.println((i + 1) + \") Done\");\n\t\t\t\tSystem.out.println();\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\tSystem.out.print(\"Select an item to add into order: \");\n\t\t\t\tchoice = Integer.parseInt(sc.nextLine());\n\n\t\t\t\tif (choice != (i + 1)) {\n\t\t\t\t\titem = (Item) listOfItems.get(choice - 1);\n\n\t\t\t\t\torderedItem = new OrderedItem();\n\t\t\t\t\torderedItem.setItem(item);\n\t\t\t\t\torderedItem.setOrder(order);\n\t\t\t\t\torderedItem.setPrice(item.getPrice());\n\n\t\t\t\t\torder.addOrderedItem(orderedItem);\n\n\t\t\t\t\tcheck = orderedItemManager.createOrderedItem(orderedItem);\n\n\t\t\t\t\tif (check) {\n\t\t\t\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\t\t\t\tSystem.out.format(\"%-25s:\", \"TASK UPDATE\");\n\t\t\t\t\t\tSystem.out\n\t\t\t\t\t\t\t\t.println(\"Item added into order successfully!\");\n\t\t\t\t\t}\n\n\t\t\t\t\telse {\n\t\t\t\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\t\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\t\t\t\tSystem.out.println(\"Failed to add item into order!\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} while (choice != (i + 1));\n\n\t\t}\n\n\t\tcatch (Exception e) {\n\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\tSystem.out.println(\"Invalid Input!\");\n\t\t}\n\t\tSystem.out.print(\"\\t\\t\");\n\t\tSystem.out.println(\"************End of adding items************\");\n\t}", "@PostMapping(\"/add-item\")\n ItemEntity addItem(@RequestParam String itemName, Float itemPrice, Long userId, Long storeId) {\n return ownerService.addItem(userId, storeId, itemName, itemPrice);\n }", "public void addItem(Item newItem){\n // check for duplicate item ID\n for (Item item: items) {\n if (item.getItemID() == newItem.getItemID()) {\n item.setQuantity(item.getQuantity() + 1);\n return;\n }\n }\n newItem.setQuantity(1);\n this.items.add(newItem);\n }", "public void addItem(Item i) {\n this.items.add(i);\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n jLabel1 = new javax.swing.JLabel();\n titlelabel = new javax.swing.JLabel();\n TitleTextField = new javax.swing.JTextField();\n authLabel = new javax.swing.JLabel();\n publabel = new javax.swing.JLabel();\n subLabel = new javax.swing.JLabel();\n CopiesLabel = new javax.swing.JLabel();\n AuthorTextField = new javax.swing.JTextField();\n PublisherTextField = new javax.swing.JTextField();\n SubTextField = new javax.swing.JTextField();\n CopiesTextField = new javax.swing.JTextField();\n ItemSelectionbox = new javax.swing.JComboBox<>();\n jButton2 = new javax.swing.JButton();\n jLabel6 = new javax.swing.JLabel();\n MessageLabel = new javax.swing.JLabel();\n jButton1 = new javax.swing.JButton();\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n\n jLabel1.setFont(new java.awt.Font(\"Tahoma\", 1, 24)); // NOI18N\n jLabel1.setText(\"Add Item\");\n\n titlelabel.setFont(new java.awt.Font(\"Tahoma\", 0, 18)); // NOI18N\n titlelabel.setText(\"Title\");\n\n TitleTextField.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n TitleTextFieldActionPerformed(evt);\n }\n });\n\n authLabel.setFont(new java.awt.Font(\"Tahoma\", 0, 18)); // NOI18N\n authLabel.setText(\"Author\");\n\n publabel.setFont(new java.awt.Font(\"Tahoma\", 0, 18)); // NOI18N\n publabel.setText(\"Publisher\");\n\n subLabel.setFont(new java.awt.Font(\"Tahoma\", 0, 18)); // NOI18N\n subLabel.setText(\"Subject\");\n\n CopiesLabel.setFont(new java.awt.Font(\"Tahoma\", 0, 18)); // NOI18N\n CopiesLabel.setText(\"Copies\");\n\n ItemSelectionbox.setMaximumRowCount(2);\n ItemSelectionbox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { \"BOOK\", \"DVD\" }));\n ItemSelectionbox.addItemListener(new java.awt.event.ItemListener() {\n public void itemStateChanged(java.awt.event.ItemEvent evt) {\n ItemSelectionboxItemStateChanged(evt);\n }\n });\n\n jButton2.setText(\"ADD\");\n jButton2.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jButton2ActionPerformed(evt);\n }\n });\n\n jLabel6.setFont(new java.awt.Font(\"Tahoma\", 0, 18)); // NOI18N\n jLabel6.setText(\"Select Item\");\n\n jButton1.setText(\"Back\");\n jButton1.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jButton1ActionPerformed(evt);\n }\n });\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());\n getContentPane().setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGroup(layout.createSequentialGroup()\n .addContainerGap()\n .addComponent(jLabel1))\n .addGroup(layout.createSequentialGroup()\n .addGap(47, 47, 47)\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addComponent(subLabel)\n .addComponent(CopiesLabel)\n .addComponent(authLabel)\n .addComponent(titlelabel)\n .addComponent(jLabel6)\n .addComponent(publabel))\n .addGap(18, 18, 18)\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)\n .addComponent(AuthorTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)\n .addComponent(SubTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)\n .addComponent(PublisherTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)\n .addComponent(TitleTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)\n .addComponent(ItemSelectionbox, 0, 150, Short.MAX_VALUE)\n .addComponent(CopiesTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)\n .addComponent(MessageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))\n .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addComponent(jButton1)\n .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))\n .addGap(26, 26, 26))\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGroup(layout.createSequentialGroup()\n .addContainerGap()\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)\n .addComponent(jLabel1)\n .addComponent(jButton1))\n .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)\n .addComponent(ItemSelectionbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addComponent(jLabel6))\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGroup(layout.createSequentialGroup()\n .addGap(18, 18, 18)\n .addComponent(titlelabel)\n .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)\n .addComponent(authLabel))\n .addGroup(layout.createSequentialGroup()\n .addGap(17, 17, 17)\n .addComponent(TitleTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addGap(18, 18, 18)\n .addComponent(AuthorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)\n .addComponent(PublisherTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addComponent(publabel))))\n .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)\n .addComponent(subLabel)\n .addComponent(SubTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))\n .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)\n .addComponent(CopiesLabel)\n .addComponent(CopiesTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))\n .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)\n .addComponent(MessageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addGap(9, 9, 9)\n .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addContainerGap())\n );\n\n pack();\n }", "public void addItem(Item toAdd) {\n\t\tthis.items.add(toAdd);\n\t}", "public Item createNew(int count) {\r\n Item i = new Item(name, id);\r\n i.setPickedUp(true);\r\n i.setCount(count);\r\n return i;\r\n }" ]
[ "0.7134488", "0.69429517", "0.69410306", "0.6910472", "0.68333596", "0.68022597", "0.6780334", "0.6766328", "0.6697094", "0.66698146", "0.66531205", "0.65933484", "0.65704376", "0.65308315", "0.6475625", "0.64546", "0.6425732", "0.64250124", "0.6422926", "0.64015007", "0.6389861", "0.6386623", "0.6385599", "0.6364275", "0.63584036", "0.6350453", "0.6338323", "0.6337688", "0.6328172", "0.63278574", "0.6319247", "0.6291814", "0.6269719", "0.6259927", "0.6251857", "0.62001884", "0.61429155", "0.61332136", "0.6124824", "0.6107241", "0.6091085", "0.60575163", "0.6020635", "0.60201573", "0.6015574", "0.60147", "0.60135806", "0.6008513", "0.60058635", "0.5984453", "0.5983449", "0.5958339", "0.59481907", "0.59356505", "0.5934487", "0.5909409", "0.59061384", "0.5890739", "0.58864987", "0.58811647", "0.5877999", "0.587105", "0.5869395", "0.5852186", "0.58495146", "0.5833951", "0.5828559", "0.58285046", "0.582748", "0.5824867", "0.58216935", "0.58199865", "0.58134335", "0.58134335", "0.58107746", "0.5799311", "0.579589", "0.57861245", "0.57816845", "0.57745713", "0.57743084", "0.5771169", "0.5766931", "0.57631624", "0.57619655", "0.5758233", "0.575655", "0.5748552", "0.57414424", "0.5737451", "0.5733762", "0.57276875", "0.5716999", "0.57136315", "0.57126725", "0.5705628", "0.5704967", "0.5704481", "0.57036275", "0.56967556" ]
0.6941532
2
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); num1 = new javax.swing.JButton(); num2 = new javax.swing.JButton(); num3 = new javax.swing.JButton(); num4 = new javax.swing.JButton(); num5 = new javax.swing.JButton(); num6 = new javax.swing.JButton(); num7 = new javax.swing.JButton(); txtQ = new javax.swing.JTextField(); add = new javax.swing.JButton(); num8 = new javax.swing.JButton(); num9 = new javax.swing.JButton(); num0 = new javax.swing.JButton(); exit = new javax.swing.JButton(); clear = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); num1.setText("1"); num1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num1ActionPerformed(evt); } }); num2.setText("2"); num2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num2ActionPerformed(evt); } }); num3.setText("3"); num3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num3ActionPerformed(evt); } }); num4.setText("4"); num4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num4ActionPerformed(evt); } }); num5.setText("5"); num5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num5ActionPerformed(evt); } }); num6.setText("6"); num6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num6ActionPerformed(evt); } }); num7.setText("7"); num7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num7ActionPerformed(evt); } }); txtQ.setText("0"); add.setText("Add"); add.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addActionPerformed(evt); } }); num8.setText("8"); num8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num8ActionPerformed(evt); } }); num9.setText("9"); num9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num9ActionPerformed(evt); } }); num0.setText("0"); num0.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { num0ActionPerformed(evt); } }); exit.setText("Exit"); exit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitActionPerformed(evt); } }); clear.setText("Clear"); clear.setToolTipText(""); clear.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(num0) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(add, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(num7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(num8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(num9))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txtQ, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(num4) .addGap(6, 6, 6) .addComponent(num5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(num6)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(num1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(num2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(num3)))))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(clear) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(exit))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(txtQ, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(num2) .addComponent(num3) .addComponent(num1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(num6) .addComponent(num5) .addComponent(num4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(num7) .addComponent(num8) .addComponent(num9)) .addGap(9, 9, 9) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(num0) .addComponent(add)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(exit) .addComponent(clear)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 27, Short.MAX_VALUE)) ); pack(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Form() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public frmRectangulo() {\n initComponents();\n }", "public form() {\n initComponents();\n }", "public AdjointForm() {\n initComponents();\n setDefaultCloseOperation(HIDE_ON_CLOSE);\n }", "public FormListRemarking() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n \n }", "public FormPemilihan() {\n initComponents();\n }", "public GUIForm() { \n initComponents();\n }", "public FrameForm() {\n initComponents();\n }", "public TorneoForm() {\n initComponents();\n }", "public FormCompra() {\n initComponents();\n }", "public muveletek() {\n initComponents();\n }", "public Interfax_D() {\n initComponents();\n }", "public quanlixe_form() {\n initComponents();\n }", "public SettingsForm() {\n initComponents();\n }", "public RegistrationForm() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public Soru1() {\n initComponents();\n }", "public FMainForm() {\n initComponents();\n this.setResizable(false);\n setLocationRelativeTo(null);\n }", "public soal2GUI() {\n initComponents();\n }", "public EindopdrachtGUI() {\n initComponents();\n }", "public MechanicForm() {\n initComponents();\n }", "public AddDocumentLineForm(java.awt.Frame parent) {\n super(parent);\n initComponents();\n myInit();\n }", "public BloodDonationGUI() {\n initComponents();\n }", "public quotaGUI() {\n initComponents();\n }", "public Customer_Form() {\n initComponents();\n setSize(890,740);\n \n \n }", "public PatientUI() {\n initComponents();\n }", "public myForm() {\n\t\t\tinitComponents();\n\t\t}", "public Oddeven() {\n initComponents();\n }", "public intrebarea() {\n initComponents();\n }", "public Magasin() {\n initComponents();\n }", "public RadioUI()\n {\n initComponents();\n }", "public NewCustomerGUI() {\n initComponents();\n }", "public ZobrazUdalost() {\n initComponents();\n }", "public FormUtama() {\n initComponents();\n }", "public p0() {\n initComponents();\n }", "public INFORMACION() {\n initComponents();\n this.setLocationRelativeTo(null); \n }", "public ProgramForm() {\n setLookAndFeel();\n initComponents();\n }", "public AmountReleasedCommentsForm() {\r\n initComponents();\r\n }", "public form2() {\n initComponents();\n }", "public MainForm() {\n\t\tsuper(\"Hospital\", List.IMPLICIT);\n\n\t\tstartComponents();\n\t}", "public LixeiraForm() {\n initComponents();\n setLocationRelativeTo(null);\n }", "public kunde() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setName(\"Form\"); // NOI18N\n setRequestFocusEnabled(false);\n setVerifyInputWhenFocusTarget(false);\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 465, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 357, Short.MAX_VALUE)\n );\n }", "public MusteriEkle() {\n initComponents();\n }", "public frmMain() {\n initComponents();\n }", "public frmMain() {\n initComponents();\n }", "public DESHBORDPANAL() {\n initComponents();\n }", "public GUIForm() {\n initComponents();\n inputField.setText(NO_FILE_SELECTED);\n outputField.setText(NO_FILE_SELECTED);\n progressLabel.setBackground(INFO);\n progressLabel.setText(SELECT_FILE);\n }", "public frmVenda() {\n initComponents();\n }", "public Botonera() {\n initComponents();\n }", "public FrmMenu() {\n initComponents();\n }", "public OffertoryGUI() {\n initComponents();\n setTypes();\n }", "public JFFornecedores() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents()\n {\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n setBackground(new java.awt.Color(255, 255, 255));\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());\n getContentPane().setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 983, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 769, Short.MAX_VALUE)\n );\n\n pack();\n }", "public EnterDetailsGUI() {\n initComponents();\n }", "public vpemesanan1() {\n initComponents();\n }", "public Kost() {\n initComponents();\n }", "public FormHorarioSSE() {\n initComponents();\n }", "public UploadForm() {\n initComponents();\n }", "public frmacceso() {\n initComponents();\n }", "public HW3() {\n initComponents();\n }", "public Managing_Staff_Main_Form() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents()\n {\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n getContentPane().setLayout(null);\n\n pack();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setName(\"Form\"); // NOI18N\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 400, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 300, Short.MAX_VALUE)\n );\n }", "public sinavlar2() {\n initComponents();\n }", "public P0405() {\n initComponents();\n }", "public IssueBookForm() {\n initComponents();\n }", "public MiFrame2() {\n initComponents();\n }", "public Choose1() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n\n String oldAuthor = prefs.get(\"AUTHOR\", \"\");\n if(oldAuthor != null) {\n this.authorTextField.setText(oldAuthor);\n }\n String oldBook = prefs.get(\"BOOK\", \"\");\n if(oldBook != null) {\n this.bookTextField.setText(oldBook);\n }\n String oldDisc = prefs.get(\"DISC\", \"\");\n if(oldDisc != null) {\n try {\n int oldDiscNum = Integer.parseInt(oldDisc);\n oldDiscNum++;\n this.discNumberTextField.setText(Integer.toString(oldDiscNum));\n } catch (Exception ex) {\n this.discNumberTextField.setText(oldDisc);\n }\n this.bookTextField.setText(oldBook);\n }\n\n\n }", "public GUI_StudentInfo() {\n initComponents();\n }", "public Lihat_Dokter_Keseluruhan() {\n initComponents();\n }", "public JFrmPrincipal() {\n initComponents();\n }", "public bt526() {\n initComponents();\n }", "public Pemilihan_Dokter() {\n initComponents();\n }", "public Ablak() {\n initComponents();\n }", "@Override\n\tprotected void initUi() {\n\t\t\n\t}", "@SuppressWarnings(\"unchecked\")\n\t// <editor-fold defaultstate=\"collapsed\" desc=\"Generated\n\t// Code\">//GEN-BEGIN:initComponents\n\tprivate void initComponents() {\n\n\t\tlabel1 = new java.awt.Label();\n\t\tlabel2 = new java.awt.Label();\n\t\tlabel3 = new java.awt.Label();\n\t\tlabel4 = new java.awt.Label();\n\t\tlabel5 = new java.awt.Label();\n\t\tlabel6 = new java.awt.Label();\n\t\tlabel7 = new java.awt.Label();\n\t\tlabel8 = new java.awt.Label();\n\t\tlabel9 = new java.awt.Label();\n\t\tlabel10 = new java.awt.Label();\n\t\ttextField1 = new java.awt.TextField();\n\t\ttextField2 = new java.awt.TextField();\n\t\tlabel14 = new java.awt.Label();\n\t\tlabel15 = new java.awt.Label();\n\t\tlabel16 = new java.awt.Label();\n\t\ttextField3 = new java.awt.TextField();\n\t\ttextField4 = new java.awt.TextField();\n\t\ttextField5 = new java.awt.TextField();\n\t\tlabel17 = new java.awt.Label();\n\t\tlabel18 = new java.awt.Label();\n\t\tlabel19 = new java.awt.Label();\n\t\tlabel20 = new java.awt.Label();\n\t\tlabel21 = new java.awt.Label();\n\t\tlabel22 = new java.awt.Label();\n\t\ttextField6 = new java.awt.TextField();\n\t\ttextField7 = new java.awt.TextField();\n\t\ttextField8 = new java.awt.TextField();\n\t\tlabel23 = new java.awt.Label();\n\t\ttextField9 = new java.awt.TextField();\n\t\ttextField10 = new java.awt.TextField();\n\t\ttextField11 = new java.awt.TextField();\n\t\ttextField12 = new java.awt.TextField();\n\t\tlabel24 = new java.awt.Label();\n\t\tlabel25 = new java.awt.Label();\n\t\tlabel26 = new java.awt.Label();\n\t\tlabel27 = new java.awt.Label();\n\t\tlabel28 = new java.awt.Label();\n\t\tlabel30 = new java.awt.Label();\n\t\tlabel31 = new java.awt.Label();\n\t\tlabel32 = new java.awt.Label();\n\t\tjButton1 = new javax.swing.JButton();\n\n\t\tlabel1.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel1.setText(\"It seems that some of the buttons on the ATM machine are not working!\");\n\n\t\tlabel2.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel2.setText(\"Unfortunately these numbers are exactly what Professor has to use to type in his password.\");\n\n\t\tlabel3.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel3.setText(\n\t\t\t\t\"If you want to eat tonight, you have to help him out and construct the numbers of the password with the working buttons and math operators.\");\n\n\t\tlabel4.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 14)); // NOI18N\n\t\tlabel4.setText(\"Denver's Password: 2792\");\n\n\t\tlabel5.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel5.setText(\"import java.util.Scanner;\\n\");\n\n\t\tlabel6.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel6.setText(\"public class ATM{\");\n\n\t\tlabel7.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel7.setText(\"public static void main(String[] args){\");\n\n\t\tlabel8.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel8.setText(\"System.out.print(\");\n\n\t\tlabel9.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel9.setText(\" -\");\n\n\t\tlabel10.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel10.setText(\");\");\n\n\t\ttextField1.addActionListener(new java.awt.event.ActionListener() {\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent evt) {\n\t\t\t\ttextField1ActionPerformed(evt);\n\t\t\t}\n\t\t});\n\n\t\tlabel14.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel14.setText(\"System.out.print( (\");\n\n\t\tlabel15.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel15.setText(\"System.out.print(\");\n\n\t\tlabel16.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel16.setText(\"System.out.print( ( (\");\n\n\t\tlabel17.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel17.setText(\")\");\n\n\t\tlabel18.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel18.setText(\" +\");\n\n\t\tlabel19.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel19.setText(\");\");\n\n\t\tlabel20.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel20.setText(\" /\");\n\n\t\tlabel21.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel21.setText(\" %\");\n\n\t\tlabel22.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel22.setText(\" +\");\n\n\t\tlabel23.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel23.setText(\");\");\n\n\t\tlabel24.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel24.setText(\" +\");\n\n\t\tlabel25.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel25.setText(\" /\");\n\n\t\tlabel26.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel26.setText(\" *\");\n\n\t\tlabel27.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));\n\t\tlabel27.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel27.setText(\")\");\n\n\t\tlabel28.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel28.setText(\")\");\n\n\t\tlabel30.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel30.setText(\"}\");\n\n\t\tlabel31.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel31.setText(\"}\");\n\n\t\tlabel32.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel32.setText(\");\");\n\n\t\tjButton1.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 14)); // NOI18N\n\t\tjButton1.setText(\"Check\");\n\t\tjButton1.addActionListener(new java.awt.event.ActionListener() {\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent evt) {\n\t\t\t\tjButton1ActionPerformed(evt);\n\t\t\t}\n\t\t});\n\n\t\tjavax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n\t\tlayout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(28).addGroup(layout\n\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING).addComponent(getDoneButton()).addComponent(jButton1)\n\t\t\t\t\t\t.addComponent(label7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t.addComponent(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t\t\t.addComponent(label2, GroupLayout.PREFERRED_SIZE, 774, GroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t.addGap(92).addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING, false)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label15, GroupLayout.PREFERRED_SIZE, 145,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField8, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(2)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label21, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField7, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label8, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField1, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label9, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED).addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextField2, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label31, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label14, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(37))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(174)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField5, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label18, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(7)))\n\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING, false).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField4, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label17, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label22, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField9, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(20)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label23, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label20, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField3, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(20).addComponent(label19, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(23).addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label16, GroupLayout.PREFERRED_SIZE, 177,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField12, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label24, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField6, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label27, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label25, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField11, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label28, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label26, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField10, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED).addComponent(label32,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t.addComponent(label30, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));\n\t\tlayout.setVerticalGroup(\n\t\t\t\tlayout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap()\n\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t.addComponent(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t.addComponent(label2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t.addComponent(label3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t.addGroup(\n\t\t\t\t\t\t\t\t\t\tlayout.createSequentialGroup().addGroup(layout.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label9,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label8,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextField2, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(3)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(19)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField5,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label14,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label18,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label17,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField4,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1))))\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label20, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label19, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField3, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(78)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label27, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(76)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField11, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(75)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label32,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tShort.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING, false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label15,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField8,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label21,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField7,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(27))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField9,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label22,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(3)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel23,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(29)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label16,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField12,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label24,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField6,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1))))))\n\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label25, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label28, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label26, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t.addGap(30)\n\t\t\t\t\t\t.addComponent(label31, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGap(25)\n\t\t\t\t\t\t.addComponent(label30, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGap(26).addComponent(jButton1).addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(getDoneButton()).addContainerGap(23, Short.MAX_VALUE)));\n\t\tthis.setLayout(layout);\n\n\t\tlabel16.getAccessibleContext().setAccessibleName(\"System.out.print( ( (\");\n\t\tlabel17.getAccessibleContext().setAccessibleName(\"\");\n\t\tlabel18.getAccessibleContext().setAccessibleName(\" +\");\n\t}", "public Pregunta23() {\n initComponents();\n }", "public FormMenuUser() {\n super(\"Form Menu User\");\n initComponents();\n }", "public AvtekOkno() {\n initComponents();\n }", "public busdet() {\n initComponents();\n }", "public ViewPrescriptionForm() {\n initComponents();\n }", "public Ventaform() {\n initComponents();\n }", "public Kuis2() {\n initComponents();\n }", "public CreateAccount_GUI() {\n initComponents();\n }", "public POS1() {\n initComponents();\n }", "public Carrera() {\n initComponents();\n }", "public EqGUI() {\n initComponents();\n }", "public JFriau() {\n initComponents();\n this.setLocationRelativeTo(null);\n this.setTitle(\"BuNus - Budaya Nusantara\");\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setBackground(new java.awt.Color(204, 204, 204));\n setMinimumSize(new java.awt.Dimension(1, 1));\n setPreferredSize(new java.awt.Dimension(760, 402));\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 750, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 400, Short.MAX_VALUE)\n );\n }", "public nokno() {\n initComponents();\n }", "public dokter() {\n initComponents();\n }", "public ConverterGUI() {\n initComponents();\n }", "public hitungan() {\n initComponents();\n }", "public Modify() {\n initComponents();\n }", "public frmAddIncidencias() {\n initComponents();\n }", "public FP_Calculator_GUI() {\n initComponents();\n \n setVisible(true);\n }" ]
[ "0.73191476", "0.72906625", "0.72906625", "0.72906625", "0.72860986", "0.7248112", "0.7213479", "0.72078276", "0.7195841", "0.71899796", "0.71840525", "0.7158498", "0.71477973", "0.7092748", "0.70800966", "0.70558053", "0.69871384", "0.69773406", "0.69548076", "0.69533914", "0.6944929", "0.6942576", "0.69355655", "0.6931378", "0.6927896", "0.69248974", "0.6924723", "0.69116884", "0.6910487", "0.6892381", "0.68921053", "0.6890637", "0.68896896", "0.68881863", "0.68826133", "0.68815064", "0.6881078", "0.68771756", "0.6875212", "0.68744373", "0.68711984", "0.6858978", "0.68558776", "0.6855172", "0.6854685", "0.685434", "0.68525875", "0.6851834", "0.6851834", "0.684266", "0.6836586", "0.6836431", "0.6828333", "0.68276715", "0.68262815", "0.6823921", "0.682295", "0.68167603", "0.68164384", "0.6809564", "0.68086857", "0.6807804", "0.6807734", "0.68067646", "0.6802192", "0.67943805", "0.67934304", "0.6791657", "0.6789546", "0.6789006", "0.67878324", "0.67877173", "0.6781847", "0.6765398", "0.6765197", "0.6764246", "0.6756036", "0.6755023", "0.6751404", "0.67508715", "0.6743043", "0.67387456", "0.6736752", "0.67356426", "0.6732893", "0.6726715", "0.6726464", "0.67196447", "0.67157453", "0.6714399", "0.67140275", "0.6708251", "0.6707117", "0.670393", "0.6700697", "0.66995865", "0.66989213", "0.6697588", "0.66939527", "0.66908985", "0.668935" ]
0.0
-1
Default constructor for Price, sets the price at 0.00, the date to the current time and the company to null.
public MF_Price() { this.price = 0.00; this.date = (Date) Calendar.getInstance().getTime(); this.company = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public MF_Price(double price, Date date) {\r\n\t\tthis.price = price;\r\n\t\tthis.date = date;\r\n\t\tthis.company = null;\r\n\t}", "public MF_Price(double price, String company) {\r\n\t\tthis.price = price;\r\n\t\tthis.company = company;\r\n\t\tthis.date = Calendar.getInstance().getTime();\r\n\t}", "public Pricing()\n\t{\n\t\tprice = INITIALPRICE;\n\t}", "public Builder clearPrice() {\n bitField0_ = (bitField0_ & ~0x00000020);\n price_ = 0;\n \n return this;\n }", "public Builder clearPrice() {\n bitField0_ = (bitField0_ & ~0x00000010);\n price_ = 0D;\n onChanged();\n return this;\n }", "public void setPrice(Date price) {\n this.price = price;\n }", "public ItemPrice() {\n }", "public void setPrice(Money price) {\n\t\tif (price == null) {\n\t\t\tthis.price = new Money(0, 0);\n\t\t} else {\n\t\t\tthis.price = price;\n\t\t}\n\t}", "@Override\n\t\t\tpublic double getPrice() {\n\t\t\t\treturn 0;\n\t\t\t}", "public Builder clearPrice() {\n if (priceBuilder_ == null) {\n price_ = java.util.Collections.emptyList();\n bitField0_ = (bitField0_ & ~0x00000001);\n onChanged();\n } else {\n priceBuilder_.clear();\n }\n return this;\n }", "public Product()\n\t{\n\t\tthis.name = \"\";\n\t\tthis.price = 0.0;\n\t\tthis.imported = false;\n\t\tthis.quantity = 0;\n\t\tthis.taxedCost = 0.0;\n\t}", "public PriceBreakdown() {\n }", "public VKApiPrice() {\n\n }", "public void setPrice(double price) {\n this.price = price;\n if (this.price < 0) {\n this.price = 0;\n }\n }", "PriceModel getZeroPriceModel();", "protected StockPrice() {\n\t\t// just for serializers\n\t}", "public Currency() {\n // Instances built via this constructor have undefined behavior.\n }", "public PortfolioAsset (String ticker, Double quantity, Date purchaseDate, Double purchasePrice) {\n\t\tthis.ticker = ticker;\n\t\tthis.quantity = quantity;\n\t\tthis.purchaseDate = purchaseDate;\n\t\tthis.purchasePrice = purchasePrice;\n\t\tpurchaseValue = purchasePrice * quantity;\n\t\t//assigning current price and value to ZERO - this will be changed when updateCurrentPriceAndValue method is called\n\t\tcurrentPrice = 0.0;\n\t\tcurrentValue = 0.0;\n\t\taccumulatedDividend = 0.0;\n\t\t\n\t}", "@Override\n\tpublic Double getPrice() {\n\t\treturn null;\n\t}", "@Override\n\tpublic void setPrice() {\n\t\tprice = 24.99;\n\n\t}", "public OrderLine() {\n products = new ArrayList<>();\n price = new BigDecimal(0);\n }", "public void setPrice(Money price) {\n this.price = price;\n }", "public Product() {\n\t\tthis.name = \"\";\n\t\tthis.price = 0;\n\t\tthis.quantity = 0;\n\t}", "public Builder clearPrice() {\n if (priceBuilder_ == null) {\n price_ = null;\n onChanged();\n } else {\n price_ = null;\n priceBuilder_ = null;\n }\n\n return this;\n }", "public void setPrice(final BigDecimal price) {\n this.price = price;\n }", "public void setPrice(BigDecimal price) {\n this.price = price;\n }", "public void setPrice(BigDecimal price) {\n this.price = price;\n }", "public void setPrice(BigDecimal price) {\r\n this.price = price;\r\n }", "public void setPrice(BigDecimal price) {\r\n this.price = price;\r\n }", "@Override\r\n\tpublic double CalculatePrice() {\n\t\treturn 0;\r\n\t}", "public Car() {\r\n this(\"\", \"\", \"\", 0, Category.EMPTY, 0.00, \"\", 0, \"\", 0.00, \"\", DriveTrain.EMPTY,\r\n Aspiration.EMPTY, 0.00, 0.00, 0.00, 0.00, 0.0, 0.0, 0.0, 0.0, 0.0);\r\n }", "public void setPrice(double price)\n {\n this.price = price;\n }", "public void setPrice(java.math.BigDecimal price) {\n this.price = price;\n }", "public Car () {\n\n Make = \"\";\n Model = \"\";\n Year = 2017;\n Price = 0.00;\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double p)\r\n\t{\r\n\t\tprice = p;\r\n\t}", "public void setPrice(double price)\n {\n this.price = price;\n }", "@Override\r\n\tpublic void setPrice(double p) {\n\t\tprice = p;\r\n\t}", "@Override\n\tpublic int getPrice() {\n\t\treturn 0;\n\t}", "public Product(String name, double price) {\r\n this.name = name;\r\n this.price = price;\r\n quantity = 0;\r\n }", "public void setPrice(Float price) {\r\n this.price = price;\r\n }", "public void setPrice(Double price) {\r\n this.price = price;\r\n }", "public void setPrice(Float price) {\n this.price = price;\n }", "public void setPrice(double price) {\n\t\tif(price > 0 )\n\t\t\tthis.price=price;\n\t}", "public void setPrice(Double price) {\n this.price = price;\n }", "public void setPrice(Double price) {\n this.price = price;\n }", "public Date getPrice() {\n return price;\n }", "public Product(final LocalDateTime createdAt,final String name,final BigDecimal price,final Status status) {\r\n\t\tthis.name=name;\r\n\t\tthis.price=price;\r\n\t\tthis.status=status;\r\n\t\tthis.createdAt=createdAt;\r\n\t}", "public EventCartItemPriceChange() {\n\t\tsuper(); // No parameters\n\t}", "public Company() {\n\t\tsuper();\n\t}", "public Company() {\r\n\t\tsuper();\r\n\t}", "@Override\n\tpublic void setPrice(double price) {\n\t\tconstantPO.setPrice(price);\n\t}", "public void setPrice(float price) {\n this.price = price;\n }", "public void setPrice(float price) {\n this.price = price;\n }", "public com.vodafone.global.er.decoupling.binding.request.BasePrice createBasePrice()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.BasePriceImpl();\n }", "public void setPriceActual (BigDecimal PriceActual);", "public void setPrice(double p) {\n\t\tprice = p;\n\t}", "public void setPrice(double value) {\n this.price = value;\n }", "public void setPrice(double value) {\n this.price = value;\n }", "protected PricingModel() {\n }", "public EmployeePay() {\n initComponents();\n setDefaultDateRange();\n updateTable();\n }", "DefaultOwnedStock(){\n\t\tsuper(\"\");\n\t\tprinciple = new BigDecimal(0);\n\t\ttotalValue = new BigDecimal(0);\n\t\tnet = new BigDecimal(0);\n\t}", "Item(DukatAmount price){\r\n\t\tthis(0, new Weight(5), price);\r\n\t}", "public Prize()\n {\n name = \"\";\n worth = 0;\n cost = 0;\n }", "public void setPrice(Double price);", "public void setPrice(double price) {\r\n\t\tthis.price = price;\r\n\t}", "public void setPrice(double price) {\r\n\t\tthis.price = price;\r\n\t}", "public PricingModel(Game game) {\n this.game = game;\n this.currentPrice = SavingCard.INITIAL_COST;\n this.invokedCount = 0;\n \n\t}", "protected Option(String name, float price) {\n\t\t\tthis.name = name;\n\t\t\tthis.price = price;\n\t\t}", "public Income() {\r\n\t\t//this.customer = customer;\r\n\t\tperiod = 31;\t\t\t\t//sets the default payment period to 31 days\r\n\t\tvalue = 1000;\t\t\t\t//sets the default income value to 1000\r\n\t\t\r\n\t}", "public ManagementCompany() {\r\n\t\tthis.name = \"\";\r\n\t\tthis.taxID = \"\";\r\n\t\tthis.mgmFeePer = 0;\r\n\t\tthis.plot.setX(0);\r\n\t\tthis.plot = new Plot();\r\n\t\tproperties = new Property[MAX_PROPERTY];\r\n\t}", "public MyDouble() {\n this.setValue(0);\n }", "public void setPrice(double price) \n\t{\n\t\tthis.price = price;\n\t}", "public Order() {\n\t\tsuper();\n\t\tcurrentOrder += 1;\n\t\torderNumber = currentOrder;\n\t\tthis.orderPrice.setScale(2, BigDecimal.ROUND_HALF_EVEN);\n\t}", "public void setPrice(double price){this.price=price;}", "public Vehicle(String carClass, BigDecimal price) {\n this.carClass = carClass;\n this.price = price;\n }", "public Companies(String name, String date, double highPrice, double lowPrice, double crazyDay) {\r\n this.name = name;\r\n this.date = date;\r\n this.lowPrice = lowPrice;\r\n this.highPrice = highPrice;\r\n this.crazyValue = crazyDay;\r\n }", "@Override\n\tpublic Money costToCompany() {\n\t\treturn null;\n\t}", "public DetailPrice(DetailPrice source) {\n if (source.PriceTitle != null) {\n this.PriceTitle = new String(source.PriceTitle);\n }\n if (source.PriceName != null) {\n this.PriceName = new String(source.PriceName);\n }\n if (source.OriginalPrice != null) {\n this.OriginalPrice = new Float(source.OriginalPrice);\n }\n if (source.DiscountPrice != null) {\n this.DiscountPrice = new Float(source.DiscountPrice);\n }\n if (source.UnitPrice != null) {\n this.UnitPrice = new Float(source.UnitPrice);\n }\n if (source.UnitPriceDiscount != null) {\n this.UnitPriceDiscount = new Float(source.UnitPriceDiscount);\n }\n if (source.ChargeUnit != null) {\n this.ChargeUnit = new String(source.ChargeUnit);\n }\n if (source.OriginalPriceHigh != null) {\n this.OriginalPriceHigh = new String(source.OriginalPriceHigh);\n }\n if (source.DiscountPriceHigh != null) {\n this.DiscountPriceHigh = new String(source.DiscountPriceHigh);\n }\n if (source.UnitPriceHigh != null) {\n this.UnitPriceHigh = new String(source.UnitPriceHigh);\n }\n if (source.UnitPriceDiscountHigh != null) {\n this.UnitPriceDiscountHigh = new String(source.UnitPriceDiscountHigh);\n }\n }", "public void setpPrice(BigDecimal pPrice) {\n this.pPrice = pPrice;\n }", "public java.lang.String getDefault_price() {\n return default_price;\n }", "public void setPrice(double price) {\n\t\tthis.price = price;\n\t}", "public void setPrice(double price) {\n\t\tthis.price = price;\n\t}", "public void setPrice(double price) {\n\t\tthis.price = price;\n\t}", "public void setPrice(double p){\n\t\t// store into the instance variable price the value of the parameter p\n\t\tprice = p;\n\t}", "public void setpPrice(double pPrice) {\n this.pPrice = pPrice;\n }", "public void setNilPriceEntity()\n {\n synchronized (monitor())\n {\n check_orphaned();\n com.unitedtote.schema.totelink._2008._06.result.PriceEntity target = null;\n target = (com.unitedtote.schema.totelink._2008._06.result.PriceEntity)get_store().find_element_user(PRICEENTITY$0, 0);\n if (target == null)\n {\n target = (com.unitedtote.schema.totelink._2008._06.result.PriceEntity)get_store().add_element_user(PRICEENTITY$0);\n }\n target.setNil();\n }\n }", "@Override\r\n\tpublic double getNettoPrice() {\n\t\treturn 0;\r\n\t}", "public CrystalExpender(int stock, double price) {\n this.stock = stock;\n this.itemPrice = price;\n\t}", "public MyDate(){\n this.day = 0;\n this.month = 0;\n this.year = 0;\n }", "public Rate() {\n this(\"Rate\", null);\n }" ]
[ "0.7575942", "0.74350774", "0.7058853", "0.6751901", "0.6719419", "0.6575236", "0.65331024", "0.651993", "0.648403", "0.64091563", "0.64039826", "0.62650335", "0.6245917", "0.6234246", "0.61784923", "0.61465466", "0.61198276", "0.61142784", "0.6113581", "0.61111283", "0.61087817", "0.60744584", "0.60679466", "0.60545576", "0.60411376", "0.6034622", "0.6034622", "0.6029517", "0.6029517", "0.60017854", "0.59877217", "0.59868586", "0.5980893", "0.5978158", "0.5970505", "0.5970505", "0.5970505", "0.59645844", "0.59645844", "0.59645844", "0.59645844", "0.59645844", "0.59645844", "0.59645844", "0.5956528", "0.5943883", "0.5943848", "0.5939852", "0.5938967", "0.59279734", "0.59256566", "0.5925363", "0.59185785", "0.591405", "0.591405", "0.5905977", "0.58843154", "0.5879305", "0.5868923", "0.586577", "0.5856336", "0.5849275", "0.5849275", "0.5846853", "0.5836878", "0.58213645", "0.581834", "0.581834", "0.581444", "0.58129555", "0.5808799", "0.5804282", "0.57873863", "0.5778896", "0.57748646", "0.57748646", "0.5769305", "0.5750929", "0.57427585", "0.5740852", "0.5729286", "0.5728293", "0.5721976", "0.57130104", "0.5703715", "0.57013535", "0.5687078", "0.56804764", "0.5673369", "0.567064", "0.56647897", "0.56647897", "0.56647897", "0.5662353", "0.5651334", "0.5649943", "0.5636734", "0.5632649", "0.56308246", "0.562951" ]
0.8442495
0
Constructor for Price. Company is set to null.
public MF_Price(double price, Date date) { this.price = price; this.date = date; this.company = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public MF_Price() {\r\n\t\tthis.price = 0.00;\r\n\t\tthis.date = (Date) Calendar.getInstance().getTime();\r\n\t\tthis.company = null;\r\n\t}", "public MF_Price(double price, String company) {\r\n\t\tthis.price = price;\r\n\t\tthis.company = company;\r\n\t\tthis.date = Calendar.getInstance().getTime();\r\n\t}", "public Company() {\r\n\t\tsuper();\r\n\t}", "public ItemPrice() {\n }", "public Company() {\n\t\tsuper();\n\t}", "public Pricing()\n\t{\n\t\tprice = INITIALPRICE;\n\t}", "public AirlineCompany() {\n\t}", "public PriceBreakdown() {\n }", "public VKApiPrice() {\n\n }", "public Currency() {\n // Instances built via this constructor have undefined behavior.\n }", "public Vehicle(String carClass, BigDecimal price) {\n this.carClass = carClass;\n this.price = price;\n }", "public ManagementCompany() {\r\n\t\tthis.name = \"\";\r\n\t\tthis.taxID = \"\";\r\n\t\tthis.mgmFeePer = 0;\r\n\t\tthis.plot.setX(0);\r\n\t\tthis.plot = new Plot();\r\n\t\tproperties = new Property[MAX_PROPERTY];\r\n\t}", "public CompanyData() {\r\n }", "@Override\n\tpublic Money costToCompany() {\n\t\treturn null;\n\t}", "public void setPrice(BigDecimal price) {\n this.price = price;\n }", "public void setPrice(BigDecimal price) {\n this.price = price;\n }", "public void setPrice(BigDecimal price) {\r\n this.price = price;\r\n }", "public void setPrice(BigDecimal price) {\r\n this.price = price;\r\n }", "public DetailPrice(DetailPrice source) {\n if (source.PriceTitle != null) {\n this.PriceTitle = new String(source.PriceTitle);\n }\n if (source.PriceName != null) {\n this.PriceName = new String(source.PriceName);\n }\n if (source.OriginalPrice != null) {\n this.OriginalPrice = new Float(source.OriginalPrice);\n }\n if (source.DiscountPrice != null) {\n this.DiscountPrice = new Float(source.DiscountPrice);\n }\n if (source.UnitPrice != null) {\n this.UnitPrice = new Float(source.UnitPrice);\n }\n if (source.UnitPriceDiscount != null) {\n this.UnitPriceDiscount = new Float(source.UnitPriceDiscount);\n }\n if (source.ChargeUnit != null) {\n this.ChargeUnit = new String(source.ChargeUnit);\n }\n if (source.OriginalPriceHigh != null) {\n this.OriginalPriceHigh = new String(source.OriginalPriceHigh);\n }\n if (source.DiscountPriceHigh != null) {\n this.DiscountPriceHigh = new String(source.DiscountPriceHigh);\n }\n if (source.UnitPriceHigh != null) {\n this.UnitPriceHigh = new String(source.UnitPriceHigh);\n }\n if (source.UnitPriceDiscountHigh != null) {\n this.UnitPriceDiscountHigh = new String(source.UnitPriceDiscountHigh);\n }\n }", "public Builder clearPrice() {\n bitField0_ = (bitField0_ & ~0x00000020);\n price_ = 0;\n \n return this;\n }", "public void setPrice(Money price) {\n this.price = price;\n }", "public void setPrice(final BigDecimal price) {\n this.price = price;\n }", "protected PricingModel() {\n }", "public BeansCompany() {\n\t\tsuper();\n\t}", "public Company(Company other) {\n\t\tsuper(); // super(this) is there is a polymorphism\n\t\tthis.name = other.name;\n\t\t// todo:\n\t\t// this.members = ??\n\t\t// this.cars = ??\n\t\n\t}", "public void setPrice(java.math.BigDecimal price) {\n this.price = price;\n }", "public Builder clearPrice() {\n bitField0_ = (bitField0_ & ~0x00000010);\n price_ = 0D;\n onChanged();\n return this;\n }", "public void setpPrice(BigDecimal pPrice) {\n this.pPrice = pPrice;\n }", "public void setPrice(Money price) {\n\t\tif (price == null) {\n\t\t\tthis.price = new Money(0, 0);\n\t\t} else {\n\t\t\tthis.price = price;\n\t\t}\n\t}", "public Car () {\n\n Make = \"\";\n Model = \"\";\n Year = 2017;\n Price = 0.00;\n }", "protected StockPrice() {\n\t\t// just for serializers\n\t}", "public ManagementCompany(ManagementCompany otherCompany) {\r\n\t\tthis.name = otherCompany.name;\r\n\t\tthis.taxID = otherCompany.taxID;\r\n\t\tthis.mgmFeePer = otherCompany.mgmFeePer;\r\n\t\tthis.plot = new Plot(otherCompany.plot);\r\n\t\tproperties = new Property[MAX_PROPERTY];\r\n\t}", "public Builder clearPrice() {\n if (priceBuilder_ == null) {\n price_ = java.util.Collections.emptyList();\n bitField0_ = (bitField0_ & ~0x00000001);\n onChanged();\n } else {\n priceBuilder_.clear();\n }\n return this;\n }", "public OrderLine() {\n products = new ArrayList<>();\n price = new BigDecimal(0);\n }", "public void setPrice(double price)\n {\n this.price = price;\n }", "public void setPrice(double p)\r\n\t{\r\n\t\tprice = p;\r\n\t}", "public Company(String name, Optional<Office> office) {\n this.name = name;\n this.office = office;\n }", "public Product()\n\t{\n\t\tthis.name = \"\";\n\t\tthis.price = 0.0;\n\t\tthis.imported = false;\n\t\tthis.quantity = 0;\n\t\tthis.taxedCost = 0.0;\n\t}", "public void setPrice(Date price) {\n this.price = price;\n }", "public SupplyOrder(SupplyOrder otherOrder){\n if(otherOrder!=null){\n this.orderID=otherOrder.getOrderID();\n this.setCustomerID(otherOrder.getCustomerID());\n this.setProductID(otherOrder.getProductID());\n this.setOrderDate(otherOrder.getOrderDate());\n this.setAmount(otherOrder.getAmount());\n }\n else{\n this.orderID=0;\n this.setCustomerID(\"\");\n this.setProductID(\"\");\n this.setOrderDate(new LocalDate());\n this.setAmount(0.0);\n }\n }", "public Currency(String country,double value, double valueUSD){\n this.country = country;\n this.value = value;\n this.valueUSD = valueUSD;\n}", "@JsonCreator\n public Price(@JsonProperty(\"value\") Double value, @JsonProperty(\"currency_code\") Currency currency) {\n this.value = value;\n this.currencyCode = currency;\n }", "public void setCommodityPrice(BigDecimal commodityPrice) {\n this.commodityPrice = commodityPrice;\n }", "public void setPrice(double price)\n {\n this.price = price;\n }", "public Companies(String name, String date, double highPrice, double lowPrice, double crazyDay) {\r\n this.name = name;\r\n this.date = date;\r\n this.lowPrice = lowPrice;\r\n this.highPrice = highPrice;\r\n this.crazyValue = crazyDay;\r\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "protected Option(String name, float price) {\n\t\t\tthis.name = name;\n\t\t\tthis.price = price;\n\t\t}", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public Market() {\n }", "public Car() {\r\n this(\"\", \"\", \"\", 0, Category.EMPTY, 0.00, \"\", 0, \"\", 0.00, \"\", DriveTrain.EMPTY,\r\n Aspiration.EMPTY, 0.00, 0.00, 0.00, 0.00, 0.0, 0.0, 0.0, 0.0, 0.0);\r\n }", "PriceModel createInstanceOfPriceModel();", "Item(DukatAmount price){\r\n\t\tthis(0, new Weight(5), price);\r\n\t}", "public void setPriceActual (BigDecimal PriceActual);", "public void setPrice(Double price) {\r\n this.price = price;\r\n }", "public Product(String name, double price) {\r\n this.name = name;\r\n this.price = price;\r\n quantity = 0;\r\n }", "public void setpPrice(double pPrice) {\n this.pPrice = pPrice;\n }", "public com.vodafone.global.er.decoupling.binding.request.BasePrice createBasePrice()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.BasePriceImpl();\n }", "@Override\r\n\tpublic void setPrice(double p) {\n\t\tprice = p;\r\n\t}", "CleanPrice getCleanPrice();", "public Company(String s)\n\t{\n\t\tname = s;\n\t}", "public void setPrice(Double price) {\n this.price = price;\n }", "public void setPrice(Double price) {\n this.price = price;\n }", "public Company( String name, String description, LocalTime startTime, LocalTime endTime, double budget, double prestigePoints)throws GameException\r\n {\r\n \tif(name==null)\r\n \t{\r\n \t\tthrow new GameException(\"Wrong argument name==null\");\r\n \t}\r\n \t\r\n \tif(description==null)\r\n \t{\r\n \t\tthrow new GameException(\"Wrong argumen description==null\");\r\n \t}\r\n \t\r\n \tif(startTime==null)\r\n \t{\r\n \t\tthrow new GameException(\"Wrong argument startTime==null\");\r\n \t}\r\n \t\r\n \tif(endTime==null)\r\n \t{\r\n \t\tthrow new GameException(\"Wrong argument endTime\");\r\n \t}\r\n \t\r\n \tif(startTime.equals(endTime) || startTime.isAfter(endTime))\r\n \t{\r\n \t\tthrow new GameException(\"Wrong argument startTime is equal or after endTime\");\r\n \t}\r\n \t\r\n \tif(budget<=0)\r\n \t{\r\n \t\tthrow new GameException(\"Wrong argument budget<=0\");\r\n \t}\r\n \t\r\n \t_lockObject = new ReentrantLock();\r\n _prestigePoints = prestigePoints;\r\n _name = name;\r\n\t\t_startTime=startTime;\r\n\t\t_endTime=endTime;\r\n\t\t_description=description;\r\n\t\t_budget=budget;\r\n\t\t_itDepartment = new Department();\r\n\t\t_lastPaymentDateTime=new DateTime();\r\n }", "public void setPrice(double p) {\n\t\tprice = p;\n\t}", "public Portfolio(){}", "public ServiceCompany(String name, String nit, String representativeName, String address, String phone, int employeeQuantity, double assetsValue, int creationDay, int creationMonth, int creationYear, int floors, String type){\n\n\t\tsuper(name, nit, representativeName, address, phone, employeeQuantity, assetsValue, creationDay, creationMonth, creationYear, floors, type);\n\n\t\tthis.surveys=new Survey[50];\n\n\t}", "public Builder clearPrice() {\n if (priceBuilder_ == null) {\n price_ = null;\n onChanged();\n } else {\n price_ = null;\n priceBuilder_ = null;\n }\n\n return this;\n }", "public void setPrice(double price){this.price=price;}", "@Override\n\tpublic void setPrice() {\n\t\tprice = 24.99;\n\n\t}", "public EventCartItemPriceChange() {\n\t\tsuper(); // No parameters\n\t}", "private WSPricingModel(String inDescription, PricingModel inPricingModel)\r\n\t{\r\n\t\tdescription = inDescription;\r\n\t\tpricingModel = inPricingModel;\r\n\t}", "public void setPriceList (BigDecimal PriceList);", "public Order() {\n\t\tsuper();\n\t\tcurrentOrder += 1;\n\t\torderNumber = currentOrder;\n\t\tthis.orderPrice.setScale(2, BigDecimal.ROUND_HALF_EVEN);\n\t}", "public void setPrice(Float price) {\r\n this.price = price;\r\n }", "public void setPrice(Float price) {\n this.price = price;\n }", "@Override\n\tpublic Double getPrice() {\n\t\treturn null;\n\t}", "public void setPrice(Integer price) {\r\n this.price = price;\r\n }", "public void setPrice(Integer price) {\r\n this.price = price;\r\n }", "public Vehicle(int year, String make, String model, BigDecimal msrp) {\n\t\tthis.year = year; \n\t\tthis.make = cleanMake(make);\n\t\tthis.model = cleanModel(model);\n\t\tthis.msrp = msrp; \n\t}", "public Rate() {\n this(\"Rate\", null);\n }", "public void setPrice(Integer price) {\n this.price = price;\n }", "public void setPrice(Integer price) {\n this.price = price;\n }", "public void setPrice(Integer price) {\n this.price = price;\n }", "public void setPrice(Integer price) {\n this.price = price;\n }", "public void setNilPriceEntity()\n {\n synchronized (monitor())\n {\n check_orphaned();\n com.unitedtote.schema.totelink._2008._06.result.PriceEntity target = null;\n target = (com.unitedtote.schema.totelink._2008._06.result.PriceEntity)get_store().find_element_user(PRICEENTITY$0, 0);\n if (target == null)\n {\n target = (com.unitedtote.schema.totelink._2008._06.result.PriceEntity)get_store().add_element_user(PRICEENTITY$0);\n }\n target.setNil();\n }\n }", "public void setPrice(int price) {\r\n this.price = price;\r\n }", "public CurrencyConversion() {\n }", "public Product(final LocalDateTime createdAt,final String name,final BigDecimal price,final Status status) {\r\n\t\tthis.name=name;\r\n\t\tthis.price=price;\r\n\t\tthis.status=status;\r\n\t\tthis.createdAt=createdAt;\r\n\t}", "public void setPriceLimit (BigDecimal PriceLimit);", "public PortfolioAsset (String ticker, Double quantity, Date purchaseDate, Double purchasePrice) {\n\t\tthis.ticker = ticker;\n\t\tthis.quantity = quantity;\n\t\tthis.purchaseDate = purchaseDate;\n\t\tthis.purchasePrice = purchasePrice;\n\t\tpurchaseValue = purchasePrice * quantity;\n\t\t//assigning current price and value to ZERO - this will be changed when updateCurrentPriceAndValue method is called\n\t\tcurrentPrice = 0.0;\n\t\tcurrentValue = 0.0;\n\t\taccumulatedDividend = 0.0;\n\t\t\n\t}", "public void setPrice(int price) {\n this.price = price;\n }", "public Companies(String name, String date, double closingPrice, double futureOpeningPrice, double twoToOneSplit,\r\n double threeToOneSplit, double threeToTwoSplit) {\r\n this.name = name;\r\n this.date = date;\r\n this.closingPrice = closingPrice;\r\n this.futureOpeningPrice = futureOpeningPrice;\r\n this.twoToOneSplit = twoToOneSplit;\r\n this.threeToOneSplit = threeToOneSplit;\r\n this.threeToTwoSplit = threeToTwoSplit;\r\n }" ]
[ "0.75586385", "0.7535797", "0.7019509", "0.70100343", "0.6991913", "0.69147927", "0.657338", "0.65311617", "0.65212274", "0.65060526", "0.64277375", "0.636171", "0.6327287", "0.630927", "0.62792593", "0.62792593", "0.62722445", "0.62722445", "0.6265976", "0.62494427", "0.6225503", "0.61872405", "0.6186058", "0.61855054", "0.6172565", "0.61647445", "0.61587715", "0.615592", "0.61102927", "0.6086981", "0.6064839", "0.605329", "0.60177195", "0.5970957", "0.59667206", "0.59537935", "0.59523535", "0.594216", "0.5918586", "0.59170485", "0.59150404", "0.5911905", "0.5908579", "0.59073186", "0.5904834", "0.589744", "0.589744", "0.589744", "0.58955026", "0.5893918", "0.5893918", "0.5893918", "0.5893918", "0.5893918", "0.5893918", "0.5893918", "0.5886468", "0.5877459", "0.58649385", "0.58632624", "0.5863002", "0.58583575", "0.58451366", "0.5844359", "0.5842504", "0.5839621", "0.5836952", "0.5832585", "0.58315414", "0.58315414", "0.5799229", "0.57954603", "0.5776751", "0.57752293", "0.57730746", "0.57709247", "0.5767061", "0.5753507", "0.57520396", "0.57492805", "0.5740539", "0.5738152", "0.57328796", "0.5730179", "0.5726175", "0.5726175", "0.57187974", "0.57128227", "0.5708191", "0.5708191", "0.5708191", "0.5708191", "0.57035536", "0.5694937", "0.569276", "0.5688626", "0.5686528", "0.5681994", "0.5671489", "0.56710464" ]
0.7230914
2
Constructor for Price. Date is set to the current date and time.
public MF_Price(double price, String company) { this.price = price; this.company = company; this.date = Calendar.getInstance().getTime(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public MF_Price(double price, Date date) {\r\n\t\tthis.price = price;\r\n\t\tthis.date = date;\r\n\t\tthis.company = null;\r\n\t}", "public MF_Price() {\r\n\t\tthis.price = 0.00;\r\n\t\tthis.date = (Date) Calendar.getInstance().getTime();\r\n\t\tthis.company = null;\r\n\t}", "public void setPrice(Date price) {\n this.price = price;\n }", "public Product(final LocalDateTime createdAt,final String name,final BigDecimal price,final Status status) {\r\n\t\tthis.name=name;\r\n\t\tthis.price=price;\r\n\t\tthis.status=status;\r\n\t\tthis.createdAt=createdAt;\r\n\t}", "public Date() {\r\n }", "public Date getPrice() {\n return price;\n }", "public Pricing()\n\t{\n\t\tprice = INITIALPRICE;\n\t}", "public Date(){\n\t\tyear=0;\n\t\tmonth=0;\n\t\tday=0;\n\t}", "public ItemPrice() {\n }", "private ARXDate() {\r\n this(\"Default\");\r\n }", "public MyDate(){\n this.day = 0;\n this.month = 0;\n this.year = 0;\n }", "public PurchaseList(Date dateOfPurchase) {\n this.dateOfPurchase = dateOfPurchase;\n }", "public Sad(){\n\t\tthis.date = new Date(System.currentTimeMillis());\n\t}", "public OneTimeDonation(float amount, LocalDateTime date) {\n super(amount, date);\n }", "public PortfolioAsset (String ticker, Double quantity, Date purchaseDate, Double purchasePrice) {\n\t\tthis.ticker = ticker;\n\t\tthis.quantity = quantity;\n\t\tthis.purchaseDate = purchaseDate;\n\t\tthis.purchasePrice = purchasePrice;\n\t\tpurchaseValue = purchasePrice * quantity;\n\t\t//assigning current price and value to ZERO - this will be changed when updateCurrentPriceAndValue method is called\n\t\tcurrentPrice = 0.0;\n\t\tcurrentValue = 0.0;\n\t\taccumulatedDividend = 0.0;\n\t\t\n\t}", "public DateTime(final BusinessObject parent) {\n super(parent);\n if (clock == null) {\n throw new ApplicationException(\"Clock not set up\");\n }\n setValue(new java.util.Date(clock.getTime()));\n isNull = false;\n }", "public TradingDayInfo(String ticker, String date, double openingPrice, double highPrice, double lowPrice, double closingPrice) {\n this.ticker = ticker;\n this.date = date;\n this.openingPrice = openingPrice;\n this.highPrice = highPrice;\n this.lowPrice = lowPrice;\n this.closingPrice = closingPrice;\n \n \n return;\n }", "public Timestamp() {\n makeNow();\n }", "public Timestamp() {\n crtime = System.currentTimeMillis() ;\n }", "public Date() {\r\n\t\tGregorianCalendar c = new GregorianCalendar();\r\n\t\tmonth = c.get(Calendar.MONTH) + 1; // our month starts from 1\r\n\t\tday = c.get(Calendar.DAY_OF_MONTH);\r\n\t\tyear = c.get(Calendar.YEAR);\r\n\t}", "public void setDate() {\n this.date = new Date();\n }", "public MyDate(long inElapsedTime)\n {\n //put in logic here\n elapsedTime = inElapsedTime;\n this.setDate(elapsedTime);\n }", "public MyDate(){\t\n\t\tthis(\"00/00/0000\");\n\t}", "protected StockPrice() {\n\t\t// just for serializers\n\t}", "public DateTime() {\n this((BusinessObject) null);\n }", "public pay_date() {\n initComponents();\n }", "public Currency() {\n // Instances built via this constructor have undefined behavior.\n }", "public EventCartItemPriceChange() {\n\t\tsuper(); // No parameters\n\t}", "public VKApiPrice() {\n\n }", "public void setStockPriceDate(Date stockPriceDate) {\n this.stockPriceDate = stockPriceDate;\n }", "public Ticket(String destination, int price)\n {\n this.destination = destination;\n this.price = price;\n issueDateTime = new Date();\n \n }", "public Rates() {\n }", "public Purchase_product() {\n initComponents();\n \n// SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd-MM-yyyy\");\n// Date d = new Date();\n// String date=dateFormat.format(d);\n//\n// \n// DateTimeFormatter dtf = DateTimeFormatter.ofPattern(\"HH:mm:ss\");\n// LocalDateTime now = LocalDateTime.now();\n// String time = dtf.format(now);\n \n \n }", "public Date getStockPriceDate() {\n return stockPriceDate;\n }", "Item(DukatAmount price){\r\n\t\tthis(0, new Weight(5), price);\r\n\t}", "public Game() {\n this.date = LocalDateTime.now();\n }", "public DateTime() {\n setCharacteristic(null);\n setYear(1582);\n setMonth(0);\n setDay(1);\n setHours(0);\n setMinutes(0);\n setSeconds(0);\n }", "public DateTime(Date date) {\r\n\t\tthis.timeString = YYYY_MMT_DD_T_HH_MM_SS_FORMATTER.format(date);\r\n\t}", "public Product()\n\t{\n\t\tthis.name = \"\";\n\t\tthis.price = 0.0;\n\t\tthis.imported = false;\n\t\tthis.quantity = 0;\n\t\tthis.taxedCost = 0.0;\n\t}", "public InterestRateMonteCarloProductFactory(final LocalDate referenceDate) {\n\t\tsuper();\n\t\tthis.referenceDate = referenceDate;\n\t}", "public Booking() {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "public OrderLine() {\n products = new ArrayList<>();\n price = new BigDecimal(0);\n }", "public TimeStamp(){\n\t\tdateTime = LocalDateTime.now();\n\t}", "protected Time() {\n\t}", "public AmountReport(BigDecimal amount, Date date) {\r\n\t\tsuper();\r\n\t\tthis.amount = amount;\r\n\t\tthis.date = date;\r\n\t}", "public FillDate() {\n }", "public TradeData(ICurrency cur, IEntity ent, ITradeType tradeType, String instructionDate, String settlementDate, int units,\r\n\t\t\tdouble pricePerUnit) {\r\n\t\tsuper();\r\n\t\tthis.cur = cur;\r\n\t\tthis.ent = ent;\r\n\t\tthis.tradeType = tradeType;\r\n\r\n\t\ttry {\r\n\r\n\t\t\tthis.instructionDate = this.sdf.parse(instructionDate);\r\n\r\n\t\t\t/*\r\n\t\t\t * I used the setSettlementDate to initialise the param to force\r\n\t\t\t * settlement date not to fall on weekend\r\n\t\t\t */\r\n\r\n\t\t\tthis.setSettlementDate(settlementDate);\r\n\r\n\t\t} catch (ParseException e) {\r\n\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\tthis.units = units;\r\n\r\n\t\tthis.pricePerUnit = pricePerUnit;\r\n\r\n\t}", "protected GeometricObject() \n\t{\n\t\tdateCreated = new java.util.Date();\n\t}", "public Cost(boolean time) {\r\n defaultCost = 5;\r\n haveSchedule = time;\r\n }", "public Time() {\n this(System.currentTimeMillis());\n }", "public MyDate(int month, int day, int year) {\n\t\tsetDate(month, day, year);\n\t}", "public SleepObject() {\n date = new Date();\n }", "public Product(String productName, double productPrice) {\n this.productName = productName;\n this.productPrice = productPrice;\n this.createDate = LocalDate.now();\n this.stockVolume = getStockNumber();\n }", "public Purchase(Date date, double amount, String rec, String note){\n\t\tthis(UUID.randomUUID().toString(), date, amount, rec, note);\n\t}", "public Product(String name, double price) {\r\n this.name = name;\r\n this.price = price;\r\n quantity = 0;\r\n }", "private Person()\r\n\t{\r\n\t\tsuper();\r\n\t\t//created = LocalDateTime.now();\r\n\t\tcreated = Calendar.getInstance().getTime();\r\n\t}", "public Payment(double amountPaid, int method, Timestamp date, int cardDetailsID, int invoiceID){\n this.recordID = recordID;\n this.amountPaid = amountPaid;\n this.method = method;\n this.date = date;\n this.cardDetailsID = cardDetailsID;\n this.invoiceID = invoiceID;\n }", "public Car () {\n\n Make = \"\";\n Model = \"\";\n Year = 2017;\n Price = 0.00;\n }", "public PubDateFilter() {\r\n this(System.currentTimeMillis());\r\n }", "public CinemaDate() {\n }", "public PriceBreakdown() {\n }", "private void initializeDate() {\n\t\tfinal Calendar c = Calendar.getInstance();\n\t\tmYear = c.get(Calendar.YEAR);\n\t\tmMonth = c.get(Calendar.MONTH);\n\t\tmDay = c.get(Calendar.DAY_OF_MONTH);\n\t\t\n\t\texpense.setDate(c.getTime());\n\n\t\t// display the current date\n\t\tupdateDateDisplay();\n\t}", "Data() {\n\t\t// dia = 01;\n\t\t// mes = 01;\n\t\t// ano = 1970;\n\t\tthis(1, 1, 1970); // usar um construtor dentro de outro\n\t}", "public Stock(String shortName, String companyName, String dateChecked, String currPrice,\n\t\t\tString divYield, String peRatio) {\n\t\tthis.shortName = shortName;\n\t\tthis.companyName = companyName;\n\t\tthis.dateChecked = dateChecked;\n\t\tthis.currPrice = currPrice;\n\t\tthis.divYield = divYield;\n\t\tthis.peRatio = peRatio;\n\t}", "public TimeDataItem(Date time, double value) {\n this(time, new Double(value));\n }", "public Sad(Date date) {\n super(date);\n }", "public void setCarbuydate(Date carbuydate) {\n this.carbuydate = carbuydate;\n }", "public History(Integer idPerson, Integer idTravel, Integer idHotel, Integer idTransport, Integer idAttraction, Date startDate, Date endDate, String name, String city, double price) {\r\n this.idPerson = idPerson;\r\n this.idTravel = idTravel;\r\n this.idHotel = idHotel;\r\n this.idTransport = idTransport;\r\n this.idAttraction = idAttraction;\r\n this.startDate = startDate;\r\n this.endDate = endDate;\r\n this.name = name;\r\n this.city = city;\r\n this.price = price;\r\n }", "public Event(String name, LocalDateTime date) {\n super(name);\n this.date = date;\n }", "public DateTime(final BusinessObject parent, final int year, final int month, final int day, final int hour, final int minute, final int second) {\n super(parent);\n setValue(year, month, day, hour, minute, second);\n isNull = false;\n }", "public GeometricObject() {\n dateCreated = new java.util.Date();\n }", "protected void setTimeStamp(Date date) {\n\t\tsetPurchaseDate(date);\n\t}", "public StoredDay(LocalDate date) {\n this.date = date;\n this.recipes = new StoredRecipe[0];\n }", "public void setDate(Date date) {\r\n this.date = date;\r\n }", "protected Item(double amount, Category category, LocalDate date, String note) {\n this.amount = amount;\n setCategory(category);\n this.date = date;\n this.note = note;\n }", "public Ticket(){\n price = ((double)(Math.random() * (MAX + 1 - MIN))) + MIN;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public MyDate(int inYear, int inDay, int inMonth)\n {\n year = inYear;\n day = inDay;\n month = inMonth;\n }", "public Date getCarbuydate() {\n return carbuydate;\n }", "public Rate() {\n this(\"Rate\", null);\n }", "@Override\n\tpublic void initDate() {\n\n\t}", "public DateUtil ()\n {\n\n }", "public Timestamp() {}", "protected PricingModel() {\n }", "public Stock() {\n }", "public Vehicle(String carClass, BigDecimal price) {\n this.carClass = carClass;\n this.price = price;\n }", "public Date getBuyDate() {\n return DateUtils.copy(buyDate);\n }", "public Product() {\n\t\tthis.name = \"\";\n\t\tthis.price = 0;\n\t\tthis.quantity = 0;\n\t}", "public Components(String item_name,String serial_no, double maint_cost,double maint_interval,String maint_date){\n this.item_name=item_name;\n this.serial_no=serial_no;\n this.maint_cost=maint_cost;\n this.maint_interval=maint_interval;\n try{\n Date date1 = new SimpleDateFormat(\"dd/MM/yyyy\").parse(maint_date);\n this.maint_date = date1;\n }\n catch (Exception e){\n System.out.println(\"Invalid date format\");\n }\n }", "public Book(String name, String author, String publisher, LocalDate purchaseDate) {\r\n\t\t\tsuper();\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.author = author;\r\n\t\t\tthis.publisher = publisher;\r\n\t\t\tthis.purchaseDate = purchaseDate;\r\n\t\t}", "public ConversionHistory() {\r\n conversionDate = LocalDate.now();\r\n }", "public DateTime(Date date,Time12 time)\n {\n\t\tthis.date=date;\n\t\tthis.time=time;\n }" ]
[ "0.77914673", "0.7469642", "0.69378716", "0.6619818", "0.6578954", "0.64914894", "0.6478292", "0.64397347", "0.63990813", "0.6342337", "0.62622726", "0.62368417", "0.6212013", "0.6202839", "0.62021554", "0.61549205", "0.6143758", "0.6134989", "0.61206424", "0.6119553", "0.6097948", "0.6049424", "0.6014479", "0.6008613", "0.6002129", "0.59985876", "0.59951985", "0.5977802", "0.5977331", "0.5949335", "0.5939879", "0.5934038", "0.59315836", "0.5931456", "0.5927725", "0.5917986", "0.58899915", "0.5888511", "0.5876856", "0.58744246", "0.5868273", "0.58657897", "0.58634627", "0.5861732", "0.5853981", "0.5849155", "0.5828832", "0.5824231", "0.5800493", "0.5792693", "0.57888335", "0.5781182", "0.5771758", "0.57633406", "0.57611287", "0.57541263", "0.5750162", "0.5749169", "0.57478034", "0.57277745", "0.5719461", "0.5702872", "0.5693437", "0.5692082", "0.5688448", "0.5678658", "0.56709945", "0.56637055", "0.56636584", "0.5662924", "0.5656542", "0.5653875", "0.5651949", "0.5644451", "0.5629523", "0.5618983", "0.5614212", "0.5614212", "0.5614212", "0.5614212", "0.5614212", "0.5614212", "0.5614212", "0.5614212", "0.5614212", "0.56139493", "0.56121397", "0.5602151", "0.5594827", "0.55919987", "0.55886054", "0.55858225", "0.5578189", "0.55779064", "0.5561565", "0.55591106", "0.5543964", "0.55429375", "0.5540792", "0.5539013" ]
0.63890344
9
Returns the price of the Price object
public double getPrice() { return this.price; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Money getPrice() {\n\t\treturn price;\n\t}", "public Double getPrice() {\n return price;\n }", "public Double getPrice() {\n return price;\n }", "public Money getPrice() {\n return price;\n }", "public Double getPrice() {\r\n return price;\r\n }", "public double getPrice() {\n return price_;\n }", "public BigDecimal getPrice() {\r\n return price;\r\n }", "public BigDecimal getPrice() {\r\n return price;\r\n }", "public BigDecimal getPrice() {\n return price;\n }", "public BigDecimal getPrice() {\n return price;\n }", "public BigDecimal getPrice() {\n return price;\n }", "public BigDecimal getPrice() {\n return price;\n }", "public BigDecimal getPrice() {\n return price;\n }", "public double getPrice() {\n return price_;\n }", "public Double getPrice();", "public double getPrice() {\r\n return price;\r\n }", "public double getPrice() {\r\n return price;\r\n }", "public double getPrice() {\r\n return price;\r\n }", "public double getPrice() {\r\n return price;\r\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice() {\n return price;\n }", "public double getPrice(){\r\n\t\treturn price;\r\n\t}", "Price getPrice() throws Exception;", "public BigDecimal\tgetPrice();", "public BigDecimal getPrice()\n\t{\n\t\treturn price;\n\t}", "public double getPrice()\n {\n return this.price;\n }", "public double getPrice(){\n\t\t\treturn price;\n\t\t}", "public double price() {\n return price;\n }", "public double getPrice() {\n return this.price;\n }", "public Double getPrice() {\r\n\t\treturn price;\r\n\t}", "public double getPrice(){\n\t\treturn this.price;\n\t}", "double getPrice();", "double getPrice();", "double getPrice();", "public double getPrice()\r\n {\r\n return price;\r\n }", "public double getPrice(){\n\t\treturn price;\n\t}", "public double getPrice(){\n\t\t\n\t\treturn price;\n\t}", "public double getPrice();", "public double getPrice()\n {\n \treturn price;\n }", "public double getPrice()\r\n {\r\n return this.price;\r\n }", "public double getPrice()\n {\n return price;\n }", "BigDecimal getPrice();", "public java.math.BigDecimal getPrice() {\n return price;\n }", "public Double getPrice() {\n\t\treturn price;\n\t}", "@Override\r\n\tpublic double getPrice() {\n\t\treturn price;\r\n\t}", "public double getPrice() \n\t{\n\t\treturn price;\n\t}", "public double getPrice() \n\t{\n\t\treturn price;\n\t}", "public Long getPrice() {\n return price;\n }", "public double getPrice()\n\t{\n\t\treturn this.price;\n\t}", "public Integer getPrice() {\n return price;\n }", "public Integer getPrice() {\n return price;\n }", "public Integer getPrice() {\n return price;\n }", "public Integer getPrice() {\n return price;\n }", "public double getPrice() {\n\t\treturn price;\n\t}", "public double getPrice() {\n\t\treturn price;\n\t}", "public double getPrice() {\n\t\treturn price;\n\t}", "public double getPrice() {\n\t\treturn price;\n\t}", "public double getPrice() {\n\t\treturn price;\n\t}", "public Integer getPrice() {\r\n return price;\r\n }", "public Integer getPrice() {\r\n return price;\r\n }", "public double getPrice() {\n\t\treturn this.price;\n\t\t\n\t}", "public String getPrice() {\n return price;\n }", "public String getPrice() {\n return price;\n }", "Price getTradePrice();", "public double getPrice() {\n\t\treturn this.price;\n\t}", "public java.lang.Integer getPrice()\n {\n return price;\n }", "public Number getPrice() {\n return (Number)getAttributeInternal(PRICE);\n }", "public double getPrice() {\n\t\t\treturn price;\n\t\t}", "public long getPrice() {\n return price;\n }", "public float getPrice() {\n return price;\n }", "public float getPrice() {\n return price;\n }", "public float getPrice() {\n return price;\n }", "@Override\n\tpublic double getPrice() {\n\t\treturn constantPO.getPrice();\n\t}", "public float getPrice() {\n return _price;\n }", "String getPrice();", "public Float getPrice() {\n return price;\n }", "public java.lang.String getPrice() {\n return price;\n }", "public Float getPrice() {\r\n return price;\r\n }", "protected float getPrice() {\n\t\t\treturn price;\n\t\t}", "public Date getPrice() {\n return price;\n }", "public BigDecimal getpPrice() {\n return pPrice;\n }", "public double getPrice(){\n\t\treturn Price; // Return the product's price\n\t}", "public double getCost() {\n return price;\n }", "long getPrice();", "String getPrice() {\n return Double.toString(price);\n }", "public ArmCurrency getPrice() {\n return (getPrice(true));\n }", "public float getPrice() \n {\n return price;\n }", "public double getpPrice() {\n return pPrice;\n }" ]
[ "0.80891204", "0.80774534", "0.80774534", "0.807133", "0.806516", "0.80511945", "0.8037765", "0.8037765", "0.8036534", "0.8036534", "0.8036534", "0.8036534", "0.8036534", "0.8034811", "0.8029292", "0.8012928", "0.8012928", "0.8012928", "0.8012928", "0.80112785", "0.8004455", "0.8004455", "0.8004455", "0.8004455", "0.8004455", "0.8004455", "0.8004455", "0.8004455", "0.8004455", "0.8004455", "0.8004455", "0.8003772", "0.80033785", "0.8001016", "0.8001013", "0.7998497", "0.7985582", "0.79785985", "0.79773414", "0.79731864", "0.7969114", "0.7968552", "0.7968552", "0.7968552", "0.79601717", "0.795893", "0.79416424", "0.7937076", "0.79339045", "0.7932669", "0.7921106", "0.79202604", "0.79141057", "0.79104227", "0.7906598", "0.7903463", "0.7903463", "0.78757966", "0.7865036", "0.7840121", "0.7840121", "0.7840121", "0.7840121", "0.7830613", "0.7830613", "0.7830613", "0.7830613", "0.7830613", "0.78263736", "0.78263736", "0.78246963", "0.78222287", "0.78222287", "0.7812906", "0.7811351", "0.78082454", "0.775967", "0.7756036", "0.7754888", "0.7736165", "0.7736165", "0.7736165", "0.7727601", "0.77077395", "0.7707264", "0.7693914", "0.7676966", "0.7673205", "0.7669027", "0.76563245", "0.76399624", "0.7636859", "0.76168793", "0.75976884", "0.75748783", "0.75643194", "0.755548", "0.7541893" ]
0.78611577
61
Returns the date and time associated with this Price object.
public Date getDate() { return this.date; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Date getOrderTime();", "public Date getEventTime() {\n\t\treturn time;\n\t}", "public Date getBuy_time() {\r\n\t\treturn buy_time;\r\n\t}", "public String getTime() {\n return dateTime.format(c.getTime());\n }", "public Date time() {\n return _time;\n }", "public Date time() {\n return _time;\n }", "public Date time() {\n return _time;\n }", "public Date getDate()\n\t\t{\n\t\t\treturn this.timeSlot;\n\t\t}", "public Date getPrint_time(){\r\n\t\treturn this.print_time ;\r\n\t}", "public double getTime() {\n return this.time;\n }", "public Date getPayTime() {\n return payTime;\n }", "public Date getPayTime() {\n return payTime;\n }", "public String getTime() {\n return this.time;\n }", "public Date getOrdertime() {\n return ordertime;\n }", "@ApiModelProperty(value = \"The timestamp that the `last_price` represents.\")\n public OffsetDateTime getTime() {\n return time;\n }", "public Date getActualBuyingTime() {\n return actualBuyingTime;\n }", "public Date getTime() {\n return time;\n }", "public Date getTime() {\n return time;\n }", "public Date getTime() {\n return time;\n }", "public Date getTime() {\n return time;\n }", "public Date getTime() {\r\n return time;\r\n }", "public Date getTime() {\r\n return time;\r\n }", "public Date getTime() {\r\n return time;\r\n }", "public Date getOrderTime() {\n return orderTime;\n }", "public Date getPubTime() {\n return (Date) getAttributeInternal(PUBTIME);\n }", "public Date getEventTime() {\n return eventTime;\n }", "public Date getEventTime() {\n return eventTime;\n }", "public String getDatetime() {\n return datetime;\n }", "public Date getTime() {\r\n\t\treturn time;\r\n\t}", "public Date getTime() {\n\t\treturn time;\n\t}", "@java.lang.Override\n public long getTime() {\n return instance.getTime();\n }", "public Date getRecTime() {\n return recTime;\n }", "public Date getTime() {\n return mTime;\n }", "public String getTime() {\n return time;\n }", "@Override\n\tpublic String getTime() {\n\t\treturn time;\n\t}", "public long getTime() {\n return instance.getTime();\n }", "public long getTime() {\n return instance.getTime();\n }", "public long getTime() {\n return instance.getTime();\n }", "public long getTime() {\n return instance.getTime();\n }", "public long getTime() {\n return instance.getTime();\n }", "public long getTime() {\n return instance.getTime();\n }", "public long getTime() {\n return instance.getTime();\n }", "final public long getDateTime() {\n return crtime ;\n }", "public String getTime() {\n Date date = new Date();\n return (date.toString());\n }", "public long getDatetime() {\n return datetime;\n }", "public String getTime() {\n\t}", "public Date getActualSellingTime() {\n return actualSellingTime;\n }", "public String getDateTime() {\n\t\tlog.trace(\"Get dateTime, returns [{}]\", dateTime);\n\t\treturn dateTime;\n\t}", "public Date getDatetime() {\n\t\treturn datetime;\n\t}", "public Date getCreate_time() {\n return create_time;\n }", "public Date getCreate_time() {\n return create_time;\n }", "public String getTime() {\r\n\t\treturn time;\r\n\t}", "private String getDate()\r\n\t{\r\n\t\tCalendar cal = Calendar.getInstance();\r\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm\");\r\n\t\treturn sdf.format(cal.getTime());\r\n\t}", "public Date getTimeCreate() {\n return timeCreate;\n }", "public Date getDate() {\n return dateTime;\n }", "public String getTime() {\n\t\treturn time;\n\t}", "public String getTimeStamp() {\n return new SimpleDateFormat(\"dd.MM.yyyy HH.mm.ss\").format(new Date());\n }", "public String getTime() {\n\t\treturn mTime;\n\t}", "public double getTime() {return _time;}", "public Date getAtTime() {\r\n return atTime;\r\n }", "public Date getPointTime() {\n return pointTime;\n }", "public Date getcTime() {\r\n return cTime;\r\n }", "public double getTime() { return time; }", "public Date getToptime() {\n return toptime;\n }", "public Date getPutintime() {\n return putintime;\n }", "public Date getPaymentTime() {\n\t\treturn paymentTime;\n\t}", "private String getTimestamp() {\n return Calendar.getInstance().getTime().toString();\n }", "public Calendar getTime () {\n return this.time;\n }", "@java.lang.Override\n public long getTime() {\n return time_;\n }", "public Date getOprTime() {\n return oprTime;\n }", "public Date getCreatetime() {\n return createtime;\n }", "public Date getCreatetime() {\n return createtime;\n }", "public Date getCreatetime() {\n return createtime;\n }", "public Date getCreatetime() {\n return createtime;\n }", "public Date getCreatetime() {\n return createtime;\n }", "public Date getCreatetime() {\n return createtime;\n }", "public Date getCreatetime() {\n return createtime;\n }", "public Date getCreatetime() {\n return createtime;\n }", "public Date getaTime() {\r\n return aTime;\r\n }", "@Override\r\n\tpublic long getTime() {\n\t\treturn this.time;\r\n\t}", "public Date getCreatetime() {\r\n return createtime;\r\n }", "public Date getCreatetime() {\r\n return createtime;\r\n }", "public Date getCreatetime() {\r\n return createtime;\r\n }", "public String getEventTime() {\r\n\t\treturn eventTime;\r\n\t}", "public String getEventTime() {\r\n return eventTime;\r\n }", "public String getDate(){\n\t\treturn toString();\n\t}", "public Date getEntrytime() {\n return entrytime;\n }", "public String getAdjustedTime() {\n\t}", "public static String getDateTime() {\n\t\treturn new SimpleDateFormat(\"dd/MM/yyyy HH:mm:ss\").format(new Date());\n\t}", "public String getTime(){\n return time;\n }", "public Date getReleaseTime() {\r\n return releaseTime;\r\n }", "public String getTime() {\n String pattern = \"yyyy-MM-dd HH:mm:ss\";\n SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);\n\n String date = simpleDateFormat.format(new Date());\n return date;\n }", "public double getTime();", "public EventTime getTime() {\n return this.time;\n }", "public long getTime() {\n return time_;\n }", "public long getTime() {\n return time_;\n }", "public synchronized String getTime() {\n\t\treturn time;\n\t}", "public long getTime() {\n return _time;\n }", "public String toString()\n\t{\n\t\treturn date.toString()+\" \"+time.toString();\n\t}", "public Date getMakeTime() {\n\t\treturn makeTime;\n\t}", "public long getTime() {\n return time_;\n }" ]
[ "0.71275896", "0.70679176", "0.7005854", "0.6990938", "0.69661754", "0.69661754", "0.69552934", "0.6952201", "0.6937096", "0.6897667", "0.68869245", "0.68869245", "0.68784535", "0.68739396", "0.68436575", "0.68418366", "0.68411225", "0.68411225", "0.68411225", "0.68411225", "0.6837183", "0.6837183", "0.6837183", "0.68346536", "0.67939365", "0.67784274", "0.67784274", "0.6772779", "0.6767758", "0.67662936", "0.6762036", "0.67448646", "0.6722605", "0.67064", "0.6691468", "0.66811085", "0.66811085", "0.66811085", "0.66697365", "0.66697365", "0.66697365", "0.66697365", "0.6666259", "0.66605717", "0.66579044", "0.665394", "0.66392285", "0.6637108", "0.6624926", "0.6623303", "0.6623303", "0.6588428", "0.6586057", "0.65844804", "0.65837586", "0.6582375", "0.65784204", "0.6571789", "0.6567785", "0.65552413", "0.6550487", "0.65477145", "0.6546183", "0.65373254", "0.65310735", "0.6510028", "0.65077025", "0.65009564", "0.64904624", "0.6487951", "0.6485394", "0.6485394", "0.6485394", "0.6485394", "0.6485394", "0.6485394", "0.6485394", "0.6485394", "0.64852107", "0.6484995", "0.6481247", "0.6481247", "0.6481247", "0.64777184", "0.64663726", "0.6462639", "0.6457909", "0.6450153", "0.64480126", "0.64378947", "0.643632", "0.64248675", "0.64228356", "0.6413369", "0.64082164", "0.64082164", "0.64062953", "0.6405572", "0.6405455", "0.64028955", "0.6402685" ]
0.0
-1
TODO: getDate that returns a string here. Set the price of this Price object
public void setPrice(double price) { this.price = price; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setPrice(double price)\n {\n this.price = price;\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "public void setPrice(double price) {\r\n this.price = price;\r\n }", "public void setPrice(double price)\n {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(double price) {\n this.price = price;\n }", "public void setPrice(Money price) {\n this.price = price;\n }", "public void setPrice(Double price) {\r\n this.price = price;\r\n }", "@Override\r\n\tpublic void setPrice(double p) {\n\t\tprice = p;\r\n\t}", "public void setPrice(double p)\r\n\t{\r\n\t\tprice = p;\r\n\t}", "public void setPrice(Double price) {\n this.price = price;\n }", "public void setPrice(Double price) {\n this.price = price;\n }", "public void setPrice(double price) \n\t{\n\t\tthis.price = price;\n\t}", "public void setPrice(double value) {\n this.price = value;\n }", "public void setPrice(double value) {\n this.price = value;\n }", "public void setPrice(double p){\n\t\t// store into the instance variable price the value of the parameter p\n\t\tprice = p;\n\t}", "public void setPrice(Date price) {\n this.price = price;\n }", "public void setPrice(Double price);", "@Override\n\tpublic void setPrice() {\n\t\tprice = 24.99;\n\n\t}", "public void setPrice(double price){this.price=price;}", "public void setPrice(java.math.BigDecimal price) {\n this.price = price;\n }", "public void setPrice(final BigDecimal price) {\n this.price = price;\n }", "public void setPrice(BigDecimal price) {\r\n this.price = price;\r\n }", "public void setPrice(BigDecimal price) {\r\n this.price = price;\r\n }", "public void setPrice(double newPrice) {\r\n price = newPrice;\r\n }", "public void setPrice(double price) {\n\t\tthis.price = price;\n\t}", "public void setPrice(double price) {\n\t\tthis.price = price;\n\t}", "public void setPrice(double price) {\n\t\tthis.price = price;\n\t}", "public void setPrice(BigDecimal price) {\n this.price = price;\n }", "public void setPrice(BigDecimal price) {\n this.price = price;\n }", "@Override\n\tpublic void setPrice(double price) {\n\t\tconstantPO.setPrice(price);\n\t}", "public void setPrice(double p) {\n\t\tprice = p;\n\t}", "public void setPrice(int price) {\n this.price = (double)price;\n }", "public void setPrice(Float price) {\r\n this.price = price;\r\n }", "public void setPrice(int price) {\r\n this.price = price;\r\n }", "protected void setPrice(float price) {\n\t\t\tthis.price = price;\n\t\t}", "public void setPrice(Float price) {\n this.price = price;\n }", "public void setPrice(java.lang.String price) {\n this.price = price;\n }", "public void setPrice(float price) {\n this.price = price;\n }", "public void setPrice(float price) {\n this.price = price;\n }", "public void setPrice(int price) {\n this.price = price;\n }", "protected void setPrice(DukatAmount price){\r\n\t\tif(canHaveAsPrice(price))\r\n\t\t\tthis.price = price;\r\n\t}", "public void setPrice(Double price) {\n\t\tthis.price = price;\n\t}", "public void setPrice (double ticketPrice)\r\n {\r\n price = ticketPrice;\r\n }", "public void setPrice(double price) \n\t{\n\t\tthis.price = price * quantity;\n\t}", "public void setPrice(String price) {\n\t\tthis.price = price;\n\t}", "public void setPrice(int price) {\n\tthis.price = price;\n}", "public void setPrice(Integer price) {\r\n this.price = price;\r\n }", "public void setPrice(Integer price) {\r\n this.price = price;\r\n }", "public void setPrice(Integer price) {\n this.price = price;\n }", "public void setPrice(Integer price) {\n this.price = price;\n }", "public void setPrice(Integer price) {\n this.price = price;\n }", "public void setPrice(Integer price) {\n this.price = price;\n }", "public void setPrice(java.lang.Integer _price)\n {\n price = _price;\n }", "public void setPrice(double price) {\n this.price = price;\n if (this.price < 0) {\n this.price = 0;\n }\n }", "public void setPrice(double price) {\n\t\tif(price > 0 )\n\t\t\tthis.price=price;\n\t}", "public void setPrice(Number value) {\n setAttributeInternal(PRICE, value);\n }", "public void setPrice(Money price) {\n\t\tif (price == null) {\n\t\t\tthis.price = new Money(0, 0);\n\t\t} else {\n\t\t\tthis.price = price;\n\t\t}\n\t}", "public void setPrice(Long price) {\n this.price = price;\n }", "public void setPrice(int value) {\n this.price = value;\n }", "@Override\n\tpublic void setPrice(int price) {\n\t\t\n\t}", "public void setPrice(int price)\n {\n if(checker.isString(Integer.toString(price)))\n this.price = price;\n else\n this.price = 0;\n }", "public void setPrice(float itemPrice) \n {\n price = itemPrice;\n }", "public void setPrice(double x){\n\t\t\tprice = x;\t\n\t\t}", "public Builder setPrice(int value) {\n bitField0_ |= 0x00000020;\n price_ = value;\n \n return this;\n }", "public void setPrice(int price) {\n\t\tthis.price = price;\n\t\tlbl.setText(price+\" C\");\n\t}", "public void setpPrice(double pPrice) {\n this.pPrice = pPrice;\n }", "public void setPriceActual (BigDecimal PriceActual);", "public Builder setPrice(double value) {\n bitField0_ |= 0x00000010;\n price_ = value;\n onChanged();\n return this;\n }", "public void setPrice(BigDecimal value) {\n setAttributeInternal(PRICE, value);\n }", "public void setProductPrice(double productPrice) {\n this.productPrice = productPrice;\n }", "public void setPrice(int newPrice){\n productRelation.setCost(newPrice);\n }", "public void setPrice(String price) {\n this.price = price == null ? null : price.trim();\n }", "@Element \n public void setPrice(Long price) {\n this.price = price;\n }", "public void setPotatoesPrice(double p);", "public void setPriceEntered (BigDecimal PriceEntered);", "public void setPurchasePrice(double p)\n {\n this.purchasePrice = p;\n }", "public void setpPrice(BigDecimal pPrice) {\n this.pPrice = pPrice;\n }", "public void changePrice(Product p, int price){\r\n\t\tp.price = price;\r\n\t}", "@Override\n\tpublic void setPrice(java.lang.String price) {\n\t\t_lineaGastoCategoria.setPrice(price);\n\t}", "public void setPrice(double price){\r\n\t\t\r\n\t\ttry{\r\n\t\t\tif(price>0)\r\n\t\t\tthis.price = price;\r\n\t\t\telse\r\n\t\t\t\tthrow new negativeNumberException();\r\n\t\t}catch (negativeNumberException ex){\r\n\t\t\tSystem.out.println(\"The price can not be negative, \"\r\n\t\t\t\t\t+ \"please reenter a positive value\");\r\n\t\t\tSystem.out.println(\"Enter a price:\");\r\n\t\t\tScanner input = new Scanner(System.in);\r\n\t\t\tdouble retry = input.nextDouble();\r\n\t\t\tsetPrice(retry);\r\n\t\t}\r\n\t\t\r\n\t}", "void setPrice(int price) {\n mPriceTextView.setText(StoreUtils.getPriceString(price, mCurrency));\n }", "void setPrice(double price) throws NegativeNumberException {\n if (price <= 0) {\n throw new NegativeNumberException(\"Negative number.Try again.\");\n }\n this.price = price;\n }", "protected void setItemPrice(Double itemPrice) {\n this.itemPrice = itemPrice;\n }", "public BigDecimal getPrice() {\r\n return price;\r\n }", "public BigDecimal getPrice() {\r\n return price;\r\n }", "public void setPriceLimit (BigDecimal PriceLimit);", "public void putNewPrice(String symbol, double price);", "public String getPrice() {\n return price;\n }", "public String getPrice() {\n return price;\n }", "public double getPrice(){\n\t\t\treturn price;\n\t\t}", "public FoursquarePathBuilder setPrice(Price price) {\n String prices = price.getQueryString();\n addParameter(\"price\", prices);\n return this;\n }", "public void changePrice(TripDTO trip, BigDecimal price);" ]
[ "0.81821305", "0.8169151", "0.8169151", "0.8169151", "0.81568843", "0.8137556", "0.8137556", "0.8137556", "0.8137556", "0.8137556", "0.8137556", "0.8137556", "0.8064742", "0.8046877", "0.80352277", "0.7996039", "0.7975971", "0.7975971", "0.7950742", "0.79484147", "0.79484147", "0.7934184", "0.7934083", "0.7931118", "0.79136366", "0.791025", "0.7892647", "0.78805757", "0.7861543", "0.7861543", "0.7859201", "0.78476", "0.78476", "0.78476", "0.7846949", "0.7846949", "0.7832574", "0.77855784", "0.7779442", "0.7777326", "0.7776246", "0.775476", "0.7741291", "0.7734537", "0.7734331", "0.7734331", "0.7727605", "0.76968473", "0.768494", "0.767779", "0.76689124", "0.76547706", "0.76048166", "0.7601485", "0.7601485", "0.75666404", "0.75666404", "0.75666404", "0.75666404", "0.7545982", "0.75077736", "0.7494569", "0.74894625", "0.74806476", "0.74777484", "0.7474022", "0.7471855", "0.7403749", "0.7392997", "0.73846716", "0.73470944", "0.7329786", "0.7260202", "0.72584456", "0.7191775", "0.71586925", "0.7151655", "0.7118601", "0.71055895", "0.7072409", "0.7061183", "0.7016023", "0.6990507", "0.6972715", "0.69358075", "0.6922662", "0.6896875", "0.6895686", "0.68938875", "0.6883255", "0.68205875", "0.68205875", "0.68056583", "0.6796446", "0.6790207", "0.6790207", "0.6785911", "0.67703557", "0.6759978" ]
0.7979231
17
Set the date object associated with the price from java.util.date
public void setDate(Date date) { this.date = date; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setPrice(Date price) {\n this.price = price;\n }", "void setDate(Date data);", "public void SetDate(Date date);", "public void setServiceDate(java.util.Date value);", "public MF_Price(double price, Date date) {\r\n\t\tthis.price = price;\r\n\t\tthis.date = date;\r\n\t\tthis.company = null;\r\n\t}", "public void setDate(Date date) {\r\n this.date = date;\r\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n\t\n\t\tthis.date = date;\n\t\n\t}", "public void setDate(java.util.Date param){\n \n this.localDate=param;\n \n\n }", "public void setDate(Date date) {\r\n \t\tthis.startDate = date;\r\n \t}", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "public void setDate(Date date) {\n\t\tthis._date = date;\n\t}", "public void setCarbuydate(Date carbuydate) {\n this.carbuydate = carbuydate;\n }", "public void setDate(Date date) {\n\t\t\n\t\tdate_ = date;\n\t}", "public void setDate(final Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n mDate = date;\n }", "public void setDate(DateTime \n date) {\n this.date = date;\n }", "void setInvoicedDate(Date invoicedDate);", "public void setCarprodate(Date carprodate) {\n this.carprodate = carprodate;\n }", "public void setDate(Date date) {\n if (date != null) {\n this.mDate = (Date) date.clone();\n } else {\n this.mDate = null;\n }\n }", "public void setDate() {\n this.date = new Date();\n }", "public final void setDate(LocalDate date) {\n dateProperty().set(date);\n }", "public void setStockPriceDate(Date stockPriceDate) {\n this.stockPriceDate = stockPriceDate;\n }", "public void setValue(java.util.Date value) {\n this.value = value;\n }", "public void setDate(LocalDate date) {\n this.date = date;\n }", "public void setDate(String parName, Date parVal) throws HibException;", "public void setStartDate(java.util.Date value);", "@Test\r\n public void testSetDateEaten()\r\n {\r\n System.out.println(\"setDateEaten\");\r\n Date dateEaten = Date.valueOf(\"1982-04-08\");\r\n FoodBean instance = new FoodBean(5, \"Beans on toast\", \r\n Date.valueOf(\"2014-04-01\"), Time.valueOf(\"10:00:00\"), \r\n 100, 120, 5, 7, 500, 0, 3);\r\n instance.setDateEaten(dateEaten);\r\n assertEquals(dateEaten, instance.getDateEaten());\r\n }", "public void setReleaseDate(Date date) {\r\n this.releaseDate = date;\r\n // set the fact we have called this method to set the date value\r\n this.hasSetReleaseDate=true;\r\n }", "public StockEvent setDate(Date date) {\n this.date = date;\n return this;\n }", "public void setDate(int dt) {\n date = dt;\n }", "public void setDate(Date date) {\n if (date != null) {\n this.mDate = (Date) date.clone();\n } else {\n Logger.d(TAG, \"The date is null\");\n }\n }", "@Override\n\tpublic void setCreated_date(Date created_date) {\n\t\t_buySellProducts.setCreated_date(created_date);\n\t}", "@Override\n\tprotected void setDate() {\n\n\t}", "public void setStartDate(Date s);", "public void setDate(int date){\n this.date = date;\n }", "void setCreateDate(Date date);", "public void setDatepr( java.sql.Date newValue ) {\n __setCache(\"datepr\", newValue);\n }", "public void setDate(java.util.Calendar date) {\n this.date = date;\n }", "public void setDate(java.util.Calendar date) {\n this.date = date;\n }", "public void setDueDate(Date d){dueDate = d;}", "public void setDate(Date date) {\n setDate(date, null);\n }", "public void setDate(LocalDate date) {\n\t\tthis.date = date;\n\t}", "abstract public void setServiceAppointment(Date serviceAppointment);", "public void setDate(long date) {\r\n\t\tthis.date = new Date(date);\r\n\t}", "public void setDateInvoice(Date dateInvoice) {\n this.dateInvoice = dateInvoice;\n }", "public void setDate(long value) {\n this.date = value;\n }", "public Date getPrice() {\n return price;\n }", "public void setData (Date date) {\r\n\t\tthis.data=date;\r\n\t\t\r\n\t}", "public void setToDate(Date toDate)\r\n/* 33: */ {\r\n/* 34:39 */ this.toDate = toDate;\r\n/* 35: */ }", "public void setDate(Calendar date)\n {\n this.date = date;\n }", "public void setDate(Date newDate) {\n this.currentDate = newDate;\n }", "@Test(dataProvider = \"date\")\r\n\tpublic void setDate(Date in, Date out) {\n\t\ttoTest.setDate(in);\r\n\t\t// reflect private field name\r\n\t\tField f = getPrivateField(toTest, \"date\");\r\n\t\ttry {\r\n\t\t\tif (in == null) {\r\n\t\t\t\tassertEquals(f.get(toTest), in, \"field should be set to null\");\r\n\t\t\t} else {\r\n\t\t\t\tassertNotSame(f.get(toTest), in, \"field should be a new object\");\r\n\t\t\t}\r\n\r\n\t\t} catch (IllegalArgumentException | IllegalAccessException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t}", "public void setDate(Calendar date) {\n\tthis.date = date;\n }", "void setDate(java.lang.String date);", "public void setDate(String date){\n this.date = date;\n }", "void setStartDate(Date startDate);", "protected void setTimeStamp(Date date) {\n\t\tsetPurchaseDate(date);\n\t}", "public void setDate(long date) {\n\t\tthis.date = date;\n\t}", "public void setClosedDate(Date v) \n {\n \n if (!ObjectUtils.equals(this.closedDate, v))\n {\n this.closedDate = v;\n setModified(true);\n }\n \n \n }", "public void setSelectedDate(Date selectedDate);", "public void setDate(String date){\n this.date = date;\n }", "public static void setDate( Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, org.ontoware.rdf2go.model.node.Node value) {\r\n\t\tBase.set(model, instanceResource, DATE, value);\r\n\t}", "public void setDate(String date) {\r\n this.date = date;\r\n }", "public void setDate(DateInfo dates) {\r\n\t\tsuper.setDate(dates);\r\n\t\t//maturityDate = new DateInfo(dates);\r\n\t}", "public void setOrderDate(LocalDate orderDate) {\n try {\n if(orderDate!=null){\n LocalDate newOrderDAte = new LocalDate(orderDate.getMonth(), orderDate.getDay(), orderDate.getYear());\n this.orderDate = newOrderDAte;\n }\n else{\n this.orderDate=new LocalDate();\n throw new SupplyOrderException(\"Invalid date\");\n }\n } catch(SupplyOrderException soe){\n soe.getMessage();\n }\n }", "public void updateDate(Date date);", "public abstract void setDate(Timestamp uneDate);", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setCreateDate(Date createDate);", "public void setCreateDate(Date createDate);", "public void setCreateDate(Date createDate);", "public void setRequestDate(Date requestDate);", "private void setCurrentDate(Date date)\n {\n date.setTime(System.currentTimeMillis());\n }", "public void setEffectiveDate(java.util.Date value);", "public void setDate(Calendar date) {\r\n\t\tthis.date = date;\r\n\t}", "public static void setDate(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, java.util.Calendar value) {\r\n\t\tBase.set(model, instanceResource, DATE, value);\r\n\t}", "void setDate(int index, Date value) throws SQLException;", "private void setDate() {\n\t\tthis.date = Integer.parseInt(this.year + String.format(\"%02d\", this.calenderWeek));\n\n\t}", "public void setDateOfPurchase(Date dateOfPurchase) {\n this.dateOfPurchase = dateOfPurchase;\n }", "@Override\n\t\t\tpublic void setValue(Date value) {\n\t\t\t\tsuper.setValue(value);\n\t\t\t\tstart_cal_date = value.getTime();\n\t\t\t\tinfo_loader.load();\n\t\t\t}", "public void setDepartureDate(Date departureDate);", "public void setDEPARTURE_FROM_LOC_DATE(java.sql.Date value)\n {\n if ((__DEPARTURE_FROM_LOC_DATE == null) != (value == null) || (value != null && ! value.equals(__DEPARTURE_FROM_LOC_DATE)))\n {\n _isDirty = true;\n }\n __DEPARTURE_FROM_LOC_DATE = value;\n }", "private void initializeDate() {\n\t\tfinal Calendar c = Calendar.getInstance();\n\t\tmYear = c.get(Calendar.YEAR);\n\t\tmMonth = c.get(Calendar.MONTH);\n\t\tmDay = c.get(Calendar.DAY_OF_MONTH);\n\t\t\n\t\texpense.setDate(c.getTime());\n\n\t\t// display the current date\n\t\tupdateDateDisplay();\n\t}" ]
[ "0.79007477", "0.7308866", "0.7210995", "0.7093392", "0.7016359", "0.6898449", "0.68672603", "0.68672603", "0.68672603", "0.68672603", "0.68672603", "0.68672603", "0.68672603", "0.68672603", "0.68672603", "0.6830915", "0.6805431", "0.67772484", "0.671422", "0.671422", "0.671422", "0.670325", "0.669871", "0.66865", "0.6655582", "0.66415405", "0.6639031", "0.66048175", "0.65892774", "0.65775305", "0.65623593", "0.65550005", "0.6541595", "0.653543", "0.652641", "0.6505643", "0.64810026", "0.6468542", "0.6468189", "0.64454824", "0.6440939", "0.64376384", "0.6435198", "0.64123124", "0.63994557", "0.6391032", "0.63660526", "0.6364996", "0.6346895", "0.6346895", "0.634112", "0.6340296", "0.6340109", "0.63210857", "0.63188434", "0.6309467", "0.63080174", "0.6295191", "0.62866545", "0.62863165", "0.6277763", "0.6273313", "0.62706494", "0.62700367", "0.6245054", "0.6242523", "0.6237996", "0.6222189", "0.6209909", "0.62082857", "0.6201649", "0.620053", "0.6200377", "0.61960864", "0.61958104", "0.6193404", "0.61784613", "0.61782163", "0.61711556", "0.61711556", "0.61711556", "0.61711556", "0.61711556", "0.6169159", "0.6169159", "0.6169159", "0.6167917", "0.6154702", "0.6118822", "0.61129326", "0.61113065", "0.61112124", "0.61018866", "0.6096802", "0.6095705", "0.6090306", "0.6084229", "0.60808766" ]
0.6806974
18
Set the date object associated with the price using an epoch timestamp.
public void setDate(long date) { this.date = new Date(date); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setEpochDate( String pEpochDate ) {\n mEpochDate = pEpochDate;\n }", "public void setDate(long value) {\n this.date = value;\n }", "public void setPrice(Date price) {\n this.price = price;\n }", "public abstract void setDate(Timestamp uneDate);", "void setDate(Date data);", "public void setDate(long date)\r\n/* 199: */ {\r\n/* 200:299 */ setDate(\"Date\", date);\r\n/* 201: */ }", "public void SetDate(Date date);", "public Builder setDate(long value) {\n bitField0_ |= 0x00000002;\n date_ = value;\n onChanged();\n return this;\n }", "public void setValue(java.util.Date value) {\n this.value = value;\n }", "public void setLicenseDate(java.sql.Timestamp value) {\n\t\tsetValue(org.jooq.example.jaxrs.db.routines.GenerateKey.LICENSE_DATE, value);\n\t}", "protected void setTimeStamp(Date date) {\n\t\tsetPurchaseDate(date);\n\t}", "public void setDate(long date) {\n\t\tthis.date = date;\n\t}", "public static void setDate( Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, org.ontoware.rdf2go.model.node.Node value) {\r\n\t\tBase.set(model, instanceResource, DATE, value);\r\n\t}", "public void setDateDoc (Timestamp DateDoc);", "public void setDateDoc (Timestamp DateDoc);", "public void setDateDoc (Timestamp DateDoc);", "public void setsaledate(Timestamp value) {\n setAttributeInternal(SALEDATE, value);\n }", "public Builder setTradeDate(long value) {\n bitField0_ |= 0x00080000;\n tradeDate_ = value;\n onChanged();\n return this;\n }", "public void setDate(java.util.Date param){\n \n this.localDate=param;\n \n\n }", "public void setDate( org.ontoware.rdf2go.model.node.Node value) {\r\n\t\tBase.set(this.model, this.getResource(), DATE, value);\r\n\t}", "public void setDate(int dt) {\n date = dt;\n }", "public void setServiceDate(java.util.Date value);", "public MF_Price(double price, Date date) {\r\n\t\tthis.price = price;\r\n\t\tthis.date = date;\r\n\t\tthis.company = null;\r\n\t}", "public final void setTimestamp(java.util.Date timestamp)\n\t{\n\t\tsetTimestamp(getContext(), timestamp);\n\t}", "public void setFreezeTimestamp(java.util.Date value);", "public com.luisjrz96.streaming.birthsgenerator.models.BirthInfo.Builder setDate(long value) {\n validate(fields()[5], value);\n this.date = value;\n fieldSetFlags()[5] = true;\n return this;\n }", "public void setTimestamp(Date timestamp) {\r\n this.timestamp = timestamp;\r\n }", "public void setDate() {\n this.date = new Date();\n }", "public void setTimestamp(Date timestamp) {\n this.timestamp = timestamp;\n }", "public void setDateInvoiced (Timestamp DateInvoiced);", "public void setDate(String parName, Date parVal) throws HibException;", "public void setDate(Date date) {\r\n this.date = date;\r\n }", "public void setTimestamp(final Date timestamp) {\r\n mTimestamp = timestamp;\r\n }", "@Test\r\n public void testSetDateEaten()\r\n {\r\n System.out.println(\"setDateEaten\");\r\n Date dateEaten = Date.valueOf(\"1982-04-08\");\r\n FoodBean instance = new FoodBean(5, \"Beans on toast\", \r\n Date.valueOf(\"2014-04-01\"), Time.valueOf(\"10:00:00\"), \r\n 100, 120, 5, 7, 500, 0, 3);\r\n instance.setDateEaten(dateEaten);\r\n assertEquals(dateEaten, instance.getDateEaten());\r\n }", "private void setCurrentDate(Date date)\n {\n date.setTime(System.currentTimeMillis());\n }", "public void setTimestamp(@NonNull Date timestamp) {\n this.timestamp = timestamp;\n }", "public Builder setSettlementDate(long value) {\n bitField0_ |= 0x00040000;\n settlementDate_ = value;\n onChanged();\n return this;\n }", "@Test\r\n\tpublic void testSetDate() {\n\t\tfail(\"Not yet implemented\");\r\n\t}", "public static void setDate(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, java.util.Calendar value) {\r\n\t\tBase.set(model, instanceResource, DATE, value);\r\n\t}", "public void setDate(Date date) {\n\t\n\t\tthis.date = date;\n\t\n\t}", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n if (date != null) {\n this.mDate = (Date) date.clone();\n } else {\n Logger.d(TAG, \"The date is null\");\n }\n }", "Employee setBirthdate(Date birthdate);", "public void setFecha(java.sql.Timestamp newFecha);", "public void setDate(final Date date) {\n this.date = date;\n }", "@Override\n\tprotected void setNextSiegeDate()\n\t{\n\t\tif(_siegeDate.getTimeInMillis() < Calendar.getInstance().getTimeInMillis())\n\t\t{\n\t\t\t_siegeDate = Calendar.getInstance();\n\t\t\t// Осада не чаще, чем каждые 4 часа + 1 час на подготовку.\n\t\t\tif(Calendar.getInstance().getTimeInMillis() - getSiegeUnit().getLastSiegeDate() * 1000L > 14400000)\n\t\t\t\t_siegeDate.add(Calendar.HOUR_OF_DAY, 1);\n\t\t\telse\n\t\t\t{\n\t\t\t\t_siegeDate.setTimeInMillis(getSiegeUnit().getLastSiegeDate() * 1000L);\n\t\t\t\t_siegeDate.add(Calendar.HOUR_OF_DAY, 5);\n\t\t\t}\n\t\t\t_database.saveSiegeDate();\n\t\t}\n\t}", "public void setDate(int date){\n this.date = date;\n }", "public void setDatepr( java.sql.Date newValue ) {\n __setCache(\"datepr\", newValue);\n }", "public void setDate(Date date) {\r\n\t\tthis.date = date;\r\n\t}", "public void setDate(Date date) {\r\n\t\tthis.date = date;\r\n\t}", "public void setDate(Date date) {\r\n\t\tthis.date = date;\r\n\t}", "@Override\n\tprotected void setDate() {\n\n\t}", "public Series setDateTime( Date theDate, TemporalPrecisionEnum thePrecision) {\n\t\tmyDateTime = new DateTimeDt(theDate, thePrecision); \n\t\treturn this; \n\t}", "public void setDate(Date date) {\n if (date != null) {\n this.mDate = (Date) date.clone();\n } else {\n this.mDate = null;\n }\n }", "public IBusinessObject setCreationDate(Timestamp creationDate)\n throws ORIOException;", "public void setStockPriceDate(Date stockPriceDate) {\n this.stockPriceDate = stockPriceDate;\n }", "private void setDate() {\n\t\tthis.date = Integer.parseInt(this.year + String.format(\"%02d\", this.calenderWeek));\n\n\t}", "public void setDate(Date date) {\n\t\tthis._date = date;\n\t}", "public void setDatetest( java.sql.Date newValue ) {\n __setCache(\"datetest\", newValue);\n }", "public void setDateAcct (Timestamp DateAcct);", "public void setDateAcct (Timestamp DateAcct);", "@Override\n\t\t\tpublic void setValue(Date value) {\n\t\t\t\tsuper.setValue(value);\n\t\t\t\tstart_cal_date = value.getTime();\n\t\t\t\tinfo_loader.load();\n\t\t\t}", "public void setDateOrdered (Timestamp DateOrdered);", "public void setValue(SSDate value) {\n box.setValue(value);\n }", "public void setDate(DateTime \n date) {\n this.date = date;\n }", "public MyDate(long inElapsedTime)\n {\n //put in logic here\n elapsedTime = inElapsedTime;\n this.setDate(elapsedTime);\n }", "public void setDate(Date date) {\n\t\t\n\t\tdate_ = date;\n\t}", "public void setDate(int day, int month, int year, int hour, int minute) // Maybe\n\n {\n this.day = day;\n this.month = month;\n this.year = year;\n this.hour = hour;\n this.minute = minute;\n }", "public void setDate(Date date) {\n mDate = date;\n }", "private void setExpiresDate(Date date, long offset)\n {\n date.setTime(System.currentTimeMillis() + offset);\n }", "public void setUpdatedAt(final Date value)\n\t{\n\t\tsetUpdatedAt( getSession().getSessionContext(), value );\n\t}", "void setCreateDate(Date date);", "public void setData (Date date) {\r\n\t\tthis.data=date;\r\n\t\t\r\n\t}", "public void setTimestamp(long value) {\r\n this.timestamp = value;\r\n }", "public void setId(Date dataInicialCota) {\n\t\tif(dataInicialCota != null){\n\t\t\tthis.dataInicialCota = new Date(dataInicialCota.getTime());\n\t\t} else{\n\t\t\tthis.dataInicialCota = null;\n\t\t}\n\t}", "public abstract void setFecha_ingreso(java.sql.Timestamp newFecha_ingreso);", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "public String getEpochDate() {\n return mEpochDate;\n }", "void setFetchedDate(long time);", "@JsonIgnore\n @DynamoDBAttribute(attributeName=\"createdAt\")\n public void setCreatedAtDD(Long value) {\n setCreatedAt(new Date(value));\n }", "void setDate(int index, Date value) throws SQLException;", "public void set(final Timestamp timestamp) {\n stamp = timestamp.get();\n }", "@JsonIgnore\n @DynamoDBAttribute(attributeName=\"updatedAt\")\n public void setUpdatedAtDD(Long value) {\n setUpdatedAt(new Date(value));\n }", "public void setDate(Date newDate) {\n this.currentDate = newDate;\n }", "public StockEvent setDate(Date date) {\n this.date = date;\n return this;\n }", "void testDateSetDate(java.util.Date date, boolean validate) {\n if (date instanceof java.sql.Time) { return; } // java.sql.Time throws IllegalArgumentException in setDate().\n \n if (validate) {\n assertEqualDate(createDate(\"Feb 03, 2006\"), date);\n } else {\n synchronized (date) {\n date.setDate(3);\n }\n }\n }", "public Builder setExpirationDate(long value) {\n\n expirationDate_ = value;\n bitField0_ |= 0x00000020;\n onChanged();\n return this;\n }", "public void setMovementDate (Timestamp MovementDate);", "public void setDate(Date date) {\r\n \t\tthis.startDate = date;\r\n \t}", "public void setDate(Date date) {\n setDate(date, null);\n }" ]
[ "0.67036706", "0.6677921", "0.6647821", "0.6636595", "0.64378726", "0.6128006", "0.6096323", "0.60683924", "0.6045989", "0.5986934", "0.5981159", "0.5903701", "0.58926535", "0.5876467", "0.5876467", "0.5876467", "0.58672154", "0.58238477", "0.58214134", "0.5812262", "0.580509", "0.5787912", "0.5787613", "0.5766026", "0.5728349", "0.57213295", "0.5717939", "0.5696858", "0.5696785", "0.5645578", "0.5644634", "0.5643509", "0.5643291", "0.5642746", "0.5637184", "0.562778", "0.5624253", "0.561966", "0.5613071", "0.55945045", "0.55872536", "0.55872536", "0.55872536", "0.55872536", "0.55872536", "0.55872536", "0.55872536", "0.55872536", "0.55872536", "0.55432993", "0.554144", "0.5535477", "0.5533076", "0.55281216", "0.55257696", "0.5524348", "0.5524308", "0.5524308", "0.5524308", "0.55238307", "0.551859", "0.55112445", "0.5510786", "0.5510509", "0.5502116", "0.5495408", "0.5495026", "0.54825217", "0.54825217", "0.5481402", "0.5476159", "0.54698056", "0.5466954", "0.5466356", "0.54648465", "0.54580444", "0.5456047", "0.54400027", "0.5426429", "0.54188496", "0.5416577", "0.5415201", "0.5410952", "0.5401857", "0.53983593", "0.53983593", "0.53983593", "0.5380777", "0.53766936", "0.53729403", "0.5363482", "0.53592193", "0.53588676", "0.5348978", "0.5339335", "0.533753", "0.53361917", "0.5329526", "0.53230613", "0.5322102" ]
0.6317789
5
Set the date associated with the price from java.util.date Returns the name of the company where the price was found.
public String getCompany() { return company; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setPrice(Date price) {\n this.price = price;\n }", "public MF_Price(double price, Date date) {\r\n\t\tthis.price = price;\r\n\t\tthis.date = date;\r\n\t\tthis.company = null;\r\n\t}", "public void setCarbuydate(Date carbuydate) {\n this.carbuydate = carbuydate;\n }", "public void setStockPriceDate(Date stockPriceDate) {\n this.stockPriceDate = stockPriceDate;\n }", "public void setCarprodate(Date carprodate) {\n this.carprodate = carprodate;\n }", "void setDate(java.lang.String date);", "public Companies(String name, String date, double highPrice, double lowPrice, double crazyDay) {\r\n this.name = name;\r\n this.date = date;\r\n this.lowPrice = lowPrice;\r\n this.highPrice = highPrice;\r\n this.crazyValue = crazyDay;\r\n }", "public void SetDate(Date date);", "public void setDate(Date date) {\r\n this.date = date;\r\n }", "public void setDate(Date date) {\r\n\t\tthis.date = date;\r\n\t}", "public void setDate(Date date) {\r\n\t\tthis.date = date;\r\n\t}", "public void setDate(Date date) {\r\n\t\tthis.date = date;\r\n\t}", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setDate(Date date) {\n this.date = date;\n }", "public void setBuyDate(Date buyDate) {\n\t\tthis.buyDate = buyDate;\n\t}", "public void setDate(Date date) {\n\t\n\t\tthis.date = date;\n\t\n\t}", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "public void setDate(Date date) {\n\t\tthis.date = date;\n\t}", "void setInvoicedDate(Date invoicedDate);", "public void setDate(LocalDate date) {\n this.date = date;\n }", "public MF_Price(double price, String company) {\r\n\t\tthis.price = price;\r\n\t\tthis.company = company;\r\n\t\tthis.date = Calendar.getInstance().getTime();\r\n\t}", "public void setServiceDate(java.util.Date value);", "public void setDateOfPurchase(Date dateOfPurchase) {\n this.dateOfPurchase = dateOfPurchase;\n }", "public void setDate(Date date) {\n\t\t\n\t\tdate_ = date;\n\t}", "public void setDate(LocalDate date) {\n\t\tthis.date = date;\n\t}", "void setDate(Date data);", "public Date getPrice() {\n return price;\n }", "public void setDate(String date) {\r\n this.date = date;\r\n }", "public void setTradeDate(Date tradeDate) {\r\n this.tradeDate = tradeDate;\r\n }", "public void setDate(Date date) {\n\t\tthis._date = date;\n\t}", "void setFoundingDate(java.lang.String foundingDate);", "public void setDate(java.lang.String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(String date) {\n this.date = date;\n }", "public void setDate(final Date date) {\n this.date = date;\n }", "public void setDate(String date){\n this.date = date;\n }", "public void setDate(String date){\n this.date = date;\n }", "public void setDateInvoice(Date dateInvoice) {\n this.dateInvoice = dateInvoice;\n }", "public void setDate(String date) {\n\t\tthis.date = date;\n\t}", "public void setDate(String date) {\n\t\tthis.date = date;\n\t}", "public Date getCarbuydate() {\n return carbuydate;\n }", "private void setSaleDateField2() {\n // Create a DatePickerDialog and manage it\n mSaleDatePickerDialog2 = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {\n public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {\n Calendar newDateEntryOfTheMarket = Calendar.getInstance();\n newDateEntryOfTheMarket.set(year, monthOfYear, dayOfMonth);\n\n // Update entryDate in ViewModel\n mSearchEstateViewModel.getDateSale2().setValue(newDateEntryOfTheMarket);\n }\n\n },newCalendar.get(Calendar.YEAR), newCalendar.get(Calendar.MONTH),\n newCalendar.get(Calendar.DAY_OF_MONTH));\n }", "private void setSaleDateField1() {\n // Create a DatePickerDialog and manage it\n mSaleDatePickerDialog1 = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {\n public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {\n Calendar newDateEntryOfTheMarket = Calendar.getInstance();\n newDateEntryOfTheMarket.set(year, monthOfYear, dayOfMonth);\n\n // Update entryDate in ViewModel\n mSearchEstateViewModel.getDateSale1().setValue(newDateEntryOfTheMarket);\n }\n\n },newCalendar.get(Calendar.YEAR), newCalendar.get(Calendar.MONTH),\n newCalendar.get(Calendar.DAY_OF_MONTH));\n }", "public void setDate(String newDate)\n\t{\n\t\tthis.date = newDate;\n\t}", "public Date getStockPriceDate() {\n return stockPriceDate;\n }", "public void setDate(String parName, Date parVal) throws HibException;", "@Override\n\tpublic void setCreated_date(Date created_date) {\n\t\t_buySellProducts.setCreated_date(created_date);\n\t}", "public void setLocalPurchaseDate (Date date)\t{\n\t\tmLocalPurchaseDate = date;\n\t}", "public void setDate(java.util.Date param){\n \n this.localDate=param;\n \n\n }", "public void setDueDate(Date d){dueDate = d;}", "public void setDate (String s) {\n date = s;\n }", "public void setDate(Calendar date) {\n\tthis.date = date;\n }", "public void setCommencDate(Date commencDate) {\n this.commencDate = commencDate;\n }", "void setDateOfBirth(LocalDate dateOfBirth);", "public void setDate(Calendar date)\n {\n this.date = date;\n }", "public void setDate(Date date) {\r\n \t\tthis.startDate = date;\r\n \t}", "public StockEvent setDate(Date date) {\n this.date = date;\n return this;\n }", "public void setDate(Calendar date) {\r\n\t\tthis.date = date;\r\n\t}", "public void setDEPARTURE_FROM_LOC_DATE(java.sql.Date value)\n {\n if ((__DEPARTURE_FROM_LOC_DATE == null) != (value == null) || (value != null && ! value.equals(__DEPARTURE_FROM_LOC_DATE)))\n {\n _isDirty = true;\n }\n __DEPARTURE_FROM_LOC_DATE = value;\n }", "public void setDate(java.util.Calendar date) {\n this.date = date;\n }", "public void setDate(java.util.Calendar date) {\n this.date = date;\n }", "public void setDateOpen(java.lang.String dateOpen)\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.SimpleValue target = null;\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(DATEOPEN$2, 0);\n if (target == null)\n {\n target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(DATEOPEN$2);\n }\n target.setStringValue(dateOpen);\n }\n }", "private void setDate() {\n java.util.Date d1 = new java.util.Date();\n SimpleDateFormat df = new SimpleDateFormat(\"YYYY-MM-dd\");\n String formateDate = df.format(d1);\n lblDate.setText(formateDate); \n }", "public void setOrderDate(LocalDate orderDate) {\n try {\n if(orderDate!=null){\n LocalDate newOrderDAte = new LocalDate(orderDate.getMonth(), orderDate.getDay(), orderDate.getYear());\n this.orderDate = newOrderDAte;\n }\n else{\n this.orderDate=new LocalDate();\n throw new SupplyOrderException(\"Invalid date\");\n }\n } catch(SupplyOrderException soe){\n soe.getMessage();\n }\n }", "Employee setBirthdate(Date birthdate);", "public void setDate(Date date) {\n mDate = date;\n }", "public void setPurchaseDate(String d)\n {\n this.purchaseDate = d;\n }", "public void setReleaseDate(Date date) {\r\n this.releaseDate = date;\r\n // set the fact we have called this method to set the date value\r\n this.hasSetReleaseDate=true;\r\n }", "public void setDateOfBirth(LocalDate dateOfBirth) {\n this.dateOfBirth = dateOfBirth;\n }", "public void setDate(long date) {\n\t\tthis.date = date;\n\t}", "public void setDatepr( java.sql.Date newValue ) {\n __setCache(\"datepr\", newValue);\n }", "public void setOpenDate(LocalDate date){\n\t\topenDate = date;\n\t}", "public void setHire_date(Date hire_date) {\n this.hire_date = hire_date;\n }", "public abstract MarketDataBox<LocalDate> getValuationDate();", "public void setDate(Date newDate) {\n this.currentDate = newDate;\n }", "public void setCompany(String company)\r\n {\r\n m_company = company;\r\n }", "public final void setDate(LocalDate date) {\n dateProperty().set(date);\n }", "public void setDate() {\n this.date = new Date();\n }", "public void setClosedDate(Date v) \n {\n \n if (!ObjectUtils.equals(this.closedDate, v))\n {\n this.closedDate = v;\n setModified(true);\n }\n \n \n }", "public Companies(String name, String date, double closingPrice, double futureOpeningPrice, double twoToOneSplit,\r\n double threeToOneSplit, double threeToTwoSplit) {\r\n this.name = name;\r\n this.date = date;\r\n this.closingPrice = closingPrice;\r\n this.futureOpeningPrice = futureOpeningPrice;\r\n this.twoToOneSplit = twoToOneSplit;\r\n this.threeToOneSplit = threeToOneSplit;\r\n this.threeToTwoSplit = threeToTwoSplit;\r\n }", "public void setDate(int dt) {\n date = dt;\n }", "public void setDate(DateTime \n date) {\n this.date = date;\n }", "public void xsetDateOpen(org.apache.xmlbeans.XmlString dateOpen)\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.XmlString target = null;\n target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(DATEOPEN$2, 0);\n if (target == null)\n {\n target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(DATEOPEN$2);\n }\n target.set(dateOpen);\n }\n }", "public void setDateClose(java.lang.String dateClose)\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.apache.xmlbeans.SimpleValue target = null;\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(DATECLOSE$4, 0);\n if (target == null)\n {\n target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(DATECLOSE$4);\n }\n target.setStringValue(dateClose);\n }\n }", "public void setDate(int date){\n this.date = date;\n }", "void setBirthDate(Date birthDate);", "public void setDate(Date date) {\n if (date != null) {\n this.mDate = (Date) date.clone();\n } else {\n Logger.d(TAG, \"The date is null\");\n }\n }", "@Override\n public void onDateSet(DatePicker view, int year, int monthOfYear,\n int dayOfMonth) {\n myCalendar.set(Calendar.YEAR, year);\n myCalendar.set(Calendar.MONTH, monthOfYear);\n myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);\n updateLabel(expireDateEditText);\n\n // TODO: is ther better way to get date?\n GregorianCalendar gc = new GregorianCalendar(TimeZone.getDefault());\n gc.clear();\n gc.set(year, monthOfYear, dayOfMonth, 23, 59, 0);\n Log.d(\"set expire date: \", \"mItem: \" + mItem);\n if (mItem != null) {\n mItem.setExpirationDate(gc.getTimeInMillis());\n SimpleDateFormat sdf = new SimpleDateFormat();\n sdf.setTimeZone(TimeZone.getDefault());\n Log.d(\"get purchase date: \", sdf.format(new Date(mItem.getPurchaseDate())));\n Log.d(\"get expiration date: \", sdf.format(new Date(mItem.getExpirationDate())));\n\n }\n }", "public Date getCarprodate() {\n return carprodate;\n }", "public void setDate(Date date) {\n if (date != null) {\n this.mDate = (Date) date.clone();\n } else {\n this.mDate = null;\n }\n }" ]
[ "0.67745936", "0.6474492", "0.63036066", "0.61712086", "0.59812903", "0.5776619", "0.5763828", "0.57501173", "0.5741603", "0.57342196", "0.57342196", "0.57342196", "0.57309514", "0.57309514", "0.57309514", "0.57309514", "0.57309514", "0.57309514", "0.57309514", "0.57309514", "0.57309514", "0.5729503", "0.5724671", "0.56953716", "0.56953716", "0.56953716", "0.56881946", "0.5672999", "0.56297517", "0.56238955", "0.5608547", "0.56057245", "0.5592966", "0.5589573", "0.5586172", "0.5568621", "0.55669194", "0.55652004", "0.55621314", "0.5557679", "0.55551404", "0.55551404", "0.55551404", "0.55551404", "0.55551404", "0.5542342", "0.55368966", "0.55281144", "0.5504441", "0.5499791", "0.5499791", "0.54983175", "0.54932845", "0.5482757", "0.5478154", "0.5470562", "0.5468269", "0.5462498", "0.5460343", "0.54511434", "0.54363704", "0.5426819", "0.54251134", "0.54245126", "0.54202175", "0.5411865", "0.54118246", "0.5395867", "0.53935516", "0.53835344", "0.53744596", "0.53744596", "0.53732145", "0.53688735", "0.5328895", "0.532781", "0.5325464", "0.52845526", "0.5274387", "0.5274196", "0.5273114", "0.5270042", "0.5262098", "0.52603304", "0.5257824", "0.5245187", "0.5237022", "0.5231797", "0.52257866", "0.521684", "0.5215316", "0.52104944", "0.5206005", "0.52030516", "0.52023864", "0.52004576", "0.51989734", "0.51962554", "0.5188711", "0.5187841", "0.51861954" ]
0.0
-1
Sets the name of the company where the price was found.
public void setCompany(String company) { this.company = company; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setCompanyName(String name) {\n this.companyName = name;\n }", "public void setCompanyname(java.lang.String newCompanyname) {\n\tcompanyname = newCompanyname;\n}", "public void setCompany(String company)\r\n {\r\n m_company = company;\r\n }", "public void setCompany(String company) {\n this.company = company;\n }", "public void setCompanyName(String companyName) {\r\n this.companyName = companyName;\r\n }", "public void setCompanyName(String companyName) {\r\n this.companyName = companyName;\r\n }", "public void setCompanyName(String companyName) {\n this.companyName = companyName;\n }", "public Builder setCompanyName(\n java.lang.String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n companyName_ = value;\n onChanged();\n return this;\n }", "public Builder setCompanyName(\n java.lang.String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n companyName_ = value;\n onChanged();\n return this;\n }", "public Builder setCompany(\n java.lang.String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n company_ = value;\n onChanged();\n return this;\n }", "public void setCompany(String company) {\n\t\tthis.company = company;\n\t}", "public void setCompany(Company aCompany) {\n company = aCompany;\n }", "public void setCompany(String company) {\n\t\tthis.company = StringUtils.trimString( company );\n\t}", "public void setCompany(final String value)\n\t{\n\t\tsetCompany( getSession().getSessionContext(), value );\n\t}", "public void setCompanyName(String companyName) {\r\n\t\tthis.companyName = companyName;\r\n\t}", "public void setCompanyName (java.lang.String companyName) {\n\t\tthis.companyName = companyName;\n\t}", "public GoldenContactBuilder company(String value) {\n company = value;\n return this;\n }", "static String editCompany()\n {\n if(companyName !=null) companyName = \"IBM\";\n return companyName;\n }", "public void setSCompanyName(String sCompanyName) {\n this.sCompanyName = sCompanyName;\n }", "public void setCompanyName(String companyName) {\n\t\tthis.companyName = companyName;\n\t}", "public void setCompanyName(String companyName) {\r\n this.companyName = companyName == null ? null : companyName.trim();\r\n }", "public void enterCompanyName(String companyName) {\n Reporter.addStepLog(\"Enter company name \" + companyName + \" to company's name field \" + _companyNameField.toString());\n sendTextToElement(_companyNameField, companyName);\n log.info(\"Enter company name \" + companyName + \" to company's name field \" + _companyNameField.toString());\n }", "public void setCompanyName(String companyName) {\n this.companyName = companyName == null ? null : companyName.trim();\n }", "public AirlineCompany(final String name) {\n\t\tthis.setName(name);\n\t}", "public void setCarCompany(String carCompany) {\n\t\tthis.carCompany = carCompany;\n\t}", "public void setCompanyname(String companyname) {\n this.companyname = companyname == null ? null : companyname.trim();\n }", "public String getCompanyName() {\r\n return companyName;\r\n }", "public String getCompanyName() {\r\n return companyName;\r\n }", "public String getCompanyName() {\r\n return companyName;\r\n }", "public String getCompanyname() {\n return companyname;\n }", "public void setCompany(final SessionContext ctx, final String value)\n\t{\n\t\tsetProperty(ctx, COMPANY,value);\n\t}", "public Company(String s)\n\t{\n\t\tname = s;\n\t}", "public void setPriceName(String PriceName) {\n this.PriceName = PriceName;\n }", "public void companyName(String name) {\n\t\tSystem.out.println(\"One argument\");\n\t\tSystem.out.println(\"Name:\"+name);\n\t}", "java.lang.String getCompanyName();", "java.lang.String getCompanyName();", "public void inputToCompany(String companyName) {\n\t\twaitToElementVisible(driver,RegisterPageUI.COMPANY_TEXTBOX);\n\t\tsendkeyToElement(driver, RegisterPageUI.COMPANY_TEXTBOX, companyName);\n\t}", "public void search_company(String compName) {\n\t\tint count=0;\n\t\tfor(int i=0 ; i<company.size() ; i++) {\n\t\t\tcompany_info c = (company_info)company.get(i);\n\t\t\tif(compName.equals(c.name)) {\n\t\t\t\tcount=1;\n\t\t\t\tc.Compute_wage();\n\t\t\t\tmapping.put(c.name, c);\n\t\t\t}\n\t\t}\n\t\tif(count==0) {\n\t\t\tSystem.out.println(\"The Company name doesn't exist\");\n\t\t}\n\t}", "public String getCompanyName() {\n return companyName;\n }", "public String getCompanyName() {\n return companyName;\n }", "public String getCompanyName() {\n return companyName;\n }", "public String getCompanyName() {\n return companyName;\n }", "public String getCompanyName() {\r\n\t\treturn companyName;\r\n\t}", "public void setCompany(java.lang.Integer newCompany) {\n\tcompany = newCompany;\n}", "public String getCompany() {\n return company;\n }", "protected static void updateName(Company company, String newName) {\n String followersString = \"{\";\n for (User follower : company.getFollowersList()) {\n followersString += follower.getUsername() + \",\";\n }\n followersString = Utils.removeStartEndChars(followersString);\n String [] strings = Utils.splitCommas(followersString);\n\n for (String follower : strings) {\n try {\n Connection connection = DriverManager.getConnection(secrets.getUrl(), secrets.getUsername(), secrets.getPassword());\n Statement statement = connection.createStatement();\n String query = String.format(\"SELECT * FROM users WHERE username='%s'\", follower);\n ResultSet result = statement.executeQuery(query);\n\n while (result.next()) {\n String companiesList = result.getString(\"companies\");\n companiesList = Utils.parseString(companiesList);\n String [] companies = Utils.splitCommas(Utils.removeStartEndChars(companiesList));\n companiesList = \"{\";\n\n for (int j=0; j<companies.length; j++) {\n if (companies[j].equals(company.getName())) companies[j] = newName;\n\n companiesList += companies[j] + \",\";\n }\n companiesList = Utils.removeEndChar(companiesList) + \"}\";\n query = String.format(\"UPDATE users SET companies='%s' WHERE username='%s'\", companiesList, follower);\n updateDBWithQuery(query);\n }\n\n // close connection to db\n connection.close();\n } catch (Exception e) {\n e.printStackTrace();\n\n return;\n }\n }\n\n String networksList = \"{\";\n for (Company network : company.getNetworksList()) {\n networksList += network.getName() + \",\";\n }\n\n networksList = Utils.removeStartEndChars(networksList);\n String [] networks = Utils.splitCommas(networksList);\n\n for (String networkName : networks) {\n try {\n Connection connection = DriverManager.getConnection(secrets.getUrl(), secrets.getUsername(), secrets.getPassword());\n Statement statement = connection.createStatement();\n String query = String.format(\"SELECT * FROM companies WHERE name='%s'\", networkName);\n ResultSet result = statement.executeQuery(query);\n\n while (result.next()) {\n String networksNetworksList = result.getString(\"network_list\");\n networksNetworksList = Utils.parseString(networksNetworksList);\n String [] companies = Utils.splitCommas(Utils.removeStartEndChars(networksNetworksList));\n networksNetworksList = \"{\";\n\n for (int j=0; j<companies.length; j++) {\n if (companies[j].equals(company.getName())) companies[j] = newName;\n\n networksNetworksList += companies[j] + \",\";\n }\n networksNetworksList = Utils.removeEndChar(networksNetworksList) + \"}\";\n query = String.format(\"UPDATE companies SET network_list='%s' WHERE name='%s'\", networksNetworksList, networkName);\n updateDBWithQuery(query);\n }\n\n } catch (Exception e) {\n e.printStackTrace();\n\n return;\n }\n }\n\n String query = String.format(\"UPDATE companies SET name='%s' WHERE name='%s'\", newName, company.getName());\n updateDBWithQuery(query);\n }", "public String getCompany() {\n return company;\n }", "public String getCompany() {\n return company;\n }", "public String getCompanyName() {\n\t\treturn companyName;\n\t}", "public String getCompanyName() {\r\n\r\n\t\treturn this.companyName;\r\n\t}", "public String getCompany() {\r\n\t\treturn company;\r\n\t}", "@When(\"^I set the FI Name dropdown under PM-Companies to (.*)$\")\n public void iSetTheFINameDropdownUnderPMCompaniesToValue(String SearchText) throws Throwable {\n\n companySearch = new CompanySearch(getDriver());\n // Set the FI Dropdown\n companySearch.SetCompanyFIDropdown(SearchText);\n }", "public void setPrimaryCompanyName(String primaryCompanyName) {\r\n this.primaryCompanyName = primaryCompanyName;\r\n }", "public void setSrcCompany(String value) {\r\n setAttributeInternal(SRCCOMPANY, value);\r\n }", "public Company(Company other) {\n\t\tsuper(); // super(this) is there is a polymorphism\n\t\tthis.name = other.name;\n\t\t// todo:\n\t\t// this.members = ??\n\t\t// this.cars = ??\n\t\n\t}", "@Override\r\n\tpublic void setCompanyData(RentCompanyData companyData) {\n\r\n\t}", "public static final String getCompany() { return company; }", "public String getCompany() {\n\t\treturn company;\n\t}", "public String getCompany() {\n\t\treturn company;\n\t}", "public void setCompany(com.hps.july.persistence.CompanyAccessBean newCompanies) throws Exception {\n\tif (newCompanies == null) {\n\t companycode = null;\n\t companyname = \"\";\n\t}\n\telse {\n\t\tcompanycode = new Integer(newCompanies.getCompany());\n\t\tcompanyname = newCompanies.getName();\n\t}\n}", "public void setDocumentCompany(java.lang.String documentCompany) {\n this.documentCompany = documentCompany;\n }", "public void setCompany(SSNewCompany iCompany) {\n this.iCompany = iCompany;\n\n iTaxRate1.setValue( iCompany.getTaxRate1() );\n iTaxRate2.setValue( iCompany.getTaxRate2() );\n iTaxRate3.setValue( iCompany.getTaxRate3() );\n }", "@Override\r\n\tpublic void updateCompany(Company company) throws CouponSystemException {\r\n\t\tConnection con = null;\r\n\t\ttry {\r\n\t\t\tcon = ConnectionPool.getInstance().getConnection();\r\n\t\t\tString sql = \"update companies set companyName=?, companyEmail=?, companyPass=? \" + \"where companyId=\"\r\n\t\t\t\t\t+ company.getCompId();\r\n\t\t\tPreparedStatement pstmt = con.prepareStatement(sql);\r\n\t\t\tpstmt.setString(1, company.getCompName());\r\n\t\t\tpstmt.setString(2, company.getCompEmail());\r\n\t\t\tpstmt.setString(3, company.getCompPass());\r\n\t\t\tpstmt.executeUpdate();\r\n\r\n\t\t} catch (SQLException e) {\r\n\t\t\tthrow new CouponSystemException(\"updateCompany Failed\", e);\r\n\t\t} finally {\r\n\t\t\tif (con != null) {\r\n\t\t\t\tConnectionPool.getInstance().restoreConnection(con);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void setContactCompany(String contactCompany) {\n this.contactCompany = contactCompany;\n }", "public String getCompanyName() {\n\t\treturn companyName + \"\\\"\";\n\t}", "public static String getCompanyName() {\n\t\treturn CompanyName;\n\t}", "public void SetCheckoutRegistrationcompanyname(String compname){\r\n\t\tString Companyname = getValue(compname);\r\n\t\tclass Local {};\r\n\t\tReporter.log(\"TestStepComponent\"+Local.class.getEnclosingMethod().getName());\r\n\t\tReporter.log(\"TestStepInput:-\"+Companyname);\r\n\t\tReporter.log(\"TestStepOutput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepExpectedResult:- Registration company name should be entered as '\"+Companyname+\"' \");\r\n\t\ttry{\r\n\r\n\t\t\tsendKeys(locator_split(\"txtcheckoutregistrationcompanyname\"),Companyname);\r\n\t\t\tSystem.out.println(\"Registration company name is entered as '\"+Companyname+\"' \");\r\n\t\t\tReporter.log(\"PASS_MESSAGE:- Registration company name is entered as '\"+Companyname+\"' \");\r\n\r\n\t\t}\r\n\t\tcatch(Exception e){\r\n\t\t\tReporter.log(\"FAIL_MESSAGE:- Registration company name is not entered\");\r\n\t\t\tthrow new NoSuchElementException(\"The element with \"\r\n\t\t\t\t\t+ elementProperties.getProperty(\"txtcheckoutregistrationcompanyname\").toString().replace(\"By.\", \" \")\r\n\t\t\t\t\t+ \" not found\");\r\n\t\t}\r\n\r\n\t}", "public Builder setCompanyNameBytes(\n com.google.protobuf.ByteString value) {\n if (value == null) {\n throw new NullPointerException();\n }\n checkByteStringIsUtf8(value);\n \n companyName_ = value;\n onChanged();\n return this;\n }", "public Builder setCompanyNameBytes(\n com.google.protobuf.ByteString value) {\n if (value == null) {\n throw new NullPointerException();\n }\n checkByteStringIsUtf8(value);\n \n companyName_ = value;\n onChanged();\n return this;\n }", "public java.lang.String getCompanyname() {\n\treturn companyname;\n}", "public void setName (String name){\n \n boyName = name;\n }", "public java.lang.String getCompanyName () {\n\t\treturn companyName;\n\t}", "@java.lang.Override\n public java.lang.String getCompany() {\n java.lang.Object ref = company_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n company_ = s;\n return s;\n }\n }", "public void setName (Product product) {\n\t\tproductNameLbl.setText(product.getName());\n\t\tproductNameLbl.repaint();\n\t}", "public void updateCompany(Company company) throws Exception {\n\t\tConnection connection = null;\n\t\tPreparedStatement preparedStatement = null;\n\n\t\ttry {\n\t\t\t// Establish a connection from the connection manager\n\t\t\tconnection = JdbcUtils.getConnection();\n\n\t\t\t// Creating the SQL query\n\t\t\t// CompanyID is defined as a primary key and auto incremented\n\t\t\tString sqlStatement = \"UPDATE `javaproject`.`companies` SET `Company_NAME` = ? WHERE `Company_ID` = ?;\";\n\n\t\t\t// Combining between the syntax and our connection\n\t\t\tpreparedStatement = connection.prepareStatement(sqlStatement);\n\n\t\t\t// Replacing the question marks in the statement above with the relevant data\n\t\t\tpreparedStatement.setString(1, company.getName());\n\t\t\tpreparedStatement.setLong(2, company.getId());\n\t\t\t\n\t\t\t// Executing the update\n\t\t\tpreparedStatement.executeUpdate();\n\n\t\t} catch (SQLException e) {\n\t\t\t// **If there was an exception in the \"try\" block above, it is caught here and\n\t\t\t// notifies a level above.\n\t\t\te.printStackTrace();\n\t\t\tthrow new ApplicationException(e,ErrorType.GENERAL_ERROR,\n\t\t\t\t\tDateUtils.getCurrentDateAndTime() + \"FAILED to Update a company\");\n\t\t} finally {\n\t\t\t// Closing the resources\n\t\t\tJdbcUtils.closeResources(connection, preparedStatement);\n\t\t}\n\t}", "public String getCompany() {\n return (String) get(\"company\");\n }", "public void setCompanycode(java.lang.Integer newCompany) {\n\tcompanycode = newCompany;\n}", "public java.lang.String getCompanyName() {\n java.lang.Object ref = companyName_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n companyName_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getCompanyName() {\n java.lang.Object ref = companyName_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n companyName_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public Company(String name, Optional<Office> office) {\n this.name = name;\n this.office = office;\n }", "public java.lang.String getCompany() {\n java.lang.Object ref = company_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n company_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public String getSCompanyName() {\n return sCompanyName;\n }", "public void setJdCompany(String jdCompany) {\r\n\t\tthis.jdCompany = jdCompany;\r\n\t}", "public void setCompanyId(String companyId) {\r\n this.companyId = companyId;\r\n }", "public void setCompanyId(String companyId) {\r\n this.companyId = companyId;\r\n }", "public static void setName(String name) {\n catalogue.name = name;\n }", "public String getCompany()\r\n {\r\n return (m_company);\r\n }", "@Override\r\n\tpublic Company updateCompany(Company company) {\n\t\treturn null;\r\n\t}", "String getCompany();", "public String findCompany(String symbol)\n {\n for (int i = 0; i < symbolPairs.size(); i++)\n {\n SymbolPair pair = symbolPairs.get(i);\n if (pair.getTickerSymbol().equals(symbol))\n {\n return pair.getCompanyName();\n }\n }\n return \"Ticker symbol not recognized!\";\n }", "public CustomerSetCompanyNameActionBuilder companyName(@Nullable final String companyName) {\n this.companyName = companyName;\n return this;\n }", "public String getCarCompany() {\n\t\treturn carCompany;\n\t}", "public void add (String nameComp) {\n if(!contains(nameComp))\n listWantedCompany.add(nameComp);\n }", "public void setName(String newname){\n name = newname; \n }", "public Builder clearCompanyName() {\n \n companyName_ = getDefaultInstance().getCompanyName();\n onChanged();\n return this;\n }", "public Builder clearCompanyName() {\n \n companyName_ = getDefaultInstance().getCompanyName();\n onChanged();\n return this;\n }", "public java.lang.String getCompanyName() {\n java.lang.Object ref = companyName_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n companyName_ = s;\n return s;\n }\n }", "public java.lang.String getCompanyName() {\n java.lang.Object ref = companyName_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n companyName_ = s;\n return s;\n }\n }", "public void setName(String newname)\n {\n name = newname;\n \n }", "public void setCompany(Company company, Context context) {\n // TODO: Perform networking operations here to upload company to database\n this.company = company;\n invoiceController = new InvoiceController(context, company);\n }" ]
[ "0.73885494", "0.72693855", "0.7251847", "0.7112902", "0.70430744", "0.70430744", "0.6958958", "0.6893097", "0.6893097", "0.6880292", "0.68596303", "0.6808528", "0.669248", "0.6591443", "0.65901595", "0.65273887", "0.6511303", "0.64898837", "0.6489414", "0.6400948", "0.63770723", "0.63526577", "0.6352102", "0.6314232", "0.6273315", "0.62486076", "0.62405646", "0.62405646", "0.62405646", "0.623968", "0.62284017", "0.6222276", "0.61975265", "0.61972976", "0.6186641", "0.6186641", "0.61849785", "0.6160057", "0.6157688", "0.6157688", "0.6157688", "0.6157688", "0.6143609", "0.61047405", "0.6089625", "0.6081482", "0.60380054", "0.60380054", "0.6032375", "0.6032113", "0.6029481", "0.6004571", "0.59870166", "0.59426606", "0.5935349", "0.59311306", "0.5904902", "0.5903491", "0.5903491", "0.5903167", "0.5886573", "0.58752114", "0.5874158", "0.5821311", "0.5821224", "0.5788129", "0.5784251", "0.5774519", "0.5774519", "0.57525176", "0.57467943", "0.5714631", "0.5680546", "0.56578904", "0.56567883", "0.56486136", "0.56367034", "0.5627204", "0.5627204", "0.56049496", "0.5600081", "0.5599166", "0.5590814", "0.5579953", "0.5579953", "0.5571092", "0.5559672", "0.5551374", "0.55442154", "0.554406", "0.55362046", "0.5530426", "0.5515949", "0.5514882", "0.5512323", "0.5512323", "0.5500071", "0.5500071", "0.5492236", "0.5469215" ]
0.696432
6
This method is called when the camera is opened. We start camera preview here.
@Override public void onOpened(@NonNull CameraDevice cameraDevice) { mCameraOpenCloseLock.release(); mCameraDevice = cameraDevice; createCameraPreviewSession(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n mCameraDevice = camera;\n startPreview();\n }", "private void startPreview() {\n if (cameraConfigured && camera!=null) {\n camera.startPreview();\n inPreview=true;\n }\n }", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n cameraDevice = camera;\n createCameraPreview();\n }", "public void onCameraOpened() {\n openCameraCommon();\n initializeControlByIntent();\n new Thread() {\n public void run() {\n try {\n Thread.sleep(500);\n PhotoModule.this.mIsCameraOpened = true;\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }.start();\n }", "public void startPreview() {\r\n\t\tCamera localCamera = camera;\r\n\t\tif (localCamera != null && !isPreview) {\r\n\t\t\tcamera.startPreview();\r\n\t\t\tisPreview = true;\r\n\t\t}\r\n\t}", "public synchronized void startPreview() {\n OpenCamera theCamera = camera;\n if (theCamera != null && !previewing) {\n theCamera.getCamera().startPreview();\n previewing = true;\n autoFocusManager = new AutoFocusManager(context, theCamera.getCamera());\n }\n }", "@Override // com.master.cameralibrary.CameraViewImpl\n public boolean start() {\n chooseCamera();\n openCamera();\n if (this.mPreview.isReady()) {\n setUpPreview();\n }\n this.mShowingPreview = true;\n this.mCamera.startPreview();\n return true;\n }", "@Override\n protected void onResume() {\n super.onResume();\n cameraView.start();\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "@Override\n public void onOpened(CameraDevice cameraDevice) {\n mCameraOpenCloseLock.release();\n mCameraDevice = cameraDevice;\n createCameraPreviewSession();\n }", "private void startCameraSource() {\n if (cameraSource != null) {\n try {\n if (cameraPreview == null) {\n Logger.e(TAG, \"Preview is null\");\n }\n cameraPreview.start(cameraSource, fireFaceOverlay);\n } catch (IOException e) {\n// Logger.e(TAG, \"Unable to start camera source.\", e);\n cameraSource.release();\n cameraSource = null;\n }\n }\n }", "@Override\n public void onOpened(@NonNull CameraDevice cameraDevice) {\n mCameraOpenCloseLock.release();\n mCameraDevice = cameraDevice;\n if (null != mTextureView) {\n configureTransform(mTextureView.getWidth(), mTextureView.getHeight());\n }\n createCameraPreviewSession();\n }", "private void startCameraSource() {\n if (cameraSource != null) {\n try {\n if (preview == null) {\n //Log.d(TAG, \"resume: Preview is null\");\n }\n if (graphicOverlay == null) {\n //Log.d(TAG, \"resume: graphOverlay is null\");\n }\n preview.start(cameraSource, graphicOverlay);\n } catch (IOException e) {\n Log.e(TAG, \"Unable to start camera source.\", e);\n cameraSource.release();\n cameraSource = null;\n }\n }\n }", "public void onPreviewStarted() {\n if (!this.mPaused) {\n Log.w(TAG, \"KPI photo preview started\");\n this.mAppController.onPreviewStarted();\n this.mAppController.setShutterEnabled(true);\n this.mAppController.setShutterButtonLongClickable(this.mIsImageCaptureIntent ^ 1);\n this.mAppController.getCameraAppUI().enableModeOptions();\n this.mUI.clearEvoPendingUI();\n if (this.mEvoFlashLock != null) {\n this.mAppController.getButtonManager().enableButtonWithToken(0, this.mEvoFlashLock.intValue());\n this.mEvoFlashLock = null;\n }\n if (this.mCameraState == 7) {\n setCameraState(5);\n } else {\n setCameraState(1);\n }\n if (isCameraFrontFacing()) {\n this.mUI.setZoomBarVisible(false);\n } else {\n this.mUI.setZoomBarVisible(true);\n }\n if (this.mActivity.getCameraAppUI().isNeedBlur() || onGLRenderEnable()) {\n new Handler().postDelayed(new Runnable() {\n public void run() {\n PhotoModule.this.startFaceDetection();\n }\n }, 1500);\n } else {\n startFaceDetection();\n }\n BoostUtil.getInstance().releaseCpuLock();\n if (this.mIsGlMode) {\n this.mActivity.getCameraAppUI().hideImageCover();\n if (this.mActivity.getCameraAppUI().getBeautyEnable()) {\n this.mActivity.getCameraAppUI().getCameraGLSurfaceView().queueEvent(new Runnable() {\n public void run() {\n PhotoModule.this.mActivity.getButtonManager().setSeekbarProgress((int) PhotoModule.this.mActivity.getCameraAppUI().getBeautySeek());\n PhotoModule.this.updateBeautySeek(PhotoModule.this.mActivity.getCameraAppUI().getBeautySeek() / 20.0f);\n }\n });\n }\n if (this.mActivity.getCameraAppUI().getEffectEnable()) {\n this.mActivity.getCameraAppUI().getCameraGLSurfaceView().queueEvent(new Runnable() {\n public void run() {\n if (TextUtils.isEmpty(PhotoModule.this.mActivity.getCameraAppUI().getCurrSelect())) {\n BeaurifyJniSdk.preViewInstance().nativeDisablePackage();\n } else {\n BeaurifyJniSdk.preViewInstance().nativeChangePackage(PhotoModule.this.mActivity.getCameraAppUI().getCurrSelect());\n }\n }\n });\n }\n }\n }\n }", "private void oldOpenCamera() {\n try {\n mCamera = Camera.open(); // attempt to get a Camera instance\n mCamera.setPreviewCallbackWithBuffer(this);\n Log.i(TAG, \"Instance created\");\n } catch (Exception e) {\n Log.e(TAG, \"Error getting Camera instance: \" + e.getMessage());\n }\n }", "private void startCameraSource() {\n\n if (cameraSource != null) {\n try {\n cameraPreview.start(cameraSource, graphicOverlay);\n } catch (IOException e) {\n Log.e(TAG, \"Unable to start camera source.\", e);\n cameraSource.release();\n cameraSource = null;\n }\n }\n\n }", "public void startCamera()\n {\n startCamera(null);\n }", "private void startPreview() {\n if (null == mCameraDevice || !mVideoPreview.isAvailable() || null == mPreviewSize) {\n return;\n }\n try {\n closePreviewSession();\n SurfaceTexture texture = mVideoPreview.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n\n Surface previewSurface = new Surface(texture);\n mPreviewBuilder.addTarget(previewSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface), new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n if (mVideoRecordListener != null) {\n mVideoRecordListener.onRecordingFailed(\"Capture session for previewing video failed.\");\n }\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public void startCameraProcessing() {\n this.checkCameraPermission();\n\n try {\n cameraManager.openCamera(cameraId, new CameraDevice.StateCallback() {\n @Override\n public void onOpened(@NonNull CameraDevice camera) {\n cameraDevice = camera;\n onCameraOpened();\n }\n\n @Override\n public void onDisconnected(@NonNull CameraDevice camera) {\n\n }\n\n @Override\n public void onError(@NonNull CameraDevice camera, int error) {\n System.out.println(\"CAMERA ERROR OCCURRED: \" + error);\n }\n\n @Override\n public void onClosed(@NonNull CameraDevice camera) {\n super.onClosed(camera);\n }\n }, null);\n }\n catch (Exception e) {\n System.out.println(\"CAMERA FAILED TO OPEN\");\n e.printStackTrace();\n }\n }", "private void onShow() {\n if (DEBUG)\n MLog.d(TAG, \"onShow(): \" + printThis());\n\n startBackgroundThread();\n\n // When the screen is turned off and turned back on, the SurfaceTexture is already\n // available, and \"onSurfaceTextureAvailable\" will not be called. In that case, we can open\n // a camera and start preview from here (otherwise, we wait until the surfaceJavaObject\n // is ready in\n // the SurfaceTextureListener).\n if (mTextureView.isAvailable()) {\n openCamera(mTextureView.getWidth(), mTextureView.getHeight());\n } else {\n mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);\n }\n }", "private void onCameraOpened() {\n SurfaceTexture texture = targetView.getSurfaceTexture();\n\n if (texture != null) {\n targetSurface = new Surface(texture);\n onSurfaceReceived();\n }\n else {\n targetView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {\n @Override\n public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {\n targetSurface = new Surface(surfaceTexture);\n onSurfaceReceived();\n }\n public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {\n return false;\n }\n\n @Override\n public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {\n\n }\n\n @Override\n public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) {\n\n }\n });\n }\n }", "void initializeCamera() {\n camera_linear = (LinearLayout) findViewById(R.id.camera_linear);\n //The preview frame is overlayed on the layout which shows the camera view.\n preview = (FrameLayout) findViewById(R.id.camera_preview);\n //Get an instance of the phone's camera.\n mCamera = cameraRecorder.getCameraInstance();\n //Find content fort the camera preview frame using the instance of the camera initialized.\n mPreview = new CameraPreview(getApplicationContext(), mCamera);\n //Apply the camera previes content from the camera to the preview frame itself.\n preview.addView(mPreview);\n }", "@Override\n public void onClick(View v) {\n if (!previewing) {\n camera = Camera.open();\n if (camera != null) {\n try {\n camera.setPreviewDisplay(surfaceHolder);\n camera.startPreview();\n previewing = true;\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n }\n }", "@Override\n public void startCamera() {\n super.startCamera();\n\n if(cameraListener != null)\n cameraListener.onCameraStart();\n }", "@SuppressLint(\"NewApi\")\n protected void startPreview() {\n if(null == mCameraDevice || !mTextureView.isAvailable() || null == mPreviewSize) {\n Log.e(TAG, \"startPreview fail, return\");\n }\n\n SurfaceTexture texture = mTextureView.getSurfaceTexture();\n if(null == texture) {\n Log.e(TAG,\"texture is null, return\");\n return;\n }\n\n texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n Surface surface = new Surface(texture);\n\n try {\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n } catch (CameraAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n mPreviewBuilder.addTarget(surface);\n\n try {\n mCameraDevice.createCaptureSession(Arrays.asList(surface), new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession session) {\n // TODO Auto-generated method stub\n mPreviewSession = session;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession session) {\n // TODO Auto-generated method stub\n Toast.makeText(mContext, \"onConfigureFailed\", Toast.LENGTH_LONG).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "@Override\n public void onOpened(@NonNull CameraDevice cameraDevice) {\n Log.d(TAG, \"Camera opened\");\n\n mImageReader = ImageReader.newInstance(\n CAMERA_RESOLUTION_WIDTH,\n CAMERA_RESOLUTION_HEIGHT,\n ImageFormat.YUV_420_888,\n 1);\n\n mImageReader.setOnImageAvailableListener(mImageAvailableListener, null);\n mCaptureSurface = mImageReader.getSurface();\n try {\n cameraDevice.createCaptureSession(\n Collections.singletonList(mCaptureSurface),\n mCameraCaptureSessionStateCallback,\n null);\n } catch (CameraAccessException cae) {\n throw new RuntimeException(\"Error encountered creating camera capture session\", cae);\n }\n }", "@Override\r\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\tinitialCamera();\r\n\t}", "private void newOpenCamera() {\n if (mThread == null) {\n mThread = new CameraHandlerThread();\n }\n\n synchronized (mThread) {\n mThread.openCamera();\n }\n }", "public void surfaceCreated(SurfaceHolder holder) {\n startCamera(holder);\n }", "protected void startPreview() {\n if (null == mCameraDevice || !mTextureView.isAvailable()) {\n return;\n }\n try {\n //\n // Media Recorder\n //\n setUpMediaRecorder();\n\n //\n // Preview Builder - Video Recording\n //\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n\n //\n // Surfaces: Preview and Record\n //\n List<Surface> surfaces = new ArrayList<>();\n\n //\n // Preview Surface\n //\n SurfaceTexture texture = mTextureView.getSurfaceTexture();\n texture.setDefaultBufferSize(screenWidth, screenHeight);\n Surface previewSurface = new Surface(texture);\n surfaces.add(previewSurface);\n mPreviewBuilder.addTarget(previewSurface);\n\n\n //\n // Record Surface\n //\n Surface recorderSurface = mMediaRecorder.getSurface();\n surfaces.add(recorderSurface);\n mPreviewBuilder.addTarget(recorderSurface);\n\n //\n // Setup Capture Session\n //\n mCameraDevice.createCaptureSession(surfaces, new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n Log.e(TAG, \"onConfigured(CameraCaptureSession cameraCaptureSession) ...\");\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onSurfacePrepared(CameraCaptureSession session, Surface surface) {\n Log.e(TAG, \"onSurfacePrepared(CameraCaptureSession session, Surface surface) ...\");\n //previewView = (LinearLayout) findViewById(R.id.camera_preview);\n //previewView.addView(mVideoCapture.mTextureView);\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n Log.e(TAG, \"onConfigureFailed(CameraCaptureSession cameraCaptureSession) ...\");\n Toast.makeText(mCameraActivity, \"failed to configure video camera\", Toast.LENGTH_SHORT).show();\n onBackPressed();\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@Override\n protected void onStart() {\n camera_ = getCameraInstance();\n Parameters params;\n\n if (camera_ != null) {\n params = camera_.getParameters();\n params.setPreviewFormat(ImageFormat.NV21);\n getSmallestPreviewSize(params);\n params.setPreviewSize(width_, height_);\n //params.setFlashMode(Parameters.FLASH_MODE_TORCH);\n params.setWhiteBalance(Parameters.WHITE_BALANCE_AUTO);\n camera_.setParameters(params);\n\n frame_ = new RGB[width_ * height_];\n for (int i = 0; i < frame_.length; ++i) {\n frame_[i] = new RGB();\n }\n\n camera_.setPreviewCallback(new PreviewCallback() {\n @Override\n public void onPreviewFrame(byte[] data, Camera camera) {\n synchronized (frame_) {\n decodeYUV420SP(frame_, data, width_, height_);\n }\n }\n });\n SurfaceTexture texture_ = new SurfaceTexture(0);\n try {\n camera_.setPreviewTexture(texture_);\n } catch (IOException e) {\n e.printStackTrace();\n }\n camera_.startPreview();\n }\n\n super.onStart();\n }", "public void onPreviewStarted() {\n Log.w(TAG, \"KPI video preview started\");\n this.mAppController.setShutterEnabled(true);\n this.mAppController.onPreviewStarted();\n this.mUI.clearEvoPendingUI();\n if (this.mFocusManager != null) {\n this.mFocusManager.onPreviewStarted();\n }\n if (isNeedStartRecordingOnSwitching()) {\n onShutterButtonClick();\n }\n }", "protected void updatePreview() {\n if (null == mCameraDevice) {\n Toast.makeText(CameraActivity.this, \"Couldn't find Camera\", Toast.LENGTH_SHORT).show();\n }\n mCaptureRequestBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);\n try {\n mCameraCaptureSessions.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "@SuppressLint({\"NewApi\"})\n public void setUpPreview() {\n try {\n if (this.mPreview.getOutputClass() == SurfaceHolder.class) {\n boolean z = this.mShowingPreview && Build.VERSION.SDK_INT < 14;\n if (z) {\n this.mCamera.stopPreview();\n }\n this.mCamera.setPreviewDisplay(this.mPreview.getSurfaceHolder());\n if (z) {\n this.mCamera.startPreview();\n return;\n }\n return;\n }\n this.mCamera.setPreviewTexture((SurfaceTexture) this.mPreview.getSurfaceTexture());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }", "public void onStart() {\n\n mVideoFolder = createVideoFolder();\n mImageFolder = createImageFolder();\n mMediaRecorder = new MediaRecorder();\n\n startBackgroundThread();\n\n if (mTextureView.isAvailable()) {\n // TODO: see Google Example add comments\n // pause and resume\n openCamera(mTextureView.getWidth(), mTextureView.getHeight());\n\n } else {\n // first time\n mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);\n }\n }", "@Override\n public void onOpened(@NonNull CameraDevice cameraDevice) {\n\n mCameraDevice = cameraDevice;\n\n\n try {\n captureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n captureRequestBuilder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_OFF);\n\n } catch(CameraAccessException e) {\n e.printStackTrace();\n }\n\n }", "private void initCameraPreview() {\n\t\tcameraPreview = (CameraPreview) findViewById(R.id.camera_preview);\n\t\tcameraPreview.init(camera);\n\t}", "@Override\n public void onCameraPreviewStarted() {\n enableTorchButtonIfPossible();\n }", "@Override\n public void init() {\n startCamera();\n }", "public void openCamera() {\n Toast.makeText(this, \"Coming soon...\", Toast.LENGTH_SHORT).show();\n }", "public void chooseCamera() {\n if (cameraFront) {\n int cameraId = findBackFacingCamera();\n if (cameraId >= 0) {\n //open the backFacingCamera\n //set a picture callback\n //refresh the preview\n\n mCamera = Camera.open(cameraId);\n setRotation(mCamera, mCamera.getParameters(), cameraId);\n // mCamera.setDisplayOrientation(90);\n mPicture = getPictureCallback();\n mPreview.refreshCamera(mCamera);\n }\n } else {\n int cameraId = findFrontFacingCamera();\n if (cameraId >= 0) {\n //open the backFacingCamera\n //set a picture callback\n //refresh the preview\n mCamera = Camera.open(cameraId);\n setRotation(mCamera, mCamera.getParameters(), cameraId);\n // mCamera.setDisplayOrientation(90);\n mPicture = getPictureCallback();\n mPreview.refreshCamera(mCamera);\n }\n }\n }", "@Override\n protected void onResume() {\n super.onResume();\n cameraLiveView.onResume();\n }", "public void surfaceCreated(SurfaceHolder holder) {\n try {\n if (mCamera == null) {\n mCamera = getCameraInstance();\n }\n holder.addCallback(this);\n mCamera.setPreviewDisplay(holder);\n mCamera.startPreview();\n preview = true;\n } catch (IOException e) {\n Log.d(TAG, \"Error setting camera preview: \" + e.getMessage());\n }\n }", "protected void previewStarted() {\n\n }", "public synchronized void requestPreviewFrame(Camera.PreviewCallback cb) {\n OpenCamera theCamera = camera;\n if (theCamera != null && previewing) {\n theCamera.getCamera().setOneShotPreviewCallback(cb);\n }\n }", "public void openCamera() {\n \n\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);\n setContentView(R.layout.activity_preview1);\n\n mOpenCvCameraView = findViewById(R.id.tutorial1_activity_java_surface_view);\n mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);\n mOpenCvCameraView.setCvCameraViewListener(this);\n\n mOpenCvCameraView.setUseFrontCamera(true);\n mOpenCvCameraView.setDrawSource(false);\n\n\n imageViewPreview = findViewById(R.id.imageViewPreview);\n imageViewPreview2 = findViewById(R.id.imageViewPreview2);\n\n\n }", "@SuppressLint(\"NewApi\")\n protected void updatePreview() {\n if(null == mCameraDevice) {\n Log.e(TAG, \"updatePreview error, return\");\n }\n\n mPreviewBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);\n HandlerThread thread = new HandlerThread(\"CameraPreview\");\n thread.start();\n Handler backgroundHandler = new Handler(thread.getLooper());\n\n try {\n mPreviewSession.setRepeatingRequest(mPreviewBuilder.build(), null, backgroundHandler);\n } catch (CameraAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "private void startCamera() {\n PreviewConfig previewConfig = new PreviewConfig.Builder().setTargetResolution(new Size(640, 480)).build();\n Preview preview = new Preview(previewConfig);\n preview.setOnPreviewOutputUpdateListener(output -> {\n ViewGroup parent = (ViewGroup) dataBinding.viewFinder.getParent();\n parent.removeView(dataBinding.viewFinder);\n parent.addView(dataBinding.viewFinder, 0);\n dataBinding.viewFinder.setSurfaceTexture(output.getSurfaceTexture());\n updateTransform();\n });\n\n\n // Create configuration object for the image capture use case\n // We don't set a resolution for image capture; instead, we\n // select a capture mode which will infer the appropriate\n // resolution based on aspect ration and requested mode\n ImageCaptureConfig imageCaptureConfig = new ImageCaptureConfig.Builder().setCaptureMode(ImageCapture.CaptureMode.MIN_LATENCY).build();\n\n // Build the image capture use case and attach button click listener\n ImageCapture imageCapture = new ImageCapture(imageCaptureConfig);\n dataBinding.captureButton.setOnClickListener(v -> {\n File file = new File(getExternalMediaDirs()[0], System.currentTimeMillis() + \".jpg\");\n imageCapture.takePicture(file, executor, new ImageCapture.OnImageSavedListener() {\n @Override\n public void onImageSaved(@NonNull File file) {\n String msg = \"Photo capture succeeded: \" + file.getAbsolutePath();\n Log.d(\"CameraXApp\", msg);\n dataBinding.viewFinder.post(\n () -> Toast.makeText(CameraXDemo.this, msg, Toast.LENGTH_SHORT).show()\n );\n }\n\n @Override\n public void onError(@NonNull ImageCapture.ImageCaptureError\n imageCaptureError, @NonNull String message, @Nullable Throwable cause) {\n String msg = \"Photo capture failed: \" + message;\n Log.e(\"CameraXApp\", msg, cause);\n dataBinding.viewFinder.post(\n () -> Toast.makeText(CameraXDemo.this, msg, Toast.LENGTH_SHORT).show()\n );\n }\n });\n });\n\n\n // Setup image analysis pipeline that computes average pixel luminance\n ImageAnalysisConfig analyzerConfig = new ImageAnalysisConfig.Builder().setImageReaderMode(\n ImageAnalysis.ImageReaderMode.ACQUIRE_LATEST_IMAGE).build();\n // Build the image analysis use case and instantiate our analyzer\n ImageAnalysis analyzerUseCase = new ImageAnalysis(analyzerConfig);\n analyzerUseCase.setAnalyzer(executor, new LuminosityAnalyzer());\n\n CameraX.bindToLifecycle(this, preview, imageCapture, analyzerUseCase);\n }", "public Boolean startPreview() {\n\n\t\tif (camera != null && !previewing) {\n\t\t\tLog.d(TAG, \"startPreview\");\n\t\t\tcamera.startPreview();\n\t\t\tpreviewing = true;\n\t\t\tif (torch)\n\t\t\t{\n\t\t\t\tLog.d(TAG, \"we need to activate torch \" );\n\t\t\t\tsetTorch(torch);\n\t\t\t}\n\t\t\tautoFocusManager = new AutoFocusManager(context, camera);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "@Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == cameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n cameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }", "@Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == cameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n cameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }", "@Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == cameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n cameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }", "@Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == cameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n cameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }", "@Override\n public void startCameraIntent() {\n Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n startActivityForResult(cameraIntent, PICK_FROM_CAMERA_REQUEST_CODE);\n }", "public static void resume() {\n\n\t\tif (myCurrentCamera != null) {\n\t\t\tmyCurrentCamera = Camera.open();\n\n\t\t\tmyIsInPreview = false;\n\n\t\t\tmyCurrentCamera.setPreviewCallbackWithBuffer(myCallback);\n\n\t\t\tif (myCurrentCamera != null) {\n\t\t\t\tif (myWasPausedInPreview == true) {\n\t\t\t\t\tstart();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == mCameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n mCameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }", "private void startPreview(CameraCaptureSession session) throws CameraAccessException{\n mPreviewBuilder.addTarget(mSurface);\n mPreviewBuilder.addTarget(mImageReader.getSurface());\n session.setRepeatingRequest(mPreviewBuilder.build(), mSessionCaptureCallback, mCamSessionHandler);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n this.requestWindowFeature(Window.FEATURE_NO_TITLE);\n this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);\n setContentView(R.layout.main);\n cameraframe = (FrameLayout) findViewById(R.id.preview);\n overlayview = new ImageView(getApplicationContext());\n\t overlayview.setScaleType(ImageView.ScaleType.FIT_XY);\n\n previewing=false;\n freestyle=false;\n \n\t// set up camera, start button\n cameraView = new Preview(this); // <3>\n\n\t cameraframe.addView(cameraView,0); // <4>\n\n\t \n\t\n\t\n\t setupButtons();\n initCamera();\n \n \n\t\n\t\n\t\n \n\tloadFrames();\n\t initFileSystem();\n\t \n //retakeButton.setEnabled(false);\n\t toggleMode();\n \n Log.d(TAG, \"Fully initialized\");\n }", "protected void setupCameraAndPreview() {\n\n //\n // always release\n //\n releaseImageObjects();\n releaseVideoCapturebjects(true);\n\n // now setup...\n if (isImageButtonSelected) {\n\n //\n // Image Camera can be fetched here\n //\n if (!isBackCameraSelected) {\n mCamera = getCameraInstance(frontCamera);\n } else {\n mCamera = getCameraInstance(backCamera);\n }\n\n if (mImageCapture == null) {\n // Initiate MImageCapture\n mImageCapture = new MImageCapture(MCameraActivity.this);\n }\n\n //\n // Set Orientation\n //\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);\n // Create our Preview view and set it as the content of our activity.\n // Add the copyright as an overlay...\n if (mImageCapture.mCameraPreview == null) {\n previewView = (LinearLayout) findViewById(R.id.camera_preview);\n mImageCapture.setCameraPreview(this, mCamera);\n previewView.addView(mImageCapture.mCameraPreview);\n }\n } else {\n //\n // Set Orientation\n //\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);\n\n /** handle video here... */\n if (mVideoCapture == null) {\n // now start over\n mVideoCapture = new MVideoCapture(this);\n }\n // Create our Preview view and set it as the content of our activity.\n // Add the copyright as an overlay...\n if (mVideoCapture.mTextureView != null) {\n previewView = (LinearLayout) findViewById(R.id.camera_preview);\n previewView.addView(mVideoCapture.mTextureView);\n }\n }\n\n }", "public void startFrontCam() {\n }", "public void surfaceCreated(SurfaceHolder holder) {\n \t// Open camera \n\t\tCameraActivity.mCamera = Camera.open(); \n\t\tCameraActivity.mCamera.setDisplayOrientation(90);\n\t\t\n // The Surface has been created, now tell the camera where to draw the preview.\n try {\n\t\t\tCameraActivity.mCamera.setPreviewDisplay(holder);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n CameraActivity.mCamera.startPreview();\n }", "private void setCamera() {\n\t\tCamera.CameraInfo cameraInfo = new Camera.CameraInfo();\n\t\tint cameraCount = Camera.getNumberOfCameras();\n\t\tLog.i(TAG, \"count = \" + cameraCount);\n\t\tLog.i(TAG, \"isBack = \" + isBack);\n\t\tint id = 0;\n\n\t\tfor (int camIdx = 0; camIdx < cameraCount; camIdx++) {\n\t\t\tCamera.getCameraInfo(camIdx, cameraInfo);\n\t\t\tLog.i(TAG, \"cameraInfoFacing = \" + cameraInfo.facing);\n\t\t\tif (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK\n\t\t\t\t\t&& isBack) {\n\t\t\t\ttry {\n\t\t\t\t\tLog.i(TAG, \"SETTING mCamera\");\n\t\t\t\t\tmCamera = Camera.open(camIdx);\n\t\t\t\t\tid = camIdx;\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\tLog.e(TAG,\n\t\t\t\t\t\t\t\"Camera failed to open: \" + e.getLocalizedMessage());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT\n\t\t\t\t\t&& !isBack){\n\t\t\t\ttry {\n\t\t\t\t\tLog.i(TAG, \"SETTING mCamera\");\n\t\t\t\t\tmCamera = Camera.open(camIdx);\n\t\t\t\t\tid = camIdx;\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\tLog.e(TAG,\n\t\t\t\t\t\t\t\"Camera failed to open: \" + e.getLocalizedMessage());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (mCamera != null) {\n\t\t\tCamera.Parameters cameraParameters = mCamera.getParameters();\n\t\t\tDisplay display = getActivity().getWindowManager().getDefaultDisplay();\n\t\t\tPoint size = new Point();\n\t\t\tdisplay.getSize(size);\n\t\t\tint screenWidth = size.x;\n\t\t\tint width = Integer.MAX_VALUE;\n\t\t\tint height = 0;\n\t\t\tLog.i(TAG, \"SCREENWIDTH: \" + screenWidth);\n\t\t\tList<Camera.Size> sizes = cameraParameters.getSupportedPreviewSizes();\n\t\t\tfor (Camera.Size cSize : sizes) {\n\t\t\t\tif (cSize.width >= screenWidth && cSize.width <= width) {\n\t\t\t\t\twidth = cSize.width;\n\t\t\t\t\theight = cSize.height;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tLog.i(TAG, \"Width: \" + width + \" HEIGHT: \" + height);\n\n\t\t\tif (mPreview != null) {\n\t\t\t\tmPreview.switchCamera(mCamera, id, width, height);\n\t\t\t} else {\n\t\t\t\tmPreview = new CameraPreview(getActivity(), mCamera, id, width, height);\n\t\t\t\tFrameLayout preview = (FrameLayout) view\n\t\t\t\t\t\t.findViewById(R.id.camera_preview);\n\t\t\t\tpreview.addView(mPreview);\n\t\t\t}\n\t\t\tmCamera.startPreview();\n\t\t}\n\t}", "protected void updatePreview() {\n if(null == cameraDevice) {\n Log.e(TAG, \"updatePreview error, return\");\n }\n captureRequestBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);\n try {\n cameraCaptureSessions.setRepeatingRequest(captureRequestBuilder.build(), null, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String mCameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraId);\n StreamConfigurationMap map = characteristics.\n get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n mImageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) !=\n PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE) !=\n PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(CameraActivity.this, new\n String[]{Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CAMERA_PERMISSION);\n }\n manager.openCamera(mCameraId, mStateCallback, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "@Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == cameraDevice) {\n return;\n }\n\n // When the session is ready, we start displaying the preview.\n cameraCaptureSessions = cameraCaptureSession;\n updatePreview(cameraCaptureSessionListener);\n }", "@TargetApi(9)\n\t@Override\n\tpublic void onResume() {\n\t\tsuper.onResume();\n\t\tif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {\n\t\t\tmCamera = Camera.open(0);\t\t\t\t\t\t\t\t\t//For API 9 and above. Open first camera available on device\n\t\t} else {\n\t\t\tmCamera = Camera.open();\t\t\t\t\t\t\t\t\t//For API 8\n\t\t}\n\t}", "public void surfaceCreated(SurfaceHolder holder) {\n try {\n mCamera.setPreviewDisplay(holder);\n mCamera.startPreview();\n } catch (IOException e) {\n Log.d(\"Preview\", \"Error setting camera preview: \" + e.getMessage());\n }\n }", "private void initCamera(SurfaceHolder surfaceHolder) {\n\t\tif (surfaceHolder == null) {\n\t\t throw new IllegalStateException(\"No SurfaceHolder provided\");\n\t\t }\n\t\tif (cameraManager.isOpen()) {\n\t\t Log.w(TAG, \"initCamera() while already open -- late SurfaceView callback?\");\n\t\t return;\n\t\t }\n\t\ttry {\n\t\t\tcameraManager.openDriver(surfaceHolder);\n\t\t\t// Creating the handler starts the preview, which can also throw a\n\t\t\t// RuntimeException.\n\t\t\t if (handler == null) {\n\t\t\t handler = new CaptureActivityHandler(this, null, null, \"UTF-8\", cameraManager);\n\t\t\t }\n\t\t\t decodeOrStoreSavedBitmap(null, null);\n\t\t} catch (IOException ioe) {\n\t\t\tLog.w(TAG, ioe);\n\t\t\t// displayFrameworkBugMessageAndExit();\n\t\t\tCommonTask.ShowMessage(this, \"IOException\\n\" + ioe.getMessage());\n\t\t} catch (RuntimeException e) {\n\t\t\t// Barcode Scanner has seen crashes in the wild of this variety:\n\t\t\t// java.?lang.?RuntimeException: Fail to connect to camera service\n\t\t\tLog.w(TAG, \"Unexpected error initializating camera\", e);\n\t\t\tCommonTask.ShowMessage(this, \"RuntimeException\\n\" + e.getMessage());\n\t\t\t// displayFrameworkBugMessageAndExit();\n\t\t}\n\t}", "public void startCamera() {\n Fragment cameraFragment = new CameraFragment();\n FragmentTransaction transaction = getActivity().getFragmentManager()\n .beginTransaction();\n transaction.replace(R.id.fragmentContainer, cameraFragment);\n transaction.addToBackStack(\"NewTripCardFragment\");\n transaction.commit();\n }", "public void setupPreview() {\n Log.i(TAG, \"setupPreview\");\n this.mFocusManager.resetTouchFocus();\n if (this.mAppController.getCameraProvider().isBoostPreview()) {\n this.mActivity.clearBoost();\n }\n startPreview();\n }", "@Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)\n {\n this.setCameraParameters(mcCamera);\n\n if (mcCamera != null)\n mcCamera.startPreview();\n }", "protected void createCameraPreview() {\n try {\n SurfaceTexture texture = mCameraTextureView.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mImageDimension.getWidth(), mImageDimension.getHeight());\n Surface surface = new Surface(texture);\n mCaptureRequestBuilder = mCameraDevice.\n createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n mCaptureRequestBuilder.addTarget(surface);\n mCameraDevice.createCaptureSession(Collections.singletonList(surface),\n new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n //The camera is already closed\n if (null == mCameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n mCameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n Toast.makeText(CameraActivity.this, \"Configuration change\",\n Toast.LENGTH_SHORT).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public void startCamera()\n \t{\n\t\t// start the video capture\n\t\t//this.capture.open(0);\n\t\tcapture.open(cameraNumber);\n\n\n\n\t\t// is the video stream available?\n\t\tif (capture.isOpened())\n\t\t{\n\t\t\t// grab a frame every 33 ms (30 frames/sec)\n\t\t\tRunnable frameGrabber = new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run()\n\t\t\t\t{\n\t\t\t\t\tgrabFrame();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttimer = Executors.newSingleThreadScheduledExecutor();\n\t\t\ttimer.scheduleAtFixedRate(frameGrabber, 0, 500, TimeUnit.MILLISECONDS);\n\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// log the error\n\t\t\tSystem.err.println(\"Impossible to open the camera connection...\");\n\t\t}\n \t}", "@Override\n public void surfaceCreated(SurfaceHolder holder)\n {\n try\n {\n if (mCamera != null)\n {\n mCamera.setPreviewDisplay(holder);\n mCamera.setDisplayOrientation(90);\n }\n }\n catch (IOException e)\n {\n Log.e(\"ProfileCamera\", \"Error setting up preview display\", e);\n }\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera(currentCamera);\n }", "public void onResume() {\n if (mCamera == null) {\n obtainCameraOrFinish();\n }\n }", "public void getCameraInstance() {\n newOpenCamera();\n }", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String cameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);\n StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n imageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION);\n return;\n }\n manager.openCamera(cameraId, stateCallback, null);\n } catch (CameraAccessException e) {\n Toast.makeText(this, \"Camera failed to open.\", Toast.LENGTH_SHORT).show();\n e.printStackTrace();\n }\n }", "public void prepareCamera() {\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n\n autoFocusHandler = new Handler();\n mCamera = getCameraInstance();\n\n /* Instance barcode scanner */\n scanner = new ImageScanner();\n scanner.setConfig(0, Config.X_DENSITY, 3);\n scanner.setConfig(0, Config.Y_DENSITY, 3);\n\n mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);\n\n cameraPreview.addView(mPreview);\n\n }", "public void surfaceCreated(SurfaceHolder holder) {\n\t\tthis.camera = Camera.open();\r\n\t\t\r\n\t\ttry {\r\n\t\t\tcamera.setDisplayOrientation(90);\r\n\t\t\tcamera.setPreviewDisplay(holder);\r\n\t\t} catch (IOException e) {\r\n\t\t\tcamera.release();\r\n\t\t\tcamera = null;\r\n\t\t\tToast.makeText(this.getContext(), \"Error \"+e.toString(), Toast.LENGTH_LONG).show();\r\n\t\t}\r\n\t\t\t\t\t\t\r\n\t}", "@Override\n public void onConfigured(\n CameraCaptureSession cameraCaptureSession) {\n if (null == mCameraDevice) {\n return;\n }\n\n // When the session is ready, we start displaying the preview.\n mCaptureSession = cameraCaptureSession;\n\n try {\n // 自动对焦\n // Auto focus should be continuous for camera preview.\n mPreviewRequestBuilder.set(\n CaptureRequest.CONTROL_AF_MODE,\n CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);\n\n // Flash is automatically enabled when necessary.\n setAutoFlash(mPreviewRequestBuilder);\n\n // Finally, we start displaying the camera preview.\n mPreviewRequest = mPreviewRequestBuilder.build();\n mCaptureSession.setRepeatingRequest(\n mPreviewRequest,\n // 如果想要拍照,那么绝不能设置为null\n // 如果单纯预览,那么可以设置为null\n mCaptureCallback,\n mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_camera);\n\n Button buttonStartCameraPreview = (Button) findViewById(R.id.startcamerapreview);\n Button buttonStopCameraPreview = (Button) findViewById(R.id.stopcamerapreview);\n\n getWindow().setFormat(PixelFormat.UNKNOWN);\n surfaceView = (SurfaceView) findViewById(R.id.surfaceview);\n surfaceHolder = surfaceView.getHolder();\n surfaceHolder.addCallback(this);\n surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);\n\n buttonStartCameraPreview.setOnClickListener(new Button.OnClickListener() {\n\n @Override\n public void onClick(View v) {\n // TODO Auto-generated method stub\n if (!previewing) {\n camera = Camera.open();\n if (camera != null) {\n try {\n camera.setPreviewDisplay(surfaceHolder);\n camera.startPreview();\n previewing = true;\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n }\n }\n });\n\n buttonStopCameraPreview.setOnClickListener(new Button.OnClickListener() {\n\n @Override\n public void onClick(View v) {\n // TODO Auto-generated method stub\n if (camera != null && previewing) {\n camera.stopPreview();\n camera.release();\n camera = null;\n\n previewing = false;\n }\n }\n });\n\n\n camera.startPreview();\n\n\n Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {\n public void onPictureTaken(byte[] imageData, Camera c) {\n\n\n camera.startPreview();\n }\n };\n\n\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "private void createCamera() {\n camera = getCameraInstance();\n // Setting the right parameters in the camera\n SetCameraParameters();\n // Create our Preview view and set it as the content of our activity.\n camera_preview = new CameraPreview(this, camera);\n // Adding the camera preview after the FrameLayout and before the mainact_btn_InOutAct\n // as a separated element.\n InOut_cameraLayout.addView(camera_preview, 0);\n }", "protected void cameraClicked() {\n\t\tif (this.pictureFromCameraString != null\n\t\t\t\t&& !\"\".equals(this.pictureFromCameraString)) {\n\t\t\timageAvailable();\n\t\t} else {\n\t\t\timageUnavailable();\n\t\t}\n\t\tthis.cameraIsActive = true;\n\t\tthis.camera.addStyleDependentName(\"highlighted\");\n\t\tthis.upload.removeStyleDependentName(\"highlighted\");\n\t\tthis.inputPanel.setWidget(this.cameraPanel);\n\t\tgetCameraPictureNative();\n\t}", "@Override\n public void onCameraPreviewStopped() {\n }", "@Override\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\tLog.e(TAG,\"Surface Created\");\n\t\tcamera = Camera.open();\n\t}", "@Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == mCameraDevice) {\n return;\n }\n // Auto focus should be continuous for camera preview.\n mCaptureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,\n CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);\n\n // Finally, we start displaying the camera preview.\n mPreviewRequest = mCaptureRequestBuilder.build();\n mPreviewCaptureSession = cameraCaptureSession;\n\n // preview is a video, so we set a repeating request\n try {\n mPreviewCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), mPreviewCaptureCallback, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public void initializeCamera(){\n mCamera = Camera.open();\n\n Camera.Parameters parameters = mCamera.getParameters();\n parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);\n\n List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();\n // Get the supported preview size closest to the requested dimensions:\n Camera.Size previewSize = previewSizes.get(previewSizes.size() - 1); // getOptimalPreviewSize(previewSizes, width, height);\n width = previewSize.width;\n height = previewSize.height;\n Log.d(TAG, \"width: \" + width + \" , height: \" + height);\n nPixels = width * height;\n pixels = new int[nPixels];\n setSize(width, height);\n parameters.setPreviewSize(width, height);\n\n mCamera.setParameters(parameters);\n\n int dataBufferSize=(int)(height * width * (ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())/8.0));\n\n mCamera.addCallbackBuffer(new byte[dataBufferSize]);\n mCamera.setPreviewCallbackWithBuffer(this);\n }", "public void surfaceCreated(SurfaceHolder holder) {\n try {\n mCamera.setPreviewDisplay(mImageCapture.mSurfaceHolder);\n setCameraDisplayOrientationByCameraSelected();\n } catch (IOException e) {\n Log.d(TAG, \"Error setting camera preview: \" + e.getMessage());\n }\n }", "public void configureCamera(){\n try{\n camera = Camera.open(findBackFacingCamera());\n } catch (Exception e){}\n\n if(camera != null) {\n cameraView = new CameraView(this.getApplicationContext(), camera);\n FrameLayout camera_view = (FrameLayout)findViewById(R.id.CameraView);\n camera_view.addView(cameraView);\n }\n }" ]
[ "0.86213505", "0.85156125", "0.8437926", "0.8437926", "0.83570015", "0.8355303", "0.82500905", "0.82500905", "0.81772125", "0.81553966", "0.80677384", "0.78405875", "0.7790925", "0.77318037", "0.7727357", "0.76684874", "0.7660506", "0.765517", "0.7622267", "0.7575925", "0.75402343", "0.7536663", "0.7503967", "0.75013083", "0.7461739", "0.7380803", "0.7350515", "0.73464113", "0.7322406", "0.7306269", "0.72475797", "0.7246842", "0.722913", "0.72244", "0.7215346", "0.7207197", "0.72055167", "0.7202084", "0.7190403", "0.7184189", "0.71802604", "0.71784717", "0.71726197", "0.7162322", "0.7161235", "0.71465117", "0.70928884", "0.7078303", "0.70691997", "0.70638126", "0.70523036", "0.70496255", "0.7048677", "0.7032719", "0.7029232", "0.70233196", "0.70233196", "0.70233196", "0.70233196", "0.70203525", "0.700727", "0.6988181", "0.6983964", "0.69824624", "0.6977708", "0.6971085", "0.6967638", "0.69661283", "0.69655246", "0.6944264", "0.69275147", "0.691422", "0.6909545", "0.69071263", "0.69002163", "0.689989", "0.68903065", "0.6874408", "0.68685716", "0.6863372", "0.6860125", "0.6860125", "0.685856", "0.68455136", "0.68361646", "0.6830192", "0.68259966", "0.6824804", "0.6824332", "0.6821137", "0.68164897", "0.68164897", "0.68156993", "0.68153495", "0.6815036", "0.6814063", "0.68022096", "0.6772768", "0.6769453", "0.6737696" ]
0.773878
13
User RokidCameraBuilder to create an instance of RokidCamera
RokidCamera(RokidCameraBuilder rokidCameraBuilder) { this(rokidCameraBuilder.getActivity(), rokidCameraBuilder.getTextureView()); this.mRokidCameraStateListener = rokidCameraBuilder.getRokidCameraStateListener(); this.mRokidCameraIOListener = rokidCameraBuilder.getRokidCameraIOListener(); this.mRokidCameraRecordingListener = rokidCameraBuilder.getRokidCameraRecordingListener(); this.mRokidCameraOnImageAvailableListener = rokidCameraBuilder.getRokidCameraOnImageAvailableListener(); this.mImageReaderCallbackMode = rokidCameraBuilder.getImageReaderCallbackMode(); this.mPreviewEnabled = rokidCameraBuilder.isPreviewEnabled(); this.mImageFormat = rokidCameraBuilder.getImageFormat(); this.mMaxImages = rokidCameraBuilder.getMaxImages(); this.mSizePreview = rokidCameraBuilder.getRokidCameraSizePreview(); this.mSizeImageReader = rokidCameraBuilder.getRokidCameraSizeImageReader(); this.mSizeVideoRecorder = rokidCameraBuilder.getRokidCameraSizeVideoRecorder(); this.mRokidCameraParamAFMode = rokidCameraBuilder.getRokidCameraParamAFMode(); this.mRokidCameraParamAEMode = rokidCameraBuilder.getRokidCameraParamAEMode(); this.mRokidCameraParamAWBMode = rokidCameraBuilder.getRokidCameraParamAWBMode(); this.mRokidCameraParamCameraId = rokidCameraBuilder.getRokidCameraParamCameraId(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Camera getCamera();", "public static Camera open() { \n return new Camera(); \n }", "public void getCameraInstance() {\n newOpenCamera();\n }", "public void configureCamera(){\n try{\n camera = Camera.open(findBackFacingCamera());\n } catch (Exception e){}\n\n if(camera != null) {\n cameraView = new CameraView(this.getApplicationContext(), camera);\n FrameLayout camera_view = (FrameLayout)findViewById(R.id.CameraView);\n camera_view.addView(cameraView);\n }\n }", "public static Camera getCameraInstance(){\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {\n return Camera.open(0); // This is the line the error occurs\n } else {\n return Camera.open();\n }\n }", "private void setupCamera(int width, int height) {\n CameraManager cameraManager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE);\n\n if (cameraManager == null) {\n return;\n }\n\n try {\n for (String cameraId : cameraManager.getCameraIdList()) {\n // get camera characteristics\n CameraCharacteristics cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId);\n\n Integer currentCameraId = cameraCharacteristics.get(CameraCharacteristics.LENS_FACING);\n if (currentCameraId == null) {\n // The return value of that key could be null if the field is not set.\n return;\n }\n if (currentCameraId != mRokidCameraParamCameraId.getParam()) {\n // if not desired Camera ID, skip\n continue;\n }\n int deviceOrientation = mActivity.getWindowManager().getDefaultDisplay().getRotation();\n mTotalRotation = CameraDeviceUtils.sensorToDeviceRotation(cameraCharacteristics, deviceOrientation, ORIENTATIONS);\n\n mImageReader = ImageReader.newInstance(mSizeImageReader.getSize().getWidth(), mSizeImageReader.getSize().getHeight(), mImageFormat, mMaxImages);\n mImageReader.setOnImageAvailableListener(mOnImageAvailableListener, mBackgroundHandler);\n\n // Check if auto focus is supported\n int[] afAvailableModes = cameraCharacteristics.get(\n CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES);\n if (afAvailableModes.length == 0 ||\n (afAvailableModes.length == 1\n && afAvailableModes[0] == CameraMetadata.CONTROL_AF_MODE_OFF)) {\n mAutoFocusSupported = false;\n } else {\n mAutoFocusSupported = true;\n }\n\n mCameraId = cameraId;\n return;\n }\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void oldOpenCamera() {\n try {\n mCamera = Camera.open(); // attempt to get a Camera instance\n mCamera.setPreviewCallbackWithBuffer(this);\n Log.i(TAG, \"Instance created\");\n } catch (Exception e) {\n Log.e(TAG, \"Error getting Camera instance: \" + e.getMessage());\n }\n }", "public org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera.Builder addCameraBuilder() {\n return getCameraFieldBuilder().addBuilder(\n org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera.getDefaultInstance());\n }", "private native void iniciarCamara(int idCamera);", "private void createCamera() {\n camera = getCameraInstance();\n // Setting the right parameters in the camera\n SetCameraParameters();\n // Create our Preview view and set it as the content of our activity.\n camera_preview = new CameraPreview(this, camera);\n // Adding the camera preview after the FrameLayout and before the mainact_btn_InOutAct\n // as a separated element.\n InOut_cameraLayout.addView(camera_preview, 0);\n }", "public Camera open(int cameraId) {\r\n Camera camera = null;\r\n try {\r\n if (mMethodOpenLevel9 != null) {\r\n Object[] argList = new Object[1];\r\n argList[0] = cameraId;\r\n camera = (Camera) mMethodOpenLevel9.invoke(null, argList);\r\n }\r\n } catch (Exception e) {\r\n Log.w(LOG_TAG, \"CameraHideMethods:mMethodOpenLevel9()\", e);\r\n }\r\n\r\n return camera;\r\n }", "private Camera(com.google.protobuf.GeneratedMessage.Builder<?> builder) {\n super(builder);\n this.unknownFields = builder.getUnknownFields();\n }", "private RokidCamera(Activity activity, TextureView textureView) {\n this.mActivity = activity;\n this.mTextureView = textureView;\n }", "void setCameraIdPref(int cameraId);", "public ReflectedCamera(Camera camera) {\n this(camera, true);\n }", "public void openCamera() {\n \n\n }", "public org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera.Builder getCameraBuilder(\n int index) {\n return getCameraFieldBuilder().getBuilder(index);\n }", "public interface ICamera {\n\n /**\n * Return frame access interface for client usage\n *\n * @param interface_index\n * @return\n */\n public long getFrameAccessIfc(int interface_index);\n\n /**\n * Start the camera stream\n */\n public void start();\n\n /**\n * Stop the camera stream\n */\n public void stop();\n\n public String prepare(final UsbMonitor.UsbConnectionData connectionData);\n\n /**\n * Register json status callback\n *\n * @param callback\n */\n public void setStatusCallback(final IStatusCallback callback);\n\n /**\n * Queries camera for supported mode\n *\n * @return supported video modes String\n */\n public String getSupportedVideoModes();\n\n// /**\n// * Select camera capture mode\n// *\n// * @param width\n// * @param height\n// * @param frameFormat\n// */\n// public void setCaptureMode(final int width, final int height, final int frameFormat);\n\n /**\n * Select camera capture mode\n *\n * @param width\n * @param height\n * @param min_fps\n * @param max_fps\n * @param frameFormat\n */\n public void setCaptureMode(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat);\n}", "public interface ICamera {\n}", "public Builder clearCamera() {\n if (cameraBuilder_ == null) {\n camera_ = java.util.Collections.emptyList();\n bitField0_ = (bitField0_ & ~0x00000100);\n onChanged();\n } else {\n cameraBuilder_.clear();\n }\n return this;\n }", "private static Camera getCameraInstance(int cameraId) {\n Camera c = null;\n try {\n c = Camera.open(cameraId);\n }\n catch (Exception e) {\n // Camera is not available (in use or does not exist)\n Log.w(LOG_TAG, \"Camera is not available: \" + e.getMessage());\n }\n return c;\n }", "public Camera() {\r\n this(1, 1);\r\n }", "private void getCamera() {\n if (camera == null) {\n try {\n camera = Camera.open();\n params = camera.getParameters();\n } catch (RuntimeException e) {\n\n }\n }\n }", "protected CameraInstance createCameraInstance() {\n CameraInstance cameraInstance = new CameraInstance(getContext());\n cameraInstance.setCameraSettings(cameraSettings);\n return cameraInstance;\n }", "void initializeCamera() {\n camera_linear = (LinearLayout) findViewById(R.id.camera_linear);\n //The preview frame is overlayed on the layout which shows the camera view.\n preview = (FrameLayout) findViewById(R.id.camera_preview);\n //Get an instance of the phone's camera.\n mCamera = cameraRecorder.getCameraInstance();\n //Find content fort the camera preview frame using the instance of the camera initialized.\n mPreview = new CameraPreview(getApplicationContext(), mCamera);\n //Apply the camera previes content from the camera to the preview frame itself.\n preview.addView(mPreview);\n }", "private CameraManager() {\n }", "public void init(Camera cam);", "@Override\n public void init() {\n startCamera();\n }", "public Camera() {\n\t\treset();\n\t}", "public String getRMRName() {\n return \"Camera\";\n }", "public org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera.Builder addCameraBuilder(\n int index) {\n return getCameraFieldBuilder().addBuilder(\n index, org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera.getDefaultInstance());\n }", "public Result link(Long id, Long cameraId) {\n Preset preset = Preset.find.byId(id); // find preset\n if (preset != null) {\n Camera camera = Camera.find.byId(cameraId);\n if (camera != null) {\n // find the camera values\n\n Integer[] values = camera.getCameraValues();\n preset.camera = camera;\n preset.pan = values[0];\n preset.tilt = values[1];\n preset.zoom = values[2];\n preset.focus = values[3];\n preset.iris = values[4];\n //savePresetThumbnail(preset);\n checkCompatibility(preset.script);\n preset.save();\n\n return ok(Json.toJson(preset));\n }\n return notFound(\"Camera not found\");\n }\n return notFound(\"Preset not found\");\n }", "public Builder addCamera(\n org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera.Builder builderForValue) {\n if (cameraBuilder_ == null) {\n ensureCameraIsMutable();\n camera_.add(builderForValue.build());\n onChanged();\n } else {\n cameraBuilder_.addMessage(builderForValue.build());\n }\n return this;\n }", "public void setCamera(Camera camera) {\n mCamera = camera;\n }", "public SimplePreset(int cameraId) {\n super(cameraId);\n }", "public Builder addCamera(org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera value) {\n if (cameraBuilder_ == null) {\n if (value == null) {\n throw new NullPointerException();\n }\n ensureCameraIsMutable();\n camera_.add(value);\n onChanged();\n } else {\n cameraBuilder_.addMessage(value);\n }\n return this;\n }", "@RestrictTo(Scope.LIBRARY_GROUP)\n protected void onCameraControlReady(String cameraId) {\n }", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String mCameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraId);\n StreamConfigurationMap map = characteristics.\n get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n mImageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) !=\n PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE) !=\n PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(CameraActivity.this, new\n String[]{Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CAMERA_PERMISSION);\n }\n manager.openCamera(mCameraId, mStateCallback, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public Builder setCamera(\n int index, org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera value) {\n if (cameraBuilder_ == null) {\n if (value == null) {\n throw new NullPointerException();\n }\n ensureCameraIsMutable();\n camera_.set(index, value);\n onChanged();\n } else {\n cameraBuilder_.setMessage(index, value);\n }\n return this;\n }", "public CameraInfo getCameraInfo(int cameraId) {\r\n CameraInfo wrapperCameraInfo = null;\r\n\r\n try {\r\n if (mMethodGetCameraInfoLevel9 != null) {\r\n Object[] argList = new Object[2];\r\n argList[0] = cameraId;\r\n Class<?> cls = Class.forName(\"android.hardware.Camera$CameraInfo\");\r\n Constructor<?> con = cls.getConstructor();\r\n Object cameraInfo = con.newInstance();\r\n argList[1] = cameraInfo;\r\n mMethodGetCameraInfoLevel9.invoke(null, argList);\r\n\r\n Field facingField = cls.getDeclaredField(\"facing\");\r\n Field orientationField = cls.getDeclaredField(\"orientation\");\r\n int facing = facingField.getInt(cameraInfo);\r\n int orientation = orientationField.getInt(cameraInfo);\r\n wrapperCameraInfo = new CameraInfo();\r\n wrapperCameraInfo.facing = facing;\r\n wrapperCameraInfo.orientation = orientation;\r\n }\r\n } catch (Exception e) {\r\n Log.w(LOG_TAG, \"CameraHideMethods:mMethodGetCameraInfoLevel9()\", e);\r\n }\r\n\r\n return wrapperCameraInfo;\r\n }", "public void setCamera(Camera camera) {\r\n\t\tthis.camera = camera;\r\n\t}", "public void startCamera()\n {\n startCamera(null);\n }", "public void prepareCamera() {\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n\n autoFocusHandler = new Handler();\n mCamera = getCameraInstance();\n\n /* Instance barcode scanner */\n scanner = new ImageScanner();\n scanner.setConfig(0, Config.X_DENSITY, 3);\n scanner.setConfig(0, Config.Y_DENSITY, 3);\n\n mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);\n\n cameraPreview.addView(mPreview);\n\n }", "private void setupCamera(final int camera) {\n try {\n // mPreview = new CamPreview(this, camera, CamPreview.LayoutMode.NoBlank);// .FitToParent);\n } catch (Exception e) {\n Toast.makeText(this, R.string.cannot_connect_to_camera, Toast.LENGTH_LONG).show();\n finish();\n return;\n }\n\n RelativeLayout.LayoutParams previewLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n Display display = getWindowManager().getDefaultDisplay();\n DisplayMetrics outMetrics = new DisplayMetrics();\n display.getMetrics(outMetrics);\n\n int width = outMetrics.widthPixels;\n int height = outMetrics.heightPixels;\n\n previewLayoutParams.height = width;\n previewLayoutParams.width = width;\n\n // Un-comment below line to specify the position.\n // mPreview.setCenterPosition(width / 2, height / 2);\n\n // previewParent.addView(mPreview, 0, previewLayoutParams);\n\n\n }", "public void onCamera();", "private void createCameraSource() {\n Context ctx = getApplicationContext();\n Point displaySize = new Point();\n getWindowManager().getDefaultDisplay().getRealSize(displaySize);\n\n // dummy detector saving the last frame in order to send it to Microsoft in case of face detection\n ImageFetchingDetector imageFetchingDetector = new ImageFetchingDetector();\n\n // We need to provide at least one detector to the camera :x\n FaceDetector faceDetector = new FaceDetector.Builder(ctx).build();\n faceDetector.setProcessor(\n new LargestFaceFocusingProcessor.Builder(faceDetector, new FaceTracker(imageFetchingDetector))\n .build());\n\n BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(ctx).build();\n //barcodeDetector.setProcessor(new BarcodeDetectionProcessor());\n barcodeDetector.setProcessor(\n new FirstFocusingProcessor<Barcode>(barcodeDetector, new BarcodeTracker())\n );\n\n TextRecognizer textRecognizer = new TextRecognizer.Builder(ctx).build();\n textRecognizer.setProcessor(new OcrDetectionProcessor());\n // TODO: Check if the TextRecognizer is operational.\n\n MultiDetector multiDetector = new MultiDetector.Builder()\n .add(imageFetchingDetector)\n .add(faceDetector)\n .add(barcodeDetector)\n .add(textRecognizer)\n .build();\n\n mCameraSource = new CameraSource.Builder(ctx, multiDetector)\n .setFacing(CameraSource.CAMERA_FACING_BACK)\n .setAutoFocusEnabled(true)\n .setRequestedFps(5.0f)\n .setRequestedPreviewSize(displaySize.y, displaySize.x)\n .build();\n }", "public void setCamera(Camera c) {\n\t\tmCamera = c;\n\t}", "boolean useCamera2();", "public interface CameraPreview {\n\n /**\n * Set the camera system this will act as the preview for.\n * <p/>\n * The preview will update the camera system as necessary for certain events, such as\n * setting the surface holder, or pausing/restarting the preview when reconfiguring the surface.\n *\n * @param cameraSystem the camera system to connect to\n */\n void connectToCameraSystem(@NonNull CameraSystem cameraSystem);\n\n}", "public Builder setCamera(\n int index, org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera.Builder builderForValue) {\n if (cameraBuilder_ == null) {\n ensureCameraIsMutable();\n camera_.set(index, builderForValue.build());\n onChanged();\n } else {\n cameraBuilder_.setMessage(index, builderForValue.build());\n }\n return this;\n }", "private void openCamera(int desiredWidth, int desiredHeight) {\n if (mCamera != null) {\n throw new RuntimeException(\"camera already initialized\");\n }\n\n android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();\n\n // Try to find a front-facing camera (e.g. for videoconferencing).\n int numCameras = android.hardware.Camera.getNumberOfCameras();\n for (int i = 0; i < numCameras; i++) {\n android.hardware.Camera.getCameraInfo(i, info);\n if (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK) {\n mCamera = android.hardware.Camera.open(i);\n break;\n }\n }\n if (mCamera == null) {\n// Log.d(TAG, \"No front-facing camera found; opening default\");\n mCamera = android.hardware.Camera.open(); // opens first back-facing camera\n }\n if (mCamera == null) {\n throw new RuntimeException(\"Unable to open camera\");\n }\n\n android.hardware.Camera.Parameters parms = mCamera.getParameters();\n\n CameraUtils.choosePreviewSize(parms, desiredWidth, desiredHeight);\n\n // Give the camera a hint that we're recording video. This can have a big\n // impact on frame rate.\n parms.setRecordingHint(true);\n\n // leave the frame rate set to default\n mCamera.setParameters(parms);\n\n int[] fpsRange = new int[2];\n android.hardware.Camera.Size mCameraPreviewSize = parms.getPreviewSize();\n parms.getPreviewFpsRange(fpsRange);\n String previewFacts = mCameraPreviewSize.width + \"x\" + mCameraPreviewSize.height;\n if (fpsRange[0] == fpsRange[1]) {\n previewFacts += \" @\" + (fpsRange[0] / 1000.0) + \"fps\";\n } else {\n previewFacts += \" @[\" + (fpsRange[0] / 1000.0) +\n \" - \" + (fpsRange[1] / 1000.0) + \"] fps\";\n }\n// TextView text = (TextView) findViewById(R.id.cameraParams_text);\n// text.setText(previewFacts);\n\n mCameraPreviewWidth = mCameraPreviewSize.width;\n mCameraPreviewHeight = mCameraPreviewSize.height;\n\n\n// AspectFrameLayout layout = (AspectFrameLayout) findViewById(R.id.cameraPreview_afl);\n\n Display display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();\n\n if(display.getRotation() == Surface.ROTATION_0) {\n mCamera.setDisplayOrientation(90);\n// layout.setAspectRatio((double) mCameraPreviewHeight / mCameraPreviewWidth);\n } else if(display.getRotation() == Surface.ROTATION_270) {\n// layout.setAspectRatio((double) mCameraPreviewHeight/ mCameraPreviewWidth);\n mCamera.setDisplayOrientation(180);\n } else {\n // Set the preview aspect ratio.\n// layout.setAspectRatio((double) mCameraPreviewWidth / mCameraPreviewHeight);\n }\n }", "org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera getCamera(int index);", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String cameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);\n StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n imageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION);\n return;\n }\n manager.openCamera(cameraId, stateCallback, null);\n } catch (CameraAccessException e) {\n Toast.makeText(this, \"Camera failed to open.\", Toast.LENGTH_SHORT).show();\n e.printStackTrace();\n }\n }", "public void openCamera(View view){\n if (isInspecting) {\n Context context = App.getContext();\n Intent intent = new Intent(Inspector.this, PhotoManager.class);\n intent.putExtra(\"blueprint\", blueprint);\n intent.putExtra(\"isInspecting\", isInspecting);\n intent.putExtra(\"filename\", filename);\n View parent = (View) view.getParent();\n String tag = parent.getTag().toString();\n intent.putExtra(\"cameraID\", tag);\n LogManager.reportStatus(context, \"INSPECTOR\", \"parent tag = \" + tag);\n startActivity(intent);\n }\n }", "private void newOpenCamera() {\n if (mThread == null) {\n mThread = new CameraHandlerThread();\n }\n\n synchronized (mThread) {\n mThread.openCamera();\n }\n }", "@Override\n protected Camera getCamera() {\n return Camera.createForPositionAndAngles(new ThreeDoubleVector(31.0, 7.0, 5.5), 0.0, 0.7);\n\n // Camera for orientation curve interpolation presentation\n// return Camera.createForPositionAndAngles(new ThreeDoubleVector(54.5, 10.0, 2.5), -0.5, 0.3);\n }", "@SuppressWarnings(\"unchecked\")\n @Nullable\n protected static <T extends OpenCvCamera> T getCamera(String cameraId) {\n if (internalCamera != null && cameraId.equals(internalCameraId)) return (T) internalCamera;\n else if (externalCameras.containsKey(cameraId)) return (T) externalCameras.get(cameraId);\n else {\n Log.e(LOGGING_TAG, \"Tried to find camera with id \" + cameraId + \" but no camera with that id was registered.\");\n return null;\n }\n }", "public void initializeCamera(){\n mCamera = Camera.open();\n\n Camera.Parameters parameters = mCamera.getParameters();\n parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);\n\n List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();\n // Get the supported preview size closest to the requested dimensions:\n Camera.Size previewSize = previewSizes.get(previewSizes.size() - 1); // getOptimalPreviewSize(previewSizes, width, height);\n width = previewSize.width;\n height = previewSize.height;\n Log.d(TAG, \"width: \" + width + \" , height: \" + height);\n nPixels = width * height;\n pixels = new int[nPixels];\n setSize(width, height);\n parameters.setPreviewSize(width, height);\n\n mCamera.setParameters(parameters);\n\n int dataBufferSize=(int)(height * width * (ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())/8.0));\n\n mCamera.addCallbackBuffer(new byte[dataBufferSize]);\n mCamera.setPreviewCallbackWithBuffer(this);\n }", "public Builder addCamera(\n int index, org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera value) {\n if (cameraBuilder_ == null) {\n if (value == null) {\n throw new NullPointerException();\n }\n ensureCameraIsMutable();\n camera_.add(index, value);\n onChanged();\n } else {\n cameraBuilder_.addMessage(index, value);\n }\n return this;\n }", "public Camera(){\n // servoPan = new Servo(PAN);\n servoTilt = new Servo(TILT);\n }", "@Override\r\n public void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.custom_cameraactivity);\r\n mCamera = getCameraInstance();\r\n mCameraPreview = new CameraPreview(this, mCamera);\r\n FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);\r\n preview.addView(mCameraPreview);\r\n\r\n Bundle extras = getIntent().getExtras();\r\n looc = extras.getString(\"coor\");\r\n\r\n Button captureButton = (Button) findViewById(R.id.button_capture);\r\n captureButton.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n mCamera.takePicture(null, null, mPicture);\r\n // havent try to use doinbackgroud test first\r\n\r\n }\r\n });\r\n }", "@Override\n\t\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\tcam.setCamera(getCameraInstance(getDefaultCameraId()));\n\t\t\t\t}", "public void openCamera(View view) {\n Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n\n mImagePath = getFile();\n takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mImagePath);\n startActivityForResult(takePictureIntent, TAKE_PIC_CODE);\n }", "private void initCameraPreview() {\n\t\tcameraPreview = (CameraPreview) findViewById(R.id.camera_preview);\n\t\tcameraPreview.init(camera);\n\t}", "@SuppressLint(\"NewApi\")\n\tpublic static Camera getCameraInstance(int cameraId)\n {\n Log.d(\"tag\", \"getCameraInstance\");\n Camera c = null;\n try\n {\n c = Camera.open(cameraId); // attempt to get a Camera instance\n }\n catch (Exception e)\n {\n // Camera is not available (in use or does not exist)\n e.printStackTrace();\n Log.e(\"tag\", \"Camera is not available\");\n }\n return c; // returns null if camera is unavailable\n }", "public void init(HardwareMap hwMap){\n int cameraMonitorViewID = hwMap.appContext.getResources().getIdentifier(\"cameraMonitorViewId\", \"id\", hwMap.appContext.getPackageName());\n phoneCam = OpenCvCameraFactory.getInstance().createInternalCamera(OpenCvInternalCamera.CameraDirection.BACK,cameraMonitorViewID);\n phoneCam.openCameraDevice();\n phoneCam.setPipeline(counter);\n phoneCam.openCameraDeviceAsync(new OpenCvCamera.AsyncCameraOpenListener()\n {\n @Override\n public void onOpened()\n {\n phoneCam.startStreaming(320, 240, OpenCvCameraRotation.UPRIGHT);\n }\n });\n }", "public void onCameraPicked(String newCameraId);", "protected void createCameraPreview() {\n try {\n SurfaceTexture texture = textureView.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(imageDimension.getWidth(), imageDimension.getHeight());\n Surface surface = new Surface(texture);\n captureRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n captureRequestBuilder.addTarget(surface);\n cameraDevice.createCaptureSession(Collections.singletonList(surface), new CameraCaptureSession.StateCallback(){\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == cameraDevice) {\n return;\n }\n cameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n Toast.makeText(MainActivity.this, \"Configuration change\", Toast.LENGTH_SHORT).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n Toast.makeText(MainActivity.this, \"Camera Surface failed to load.\", Toast.LENGTH_SHORT).show();\n e.printStackTrace();\n }\n }", "private void configureCamera(int width, int height)\n {\n mCameraId = CAMERA_FACE_BACK;\n ///Configure camera output surfaces\n setupCameraOutputs(mWidth, mHeight);\n }", "void cameraSetup();", "private void setUpAndConfigureCamera() {\n\t\t// Open and configure the camera\n\t\tmCamera = selectAndOpenCamera();\n\n\t\tCamera.Parameters param = mCamera.getParameters();\n\n\t\t// Smaller images are recommended because some computer vision operations are very expensive\n\t\tList<Camera.Size> sizes = param.getSupportedPreviewSizes();\n\t\tCamera.Size s = sizes.get(closest(sizes,640,360));\n\t\tparam.setPreviewSize(s.width,s.height);\n\t\tmCamera.setParameters(param);\n\n\t\t// start image processing thread\n\n\t\t// Start the video feed by passing it to mPreview\n\t\tmPreview.setCamera(mCamera);\n\t}", "private static UsbCamera setUsbCamera(String camName, int cameraId) {\n // This gets the image from a USB camera \n // Usually this will be on device 0, but there are other overloads\n // that can be used\n UsbCamera camera = new UsbCamera(camName, cameraId);\n camera.setResolution(PIXEL_WIDTH, PIXEL_HEIGHT);\n camera.setBrightness(BRIGHTNESS);\n camera.setExposureManual(EXPOSURE);\n camera.setWhiteBalanceManual(WHITE_BALANCE);\n camera.setFPS(FRAMES_PER_SEC);\n System.out.println(camera.getName());\n System.out.println(camera.getDescription());\n System.out.println(camera.getPath());\n System.out.println(camera.getKind());\n System.out.println(camera.isConnected());\n return camera;\n }", "public interface CameraSetting {\n}", "void onBind(String cameraId);", "private Camera getCameraInstance() {\r\n Camera camera = null;\r\n try {\r\n camera = Camera.open();\r\n } catch (Exception e) {\r\n // cannot get camera or does not exist\r\n }\r\n Camera.Parameters params = camera.getParameters();\r\n\r\n List<Size> sizes = params.getSupportedPictureSizes();\r\n int w = 0, h = 0;\r\n for (Size size : sizes) {\r\n if (size.width > w || size.height > h) {\r\n w = size.width;\r\n h = size.height;\r\n }\r\n\r\n }\r\n params.setPictureSize(w, h);\r\n\r\n\r\n if (params.getSupportedFocusModes().contains(\r\n Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {\r\n params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\r\n }\r\n params.setPictureFormat(ImageFormat.JPEG);\r\n params.setJpegQuality(100);\r\n camera.setParameters(params);\r\n\r\n\r\n return camera;\r\n }", "protected void createCameraPreview() {\n try {\n SurfaceTexture texture = mCameraTextureView.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mImageDimension.getWidth(), mImageDimension.getHeight());\n Surface surface = new Surface(texture);\n mCaptureRequestBuilder = mCameraDevice.\n createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n mCaptureRequestBuilder.addTarget(surface);\n mCameraDevice.createCaptureSession(Collections.singletonList(surface),\n new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n //The camera is already closed\n if (null == mCameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n mCameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n Toast.makeText(CameraActivity.this, \"Configuration change\",\n Toast.LENGTH_SHORT).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public CameraManager(HardwareMap hardwareMap) {\n int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(\"cameraMonitorViewId\", \"id\", hardwareMap.appContext.getPackageName());\n phoneCam = OpenCvCameraFactory.getInstance().createInternalCamera(OpenCvInternalCamera.CameraDirection.BACK, cameraMonitorViewId);\n pipeline = new CvPipeline();\n phoneCam.setPipeline(pipeline);\n }", "public Builder addCamera(\n int index, org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera.Builder builderForValue) {\n if (cameraBuilder_ == null) {\n ensureCameraIsMutable();\n camera_.add(index, builderForValue.build());\n onChanged();\n } else {\n cameraBuilder_.addMessage(index, builderForValue.build());\n }\n return this;\n }", "public interface ICapture {\n public Handler getHandler();\n\n Rect getCropRect();\n\n void handleDecode(Result rawResult, Bundle bundle);\n\n CameraManager getCameraManager();\n}", "private void setupCamera(int width, int height) {\n CameraManager cameraManager = (CameraManager) getSystemService(CAMERA_SERVICE);\n try {\n if (cameraManager == null) return;\n for (String cameraId : cameraManager.getCameraIdList()) {\n CameraCharacteristics cc = cameraManager.getCameraCharacteristics(cameraId);\n if (cc.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK) {\n continue;\n }\n mCameraId = cameraId;\n\n int deviceOrientation = getWindowManager().getDefaultDisplay().getRotation();\n mTotalRotation = CameraUtils.calculateTotalRotation(cc, deviceOrientation);\n StreamConfigurationMap map = cc.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n\n int finalWidth = width;\n int finalHeight = height;\n boolean swapDimensions = mTotalRotation == 90 || mTotalRotation == 270;\n if (swapDimensions) {\n finalHeight = width;\n finalWidth = height;\n }\n mPreviewSize = CameraUtils.chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), finalWidth, finalHeight);\n mVideoSize = CameraUtils.chooseOptimalSize(map.getOutputSizes(MediaRecorder.class), finalWidth, finalHeight);\n return;\n }\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "void initCameraManager(){\n\t\tcameraManager = new CameraManager(getApplication());\n\t}", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "public synchronized void setManualCameraId(int cameraId) {\n requestedCameraId = cameraId;\n }", "org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.CameraOrBuilder getCameraOrBuilder(\n int index);", "private static UsbCamera setUsbCamera(String camName, int cameraId, MjpegServer server) {\n\t // This gets the image from a USB camera \n\t // Usually this will be on device 0, but there are other overloads\n\t // that can be used\n\t UsbCamera camera = new UsbCamera(camName, cameraId);\n\t camera.setResolution(PIXEL_WIDTH,PIXEL_HEIGHT);\n\t camera.setBrightness(BRIGHTNESS);\n\t camera.setExposureManual(EXPOSURE);\n\t camera.setWhiteBalanceManual(WHITE_BALANCE);\n\t camera.setFPS(FRAMES_PER_SEC);\n\t server.setSource(camera);\n\t return camera;\n\t}", "private void openCamera(int width, int height) {\n setupCamera(width, height);\n configureTransform(width, height);\n Activity activity = mActivity;\n CameraManager cameraManager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE);\n try {\n if (ContextCompat.checkSelfPermission(mActivity, Manifest.permission.CAMERA) ==\n PackageManager.PERMISSION_GRANTED) {\n // connect the camera\n // TODO: add comments\n cameraManager.openCamera(mCameraId, mStateCallback, mBackgroundHandler);\n }\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public static Camera openCamera(Activity activity, int cameraId)\n throws Exception {\n if (!activity.isFinishing()) {\n DevicePolicyManager dpm = (DevicePolicyManager) activity.getSystemService(\n Context.DEVICE_POLICY_SERVICE);\n if (dpm.getCameraDisabled(null) == true) {\n throw new Exception();\n }\n for (int i = 0; i < OPEN_RETRY_COUNT; i++) {\n try {\n return CameraHolder.instance().open(cameraId);\n } catch (Exception e) {\n if (i == 0) {\n try {\n //wait some time, and try another time\n //Camera device may be using by VT or atv.\n Thread.sleep(1000);\n } catch (InterruptedException ie) {\n }\n continue;\n } else {\n // In eng build, we throw the exception so that test tool\n // can detect it and report it\n if (\"eng\".equals(Build.TYPE)) {\n if (BuildConfig.DEBUG) Log.i(TAG, \"Open Camera fail\", e);\n throw e;\n //QA will always consider JE as bug, so..\n //throw new RuntimeException(\"openCamera failed\", e);\n } else {\n throw e;\n }\n }\n }\n }\n //just for build pass\n }\n throw new Exception(new RuntimeException(\"Should never get here\"));\n\n }", "public org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.CameraOrBuilder getCameraOrBuilder(\n int index) {\n if (cameraBuilder_ == null) {\n return camera_.get(index); } else {\n return cameraBuilder_.getMessageOrBuilder(index);\n }\n }", "public void openCamera(View view) {\n //do something here\n dispatchTakePictureIntent();\n\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n createCameraPreview();\n }", "public org.auvua.utils.protobuffer.AUVprotocol.AUVState.Telemetry.Camera getCamera(int index) {\n if (cameraBuilder_ == null) {\n return camera_.get(index);\n } else {\n return cameraBuilder_.getMessage(index);\n }\n }", "public void onCreateCameraPipeline(com.arashivision.onestream.pipeline.ICameraPreviewPipeline r20) {\n /*\n r19 = this;\n r0 = r19\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"onCreateCameraPipeline\"\n r1.d(r2)\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n r2 = r20\n r1.f73l = r2\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r1 = r1.IL1Iii\n com.arashivision.insta360.basemedia.model.FileType r1 = r1.getFileType()\n com.arashivision.insta360.basemedia.model.FileType r2 = com.arashivision.insta360.basemedia.model.FileType.FISH_EYE\n r3 = 1\n r4 = 0\n if (r1 != r2) goto L_0x0059\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r1 = r1.IL1Iii\n com.arashivision.insta360.basemedia.model.viewconstraint.Constraint r1 = r1.getConstraint()\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r2 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r2 = r2.IL1Iii\n int[] r2 = r2.getConstraintRatio()\n if (r1 == 0) goto L_0x0059\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r5 = r0.f577a\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r6 = r5.I11L\n float r5 = r1.getDefaultDistance()\n double r9 = (double) r5\n float r5 = r1.getDefaultFov()\n double r11 = (double) r5\n r5 = r2[r3]\n float r5 = (float) r5\n r2 = r2[r4]\n float r2 = (float) r2\n float r5 = r5 / r2\n double r13 = (double) r5\n float r2 = r1.getXScale()\n double r7 = (double) r2\n float r1 = r1.getYScale()\n double r1 = (double) r1\n r15 = 4607182418800017408(0x3ff0000000000000, double:1.0)\n r17 = r7\n r7 = r15\n r15 = r17\n r17 = r1\n r6.setGyroStabilizerFovDistance2(r7, r9, r11, r13, r15, r17)\n L_0x0059:\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n r1.setLoading(r4)\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n if (r1 == 0) goto L_0x00cf\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r2 = r1.ILil\n if (r2 == 0) goto L_0x006d\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r2 = r2.getCameraRenderSurfaceInfo()\n if (r2 == 0) goto L_0x006d\n r4 = r3\n L_0x006d:\n if (r4 != 0) goto L_0x0077\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Custom surface is null\"\n L_0x0073:\n r1.e(r2)\n goto L_0x00c5\n L_0x0077:\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r2 = r1.I11L\n if (r2 != 0) goto L_0x0080\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Render is null\"\n goto L_0x0073\n L_0x0080:\n boolean r2 = r1.llliI\n if (r2 == 0) goto L_0x0089\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Already render surface\"\n goto L_0x0073\n L_0x0089:\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender$CameraRenderSurfaceInfo r2 = new com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender$CameraRenderSurfaceInfo\n r2.<init>()\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n int r4 = r4.renderWidth\n r2.renderWidth = r4\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n int r4 = r4.renderHeight\n r2.renderHeight = r4\n a.a.a.a.e.a.e.l r4 = r1.f60IL\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r5 = r1.ILil\n int r5 = r5.getRenderModelType()\n com.arashivision.graphicpath.render.rendermodel.RenderModelType r4 = r4.a(r5)\n int r4 = r4.getType()\n r2.renderModeType = r4\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n android.view.Surface r4 = r4.mSurface\n r2.mSurface = r4\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r4 = r1.I11L\n r4.startCameraRenderSurface(r2)\n r1.llliI = r3\n L_0x00c5:\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.listener.IBasePlayerViewListener r1 = r1.f741\n if (r1 == 0) goto L_0x00ce\n r1.onLoadingFinish()\n L_0x00ce:\n return\n L_0x00cf:\n r1 = 0\n throw r1\n */\n throw new UnsupportedOperationException(\"Method not decompiled: a.a.a.a.e.a.f.h.onCreateCameraPipeline(com.arashivision.onestream.pipeline.ICameraPreviewPipeline):void\");\n }", "public SmartCamera( String cameraName ) {\r\n\t\t\r\n\t\tCameraServer.getInstance().setQuality(50);\r\n\t\t\r\n\t\ttry{\r\n\t\t\tframe = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);\r\n\t\r\n\t // the camera name (ex \"cam0\") can be found through the roborio web interface\r\n\t cameraSession = NIVision.IMAQdxOpenCamera( cameraName,\r\n\t NIVision.IMAQdxCameraControlMode.CameraControlModeController);\r\n\t NIVision.IMAQdxConfigureGrab(cameraSession);\r\n\t NIVision.IMAQdxStartAcquisition(cameraSession);\r\n\t\t}catch (VisionException vx){\r\n\t\t\tvisionBroken=true;\r\n\t\t}\r\n\t}", "public interface CameraDescriptor {\n /**\n * @return The possible preview sizes for the camera, in no\n * particular order\n */\n ArrayList<Size> getPreviewSizes();\n\n /**\n * @return The possible picture sizes for the camera, in no\n * particular order\n */\n ArrayList<Size> getPictureSizes();\n\n /**\n * Indicates if the camera (and this library) supports a\n * particular image format for pictures.\n *\n * @param format an ImageFormat value (e.g., ImageFormat.JPEG)\n * @return true if supported, false otherwise\n */\n boolean isPictureFormatSupported(int format);\n}", "private void setCamera() {\n\t\tCamera.CameraInfo cameraInfo = new Camera.CameraInfo();\n\t\tint cameraCount = Camera.getNumberOfCameras();\n\t\tLog.i(TAG, \"count = \" + cameraCount);\n\t\tLog.i(TAG, \"isBack = \" + isBack);\n\t\tint id = 0;\n\n\t\tfor (int camIdx = 0; camIdx < cameraCount; camIdx++) {\n\t\t\tCamera.getCameraInfo(camIdx, cameraInfo);\n\t\t\tLog.i(TAG, \"cameraInfoFacing = \" + cameraInfo.facing);\n\t\t\tif (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK\n\t\t\t\t\t&& isBack) {\n\t\t\t\ttry {\n\t\t\t\t\tLog.i(TAG, \"SETTING mCamera\");\n\t\t\t\t\tmCamera = Camera.open(camIdx);\n\t\t\t\t\tid = camIdx;\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\tLog.e(TAG,\n\t\t\t\t\t\t\t\"Camera failed to open: \" + e.getLocalizedMessage());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT\n\t\t\t\t\t&& !isBack){\n\t\t\t\ttry {\n\t\t\t\t\tLog.i(TAG, \"SETTING mCamera\");\n\t\t\t\t\tmCamera = Camera.open(camIdx);\n\t\t\t\t\tid = camIdx;\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\tLog.e(TAG,\n\t\t\t\t\t\t\t\"Camera failed to open: \" + e.getLocalizedMessage());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (mCamera != null) {\n\t\t\tCamera.Parameters cameraParameters = mCamera.getParameters();\n\t\t\tDisplay display = getActivity().getWindowManager().getDefaultDisplay();\n\t\t\tPoint size = new Point();\n\t\t\tdisplay.getSize(size);\n\t\t\tint screenWidth = size.x;\n\t\t\tint width = Integer.MAX_VALUE;\n\t\t\tint height = 0;\n\t\t\tLog.i(TAG, \"SCREENWIDTH: \" + screenWidth);\n\t\t\tList<Camera.Size> sizes = cameraParameters.getSupportedPreviewSizes();\n\t\t\tfor (Camera.Size cSize : sizes) {\n\t\t\t\tif (cSize.width >= screenWidth && cSize.width <= width) {\n\t\t\t\t\twidth = cSize.width;\n\t\t\t\t\theight = cSize.height;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tLog.i(TAG, \"Width: \" + width + \" HEIGHT: \" + height);\n\n\t\t\tif (mPreview != null) {\n\t\t\t\tmPreview.switchCamera(mCamera, id, width, height);\n\t\t\t} else {\n\t\t\t\tmPreview = new CameraPreview(getActivity(), mCamera, id, width, height);\n\t\t\t\tFrameLayout preview = (FrameLayout) view\n\t\t\t\t\t\t.findViewById(R.id.camera_preview);\n\t\t\t\tpreview.addView(mPreview);\n\t\t\t}\n\t\t\tmCamera.startPreview();\n\t\t}\n\t}", "public void updateCamera() {\n\t}", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "public interface CameraOpenListener {\n void onCameraError(Exception exc);\n\n void onCameraOpened(CameraController cameraController, int i, int i2);\n}", "private void addWithCamera() {\n if (PermissionUtils.isPermissionGranted(Manifest.permission.CAMERA)) {\n startCameraPage();\n } else {\n PermissionUtils.requestPermission(\n this,\n Manifest.permission.CAMERA,\n CAMERA_PERMISSION_REQUEST);\n }\n }" ]
[ "0.6435994", "0.6160698", "0.6151696", "0.6093684", "0.6031215", "0.60213435", "0.6020806", "0.59574115", "0.59538865", "0.595346", "0.59477496", "0.5928392", "0.5905893", "0.5893831", "0.58839303", "0.5853819", "0.58451396", "0.579084", "0.5765657", "0.57559127", "0.57509065", "0.57354516", "0.57156116", "0.57155156", "0.5710872", "0.5700896", "0.5698494", "0.5684931", "0.5681569", "0.5668554", "0.5645294", "0.56216025", "0.56008613", "0.55838954", "0.5580368", "0.5567892", "0.5554274", "0.552628", "0.5520151", "0.55170757", "0.5508735", "0.5506168", "0.5505723", "0.54825836", "0.547141", "0.54628474", "0.54579985", "0.5454705", "0.54395884", "0.5431998", "0.5423353", "0.5420425", "0.5413157", "0.5409541", "0.540656", "0.53933203", "0.53841794", "0.53815204", "0.5381511", "0.5381204", "0.5380004", "0.5373319", "0.53713304", "0.5368438", "0.53656375", "0.5362203", "0.53536016", "0.5350499", "0.5345942", "0.533514", "0.5321883", "0.5318459", "0.5308812", "0.5297565", "0.5295211", "0.529484", "0.52934647", "0.5291255", "0.52899086", "0.52886903", "0.5284004", "0.52838445", "0.52838445", "0.52714145", "0.5257516", "0.52565205", "0.52546155", "0.52423584", "0.52419114", "0.5232108", "0.52314705", "0.5226508", "0.52261627", "0.5202754", "0.5193504", "0.51824397", "0.51773524", "0.51754963", "0.5174945", "0.5171315" ]
0.80366844
0
Minimum constructor because RokidCamera will need at least an Activity and a TextureView. User can choose to add callback using the later setter methods.
private RokidCamera(Activity activity, TextureView textureView) { this.mActivity = activity; this.mTextureView = textureView; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "RokidCamera(RokidCameraBuilder rokidCameraBuilder) {\n this(rokidCameraBuilder.getActivity(), rokidCameraBuilder.getTextureView());\n this.mRokidCameraStateListener = rokidCameraBuilder.getRokidCameraStateListener();\n this.mRokidCameraIOListener = rokidCameraBuilder.getRokidCameraIOListener();\n this.mRokidCameraRecordingListener = rokidCameraBuilder.getRokidCameraRecordingListener();\n this.mRokidCameraOnImageAvailableListener = rokidCameraBuilder.getRokidCameraOnImageAvailableListener();\n this.mImageReaderCallbackMode = rokidCameraBuilder.getImageReaderCallbackMode();\n this.mPreviewEnabled = rokidCameraBuilder.isPreviewEnabled();\n this.mImageFormat = rokidCameraBuilder.getImageFormat();\n this.mMaxImages = rokidCameraBuilder.getMaxImages();\n this.mSizePreview = rokidCameraBuilder.getRokidCameraSizePreview();\n this.mSizeImageReader = rokidCameraBuilder.getRokidCameraSizeImageReader();\n this.mSizeVideoRecorder = rokidCameraBuilder.getRokidCameraSizeVideoRecorder();\n this.mRokidCameraParamAFMode = rokidCameraBuilder.getRokidCameraParamAFMode();\n this.mRokidCameraParamAEMode = rokidCameraBuilder.getRokidCameraParamAEMode();\n this.mRokidCameraParamAWBMode = rokidCameraBuilder.getRokidCameraParamAWBMode();\n this.mRokidCameraParamCameraId = rokidCameraBuilder.getRokidCameraParamCameraId();\n }", "public Camera() {\r\n this(1, 1);\r\n }", "@Override\n public void init() {\n startCamera();\n }", "abstract void setPreviewCallback(android.hardware.Camera.PreviewCallback cb);", "public void onCamera();", "public TextureView$SurfaceTextureListenerC32431ew(Context context, C32451ey r11, boolean z) {\n C33171gJ r1;\n AnonymousClass0VV r0;\n EnumC21070y8 r8 = EnumC21070y8.CAMERA2;\n EnumC21070y8 r7 = EnumC21070y8.CAMERA1;\n this.A0D = context.getApplicationContext();\n this.A0T = \"WhatsAppCamera\";\n this.A0L = z ? r8 : r7;\n this.A0K = r11;\n this.A0J = new C19860vj();\n HandlerThread handlerThread = new HandlerThread(\"Simple-Lite-Camera-Callback-Thread\");\n this.A0E = handlerThread;\n handlerThread.start();\n C21110yC A002 = C21110yC.A00();\n Context context2 = this.A0D;\n EnumC21070y8 r4 = this.A0L;\n if (A002 != null) {\n if (r4 == r7) {\n C22170zz r5 = A002.A01;\n C22150zx r42 = A002.A00;\n if (C33081gA.A0e == null) {\n synchronized (C33081gA.class) {\n if (C33081gA.A0e == null) {\n C33081gA.A0e = new C33081gA(r5, r42, context2);\n }\n }\n } else if (C33081gA.A0e.A0R != r5) {\n throw new RuntimeException(\"ThreadManager instance has changed!\");\n } else if (C33081gA.A0e.A0Q != r42) {\n throw new RuntimeException(\"SessionManager instance has changed!\");\n }\n C33081gA r12 = C33081gA.A0e;\n r12.A0D = true;\n r1 = r12;\n } else if (r4 != r8) {\n StringBuilder sb = new StringBuilder(\"Invalid Camera API: \");\n sb.append(r4);\n throw new RuntimeException(sb.toString());\n } else if (context2 != null) {\n C22170zz r52 = A002.A01;\n C22150zx r43 = A002.A00;\n if (C33171gJ.A0o == null) {\n synchronized (C33171gJ.class) {\n if (C33171gJ.A0o == null) {\n C33171gJ.A0o = new C33171gJ(r52, r43, context2);\n }\n }\n } else if (C33171gJ.A0o.A0b != r52) {\n throw new RuntimeException(\"ThreadManager instance has changed!\");\n } else if (C33171gJ.A0o.A0a != r43) {\n throw new RuntimeException(\"SessionManager instance has changed!\");\n }\n C33171gJ r13 = C33171gJ.A0o;\n r13.A0J = true;\n r1 = r13;\n } else {\n throw new NullPointerException(\"Context must be provided for Camera2.\");\n }\n this.A0M = r1;\n if (0 == 0) {\n r0 = AnonymousClass0VV.BACK;\n } else if (0 == 1) {\n r0 = AnonymousClass0VV.FRONT;\n } else {\n throw new RuntimeException(AnonymousClass008.A0F(\"Could not convert camera facing to optic: \", 0));\n }\n this.A00 = !r1.AAF(r0) ? 1 : 0;\n this.A0C = true;\n TextureView textureView = new TextureView(this.A0D);\n this.A0G = textureView;\n textureView.setSurfaceTextureListener(this);\n this.A0F = new C19850vi(this, this.A0D);\n return;\n }\n throw null;\n }", "public void init(Camera cam);", "private CameraManager() {\n }", "@Override\n\tpublic void initCameraGlSurfaceView() {\n\t\t\n\t}", "private void onCameraOpened() {\n SurfaceTexture texture = targetView.getSurfaceTexture();\n\n if (texture != null) {\n targetSurface = new Surface(texture);\n onSurfaceReceived();\n }\n else {\n targetView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {\n @Override\n public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {\n targetSurface = new Surface(surfaceTexture);\n onSurfaceReceived();\n }\n public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {\n return false;\n }\n\n @Override\n public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {\n\n }\n\n @Override\n public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) {\n\n }\n });\n }\n }", "void onBind(String cameraId);", "@Override\n public void startCamera() {\n super.startCamera();\n\n if(cameraListener != null)\n cameraListener.onCameraStart();\n }", "public CameraSurfaceView(Context context, AttributeSet attrs) {\n\t\tsuper(context, attrs);\n\t\tinit();\n\t}", "void initializeCamera() {\n camera_linear = (LinearLayout) findViewById(R.id.camera_linear);\n //The preview frame is overlayed on the layout which shows the camera view.\n preview = (FrameLayout) findViewById(R.id.camera_preview);\n //Get an instance of the phone's camera.\n mCamera = cameraRecorder.getCameraInstance();\n //Find content fort the camera preview frame using the instance of the camera initialized.\n mPreview = new CameraPreview(getApplicationContext(), mCamera);\n //Apply the camera previes content from the camera to the preview frame itself.\n preview.addView(mPreview);\n }", "public interface CameraOpenListener {\n void onCameraError(Exception exc);\n\n void onCameraOpened(CameraController cameraController, int i, int i2);\n}", "public MFaceCameraView(Context context, AttributeSet attrs) {\n super(context, attrs);\n }", "public Camera(){\n // servoPan = new Servo(PAN);\n servoTilt = new Servo(TILT);\n }", "private void oldOpenCamera() {\n try {\n mCamera = Camera.open(); // attempt to get a Camera instance\n mCamera.setPreviewCallbackWithBuffer(this);\n Log.i(TAG, \"Instance created\");\n } catch (Exception e) {\n Log.e(TAG, \"Error getting Camera instance: \" + e.getMessage());\n }\n }", "public interface CameraListener {\n void onCameraStart();\n void onCameraStop();\n }", "public Camera() {\n\t\treset();\n\t}", "public interface CameraPreview {\n\n /**\n * Set the camera system this will act as the preview for.\n * <p/>\n * The preview will update the camera system as necessary for certain events, such as\n * setting the surface holder, or pausing/restarting the preview when reconfiguring the surface.\n *\n * @param cameraSystem the camera system to connect to\n */\n void connectToCameraSystem(@NonNull CameraSystem cameraSystem);\n\n}", "public void initializeCamera(){\n mCamera = Camera.open();\n\n Camera.Parameters parameters = mCamera.getParameters();\n parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);\n\n List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();\n // Get the supported preview size closest to the requested dimensions:\n Camera.Size previewSize = previewSizes.get(previewSizes.size() - 1); // getOptimalPreviewSize(previewSizes, width, height);\n width = previewSize.width;\n height = previewSize.height;\n Log.d(TAG, \"width: \" + width + \" , height: \" + height);\n nPixels = width * height;\n pixels = new int[nPixels];\n setSize(width, height);\n parameters.setPreviewSize(width, height);\n\n mCamera.setParameters(parameters);\n\n int dataBufferSize=(int)(height * width * (ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())/8.0));\n\n mCamera.addCallbackBuffer(new byte[dataBufferSize]);\n mCamera.setPreviewCallbackWithBuffer(this);\n }", "public interface CameraCallback {\n\n public void onPhotoTaken(String path);\n}", "void initCameraManager(){\n\t\tcameraManager = new CameraManager(getApplication());\n\t}", "@Override\r\n\tpublic void surfaceCreated(SurfaceHolder holder) \r\n\t{\n\t\t if (mCamera != null)\r\n\t\t {\r\n\t\t\t Parameters params = mCamera.getParameters();\r\n\t mCamera.setParameters(params);\r\n\t Log.i(\"Surface\", \"Created\");\r\n\t }\r\n\t\t else\r\n\t\t {\r\n\t\t\t Toast.makeText(getApplicationContext(), \"Camera not available!\",\r\n\t Toast.LENGTH_LONG).show();\r\n\r\n\t finish();\r\n\t }\r\n\t}", "@Override\n\t\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\tcam.setCamera(getCameraInstance(getDefaultCameraId()));\n\t\t\t\t}", "Camera getCamera();", "public void init(HardwareMap hwMap){\n int cameraMonitorViewID = hwMap.appContext.getResources().getIdentifier(\"cameraMonitorViewId\", \"id\", hwMap.appContext.getPackageName());\n phoneCam = OpenCvCameraFactory.getInstance().createInternalCamera(OpenCvInternalCamera.CameraDirection.BACK,cameraMonitorViewID);\n phoneCam.openCameraDevice();\n phoneCam.setPipeline(counter);\n phoneCam.openCameraDeviceAsync(new OpenCvCamera.AsyncCameraOpenListener()\n {\n @Override\n public void onOpened()\n {\n phoneCam.startStreaming(320, 240, OpenCvCameraRotation.UPRIGHT);\n }\n });\n }", "public static void init(Context context) {\n\t\tif (cameraManager == null) {\n\t\t\tcameraManager = new CameraManager(context);\n\t\t}\n\t}", "@Override\r\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\tinitialCamera();\r\n\t}", "public void configureCamera(){\n try{\n camera = Camera.open(findBackFacingCamera());\n } catch (Exception e){}\n\n if(camera != null) {\n cameraView = new CameraView(this.getApplicationContext(), camera);\n FrameLayout camera_view = (FrameLayout)findViewById(R.id.CameraView);\n camera_view.addView(cameraView);\n }\n }", "private void initCamera(SurfaceHolder surfaceHolder) {\n\t\tif (surfaceHolder == null) {\n\t\t throw new IllegalStateException(\"No SurfaceHolder provided\");\n\t\t }\n\t\tif (cameraManager.isOpen()) {\n\t\t Log.w(TAG, \"initCamera() while already open -- late SurfaceView callback?\");\n\t\t return;\n\t\t }\n\t\ttry {\n\t\t\tcameraManager.openDriver(surfaceHolder);\n\t\t\t// Creating the handler starts the preview, which can also throw a\n\t\t\t// RuntimeException.\n\t\t\t if (handler == null) {\n\t\t\t handler = new CaptureActivityHandler(this, null, null, \"UTF-8\", cameraManager);\n\t\t\t }\n\t\t\t decodeOrStoreSavedBitmap(null, null);\n\t\t} catch (IOException ioe) {\n\t\t\tLog.w(TAG, ioe);\n\t\t\t// displayFrameworkBugMessageAndExit();\n\t\t\tCommonTask.ShowMessage(this, \"IOException\\n\" + ioe.getMessage());\n\t\t} catch (RuntimeException e) {\n\t\t\t// Barcode Scanner has seen crashes in the wild of this variety:\n\t\t\t// java.?lang.?RuntimeException: Fail to connect to camera service\n\t\t\tLog.w(TAG, \"Unexpected error initializating camera\", e);\n\t\t\tCommonTask.ShowMessage(this, \"RuntimeException\\n\" + e.getMessage());\n\t\t\t// displayFrameworkBugMessageAndExit();\n\t\t}\n\t}", "public void openCamera() {\n \n\n }", "private void createCameraSource() {\n Context ctx = getApplicationContext();\n Point displaySize = new Point();\n getWindowManager().getDefaultDisplay().getRealSize(displaySize);\n\n // dummy detector saving the last frame in order to send it to Microsoft in case of face detection\n ImageFetchingDetector imageFetchingDetector = new ImageFetchingDetector();\n\n // We need to provide at least one detector to the camera :x\n FaceDetector faceDetector = new FaceDetector.Builder(ctx).build();\n faceDetector.setProcessor(\n new LargestFaceFocusingProcessor.Builder(faceDetector, new FaceTracker(imageFetchingDetector))\n .build());\n\n BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(ctx).build();\n //barcodeDetector.setProcessor(new BarcodeDetectionProcessor());\n barcodeDetector.setProcessor(\n new FirstFocusingProcessor<Barcode>(barcodeDetector, new BarcodeTracker())\n );\n\n TextRecognizer textRecognizer = new TextRecognizer.Builder(ctx).build();\n textRecognizer.setProcessor(new OcrDetectionProcessor());\n // TODO: Check if the TextRecognizer is operational.\n\n MultiDetector multiDetector = new MultiDetector.Builder()\n .add(imageFetchingDetector)\n .add(faceDetector)\n .add(barcodeDetector)\n .add(textRecognizer)\n .build();\n\n mCameraSource = new CameraSource.Builder(ctx, multiDetector)\n .setFacing(CameraSource.CAMERA_FACING_BACK)\n .setAutoFocusEnabled(true)\n .setRequestedFps(5.0f)\n .setRequestedPreviewSize(displaySize.y, displaySize.x)\n .build();\n }", "private void initCameraPreview() {\n\t\tcameraPreview = (CameraPreview) findViewById(R.id.camera_preview);\n\t\tcameraPreview.init(camera);\n\t}", "@Override\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\tLog.e(TAG,\"Surface Created\");\n\t\tcamera = Camera.open();\n\t}", "public CameraManager(HardwareMap hardwareMap) {\n int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(\"cameraMonitorViewId\", \"id\", hardwareMap.appContext.getPackageName());\n phoneCam = OpenCvCameraFactory.getInstance().createInternalCamera(OpenCvInternalCamera.CameraDirection.BACK, cameraMonitorViewId);\n pipeline = new CvPipeline();\n phoneCam.setPipeline(pipeline);\n }", "public GameCamera(RefLinks refLinks, float xOffset, float yOffset)\n {\n this.refLinks = refLinks;\n this.xOffset = xOffset;\n this.yOffset = yOffset;\n }", "public MultiCameraModule(AppController app) {\n super(app);\n mDetectionManager = new DetectionManager(app, this, null);\n mAaaControl = new ControlImpl(app, this, true, null);\n mRemoteTouchFocus = new RemoteTouchFocus(app.getServices().getSoundPlayback(), app,\n new RemoteAaaListener(), app.getCameraAppUi().getModuleLayoutRoot());\n mCameraIdManager = new CameraIdManager();\n mFocusStateListenerMangaer = new FocusStateListenerMangaer();\n mCameraSemaphoreCtrl = new CameraSemaphoreCtrl();\n }", "private void createCamera() {\n camera = getCameraInstance();\n // Setting the right parameters in the camera\n SetCameraParameters();\n // Create our Preview view and set it as the content of our activity.\n camera_preview = new CameraPreview(this, camera);\n // Adding the camera preview after the FrameLayout and before the mainact_btn_InOutAct\n // as a separated element.\n InOut_cameraLayout.addView(camera_preview, 0);\n }", "public interface ICamera {\n}", "private Camera() {\n viewport = new Rectangle();\n dirtyAreas = new ArrayList<Rectangle>();\n renderedAreas = new ArrayList<Rectangle>();\n fullUpdate = false;\n dirtyAreaCounter = 0;\n }", "void Initialize(MainActivity mainActivity_, FrameLayout frameLayout_){\n mainActivity = mainActivity_;\n cameraPreviewLayout = frameLayout_;\n\n if (ContextCompat.checkSelfPermission(mainActivity, Manifest.permission.CAMERA) == PackageManager.PERMISSION_DENIED)\n ActivityCompat.requestPermissions(mainActivity, new String[] {Manifest.permission.CAMERA}, MY_CAMERA_REQUEST_CODE);\n else\n Setup();\n }", "public MapsCameraFragment() {\n // Required empty public constructor\n }", "public SimplePreset(int cameraId) {\n super(cameraId);\n }", "@Override\n public void onFrameAvailable(int cameraId) {\n }", "@Override\n public void onFrameAvailable(int cameraId) {\n }", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "public void startCamera()\n {\n startCamera(null);\n }", "@Override\n public void onCameraOpenFailed(Exception e) {\n }", "public interface ICamera {\n\n /**\n * Return frame access interface for client usage\n *\n * @param interface_index\n * @return\n */\n public long getFrameAccessIfc(int interface_index);\n\n /**\n * Start the camera stream\n */\n public void start();\n\n /**\n * Stop the camera stream\n */\n public void stop();\n\n public String prepare(final UsbMonitor.UsbConnectionData connectionData);\n\n /**\n * Register json status callback\n *\n * @param callback\n */\n public void setStatusCallback(final IStatusCallback callback);\n\n /**\n * Queries camera for supported mode\n *\n * @return supported video modes String\n */\n public String getSupportedVideoModes();\n\n// /**\n// * Select camera capture mode\n// *\n// * @param width\n// * @param height\n// * @param frameFormat\n// */\n// public void setCaptureMode(final int width, final int height, final int frameFormat);\n\n /**\n * Select camera capture mode\n *\n * @param width\n * @param height\n * @param min_fps\n * @param max_fps\n * @param frameFormat\n */\n public void setCaptureMode(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat);\n}", "public void prepareCamera() {\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n\n autoFocusHandler = new Handler();\n mCamera = getCameraInstance();\n\n /* Instance barcode scanner */\n scanner = new ImageScanner();\n scanner.setConfig(0, Config.X_DENSITY, 3);\n scanner.setConfig(0, Config.Y_DENSITY, 3);\n\n mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);\n\n cameraPreview.addView(mPreview);\n\n }", "public ReflectedCamera(Camera camera) {\n this(camera, true);\n }", "@RestrictTo(Scope.LIBRARY_GROUP)\n protected void onCameraControlReady(String cameraId) {\n }", "public void surfaceCreated(SurfaceHolder holder) {\n startCamera(holder);\n }", "@Override\n public void onOpened(@NonNull CameraDevice cameraDevice) {\n mCameraOpenCloseLock.release();\n mCameraDevice = cameraDevice;\n if (null != mTextureView) {\n configureTransform(mTextureView.getWidth(), mTextureView.getHeight());\n }\n createCameraPreviewSession();\n }", "@Override\r\n public void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.custom_cameraactivity);\r\n mCamera = getCameraInstance();\r\n mCameraPreview = new CameraPreview(this, mCamera);\r\n FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);\r\n preview.addView(mCameraPreview);\r\n\r\n Bundle extras = getIntent().getExtras();\r\n looc = extras.getString(\"coor\");\r\n\r\n Button captureButton = (Button) findViewById(R.id.button_capture);\r\n captureButton.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n mCamera.takePicture(null, null, mPicture);\r\n // havent try to use doinbackgroud test first\r\n\r\n }\r\n });\r\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n setupCamera(width, height);\n openCamera();\n }", "@Override\r\n\tpublic void onCreate (Bundle savedInstanceState) \r\n\t{\r\n\t\t// -------------------------------------------------------------------------\r\n\t\tsuper.onCreate (savedInstanceState);\r\n\t\t// -------------------------------------------------------------------------\r\n\t\t// 16/06/2017 ECU check if the camera settings have been set - if not then\r\n\t\t// create the object\r\n\t\t// -------------------------------------------------------------------------\r\n\t\tif (PublicData.storedData.cameraSettings == null)\r\n\t\t{\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 16/06/2017 ECU create a new instance of the settings\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tPublicData.storedData.cameraSettings = new CameraSettings ();\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t}\r\n\t\t// -------------------------------------------------------------------------\r\n\t\tif (savedInstanceState == null)\r\n\t\t{\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 03/05/2015 ECU cannot use the normal Utilities.SetUpActivity because of\r\n\t\t\t// the orientation and trying to keep the screen on\r\n\t\t\t// ECU updated the SetUpActivity so that orientation can be\r\n\t\t\t// passed through\r\n\t\t\t// 29/05/2016 ECU change to use 'portrait' mode\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tUtilities.SetUpActivity (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT,\r\n\t\t\t\t\t\t\t\t\t this,\r\n\t\t\t\t\t\t\t\t\t StaticData.ACTIVITY_FULL_SCREEN,\r\n\t\t\t\t\t\t\t\t\t !StaticData.ACTIVITY_SCREEN_ON);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 29/05/2016 ECU remember the context for later use\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tcontext = this;\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 15/06/2017 ECU initialise any static variables\r\n\t\t\t// 18/09/2017 ECU added video streaming\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tdestinationFileName\t= null;\r\n\t\t\tvideoStreaming\t\t= false;\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 15/06/2017 ECU create the handler that will process the record actions\r\n\t\t\t// when a destination file has been specified and the\r\n\t\t\t// recorder is to be started automatically\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\trecordHandler\t\t= new MessageHandler ();\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 15/06/2017 ECU check if a destination file name has been fed through\r\n\t\t\t// which indicates that recording is to start automatically\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tBundle extras = getIntent().getExtras();\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tif (extras != null)\r\n\t\t\t{\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\t// 15/06/2017 ECU check if file name passed through\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\tdestinationFileName = extras.getString (StaticData.PARAMETER_FILE_NAME);\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\t// 18/09/2017 ECU check if video streaming has been requested\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\tvideoStreaming = extras.getBoolean (StaticData.PARAMETER_VIDEO_STREAM, false);\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\t// 27/09/2017 ECU if video streaming is on then allow access to\r\n\t\t\t\t// the network from the UI\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\tif (videoStreaming)\r\n\t\t\t\t\tAPIIssues.NetworkOnMainUIThread (android.os.Build.VERSION.SDK_INT);\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t}\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 11/10/2015 ECU the activity has been created anew\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tsetContentView (R.layout.activity_video_recorder);\r\n\t\t\tsurfaceView = (SurfaceView) findViewById (R.id.camera_surface_view);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 17/06/2017 ECU get details of the timer\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\ttimerTextView = (TextView) findViewById (R.id.video_timer);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 18/06/2017 ECU declare the text view that will be used to hide the\r\n\t\t\t// surface view\r\n\t\t\t// ----------------------------------------------------------------------\r\n\t\t\thideSurfaceView = (TextView) findViewById (R.id.video_hide_view);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 25/05/2016 ECU set up the surface that will be used for the camera\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tsurfaceHolder = surfaceView.getHolder(); \r\n\t\t\tsurfaceHolder.addCallback (this); \r\n\t\t\tsurfaceHolder.setType (SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 25/05/2016 ECU set up the buttons and their listeners\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tchangeCameraButton\t= (ImageButton) findViewById (R.id.video_camera);\r\n\t\t\trecordButton \t\t= (ImageButton) findViewById (R.id.video_record_button);\r\n\t\t\t\r\n\t\t\tchangeCameraButton.setOnClickListener (cameraChangeOnClickListener);\r\n\t\t\trecordButton.setOnClickListener (buttonOnClickListener);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 29/05/2016 ECU preset some variables\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\trecording \t\t= false;\r\n\t\t\trecordingMode \t= StaticData.VIDEO_RECORDER_RECORD;\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 11/10/2015 ECU the activity has been recreated after having been\r\n\t\t\t// destroyed by the Android OS\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tfinish (); \r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t}\r\n\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_camera_preview);\n\t\tmCamSV = (SurfaceView) findViewById(R.id.camera_preview_surface_cam);\n\n\t\tmCamSV.getHolder().setFixedSize(VisionConfig.getWidth(),\n\t\t\t\tVisionConfig.getHeight());\n\n\t\tLog.i(\"MyLog\", \"CAP: onCreate\");\n\n\t\t// Setup Bind Service\n\t\tVisionConfig.bindService(this, mConnection);\n\t\ttakeAPictureReceiver = new TakeAPictureReceiver();\n\t\tIntentFilter filterOverlayVision = new IntentFilter(\n\t\t\t\tRobotIntent.CAM_TAKE_PICKTURE);\n\t\tHandlerThread handlerThreadOverlay = new HandlerThread(\n\t\t\t\t\"MyNewThreadOverlay\");\n\t\thandlerThreadOverlay.start();\n\t\tLooper looperOverlay = handlerThreadOverlay.getLooper();\n\t\thandlerOverlay = new Handler(looperOverlay);\n\t\tregisterReceiver(takeAPictureReceiver, filterOverlayVision, null,\n\t\t\t\thandlerOverlay);\n\t\t\n\t\tfaceDetectionReceiver = new FaceDetectionReceiver();\n\t\tIntentFilter filterFaceDetection = new IntentFilter(RobotIntent.CAM_FACE_DETECTION);\n\t\tHandlerThread handlerThreadFaceDetectionOverlay = new HandlerThread(\n\t\t\t\t\"MyNewThreadFaceDetectionOverlay\");\n\t\thandlerThreadFaceDetectionOverlay.start();\n\t\tLooper looperFaceDetectionOverlay = handlerThreadFaceDetectionOverlay.getLooper();\n\t\thandleFaceDetection = new Handler(looperFaceDetectionOverlay);\n\t\tregisterReceiver(faceDetectionReceiver, filterFaceDetection, null,\n\t\t\t\thandleFaceDetection);\n\t\t\n\t\t\n//\t\tfaceDetectionReceiver2 = new FaceDetectionReceiver2();\n//\t\tIntentFilter filterFaceDetection2 = new IntentFilter(\"hhq.face\");\n//\t\tHandlerThread handlerThreadFaceDetectionOverlay2 = new HandlerThread(\n//\t\t\t\t\"MyNewThreadFaceDetectionOverlay2\");\n//\t\thandlerThreadFaceDetectionOverlay2.start();\n//\t\tLooper looperFaceDetectionOverlay2 = handlerThreadFaceDetectionOverlay2.getLooper();\n//\t\thandleFaceDetection2 = new Handler(looperFaceDetectionOverlay2);\n//\t\tregisterReceiver(faceDetectionReceiver2, filterFaceDetection2, null,\n//\t\t\t\thandleFaceDetection2);\t\t\n\n\t\t\t\t\n\t\tpt.setColor(Color.GREEN);\n\t\tpt.setTextSize(50);\n\t\tpt.setStrokeWidth(3);\n\t\tpt.setStyle(Paint.Style.STROKE);\n\t\t\n//\t\tpt2.setColor(Color.BLUE);\n//\t\tpt2.setTextSize(50);\n//\t\tpt2.setStrokeWidth(3);\n//\t\tpt2.setStyle(Paint.Style.STROKE);\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n this.requestWindowFeature(Window.FEATURE_NO_TITLE);\n this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);\n setContentView(R.layout.main);\n cameraframe = (FrameLayout) findViewById(R.id.preview);\n overlayview = new ImageView(getApplicationContext());\n\t overlayview.setScaleType(ImageView.ScaleType.FIT_XY);\n\n previewing=false;\n freestyle=false;\n \n\t// set up camera, start button\n cameraView = new Preview(this); // <3>\n\n\t cameraframe.addView(cameraView,0); // <4>\n\n\t \n\t\n\t\n\t setupButtons();\n initCamera();\n \n \n\t\n\t\n\t\n \n\tloadFrames();\n\t initFileSystem();\n\t \n //retakeButton.setEnabled(false);\n\t toggleMode();\n \n Log.d(TAG, \"Fully initialized\");\n }", "public synchronized void requestPreviewFrame(Camera.PreviewCallback cb) {\n OpenCamera theCamera = camera;\n if (theCamera != null && previewing) {\n theCamera.getCamera().setOneShotPreviewCallback(cb);\n }\n }", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_camera);\n\t\t\n\t \n\t\t\n\t\t\tcam=(CameraPreview) this.findViewById(R.id.camera);\n\t\t\tthis.findViewById(R.id.startButton).setOnClickListener(new View.OnClickListener() {\n\t\t\t\t\n\t\t\t\t@Override\n\t\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tcam.setCamera(getCameraInstance(getDefaultCameraId()));\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t\t\n\t}", "public void onCreate(Bundle bundle) {\n super.onCreate(bundle);\n SystemBar.m33556a((Activity) this, 0);\n SystemBar.m33562b((Activity) this, 0);\n SystemBar.m33561b((Activity) this);\n SystemBar.m33561b((Activity) this);\n if (bundle != null) {\n this.f26280d = bundle.getInt(\"INSTANCE_CAMERA_FUNCTION\");\n this.f26281e = bundle.getString(\"INSTANCE_CAMERA_FILE_PATH\");\n this.f26282f = bundle.getInt(\"INSTANCE_CAMERA_QUALITY\");\n this.f26283j = bundle.getLong(\"INSTANCE_CAMERA_DURATION\");\n this.f26284k = bundle.getLong(\"INSTANCE_CAMERA_BYTES\");\n return;\n }\n Bundle extras = getIntent().getExtras();\n if (f26279c || extras != null) {\n this.f26280d = extras.getInt(\"KEY_INPUT_FUNCTION\");\n this.f26281e = extras.getString(\"KEY_INPUT_FILE_PATH\");\n this.f26282f = extras.getInt(\"KEY_INPUT_CAMERA_QUALITY\");\n this.f26283j = extras.getLong(\"KEY_INPUT_CAMERA_DURATION\");\n this.f26284k = extras.getLong(\"KEY_INPUT_CAMERA_BYTES\");\n int i = this.f26280d;\n if (i == 0) {\n if (TextUtils.isEmpty(this.f26281e)) {\n this.f26281e = AlbumUtils.m33548b((Context) this);\n }\n mo37679a(f26328g, 1);\n } else if (i == 1) {\n if (TextUtils.isEmpty(this.f26281e)) {\n this.f26281e = AlbumUtils.m33552c((Context) this);\n }\n mo37679a(f26329h, 2);\n } else {\n throw new AssertionError(\"This should not be the case.\");\n }\n } else {\n throw new AssertionError();\n }\n }", "public void setCamera(Camera c) {\n\t\tmCamera = c;\n\t}", "public void onCameraPicked(String newCameraId);", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n createCameraPreview();\n }", "void cameraSetup();", "@JsConstructor\n public ScreenSpaceCameraController(Scene scene) {}", "public interface AutoFocusCallback\n {\n /**\n * Callback for the camera auto focus.\n * \n * @param success true if focus was successful, false if otherwise\n * @param camera the Camera service object\n */\n void onAutoFocus(boolean success, Camera camera);\n }", "private void init() {\n add_camera_action_two = (Button) findViewById(R.id.add_camera_action_two);\n add_camera_action_two.setOnClickListener(new View.OnClickListener() {\n\n @Override\n public void onClick(View arg0) {\n // TODO Auto-generated method stub\n Intent i = new Intent(mContext, AddCameraThirdActivity.class);\n startActivity(i);\n finish();//@@8.10\n }\n });\n }", "void onCameraError();", "public VideoStream(int camera) {\n\t\tsuper();\n\t\tsetCamera(camera);\n\t}", "private void init() {\n SurfaceHolder holder = getHolder();\n holder.addCallback(this);\n }", "protected void initialize() {\n \tm_cameraThread = new CameraThread();\n \tm_cameraThread.start();\n \tm_onTarget = false;\n \tm_moving = false;\n \tm_desiredYaw = Gyro.getYaw();\n \t\n \t\n \tcount = 0;\n }", "private native void iniciarCamara(int idCamera);", "private void setupRenderer() {\n mSurfaceView.setEGLContextClientVersion(2);\n mRenderer = new WiFiAugmentedRealityRenderer(this,\n new WiFiAugmentedRealityRenderer.RenderCallback() {\n private double lastRenderedTimeStamp;\n\n @Override\n public void preRender() {\n // This is the work that you would do on your main OpenGL render thread.\n\n try {\n // Synchronize against concurrently disconnecting the service triggered\n // from the UI thread.\n synchronized (WiFiAugmentedRealityActivity.this) {\n // We need to be careful to not run any Tango-dependent code in the\n // OpenGL thread unless we know the Tango service to be properly\n // set-up and connected.\n if (!mIsConnected) {\n return;\n }\n\n // Connect the Tango SDK to the OpenGL texture ID where we are\n // going to render the camera.\n // NOTE: This must be done after both the texture is generated\n // and the Tango service is connected.\n if (mConnectedTextureIdGlThread != mRenderer.getTextureId()) {\n mTango.connectTextureId(\n TangoCameraIntrinsics.TANGO_CAMERA_COLOR,\n mRenderer.getTextureId());\n mConnectedTextureIdGlThread = mRenderer.getTextureId();\n Log.d(TAG, \"connected to texture id: \" +\n mRenderer.getTextureId());\n\n // Set-up scene camera projection to match RGB camera intrinsics\n mRenderer.setProjectionMatrix(\n projectionMatrixFromCameraIntrinsics(mIntrinsics));\n }\n // If there is a new RGB camera frame available, update the texture\n // and scene camera pose.\n if (mIsFrameAvailableTangoThread.compareAndSet(true, false)) {\n // {@code mRgbTimestampGlThread} contains the exact timestamp at\n // which the rendered RGB frame was acquired.\n mRgbTimestampGlThread =\n mTango.updateTexture(TangoCameraIntrinsics.\n TANGO_CAMERA_COLOR);\n\n // Get the transform from color camera to Start of Service\n // at the timestamp of the RGB image in OpenGL coordinates.\n //\n // When drift correction mode is enabled in config file, we need\n // to query the device with respect to Area Description pose in\n // order to use the drift corrected pose.\n //\n // Note that if you don't want to use the drift corrected pose,\n // the normal device with respect to start of service pose is\n // still available.\n TangoSupport.TangoMatrixTransformData transform =\n TangoSupport.getMatrixTransformAtTime(\n mRgbTimestampGlThread,\n TangoPoseData\n .COORDINATE_FRAME_AREA_DESCRIPTION,\n TangoPoseData.COORDINATE_FRAME_CAMERA_COLOR,\n TangoSupport.TANGO_SUPPORT_ENGINE_OPENGL,\n TangoSupport.TANGO_SUPPORT_ENGINE_OPENGL,\n 0);\n if (transform.statusCode == TangoPoseData.POSE_VALID) {\n\n mRenderer.updateViewMatrix(transform.matrix);\n double deltaTime = mRgbTimestampGlThread\n - lastRenderedTimeStamp;\n lastRenderedTimeStamp = mRgbTimestampGlThread;\n }\n// } else {\n// // When the pose status is not valid, it indicates tracking\n// // has been lost. In this case, we simply stop rendering.\n// //\n// // This is also the place to display UI to suggest the user\n// // walk to recover tracking.\n// Log.w(TAG, \"Could not get a valid transform at time \" +\n// mRgbTimestampGlThread);\n// }\n }\n }\n // Avoid crashing the application due to unhandled exceptions\n } catch (TangoErrorException e) {\n Log.e(TAG, \"Tango API call error within the OpenGL render thread\", e);\n } catch (Throwable t) {\n Log.e(TAG, \"Exception on the OpenGL thread\", t);\n }\n }\n });\n\n // Set the starting position and orientation of the Earth and Moon respect the OpenGL frame.\n Matrix.setIdentityM(mOpenGLTEarthMoonCenter, 0);\n Matrix.translateM(mOpenGLTEarthMoonCenter, 0, 0, 0, -1f);\n Matrix.setIdentityM(mEarthMoonCenterTEarth, 0);\n Matrix.setIdentityM(mEarthMoonCenterTMoonRotation, 0);\n Matrix.setIdentityM(mEarthMoonCenterTTranslation, 0);\n Matrix.translateM(mEarthMoonCenterTTranslation, 0, 0.5f, 0, 0);\n\n mSurfaceView.setRenderer(mRenderer);\n }", "private void setupCamera(final int camera) {\n try {\n // mPreview = new CamPreview(this, camera, CamPreview.LayoutMode.NoBlank);// .FitToParent);\n } catch (Exception e) {\n Toast.makeText(this, R.string.cannot_connect_to_camera, Toast.LENGTH_LONG).show();\n finish();\n return;\n }\n\n RelativeLayout.LayoutParams previewLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n Display display = getWindowManager().getDefaultDisplay();\n DisplayMetrics outMetrics = new DisplayMetrics();\n display.getMetrics(outMetrics);\n\n int width = outMetrics.widthPixels;\n int height = outMetrics.heightPixels;\n\n previewLayoutParams.height = width;\n previewLayoutParams.width = width;\n\n // Un-comment below line to specify the position.\n // mPreview.setCenterPosition(width / 2, height / 2);\n\n // previewParent.addView(mPreview, 0, previewLayoutParams);\n\n\n }", "public static Camera getCameraInstance(){\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {\n return Camera.open(0); // This is the line the error occurs\n } else {\n return Camera.open();\n }\n }", "public interface Camera extends GameObject {\n\n public static final byte FORWARDS = 0x0;\n public static final byte LEFT = 0x1;\n public static final byte BACKWARDS = 0x2;\n public static final byte RIGHT = 0x3;\n\n /**\n * The default camera controls.\n */\n public static final byte[] DEFAULT_CAMERA_CONTROLLER = {\n Keys.KEY_W, Keys.KEY_A, Keys.KEY_S, Keys.KEY_D\n };\n\n /**\n * @return the position of the <code>Camera</code> in the world\n */\n public abstract ReadableVector3f getPosition();\n\n /**\n * @param deltaX the change along the X axis\n * @param deltaY the change along the Y axis\n * @param deltaZ the change along the Z axis\n */\n public abstract void translate(float deltaX, float deltaY, float deltaZ);\n\n public abstract void translate(ReadableVector3f delta);\n\n /**\n * @param position the new position of the <code>Camera</code>\n */\n public abstract void setPosition(ReadableVector3f position);\n}", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n protected void onStart() {\n camera_ = getCameraInstance();\n Parameters params;\n\n if (camera_ != null) {\n params = camera_.getParameters();\n params.setPreviewFormat(ImageFormat.NV21);\n getSmallestPreviewSize(params);\n params.setPreviewSize(width_, height_);\n //params.setFlashMode(Parameters.FLASH_MODE_TORCH);\n params.setWhiteBalance(Parameters.WHITE_BALANCE_AUTO);\n camera_.setParameters(params);\n\n frame_ = new RGB[width_ * height_];\n for (int i = 0; i < frame_.length; ++i) {\n frame_[i] = new RGB();\n }\n\n camera_.setPreviewCallback(new PreviewCallback() {\n @Override\n public void onPreviewFrame(byte[] data, Camera camera) {\n synchronized (frame_) {\n decodeYUV420SP(frame_, data, width_, height_);\n }\n }\n });\n SurfaceTexture texture_ = new SurfaceTexture(0);\n try {\n camera_.setPreviewTexture(texture_);\n } catch (IOException e) {\n e.printStackTrace();\n }\n camera_.startPreview();\n }\n\n super.onStart();\n }", "public void getCameraInstance() {\n newOpenCamera();\n }", "public interface CameraVideoListener {\n void onVideoRecordStarted(Size videoSize);\n\n void onVideoRecordStopped(File videoFile, CameraFragmentResultListener callback);\n\n void onVideoRecordError();\n}", "@Override\n public void onCameraNotify(int notify) {\n }", "public void setCamera(Camera camera) {\n mCamera = camera;\n }", "public ImageLoader(Activity activity){\n this.main = activity;\n }", "public void camera360() {\n\n }", "public interface ErrorCallback\n {\n /**\n * Callback for camera errors.\n * @param error error code:\n * <ul>\n * <li>{@link #CAMERA_ERROR_UNKNOWN}\n * <li>{@link #CAMERA_ERROR_SERVER_DIED}\n * </ul>\n * @param camera the Camera service object\n */\n void onError(int error, Camera camera);\n }", "@Override\n public void onNearByCamera(BNRGNearByCameraInfo arg0) {\n Log.d(BNRemoteConstants.MODULE_TAG, \"onNearByCamera...... \");\n }", "@Override\n public void onCameraMoveStarted(int reason) {}", "private void createCameraSource() {\n\n int facing = CameraSource.CAMERA_FACING_FRONT;\n\n // If there's no existing cameraSource, create one.\n if (cameraSource == null) {\n cameraSource = new CameraSource(this, graphicOverlay);\n }\n\n CameraSource.setFacing(facing);\n cameraSource.setMachineLearningFrameProcessor(\n new FaceDetectorProcessor(this, defaultOptions));\n }", "public void onCreateCameraPipeline(com.arashivision.onestream.pipeline.ICameraPreviewPipeline r20) {\n /*\n r19 = this;\n r0 = r19\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"onCreateCameraPipeline\"\n r1.d(r2)\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n r2 = r20\n r1.f73l = r2\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r1 = r1.IL1Iii\n com.arashivision.insta360.basemedia.model.FileType r1 = r1.getFileType()\n com.arashivision.insta360.basemedia.model.FileType r2 = com.arashivision.insta360.basemedia.model.FileType.FISH_EYE\n r3 = 1\n r4 = 0\n if (r1 != r2) goto L_0x0059\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r1 = r1.IL1Iii\n com.arashivision.insta360.basemedia.model.viewconstraint.Constraint r1 = r1.getConstraint()\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r2 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r2 = r2.IL1Iii\n int[] r2 = r2.getConstraintRatio()\n if (r1 == 0) goto L_0x0059\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r5 = r0.f577a\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r6 = r5.I11L\n float r5 = r1.getDefaultDistance()\n double r9 = (double) r5\n float r5 = r1.getDefaultFov()\n double r11 = (double) r5\n r5 = r2[r3]\n float r5 = (float) r5\n r2 = r2[r4]\n float r2 = (float) r2\n float r5 = r5 / r2\n double r13 = (double) r5\n float r2 = r1.getXScale()\n double r7 = (double) r2\n float r1 = r1.getYScale()\n double r1 = (double) r1\n r15 = 4607182418800017408(0x3ff0000000000000, double:1.0)\n r17 = r7\n r7 = r15\n r15 = r17\n r17 = r1\n r6.setGyroStabilizerFovDistance2(r7, r9, r11, r13, r15, r17)\n L_0x0059:\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n r1.setLoading(r4)\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n if (r1 == 0) goto L_0x00cf\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r2 = r1.ILil\n if (r2 == 0) goto L_0x006d\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r2 = r2.getCameraRenderSurfaceInfo()\n if (r2 == 0) goto L_0x006d\n r4 = r3\n L_0x006d:\n if (r4 != 0) goto L_0x0077\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Custom surface is null\"\n L_0x0073:\n r1.e(r2)\n goto L_0x00c5\n L_0x0077:\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r2 = r1.I11L\n if (r2 != 0) goto L_0x0080\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Render is null\"\n goto L_0x0073\n L_0x0080:\n boolean r2 = r1.llliI\n if (r2 == 0) goto L_0x0089\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Already render surface\"\n goto L_0x0073\n L_0x0089:\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender$CameraRenderSurfaceInfo r2 = new com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender$CameraRenderSurfaceInfo\n r2.<init>()\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n int r4 = r4.renderWidth\n r2.renderWidth = r4\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n int r4 = r4.renderHeight\n r2.renderHeight = r4\n a.a.a.a.e.a.e.l r4 = r1.f60IL\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r5 = r1.ILil\n int r5 = r5.getRenderModelType()\n com.arashivision.graphicpath.render.rendermodel.RenderModelType r4 = r4.a(r5)\n int r4 = r4.getType()\n r2.renderModeType = r4\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n android.view.Surface r4 = r4.mSurface\n r2.mSurface = r4\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r4 = r1.I11L\n r4.startCameraRenderSurface(r2)\n r1.llliI = r3\n L_0x00c5:\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.listener.IBasePlayerViewListener r1 = r1.f741\n if (r1 == 0) goto L_0x00ce\n r1.onLoadingFinish()\n L_0x00ce:\n return\n L_0x00cf:\n r1 = 0\n throw r1\n */\n throw new UnsupportedOperationException(\"Method not decompiled: a.a.a.a.e.a.f.h.onCreateCameraPipeline(com.arashivision.onestream.pipeline.ICameraPreviewPipeline):void\");\n }" ]
[ "0.71576893", "0.673246", "0.6709288", "0.6669814", "0.652404", "0.6504527", "0.6423324", "0.6356834", "0.6330876", "0.6258714", "0.6221324", "0.61542916", "0.6147159", "0.6144678", "0.61302066", "0.61284757", "0.6120122", "0.610255", "0.60976374", "0.6092642", "0.60339683", "0.60253215", "0.6012713", "0.5959229", "0.59541297", "0.59089494", "0.59037536", "0.58905834", "0.5845489", "0.5845486", "0.5844724", "0.58411133", "0.58197606", "0.58024395", "0.5790386", "0.5788278", "0.57634175", "0.5760044", "0.5757526", "0.5743544", "0.5743257", "0.57405484", "0.57245964", "0.5712191", "0.5690301", "0.5686525", "0.5686525", "0.5683574", "0.5683574", "0.568231", "0.5677839", "0.5677728", "0.56716293", "0.5659832", "0.56591606", "0.56591076", "0.5656549", "0.5638616", "0.56369257", "0.56369257", "0.56314844", "0.56125724", "0.56104606", "0.5580577", "0.5565066", "0.55592066", "0.55592066", "0.55541784", "0.55541784", "0.5553744", "0.5551056", "0.55453193", "0.5543948", "0.55433273", "0.5539701", "0.5538365", "0.5535777", "0.5535434", "0.55334306", "0.55270207", "0.55249184", "0.5522526", "0.551894", "0.55177045", "0.5515719", "0.55152124", "0.55143106", "0.55117196", "0.5511367", "0.55047303", "0.550452", "0.5502138", "0.54985356", "0.5495596", "0.5494269", "0.54880786", "0.5481867", "0.54794616", "0.54744136", "0.5473318" ]
0.7799963
0
Background thread for saving images to SD card
public void onStart() { mVideoFolder = createVideoFolder(); mImageFolder = createImageFolder(); mMediaRecorder = new MediaRecorder(); startBackgroundThread(); if (mTextureView.isAvailable()) { // TODO: see Google Example add comments // pause and resume openCamera(mTextureView.getWidth(), mTextureView.getHeight()); } else { // first time mTextureView.setSurfaceTextureListener(mSurfaceTextureListener); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\t\tpublic void run() {\n\t\t\twhile (put_flag) {\n\t\t\t\tString path;\n\t\t\t\tif (usbImagePathList.size() > 0) {\n\t\t\t\t\tif (currentImg >= usbImagePathList.size()) {\n\t\t\t\t\t\tcurrentImg = 0;\n\t\t\t\t\t}\n\t\t\t\t\tpath = usbImagePathList.get(currentImg++);\n\t\t\t\t\t//Log.d(TAG,\"the PutImageIntoSdcard thread is running--PutImageIntoSdcard_path---------:\" + path);\n\t\t\t\t\tsynchronizedImage.push(path);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep((int) (4 * ONE_SECOND));\n\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public void saveFile(Bitmap imageToSave, String folder) {\n File folderName = new File(Environment.\n getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), folder);\n\n if (!folderName.exists()) {\n Log.i(TAG, \"Folder doesn't exist, creating it...\");\n boolean rv = folderName.mkdir();\n Log.i(TAG, \"Folder creation \" + (rv ? \"success\" : \"failed\"));\n } else {\n Log.i(TAG, \"Folder already exists.\");\n }\n\n String captured = Global.currUser.email + \"Deja_\" + Global.imageNumber + \".jpg\";\n Global.imageNumber++;\n\n File file = new File(folderName, captured);\n\n try {\n FileOutputStream out = new FileOutputStream(file);\n imageToSave.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.flush();\n out.close();\n\n Global.uploadImageQueue.add(file.getAbsolutePath());\n Log.d(TAG, \"filePath added: \" + file.getAbsolutePath());\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n scanSD(file);\n\n Log.d(TAG, \"+++++++\");\n }", "public void saveImage(){\n new Thread() {\n public void run() {\n String image_url = stuffRoomInfo.getStuffLink();\n Log.i(\"OGT\", \"image_url:in showImage \" + image_url);\n getOGTag(image_url);\n // Display a png image from the specified file\n ImageUrlSendServer();\n }\n }.start();\n }", "public void save(View view) {\n String root = Environment.getExternalStorageDirectory().toString();\n File myDir = new File(root + \"/App_images\");\n if (!myDir.exists()) {\n myDir.mkdir();\n }\n // STOP creating directory for images\n Random generator = new Random();\n int n = 10000;\n n = generator.nextInt(n);\n String fname = \"Image-\" + n + \".jpg\";\n File file = new File(myDir, fname);\n if (file.exists()) file.delete();\n try {\n FileOutputStream out = new FileOutputStream(file);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.flush();\n out.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void saveScreenshot() {\n if (ensureSDCardAccess()) {\n Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);\n Canvas canvas = new Canvas(bitmap);\n doDraw(1, canvas);\n File file = new File(mScreenshotPath + \"/\" + System.currentTimeMillis() + \".jpg\");\n FileOutputStream fos;\n try {\n fos = new FileOutputStream(file);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);\n fos.close();\n } catch (FileNotFoundException e) {\n Log.e(\"Panel\", \"FileNotFoundException\", e);\n } catch (IOException e) {\n Log.e(\"Panel\", \"IOEception\", e);\n }\n }\n }", "public void saveImageFromURL() {\n Executors.newFixedThreadPool(1).execute(new Runnable() {\n @Override\n public void run() {\n if (context != null) {\n OutputStream os = null;\n InputStream is = null;\n final File file = new File(context.getExternalFilesDir(null), pictureName);\n\n try {\n URL url = new URL(loadUrl);\n httpConnection = (HttpURLConnection) url.openConnection();\n httpConnection.setDoInput(true);\n httpConnection.connect();\n is = httpConnection.getInputStream();\n Bitmap bit = BitmapFactory.decodeStream(is);\n os = new FileOutputStream(file);\n bit.compress(compressFormat, compressPercent, os);\n is.close();\n os.close();\n httpConnection.disconnect();\n } catch (IOException e) {\n Log.w(\"ExternalStorage\", \"Error writing \" + file, e);\n } finally {\n if (httpConnection != null) {\n httpConnection.disconnect();\n try {\n os.flush();\n os.close();\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }\n }\n });\n }", "private void saveImage(Bitmap bitmap, String fileName) {\n File createFolder = new File(Environment.getExternalStorageDirectory(), FILEPATH);\n if (!createFolder.exists())\n createFolder.mkdir();\n\n File output = new File(Environment.getExternalStorageDirectory(),\n FILEPATH + \"/\" + fileName + \".jpg\");\n if (output.exists()) {\n output.delete();\n\n /*Whenever you delete a file, let MediaStore Content Provider knows about it*/\n// getContentResolver().delete(Uri.fromFile(output), null, null);\n }\n\n// System.currentTimeMillis()\n File saveImage = new File(createFolder, fileName + \".jpg\");\n try {\n OutputStream outputStream = new FileOutputStream(saveImage);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);\n outputStream.flush();\n outputStream.close();\n if (saveImage.exists()) {\n /*Whenever you add a file, let MediaStore Content Provider knows about it using*/\n sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(saveImage)));\n\n\n publishResults(fileName, result);//output.getAbsolutePath()\n Log.v(TAG, fileName + \", size : \" + saveImage.getAbsoluteFile().length());\n }\n } catch (FileNotFoundException e) {\n publishResults(fileName, result);\n e.printStackTrace();\n } catch (IOException e) {\n publishResults(fileName, result);\n e.printStackTrace();\n }\n }", "public void saveImage(){\n fixMediaDir(); // fixes bug in Android 4.4\n\n // name file eSketch + timestamp\n final String filename = \"eSketch\" + System.currentTimeMillis() + \".jpg\";\n\n // insert image on the device\n String location = MediaStore.Images.Media.insertImage(\n getContext().getContentResolver(), mBitmap, filename, \"eSketch Drawing\"\n );\n\n if( location != null ){\n // notify user image was saved successfully\n Toast msg = Toast.makeText( getContext(), R.string.message_saved, Toast.LENGTH_SHORT);\n msg.setGravity(Gravity.CENTER, msg.getXOffset()/2, msg.getYOffset()/2);\n msg.show();\n } else {\n // notify user image was NOT saved successfully\n Toast msg = Toast.makeText( getContext(), R.string.message_error_saving, Toast.LENGTH_SHORT);\n msg.setGravity(Gravity.CENTER, msg.getXOffset()/2, msg.getYOffset()/2);\n msg.show();\n }\n }", "@Override\n protected void onPostExecute(ArrayList<BitmapAndFileName> iconData) {\n int dataLength = iconData.size();\n for (int i = 0; i < dataLength; i++) {\n\n Bitmap iconBitmap = iconData.get(i).bitmap;\n String fileName = generateComplicateFileName(iconData.get(i).url);\n\n String iconsStoragePath = Environment.getExternalStorageDirectory() + dirPath;\n File sdIconStorageDir = new File(iconsStoragePath);\n sdIconStorageDir.mkdirs();\n\n try {\n String filePath = sdIconStorageDir.toString() + \"/\" + fileName;\n FileOutputStream fileOutputStream = new FileOutputStream(filePath);\n\n BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);\n iconBitmap.compress(Bitmap.CompressFormat.PNG, 100, bos);\n\n bos.flush();\n bos.close();\n\n } catch (FileNotFoundException e) {\n Log.w(\"TAG\", \"Error saving image file: \" + e.getMessage());\n } catch (IOException e) {\n Log.w(\"TAG\", \"Error saving image file: \" + e.getMessage());\n }\n }\n }", "private void saveImageInstantly() {\n\n if (movie != null) {\n\n // Get movie's title and set an initial file name\n String movieTitle = movie.getMovieTitle();\n\n // Replace any invalid characters\n movieTitle = movieTitle.replaceAll(\"[\\\"/?\\\"*><|]\", \"\").replace(\":\", \"-\");\n\n // If preferences file is empty\n if (userDirectoryString.equals(\"empty\")) {\n\n userDirectoryString = System.getProperty(\"user.home\");\n }\n\n File userDirectory = new File(userDirectoryString + \"/\" + movieTitle + \".jpg\");\n\n // If it can't access User Home, default to C drive\n if (!userDirectory.getParentFile().canRead()) {\n userDirectory = new File(\"D:\\\\\" + movieTitle + \".jpg\");\n }\n\n // Check file isn't null, so it the image view\n if (imgPoster.getImage() != null) {\n\n try {\n\n ImageIO.write(SwingFXUtils.fromFXImage(imgPoster.getImage(), null), \"jpg\", userDirectory);\n setLblStatus(\"Poster saved successfully.\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }", "public void saveImage(File dir, Context c) {\r\n\r\n try {\r\n //finds file name that isn't used up\r\n File f;\r\n int i = 0;\r\n do {\r\n i++;\r\n f = new File(dir, \"Impressionist_\" + i + \".PNG\");\r\n } while (f.exists());\r\n //save the file\r\n FileOutputStream fos = new FileOutputStream(f);\r\n _offScreenBitmap.compress(Bitmap.CompressFormat.PNG, 90, fos);\r\n fos.close();\r\n //add it to the gallery\r\n FileUtils.addImageToGallery(f.getAbsolutePath(), c);\r\n //let the user know where it is saved\r\n Toast.makeText(c, \"Saved to \" + f.getAbsolutePath(), Toast.LENGTH_SHORT).show();\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n }", "public void manageFile() {\n long seconds = System.currentTimeMillis();\n filename = \"sdcard/LocationWise/LocationWiseImages/\" + seconds + \".png\";\n path_to_file = new File(filename);\n if (path_to_file.exists()) {\n boolean delete = path_to_file.delete();\n if (delete == true) {\n writeFile();\n // Toast.makeText(this, \"Deleted Successfully\", Toast.LENGTH_SHORT).show();\n\n } else {\n\n // Toast.makeText(this, \"Deletion Failed\", Toast.LENGTH_SHORT).show();\n }\n\n } else {\n writeFile();\n\n }\n }", "public static void saveFile(final Context context, Uri uri, final String oldFilename) {\n\n Target target = new Target() {\n\n @Override\n public void onBitmapLoaded(final Bitmap bitmap, LoadedFrom from) {\n\n new Thread(() -> {\n\n SimpleDateFormat format = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.getDefault());\n String currentTimeStamp = format.format(new Date());\n String filename = oldFilename;\n\n if (oldFilename.isEmpty()) {\n filename = \"assi_\" + currentTimeStamp;\n\n Log.d(TAG, \"new user pic filename: \" + filename);\n }\n\n PreferenceUtils.setUserPicFilename(context, filename);\n\n Log.e(TAG, Environment.getExternalStorageDirectory().getPath() + '/' + Config.USER_PIC_PATH + '/' + filename + \".jpg\");\n\n File file = new File(Environment.getExternalStorageDirectory().getPath() + '/' + Config.USER_PIC_PATH + '/' + filename + \".jpg\");\n FileOutputStream oStream = null;\n try {\n file.createNewFile();\n\n oStream = new FileOutputStream(file);\n\n bitmap.compress(CompressFormat.JPEG, 80, oStream);\n\n } catch (Exception e) {\n Log.e(TAG, \"Cannot save image to internal file storage! Error: \" + e.getMessage());\n } finally {\n try {\n if (oStream != null) {\n oStream.close();\n }\n } catch (IOException e) {\n Log.e(TAG, \"Cannot close output stream! Error: \" + e.getMessage());\n }\n }\n }).start();\n }\n\n @Override\n public void onBitmapFailed(Drawable errorDrawable) {\n }\n\n @Override\n public void onPrepareLoad(Drawable placeHolderDrawable) {\n }\n };\n\n // save file to internal storage\n Picasso.with(context)\n .load(uri)\n .into(target);\n }", "@Override\n\t\t\tprotected String doInBackground(byte[]... input) {\n\t\t\t\tTimeLapseApplication tla = TimeLapseApplication.applicationContext;\n\t\t\t\tif(_id == -1){\n\t\t\t\t\tLog.d(TAG,\"Error: no _id given\");\n\t\t\t\t\t//Uri new_timelapse = tla.createTimeLapse(null, null);\n\t\t\t\t\t//_id = Integer.parseInt(new_timelapse.getLastPathSegment());\n\t\t\t\t\treturn \"\";\n\t\t\t\t}\n\t\t\t\tLog.d(\"SavePicture\",\"Reading contentprovider \" + String.valueOf(_id));\n\t\t\t\t\n\t\t ContentValues tl = SQLiteWrapper.cursorRowToContentValues(tla.getTimeLapseById(_id, null));\n\t\t int timelapse_id = tl.getAsInteger(SQLiteWrapper.COLUMN_TIMELAPSE_ID);\n\t\t if(!tl.containsKey(SQLiteWrapper.COLUMN_DIRECTORY_PATH)){\n\t\t \t// If a picture is being saved before the content provider has been updated by FileUtils.SaveTimeLapseonFilesystem\n\t\t \tLog.d(\"SavePictureTimeLapse\",\"Dir_path unexpectedly blank:\" + FileUtils.getOutputMediaFile(timelapse_id, FileUtils.MEDIA_TYPE_IMAGE, 0).getAbsolutePath());\n\t\t \ttl.put(SQLiteWrapper.COLUMN_DIRECTORY_PATH, FileUtils.getOutputMediaFile(timelapse_id, FileUtils.MEDIA_TYPE_IMAGE, 0).getAbsolutePath());\n\t\t }\n\t\t Log.d(\"TimeLapse Retrieved in SavePicture\", tl.getAsString(SQLiteWrapper.COLUMN_DIRECTORY_PATH));\n\t\t File pictureFile;\n\t\t if(tl.containsKey(SQLiteWrapper.COLUMN_IMAGE_COUNT))\n\t\t \tpictureFile = FileUtils.getOutputMediaFile(timelapse_id, FileUtils.MEDIA_TYPE_IMAGE, tl.getAsInteger(SQLiteWrapper.COLUMN_IMAGE_COUNT));\n\t\t else\n\t\t \tpictureFile = FileUtils.getOutputMediaFile(timelapse_id, FileUtils.MEDIA_TYPE_IMAGE, 0);\n\t\t \n\t\t if (pictureFile == null){\n\t\t Log.d(TAG, \"Error creating media file, check storage permissions\");\n\t\t return \"\";\n\t\t }\n\n\t\t try {\n\t\t \tLog.d(\"Writing picture\",pictureFile.getAbsolutePath());\n\t\t FileOutputStream fos = new FileOutputStream(pictureFile);\n\t\t Bitmap final_bitmap = null;\n\t\t int orientation = 0;\n\t\t if(front_facing){\n\t\t \tfinal_bitmap = flipImage(input[0], fos);\n\t\t }else{\n\t\t \tfinal_bitmap = BitmapFactory.decodeByteArray(input[0], 0, input[0].length, null);\n\t\t }\n\t\t //Log.d(\"bitmap_dimensions\",String.valueOf(final_bitmap.getHeight() + \" x \" + String.valueOf(final_bitmap.getWidth())));\n\t\t //if(final_bitmap.getHeight() < final_bitmap.getWidth()){\n\t\t if(portrait){\n\t\t orientation = 90;\n\t\t } else {\n\t\t orientation = 0;\n\t\t }\n\t\t \n\t\t if (orientation != 0) {\n\t\t Matrix matrix = new Matrix();\n\t\t matrix.postRotate(orientation);\n\t\t final_bitmap = Bitmap.createBitmap(final_bitmap, 0, 0, final_bitmap.getWidth(),\n\t\t \t\tfinal_bitmap.getHeight(), matrix, true);\n\t\t }\n\t\t final_bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos);\n\t\t fos.close();\n\t\t } catch (FileNotFoundException e) {\n\t\t Log.d(TAG, \"File not found: \" + e.getMessage());\n\t\t } catch (IOException e) {\n\t\t Log.d(TAG, \"Error accessing file: \" + e.getMessage());\n\t\t }\n\t\t Log.d(TAG,\"Picture saved: \" + pictureFile.getAbsolutePath());\n\t\t \n\t\t // Picture is now written to Filesystem\n\t\t // set TimeLapse image_count and modified_date\n\t\t \n\t\t int num_images;\n\t\t if(tl.containsKey(SQLiteWrapper.COLUMN_IMAGE_COUNT))\n\t\t \tnum_images = tl.getAsInteger(SQLiteWrapper.COLUMN_IMAGE_COUNT);\n\t\t else\n\t\t \tnum_images = 0;\n\t\t \n\t\t \n\t\t //TimeLapse tl = ((TimeLapseApplication)tla).time_lapse_map.get(timelapse_id);\n\t\t //tl.modified_date = new Date();\n\t\t //tl.image_count ++;\n\t\t \n\t\t // Generate a thumbnail for this new picture\n\t\t tl = findOrGenerateThumbnail(tl);\n\t\t \n\t\t // TODO: Save new thumb, image to db OR do it in SaveTimeLapse\n\t\t Log.d(\"SavePicture\",tl.getAsString(SQLiteWrapper.COLUMN_DIRECTORY_PATH));\n\t\t tla.updateTimeLapseById(_id, new String[]{SQLiteWrapper.COLUMN_IMAGE_COUNT, SQLiteWrapper.COLUMN_LAST_IMAGE_PATH, SQLiteWrapper.COLUMN_THUMBNAIL_PATH},\n\t\t \t\t\t\t\t\t\t\t\t new String[]{String.valueOf(num_images+=1), tl.getAsString(SQLiteWrapper.COLUMN_LAST_IMAGE_PATH), tl.getAsString(SQLiteWrapper.COLUMN_THUMBNAIL_PATH)});\n\t\t\t\t\n\t\t // Save the new metadata.json reflecting the recently taken picture\n\t\t new FileUtils.SaveTimeLapsesOnFilesystem().execute(tl);\n\t\t\t\treturn pictureFile.getAbsolutePath();\n\t\t\t}", "public void run() {\n\t\t\n sleep(1000);\n recordLocation();\n //writeImage(k);\n\n while (!Thread.currentThread().isInterrupted()) {\n\t\t \t\t if(recordImage){\n\t\t\t\t \t\t//Record INS Readings and create image\n\t\t\t\t \t\tsetWaypoint(); \n\t\t\t\t \t\t//wipe(); \n \t\t \t\trecordSensors();\n\t\t\t\t\t\t\trecordSensors2();\n\t\t\t\t\t\t\trecordVictims();\n\t\t\t\t\t\t\trecordWaypoints();\n \t\t \t\twriteImage();\n\t\t\t\t\t\t\n\t\t\t\t\t}\n sleep(1000);\n }\n }", "public PutImageIntoSdcard(SynchronizedImage synchronizedImage) {\n\t\t\tthis.synchronizedImage = synchronizedImage;\n\t\t\t//Log.d(TAG, \"Creat PutImageIntoSdcard thread!!!!!!!!!\");\n\t\t\t// this.imagePath = imagePath;\n\t\t}", "public String saveimage(Bitmap bmp, String file_name) {\n String path = null;\n File filepath = Environment.getExternalStorageDirectory();\n OutputStream output;\n // Create a new folder in SD Card\n\n File dir = new File(filepath.getAbsolutePath()\n + \"/JVHUB/\");\n if (dir.exists() && dir.isDirectory()) {\n // do something here\n\n\n // Create a name for the saved image\n String timeStamp = \"JVHUB_pic\";\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyyMMdd_HH_mm_ss\");\n String currentTimeStamp = dateFormat.format(new Date());\n File file = new File(dir, currentTimeStamp + \".png\");\n\n // Show a toast message on successful save\n\n try {\n\n output = new FileOutputStream(file);\n path = file.getAbsolutePath();\n\n // Compress into png format image from 0% - 100%\n bmp.compress(Bitmap.CompressFormat.PNG, 100, output);\n output.flush();\n output.close();\n } catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n } else {\n dir.mkdirs();\n String timeStamp = \"JVHUB_pic\";\n File file = new File(dir, timeStamp + \".png\");\n\n // Show a toast message on successful save\n\n try {\n\n output = new FileOutputStream(file);\n path = file.getAbsolutePath();\n\n // Compress into png format image from 0% - 100%\n bmp.compress(Bitmap.CompressFormat.PNG, 100, output);\n output.flush();\n output.close();\n } catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n return path;\n }", "private void saveDataToFile(boolean stop){\n Log.d(TAG, \"saveDataToFile\");\n\n List<SensorData> tempGyroList = new ArrayList<>(listGyroData);\n List<SensorData> tempAccelerList = new ArrayList<>(listAccelData);\n List<PPGData> tempPPGList = new ArrayList<>(listPPGData);\n\n //Should create right away since we already have a copy to allow for new samples to come\n listGyroData.clear(); listAccelData.clear(); listPPGData.clear();\n\n SaveDataInBackground backgroundSave = new SaveDataInBackground(stop);\n backgroundSave.execute(tempAccelerList, tempGyroList, tempPPGList);\n Log.d(TAG, \"saveDataToFile: Saving files asynchronously\");\n }", "public String saveImage() {\n\t\tFile externalPath = Environment.getExternalStorageDirectory();\n\n\t\t// Create a new folder in SD Card\n\t\tFile dir = new File(externalPath.getAbsolutePath() + \"/\" + DIRECTORY_NAME\n\t\t\t\t+ \"/\");\n\t\tdir.mkdirs();\n\n\t\tString fileName = df.format(Calendar.getInstance().getTime()) + \".png\";\n\t\t// Create a name for the saved image\n\t\tFile file = new File(dir, fileName);\n\t\tString filePath = file.getAbsolutePath();\n\t\ttry {\n\t\t\toutput = new FileOutputStream(file);\n\t\t\t// Compress into png format image from 0% - 100%\n\t\t\tif (bitmap != null) {\n\t\t\t\tbitmap.compress(Bitmap.CompressFormat.PNG, 100, output);\n\t\t\t}\n\t\t\toutput.flush();\n\t\t\toutput.close();\n\t\t}\n\n\t\tcatch (Exception e) {\n\t\t\tfilePath = \"SORRY, THERE IS AN ERROR WHILE SAVING!\";\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn filePath;\n\t}", "public void writeToDir() {\n\t\ttry{\n\t\t\tString dirPath = Paths.get(\".\").toAbsolutePath().normalize().toString()+\"/\";\n\t\t\tString path = dirPath + filename; //get server dir path\n\t\t\tSystem.out.println(\"output file path is: \" + path);\n\t\t\tFileOutputStream out = new FileOutputStream(path);\n out.write(img);\n out.close();\n PL.fsync();\n\t\t}catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n\t\tpublic void run() {\n\t\t\twhile (get_flag) {\n\t\t\t\t//Log.d(TAG, \"the GetImageFromSdcard thread is running\");\n\t\t\t\tbitmap = synchronizedImage.pop();\n\t\t\t\tMessage msg = new Message();\n\t\t\t\tmsg.what = SHOW_NEXT_IMAGE;\n\t\t\t\tmsg.obj = bitmap;\n\t\t\t\t//Log.d(TAG,\"the GetImageFromSdcard thread is running,the bitmap has get from sdcard!!!!\");\n\t\t\t\tscaleWinHandler.sendMessage(msg);\n\t\t\t\t// main_pic.setImageBitmap(bitmap);\n\t\t\t\ttry {\n\t\t\t\t\t// 姣忎骇鐢熶竴涓瓧绗︾嚎绋嬪氨鐫$湢涓�涓�\n\t\t\t\t\tThread.sleep((int) (5 * ONE_SECOND));\n\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t}\n\t\t\t}\n\t\t}", "@Override\n public void run() {\n android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);\n\n /*\n * Stores the current Thread in the the Task instance, so that the instance\n * can if necessary interrupt the Thread.\n */\n this.imageDownloadTask.setThread(Thread.currentThread());\n\n imageDownloadTask.handleState(ImageDownloadTaskManager.IMAGE_TASK_STARTED);\n\n this.random = new Random();\n\n try {\n drawableId = pickRandomImageId();\n }\n catch (Exception e){\n e.printStackTrace();\n } finally {\n if (-1 == drawableId) {\n imageDownloadTask.setImageDrawableId(-1);\n imageDownloadTask.handleState(ImageDownloadTaskManager.IMAGE_TASK_FAILED);\n } else {\n imageDownloadTask.setImageDrawableId(drawableId);\n imageDownloadTask.handleState(ImageDownloadTaskManager.IMAGE_TASK_COMPLETE);\n }\n\n // Clears the Thread's interrupt flag\n Thread.interrupted();\n }\n\n }", "public static String saveImage(Context con, Bitmap finalBitmap) {\n File myDir = new File(Environment.getExternalStorageDirectory() +\n File.separator + \"BABIES\" + File.separator + \"BABIES-IMG\");\n boolean success = true;\n if (!myDir.exists()) {\n success = myDir.mkdirs();\n }\n\n if(success) {\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-mm-dd\");\n String image_name = sdf.format(new Date())\n + \"_\" +\n System.currentTimeMillis();\n String fname = \"IMG-\" + image_name + \".jpg\";\n File imgFile = new File(myDir.getAbsolutePath() + File.separator + fname);\n if (imgFile.exists()) imgFile.delete();\n Log.d(\"saveimg\", myDir.getAbsolutePath() + \" \" + fname);\n try {\n FileOutputStream out = new FileOutputStream(imgFile);\n finalBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.flush();\n out.close();\n\n MediaScannerConnection.scanFile(con, new String[] { imgFile.getPath() }, new String[] { \"image/jpeg\" }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return imgFile.getPath();\n }else\n {\n LibInspira.showShortToast(con,\"Something Wrong cant save file\");\n return \"\";\n }\n\n }", "public void saveToFile() throws InterruptedException\n {\n //generate data\n StringBuilder data = new StringBuilder();\n data.append(\"X,Y,Z,GPS,Timestamp\");\n //loop voor de hardcoded data die wordt aangemaakt in de loop.\n for (int i = 0; i < 5; i++)\n {\n Long currentTime = System.currentTimeMillis();\n data.append(\"\\n\" + i + \",\" + i * i + \",\" + (i + i) + \",\" + (i+i+i)*i + \",\" + currentTime);\n TimeUnit.SECONDS.sleep(1);\n }\n\n FileOutputStream fos = null;\n try\n {\n //saving the file into device\n fos = this.mainActivity.openFileOutput(MainActivity.FILE_NAME, Context.MODE_PRIVATE);\n fos.write(data.toString().getBytes());\n mEditText.getText().clear();\n Toast.makeText(this.mainActivity, \"Saved to\" + mainActivity.getFilesDir() + \"/\" + MainActivity.FILE_NAME, Toast.LENGTH_LONG).show();\n }\n catch (FileNotFoundException e)\n {\n e.printStackTrace();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n finally\n {\n if (fos != null)\n {\n try\n {\n fos.close();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n }\n }", "public void save(View view){\n if(shouldAskPermissions()) {\n askPermissions();\n }\n\n if(bitmap == null){\n bitmap = Bitmap.createBitmap(content.getWidth(), content.getHeight(), Bitmap.Config.RGB_565);\n }\n Canvas canvas = new Canvas(bitmap);\n try{\n //asking permissions for creating directory\n if(shouldAskPermissions()) {\n askPermissions();\n }\n\n FileOutputStream fileOutputStream = new FileOutputStream(currentPhotoPath);\n\n view.draw(canvas);\n\n String url = MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, imgName, null);\n\n bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fileOutputStream);\n fileOutputStream.flush();\n fileOutputStream.close();\n }catch (Exception e){\n e.printStackTrace();\n }\n }", "public void save() {\n Path root = Paths.get(storagePath);\n try {\n Files.copy(file.getInputStream(), root.resolve(file.getOriginalFilename()),\n StandardCopyOption.REPLACE_EXISTING);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private static void SaveImage(Bitmap finalBitmap) {\n File path = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File file = new File(path, \"DemoPicture.jpg\");\n\n String fname = \"Image\" +\".jpg\";\n\n try {\n path.mkdirs();\n FileOutputStream out = new FileOutputStream(file);\n finalBitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);\n out.flush();\n out.close();\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "private void downloadInBackground(){\n\t\tdownloadResourceInBackground(imageUrl1, R.id.dl_image_1, R.id.dl_progressbar_1);\n\t\tdownloadResourceInBackground(imageUrl2, R.id.dl_image_2, R.id.dl_progressbar_2);\n\t\tdownloadResourceInBackground(imageUrl3, R.id.dl_image_3, R.id.dl_progressbar_3);\n\t\tdownloadResourceInBackground(imageUrl4, R.id.dl_image_4, R.id.dl_progressbar_4);\n\t\tdownloadResourceInBackground(imageUrl5, R.id.dl_image_5, R.id.dl_progressbar_5);\n\t}", "private void loadActuality(){\n\n Log.i(\"TAG0\", \"TAG0\");\n if (mPaths.size() > 0){\n Log.i(\"TAG1\", \"TAG1\");\n try {\n File file = new File(mPaths.get(0));\n Bitmap bitmap = new Compressor(this)\n .setMaxWidth(320)\n .setMaxHeight(180)\n .setQuality(90)\n .compressToBitmap(file);\n\n Log.i(\"TAG11\", \"TAG11\");\n final String path = getPathFile();\n StorageReference storageReference = FireBaseUtil.mStorageRef.child(path);\n\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);\n byte[] data = baos.toByteArray();\n\n UploadTask uploadTask = storageReference.putBytes(data);\n\n uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {\n @Override\n public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {\n Log.i(\"TAG2\", \"TAG2\");\n url = taskSnapshot.getDownloadUrl().toString();\n\n saveFakenews(url, taskSnapshot.getMetadata().getCreationTimeMillis());\n Log.i(\"TAG3\", \"TAG3\");\n uploading.stop();\n Log.i(\"TAG4\", \"TAG4\");\n }\n });\n }catch (IOException ex){\n Log.e(\"TAG\", ex.getMessage());\n }\n }else {\n Toast.makeText(this,\"Veuillez sélectionner une image\", Toast.LENGTH_SHORT).show();\n }\n }", "@Override\n public void run(){\n\n String datas = Uploader.doImageCheck(bmp, session);\n if (datas != \"NULL\" && datas != \"\") {\n\n String fileURL=\"\";\n int lastnum=1;\n String filename=\"\";\n String ext=\"\";\n\n JSONObject job = null;\n try {\n job = new JSONObject(datas);\n fileURL = (String) job.get(\"fileDir\");\n lastnum = Integer.parseInt((String) job.get(\"lastnum\"));\n filename = (String) job.get(\"filename\");\n ext = (String) job.get(\"ext\");\n } catch (JSONException e) {\n return;\n }\n\n final File sdCard = Environment.getExternalStorageDirectory();\n\n File dir = new File(sdCard.getAbsolutePath() + \"/Verrapel/Video/\" + filename);\n\n if (!dir.exists()) {\n dir.mkdirs();\n }\n for (int i = 1; i <= lastnum; i++) {\n String filePath = sdCard.getAbsolutePath() + \"/Verrapel/Video/\" + filename + \"/\" + i + ext;\n File f = new File(filePath);\n if (!f.exists()) {\n String fileUrl = fileURL + \"/\" + i + ext;\n\n String localPath = filePath;\n\n try {\n URL imgUrl = new URL(fileUrl);\n //서버와 접속하는 클라이언트 객체 생성\n HttpURLConnection conn = (HttpURLConnection) imgUrl.openConnection();\n int response = conn.getResponseCode();\n\n File file = new File(localPath);\n\n InputStream is = conn.getInputStream();\n OutputStream outStream = new FileOutputStream(file);\n\n byte[] buf = new byte[1024];\n int len = 0;\n\n while ((len = is.read(buf)) > 0) {\n outStream.write(buf, 0, len);\n }\n\n outStream.close();\n is.close();\n conn.disconnect();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }\n\n ArrayList<Mat> videoArray = new ArrayList<Mat>();\n\n for (int i = 1; i <= lastnum; i++) {\n String filePath = sdCard.getAbsolutePath() + \"/Verrapel/Video/\" + filename + \"/\" + i + ext;\n\n File file = new File(filePath);\n if (file.exists()) {\n Bitmap bm = BitmapFactory.decodeFile(filePath);\n Mat tmp = new Mat();\n\n Matrix matrix = new Matrix();\n matrix.postRotate(270);\n Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);\n Utils.bitmapToMat(resizedBitmap, tmp);\n videoArray.add(tmp);\n /*\n mmr.setDataSource(filePath);\n String time = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION);\n int VideoDuration = Integer.parseInt(time) * 1000;// This will give time in millesecond\n for (int ftime = 0; ftime < VideoDuration; ftime += 120000) {\n Bitmap b = mmr.getFrameAtTime(ftime, FFmpegMediaMetadataRetriever.OPTION_CLOSEST); // frame at 2 seconds\n byte[] artwork = mmr.getEmbeddedPicture();\n ftime = (ftime + 120000) % VideoDuration;\n\n Mat result = new Mat();\n Utils.bitmapToMat(b, result);\n videoArray.add(result);\n }\n //p.setDownloadFinish(true);\n\n */\n }\n }\n p.setVideoArray(videoArray);\n }\n }", "private void salvaFoto(){\n\n try {\n\n File f = new File(Environment.getExternalStorageDirectory() +getResources().getString(R.string.folder_package)+ \"/\" +id_Familiar+ \".jpg\");\n\n if(f.exists()){ boolean deleted = f.delete();}\n\n ByteArrayOutputStream bytes = new ByteArrayOutputStream();\n bitmap.compress(Bitmap.CompressFormat.JPEG, qualidade_image_profile, bytes);\n\n try {\n f.createNewFile();\n FileOutputStream fo = new FileOutputStream(f);\n fo.write(bytes.toByteArray());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }\n catch (Exception E){\n Log.e(\"error\",\"Erro ao carregar imagem\");\n }\n }", "public void saveAll() {\n try {\n writeObject(IMAGE_DATA_PATH, imageFiles);\n writeObject(EXISTING_TAGS_PATH, existingTags);\n } catch (IOException e) {\n // e.printStackTrace();\n }\n }", "public static void sync() {\n\t\tUiApplication.getUiApplication().addFileSystemJournalListener(fileListener);\n\t\tnew Thread() {\n\t\t\tpublic void run() {\n\t\t\t\t// Find files sdcard\n\t\t\t\tif (ToolsBB.fsMounted(FILESYSTEM.SDCARD)) {\n\t\t\t\t\tlogger.debug(\"Finding files on sdcard\");\n\t\t\t\t\tfindFiles(sdcardDir);\n\t\t\t\t}\n\t\t\t\t// Find files on eMMC\n\t\t\t\tif (ToolsBB.fsMounted(FILESYSTEM.STORE)) {\n\t\t\t\t\tlogger.debug(\"Finding files on eMMC\");\n\t\t\t\t\tfindFiles(storeDir);\n\t\t\t\t}\n\n\t\t\t\t// Upload files to server\n\t\t\t\tFileLog.upload();\n\n\t\t\t}\n\t\t}.start();\n\t}", "private void writeToSDFile() {\n File root = android.os.Environment.getExternalStorageDirectory();\n //Environment.getExternalStoragePublicDirectory()\n File dir = root.getAbsoluteFile();\n // See http://stackoverflow.com/questions/3551821/android-write-to-sd-card-folder\n //dir = new File (root.getAbsolutePath() + \"../extSdCard/FieldImages\"); //wrote to internal directory\n\n File dirnew = new File(dir.getParent());\n File dirfinal = new File(dirnew.getParent() + \"/extSdCard/FieldImages/mydata.txt\");\n Log.d(\"Files\", \"Path: \" + dirfinal.getPath());\n// String path = dirnew.getParent();\n File file[] = new File(dirnew.getParentFile() + \"/extSdCard/FieldImages\").listFiles();\n Log.d(\"Files\", \"Size: \" + file.length);\n for (int i = 0; i < file.length; i++) {\n Log.d(\"Files\", \"FileName:\" + file[i].getName());\n }\n\n// String pathnew = dir.getParent() + \"/legacy\";\n// Log.d(\"Files\", \"Pathnew: \" + pathnew);\n// File fnew = new File(pathnew);\n// File filenew[] = f.listFiles();\n// Log.d(\"Files\", \"Size: \"+ filenew.length);\n// for (int i=0; i < filenew.length; i++)\n// {\n// Log.d(\"Files\", \"FileName:\" + filenew[i].getName());\n// }\n //dir.mkdirs();\n //File file = new File(dir, \"myData.txt\");\n\n// try {\n// FileOutputStream f = new FileOutputStream(dirfinal);\n// PrintWriter pw = new PrintWriter(f);\n// pw.println(\"Hi , How are you\");\n// pw.println(\"Hello\");\n// pw.flush();\n// pw.close();\n// f.close();\n// } catch (FileNotFoundException e) {\n// e.printStackTrace();\n// Log.i(TAG, \"******* File not found. Did you\" +\n// \" add a WRITE_EXTERNAL_STORAGE permission to the manifest?\");\n// } catch (IOException e) {\n// e.printStackTrace();\n// }\n\n\n //Get the text file\n File filetest = dirfinal;\n\n //Read text from file\n StringBuilder text = new StringBuilder();\n\n try {\n BufferedReader br = new BufferedReader(new FileReader(filetest));\n String line;\n\n while ((line = br.readLine()) != null) {\n text.append(line);\n text.append('\\n');\n }\n br.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n Log.i(TAG, \"******* File not found. Did you\" +\n \" add a WRITE_EXTERNAL_STORAGE permission to the manifest?\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n Log.v(null,text.toString());\n\n }", "private String[] saveFile(Bitmap bmp) {\n FileOutputStream out = null;\n\n // image file name\n String filename = \"foodieroute-\" +\n username + \"-\" +\n System.currentTimeMillis() + \".jpg\";\n\n // get device's PICTURE folder path\n File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n\n // PICTURE path + /FoodieRoute Folder.\n File newFolderFromPath = new File(path.toString() + \"/FoodieRoute\");\n\n // check folder existsted, if not, create new folder.\n if (!newFolderFromPath.exists()) {\n newFolderFromPath.mkdir();\n }\n\n File filepathname = new File(newFolderFromPath, filename);\n\n // saving the image into device folder\n try {\n out = new FileOutputStream(filepathname);\n System.out.println(\"elliot: fileoutputstream: \" + out.toString());\n System.out.println(\"elliot: filepathname: \" + filepathname.toString());\n bmp.compress(Bitmap.CompressFormat.JPEG, 100, out); // bmp is your Bitmap instance\n // PNG is a lossless format, the compression factor (100) is ignored\n\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (out != null) {\n out.close();\n// return Uri.fromFile(getFileStreamPath(filename));\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return new String[]{filepathname.toString(), filename};\n }", "private void saveImageToLocalStore(Bitmap finalBitmap) {\n Calendar cal = Calendar.getInstance();\n //--------------\n File direct = new File(Environment.getExternalStorageDirectory() + \"/NDS images\");\n\n if (!direct.exists()) {\n direct = new File(\"/NDS images\");\n direct.mkdirs();\n }\n final String filename = \"NDS_img_\" + cal.getTimeInMillis() + \".png\";\n\n File file = new File(Environment.getExternalStorageDirectory() + File.separator\n + \"/NDS images/\", filename);\n if (file.exists()) {\n file.delete();\n\n }\n //--\n\n // File file = new File(directory+\"/Boo_images/\", filename);\n if (file.exists()) file.delete();\n try {\n FileOutputStream out = new FileOutputStream(file);\n finalBitmap.compress(Bitmap.CompressFormat.PNG, 100, out);\n out.flush();\n out.close();\n //---\n String path_0 = Environment.getExternalStorageDirectory() + File.separator\n + \"/NDS images/\" + filename;\n String filename_to_up = path_0.substring(path_0.lastIndexOf(\"/\") + 1);\n if (!editText.getText().toString().isEmpty()) {\n //addCaptionToSuggestionMedia(path_0, filename_to_up, \"image\", MYRemoteId, (editText.getTag().toString().isEmpty()) ? \"0\" : editText.getTag().toString());\n //addCaptionToSuggestionMedia(path_0, filename_to_up, \"audio\", MYRemoteId, (editText.getTag().toString().isEmpty()) ? \"0\" : editText.getTag().toString());\n path_000 = path_0;\n filename_000 = filename_to_up;\n myRemoteId_000 = MYRemoteId;\n SuggestionBoxId_000 = (editText.getTag().toString().isEmpty()) ? \"0\" : editText.getTag().toString();\n //-000000000000000000000000-----Image to send-----------------------------------------\n mediaType_000 = \"image\";\n image_tag.setTag(filename_to_up);\n image_tag.setVisibility(View.VISIBLE);\n video_tag.setVisibility(View.GONE);\n audio_tag.setVisibility(View.GONE);\n textSuggestion.setVisibility(View.GONE);\n File imgFile = new File(path_0);\n if (imgFile.exists()) {\n try {\n final BitmapFactory.Options options = new BitmapFactory.Options();\n options.inSampleSize = 2;\n Bitmap bm = BitmapFactory.decodeFile(path_0, options);\n //Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());\n // Log.w(\"myPath\", path);\n //--Adjust imagte before final display haha!---------\n\n\n //---\n Bitmap srcBmp = bm;\n Bitmap dstBmp = null;\n //---Cropping for small display--\n try {\n if (srcBmp.getWidth() >= srcBmp.getHeight()) {\n try {\n dstBmp = Bitmap.createBitmap(srcBmp, srcBmp.getWidth() - srcBmp.getHeight(), 0, srcBmp.getHeight(), srcBmp.getHeight());\n //Log.w(\"cropped yes\",\"good\");\n } catch (RuntimeException shhh) {\n\n }\n } else {\n try {\n dstBmp = Bitmap.createBitmap(srcBmp, 0, srcBmp.getHeight() - srcBmp.getWidth(), srcBmp.getWidth(), srcBmp.getWidth());\n //Log.w(\"cropped yes\",\"good\");\n } catch (RuntimeException shhh) {\n\n }\n }\n\n\n //-----------------\n Drawable d = new BitmapDrawable(getResources(), dstBmp);\n edixt_image.setImageDrawable(d);\n\n // edixt_image.setImageBitmap(dstBmp);\n edixt_image.setTag(path_0);\n } catch (RuntimeException shhh) {\n\n }\n\n\n } catch (Exception vb) {\n\n }\n\n //-------------\n\n\n //----------------\n }\n\n //---------0000000000000000000000000000000000000000000000000000000000000000000000000000000000\n } else {\n Toast.makeText(Suggestion_box_suggest.this, \"Choose or type in receipient\", Toast.LENGTH_SHORT).show();\n }\n galleryAddPic();\n deleteLatestPicture();\n //-------------------------------------------\n } catch (Exception e) {\n e.printStackTrace();\n\n\n Log.w(\"DirImage\", \"failed!\" + e.toString());\n Toast.makeText(Suggestion_box_suggest.this, \"Image not saved! Not enough space!\" + e.toString(), Toast.LENGTH_SHORT).show();\n }\n }", "@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\ts[0] = pathImage;\n\t\t\t\t\t\tString names = name.getText().toString();\n\t\t\t\t\t\tString types = type.getText().toString();\n\t\t\t\t\t\tString characters = character.getText().toString();\n\t\t\t\t\t\tString notes = note.getText().toString();\n\t\t\t\t\t\tString sexs = sex.getText().toString();\n\t\t\t\t\t\tDouble weights = Double.parseDouble(weight.getText().toString());\n\t\t\t\t\t\tint ages = Integer.parseInt(age.getText().toString());\n\t\t\t\t\t\t\n\t\t\t\t\t\tUpload u = new Upload(NewPet.this, s);\n\t\t\t\t\t\tu.Commit();\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile(u.getUrls() == null);\n\t\t\t\t\t\ts = u.getUrls();\n\t\t\t\t\t\t\n\t\t\t\t\t\tCreatePet cp = new CreatePet(NewPet.this, names, types, characters, notes\n\t\t\t\t\t\t\t\t, sexs, weights, ages, s);\n\t\t\t\t\t\tcp.Commit();\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile(cp.getFlag() == 0){\n\t\t\t\t\t\t\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfinish();\n\t\t\t\t\t}", "private void runGet() {\n File myFile = new File(\"sdcard/Pictures/Screenshots\");\n //File myFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), SCREENSHOTS_DIR_NAME);\n //File myFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), \"\");\n //File myFile = new File(\"sdcard/DCIM/Screenshots\"); // L\n Log.i(TAG, \"Observing is clicked... path : \" + myFile.getPath());\n NewScreenshotObserver observer = new NewScreenshotObserver(myFile.getAbsolutePath());\n observer.startWatching();\n Log.i(TAG, \"Oberving is started\");\n\n //monitorAllFiles(myFile);\n Handler handler = new Handler(Looper.getMainLooper());\n co = new MyContentObserver(this, handler);\n getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, true, co);\n\n try {\n while(!Thread.currentThread().isInterrupted()) {\n Log.i(TAG, \"I am observer sdcard\");\n Thread.sleep(THREAD_SLEEP_TIME);\n }\n } catch(InterruptedException e) {\n }\n }", "private String storeImage(Bitmap imageData) {\n // get path to external storage (SD card)\n String filePath = null;\n if (imageData != null) {\n\n\n try {\n //boolean s = sdIconStorageDir.mkdirs();\n filePath = Environment.getExternalStorageState()\n + System.currentTimeMillis() + \".jpg\";\n Log.d(\"Donde\", filePath);\n FileOutputStream fileOutputStream = new FileOutputStream(\n filePath);\n\n BufferedOutputStream bos = new BufferedOutputStream(\n fileOutputStream);\n\n // choose another format if PNG doesn't suit you\n imageData.compress(Bitmap.CompressFormat.JPEG, 0, bos);\n\n bos.flush();\n bos.close();\n return filePath;\n } catch (IOException e) {\n return \"fail\";\n }\n } else {\n return \"fail\";\n }\n\n }", "public abstract void executeOnDiskIO(@NonNull Runnable runnable);", "@Override\n\t \tpublic void run() {\n\t \t\tsuper.run();\n\t \t\t FileUtil.DeleteFile(new File(Environment.getExternalStorageDirectory() + \"/\"+\"jikedownload\"));\n\t \t}", "private void uploadFile(String uploadDate,String uploadMealName) {\n\n Context context = this;\n Thread imageWithMealBinder = new Thread(){\n private Context localContext = context;\n @Override\n public void run(){\n if (mImageUri != null) {\n String address = System.currentTimeMillis() + \".\" + getFileExtension(mImageUri);\n final StorageReference fileReference = mStorageRef.child(address);\n\n\n fileReference.putFile(mImageUri).addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n Toast.makeText(MealViewer.this, e.getMessage(), Toast.LENGTH_SHORT).show();\n }\n }).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {\n @Override\n public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {\n double progress = (100.0 * taskSnapshot.getBytesTransferred() / taskSnapshot.getTotalByteCount());\n mProgressBar.setProgress((int) progress);\n\n }\n }).continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {\n @Override\n public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {\n if (!task.isSuccessful()) {\n throw task.getException();\n }\n return fileReference.getDownloadUrl();\n }\n }).addOnSuccessListener(new OnSuccessListener<Uri>() {\n @Override\n public void onSuccess(@NonNull Uri downloadUri) {\n Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n mProgressBar.setProgress(0);\n }\n }, 5000);\n\n Toast.makeText(MealViewer.this, R.string.upload_successfull, Toast.LENGTH_SHORT).show();\n Upload upload = new Upload(mealNameTextbox.getText().toString().trim(), downloadUri.toString());\n\n // Make a unique Id - We can change this later.\n String uploadId = mDatabaseRef.push().getKey();\n\n // Use this to get data\n mDatabaseRef.child(uploadId).setValue(upload);\n\n // Get the url\n String imageUrl = upload.getImageUrl();\n\n\n //update the database\n MealCalendar mc =\n GreenFoodChallengeDatabase.getCurrentUser().getMealCalendar();\n\n synchronized (mc){\n Day day = mc.getDay(uploadDate);\n Meal meal = day.getMeal(uploadMealName);\n meal.setImageUrl(imageUrl);\n day.setMeal(meal);\n mc.updateDay(uploadDate,day);\n\n GreenFoodChallengeDatabase.updateCurrentUser();\n }\n\n }\n });\n\n }\n }\n\n };\n imageWithMealBinder.start();\n }", "@Override\n\t\tprotected String doInBackground(String... arg0) {\n\t\t\tBitmap ret = takeScreenShot(0, 0 + mStatusBarHeight,\n\t\t\t\t\tmDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels\n\t\t\t\t\t\t\t- mStatusBarHeight);\n\n\t\t\t// CopyOfScreenShotActivity cc = new CopyOfScreenShotActivity(1);\n\t\t\t// Bitmap ret = cc.getScreenShot(cc.getDevice());\n\t\t\tif (ret != null) {\n\t\t\t\tif (cropRect != null) {// rectangle\n\t\t\t\t\tret = cropImage(ret, cropRect);\n\t\t\t\t\tif (mIsOval)\n\t\t\t\t\t\tret = Utils.getOval(ret);\n\t\t\t\t}\n\t\t\t\tcutSuccess = makeFile(ret);\n\t\t\t}\n\t\t\treturn null;\n\t\t}", "private boolean SaveImage(Bitmap imageData, String filename, Context ctx) {\n\n String folder = \"\";\n String sdState = android.os.Environment.getExternalStorageState(); //Получаем состояние SD карты (подключена она или нет) - возвращается true и false соответственно\n if (sdState.equals(android.os.Environment.MEDIA_MOUNTED)) {\n folder = ctx.getCacheDir().toString();\n }\n else {\n folder = ctx.getExternalCacheDir().toString();\n }\n\n try {\n String filePath = folder + \"/\" + filename;\n FileOutputStream fileOutputStream = new FileOutputStream(filePath);\n\n BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);\n\n //choose another format if PNG doesn't suit you\n imageData.compress(Bitmap.CompressFormat.PNG, 100, bos);\n\n bos.flush();\n bos.close();\n\n } catch (FileNotFoundException e) {\n Log.w(\"TAG\", \"Error saving image file: \" + e.getMessage());\n return false;\n } catch (IOException e) {\n Log.w(\"TAG\", \"Error saving image file: \" + e.getMessage());\n return false;\n }\n\n return true;\n }", "private void saveToInternalStorage(Bitmap bitmapImage) {\n String root = Environment.getExternalStorageDirectory().toString();\n File myDir = new File(root + \"/saved_images\");\n if (!myDir.exists()) {\n myDir.mkdirs();\n }\n String fname = \"profile.jpg\";\n File file = new File(myDir, fname);\n if (file.exists()){\n file.delete();\n }\n try {\n FileOutputStream out = new FileOutputStream(file);\n bitmapImage.compress(Bitmap.CompressFormat.JPEG, 90, out);\n out.flush();\n out.close();\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private void saveFileToDrive() {\n Log.w(TAG, \"Creating new contents.\");\n final Bitmap image = mBitmapToSave;\n Drive.DriveApi.newDriveContents(mGoogleApiClient)\n .setResultCallback(new ResultCallback<DriveApi.DriveContentsResult>() {\n\n @Override\n public void onResult(DriveApi.DriveContentsResult result) {\n // If the operation was not successful, we cannot do anything\n // and must\n // fail.\n if (!result.getStatus().isSuccess()) {\n Log.w(TAG, \"Failed to create new contents.\");\n return;\n }\n // Otherwise, we can write our data to the new contents.\n Log.w(TAG, \"New contents created.\");\n // Get an output stream for the contents.\n OutputStream outputStream = result.getDriveContents().getOutputStream();\n // Write the bitmap data from it.\n ByteArrayOutputStream bitmapStream = new ByteArrayOutputStream();\n image.compress(Bitmap.CompressFormat.PNG, 100, bitmapStream);\n try {\n outputStream.write(bitmapStream.toByteArray());\n } catch (IOException e1) {\n Log.w(TAG, \"Unable to write file contents.\");\n }\n // Create the initial metadata - MIME type and title.\n // Note that the user will be able to change the title later.\n MetadataChangeSet metadataChangeSet = new MetadataChangeSet.Builder()\n .setMimeType(\"image/jpeg\").setTitle(\".png\").build();\n // Create an intent for the file chooser, and start it.\n IntentSender intentSender = Drive.DriveApi\n .newCreateFileActivityBuilder()\n .setInitialMetadata(metadataChangeSet)\n .setInitialDriveContents(result.getDriveContents())\n .build(mGoogleApiClient);\n try {\n startIntentSenderForResult(\n intentSender, REQUEST_ACCOUNT_PICKER, null, 0, 0, 0);\n } catch (IntentSender.SendIntentException e) {\n Log.w(TAG, \"Failed to launch file chooser.\");\n }\n }\n });\n }", "private void savePhotoFiles(Bitmap anypicImage, Uri uri) {\n\t\tMatrix matrix = new Matrix();\n\t\t// matrix.postRotate(90);\n\t\tBitmap rotatedImage = Bitmap.createBitmap(anypicImage, 0, 0,\n\t\t\t\tanypicImage.getWidth(), anypicImage.getHeight(), matrix, true);\n\n\t\t// make thumbnail with size of 86 pixels\n\t\tBitmap anypicThumbnail = Bitmap.createScaledBitmap(anypicImage, 86, 86,\n\t\t\t\tfalse);\n\n\t\tByteArrayOutputStream bos = new ByteArrayOutputStream();\n\t\trotatedImage.compress(Bitmap.CompressFormat.JPEG, 100, bos);\n\t\tbyte[] rotatedData = bos.toByteArray();\n\n\t\tbos.reset(); // reset the stream to prepare for the thumbnail\n\t\tanypicThumbnail.compress(Bitmap.CompressFormat.JPEG, 100, bos);\n\t\tbyte[] thumbnailData = bos.toByteArray();\n\n\t\ttry {\n\t\t\t// close the byte array output stream\n\t\t\tbos.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t// Create the ParseFiles and save them in the background\n\t\timage = new ParseFile(\"photo.jpg\", rotatedData);\n\t\tsong = new ParseFile(\"song.\"\n\t\t\t\t+ songPath.substring(songPath.length() - 3),\n\t\t\t\tconvertAudioToByte(uri));\n\t\tthumbnail = new ParseFile(\"photo_thumbnail.jpg\", thumbnailData);\n\t\timage.saveInBackground(new SaveCallback() {\n\t\t\t@Override\n\t\t\tpublic void done(ParseException e) {\n\t\t\t\tif (e != null) {\n\t\t\t\t\tToast.makeText(getApplicationContext(),\n\t\t\t\t\t\t\t\"Error saving image file: \" + e.getMessage(),\n\t\t\t\t\t\t\tToast.LENGTH_LONG).show();\n\t\t\t\t} else {\n\t\t\t\t\t// saved image to Parse\n\t\t\t\t\tgetCurrentPhoto().setImage(image);\n\t\t\t\t\tgetCurrentPhoto().setThumbnail(thumbnail);\n\t\t\t\t\tgetCurrentPhoto().setSong(song);\n\t\t\t\t\t//getCurrentPhoto().setUploadCount((songCount.intValue()+1));\n\t\t\t\t\tgData.setUploadCount(1+gData.getUploadCount());\n\t\t\t\t\tParseUser.getCurrentUser().put(\"uploadCount\",gData.getUploadCount());\n\t\t\t\t\tParseUser.getCurrentUser().saveInBackground();\n\n\t\t\t\t\tif (publicUpload) {\n\t\t\t\t\t\tgetCurrentPhoto().setVisiblity(publicUpload);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgetCurrentPhoto().setVisiblity(privateUpload);\n\n\t\t\t\t\t}\n\t\t\t\t\tgetCurrentPhoto().setSongTitle(songTitle);\n\t\t\t\t\tgetCurrentPhoto().setArtistName(artistName);\n\t\t\t\t\tgetCurrentPhoto().setUser(ParseUser.getCurrentUser());\n\t\t\t\t\tgetCurrentPhoto().setSongSize(fileSize);\n\n\t\t\t\t\tgData.setUsedSpace(gData.getUsedSpace()+fileSize);\n\t\t\t\t\tParseUser.getCurrentUser().put(\"usedSpace\",gData.getUsedSpace());\n\t\t\t\t\tParseUser.getCurrentUser().saveInBackground();\n\t\t\t\t\t//getCurrentPhoto().setUsedSpace(\n\t\t\t\t\t\t\t//(value.intValue() + fileSize));\n\t\t\t\t\tdoe();\n\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tLog.i(\"dsd\", \"Finished saving the photos to ParseFiles!\");\n\n\t}", "public String saveCapturedImagesToSdcard(Bitmap bitmap) {\n\t\tFile destDir = ctxt.getExternalFilesDir(Tattle_Config_Constants.SD_FOLDER_NAME + File.separator);\n\t\tif (!destDir.exists()) {\n\t\t\tdestDir.mkdir();\n\t\t}\n\t\tString filePath = destDir + File.separator + Tattle_Config_Constants.SD_SCREENSHOT_IMAGE_NAME;\n\t\tFile imagePath = new File(filePath);\n\t\tFileOutputStream fos;\n\t\ttry {\n\t\t\tfos = new FileOutputStream(imagePath);\n\t\t\tbitmap.compress(CompressFormat.PNG, 100, fos);\n\t\t\tfos.flush();\n\t\t\tfos.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\tLog.e(\"GREC\", e.getMessage(), e);\n\t\t} catch (IOException e) {\n\t\t\tLog.e(\"GREC\", e.getMessage(), e);\n\t\t}\n\t\treturn destDir.getAbsolutePath();\n\t}", "void save(Images image);", "public void savePicture() {\n\t\tLog.d(TAG, \"savePicture\");\n\t\t\n\t\tFile cropFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath() + \"/Lente/crop.jpg\");\n\t\tmCropView.setDrawingCacheEnabled(true);\n\t\tBitmap bm = Bitmap.createBitmap(mCropView.getDrawingCache());\n\t\tmCropView.setDrawingCacheEnabled(false);\n\t\t\n\t\ttry {\n\t\t FileOutputStream outputStream = new FileOutputStream(cropFile);\n\t\t Log.d(TAG, \"Compressing and saving...\");\n\t\t bm.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);\n\t\t outputStream.flush();\n\t\t outputStream.close();\n\t\t \n\t\t MediaScannerConnection.scanFile(getBaseContext(),\n\t new String[] { cropFile.toString() }, null,\n\t new MediaScannerConnection.OnScanCompletedListener() {\n\t public void onScanCompleted(String path, Uri uri) {\n\t Log.i(\"ExternalStorage\", \"Scanned \" + path + \":\");\n\t Log.i(\"ExternalStorage\", \"-> uri=\" + uri);\n\t //passUri(uri); //Pass the URI once obtained and move onto OCRopus\n\t }\n\t\t\t});\n\t }\n\t\t\n\t\tcatch (IOException e) {\n\t\t\tToast.makeText(ImageTextSelect.this, \"Failed to save selected image area.\", 2000).show();\n\t\t\tLog.e(TAG, \"IO Exception\");\n\t\t}\n\t}", "@Override\n public void run(){\n int status = 0;\n try{\n FileWriter writer = new FileWriter(file);\n writer.append(data);\n writer.flush();\n writer.close();\n Log.d(\"MainActivity\",\"File saved to \"+file.getAbsolutePath());\n //Log.v(\"DataActivity\", data);\n status = 1;\n }catch (IOException e){\n Log.e(\"Exception\", \"File write failed: \" + e.toString());\n }\n Message msg = new Message();\n msg.what = status;\n msg.obj = file.getAbsolutePath();\n msg.arg1 = type;\n Log.d(\"File\", file.getAbsolutePath());\n if (writeToFileHandler != null){\n writeToFileHandler.sendMessage(msg);\n }\n }", "private void downloadImages(){\n new Thread(new Runnable() {\n @Override\n public void run() {\n while(true){\n if(jsonFlag) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n Toast.makeText(getApplicationContext(), \"\\tJSON DOWNLOADED\\nIMAGES DOWNLOADING...\", Toast.LENGTH_SHORT).show();\n }\n });\n for ( int i = 0; i < getSize(); ++i) {\n final int index = i;\n new Thread(new Runnable() {\n @Override\n public void run() {\n long startTime;\n synchronized (mutex) {\n startTime = System.currentTimeMillis();\n bitmapList.add(getBitmapFromURL(urlList.get(index)));\n threadOrder.add(index);\n }\n long stopTime = System.currentTimeMillis();\n long elapsedTime = stopTime - startTime;\n Log.i(TAG, \"Image [\" + index + \"] downloaded. Duration is: \" + elapsedTime + \" ms.\");\n ++downloadCount;\n if (downloadCount == getSize()) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n Toast.makeText(getApplicationContext(), \"IMAGES DOWNLOADED\", Toast.LENGTH_SHORT).show();\n }\n });\n downloadFlag = true;\n downloadCount = 0;\n }\n }\n }).start();\n }\n break;\n }\n }\n }\n }).start();\n }", "@Override\n public void onComplete(String url) {\n String localName = getLocalImageFileName(url);\n //Log.d(\"TAG\",\"cach image: \" + localName);\n saveImageToFile(imageBitmap,localName); // synchronously save image locally\n //listener.oncomplete(url);\n listener.onComplete(url);\n }", "static void updateUsersThumbnails(String phone)\n {\n new Thread(() -> {\n FirebaseStorage storage = FirebaseStorage.getInstance();\n StorageReference storageReference = storage.getReference();\n storageReference.child(\"images/thumb_\" + phone).getBytes(MAX_SIZE)\n .addOnSuccessListener(bytes -> usersThumbnails.put(phone, BitmapFactory.decodeByteArray(bytes, 0, bytes.length)))\n .addOnFailureListener(exception -> Log.d(\"Connection Error\", \"Failed to receive photo due to connection error\"));\n }).start();\n }", "public void saveActions()\r\n {\r\n\t imageCopy[0] = bufferedImage;\r\n\t imageCopy[1] = edited;\r\n\t imageCopy[2] = cropedPart;\r\n\t imageCopy[3] = bufferedImage;\r\n\t \r\n\t statesCopy[0] = isBlured;\r\n\t statesCopy[1] = isReadyToSave;\r\n\t statesCopy[2] = isChanged;\r\n\t statesCopy[3] = isInverted;\r\n\t statesCopy[4] = isRectangularCrop;\r\n\t statesCopy[5] = isCircularCrop;\r\n\t statesCopy[6] = isImageLoaded;\r\n\t \r\n }", "@Override\r\n protected Boolean doInBackground(Void... params) {\n try{\r\n String ImgPath = ImageUtils.getImageSavePath(GlobalDefinitions.TAG);\r\n PhotoUtils.saveBitmap(mFaceEditor.getDisplayImage(), ImgPath,PhotoUtils.IMAGE_FORMAT_JPG, BeautyfaceActivity.this);\r\n GlobalDefinitions.IMAGE_EDIT_DONE = true;\r\n\r\n }\r\n catch(Exception e)\r\n {\r\n return false;\r\n }\r\n return true;\r\n }", "public void saveImageFromURL(final CacheLoaderCallBack callBack) {\n Executors.newFixedThreadPool(1).execute(new Runnable() {\n @Override\n public void run() {\n if (context != null) {\n OutputStream os = null;\n InputStream is = null;\n final File file = new File(context.getExternalFilesDir(null), pictureName);\n\n try {\n URL url = new URL(loadUrl);\n httpConnection = (HttpURLConnection) url.openConnection();\n httpConnection.setDoInput(true);\n httpConnection.connect();\n is = httpConnection.getInputStream();\n Bitmap bit = BitmapFactory.decodeStream(is);\n os = new FileOutputStream(file);\n bit.compress(Bitmap.CompressFormat.JPEG, 85, os);\n is.close();\n os.close();\n Runnable runnable = new Runnable() {\n @Override\n public void run() {\n callBack.onSuccess();\n }\n };\n new Handler(Looper.getMainLooper()).post(runnable);\n httpConnection.disconnect();\n } catch (final IOException e) {\n Log.w(\"ExternalStorage\", \"Error writing \" + file, e);\n Runnable runnable = new Runnable() {\n @Override\n public void run() {\n callBack.onError(e.getMessage());\n }\n };\n new Handler(Looper.getMainLooper()).post(runnable);\n } finally {\n if (httpConnection != null) {\n httpConnection.disconnect();\n try {\n os.flush();\n os.close();\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n } catch (NullPointerException e) {\n e.printStackTrace();\n }\n }\n }\n }\n }\n });\n }", "public void downloadImage(View v)\n {\n\n String url=editText.getText().toString();\n Thread mythread=new Thread(new downloadImagesUsingWorkerThread(url));\n mythread.start();\n // downloadImagesUsingThreads(listofImages[0]);//must not do this downloading on main thread\n }", "@Override\n\t\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tll.setDrawingCacheEnabled(true);\n\t\t\t\t\t\t\t\tBitmap b = ll.getDrawingCache();\n\t\t\t\t\t\t\t\tb.compress(\n\t\t\t\t\t\t\t\t\t\tCompressFormat.JPEG,\n\t\t\t\t\t\t\t\t\t\t95,\n\t\t\t\t\t\t\t\t\t\tnew FileOutputStream(\n\t\t\t\t\t\t\t\t\t\t\t\tEnvironment\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getExternalStoragePublicDirectory(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tEnvironment.DIRECTORY_PICTURES)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getPath()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ File.separator\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ \"image.jpg\"));\n\t\t\t\t\t\t\t\tfile=new File(Environment\n\t\t\t\t\t\t\t\t\t\t.getExternalStoragePublicDirectory(\n\t\t\t\t\t\t\t\t\t\t\t\tEnvironment.DIRECTORY_PICTURES)\n\t\t\t\t\t\t\t\t\t\t.getPath()\n\t\t\t\t\t\t\t\t\t\t+ File.separator\n\t\t\t\t\t\t\t\t\t\t+ \"image.jpg\");\n\t\t\t\t\t\t\t\tdialog.dismiss();\n\t\t\t\t\t\t\t\t pd = ProgressDialog.show(getActivity(), \"Working..\", \"Uploading Item\", true,\n\t\t\t\t false);\n\t\t\t\t\t\t\t\t try\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t entity=new MultipartEntity();\n\t\t\t\t\t\t\t\t\tentity.addPart(\"days\",new StringBody( days.getText().toString()));\n\t\t\t\t\t\t\t\t\tentity.addPart(\"id\", new StringBody( idItems.get(spinner2.getSelectedItemPosition())));\n\t\t\t\t\t\t\t\t\tentity.addPart(\"title\", new StringBody(title.getText().toString()));\n\t\t\t\t\t\t\t\t\tentity.addPart(\"desc\", new StringBody(desc.getText().toString()));\n\t\t\t\t\t\t\t\t\tentity.addPart(\"advertype\", new StringBody(B2BUtils.getUser().getUsertype()));\n\t\t\t\t\t\t\t\t\tentity.addPart(\"catid\", new StringBody(B2BUtils.categoryId.get(B2BUtils.categoryNames.indexOf(spinner1.getSelectedItem().toString().toUpperCase(Locale.getDefault())))));\n\t\t\t\t\t\t\t\t\tSystem.out.println((B2BUtils.categoryId.get(B2BUtils.categoryNames.indexOf(spinner1.getSelectedItem().toString().toUpperCase(Locale.getDefault())))));\n\t\t\t\t\t\t\t\t\tThread t=new Uploader(file, url, handler, entity);\n\t\t\t\t\t\t\t\t\tt.start();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcatch(Exception e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tLog.d(\"Error\", e.toString());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\tSystem.out.println(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "@Override\n public void onClick(View v) {\n\n writeFile();\n\n File INTERNAL = getFilesDir();\n File EXT_DIR = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File dataDir = Environment.getExternalStorageDirectory();\n\n Log.d(\"FILE\", \"INTERNAL: \" + INTERNAL.getAbsolutePath());\n Log.d(\"FILE\", \"EXTERNAL: \" + EXT_DIR.getAbsolutePath());\n Log.d(\"FILE\", \"DATA: \" + dataDir.getAbsolutePath());\n }", "private void openImageIntent() {\n File pictureFolder = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES\n );\n final File root = new File(pictureFolder, \"SkilExImages\");\n// final File root = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), \"MyDir\");\n\n if (!root.exists()) {\n if (!root.mkdirs()) {\n d(TAG, \"Failed to create directory for storing images\");\n return;\n }\n }\n Calendar newCalendar = Calendar.getInstance();\n int month = newCalendar.get(Calendar.MONTH) + 1;\n int day = newCalendar.get(Calendar.DAY_OF_MONTH);\n int year = newCalendar.get(Calendar.YEAR);\n int hours = newCalendar.get(Calendar.HOUR_OF_DAY);\n int minutes = newCalendar.get(Calendar.MINUTE);\n int seconds = newCalendar.get(Calendar.SECOND);\n final String fname = PreferenceStorage.getUserMasterId(this) + \"_\" + day + \"_\" + month + \"_\" + year + \"_\" + hours + \"_\" + minutes + \"_\" + seconds + \".png\";\n final File sdImageMainDirectory = new File(root.getPath() + File.separator + fname);\n destFile = sdImageMainDirectory;\n outputFileUri = Uri.fromFile(sdImageMainDirectory);\n d(TAG, \"camera output Uri\" + outputFileUri);\n\n // Camera.\n file = new File(Environment.getExternalStorageDirectory()\n + \"/\" + IMAGE_DIRECTORY);\n if (!file.exists()) {\n file.mkdirs();\n }\n final List<Intent> cameraIntents = new ArrayList<Intent>();\n final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n final PackageManager packageManager = getPackageManager();\n final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0);\n for (ResolveInfo res : listCam) {\n final String packageName = res.activityInfo.packageName;\n final Intent intent = new Intent(captureIntent);\n intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));\n intent.setPackage(packageName);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);\n cameraIntents.add(intent);\n }\n\n // Filesystem.\n final Intent galleryIntent = new Intent();\n galleryIntent.setType(\"image/*\");\n galleryIntent.setAction(Intent.ACTION_PICK);\n\n // Chooser of filesystem options.\n final Intent chooserIntent = Intent.createChooser(galleryIntent, \"Select Profile Photo\");\n\n // Add the camera options.\n chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()]));\n\n startActivityForResult(chooserIntent, REQUEST_IMAGE_GET);\n }", "private void save(String name, Bitmap bitmap) {\n\n File photo = new File(currentCaptureDirectory, name + \".jpg\");\n if (photo.exists()) photo.delete();\n\n try {\n FileOutputStream fos = new FileOutputStream(photo.getPath());\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);\n fos.close();\n uploadMultipart(photo.getAbsolutePath(), name + \".jpg\");\n } catch (java.io.IOException e) {\n Log.e(\"PictureDemo\", \"Exception in photoCallback\", e);\n }\n }", "@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)\n @Override\n public void run() {\n Boolean hasBarcodes = barcodes > 0;\n if (hasBarcodes) {\n // Keep local image\n\n //handlePrivateImage(bitmap);\n context.get().finish();\n }\n else {\n // Delete local image and push to cloud\n if (imageFile.exists())\n imageFile.delete();\n handlePublicImage(bitmap);\n }\n }", "@SuppressLint(\"CheckResult\")\n private void saveData() {\n boolean okToSave = true;\n\n if (mImages.size() == 0) {\n okToSave = false;\n ToastModifications.createToast(this, getString(R.string.at_least_one_photo), Toast.LENGTH_LONG);\n } else {\n for (View v : mAllEditTexts) {\n EditText thisEditText = (EditText) v;\n if (thisEditText.getText().toString().equals(\"\")) {\n okToSave = false;\n ToastModifications.createToast(this, getString(R.string.enter_value_for) + thisEditText.getTag(), Toast.LENGTH_SHORT);\n break;\n }\n }\n }\n\n if (okToSave) {\n new Thread(new Runnable() {\n @SuppressWarnings(\"ConstantConditions\")\n @Override\n public void run() {\n String[] imageDescrps = mImageDescription.toArray(new String[0]);\n String saleDate;\n\n if (mListingBeingEdited != null) {\n String editingListingSoldDate = mListingBeingEdited.getSaleDate();\n if (!editingListingSoldDate.equals(\"\")) { //it has been sold previously\n saleDate = determineSaveDate(true);\n } else { //it has not been sold\n saleDate = determineSaveDate(false);\n }\n\n } else {\n saleDate = determineSaveDate(false);\n }\n\n Listing listingToAdd = new Listing(\n mEditingId == null ? DEFAULT_LISTING_ID : mEditingId,\n mTypeSpinner.getSelectedItem().toString(),\n Double.valueOf(mPriceEditText.getText().toString()),\n Double.valueOf(mSurfaceAreaText.getText().toString()),\n Integer.valueOf(mBedroomsSpinner.getSelectedItem().toString()),\n mDescriptionEditText.getText().toString(),\n ImageTools.BitmapsToByteArray(mImages),\n imageDescrps,\n mAddressPostcodeEditText.getText().toString(),\n mAddressNumberEditText.getText().toString(),\n mAddressStreetEditText.getText().toString(),\n mAddressTownEditText.getText().toString(),\n mAddressCountyEditText.getText().toString(),\n mPoiAutocomplete.getText().toString(),\n mEditing ? mListingBeingEdited.getPostedDate() : Utils.getTodayDate(),\n saleDate,\n mListingBeingEdited != null ? mListingBeingEdited.getAgent() :\n (FirebaseHelper.getLoggedInUser() != null ? FirebaseHelper.getLoggedInUser() : getString(R.string.unknown_agent)),\n Utils.getTodayDate(),\n !mBuyOrLetSwitch.isChecked() ? BUY_STRING : LET_STRING,\n mSaleStatusImage.getTag().toString().equals(FOR_SALE_TAG));\n\n if (mEditing) {\n listingToAdd.setEditingAgent(FirebaseHelper.getLoggedInUser() != null ? FirebaseHelper.getLoggedInUser() : getString(R.string.unknown_agent));\n }\n\n mPresenter.addListing(getApplicationContext(), listingToAdd, mEditing);\n }\n\n }).start();\n\n\n createSaveListingProgressBar(); //create the progress bar to display to the user that saving is taking place\n }\n }", "public void run() {\n \t\t\tlogger.info(\"Saving settings ...\");\n \n \t\t\tif (exitSavables != null) {\n \t\t\t\tEnumeration enumeration = exitSavables.elements();\n \t\t\t\twhile (enumeration.hasMoreElements()) {\n \t\t\t\t\tSavable savable = (Savable) enumeration.nextElement();\n \t\t\t\t\ttry {\n \t\t\t\t\t\tsavable.save();\n \t\t\t\t\t} catch (StorageException se) {\n \t\t\t\t\t\tlogger.log(Level.SEVERE,\n \t\t\t\t\t\t\t\t\"Error while saving a resource inside the shutdown hook.\", se);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t\tFileAccess.cleanKeypool(MainFrame.keypool);\n \n \t\t\tlogger.info(\"Bye!\");\n \t\t}", "public void storeScreenshot(Bitmap bitmap, String filename)\n {\n String path = \"/storage/self/primary/Pictures/\" + filename;\n OutputStream out = null;\n File imageFile = new File(path);\n try\n {\n out = new FileOutputStream(imageFile);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 90,out);\n out.flush();\n }\n catch(FileNotFoundException e)\n {\n e.printStackTrace();\n }\n catch(IOException e)\n {\n e.printStackTrace();\n }\n finally\n {\n try\n {\n if(out != null)\n out.close();\n }\n catch(Exception e)\n {\n e.printStackTrace();\n }\n }\n }", "@Override\n\tpublic void run() {\n\t\ttry {\n\t\t\tuploadCurrentImage();\n\t\t} catch (IOException | InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t//Call function from client with the Image URL\n\t}", "@Override\n\tpublic void run(String... args) throws Exception {\n\t\timageDAO.save(new Image(\"imag1\",\"www.ex.com/image1\"));\n\t\timageDAO.save(new Image(\"imag2\",\"www.ex.com/image2\"));\n\t\timageDAO.save(new Image(\"imag3\",\"www.ex.com/image3\"));\n\t\timageDAO.save(new Image(\"imag4\",\"www.ex.com/image4\"));\n\t}", "@Override\n public void run() {\n try {\n List<String> list = Lists.newArrayList();\n for (; ; ) {\n String url = Engine.routeQueue.poll();\n if (url == null && list.size() > 0) {\n File file = new File(\"./half-moil.db\");\n if (!file.exists()) file.createNewFile();\n FileWriter writer = new FileWriter(file, true);\n\n writer.write(Joiner.on(\"\\r\\n\").join(list) + \"\\r\\n\");\n writer.flush();\n writer.close();\n writer = null;\n logger.info(\"文件已保存,新增{}条\", list.size());\n list.clear();\n } else if (url != null) {\n list.add(url);\n } else {\n Thread.sleep(5000L);\n }\n }\n } catch (Exception e) {\n logger.error(e);\n }\n }", "private void saveMap() {\r\n new Thread(() -> {\r\n try {\r\n FileOutputStream f = new FileOutputStream(this.save_file);\r\n ObjectOutputStream S = new ObjectOutputStream(f);\r\n S.writeObject(this.music_map);\r\n S.close();\r\n f.close();\r\n if (!this.save_file.setLastModified(this.music_root.lastModified())) {\r\n throw new IllegalStateException(\"Impossibile aggiornare il file dizionario\");\r\n }\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }).start();\r\n }", "public void savePhotosToDisk(String path, LinkedList<Image> listOfImages){\n\t\ttry{\n\t\t BufferedImage bi = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_BYTE_GRAY);\n\t\t WritableRaster raster = bi.getRaster();\n\n\t\t for (int k = 0; k < listOfImages.size(); k++) {\n\t\t \t\n\t\t \tbyte[][] image = listOfImages.get(k).getData();\n\t\t \tfor (int i = 0; i < 28; i++) {\n\t\t\t\t\tfor (int j = 0; j < 28; j++) {\n\t\t\t\t\t\traster.setSample(i, j, 0, image[i][j]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t \t\n\t\t\t ImageIO.write(bi, \"jpg\", new File(path+k+\".jpg\"));\n\t\t\t}\t\t \n\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t}", "@Override\n protected Integer doInBackground(List<BackupModel>... params) {\n try {\n for (int i = 0; i < params[0].size(); i++) {\n /*if(params[0].get(i).getAppChecked())\n {*/\n // publishProgress(params[0].get(i).getPackgae_name());\n File sdCard = Environment.getExternalStorageDirectory();\n // File x = new File(sdCard.getAbsolutePath() + \"/\" + sdCardDirectory);\n File x = new File(BACKUP_FOLDER_APP_DATA);\n Log.i(TAG, \"创建文件>>>>>>>>>>>>>>>>>>\");\n if (!x.exists()) {\n boolean s = x.mkdirs();\n Log.i(TAG, \"创建文件>>>>>>>>>>>>>>>>>>\");\n } else {\n\n }\n String xdir = params[0].get(i).getPackgae_name();\n File newDir = new File(x.getAbsolutePath() + \"/\" + xdir);\n if (!newDir.exists()) {\n boolean s = newDir.mkdirs();\n }\n try {\n\n List<String> res = RootTools.sendShell(\"cp -r /data/data/\" + xdir + \"/!(cache) \" + newDir.getAbsolutePath(), 15000);\n\n res = RootTools.sendShell(\"tar -zcvf \" + x.getAbsolutePath() + \"/\" + xdir + \".tar.gz -C \" + x.getAbsolutePath() + \" \" + xdir, 15000);\n res = RootTools.sendShell(\"rm -r \" + x.getAbsolutePath() + \"/\" + xdir, 10000);\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n\n // }\n }\n } catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n return null;\n }", "@Override\n public void run() {\n if (isRunScreenSaver == true) { //如果屏保正在显示,就计算不断持续显示\n//\t\t\t\thideOriginalLayout();\n showScreenSaver();\n mHandler02.postDelayed(mTask02, intervalScreenSaver);\n } else {\n mHandler02.removeCallbacks(mTask02); //如果屏保没有显示则移除线程\n }\n }", "@Override\r\n public void run() {\r\n\r\n // Thread: writes files\r\n if (Controller.this.isFileWriteInUse) {\r\n // System.out.println(\"isFileWriteInUse\");\r\n\r\n if (Controller.this.cw.getWritesOnlyFiles()) {// as long as\r\n // thread is\r\n // running\r\n int i = Controller.this.cw.writeFileProgress / 2;\r\n Controller.this.writeIntoFiles.setValue(i);\r\n Controller.this.writeIntoFiles.repaint();\r\n } else {\r\n this.tImer.cancel();\r\n System.out.println(\"*\\tWriting into files finished.\");\r\n Controller.this.isFileWriteInUse = false;\r\n Controller.this.writeIntoFiles.setVisible(false);\r\n if (!Controller.this.isDBWriteInUse)\r\n Controller.this.setStatus(true);\r\n }\r\n } // fi isFileWriteInUse\r\n else\r\n // Thread: writes from file in DB\r\n if (Controller.this.isDBWriteInUse) {// as long write process in DB\r\n // runs\r\n // System.out.println(\"isDBWriteInUse\");\r\n\r\n // critical, because dbc_in is not available as object in the\r\n // beginning\r\n boolean dbc_inStillWork;\r\n try {\r\n dbc_inStillWork = Controller.this.dbc_in.stillWorks;\r\n } catch (Exception e) {\r\n dbc_inStillWork = false;\r\n }\r\n\r\n if (Controller.this.cw.getWritesOnlyFiles() || dbc_inStillWork) {// as\r\n // long\r\n // as\r\n // the\r\n // thread\r\n // is\r\n // running\r\n int i;\r\n if (dbc_inStillWork) {\r\n i = (Controller.this.cw.writeFileProgress / 2)\r\n + ((Controller.this.dbc_in.singleProgress * 50) / Controller.this.dbc_in.maxProgerss);\r\n } else {\r\n i = Controller.this.cw.writeFileProgress / 2;\r\n }\r\n Controller.this.writeIntoDBProgress.setValue(i);\r\n Controller.this.writeIntoDBProgress.repaint();\r\n } else {\r\n this.tImer.cancel();\r\n System.out.println(\"*\\tWriting into DB finished.\");\r\n Controller.this.isDBWriteInUse = false;\r\n Controller.this.writeIntoDBProgress.setVisible(false);\r\n if (!Controller.this.isFileWriteInUse)\r\n Controller.this.setStatus(true);\r\n\r\n if (Controller.this.dBInError) {\r\n this.tImer.cancel();\r\n System.err.print(\"\\t FAILED!\\n\");\r\n Controller.this.setStatus(true);\r\n Controller.this.dBInError = false;\r\n\r\n // dBOutError=false;\r\n }\r\n\r\n } // esle\r\n } else\r\n // Thread: lloads from DB and writes in nodelist.tmp and\r\n // edgelist.tmp\r\n if (Controller.this.isDBReadInUse) {// as lng as read process is\r\n // active\r\n // System.out.println(\"isDBReadInUse\");\r\n\r\n Controller.this.loadFromDBProgress.setVisible(true);\r\n if (Controller.this.dbc_out.stillWorks) {\r\n // System.out.println(\"Loading from DB active ...\");\r\n int i = (Controller.this.dbc_out.singleProgress * 100) / Controller.this.dbc_out.maxProgerss;\r\n if (i < 1)\r\n i = 1;\r\n Controller.this.loadFromDBProgress.setValue(i);\r\n Controller.this.loadFromDBProgress.repaint();\r\n } else {\r\n // tImer.cancel();\r\n System.out.println(\"*\\tLoading from DB finished.\");\r\n Controller.this.isDBReadInUse = false;\r\n Controller.this.loadFromDBProgress.setVisible(false);\r\n\r\n if (Controller.this.dBOutError) {\r\n this.tImer.cancel();\r\n System.err.print(\"\\t FAILED!\\n\");\r\n\r\n Controller.this.setStatus(true);\r\n\r\n Controller.this.isGraphStarted = false;\r\n Controller.this.isDiagStarted = false;\r\n Controller.this.isFileWriteInUse = false;\r\n Controller.this.dBOutError = false;\r\n\r\n // dBInError=true;\r\n\r\n }\r\n }\r\n }\r\n // Thread: runs Chinese Whispers\r\n else if (!Controller.this.dBOutError && !Controller.this.dBInError) {\r\n // System.out.println(\"!dBOutError&&!dBInError\");\r\n\r\n Controller.this.calculateCWProgress.setVisible(true);\r\n Controller.this.CalculateCWLabel.setVisible(true);\r\n\r\n if (Controller.this.cw.isActive) {\r\n if (Controller.this.cw.getIteration() > 0)\r\n Controller.this.calculateCWProgress.setValue(\r\n (Controller.this.cw.getCurrentIteration() * 100) / Controller.this.cw.getIteration());\r\n Controller.this.calculateCWProgress.repaint();\r\n } else { // cw not active\r\n this.tImer.cancel();\r\n System.out.println(\"*\\tCalculating algorithm finished.\");\r\n Controller.this.calculateCWProgress.setVisible(false);\r\n Controller.this.CalculateCWLabel.setVisible(false);\r\n\r\n if (Controller.this.isGraphStarted) {\r\n // System.out.println(\"isGraphStarted\");\r\n Controller.this.setStatus(true);\r\n Controller.this.isAlgStartedForGraph = true;\r\n Controller.this.isGraphStarted = false;\r\n try {\r\n Thread t1 = new Thread(new MyGraphGUI(Controller.this.display_sub_current,\r\n (ChineseWhispers) Controller.this.cw.clone(), Controller.this.display_edges_temp,\r\n Controller.this.scale_temp, 30, Controller.this.display_degree_temp));\r\n t1.start();\r\n } catch (CloneNotSupportedException e) {\r\n e.printStackTrace();\r\n }\r\n } // fi isGraphStarted\r\n\r\n if (Controller.this.isDiagStarted) {\r\n // System.out.println(\"isDiagStarted\");\r\n Controller.this.setStatus(true);\r\n Controller.this.isAlgStartedForGraph = false;\r\n Controller.this.isDiagStarted = false;\r\n try {\r\n Thread t2 = new Thread(new Diagram((ChineseWhispers) Controller.this.cw.clone()));\r\n t2.start();\r\n } catch (CloneNotSupportedException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n } // fi isDiagStarted\r\n if (Controller.this.isFileOutStarted) {\r\n // System.out.println(\"isFileOutStarted\");\r\n Thread t = new Thread(new Runnable() {\r\n @Override\r\n public void run() {\r\n Controller.this.isFileWriteInUse = true;\r\n Controller.this.writeIntoFiles.setVisible(true);\r\n Controller.this.isAlgStartedForGraph = false;\r\n Controller.this.cw.setWritesOnlyFiles(true);\r\n Controller.this.cw.writeFile(true, true, false);\r\n // isFileWriteInUse=false;\r\n }// run()\r\n });// Thread\r\n\r\n t.start();\r\n Timer timer = new Timer();\r\n timer.schedule(new ObserveProgress(timer, t), 200, 2000);\r\n Controller.this.isFileOutStarted = false;\r\n } // fi isFileOutStarted\r\n if (Controller.this.isDBOutStarted) {\r\n // System.out.println(\"isDBOutStarted\");\r\n Thread t = new Thread(new Runnable() {\r\n @Override\r\n public void run() {\r\n Controller.this.isDBWriteInUse = true;\r\n Controller.this.writeIntoDBProgress.setVisible(true);\r\n Controller.this.isAlgStartedForGraph = false;\r\n Controller.this.cw.setWritesOnlyFiles(true);\r\n Controller.this.cw.writeFile(false, false, false);\r\n String pw = \"\";\r\n for (int i = 0; i < Controller.this.rpasswdfield.getPassword().length; i++)\r\n pw += Controller.this.rpasswdfield.getPassword()[i];\r\n\r\n Controller.this.dbc_in = new DBConnect(Controller.this.rhostfield.getText(),\r\n Controller.this.rdatabasefield.getText(), Controller.this.ruserfield.getText(),\r\n pw, Integer.parseInt(Controller.this.rportfield.getText()),\r\n Controller.this.otablenamefield.getText(), COLUMN_NAMES_FOR_DB_OUT);\r\n\r\n // File: Controller.CLASSES_TMP_FILENAME\r\n // Columns: Controller.COLUMN_NAMES_FOR_DB_OUT\r\n try {\r\n Controller.this.dbc_in.stillWorks = true;\r\n Controller.this.dbc_in.maxProgerss = Controller.this.cw.countNodesWithClasses;\r\n Controller.this.dbc_in.writeFromFileIntoDB();\r\n } catch (IOWrapperException iow_e) {\r\n System.err.println(\"Error while writing into DB!\\nConnection failed!\");\r\n JOptionPane.showMessageDialog(null,\r\n \"Error while writing into DB!\\nConnection failed!\", \"Error\",\r\n JOptionPane.ERROR_MESSAGE);\r\n Controller.this.dBInError = true;\r\n Controller.this.dbc_in.stillWorks = false;\r\n return;\r\n } // end catch WrapperException\r\n catch (IOIteratorException ioi_e) {\r\n System.err.println(\"Error while writing into DB!\\nCould not iterate over results!\");\r\n JOptionPane.showMessageDialog(null,\r\n \"Error while writing into DB!\\nCould not iterate over results!\", \"Error\",\r\n JOptionPane.ERROR_MESSAGE);\r\n Controller.this.dBInError = true;\r\n Controller.this.dbc_in.stillWorks = false;\r\n return;\r\n }\r\n Controller.this.isDBOutStarted = false;\r\n }// run()\r\n });// Thread\r\n\r\n t.start();\r\n Timer timer = new Timer();\r\n timer.schedule(new ObserveProgress(timer, t), 200, 2000);\r\n Controller.this.isDBOutStarted = false;\r\n } // end isDBOutStarted\r\n\r\n } // esle CW not active\r\n\r\n } // fi (!dBOutError && !dBInError)\r\n\r\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\tSystem.out.println(\"开始上传\");\n\t\t\t\t\tsocket=new Socket(ip,port);\n\t\t\t\t\tInputStream in=socket.getInputStream();\n\t\t\t\t\tOutputStream out=socket.getOutputStream();\n\t\t\t\t\tBufferedInputStream input=new BufferedInputStream(in);\n\t\t\t\t\twhile(true)\n\t\t\t\t\t{\n\t\t\t\t\t\tFileInputStream fis=new FileInputStream(file);\n\t\t\t\t\t\tDataInputStream dis=new DataInputStream(new BufferedInputStream(fis));\n\t\t\t\t\t\tbyte[] buf=new byte[8192];\n\t\t\t\t\t\tDataOutputStream ps=new DataOutputStream(out);\n\t\t\t\t\t\twhile(true)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tThread.sleep(100);\n\t\t\t\t\t\t\tint read=0;\n\t\t\t\t\t\t\tif(dis!=null){\n\t\t\t\t\t\t\t\tread=fis.read(buf);\n\t\t\t\t\t\t\t\tdownLoadFileSize+=read;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(read==-1)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttimer.cancel();\n\t\t\t\t\t\t\t\tMessage msg=new Message();\n\t\t\t\t\t\t\t\tBundle bundle=new Bundle();\n\t\t\t\t\t\t\t\tbundle.putInt(\"percent\",100 );\n\t\t\t\t\t\t\t\tmsg.setData(bundle);\n\t\t\t\t\t\t\t\thandler.sendMessage(msg);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tps.write(buf,0,read);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tps.flush();\n\t\t\t\t\t\tout.flush();\n\t\t\t\t\t\tps.close();\n\t\t\t\t\t\tdis.close();\n\t\t\t\t\t\tsocket.close();\n\t\t\t\t\t\tSystem.out.println(\"上传完成\");\n\t\t\t\t\t\t \n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}", "private void openImageIntent() {\n File pictureFolder = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES\n );\n final File root = new File(pictureFolder, \"SkilExImages\");\n// final File root = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), \"MyDir\");\n\n if (!root.exists()) {\n if (!root.mkdirs()) {\n Log.d(TAG, \"Failed to create directory for storing images\");\n return;\n }\n }\n Calendar newCalendar = Calendar.getInstance();\n int month = newCalendar.get(Calendar.MONTH) + 1;\n int day = newCalendar.get(Calendar.DAY_OF_MONTH);\n int year = newCalendar.get(Calendar.YEAR);\n int hours = newCalendar.get(Calendar.HOUR_OF_DAY);\n int minutes = newCalendar.get(Calendar.MINUTE);\n int seconds = newCalendar.get(Calendar.SECOND);\n final String fname = PreferenceStorage.getUserMasterId(this) + \"_\" + day + \"_\" + month + \"_\" + year + \"_\" + hours + \"_\" + minutes + \"_\" + seconds + \".png\";\n final File sdImageMainDirectory = new File(root.getPath() + File.separator + fname);\n destFile = sdImageMainDirectory;\n outputFileUri = Uri.fromFile(sdImageMainDirectory);\n Log.d(TAG, \"camera output Uri\" + outputFileUri);\n\n // Camera.\n file = new File(Environment.getExternalStorageDirectory()\n + \"/\" + IMAGE_DIRECTORY);\n if (!file.exists()) {\n file.mkdirs();\n }\n final List<Intent> cameraIntents = new ArrayList<Intent>();\n final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n final PackageManager packageManager = getPackageManager();\n final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0);\n for (ResolveInfo res : listCam) {\n final String packageName = res.activityInfo.packageName;\n final Intent intent = new Intent(captureIntent);\n intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));\n intent.setPackage(packageName);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);\n cameraIntents.add(intent);\n }\n\n // Filesystem.\n final Intent galleryIntent = new Intent();\n galleryIntent.setType(\"image/*\");\n galleryIntent.setAction(Intent.ACTION_PICK);\n\n // Chooser of filesystem options.\n final Intent chooserIntent = Intent.createChooser(galleryIntent, \"Select Profile Photo\");\n\n // Add the camera options.\n chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()]));\n\n startActivityForResult(chooserIntent, REQUEST_IMAGE_GET);\n }", "@Override\n public void imageComplete() throws IOException {\n\tif (done) throw new IOException(errorMsg(\"imageComplete\"));\n\tdone = true;\n\tsynchronized(recorder) {\n\t continueWriting = true;\n\t recorder.notify();\n\t}\n\tsynchronized(this) {\n\t try {\n\t\twhile (writingDone == false) {\n\t\t wait();\n\t\t}\n\t } catch(InterruptedException ie) {\n\t\twriteException = ie;\n\t } catch (IllegalMonitorStateException ime) {\n\t\twriteException = ime;\n\t }\n\t if (writeException != null) {\n\t\tString msg = errorMsg(\"cannotCreateFST\", getType());\n\t\tthrow new\n\t\t IOException(msg, writeException);\n\t }\n\t}\n }", "public void saveBitmapToDisk(String fileName) throws FileNotFoundException, IOException {\n // serialize\n // save to disk\n FileOutputStream fout = new FileOutputStream(\"assets/\"+fileName+\".bitmap\");\n ObjectOutputStream oos = new ObjectOutputStream(fout);\n oos.writeObject(this);\n }", "@Override\n public void onClick(View v) {\n try {\n // new UploadFileToServer().execute();\n\n\t\t\t\t\t\tdialog = ProgressDialog.show(UploadActivity.this, \"\", \"Uploading file...\", true);\n\t\t\t\t\t\tnew Thread(new Runnable() {\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\trunOnUiThread(new Runnable() {\n\t\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\t\t//tv.setText(\"uploading started.....\");\n\n\t\t\t\t\t\t\t\t\t\ttxtdescr.setText(\"Uploading Started\");\n\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tint response= uploadFile(\"/sdcard/android_1.png\");\n\t\t\t\t\t\t\t\tSystem.out.println(\"RES : \" + response);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}).start();\n\t\t\t\t\t\t//dialog.setCancelable(true);\n\n\t\t\t\t\t} catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "@Override\n public void onClick(View view) {\n File direct = new File(Environment.getExternalStorageDirectory() + \"/Scrittor_Backup\");\n\n if (!direct.exists()) {\n if (direct.mkdir()) {\n exportDB();\n } else {\n direct.mkdir();\n exportDB();\n }\n }\n exportDB();\n }", "@Override\n public void onClick(View v) {\n\n dialog = ProgressDialog.show(MainActivity.this, \"\", \"Uploading file...\", true);\n new Thread(new Runnable() {\n public void run() {\n\n uploadFile(pictureFile.getAbsolutePath());\n\n }\n }).start();\n\n }", "@Override\r\n protected String doInBackground(String... params) {\n Thread th = new Thread(new Runnable() {\r\n\r\n @Override\r\n public void run() {\r\n // TODO Auto-generated method stub\r\n upload();\r\n }\r\n });\r\n th.start();\r\n try {\r\n th.join();\r\n } catch (InterruptedException e) {\r\n // TODO Auto-generated catch block\r\n e.printStackTrace();\r\n }\r\n return null;\r\n }", "public static void threadstorer()\r\n\r\n\t{\r\n\t\tThread threadstoreData = new Thread(){\r\n\t\t\tpublic void run(){\r\n\t\t\t\ttry {\r\n\t\t\t\t\t//loadData(inputFile1);\r\n\t\t\t\t\tUtility.writeTofile(wordList, outputFile1);\r\n\t\t\t\t\tSystem.out.println(\"Word Stored\");\r\n\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\tSystem.err.println(\"Error in storing data: \"+e.getMessage());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tThread threadstorePattern = new Thread(){\r\n\t\t\tpublic void run(){\r\n\t\t\t\ttry {\r\n\t\t\t\t\tUtility.writeTofile(patternOut, outputFile2);\r\n\t\t\t\t\tSystem.out.println(\"Pattern stored\");\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\tSystem.err.println(\"Error in storing pattern: \"+e.getMessage());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tthreadstoreData.run();\r\n\t\tthreadstorePattern.run();\r\n\t}", "private void saveScreenshot(Bitmap screenshot, String filePath) {\n FileOutputStream out = null;\n try {\n out = new FileOutputStream(filePath);\n screenshot.compress(Bitmap.CompressFormat.PNG, 100, out);\n Log.i(TAG, \"Screenshot saved to \" + filePath);\n Toast.makeText(this, \"Screenshot saved to \" + filePath, Toast.LENGTH_LONG).show();\n } catch (Exception e) {\n Log.e(TAG, \"Failed to save screenshot\", e);\n Toast.makeText(this, \"Screenshot FAILED!\", Toast.LENGTH_SHORT).show();\n } finally {\n try { if (out != null) { out.close();} } catch (IOException e) {}\n }\n }", "@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tmyAssetInstaller.copyAll();\n\n\t\t\t\t\tringProgressDialog.dismiss();\n\t\t\t\t}", "public void run() {\n sight.setImageBitmap(bmp);\n // old = null;\n }", "public void run() {\n\t\t\t\t\t\tFile tempFile;\n\t\t\t\t\t\tif (tempFileStack.size() >= numberOfFiles)\n\t\t\t\t\t\t\ttempFile = (File) tempFileStack.remove(0); // pop\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\ttempFile = File.createTempFile(\n\t\t\t\t\t\t\t\t\t\t\"FM_\"\n\t\t\t\t\t\t\t\t\t\t\t\t+ ((model.toString() == null) ? \"unnamed\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: model.toString()),\n\t\t\t\t\t\t\t\t\t\tfreemind.main.FreeMindCommon.FREEMIND_FILE_EXTENSION,\n\t\t\t\t\t\t\t\t\t\tpathToStore);\n\t\t\t\t\t\t\t\tif (filesShouldBeDeletedAfterShutdown)\n\t\t\t\t\t\t\t\t\ttempFile.deleteOnExit();\n\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\tSystem.err\n\t\t\t\t\t\t\t\t\t\t.println(\"Error in automatic MindMapMapModel.save(): \"\n\t\t\t\t\t\t\t\t\t\t\t\t+ e.getMessage());\n\t\t\t\t\t\t\t\tfreemind.main.Resources.getInstance()\n\t\t\t\t\t\t\t\t\t\t.logException(e);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tmodel.saveInternal(tempFile, true /* =internal call */);\n\t\t\t\t\t\t\tmodel.getFrame()\n\t\t\t\t\t\t\t\t\t.out(Resources\n\t\t\t\t\t\t\t\t\t\t\t.getInstance()\n\t\t\t\t\t\t\t\t\t\t\t.format(\"automatically_save_message\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tnew Object[] { tempFile\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.toString() }));\n\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\tSystem.err\n\t\t\t\t\t\t\t\t\t.println(\"Error in automatic MindMapMapModel.save(): \"\n\t\t\t\t\t\t\t\t\t\t\t+ e.getMessage());\n\t\t\t\t\t\t\tfreemind.main.Resources.getInstance().logException(\n\t\t\t\t\t\t\t\t\te);\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttempFileStack.add(tempFile); // add at the back.\n\t\t\t\t\t}", "@Override\n public void saveSnapshot(String path) {\n String command = \"adb shell screencap -p \" + path;\n// String command=\"adb shell screencap -p /sdcard/js_test.png\";\n// executeCommand(Lists.newArrayList(\n// \"adb\",\"shell\",\"screencap\",\"-p\",\"/sdcard/js_test.png\",\n// \"|\",\"sed\",\"'s/\\\\r$//'\",\">\",path\n//\n// ));\n// String command=\"adb shell screencap -p | sed 's/\\\\r$//' > screen.png\";\n executeCommand(command);\n }", "@Override\r\n public void run() {\n upload();\r\n }", "@Override\n\t\tprotected String doInBackground(String... f_url) {\n\t\t\tint count;\n\n\t\t\ttry {\n\n\t\t\t\tFile folder = new File(\n\t\t\t\t\t\tEnvironment.getExternalStorageDirectory() + \"/sdcard\");\n\t\t\t\tboolean success = true;\n\t\t\t\tif (!folder.exists()) {\n\t\t\t\t\tsuccess = folder.mkdir();\n\t\t\t\t}\n\t\t\t\tFile folder2 = new File(\n\t\t\t\t\t\tEnvironment.getExternalStorageDirectory()\n\t\t\t\t\t\t\t\t+ \"/sdcard/RBK\");\n\t\t\t\tif (!folder2.exists()) {\n\t\t\t\t\tsuccess = folder2.mkdir();\n\t\t\t\t}\n\n\t\t\t\tURL url = new URL(f_url[0]);\n\t\t\t\tURLConnection conection = url.openConnection();\n\t\t\t\tconection.connect();\n\t\t\t\t// getting file length\n\t\t\t\tint lenghtOfFile = conection.getContentLength();\n\n\t\t\t\t// input stream to read file - with 8k buffer\n\t\t\t\tInputStream input = new BufferedInputStream(url.openStream(),\n\t\t\t\t\t\t8192);\n\n\t\t\t\t// Output stream to write file\n\n\t\t\t\tOutputStream output = new FileOutputStream(Environment\n\t\t\t\t\t\t.getExternalStorageDirectory().toString()\n\t\t\t\t\t\t+ \"/sdcard/RBK/downloadedfile\" + j + \".jpg\");\n\n\t\t\t\tbyte data[] = new byte[1024];\n\n\t\t\t\tlong total = 0;\n\t\t\t\tj++;\n\t\t\t\tLog.v(\"log_tag\", \"j ::: \" + j);\n\n\t\t\t\twhile ((count = input.read(data)) != -1) {\n\t\t\t\t\ttotal += count;\n\n\t\t\t\t\t// writing data to file\n\t\t\t\t\toutput.write(data, 0, count);\n\n\t\t\t\t}\n\n\t\t\t\t// flushing output\n\t\t\t\toutput.flush();\n\n\t\t\t\t// closing streams\n\t\t\t\tinput.close();\n\n\t\t\t} catch (Exception e) {\n\t\t\t\tIntent intent = new Intent(getApplicationContext(), Error.class);\n\n\t\t\t\tstartActivityForResult(intent, 0);\n\t\t\t\tLog.e(\"Error: \", e.getMessage());\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}", "private void proceedAfterPermission() {\n new SDsync().execute();\n\n }", "@Override\r\npublic void onClick(View v) {\r\n switch (v.getId()) {\r\n case R.id.btnStart:\r\n btnStart.setEnabled(false);\r\n btnStop.setEnabled(true);\r\n // sensorData = new ArrayList();\r\n Toast.makeText(GroovyDancero.this,\"Test!!!\", Toast.LENGTH_LONG).show();\r\n System.out.println(\"Start test\");\r\n WriteFile(filepath,acc);\r\n started = true;\r\n sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_FASTEST);\r\n break;\r\n case R.id.btnStop:\r\n try {\r\n btnStart.setEnabled(true);\r\n btnStop.setEnabled(false);\r\n // btnUpload.setEnabled(true);\r\n started = false;\r\n sensorManager.unregisterListener(this);\r\n //if (FileHelper.saveToFile(lastX)){\r\n // Toast.makeText(GroovyDancero.this,\"Saved to file\",Toast.LENGTH_SHORT).show();\r\n //}else{\r\n // Toast.makeText(GroovyDancero.this,\"Error save file!!!\",Toast.LENGTH_SHORT).show();\r\n //}\r\n /*\r\n * if(writer != null) { try { writer.close(); } catch\r\n * (IOException e) { // TODO Auto-generated catch block\r\n * e.printStackTrace(); } }\r\n */} catch (Exception e) {\r\n e.printStackTrace();\r\n Toast.makeText(GroovyDancero.this,\"Error save file!!!\",Toast.LENGTH_SHORT).show();\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n}", "public void startWriterSimulator() throws IOException, InterruptedException {\n \n // producer thread: Write to a file (ie simulate the behavior of the AndofflineApp running on the phone)\n \tnew Thread(new Runnable() {\n\n \t\tpublic void run() {\n \t\t\tSystem.out.println(\"Starting Android File Writer simulator on file: \"+pcounter_log); \t\t\t\t\n \t\t\t\n \t\t\tFileWriter fw;\n \t\t\t\t\n \t\t\ttry {\n \t\t\t\t fw = new FileWriter(pcounter_log);\t\t\n \t\t\t\t\n \t\t\t\t for(int i=0; i<10000;i++){\n \t\t\t\t\tfw.append(\"sms: \"+i +\"\\n\");\n \t\t\t\t\tfw.flush();\n \t\t\t\t\tThread.sleep(5000);\n \t\t\t\t }\n \t\t\t\t\n \t\t\t} catch (Exception e) { \n \t\t\t\tSystem.out.println(\"Error writing SD card file\");\n \t\t\t\te.printStackTrace();\n \t\t\t}\n \t\t}\n \t}).start();\n\n\t}", "public void post() {\r\n // If first or second frame, don't update or save.\r\n if(firstFrame||secondFrame|| (!isTiling)) return;\r\n\r\n // Find image ID from reverse row order\r\n int imgid=tileImgCnt%tileNum+(tileNum-tileImgCnt/tileNum-1)*tileNum;\r\n int idx=(imgid%tileNum);\r\n int idy=(imgid/tileNum);\r\n\r\n // DAVE: in forward row order\r\n imgid = tileImgCnt;\r\n idx=(imgid%tileNum);\r\n idy=(imgid/tileNum);\r\n\r\n // Get current image from sketch and draw it into buffer\r\n p.loadPixels();\r\n tileImg.set(idx*p.width, idy*p.height, p.g);\r\n\r\n // DAVE: time to stream output image?\r\n if (idx==tileNum-1)\r\n appendTGA(tileImg.pixels);\r\n\r\n // Increment tile index\r\n tileImgCnt++;\r\n perc=100*((float)tileImgCnt/(float)tileNumSq);\r\n if(perc-percMilestone>5 || perc>99) {\r\n p.println(p.nf(perc,3,2)+\"% completed. \"+tileImgCnt+\"/\"+tileNumSq+\" images saved.\");\r\n percMilestone=perc;\r\n }\r\n\r\n if(tileImgCnt==tileNumSq) tileFinish();\r\n else tileInc();\r\n }", "public Bitmap processCapturedImage(Intent intentData){\n Bitmap processedImage = (Bitmap) intentData.getExtras().get(\"data\");\n ByteArrayOutputStream bytes = new ByteArrayOutputStream();\n processedImage.compress(Bitmap.CompressFormat.JPEG, 90, bytes);\n File destination = new File(Environment.getExternalStorageDirectory(),\n System.currentTimeMillis() + \".jpg\");\n FileOutputStream fo;\n try {\n destination.createNewFile();\n fo = new FileOutputStream(destination);\n fo.write(bytes.toByteArray());\n fo.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return processedImage;\n }", "private void bitmapToFile(){\n ByteArrayOutputStream bytes = new ByteArrayOutputStream();\n Bitmap thumb,resized;\n thumb = ThumbnailUtils.createVideoThumbnail(selectedVideoPath,\n MediaStore.Images.Thumbnails.MINI_KIND);\n\n if(thumb!=null){\n resized = getResizedBitmap(thumb,120,100);\n }\n else { return;}\n\n resized.compress(Bitmap.CompressFormat.JPEG, 100, bytes);\n imgFile = new File(setFileDestinationPath());\n try {\n FileOutputStream fo = new FileOutputStream(imgFile);\n fo.write(bytes.toByteArray());\n fo.flush();\n fo.close();\n } catch (IOException e) {\n e.printStackTrace();\n broadcastResult(false);\n }\n }", "@Override\n public void onClick(View v) {\n progressDialog = new ProgressDialog(activity,\n R.style.MMBAppTheme);\n progressDialog.setIndeterminate(true);\n progressDialog.setMessage(\"Saving Data\");\n progressDialog.show();\n\n //Save path to Shared Pref\n SharedPrefManager.getInstance(activity).saveStringInfoToSharedPreferences(activity, \"profileImageFilePath\", profileImageFilePathForLocalSaving);\n try {\n uploadProfileImage(); //FIXME: should not happen here but in the next screen\n } catch (ExecutionException | InterruptedException e) {\n e.printStackTrace();\n }\n }", "public void run() {\n try {\n String[] files = mBaseDir.list();\n // if mBaseDir doesn't exist, files can be null.\n if (files != null) {\n for (int i = 0; i < files.length; i++) {\n File f = new File(mBaseDir, files[i]);\n if (!f.delete()) {\n Log.e(LOGTAG, f.getPath() + \" delete failed.\");\n }\n }\n }\n } catch (SecurityException e) {\n // Ignore SecurityExceptions.\n }\n }", "public void saveSelfInfo()\n\t{\n\t\tnew Thread(new Runnable() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\thelper.addSelfInfo(uid, myApp.getSelfInfoList());\n\t\t\t}\n\t\t}).start();\n\t}", "private boolean savePicture(Mesero pictureInfo) {\r\n\t\tif(!isReady) prepare();\r\n\t\tif(!isReady) {\r\n\t\t\tLog.e(TAG,\"The system was not ready. No external media\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t/** Now, let's do the heavy lifting */\r\n\t\t//YAY! http://stackoverflow.com/questions/649154/save-bitmap-to-location\r\n\t\tFileOutputStream out = null;\r\n\t\ttry {\r\n\t\t\tout = new FileOutputStream(new File(directory,pictureInfo.getName()));\r\n\t\t\tpictureInfo.getBitmap().compress(Bitmap.CompressFormat.JPEG, 100, out);\r\n\t\t\t\r\n\t\t} catch(IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\tLog.e(TAG,\"Unable to save file \"+pictureInfo.getName(),e);\r\n\t\t\treturn false;\r\n\t\t} finally {\r\n\t\t\ttry {\r\n\t\t\t\tif(out!=null) out.close();\r\n\t\t\t} catch(IOException ioe) {\r\n\t\t\t\tioe.printStackTrace();\r\n\t\t\t\tLog.e(TAG,\"Unable to close file \"+pictureInfo.getName(),ioe);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "@Override\n public void run() {\n tileset.setIsDownloading(false);\n downloadButton.setOnClickListener(null);\n downloadButton.setColorFilter(0xFF00FF00);\n\n // Update tileset / add to local ArrayList\n Context context = activity.getApplicationContext();\n updateTilesetInDB(context, tileset);\n }" ]
[ "0.6917551", "0.6910758", "0.6808562", "0.64967453", "0.6472984", "0.6422356", "0.62842786", "0.6236365", "0.61649", "0.6104375", "0.6078278", "0.60410887", "0.5982373", "0.59575313", "0.5938169", "0.58609253", "0.585947", "0.5857043", "0.58161014", "0.57771134", "0.5771664", "0.5746991", "0.5736479", "0.5717257", "0.56830126", "0.5663889", "0.5653718", "0.56470793", "0.5625243", "0.56242627", "0.56145734", "0.5595522", "0.5594737", "0.5587604", "0.5576641", "0.555842", "0.5555421", "0.55332863", "0.5529108", "0.5500021", "0.5467108", "0.54621685", "0.5457469", "0.5451689", "0.5451024", "0.54439783", "0.54430693", "0.543889", "0.54301566", "0.5428707", "0.542811", "0.5423033", "0.54101914", "0.5377596", "0.53662735", "0.53619987", "0.5359541", "0.53556037", "0.53514427", "0.5350036", "0.53496575", "0.53493786", "0.5347219", "0.5341582", "0.5336495", "0.5333632", "0.533065", "0.53292537", "0.53285563", "0.5316293", "0.5310181", "0.5302089", "0.52919006", "0.52884567", "0.528747", "0.52870303", "0.5281081", "0.5273326", "0.52709126", "0.52663445", "0.52625835", "0.5261116", "0.52569705", "0.5256514", "0.52485365", "0.52484274", "0.5231971", "0.52314186", "0.5217942", "0.5217314", "0.5214509", "0.52109575", "0.52103025", "0.51997066", "0.5199402", "0.51948756", "0.51908916", "0.5190833", "0.51844394", "0.5183349", "0.51785904" ]
0.0
-1
Setup camera parameters: Rotation Degree Preview Size Video Recording Size ImageReader Size AutoFocus Support CameraID (If has multiple cameras)
private void setupCamera(int width, int height) { CameraManager cameraManager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE); if (cameraManager == null) { return; } try { for (String cameraId : cameraManager.getCameraIdList()) { // get camera characteristics CameraCharacteristics cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId); Integer currentCameraId = cameraCharacteristics.get(CameraCharacteristics.LENS_FACING); if (currentCameraId == null) { // The return value of that key could be null if the field is not set. return; } if (currentCameraId != mRokidCameraParamCameraId.getParam()) { // if not desired Camera ID, skip continue; } int deviceOrientation = mActivity.getWindowManager().getDefaultDisplay().getRotation(); mTotalRotation = CameraDeviceUtils.sensorToDeviceRotation(cameraCharacteristics, deviceOrientation, ORIENTATIONS); mImageReader = ImageReader.newInstance(mSizeImageReader.getSize().getWidth(), mSizeImageReader.getSize().getHeight(), mImageFormat, mMaxImages); mImageReader.setOnImageAvailableListener(mOnImageAvailableListener, mBackgroundHandler); // Check if auto focus is supported int[] afAvailableModes = cameraCharacteristics.get( CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES); if (afAvailableModes.length == 0 || (afAvailableModes.length == 1 && afAvailableModes[0] == CameraMetadata.CONTROL_AF_MODE_OFF)) { mAutoFocusSupported = false; } else { mAutoFocusSupported = true; } mCameraId = cameraId; return; } } catch (CameraAccessException e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setCameraParameters() {\n mParameters = mCameraDevice.getParameters();\n\n// Camera.Size previewSize = getDefaultPreviewSize(mParameters);\n//\n// //获取计算过的摄像头分辨率\n// if(previewSize != null ){\n// mPreviewWidth = previewSize.width;\n// mPreviewHeight = previewSize.height;\n// } else {\n// mPreviewWidth = 480;\n// mPreviewHeight = 480;\n// }\n// mParameters.setPreviewSize(mPreviewWidth, mPreviewHeight);\n// //将获得的Preview Size中的最小边作为视频的大小\n// mVideoWidth = mPreviewWidth > mPreviewHeight ? mPreviewHeight : mPreviewWidth;\n// mVideoHeight = mPreviewWidth > mPreviewHeight ? mPreviewHeight : mPreviewWidth;\n// if(mFFmpegFrameRecorder != null) {\n// mFFmpegFrameRecorder.setImageWidth(mVideoWidth);\n// mFFmpegFrameRecorder.setImageHeight(mVideoHeight);\n// }\n//\n// mParameters.setPreviewFrameRate(mPreviewFrameRate);\n\n List<String> supportedFocusMode = mParameters.getSupportedFocusModes();\n if(isSupported(Camera.Parameters.FOCUS_MODE_AUTO, supportedFocusMode)) {\n mParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);\n }\n\n\n mCameraDevice.setParameters(mParameters);\n\n // 设置闪光灯,默认关闭\n setVideoFlash(false);\n\n //是否支持打开/关闭闪光灯\n mSettingWindow.setFlashEnabled(isSupportedVideoFlash());\n\n mTBtnFocus.setEnabled(isSupportedFocus());\n\n layoutPreView();\n }", "private void updateCameraParametersPreference() {\n\n int camOri = CameraHolder.instance().getCameraInfo()[mCameraId].orientation;\n // Set the preview frame aspect ratio according to the picture size.\n Camera.Size size = mParameters.getPictureSize();\n double aspectWtoH = 0.0;\n if ((camOri == 0 || camOri == 180) && size.height > size.width) {\n aspectWtoH = (double) size.height / size.width;\n } else {\n aspectWtoH = (double) size.width / size.height;\n }\n\n if (LOGV)\n Log.e(TAG, \"picture width=\" + size.width + \", height=\" + size.height);\n\n // Set a preview size that is closest to the viewfinder height and has the right aspect ratio.\n List<Camera.Size> sizes = mParameters.getSupportedPreviewSizes();\n Camera.Size optimalSize;\n //if (mode == SettingsActivity.CAPTURE_MODE)\n //\toptimalSize = Util.getOptimalPreviewSize(this, sizes, aspectWtoH);\n //else\n {\n int requiredArea = mPreviewWidth * mPreviewHeight;\n\n //optimalSize = Util.getOptimalPreviewSize(this, sizes, aspectWtoH);\n optimalSize = Util.getOptimalPreviewSizeByArea(this, sizes, requiredArea);\n }\n\n // Camera.Size optimalSize = Util.getMaxPreviewSize(sizes, camOri);\n Camera.Size original = mParameters.getPreviewSize();\n\n Log.i(TAG, \" Sensor[\" + mCameraId + \"]'s orientation is \" + camOri);\n if (!original.equals(optimalSize)) {\n if (camOri == 0 || camOri == 180) {\n mParameters.setPreviewSize(optimalSize.height, optimalSize.width);\n } else {\n mParameters.setPreviewSize(optimalSize.width, optimalSize.height);\n }\n\n // Zoom related settings will be changed for different preview\n // sizes, so set and read the parameters to get lastest values\n\n if (mCameraDevice != null) {\n mCameraDevice.setParameters(mParameters);\n mParameters = mCameraDevice.getParameters();\n }\n }\n if (LOGV)\n Log.e(TAG, \"Preview size is \" + optimalSize.width + \"x\"\n + optimalSize.height);\n\n String previewSize = \"\";\n previewSize = \"[\" + optimalSize.width + \"x\" + optimalSize.height + \"]\";\n// mPreviewSizeView.setText(previewSize);\n\n // Set JPEG quality.\n int jpegQuality = CameraProfile.getJpegEncodingQualityParameter(\n mCameraId, CameraProfile.QUALITY_HIGH);\n mParameters.setJpegQuality(jpegQuality);\n\n // For the following settings, we need to check if the settings are\n // still supported by latest driver, if not, ignore the settings.\n\n //if (Parameters.SCENE_MODE_AUTO.equals(mSceneMode))\n {\n if (mParameters != null) {\n // Set white balance parameter.\n String whiteBalance = \"auto\";\n if (isSupported(whiteBalance,\n mParameters.getSupportedWhiteBalance())) {\n mParameters.setWhiteBalance(whiteBalance);\n }\n\n String focusMode = mFocusManager.getFocusMode();\n mParameters.setFocusMode(focusMode);\n\n // Set exposure compensation\n int value = 0;\n int max = mParameters.getMaxExposureCompensation();\n int min = mParameters.getMinExposureCompensation();\n if (value >= min && value <= max) {\n mParameters.setExposureCompensation(value);\n } else {\n Log.w(TAG, \"invalid exposure range: \" + value);\n }\n }\n }\n\n\n if (mParameters != null) {\n // Set flash mode.\n String flashMode = \"off\";\n List<String> supportedFlash = mParameters.getSupportedFlashModes();\n if (isSupported(flashMode, supportedFlash)) {\n mParameters.setFlashMode(flashMode);\n }\n\n Log.e(TAG, \"focusMode=\" + mParameters.getFocusMode());\n }\n\n }", "public void adjustCameraParameters() {\n SortedSet<Size> sizes = this.mPreviewSizes.sizes(this.mAspectRatio);\n if (sizes == null) {\n this.mAspectRatio = chooseAspectRatio();\n sizes = this.mPreviewSizes.sizes(this.mAspectRatio);\n }\n Size chooseOptimalSize = chooseOptimalSize(sizes);\n Size last = this.mPictureSizes.sizes(this.mAspectRatio).last();\n if (this.mShowingPreview) {\n this.mCamera.stopPreview();\n }\n this.mCameraParameters.setPreviewSize(chooseOptimalSize.getWidth(), chooseOptimalSize.getHeight());\n this.mCameraParameters.setPictureSize(last.getWidth(), last.getHeight());\n this.mCameraParameters.setRotation(calcCameraRotation(this.mDisplayOrientation));\n setAutoFocusInternal(this.mAutoFocus);\n setFlashInternal(this.mFlash);\n this.mCamera.setParameters(this.mCameraParameters);\n if (this.mShowingPreview) {\n this.mCamera.startPreview();\n }\n }", "private void setupCamera(int width, int height) {\n CameraManager cameraManager = (CameraManager) getSystemService(CAMERA_SERVICE);\n try {\n if (cameraManager == null) return;\n for (String cameraId : cameraManager.getCameraIdList()) {\n CameraCharacteristics cc = cameraManager.getCameraCharacteristics(cameraId);\n if (cc.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK) {\n continue;\n }\n mCameraId = cameraId;\n\n int deviceOrientation = getWindowManager().getDefaultDisplay().getRotation();\n mTotalRotation = CameraUtils.calculateTotalRotation(cc, deviceOrientation);\n StreamConfigurationMap map = cc.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n\n int finalWidth = width;\n int finalHeight = height;\n boolean swapDimensions = mTotalRotation == 90 || mTotalRotation == 270;\n if (swapDimensions) {\n finalHeight = width;\n finalWidth = height;\n }\n mPreviewSize = CameraUtils.chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), finalWidth, finalHeight);\n mVideoSize = CameraUtils.chooseOptimalSize(map.getOutputSizes(MediaRecorder.class), finalWidth, finalHeight);\n return;\n }\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void updateCameraParametersInitialize() {\n List<Integer> frameRates = mParameters.getSupportedPreviewFrameRates();\n if (frameRates != null) {\n Integer max = Collections.max(frameRates);\n mParameters.setPreviewFrameRate(max);\n }\n\n //mParameters.setRecordingHint(false);\n\n // Disable video stabilization. Convenience methods not available in API\n // level <= 14\n String vstabSupported = mParameters\n .get(\"video-stabilization-supported\");\n if (\"true\".equals(vstabSupported)) {\n mParameters.set(\"video-stabilization\", \"false\");\n }\n }", "abstract void setCaptureParameters(int width, int height, int frameRate,\n android.hardware.Camera.Parameters cameraParameters);", "private void setupCamera(final int camera) {\n try {\n // mPreview = new CamPreview(this, camera, CamPreview.LayoutMode.NoBlank);// .FitToParent);\n } catch (Exception e) {\n Toast.makeText(this, R.string.cannot_connect_to_camera, Toast.LENGTH_LONG).show();\n finish();\n return;\n }\n\n RelativeLayout.LayoutParams previewLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n Display display = getWindowManager().getDefaultDisplay();\n DisplayMetrics outMetrics = new DisplayMetrics();\n display.getMetrics(outMetrics);\n\n int width = outMetrics.widthPixels;\n int height = outMetrics.heightPixels;\n\n previewLayoutParams.height = width;\n previewLayoutParams.width = width;\n\n // Un-comment below line to specify the position.\n // mPreview.setCenterPosition(width / 2, height / 2);\n\n // previewParent.addView(mPreview, 0, previewLayoutParams);\n\n\n }", "protected void initRecorderParameters() {\n\t\tmMediaRecorder.setCamera(mCamera);\n\t\tmMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);\n\t\tmMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);\n\t\tmMediaRecorder.setVideoEncoder(mVideoEncoder);\n\t\tmMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());\n\t\tmMediaRecorder.setVideoSize(mQuality.resX,mQuality.resY);\n\t\tmMediaRecorder.setVideoFrameRate(mQuality.framerate);\n\t\tmMediaRecorder.setVideoEncodingBitRate(mQuality.bitrate);\n\t\tmMediaRecorder.setOrientationHint(mQuality.orientation);\n\t}", "private void openCamera(int desiredWidth, int desiredHeight) {\n if (mCamera != null) {\n throw new RuntimeException(\"camera already initialized\");\n }\n\n android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();\n\n // Try to find a front-facing camera (e.g. for videoconferencing).\n int numCameras = android.hardware.Camera.getNumberOfCameras();\n for (int i = 0; i < numCameras; i++) {\n android.hardware.Camera.getCameraInfo(i, info);\n if (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK) {\n mCamera = android.hardware.Camera.open(i);\n break;\n }\n }\n if (mCamera == null) {\n// Log.d(TAG, \"No front-facing camera found; opening default\");\n mCamera = android.hardware.Camera.open(); // opens first back-facing camera\n }\n if (mCamera == null) {\n throw new RuntimeException(\"Unable to open camera\");\n }\n\n android.hardware.Camera.Parameters parms = mCamera.getParameters();\n\n CameraUtils.choosePreviewSize(parms, desiredWidth, desiredHeight);\n\n // Give the camera a hint that we're recording video. This can have a big\n // impact on frame rate.\n parms.setRecordingHint(true);\n\n // leave the frame rate set to default\n mCamera.setParameters(parms);\n\n int[] fpsRange = new int[2];\n android.hardware.Camera.Size mCameraPreviewSize = parms.getPreviewSize();\n parms.getPreviewFpsRange(fpsRange);\n String previewFacts = mCameraPreviewSize.width + \"x\" + mCameraPreviewSize.height;\n if (fpsRange[0] == fpsRange[1]) {\n previewFacts += \" @\" + (fpsRange[0] / 1000.0) + \"fps\";\n } else {\n previewFacts += \" @[\" + (fpsRange[0] / 1000.0) +\n \" - \" + (fpsRange[1] / 1000.0) + \"] fps\";\n }\n// TextView text = (TextView) findViewById(R.id.cameraParams_text);\n// text.setText(previewFacts);\n\n mCameraPreviewWidth = mCameraPreviewSize.width;\n mCameraPreviewHeight = mCameraPreviewSize.height;\n\n\n// AspectFrameLayout layout = (AspectFrameLayout) findViewById(R.id.cameraPreview_afl);\n\n Display display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();\n\n if(display.getRotation() == Surface.ROTATION_0) {\n mCamera.setDisplayOrientation(90);\n// layout.setAspectRatio((double) mCameraPreviewHeight / mCameraPreviewWidth);\n } else if(display.getRotation() == Surface.ROTATION_270) {\n// layout.setAspectRatio((double) mCameraPreviewHeight/ mCameraPreviewWidth);\n mCamera.setDisplayOrientation(180);\n } else {\n // Set the preview aspect ratio.\n// layout.setAspectRatio((double) mCameraPreviewWidth / mCameraPreviewHeight);\n }\n }", "private void configureCamera(int width, int height)\n {\n mCameraId = CAMERA_FACE_BACK;\n ///Configure camera output surfaces\n setupCameraOutputs(mWidth, mHeight);\n }", "public void updateParametersPictureSize() {\n if (this.mCameraDevice == null) {\n Log.w(TAG, \"attempting to set picture size without camera device\");\n return;\n }\n String pictureSizeKey;\n this.mCameraSettings.setSizesLocked(false);\n SettingsManager settingsManager = this.mActivity.getSettingsManager();\n if (isCameraFrontFacing()) {\n pictureSizeKey = Keys.KEY_PICTURE_SIZE_FRONT;\n } else {\n pictureSizeKey = Keys.KEY_PICTURE_SIZE_BACK;\n }\n String pictureSize = settingsManager.getString(SettingsManager.SCOPE_GLOBAL, pictureSizeKey, SettingsUtil.getDefaultPictureSize(isCameraFrontFacing()));\n Size size = new Size(960, MotionPictureHelper.FRAME_HEIGHT_9);\n if (isDepthEnabled()) {\n size = SettingsUtil.getBokehPhotoSize(this.mActivity, pictureSize);\n } else {\n size = SettingsUtil.sizeFromString(pictureSize);\n }\n this.mCameraSettings.setPhotoSize(size);\n if (ApiHelper.IS_NEXUS_5) {\n if (ResolutionUtil.NEXUS_5_LARGE_16_BY_9.equals(pictureSize)) {\n this.mShouldResizeTo16x9 = true;\n } else {\n this.mShouldResizeTo16x9 = false;\n }\n }\n if (size != null) {\n Size optimalSize;\n Tag tag;\n Size optimalSize2 = CameraUtil.getOptimalPreviewSize(this.mActivity, this.mCameraCapabilities.getSupportedPreviewSizes(), ((double) size.width()) / ((double) size.height()));\n Size original = this.mCameraSettings.getCurrentPreviewSize();\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"Photo module Set preview size \");\n stringBuilder.append(size);\n stringBuilder.append(\" calculate size \");\n stringBuilder.append(optimalSize2);\n stringBuilder.append(\" original size \");\n stringBuilder.append(original);\n android.util.Log.e(\"===++++++=====\", stringBuilder.toString());\n if (isDepthEnabled()) {\n optimalSize = SettingsUtil.getBokehPreviewSize(pictureSize, false);\n } else {\n if ((size.width() == 4160 && size.height() == 1970) || (size.width() == 3264 && size.height() == 1546)) {\n optimalSize2 = new Size(1440, MotionPictureHelper.FRAME_HEIGHT_9);\n }\n optimalSize = optimalSize2;\n this.mActivity.getCameraAppUI().setSurfaceHeight(optimalSize.height());\n this.mActivity.getCameraAppUI().setSurfaceWidth(optimalSize.width());\n }\n this.mUI.setCaptureSize(optimalSize);\n Log.w(TAG, String.format(\"KPI original size is %s, optimal size is %s\", new Object[]{original.toString(), optimalSize.toString()}));\n if (!optimalSize.equals(original)) {\n tag = TAG;\n StringBuilder stringBuilder2 = new StringBuilder();\n stringBuilder2.append(\"setting preview size. optimal: \");\n stringBuilder2.append(optimalSize);\n stringBuilder2.append(\"original: \");\n stringBuilder2.append(original);\n Log.v(tag, stringBuilder2.toString());\n this.mCameraSettings.setPreviewSize(optimalSize);\n this.mCameraDevice.applySettings(this.mCameraSettings);\n this.mCameraSettings = this.mCameraDevice.getSettings();\n if (this.mCameraSettings == null) {\n Log.e(TAG, \"camera setting is null ?\");\n }\n }\n if (!(optimalSize.width() == 0 || optimalSize.height() == 0)) {\n Log.v(TAG, \"updating aspect ratio\");\n this.mUI.updatePreviewAspectRatio(((float) optimalSize.width()) / ((float) optimalSize.height()));\n }\n this.mCameraSettings.setSizesLocked(true);\n tag = TAG;\n StringBuilder stringBuilder3 = new StringBuilder();\n stringBuilder3.append(\"Preview size is \");\n stringBuilder3.append(optimalSize);\n Log.d(tag, stringBuilder3.toString());\n }\n }", "public void setCameraParameters(Camera cCamera)\n {\n if (cCamera != null)\n {\n Camera.Parameters cParams = cCamera.getParameters();\n cParams.setPreviewFpsRange(30000, 30000);\n// cParams.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);\n\n cParams.setFlashMode(Camera.Parameters.FLASH_MODE_ON);\n cParams.setJpegQuality(100);\n\n cCamera.setParameters(cParams);\n }\n }", "@Override\n public Camera setupCamera() {\n mCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);\n try {\n Camera.Parameters parameters = mCamera.getParameters();\n parameters.setPreviewSize(mWidth, mHeight);\n parameters.setPreviewFormat(mFormat);\n mCamera.setDisplayOrientation(90);\n for (Camera.Size size : parameters.getSupportedPreviewSizes()) {\n Log.d(TAG, \"SIZE:\" + size.width + \"x\" + size.height);\n }\n for (Integer format : parameters.getSupportedPreviewFormats()) {\n Log.d(TAG, \"FORMAT:\" + format);\n }\n\n List<int[]> fps = parameters.getSupportedPreviewFpsRange();\n for (int[] count : fps) {\n Log.d(TAG, \"T:\");\n for (int data : count) {\n Log.d(TAG, \"V=\" + data);\n }\n }\n mCamera.setParameters(parameters);\n } catch (Exception e) {\n e.printStackTrace();\n }\n if (mCamera != null) {\n mWidth = mCamera.getParameters().getPreviewSize().width;\n mHeight = mCamera.getParameters().getPreviewSize().height;\n }\n return mCamera;\n }", "private void setUpAndConfigureCamera() {\n\t\t// Open and configure the camera\n\t\tmCamera = selectAndOpenCamera();\n\n\t\tCamera.Parameters param = mCamera.getParameters();\n\n\t\t// Smaller images are recommended because some computer vision operations are very expensive\n\t\tList<Camera.Size> sizes = param.getSupportedPreviewSizes();\n\t\tCamera.Size s = sizes.get(closest(sizes,640,360));\n\t\tparam.setPreviewSize(s.width,s.height);\n\t\tmCamera.setParameters(param);\n\n\t\t// start image processing thread\n\n\t\t// Start the video feed by passing it to mPreview\n\t\tmPreview.setCamera(mCamera);\n\t}", "private void setCamera() {\n\t\tCamera.CameraInfo cameraInfo = new Camera.CameraInfo();\n\t\tint cameraCount = Camera.getNumberOfCameras();\n\t\tLog.i(TAG, \"count = \" + cameraCount);\n\t\tLog.i(TAG, \"isBack = \" + isBack);\n\t\tint id = 0;\n\n\t\tfor (int camIdx = 0; camIdx < cameraCount; camIdx++) {\n\t\t\tCamera.getCameraInfo(camIdx, cameraInfo);\n\t\t\tLog.i(TAG, \"cameraInfoFacing = \" + cameraInfo.facing);\n\t\t\tif (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK\n\t\t\t\t\t&& isBack) {\n\t\t\t\ttry {\n\t\t\t\t\tLog.i(TAG, \"SETTING mCamera\");\n\t\t\t\t\tmCamera = Camera.open(camIdx);\n\t\t\t\t\tid = camIdx;\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\tLog.e(TAG,\n\t\t\t\t\t\t\t\"Camera failed to open: \" + e.getLocalizedMessage());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT\n\t\t\t\t\t&& !isBack){\n\t\t\t\ttry {\n\t\t\t\t\tLog.i(TAG, \"SETTING mCamera\");\n\t\t\t\t\tmCamera = Camera.open(camIdx);\n\t\t\t\t\tid = camIdx;\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\tLog.e(TAG,\n\t\t\t\t\t\t\t\"Camera failed to open: \" + e.getLocalizedMessage());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (mCamera != null) {\n\t\t\tCamera.Parameters cameraParameters = mCamera.getParameters();\n\t\t\tDisplay display = getActivity().getWindowManager().getDefaultDisplay();\n\t\t\tPoint size = new Point();\n\t\t\tdisplay.getSize(size);\n\t\t\tint screenWidth = size.x;\n\t\t\tint width = Integer.MAX_VALUE;\n\t\t\tint height = 0;\n\t\t\tLog.i(TAG, \"SCREENWIDTH: \" + screenWidth);\n\t\t\tList<Camera.Size> sizes = cameraParameters.getSupportedPreviewSizes();\n\t\t\tfor (Camera.Size cSize : sizes) {\n\t\t\t\tif (cSize.width >= screenWidth && cSize.width <= width) {\n\t\t\t\t\twidth = cSize.width;\n\t\t\t\t\theight = cSize.height;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tLog.i(TAG, \"Width: \" + width + \" HEIGHT: \" + height);\n\n\t\t\tif (mPreview != null) {\n\t\t\t\tmPreview.switchCamera(mCamera, id, width, height);\n\t\t\t} else {\n\t\t\t\tmPreview = new CameraPreview(getActivity(), mCamera, id, width, height);\n\t\t\t\tFrameLayout preview = (FrameLayout) view\n\t\t\t\t\t\t.findViewById(R.id.camera_preview);\n\t\t\t\tpreview.addView(mPreview);\n\t\t\t}\n\t\t\tmCamera.startPreview();\n\t\t}\n\t}", "public void configureCamera(){\n try{\n camera = Camera.open(findBackFacingCamera());\n } catch (Exception e){}\n\n if(camera != null) {\n cameraView = new CameraView(this.getApplicationContext(), camera);\n FrameLayout camera_view = (FrameLayout)findViewById(R.id.CameraView);\n camera_view.addView(cameraView);\n }\n }", "public void initializeCamera(){\n mCamera = Camera.open();\n\n Camera.Parameters parameters = mCamera.getParameters();\n parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);\n\n List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();\n // Get the supported preview size closest to the requested dimensions:\n Camera.Size previewSize = previewSizes.get(previewSizes.size() - 1); // getOptimalPreviewSize(previewSizes, width, height);\n width = previewSize.width;\n height = previewSize.height;\n Log.d(TAG, \"width: \" + width + \" , height: \" + height);\n nPixels = width * height;\n pixels = new int[nPixels];\n setSize(width, height);\n parameters.setPreviewSize(width, height);\n\n mCamera.setParameters(parameters);\n\n int dataBufferSize=(int)(height * width * (ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())/8.0));\n\n mCamera.addCallbackBuffer(new byte[dataBufferSize]);\n mCamera.setPreviewCallbackWithBuffer(this);\n }", "private void configureCamera() {\n float fHeight = cam.getFrustumTop() - cam.getFrustumBottom();\n float fWidth = cam.getFrustumRight() - cam.getFrustumLeft();\n float fAspect = fWidth / fHeight;\n float yDegrees = 45f;\n float near = 0.02f;\n float far = 20f;\n cam.setFrustumPerspective(yDegrees, fAspect, near, far);\n\n flyCam.setMoveSpeed(5f);\n\n cam.setLocation(new Vector3f(2f, 4.7f, 0.4f));\n cam.setRotation(new Quaternion(0.348f, -0.64f, 0.4f, 0.556f));\n }", "private void setupCameraOutputs(int width, int height) {\n MLog.d(TAG, \"setupCameraOutputs()\" +\n \" width: \" + width +\n \" height: \" + height);\n\n Activity activity = getActivity();\n CameraManager manager =\n (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);\n Point displaySize = new Point();\n activity.getWindowManager().getDefaultDisplay().getSize(displaySize);\n int rotatedPreviewWidth = width;\n int rotatedPreviewHeight = height;\n int screenWidth = displaySize.x;\n int screenHeight = displaySize.y;\n // screenWidth: 720 screenHeight: 1280\n MLog.d(TAG, \"setupCameraOutputs()\" +\n \" screenWidth: \" + screenWidth +\n \" screenHeight: \" + screenHeight);\n\n try {\n for (String cameraId : manager.getCameraIdList()) {\n MLog.d(TAG, \"setupCameraOutputs()\" +\n \" cameraId: \" + cameraId);\n if (TextUtils.isEmpty(cameraId)) {\n continue;\n }\n\n mCameraId = cameraId;\n\n //获取某个相机(摄像头特性)\n CameraCharacteristics characteristics\n = manager.getCameraCharacteristics(cameraId);\n\n // 检查支持\n int deviceLevel = characteristics.get(\n CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);\n if (deviceLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {\n\n }\n\n // We don't use a front facing camera in this sample.\n Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);\n if (facing != null && facing == CameraCharacteristics.LENS_FACING_FRONT) {\n continue;\n }\n\n // 获取StreamConfigurationMap,它是管理摄像头支持的所有输出格式和尺寸\n StreamConfigurationMap map = characteristics.get(\n CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n if (map == null) {\n continue;\n }\n\n // 拍照时使用最大的宽高\n // For still image captures, we use the largest available size.\n Size largest = Collections.max(\n Arrays.asList(map.getOutputSizes(ImageFormat.JPEG)),\n //Arrays.asList(map.getOutputSizes(TextureView.class)),// 不能这样使用\n new CompareSizesByArea());\n // ImageFormat.JPEG largest.getWidth(): 3264 largest.getHeight(): 2448\n // ImageFormat.YV12 largest.getWidth(): 960 largest.getHeight(): 720\n // ImageFormat.YUV_420_888 largest.getWidth(): 960 largest.getHeight(): 720\n MLog.d(TAG, \"setupCameraOutputs() \" + printThis() +\n \" largest.getWidth(): \" + largest.getWidth() +\n \" largest.getHeight(): \" + largest.getHeight());\n\n /***\n * 实时帧数据获取类\n * 由于获取实时帧所以选用YV12或者YUV_420_888两个格式,暂时不采用JPEG格式\n * 在真机显示的过程中,不同的数据格式所设置的width和height需要注意,否侧视频会很卡顿\n * YV12:width 720, height 960\n * YUV_420_888:width 720, height 960\n * JPEG:获取帧数据不能用 ImageFormat.JPEG 格式,否则你会发现预览非常卡的,\n * 因为渲染 JPEG 数据量过大,导致掉帧,所以预览帧请使用其他编码格式\n *\n * 输入相机的尺寸必须是相机支持的尺寸,这样画面才能不失真,TextureView输入相机的尺寸也是这个\n */\n /*mImageReader = ImageReader.newInstance(\n largest.getWidth(),\n largest.getHeight(),\n ImageFormat.YUV_420_888,\n *//*maxImages*//*5);// ImageFormat.JPEG, 2\n mImageReader.setOnImageAvailableListener(\n mOnImageAvailableListener,\n mBackgroundHandler);*/\n\n // Find out if we need to swap dimension to get the preview size relative to sensor\n // coordinate.\n int displayRotation = activity.getWindowManager().getDefaultDisplay().getRotation();\n // noinspection ConstantConditions\n mSensorOrientation = characteristics.get(\n CameraCharacteristics.SENSOR_ORIENTATION);\n MLog.d(TAG, \"setupCameraOutputs() \" + printThis() +\n \" displayRotation: \" + displayRotation +\n \" mSensorOrientation: \" + mSensorOrientation);\n boolean swappedDimensions = false;\n switch (displayRotation) {\n // 竖屏\n case Surface.ROTATION_0:\n case Surface.ROTATION_180:\n if (mSensorOrientation == 90 || mSensorOrientation == 270) {\n swappedDimensions = true;\n }\n break;\n // 横屏\n case Surface.ROTATION_90:\n case Surface.ROTATION_270:\n if (mSensorOrientation == 0 || mSensorOrientation == 180) {\n swappedDimensions = true;\n }\n break;\n default:\n Log.e(TAG, \"Display rotation is invalid: \" + displayRotation);\n break;\n }\n\n if (swappedDimensions) {\n rotatedPreviewWidth = height;\n rotatedPreviewHeight = width;\n screenWidth = displaySize.y;\n screenHeight = displaySize.x;\n }\n\n if (screenWidth > MAX_PREVIEW_WIDTH) {\n screenWidth = MAX_PREVIEW_WIDTH;\n }\n\n if (screenHeight > MAX_PREVIEW_HEIGHT) {\n screenHeight = MAX_PREVIEW_HEIGHT;\n }\n\n // Danger, W.R.! Attempting to use too large a preview size could exceed the camera\n // bus' bandwidth limitation, resulting in gorgeous previews but the storage of\n // garbage capture data.\n mPreviewSize = chooseOptimalSize(\n map.getOutputSizes(SurfaceTexture.class),\n rotatedPreviewWidth,\n rotatedPreviewHeight,\n screenWidth,\n screenHeight,\n largest);\n // mPreviewSize.getWidth(): 960 mPreviewSize.getHeight(): 720\n MLog.d(TAG, \"setupCameraOutputs()\" +\n \" mPreviewSize.getWidth(): \" + mPreviewSize.getWidth() +\n \" mPreviewSize.getHeight(): \" + mPreviewSize.getHeight());\n\n // We fit the aspect ratio of TextureView to the size of preview we picked.\n int orientation = getResources().getConfiguration().orientation;\n // 横屏\n if (orientation == Configuration.ORIENTATION_LANDSCAPE) {\n mTextureView.setAspectRatio(\n mPreviewSize.getWidth(), mPreviewSize.getHeight());\n } else {\n mTextureView.setAspectRatio(\n mPreviewSize.getHeight(), mPreviewSize.getWidth());\n }\n\n // Check if the flash is supported.\n Boolean available = characteristics.get(\n CameraCharacteristics.FLASH_INFO_AVAILABLE);\n mFlashSupported = available == null ? false : available;\n return;\n }\n } catch (CameraAccessException e) {\n e.printStackTrace();\n } catch (NullPointerException e) {\n // Currently an NPE is thrown when the Camera2API is used but not supported on the\n // device this code runs.\n Camera2Fragment.ErrorDialog.newInstance(getString(R.string.camera_error))\n .show(getChildFragmentManager(), FRAGMENT_DIALOG);\n }\n }", "void cameraSetup();", "public static void setCameraFrame() {\n\t\tCAMERA.src = VERTICES[CAMERA.v];\n\t\tVector zc = CAMERA.src.d.scale(-1).normalized();\n\t\tCAMERA.zAxis = zc;\n\t\tVector xc = MathUtils.cross(CAMERA.src.d, new Vector(0, 1, 0)).normalized();\n\t\tCAMERA.xAxis = xc;\n\t\tVector yc = MathUtils.cross(zc, xc).normalized();\n\t\tCAMERA.yAxis = yc;\n\t\t\n\t\tSystem.out.println(\"***** just set camera: \" + CAMERA.toString());\n\t}", "public void prepareCamera() {\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n\n autoFocusHandler = new Handler();\n mCamera = getCameraInstance();\n\n /* Instance barcode scanner */\n scanner = new ImageScanner();\n scanner.setConfig(0, Config.X_DENSITY, 3);\n scanner.setConfig(0, Config.Y_DENSITY, 3);\n\n mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);\n\n cameraPreview.addView(mPreview);\n\n }", "void setCameraIdPref(int cameraId);", "@Override\n public void setFocusParameters() {\n setCameraParameters(UPDATE_PARAM_PREFERENCE);\n }", "private void onCameraModeChangedTo(int n) {\n Camera.Parameters parameters = this.mStateMachine.getCurrentCameraParameters(false);\n if (!(parameters != null && this.isHeadUpDesplayReady())) {\n return;\n }\n int n2 = parameters.getPreviewSize().width;\n int n3 = parameters.getPreviewSize().height;\n Rect rect = LayoutDependencyResolver.getSurfaceRect((Activity)this.mActivity, (float)n2 / (float)n3);\n PositionConverter.getInstance().setSurfaceSize(rect.width(), rect.height());\n PositionConverter.getInstance().setPreviewSize(n2, n3);\n this.mFocusRectangles.updateDevicePreviewSize(n2, n3);\n this.mFocusRectangles.clearExceptTouchFocus();\n switch (n) {\n default: {\n throw new IllegalArgumentException(\"ViewFinder.onCameraModeChangedTo():[INVALID]\");\n }\n case 1: {\n super.setupCapturingModeSelectorButton(BaseFastViewFinder.HeadUpDisplaySetupState.PHOTO_STANDBY);\n super.updateViewFinderCaptureAreaTouchEventHandling(this.mTouchCapture, BaseFastViewFinder.HeadUpDisplaySetupState.PHOTO_STANDBY);\n this.mSettingDialogStack.showShortcutTray();\n super.setupZoomBar(BaseFastViewFinder.HeadUpDisplaySetupState.PHOTO_STANDBY);\n break;\n }\n case 2: {\n super.setupCapturingModeSelectorButton(BaseFastViewFinder.HeadUpDisplaySetupState.VIDEO_RECORDING);\n super.updateViewFinderCaptureAreaTouchEventHandling(this.mTouchCapture, BaseFastViewFinder.HeadUpDisplaySetupState.VIDEO_STANDBY);\n this.mSettingDialogStack.showShortcutTray();\n super.setupZoomBar(BaseFastViewFinder.HeadUpDisplaySetupState.VIDEO_STANDBY);\n }\n }\n this.setOrientation(this.getOrientation());\n }", "private void initCaptureSetting(GLSurfaceView preview, FrameLayout window, GLSurfaceView remote) {\n RTCMediaStreamingManager.init(getApplicationContext());\n\n /**\n * Step 2: find & init views\n */\n\n /**\n * Step 3: config camera settings\n */\n CameraStreamingSetting.CAMERA_FACING_ID facingId = chooseCameraFacingId();\n if (mCameraStreamingSetting == null) {\n mCameraStreamingSetting = new CameraStreamingSetting();\n }\n mCameraStreamingSetting.setCameraFacingId(facingId)\n .setContinuousFocusModeEnabled(true)\n .setRecordingHint(false)\n .setResetTouchFocusDelayInMs(3000)\n .setFocusMode(CameraStreamingSetting.FOCUS_MODE_CONTINUOUS_PICTURE)\n .setCameraPrvSizeLevel(CameraStreamingSetting.PREVIEW_SIZE_LEVEL.MEDIUM)\n .setCameraPrvSizeRatio(CameraStreamingSetting.PREVIEW_SIZE_RATIO.RATIO_16_9)\n .setBuiltInFaceBeautyEnabled(true) // Using sdk built in face beauty algorithm\n .setFaceBeautySetting(new CameraStreamingSetting.FaceBeautySetting(0.8f, 0.8f, 0.6f)) // sdk built in face beauty settings\n .setVideoFilter(CameraStreamingSetting.VIDEO_FILTER_TYPE.VIDEO_FILTER_BEAUTY); // set the beauty on/off\n mCurrentCamFacingIndex = facingId.ordinal();\n\n /**\n * Step 4: create streaming manager and set listeners\n */\n if (mRTCStreamingManager == null) {\n mRTCStreamingManager = new RTCMediaStreamingManager(getApplicationContext(),\n preview, AVCodecType.SW_VIDEO_WITH_SW_AUDIO_CODEC);\n mRTCStreamingManager.prepare(mCameraStreamingSetting, null);\n }\n mRTCStreamingManager.setConferenceStateListener(mRTCStreamingStateChangedListener);\n mRTCStreamingManager.setRemoteWindowEventListener(mRTCRemoteWindowEventListener);\n mRTCStreamingManager.setUserEventListener(mRTCUserEventListener);\n mRTCStreamingManager.setDebugLoggingEnabled(false);\n mRTCStreamingManager.mute(true);\n\n /**\n * Step 5: set conference options\n */\n RTCConferenceOptions confOptions = new RTCConferenceOptions();\n // vice anchor can use a smaller size\n // RATIO_4_3 & VIDEO_ENCODING_SIZE_HEIGHT_240 means the output size is 320 x 240\n // 4:3 looks better in the mix frame\n confOptions.setVideoEncodingSizeRatio(RTCConferenceOptions.VIDEO_ENCODING_SIZE_RATIO.RATIO_4_3);\n confOptions.setVideoEncodingSizeLevel(RTCConferenceOptions.VIDEO_ENCODING_SIZE_HEIGHT_240);\n // vice anchor can use a higher conference bitrate for better image quality\n confOptions.setVideoBitrateRange(300 * 1000, 800 * 1000);\n // 20 fps is enough\n confOptions.setVideoEncodingFps(20);\n confOptions.setHWCodecEnabled(false);\n mRTCStreamingManager.setConferenceOptions(confOptions);\n\n /**\n * Step 6: create the remote windows\n */\n if (mRTCVideoWindow == null) {\n mRTCVideoWindow = new RTCVideoWindow(window, remote);\n\n /**\n * Step 8: add the remote windows\n */\n mRTCStreamingManager.addRemoteWindow(mRTCVideoWindow);\n }\n\n /**\n * Step 9: do prepare, anchor should config streaming profile first\n */\n StreamingProfile mStreamingProfile = new StreamingProfile();\n mStreamingProfile.setEncodingOrientation(\n isLandscape() ? StreamingProfile.ENCODING_ORIENTATION.LAND : StreamingProfile.ENCODING_ORIENTATION.PORT);\n mRTCStreamingManager.setStreamingProfile(mStreamingProfile);\n }", "protected void setupCameraAndPreview() {\n\n //\n // always release\n //\n releaseImageObjects();\n releaseVideoCapturebjects(true);\n\n // now setup...\n if (isImageButtonSelected) {\n\n //\n // Image Camera can be fetched here\n //\n if (!isBackCameraSelected) {\n mCamera = getCameraInstance(frontCamera);\n } else {\n mCamera = getCameraInstance(backCamera);\n }\n\n if (mImageCapture == null) {\n // Initiate MImageCapture\n mImageCapture = new MImageCapture(MCameraActivity.this);\n }\n\n //\n // Set Orientation\n //\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);\n // Create our Preview view and set it as the content of our activity.\n // Add the copyright as an overlay...\n if (mImageCapture.mCameraPreview == null) {\n previewView = (LinearLayout) findViewById(R.id.camera_preview);\n mImageCapture.setCameraPreview(this, mCamera);\n previewView.addView(mImageCapture.mCameraPreview);\n }\n } else {\n //\n // Set Orientation\n //\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);\n\n /** handle video here... */\n if (mVideoCapture == null) {\n // now start over\n mVideoCapture = new MVideoCapture(this);\n }\n // Create our Preview view and set it as the content of our activity.\n // Add the copyright as an overlay...\n if (mVideoCapture.mTextureView != null) {\n previewView = (LinearLayout) findViewById(R.id.camera_preview);\n previewView.addView(mVideoCapture.mTextureView);\n }\n }\n\n }", "void initFromCameraParameters(OpenCamera camera) {\n Camera.Parameters parameters = camera.getCamera().getParameters();\n WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);\n Display display = manager.getDefaultDisplay();\n\n int displayRotation = display.getRotation();\n int cwRotationFromNaturalToDisplay;\n switch (displayRotation) {\n case Surface.ROTATION_0:\n cwRotationFromNaturalToDisplay = 0;\n break;\n case Surface.ROTATION_90:\n cwRotationFromNaturalToDisplay = 90;\n break;\n case Surface.ROTATION_180:\n cwRotationFromNaturalToDisplay = 180;\n break;\n case Surface.ROTATION_270:\n cwRotationFromNaturalToDisplay = 270;\n break;\n default:\n // Have seen this return incorrect values like -90\n if (displayRotation % 90 == 0) {\n cwRotationFromNaturalToDisplay = (360 + displayRotation) % 360;\n } else {\n throw new IllegalArgumentException(\"Bad rotation: \" + displayRotation);\n }\n }\n Log.i(TAG, \"Display at: \" + cwRotationFromNaturalToDisplay);\n\n int cwRotationFromNaturalToCamera = camera.getOrientation();\n Log.i(TAG, \"Camera at: \" + cwRotationFromNaturalToCamera);\n\n // Still not 100% sure about this. But acts like we need to flip this:\n if (camera.getFacing() == CameraFacing.FRONT) {\n cwRotationFromNaturalToCamera = (360 - cwRotationFromNaturalToCamera) % 360;\n Log.i(TAG, \"Front camera overriden to: \" + cwRotationFromNaturalToCamera);\n }\n\n /*\n SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);\n String overrideRotationString;\n if (camera.getFacing() == CameraFacing.FRONT) {\n overrideRotationString = prefs.getString(PreferencesActivity.KEY_FORCE_CAMERA_ORIENTATION_FRONT, null);\n } else {\n overrideRotationString = prefs.getString(PreferencesActivity.KEY_FORCE_CAMERA_ORIENTATION, null);\n }\n if (overrideRotationString != null && !\"-\".equals(overrideRotationString)) {\n Log.i(TAG, \"Overriding camera manually to \" + overrideRotationString);\n cwRotationFromNaturalToCamera = Integer.parseInt(overrideRotationString);\n }\n */\n\n cwRotationFromDisplayToCamera =\n (360 + cwRotationFromNaturalToCamera - cwRotationFromNaturalToDisplay) % 360;\n Log.i(TAG, \"Final display orientation: \" + cwRotationFromDisplayToCamera);\n if (camera.getFacing() == CameraFacing.FRONT) {\n Log.i(TAG, \"Compensating rotation for front camera\");\n cwNeededRotation = (360 - cwRotationFromDisplayToCamera) % 360;\n } else {\n cwNeededRotation = cwRotationFromDisplayToCamera;\n }\n Log.i(TAG, \"Clockwise rotation from display to camera: \" + cwNeededRotation);\n\n Point theScreenResolution = new Point();\n display.getSize(theScreenResolution);\n screenResolution = theScreenResolution;\n Log.i(TAG, \"Screen resolution in current orientation: \" + screenResolution);\n cameraResolution = CameraConfigurationUtils.findBestPreviewSizeValue(parameters, screenResolution);\n Log.i(TAG, \"Camera resolution: \" + cameraResolution);\n bestPreviewSize = CameraConfigurationUtils.findBestPreviewSizeValue(parameters, screenResolution);\n Log.i(TAG, \"Best available preview size: \" + bestPreviewSize);\n\n boolean isScreenPortrait = screenResolution.x < screenResolution.y;\n boolean isPreviewSizePortrait = bestPreviewSize.x < bestPreviewSize.y;\n\n if (isScreenPortrait == isPreviewSizePortrait) {\n previewSizeOnScreen = bestPreviewSize;\n } else {\n previewSizeOnScreen = new Point(bestPreviewSize.y, bestPreviewSize.x);\n }\n Log.i(TAG, \"Preview size on screen: \" + previewSizeOnScreen);\n }", "public void readCameraInitialParameters() {\n if (this.mCameraDevice != null) {\n int maxEvo = this.mCameraDevice.getCapabilities().getMaxExposureCompensation();\n int minEvo = this.mCameraDevice.getCapabilities().getMinExposureCompensation();\n Log.w(TAG, String.format(\"max Evo is %d and min Evo is %d\", new Object[]{Integer.valueOf(maxEvo), Integer.valueOf(minEvo)}));\n this.mUI.parseEvoBound(maxEvo, minEvo);\n initializeFocusModeSettings();\n }\n }", "private void initPreview(int width, int height) {\n if (camera!=null && previewHolder.getSurface()!=null) {\n try {\n camera.setPreviewDisplay(previewHolder);\n }\n catch (Throwable t) {\n Log.e(\"PreviewDemo-surfaceCallback\",\n \"ExceptionsetPreviewDisplay()\", t);\n // Toast.makeText(PreviewDemo.this, t.getMessage(), Toast.LENGTH_LONG).show();\n }\n\n if (!cameraConfigured) {\n Camera.Parameters parameters=camera.getParameters();\n Camera.Size size=getBestPreviewSize(width, height,\n parameters);\n\n if (size!=null) {\n parameters.setPreviewSize(size.width, size.height);\n camera.setParameters(parameters);\n cameraConfigured=true;\n }\n }\n }\n }", "public void setCameraPreviewSize(int width, int height) {\n Log.d(TAG, \"setCameraPreviewSize\");\n mIncomingWidth = width;\n mIncomingHeight = height;\n mIncomingSizeUpdated = true;\n }", "public static void initialCameraPictureSize(\n Context context, Parameters parameters, int currentCameraId) {\n // When launching the camera app first time, we will set the picture\n // size to the first one in the list defined in \"arrays.xml\" and is also\n // supported by the driver.\n List<Size> supported = parameters.getSupportedPictureSizes();\n if (supported == null) return;\n //BEGIN: Added by zhanghongxing at 2013-01-09 for full preview\n int backCameraId = CameraHolder.instance().getBackCameraId();\n String defaultStr = null;\n String[] candidateArray = null;\n if (currentCameraId == backCameraId) {\n// defaultStr = context.getString(R.string.pref_back_camera_picturesize_default);\n candidateArray = context.getResources().getStringArray(\n R.array.pref_camera_picturesize_entryvalues);\n defaultStr = SystemProperties.get(BACK_CAMERA_DEFAULT_PICTURE_SIZE_VALUE,\"\");\n } else {\n //BEGIN: Modified by zhanghongxing at 2013-04-09 for FBD-96/97\n // defaultStr = null;\n// defaultStr = context.getString(R.string.pref_front_camera_picturesize_default);\n candidateArray = context.getResources().getStringArray(\n R.array.pref_front_camera_picturesize_entryvalues);\n defaultStr = SystemProperties.get(FRONT_CAMERA_DEFAULT_PICTURE_SIZE_VALUE,\"\");\n //END: Modified by zhanghongxing at 2013-04-09 for FBD-96/97\n }\n\n //END: Added by zhanghongxing at 2013-01-09\n for (String candidate : candidateArray) {\n if (setCameraPictureSize(candidate, supported, parameters)) {\n if (defaultStr == null || defaultStr.length() < 1) {\n SharedPreferences.Editor editor = ComboPreferences\n .get(context).edit();\n editor.putString(KEY_PICTURE_SIZE, candidate);\n editor.apply();\n return;\n } else {\n if (candidate.equals(defaultStr)) {\n SharedPreferences.Editor editor = ComboPreferences\n .get(context).edit();\n editor.putString(KEY_PICTURE_SIZE, candidate);\n editor.apply();\n return;\n }\n }\n //END: Modified by zhanghongxing at 2013-01-09\n }\n }\n Log.e(TAG, \"No supported picture size found\");\n }", "public void onCreateCameraPipeline(com.arashivision.onestream.pipeline.ICameraPreviewPipeline r20) {\n /*\n r19 = this;\n r0 = r19\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"onCreateCameraPipeline\"\n r1.d(r2)\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n r2 = r20\n r1.f73l = r2\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r1 = r1.IL1Iii\n com.arashivision.insta360.basemedia.model.FileType r1 = r1.getFileType()\n com.arashivision.insta360.basemedia.model.FileType r2 = com.arashivision.insta360.basemedia.model.FileType.FISH_EYE\n r3 = 1\n r4 = 0\n if (r1 != r2) goto L_0x0059\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r1 = r1.IL1Iii\n com.arashivision.insta360.basemedia.model.viewconstraint.Constraint r1 = r1.getConstraint()\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r2 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.capture.ICaptureParams r2 = r2.IL1Iii\n int[] r2 = r2.getConstraintRatio()\n if (r1 == 0) goto L_0x0059\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r5 = r0.f577a\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r6 = r5.I11L\n float r5 = r1.getDefaultDistance()\n double r9 = (double) r5\n float r5 = r1.getDefaultFov()\n double r11 = (double) r5\n r5 = r2[r3]\n float r5 = (float) r5\n r2 = r2[r4]\n float r2 = (float) r2\n float r5 = r5 / r2\n double r13 = (double) r5\n float r2 = r1.getXScale()\n double r7 = (double) r2\n float r1 = r1.getYScale()\n double r1 = (double) r1\n r15 = 4607182418800017408(0x3ff0000000000000, double:1.0)\n r17 = r7\n r7 = r15\n r15 = r17\n r17 = r1\n r6.setGyroStabilizerFovDistance2(r7, r9, r11, r13, r15, r17)\n L_0x0059:\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n r1.setLoading(r4)\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n if (r1 == 0) goto L_0x00cf\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r2 = r1.ILil\n if (r2 == 0) goto L_0x006d\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r2 = r2.getCameraRenderSurfaceInfo()\n if (r2 == 0) goto L_0x006d\n r4 = r3\n L_0x006d:\n if (r4 != 0) goto L_0x0077\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Custom surface is null\"\n L_0x0073:\n r1.e(r2)\n goto L_0x00c5\n L_0x0077:\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r2 = r1.I11L\n if (r2 != 0) goto L_0x0080\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Render is null\"\n goto L_0x0073\n L_0x0080:\n boolean r2 = r1.llliI\n if (r2 == 0) goto L_0x0089\n com.arashivision.insta360.basemedia.log.MediaLogger r1 = com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView.LL1IL\n java.lang.String r2 = \"startCameraRenderSurface return. Already render surface\"\n goto L_0x0073\n L_0x0089:\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender$CameraRenderSurfaceInfo r2 = new com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender$CameraRenderSurfaceInfo\n r2.<init>()\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n int r4 = r4.renderWidth\n r2.renderWidth = r4\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n int r4 = r4.renderHeight\n r2.renderHeight = r4\n a.a.a.a.e.a.e.l r4 = r1.f60IL\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r5 = r1.ILil\n int r5 = r5.getRenderModelType()\n com.arashivision.graphicpath.render.rendermodel.RenderModelType r4 = r4.a(r5)\n int r4 = r4.getType()\n r2.renderModeType = r4\n com.arashivision.insta360.basemedia.ui.player.capture.IPlayCaptureParams r4 = r1.ILil\n com.arashivision.insta360.basemedia.ui.player.capture.CameraRenderSurfaceInfo r4 = r4.getCameraRenderSurfaceInfo()\n android.view.Surface r4 = r4.mSurface\n r2.mSurface = r4\n com.arashivision.arvbmg.previewer.BMGCameraPreviewerSessionRender r4 = r1.I11L\n r4.startCameraRenderSurface(r2)\n r1.llliI = r3\n L_0x00c5:\n com.arashivision.insta360.basemedia.ui.player.capture.CapturePlayerView r1 = r0.f577a\n com.arashivision.insta360.basemedia.ui.player.listener.IBasePlayerViewListener r1 = r1.f741\n if (r1 == 0) goto L_0x00ce\n r1.onLoadingFinish()\n L_0x00ce:\n return\n L_0x00cf:\n r1 = 0\n throw r1\n */\n throw new UnsupportedOperationException(\"Method not decompiled: a.a.a.a.e.a.f.h.onCreateCameraPipeline(com.arashivision.onestream.pipeline.ICameraPreviewPipeline):void\");\n }", "RokidCamera(RokidCameraBuilder rokidCameraBuilder) {\n this(rokidCameraBuilder.getActivity(), rokidCameraBuilder.getTextureView());\n this.mRokidCameraStateListener = rokidCameraBuilder.getRokidCameraStateListener();\n this.mRokidCameraIOListener = rokidCameraBuilder.getRokidCameraIOListener();\n this.mRokidCameraRecordingListener = rokidCameraBuilder.getRokidCameraRecordingListener();\n this.mRokidCameraOnImageAvailableListener = rokidCameraBuilder.getRokidCameraOnImageAvailableListener();\n this.mImageReaderCallbackMode = rokidCameraBuilder.getImageReaderCallbackMode();\n this.mPreviewEnabled = rokidCameraBuilder.isPreviewEnabled();\n this.mImageFormat = rokidCameraBuilder.getImageFormat();\n this.mMaxImages = rokidCameraBuilder.getMaxImages();\n this.mSizePreview = rokidCameraBuilder.getRokidCameraSizePreview();\n this.mSizeImageReader = rokidCameraBuilder.getRokidCameraSizeImageReader();\n this.mSizeVideoRecorder = rokidCameraBuilder.getRokidCameraSizeVideoRecorder();\n this.mRokidCameraParamAFMode = rokidCameraBuilder.getRokidCameraParamAFMode();\n this.mRokidCameraParamAEMode = rokidCameraBuilder.getRokidCameraParamAEMode();\n this.mRokidCameraParamAWBMode = rokidCameraBuilder.getRokidCameraParamAWBMode();\n this.mRokidCameraParamCameraId = rokidCameraBuilder.getRokidCameraParamCameraId();\n }", "private void setCameraParameters(int updateSet) {\n if (mCameraDevice != null) {\n mParameters = mCameraDevice.getParameters();\n\n if ((updateSet & UPDATE_PARAM_INITIALIZE) != 0) {\n updateCameraParametersInitialize();\n }\n\n\n if ((updateSet & UPDATE_PARAM_PREFERENCE) != 0) {\n updateCameraParametersPreference();\n mIsAutoFocusCallback = false;\n }\n\n if (mParameters != null)\n mCameraDevice.setParameters(mParameters);\n }\n }", "protected void createCameraPreview() {\n try {\n SurfaceTexture texture = mCameraTextureView.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mImageDimension.getWidth(), mImageDimension.getHeight());\n Surface surface = new Surface(texture);\n mCaptureRequestBuilder = mCameraDevice.\n createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n mCaptureRequestBuilder.addTarget(surface);\n mCameraDevice.createCaptureSession(Collections.singletonList(surface),\n new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n //The camera is already closed\n if (null == mCameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n mCameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n Toast.makeText(CameraActivity.this, \"Configuration change\",\n Toast.LENGTH_SHORT).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "protected void createCameraPreview() {\n try {\n SurfaceTexture texture = textureView.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(imageDimension.getWidth(), imageDimension.getHeight());\n Surface surface = new Surface(texture);\n captureRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n captureRequestBuilder.addTarget(surface);\n cameraDevice.createCaptureSession(Collections.singletonList(surface), new CameraCaptureSession.StateCallback(){\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == cameraDevice) {\n return;\n }\n cameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n Toast.makeText(MainActivity.this, \"Configuration change\", Toast.LENGTH_SHORT).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n Toast.makeText(MainActivity.this, \"Camera Surface failed to load.\", Toast.LENGTH_SHORT).show();\n e.printStackTrace();\n }\n }", "public void setCameraSettings(CameraSettings cameraSettings) {\n this.cameraSettings = cameraSettings;\n }", "public void setCaptureMode(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat);", "void initializeCamera() {\n camera_linear = (LinearLayout) findViewById(R.id.camera_linear);\n //The preview frame is overlayed on the layout which shows the camera view.\n preview = (FrameLayout) findViewById(R.id.camera_preview);\n //Get an instance of the phone's camera.\n mCamera = cameraRecorder.getCameraInstance();\n //Find content fort the camera preview frame using the instance of the camera initialized.\n mPreview = new CameraPreview(getApplicationContext(), mCamera);\n //Apply the camera previes content from the camera to the preview frame itself.\n preview.addView(mPreview);\n }", "public interface CameraPreview {\n\n /**\n * Set the camera system this will act as the preview for.\n * <p/>\n * The preview will update the camera system as necessary for certain events, such as\n * setting the surface holder, or pausing/restarting the preview when reconfiguring the surface.\n *\n * @param cameraSystem the camera system to connect to\n */\n void connectToCameraSystem(@NonNull CameraSystem cameraSystem);\n\n}", "@Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == mCameraDevice) {\n return;\n }\n // Auto focus should be continuous for camera preview.\n mCaptureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,\n CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);\n\n // Finally, we start displaying the camera preview.\n mPreviewRequest = mCaptureRequestBuilder.build();\n mPreviewCaptureSession = cameraCaptureSession;\n\n // preview is a video, so we set a repeating request\n try {\n mPreviewCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), mPreviewCaptureCallback, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String cameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);\n StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n imageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION);\n return;\n }\n manager.openCamera(cameraId, stateCallback, null);\n } catch (CameraAccessException e) {\n Toast.makeText(this, \"Camera failed to open.\", Toast.LENGTH_SHORT).show();\n e.printStackTrace();\n }\n }", "private void getCamera() {\n if (camera == null) {\n try {\n camera = Camera.open();\n params = camera.getParameters();\n } catch (RuntimeException e) {\n\n }\n }\n }", "private void createCamera() {\n camera = getCameraInstance();\n // Setting the right parameters in the camera\n SetCameraParameters();\n // Create our Preview view and set it as the content of our activity.\n camera_preview = new CameraPreview(this, camera);\n // Adding the camera preview after the FrameLayout and before the mainact_btn_InOutAct\n // as a separated element.\n InOut_cameraLayout.addView(camera_preview, 0);\n }", "public void surfaceCreated(SurfaceHolder holder) {\n try {\n \tCamera.Parameters parameters = getOptimalPreviewSize(mCamera);\n \t\n \tthis.setLayoutParams(getLayoutParams(parameters.getPreviewSize()));\n \n parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);\n \n parameters.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO);\n \n parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);\n\n mCamera.setDisplayOrientation(90);\n \n mCamera.setParameters(parameters);\n mCamera.setPreviewDisplay(holder);\n mCamera.startPreview();\n } catch (IOException e) {\n Log.d(\"CameraView\", \"Error setting camera preview: \" + e.getMessage());\n }\n }", "public void updateParametersSceneMode() {\n Stringifier stringifier = this.mCameraCapabilities.getStringifier();\n SettingsManager settingsManager = this.mActivity.getSettingsManager();\n this.mSceneMode = stringifier.sceneModeFromString(settingsManager.getString(this.mAppController.getCameraScope(), Keys.KEY_SCENE_MODE));\n if (Keys.isHdrOn(settingsManager) && !isCameraFrontFacing() && isHdrShow()) {\n if (this.mSceneMode != SceneMode.HDR) {\n this.mSceneMode = SceneMode.HDR;\n settingsManager.set(this.mAppController.getCameraScope(), Keys.KEY_SCENE_MODE, this.mCameraCapabilities.getStringifier().stringify(this.mSceneMode));\n }\n } else if (this.mSceneMode == SceneMode.HDR) {\n this.mSceneMode = SceneMode.AUTO;\n settingsManager.set(this.mAppController.getCameraScope(), Keys.KEY_SCENE_MODE, this.mCameraCapabilities.getStringifier().stringify(this.mSceneMode));\n }\n if (!this.mCameraCapabilities.supports(this.mSceneMode)) {\n this.mSceneMode = this.mCameraSettings.getCurrentSceneMode();\n if (this.mSceneMode == null) {\n this.mSceneMode = SceneMode.AUTO;\n }\n } else if (this.mCameraSettings.getCurrentSceneMode() != this.mSceneMode) {\n this.mCameraSettings.setSceneMode(this.mSceneMode);\n if (this.mCameraDevice != null) {\n this.mCameraDevice.applySettings(this.mCameraSettings);\n this.mCameraSettings = this.mCameraDevice.getSettings();\n }\n }\n this.mCameraSettings.setSceneMode(this.mSceneMode);\n updateParametersFlashMode();\n if (SceneMode.AUTO == this.mSceneMode) {\n updateParametersFocusMode();\n } else {\n this.mFocusManager.overrideFocusMode(this.mCameraSettings.getCurrentFocusMode());\n }\n }", "@Override\n public void onCameraViewStarted(int width, int height) {\n mRgba = new Mat(height, width, CvType.CV_8UC4);\n mRgbaF = new Mat(width, height, CvType.CV_8UC4);\n mRgbaT = new Mat(width, height, CvType.CV_8UC4);\n Log.i(TAG, \"height : \" + height);\n Log.i(TAG, \"width : \" + width);\n //Log.i(TAG, \"mOpenCvCameraView size (w,h):\" + mOpenCvCameraView.getWidth() + \" - \" + mOpenCvCameraView.getHeight());\n }", "public void setCamera(Camera camera) {\r\n\t\tthis.camera = camera;\r\n\t}", "@Override\n\tpublic EngineOptions onCreateEngineOptions() {\n\t\t\n\t\t// Device properties & dimensions\n\t\tDisplay display = getWindowManager().getDefaultDisplay();\n\t\tPoint size = new Point();\n\t\tdisplay.getSize(size);\n\t\tint width = size.x;\n\t\tint height = size.y;\n\t\t\n\t\tCAMERA_WIDTH = width;\n\t\tCAMERA_HEIGHT = height;\n\t\t\n\t\tfinal Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);\n\n\t\treturn new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);\n\t}", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String mCameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraId);\n StreamConfigurationMap map = characteristics.\n get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n mImageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) !=\n PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE) !=\n PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(CameraActivity.this, new\n String[]{Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CAMERA_PERMISSION);\n }\n manager.openCamera(mCameraId, mStateCallback, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public void setCamera(Camera camera) {\n mCamera = camera;\n }", "protected void updatePreview() {\n if (null == mCameraDevice) {\n Toast.makeText(CameraActivity.this, \"Couldn't find Camera\", Toast.LENGTH_SHORT).show();\n }\n mCaptureRequestBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);\n try {\n mCameraCaptureSessions.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "int getCameraIdPref();", "public void nextCameraMode() {\n cameraMode = cameraMode.next();\n setCameraControlMode(cameraMode);\n }", "public static void setRecorderVideoSize(Size size){\n\t}", "public void setupCamera() {\r\n p.camera(width/2.0f, height/2.0f, cameraZ,\r\n width/2.0f, height/2.0f, 0, 0, 1, 0);\r\n\r\n if(isTiling) {\r\n float mod=1f/10f;\r\n p.frustum(width*((float)tileX/(float)tileNum-.5f)*mod,\r\n width*((tileX+1)/(float)tileNum-.5f)*mod,\r\n height*((float)tileY/(float)tileNum-.5f)*mod,\r\n height*((tileY+1)/(float)tileNum-.5f)*mod,\r\n cameraZ*mod, 10000);\r\n }\r\n\r\n }", "public void updateParametersFocusMode() {\n this.mFocusManager.overrideFocusMode(getOverrideFocusMode());\n this.mCameraSettings.setFocusMode(this.mFocusManager.getFocusMode(this.mCameraSettings.getCurrentFocusMode()));\n }", "public interface CameraSetting {\n}", "private void initCameraPreview() {\n\t\tcameraPreview = (CameraPreview) findViewById(R.id.camera_preview);\n\t\tcameraPreview.init(camera);\n\t}", "public interface ICamera {\n\n /**\n * Return frame access interface for client usage\n *\n * @param interface_index\n * @return\n */\n public long getFrameAccessIfc(int interface_index);\n\n /**\n * Start the camera stream\n */\n public void start();\n\n /**\n * Stop the camera stream\n */\n public void stop();\n\n public String prepare(final UsbMonitor.UsbConnectionData connectionData);\n\n /**\n * Register json status callback\n *\n * @param callback\n */\n public void setStatusCallback(final IStatusCallback callback);\n\n /**\n * Queries camera for supported mode\n *\n * @return supported video modes String\n */\n public String getSupportedVideoModes();\n\n// /**\n// * Select camera capture mode\n// *\n// * @param width\n// * @param height\n// * @param frameFormat\n// */\n// public void setCaptureMode(final int width, final int height, final int frameFormat);\n\n /**\n * Select camera capture mode\n *\n * @param width\n * @param height\n * @param min_fps\n * @param max_fps\n * @param frameFormat\n */\n public void setCaptureMode(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat);\n}", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "public void surfaceCreated(SurfaceHolder holder) {\n Log.i(TAG, \"surface created\");\n if (mCamera != null) {\n final Camera.Parameters params = mCamera.getParameters();\n final List<Camera.Size> sizes = params.getSupportedPreviewSizes();\n final int screenWidth = ((View) getParent()).getWidth();\n int minDiff = Integer.MAX_VALUE;\n Camera.Size bestSize = null;\n\n /*\n * Impostazione dimensione frame a seconda delle dimensioni ottimali e dell'orientamento\n */\n if (getResources().getConfiguration().orientation\n == Configuration.ORIENTATION_LANDSCAPE) {\n for (Camera.Size size : sizes) {\n final int diff = Math.abs(size.width - screenWidth);\n if (diff < minDiff) {\n minDiff = diff;\n bestSize = size;\n }\n }\n } else {\n mCamera.setDisplayOrientation(90);\n for (Camera.Size size : sizes) {\n final int diff = Math.abs(size.height - screenWidth);\n if (Math.abs(size.height - screenWidth) < minDiff) {\n minDiff = diff;\n bestSize = size;\n }\n }\n }\n\n final int previewWidth = bestSize.width;\n final int previewHeight = bestSize.height;\n mHeight = previewHeight;\n mWidth = previewWidth;\n\n ViewGroup.LayoutParams layoutParams = getLayoutParams();\n layoutParams.height = previewHeight;\n layoutParams.width = previewWidth;\n setLayoutParams(layoutParams);\n\n // FORMATO PREVIEW\n params.setPreviewFormat(ImageFormat.NV21);\n params.setPreviewSize(previewWidth, previewHeight);\n params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\n\n mCamera.setParameters(params);\n\n //buffer di uscita\n int size = previewWidth * previewHeight *\n ImageFormat.getBitsPerPixel(params.getPreviewFormat()) / 8;\n setupCallback(size);\n\n // Esecuzione preview\n try {\n mCamera.setPreviewDisplay(holder);\n mCamera.startPreview();\n Log.i(TAG, \"preview started\");\n } catch (IOException e) {\n Log.e(TAG, \"Error setting camera preview: \" + e.getMessage());\n }\n\n }\n }", "public interface CameraDescriptor {\n /**\n * @return The possible preview sizes for the camera, in no\n * particular order\n */\n ArrayList<Size> getPreviewSizes();\n\n /**\n * @return The possible picture sizes for the camera, in no\n * particular order\n */\n ArrayList<Size> getPictureSizes();\n\n /**\n * Indicates if the camera (and this library) supports a\n * particular image format for pictures.\n *\n * @param format an ImageFormat value (e.g., ImageFormat.JPEG)\n * @return true if supported, false otherwise\n */\n boolean isPictureFormatSupported(int format);\n}", "private Parameters setSize(Parameters parameters) {\n\n\t\tLog.d(\"<<picture>>\", \"W:\"+parameters.getPictureSize().width+\"H:\"+parameters.getPictureSize().height);\n\t\tLog.d(\"<<preview>>\", \"W:\"+parameters.getPreviewSize().width+\"H:\"+parameters.getPreviewSize().height);\n\n\t\tint tempWidth = parameters.getPictureSize().width;\n\t\tint tempHeight = parameters.getPictureSize().height;\n\t\tint Result = 0;\n\t\tint Result2 = 0;\n\t\tint picSum = 0;\n\t\tint picSum2 = 0;\n\t\tint soin = 2;\n\n\t\twhile(tempWidth >= soin && tempHeight >= soin){\n\t\t\tResult = tempWidth%soin;\n\t\t\tResult2 = tempHeight%soin;\n\t\t\tif(Result == 0 && Result2 == 0){\n\t\t\t\tpicSum = tempWidth/soin;\n\t\t\t\tpicSum2 = tempHeight/soin;\n\t\t\t\tSystem.out.println(\"PictureWidth :\"+tempWidth+\"/\"+soin+\"���:\"+picSum+\"������:\"+Result);\n\t\t\t\tSystem.out.println(\"PictureHeight :\"+tempHeight+\"/\"+soin+\"���:\"+picSum2+\"������:\"+Result2);\n\t\t\t\ttempWidth = picSum;\n\t\t\t\ttempHeight = picSum2;\n\t\t\t}else {\n\t\t\t\tsoin++;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(\"������� \"+picSum+\":\"+picSum2);\n\n\t\tList<Camera.Size> previewSizeList = parameters.getSupportedPreviewSizes();\n\t\tfor (Size size : previewSizeList){\n\t\t\ttempWidth = size.width;\n\t\t\ttempHeight = size.height;\n\t\t\tResult = 0;\n\t\t\tResult2 = 0;\n\t\t\tint preSum = 0;\n\t\t\tint preSum2 = 0;\n\t\t\tsoin = 2;\n\n\t\t\twhile(tempWidth >= soin && tempHeight >= soin){\n\t\t\t\tResult = tempWidth%soin;\n\t\t\t\tResult2 = tempHeight%soin;\n\t\t\t\tif(Result == 0 && Result2 == 0){\n\t\t\t\t\tpreSum = tempWidth/soin;\n\t\t\t\t\tpreSum2 = tempHeight/soin;\n\t\t\t\t\tSystem.out.println(\"PreviewWidth :\"+tempWidth+\"/\"+soin+\"���:\"+preSum+\"������:\"+Result);\n\t\t\t\t\tSystem.out.println(\"PreviewHeight :\"+tempHeight+\"/\"+soin+\"���:\"+preSum2+\"������:\"+Result2);\n\t\t\t\t\ttempWidth = preSum;\n\t\t\t\t\ttempHeight = preSum2;\n\t\t\t\t}else {\n\t\t\t\t\tsoin++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tSystem.out.println(\"������� \"+preSum+\":\"+preSum2);\n\t\t\tif(picSum == preSum && picSum2 == preSum2){\n\t\t\t\tparameters.setPreviewSize(size.width, size.height);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn parameters;\n\t}", "public void setCameraParameters(int updateSet) {\n if ((updateSet & 1) != 0) {\n updateCameraParametersInitialize();\n }\n if ((updateSet & 2) != 0) {\n updateCameraParametersZoom();\n }\n if ((updateSet & 4) != 0) {\n updateCameraParametersPreference();\n }\n if ((updateSet & 8) != 0) {\n updateVisidionMode();\n }\n if (this.mCameraDevice != null) {\n this.mCameraDevice.applySettings(this.mCameraSettings);\n }\n }", "Camera getCamera();", "public CameraSet(Controls controls, String devpath1, String devpath2) {\n this.controls = controls;\n this.cam1 = CameraServer.getInstance().startAutomaticCapture(\"Back\", devpath2);\n this.cam2 = CameraServer.getInstance().startAutomaticCapture(\"Front\", devpath1);\n\n// cam1.setResolution((int) (this.multiplier * 160), (int) (this.multiplier * 120));\n// cam2.setResolution((int) (this.multiplier * 160), (int) (this.multiplier * 120));\n\n outputStream = CameraServer.getInstance().putVideo(\"camera_set\", (int) (multiplier * 160), (int) (multiplier * 120));\n source = new Mat();\n\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n createCameraPreview();\n }", "public void setAutoFocus() {\n \tCamera.Parameters params = mCamera.getParameters();\n \tList<String> focusModes = params.getSupportedFocusModes();\n \tif (focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {\n \t\tparams.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\n \t\tmCamera.setParameters(params);\n \t}\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "public void setCameraPreview(CameraPreview cameraPreview) {\n mCameraPreview = cameraPreview;\n }", "protected void startPreview() {\n if (null == mCameraDevice || !mTextureView.isAvailable()) {\n return;\n }\n try {\n //\n // Media Recorder\n //\n setUpMediaRecorder();\n\n //\n // Preview Builder - Video Recording\n //\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n\n //\n // Surfaces: Preview and Record\n //\n List<Surface> surfaces = new ArrayList<>();\n\n //\n // Preview Surface\n //\n SurfaceTexture texture = mTextureView.getSurfaceTexture();\n texture.setDefaultBufferSize(screenWidth, screenHeight);\n Surface previewSurface = new Surface(texture);\n surfaces.add(previewSurface);\n mPreviewBuilder.addTarget(previewSurface);\n\n\n //\n // Record Surface\n //\n Surface recorderSurface = mMediaRecorder.getSurface();\n surfaces.add(recorderSurface);\n mPreviewBuilder.addTarget(recorderSurface);\n\n //\n // Setup Capture Session\n //\n mCameraDevice.createCaptureSession(surfaces, new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n Log.e(TAG, \"onConfigured(CameraCaptureSession cameraCaptureSession) ...\");\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onSurfacePrepared(CameraCaptureSession session, Surface surface) {\n Log.e(TAG, \"onSurfacePrepared(CameraCaptureSession session, Surface surface) ...\");\n //previewView = (LinearLayout) findViewById(R.id.camera_preview);\n //previewView.addView(mVideoCapture.mTextureView);\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n Log.e(TAG, \"onConfigureFailed(CameraCaptureSession cameraCaptureSession) ...\");\n Toast.makeText(mCameraActivity, \"failed to configure video camera\", Toast.LENGTH_SHORT).show();\n onBackPressed();\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@Override\n public void onFinish() {\n if (camera == null)\n return;\n\n Camera.Parameters parameters = camera.getParameters();\n parameters.setFocusAreas(null);\n if (supportedFocusModes == null)\n supportedFocusModes = getSupportedFocusModes(parameters);\n if (supportedFocusModes.get(FOCUS_CONTINUOUS_PICTURE)) {\n parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);\n } else if (supportedFocusModes.get(FOCUS_CONTINUOUS_VIDEO)) {\n parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\n }\n camera.setParameters(parameters);\n }", "private void setCamera() {\n\t\tVector viewTranslation = controller.getCameraPosition();\n\n\t\tGL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);\n\t\tGL11.glMatrixMode(GL11.GL_PROJECTION);\n\t\tGL11.glLoadIdentity();\n\n\t\tfloat whRatio = (float) windowWidth / (float) windowHeight;\n\t\tGLU.gluPerspective(controller.getFOV(), whRatio, 1, 100000);\n\t\tGLU.gluLookAt((float) viewTranslation.x, (float) viewTranslation.y,\n\t\t\t\t(float) controller.getCameraDistance(), (float) viewTranslation.x,\n\t\t\t\t(float) viewTranslation.y, 0, 0, 1, 0);\n\n\t\tGL11.glMatrixMode(GL11.GL_MODELVIEW);\n\t\tGL11.glLoadIdentity();\n\t}", "public static void initialCameraPictureSize(\n Context context, Parameters parameters) {\n List<Size> supported = parameters.getSupportedPictureSizes();\n if (supported == null) return;\n for (String candidate : context.getResources().getStringArray(\n R.array.pref_camera_picturesize_entryvalues)) {\n if (setCameraPictureSize(candidate, supported, parameters)) {\n SharedPreferences.Editor editor = UserPreferences.get(context).edit();\n editor.putString(KEY_PICTURE_SIZE, candidate);\n editor.apply();\n return;\n }\n }\n Log.e(CameraActivity.TAG, \"No supported picture size found\");\n }", "@Override\r\n\tpublic void surfaceChanged(SurfaceHolder holder, int format, int width,\r\n\t\t\tint height) {\n\t\tif(myCamera!=null){\r\n\t\t\tCamera.Parameters parameters = myCamera.getParameters();//得到initial參數\r\n\t\t\tmyCamera.setParameters(parameters);\r\n\t\t\tmyCamera.startPreview();\r\n\t\t}\r\n\t}", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n\tpublic void onCameraViewStarted(int width, int height) {\n\n\n\n\t\tmRgbaT = new Mat(width, height, CvType.CV_8UC4); // NOTE width,width is NOT a typo\n\n\t}", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "public void chooseCamera() {\n if (cameraFront) {\n int cameraId = findBackFacingCamera();\n if (cameraId >= 0) {\n //open the backFacingCamera\n //set a picture callback\n //refresh the preview\n\n mCamera = Camera.open(cameraId);\n setRotation(mCamera, mCamera.getParameters(), cameraId);\n // mCamera.setDisplayOrientation(90);\n mPicture = getPictureCallback();\n mPreview.refreshCamera(mCamera);\n }\n } else {\n int cameraId = findFrontFacingCamera();\n if (cameraId >= 0) {\n //open the backFacingCamera\n //set a picture callback\n //refresh the preview\n mCamera = Camera.open(cameraId);\n setRotation(mCamera, mCamera.getParameters(), cameraId);\n // mCamera.setDisplayOrientation(90);\n mPicture = getPictureCallback();\n mPreview.refreshCamera(mCamera);\n }\n }\n }", "public CameraSetting(int id,int width,int height) {\n initComponents();\n txt_id.setText(\"\"+id);\n txt_width.setText(\"\"+width);\n txt_height.setText(\"\"+height);\n }", "@Override\n public void surfaceCreated(SurfaceHolder holder)\n {\n try\n {\n if (mCamera != null)\n {\n mCamera.setPreviewDisplay(holder);\n mCamera.setDisplayOrientation(90);\n }\n }\n catch (IOException e)\n {\n Log.e(\"ProfileCamera\", \"Error setting up preview display\", e);\n }\n }", "@Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)\n {\n this.setCameraParameters(mcCamera);\n\n if (mcCamera != null)\n mcCamera.startPreview();\n }", "@SuppressLint(\"NewApi\")\n protected void startPreview() {\n if(null == mCameraDevice || !mTextureView.isAvailable() || null == mPreviewSize) {\n Log.e(TAG, \"startPreview fail, return\");\n }\n\n SurfaceTexture texture = mTextureView.getSurfaceTexture();\n if(null == texture) {\n Log.e(TAG,\"texture is null, return\");\n return;\n }\n\n texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n Surface surface = new Surface(texture);\n\n try {\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n } catch (CameraAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n mPreviewBuilder.addTarget(surface);\n\n try {\n mCameraDevice.createCaptureSession(Arrays.asList(surface), new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession session) {\n // TODO Auto-generated method stub\n mPreviewSession = session;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession session) {\n // TODO Auto-generated method stub\n Toast.makeText(mContext, \"onConfigureFailed\", Toast.LENGTH_LONG).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "public void mediaRecorderParameterFetching(MediaRecorder recorder) {\n recorder.setAudioSource(5);\n recorder.setVideoSource(1);\n recorder.setProfile(this.mProfile);\n recorder.setVideoSize(this.mProfile.videoFrameWidth, this.mProfile.videoFrameHeight);\n recorder.setMaxDuration(getOverrodeVideoDuration());\n }", "private Camera getCameraInstance() {\r\n Camera camera = null;\r\n try {\r\n camera = Camera.open();\r\n } catch (Exception e) {\r\n // cannot get camera or does not exist\r\n }\r\n Camera.Parameters params = camera.getParameters();\r\n\r\n List<Size> sizes = params.getSupportedPictureSizes();\r\n int w = 0, h = 0;\r\n for (Size size : sizes) {\r\n if (size.width > w || size.height > h) {\r\n w = size.width;\r\n h = size.height;\r\n }\r\n\r\n }\r\n params.setPictureSize(w, h);\r\n\r\n\r\n if (params.getSupportedFocusModes().contains(\r\n Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {\r\n params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\r\n }\r\n params.setPictureFormat(ImageFormat.JPEG);\r\n params.setJpegQuality(100);\r\n camera.setParameters(params);\r\n\r\n\r\n return camera;\r\n }", "public void setCamera(Camera c) {\n\t\tmCamera = c;\n\t}", "private void startPreview() {\n if (null == mCameraDevice || !mVideoPreview.isAvailable() || null == mPreviewSize) {\n return;\n }\n try {\n closePreviewSession();\n SurfaceTexture texture = mVideoPreview.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n\n Surface previewSurface = new Surface(texture);\n mPreviewBuilder.addTarget(previewSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface), new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n if (mVideoRecordListener != null) {\n mVideoRecordListener.onRecordingFailed(\"Capture session for previewing video failed.\");\n }\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "@Override\n public void onConfigured(\n CameraCaptureSession cameraCaptureSession) {\n if (null == mCameraDevice) {\n return;\n }\n\n // When the session is ready, we start displaying the preview.\n mCaptureSession = cameraCaptureSession;\n\n try {\n // 自动对焦\n // Auto focus should be continuous for camera preview.\n mPreviewRequestBuilder.set(\n CaptureRequest.CONTROL_AF_MODE,\n CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);\n\n // Flash is automatically enabled when necessary.\n setAutoFlash(mPreviewRequestBuilder);\n\n // Finally, we start displaying the camera preview.\n mPreviewRequest = mPreviewRequestBuilder.build();\n mCaptureSession.setRepeatingRequest(\n mPreviewRequest,\n // 如果想要拍照,那么绝不能设置为null\n // 如果单纯预览,那么可以设置为null\n mCaptureCallback,\n mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "@Override\r\n\tpublic void surfaceCreated(SurfaceHolder holder) \r\n\t{\n\t\t if (mCamera != null)\r\n\t\t {\r\n\t\t\t Parameters params = mCamera.getParameters();\r\n\t mCamera.setParameters(params);\r\n\t Log.i(\"Surface\", \"Created\");\r\n\t }\r\n\t\t else\r\n\t\t {\r\n\t\t\t Toast.makeText(getApplicationContext(), \"Camera not available!\",\r\n\t Toast.LENGTH_LONG).show();\r\n\r\n\t finish();\r\n\t }\r\n\t}", "public synchronized void setManualCameraId(int cameraId) {\n requestedCameraId = cameraId;\n }", "private void setCameraDisplayOrientation(Activity activity, int cameraId, Camera camera){\n Camera.CameraInfo info = new Camera.CameraInfo();\n Camera.getCameraInfo(cameraId, info);\n int degrees = getDisplayRotation(activity);\n Log.i(\"Test\", \"rotation:-->\" + degrees);\n int result;\n if(info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT){\n result = (info.orientation + degrees) % 360;\n result = (360 - result) % 360; //compensate the mirror\n }else{\n result = (info.orientation - degrees + 360) % 360;\n }\n camera.setDisplayOrientation(result);\n }", "protected void updatePreviewDisplayRotation(Size previewSize, TextureView textureView) {\n int rotationDegrees = 0;\n MCameraActivity activity = mCameraActivity;\n int displayRotation = activity.getWindowManager().getDefaultDisplay().getRotation();\n Configuration config = activity.getResources().getConfiguration();\n // Get UI display rotation\n switch (displayRotation) {\n case Surface.ROTATION_0:\n rotationDegrees = 0;\n break;\n case Surface.ROTATION_90:\n rotationDegrees = 90;\n break;\n case Surface.ROTATION_180:\n rotationDegrees = 180;\n break;\n case Surface.ROTATION_270:\n rotationDegrees = 270;\n break;\n }\n // Get device natural orientation\n int deviceOrientation = Configuration.ORIENTATION_PORTRAIT;\n if ((rotationDegrees % 180 == 0 &&\n config.orientation == Configuration.ORIENTATION_LANDSCAPE) ||\n ((rotationDegrees % 180 != 0 &&\n config.orientation == Configuration.ORIENTATION_PORTRAIT))) {\n deviceOrientation = Configuration.ORIENTATION_LANDSCAPE;\n }\n // Rotate the buffer dimensions if device orientation is portrait.\n int effectiveWidth = previewSize.getWidth();\n int effectiveHeight = previewSize.getHeight();\n if (deviceOrientation == Configuration.ORIENTATION_PORTRAIT) {\n effectiveWidth = previewSize.getHeight();\n effectiveHeight = previewSize.getWidth();\n }\n // Find and center view rect and buffer rect\n Matrix transformMatrix = textureView.getTransform(null);\n int viewWidth = textureView.getWidth();\n int viewHeight = textureView.getHeight();\n RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);\n RectF bufRect = new RectF(0, 0, effectiveWidth, effectiveHeight);\n float centerX = viewRect.centerX();\n float centerY = viewRect.centerY();\n bufRect.offset(centerX - bufRect.centerX(), centerY - bufRect.centerY());\n // Undo ScaleToFit.FILL done by the surface\n transformMatrix.setRectToRect(viewRect, bufRect, Matrix.ScaleToFit.FILL);\n // Rotate buffer contents to proper orientation\n transformMatrix.postRotate((360 - rotationDegrees) % 360, centerX, centerY);\n if ((rotationDegrees % 180) == 90) {\n int temp = effectiveWidth;\n effectiveWidth = effectiveHeight;\n effectiveHeight = temp;\n }\n // Scale to fit view, cropping the longest dimension\n float scale =\n Math.max(viewWidth / (float) effectiveWidth, viewHeight / (float) effectiveHeight);\n transformMatrix.postScale(scale, scale, centerX, centerY);\n Handler handler = new Handler(Looper.getMainLooper());\n class TransformUpdater implements Runnable {\n TextureView mView;\n Matrix mTransformMatrix;\n\n TransformUpdater(TextureView view, Matrix matrix) {\n mView = view;\n mTransformMatrix = matrix;\n }\n\n @Override\n public void run() {\n mView.setTransform(mTransformMatrix);\n }\n }\n handler.post(new TransformUpdater(textureView, transformMatrix));\n }", "public synchronized void openDriver(SurfaceHolder holder) throws IOException {\n OpenCamera theCamera = camera;\n if (theCamera == null) {\n theCamera = OpenCameraInterface.open(-1);\n if (theCamera == null) {\n throw new IOException(\"Camera.open() failed to return object from driver\");\n }\n camera = theCamera;\n }\n\n Camera cameraObject = theCamera.getCamera();\n Camera.Parameters parameters = cameraObject.getParameters();\n String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily\n try {\n setDesiredCameraParameters(theCamera, false);\n } catch (RuntimeException re) {\n // Driver failed\n Log.w(TAG, \"Camera rejected parameters. Setting only minimal safe-mode parameters\");\n Log.i(TAG, \"Resetting to saved camera params: \" + parametersFlattened);\n // Reset:\n if (parametersFlattened != null) {\n parameters = cameraObject.getParameters();\n parameters.unflatten(parametersFlattened);\n try {\n cameraObject.setParameters(parameters);\n setDesiredCameraParameters(theCamera, true);\n } catch (RuntimeException re2) {\n // Well, darn. Give up\n Log.w(TAG, \"Camera rejected even safe-mode parameters! No configuration\");\n }\n }\n }\n cameraObject.setPreviewDisplay(holder);\n previewCallback = new PreviewCallback(previewSize);\n }", "@Override\r\n\tpublic EngineOptions onCreateEngineOptions() {\r\n\t\tmCamera = new Camera(0, 0, WIDTH, HEIGHT);\r\n\t\t\r\n\t\tEngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), mCamera);\r\n\t\t\r\n\t\tengineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);\r\n\t\t\r\n\t\tmEngine = new FixedStepEngine(engineOptions, 60);\r\n\t\t\r\n\t\treturn engineOptions;\r\n\t}", "@Override\n protected void onStart() {\n camera_ = getCameraInstance();\n Parameters params;\n\n if (camera_ != null) {\n params = camera_.getParameters();\n params.setPreviewFormat(ImageFormat.NV21);\n getSmallestPreviewSize(params);\n params.setPreviewSize(width_, height_);\n //params.setFlashMode(Parameters.FLASH_MODE_TORCH);\n params.setWhiteBalance(Parameters.WHITE_BALANCE_AUTO);\n camera_.setParameters(params);\n\n frame_ = new RGB[width_ * height_];\n for (int i = 0; i < frame_.length; ++i) {\n frame_[i] = new RGB();\n }\n\n camera_.setPreviewCallback(new PreviewCallback() {\n @Override\n public void onPreviewFrame(byte[] data, Camera camera) {\n synchronized (frame_) {\n decodeYUV420SP(frame_, data, width_, height_);\n }\n }\n });\n SurfaceTexture texture_ = new SurfaceTexture(0);\n try {\n camera_.setPreviewTexture(texture_);\n } catch (IOException e) {\n e.printStackTrace();\n }\n camera_.startPreview();\n }\n\n super.onStart();\n }", "private void sendVideoRecordingRequest() {\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n assert surfaceTexture != null;\n surfaceTexture.setDefaultBufferSize(mSizePreview.getSize().getWidth(), mSizePreview.getSize().getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n\n try {\n\n // create request for RECORDING template\n /**\n * Create a request suitable for video recording. Specifically, this means\n * that a stable frame rate is used, and post-processing is set for\n * recording quality. These requests would commonly be used with the\n * {@link CameraCaptureSession#setRepeatingRequest} method.\n * This template is guaranteed to be supported on all camera devices except\n * {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT DEPTH_OUTPUT} devices\n * that are not {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE\n * BACKWARD_COMPATIBLE}.\n *\n * @see #createCaptureRequest\n */\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n configureCameraParameters(mCaptureRequestBuilder, mRokidCameraParamAEMode, mRokidCameraParamAFMode, mRokidCameraParamAWBMode);\n\n if (mPreviewEnabled) {\n // add Preview surface to target\n mCaptureRequestBuilder.addTarget(previewSurface);\n }\n\n // add Record surface to target\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface), new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n try {\n cameraCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }" ]
[ "0.7505181", "0.74905276", "0.742294", "0.7409308", "0.730329", "0.7153478", "0.7116762", "0.7086943", "0.69136405", "0.6888323", "0.6864784", "0.68547195", "0.6840804", "0.6831018", "0.68237215", "0.6800759", "0.6716201", "0.66801745", "0.66774946", "0.6575431", "0.6558298", "0.65244937", "0.6486195", "0.64662766", "0.64659154", "0.6445546", "0.63954717", "0.63948745", "0.63897324", "0.63752073", "0.6348361", "0.6329104", "0.6313804", "0.6270507", "0.62654084", "0.6229167", "0.6218602", "0.6171509", "0.61512", "0.6150592", "0.6128216", "0.611817", "0.6114121", "0.60664684", "0.60581785", "0.6051787", "0.6044763", "0.6034954", "0.6015523", "0.60073954", "0.60026896", "0.5999729", "0.59985876", "0.59959525", "0.5946539", "0.59438235", "0.59419614", "0.5940146", "0.59384453", "0.5936527", "0.593436", "0.5933464", "0.5933464", "0.59328586", "0.5903897", "0.58956754", "0.58866054", "0.58843267", "0.587818", "0.5872283", "0.586407", "0.58484334", "0.5844587", "0.5843245", "0.5825274", "0.57934886", "0.5760072", "0.5758076", "0.5735165", "0.5735165", "0.573157", "0.572956", "0.5711742", "0.5708868", "0.5708646", "0.5708365", "0.5702829", "0.569732", "0.5691294", "0.5690695", "0.56862724", "0.56850696", "0.5679285", "0.56684303", "0.56681067", "0.5655164", "0.5653935", "0.5646557", "0.5643463", "0.5642158" ]
0.7413631
3
Opening Camera via CameraManager
private void openCamera(int width, int height) { setupCamera(width, height); configureTransform(width, height); Activity activity = mActivity; CameraManager cameraManager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE); try { if (ContextCompat.checkSelfPermission(mActivity, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { // connect the camera // TODO: add comments cameraManager.openCamera(mCameraId, mStateCallback, mBackgroundHandler); } } catch (CameraAccessException e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void openCamera() {\n \n\n }", "public void openCamera() {\n\n Uri photoURI = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + \".provider\", getTempImage());\n\n if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {\n photoURI = Uri.fromFile(getTempImage());\n }\n\n Intent cIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n cIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n startActivityForResult(cIntent, CAPTURE_PHOTO);\n }", "private void oldOpenCamera() {\n try {\n mCamera = Camera.open(); // attempt to get a Camera instance\n mCamera.setPreviewCallbackWithBuffer(this);\n Log.i(TAG, \"Instance created\");\n } catch (Exception e) {\n Log.e(TAG, \"Error getting Camera instance: \" + e.getMessage());\n }\n }", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String mCameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraId);\n StreamConfigurationMap map = characteristics.\n get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n mImageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) !=\n PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE) !=\n PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(CameraActivity.this, new\n String[]{Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CAMERA_PERMISSION);\n }\n manager.openCamera(mCameraId, mStateCallback, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public void getCameraInstance() {\n newOpenCamera();\n }", "private void newOpenCamera() {\n if (mThread == null) {\n mThread = new CameraHandlerThread();\n }\n\n synchronized (mThread) {\n mThread.openCamera();\n }\n }", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String cameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);\n StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n imageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION);\n return;\n }\n manager.openCamera(cameraId, stateCallback, null);\n } catch (CameraAccessException e) {\n Toast.makeText(this, \"Camera failed to open.\", Toast.LENGTH_SHORT).show();\n e.printStackTrace();\n }\n }", "public static Camera open() { \n return new Camera(); \n }", "public void onCameraOpened() {\n openCameraCommon();\n initializeControlByIntent();\n new Thread() {\n public void run() {\n try {\n Thread.sleep(500);\n PhotoModule.this.mIsCameraOpened = true;\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }.start();\n }", "@Override\n public void startCameraIntent() {\n Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n startActivityForResult(cameraIntent, PICK_FROM_CAMERA_REQUEST_CODE);\n }", "private void openCamera() {\n Intent intent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n // intent.setAction(Intent.ACTION_PICK);\n // intent.putExtra(MediaStore.EXTRA_OUTPUT,Image_uri);\n startActivityForResult(intent, camera_image_code);\n\n }", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "public void startCamera()\n {\n startCamera(null);\n }", "public void openCamera() {\n Toast.makeText(this, \"Coming soon...\", Toast.LENGTH_SHORT).show();\n }", "private void launchCamera() {\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n // Create a File reference to access to future access\n photoFile = getPhotoFileUri(photoFileName);\n\n // wrap File object into a content provider\n // required for API >= 24\n // See https://guides.codepath.com/android/Sharing-Content-with-Intents#sharing-files-with-api-24-or-higher\n Uri fileProvider = FileProvider.getUriForFile(getContext(), \"com.codepath.fileprovider\", photoFile);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, fileProvider);\n\n // If you call startActivityForResult() using an intent that no app can handle, your app will crash.\n // So as long as the result is not null, it's safe to use the intent.\n if (intent.resolveActivity(getContext().getPackageManager()) != null) {\n // Start the image capture intent to take photo\n startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);\n }\n }", "private void launchCamera() {\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n // Create a File reference for future access\n photoFile = getPhotoFileUri(photoFileName);\n\n // wrap File object into a content provider\n // required for API >= 24\n // See https://guides.codepath.com/android/Sharing-Content-with-Intents#sharing-files-with-api-24-or-higher\n Uri fileProvider = FileProvider.getUriForFile(getContext(), \"com.codepath.fileprovider\", photoFile);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, fileProvider);\n\n // If you call startActivityForResult() using an intent that no app can handle, your app will crash.\n // So as long as the result is not null, it's safe to use the intent.\n if (intent.resolveActivity(getContext().getPackageManager()) != null) {\n // Start the image capture intent to take photo\n startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);\n }\n }", "@Override\n public void onClick(View view) {\n try {\n if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n cameraManager.openCamera(cameraManager.getCameraIdList()[0],\n new CameraState(cameraView), null);\n } catch (CameraAccessException e) {\n Log.d(\"msg\",\"CameraAccessException\");\n e.printStackTrace();\n }\n\n }", "private void getCamera() {\n if (camera == null) {\n try {\n camera = Camera.open();\n params = camera.getParameters();\n } catch (RuntimeException e) {\n\n }\n }\n }", "public void openCamera(View view) {\n Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n\n mImagePath = getFile();\n takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mImagePath);\n startActivityForResult(takePictureIntent, TAKE_PIC_CODE);\n }", "public void startCameraProcessing() {\n this.checkCameraPermission();\n\n try {\n cameraManager.openCamera(cameraId, new CameraDevice.StateCallback() {\n @Override\n public void onOpened(@NonNull CameraDevice camera) {\n cameraDevice = camera;\n onCameraOpened();\n }\n\n @Override\n public void onDisconnected(@NonNull CameraDevice camera) {\n\n }\n\n @Override\n public void onError(@NonNull CameraDevice camera, int error) {\n System.out.println(\"CAMERA ERROR OCCURRED: \" + error);\n }\n\n @Override\n public void onClosed(@NonNull CameraDevice camera) {\n super.onClosed(camera);\n }\n }, null);\n }\n catch (Exception e) {\n System.out.println(\"CAMERA FAILED TO OPEN\");\n e.printStackTrace();\n }\n }", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n createCameraPreview();\n }", "Camera getCamera();", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n cameraDevice = camera;\n createCameraPreview();\n }", "@Override\n public void onOpened(CameraDevice camera) {\n Log.e(TAG, \"onOpened\");\n mCameraDevice = camera;\n startPreview();\n }", "public void openCamera(View view) {\n //do something here\n dispatchTakePictureIntent();\n\n }", "public void openCamera(View view){\n if (isInspecting) {\n Context context = App.getContext();\n Intent intent = new Intent(Inspector.this, PhotoManager.class);\n intent.putExtra(\"blueprint\", blueprint);\n intent.putExtra(\"isInspecting\", isInspecting);\n intent.putExtra(\"filename\", filename);\n View parent = (View) view.getParent();\n String tag = parent.getTag().toString();\n intent.putExtra(\"cameraID\", tag);\n LogManager.reportStatus(context, \"INSPECTOR\", \"parent tag = \" + tag);\n startActivity(intent);\n }\n }", "public void OpenCamera (View view){\n\t \t\n\t \t//Open Next Camera Activity and give the mood to it\n\t \tIntent intent = new Intent(this, Camera.class);\n\t \tintent.putExtra(\"mood\", Bar.getProgress());\n\t \tstartActivity(intent);\t\n\t }", "public void cameraIntent() {\n startActivityForResult(new Intent(\"android.media.action.IMAGE_CAPTURE\"), 1);\n }", "private void launchCamera() {\n Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n\n // Ensure that there's a camera activity to handle the intent\n if (takePictureIntent.resolveActivity(getPackageManager()) != null) {\n // Create the temporary File where the photo should go\n try {\n photoFile = createTempImageFile(PhotoActivity.this);\n } catch (IOException ex) {\n // Error occurred while creating the File\n ex.printStackTrace();\n }\n // Continue only if the File was successfully created\n if (photoFile != null) {\n\n // Get the path of the temporary file\n mTempPhotoPath = photoFile.getAbsolutePath();\n\n // Get the content URI for the image file\n Uri photoURI = FileProvider.getUriForFile(this,\n FILE_PROVIDER_AUTHORITY,\n photoFile);\n\n // Add the URI so the camera can store the image\n takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n\n // Launch the camera activity\n startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);\n }\n }\n }", "public void onLaunchCamera(View view) {\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n // Create a File reference to access to future access\n /*photoFile = getPhotoFileUri(photoFileName);\n\n // wrap File object into a content provider\n // required for API >= 24\n // See https://guides.codepath.com/android/Sharing-Content-with-Intents#sharing-files-with-api-24-or-higher\n Uri fileProvider = FileProvider.getUriForFile(this, \"com.codepath.fileprovider\", photoFile);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, fileProvider);*/\n\n // If you call startActivityForResult() using an intent that no app can handle, your app will crash.\n // So as long as the result is not null, it's safe to use the intent.\n if (intent.resolveActivity(getPackageManager()) != null) {\n // Start the image capture intent to take photo\n File photoFile = null;\n try {\n photoFile = createImageFile();\n } catch (IOException ex) {\n // Error occurred while creating the File\n\n }\n\n if (photoFile != null) {\n Uri photoURI = FileProvider.getUriForFile(this,\n \"com.example.android.fileprovider\",\n photoFile);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);\n }\n }\n }", "public void configureCamera(){\n try{\n camera = Camera.open(findBackFacingCamera());\n } catch (Exception e){}\n\n if(camera != null) {\n cameraView = new CameraView(this.getApplicationContext(), camera);\n FrameLayout camera_view = (FrameLayout)findViewById(R.id.CameraView);\n camera_view.addView(cameraView);\n }\n }", "@Override\n public void onCameraOpenFailed(Exception e) {\n }", "public void startCamera()\n \t{\n\t\t// start the video capture\n\t\t//this.capture.open(0);\n\t\tcapture.open(cameraNumber);\n\n\n\n\t\t// is the video stream available?\n\t\tif (capture.isOpened())\n\t\t{\n\t\t\t// grab a frame every 33 ms (30 frames/sec)\n\t\t\tRunnable frameGrabber = new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run()\n\t\t\t\t{\n\t\t\t\t\tgrabFrame();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttimer = Executors.newSingleThreadScheduledExecutor();\n\t\t\ttimer.scheduleAtFixedRate(frameGrabber, 0, 500, TimeUnit.MILLISECONDS);\n\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// log the error\n\t\t\tSystem.err.println(\"Impossible to open the camera connection...\");\n\t\t}\n \t}", "public static Camera openCamera(Activity activity, int cameraId)\n throws Exception {\n if (!activity.isFinishing()) {\n DevicePolicyManager dpm = (DevicePolicyManager) activity.getSystemService(\n Context.DEVICE_POLICY_SERVICE);\n if (dpm.getCameraDisabled(null) == true) {\n throw new Exception();\n }\n for (int i = 0; i < OPEN_RETRY_COUNT; i++) {\n try {\n return CameraHolder.instance().open(cameraId);\n } catch (Exception e) {\n if (i == 0) {\n try {\n //wait some time, and try another time\n //Camera device may be using by VT or atv.\n Thread.sleep(1000);\n } catch (InterruptedException ie) {\n }\n continue;\n } else {\n // In eng build, we throw the exception so that test tool\n // can detect it and report it\n if (\"eng\".equals(Build.TYPE)) {\n if (BuildConfig.DEBUG) Log.i(TAG, \"Open Camera fail\", e);\n throw e;\n //QA will always consider JE as bug, so..\n //throw new RuntimeException(\"openCamera failed\", e);\n } else {\n throw e;\n }\n }\n }\n }\n //just for build pass\n }\n throw new Exception(new RuntimeException(\"Should never get here\"));\n\n }", "public static Camera getCameraInstance(){\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {\n return Camera.open(0); // This is the line the error occurs\n } else {\n return Camera.open();\n }\n }", "void initCameraManager(){\n\t\tcameraManager = new CameraManager(getApplication());\n\t}", "public void onLaunchCamera(View view) {\n Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n\n\n data.insertAnImage(OptionID.get(alg), null);\n Cursor imageCursor = data.getImageData(OptionID.get(alg));\n imageCursor.moveToNext();\n intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(getPhotoFileUri(imageCursor.getString(0))))); // set the image file name\n\n // If you call startActivityForResult() using an intent that no app can handle, your app will crash.\n // So as long as the result is not null, it's safe to use the intent.\n if (intent.resolveActivity(getPackageManager()) != null) {\n // Start the image capture intent to take photo\n startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);\n }\n }", "private void openCamera(int desiredWidth, int desiredHeight) {\n if (mCamera != null) {\n throw new RuntimeException(\"camera already initialized\");\n }\n\n android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();\n\n // Try to find a front-facing camera (e.g. for videoconferencing).\n int numCameras = android.hardware.Camera.getNumberOfCameras();\n for (int i = 0; i < numCameras; i++) {\n android.hardware.Camera.getCameraInfo(i, info);\n if (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK) {\n mCamera = android.hardware.Camera.open(i);\n break;\n }\n }\n if (mCamera == null) {\n// Log.d(TAG, \"No front-facing camera found; opening default\");\n mCamera = android.hardware.Camera.open(); // opens first back-facing camera\n }\n if (mCamera == null) {\n throw new RuntimeException(\"Unable to open camera\");\n }\n\n android.hardware.Camera.Parameters parms = mCamera.getParameters();\n\n CameraUtils.choosePreviewSize(parms, desiredWidth, desiredHeight);\n\n // Give the camera a hint that we're recording video. This can have a big\n // impact on frame rate.\n parms.setRecordingHint(true);\n\n // leave the frame rate set to default\n mCamera.setParameters(parms);\n\n int[] fpsRange = new int[2];\n android.hardware.Camera.Size mCameraPreviewSize = parms.getPreviewSize();\n parms.getPreviewFpsRange(fpsRange);\n String previewFacts = mCameraPreviewSize.width + \"x\" + mCameraPreviewSize.height;\n if (fpsRange[0] == fpsRange[1]) {\n previewFacts += \" @\" + (fpsRange[0] / 1000.0) + \"fps\";\n } else {\n previewFacts += \" @[\" + (fpsRange[0] / 1000.0) +\n \" - \" + (fpsRange[1] / 1000.0) + \"] fps\";\n }\n// TextView text = (TextView) findViewById(R.id.cameraParams_text);\n// text.setText(previewFacts);\n\n mCameraPreviewWidth = mCameraPreviewSize.width;\n mCameraPreviewHeight = mCameraPreviewSize.height;\n\n\n// AspectFrameLayout layout = (AspectFrameLayout) findViewById(R.id.cameraPreview_afl);\n\n Display display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();\n\n if(display.getRotation() == Surface.ROTATION_0) {\n mCamera.setDisplayOrientation(90);\n// layout.setAspectRatio((double) mCameraPreviewHeight / mCameraPreviewWidth);\n } else if(display.getRotation() == Surface.ROTATION_270) {\n// layout.setAspectRatio((double) mCameraPreviewHeight/ mCameraPreviewWidth);\n mCamera.setDisplayOrientation(180);\n } else {\n // Set the preview aspect ratio.\n// layout.setAspectRatio((double) mCameraPreviewWidth / mCameraPreviewHeight);\n }\n }", "private Camera selectAndOpenCamera() {\n\t\tCamera.CameraInfo info = new Camera.CameraInfo();\n\t\tint numberOfCameras = Camera.getNumberOfCameras();\n\n\t\tint selected = -1;\n\n\t\tfor (int i = 0; i < numberOfCameras; i++) {\n\t\t\tCamera.getCameraInfo(i, info);\n\n\t\t\tif( info.facing == Camera.CameraInfo.CAMERA_FACING_BACK ) {\n\t\t\t\tselected = i;\n\t\t\t\tflipHorizontal = false;\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\t// default to a front facing camera if a back facing one can't be found\n\t\t\t\tselected = i;\n\t\t\t\tflipHorizontal = true;\n\t\t\t}\n\t\t}\n\n\t\tif( selected == -1 ) {\n\t\t\tdialogNoCamera();\n\t\t\treturn null; // won't ever be called\n\t\t} else {\n\t\t\treturn Camera.open(selected);\n\t\t}\n\t}", "public void openInAppCamera(SmartCameraListener smartCameraListener, CameraConfigInformation cameraConfigInfo) {\n\t\tLog.d(SmartConstants.APP_NAME, \"SmartViewActivity->openInAppCamera->cameraConfigInfo:\" + cameraConfigInfo);\n\t\tthis.smartCameraListener = smartCameraListener;\n\t\tthis.cameraConfigInformation = cameraConfigInfo;\n\t\tIntent intent = new Intent(\"android.media.action.IMAGE_CAPTURE\");\n\n\t\t// for experimentation only\n\t\tFile output = getCameraTempFile();\n\t\tintent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(output));\n\t\t// ----------------------------\n\n\t\tstartActivityForResult(intent, SmartConstants.REQ_CODE_LAUNCH_CAMERA_APP);\n\t}", "private void startCameraSource() {\n if (cameraSource != null) {\n try {\n if (cameraPreview == null) {\n Logger.e(TAG, \"Preview is null\");\n }\n cameraPreview.start(cameraSource, fireFaceOverlay);\n } catch (IOException e) {\n// Logger.e(TAG, \"Unable to start camera source.\", e);\n cameraSource.release();\n cameraSource = null;\n }\n }\n }", "private void startCameraSource() {\n\n if (cameraSource != null) {\n try {\n cameraPreview.start(cameraSource, graphicOverlay);\n } catch (IOException e) {\n Log.e(TAG, \"Unable to start camera source.\", e);\n cameraSource.release();\n cameraSource = null;\n }\n }\n\n }", "public void onCamera();", "private void setCamera() {\n\t\tCamera.CameraInfo cameraInfo = new Camera.CameraInfo();\n\t\tint cameraCount = Camera.getNumberOfCameras();\n\t\tLog.i(TAG, \"count = \" + cameraCount);\n\t\tLog.i(TAG, \"isBack = \" + isBack);\n\t\tint id = 0;\n\n\t\tfor (int camIdx = 0; camIdx < cameraCount; camIdx++) {\n\t\t\tCamera.getCameraInfo(camIdx, cameraInfo);\n\t\t\tLog.i(TAG, \"cameraInfoFacing = \" + cameraInfo.facing);\n\t\t\tif (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK\n\t\t\t\t\t&& isBack) {\n\t\t\t\ttry {\n\t\t\t\t\tLog.i(TAG, \"SETTING mCamera\");\n\t\t\t\t\tmCamera = Camera.open(camIdx);\n\t\t\t\t\tid = camIdx;\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\tLog.e(TAG,\n\t\t\t\t\t\t\t\"Camera failed to open: \" + e.getLocalizedMessage());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT\n\t\t\t\t\t&& !isBack){\n\t\t\t\ttry {\n\t\t\t\t\tLog.i(TAG, \"SETTING mCamera\");\n\t\t\t\t\tmCamera = Camera.open(camIdx);\n\t\t\t\t\tid = camIdx;\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\tLog.e(TAG,\n\t\t\t\t\t\t\t\"Camera failed to open: \" + e.getLocalizedMessage());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (mCamera != null) {\n\t\t\tCamera.Parameters cameraParameters = mCamera.getParameters();\n\t\t\tDisplay display = getActivity().getWindowManager().getDefaultDisplay();\n\t\t\tPoint size = new Point();\n\t\t\tdisplay.getSize(size);\n\t\t\tint screenWidth = size.x;\n\t\t\tint width = Integer.MAX_VALUE;\n\t\t\tint height = 0;\n\t\t\tLog.i(TAG, \"SCREENWIDTH: \" + screenWidth);\n\t\t\tList<Camera.Size> sizes = cameraParameters.getSupportedPreviewSizes();\n\t\t\tfor (Camera.Size cSize : sizes) {\n\t\t\t\tif (cSize.width >= screenWidth && cSize.width <= width) {\n\t\t\t\t\twidth = cSize.width;\n\t\t\t\t\theight = cSize.height;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tLog.i(TAG, \"Width: \" + width + \" HEIGHT: \" + height);\n\n\t\t\tif (mPreview != null) {\n\t\t\t\tmPreview.switchCamera(mCamera, id, width, height);\n\t\t\t} else {\n\t\t\t\tmPreview = new CameraPreview(getActivity(), mCamera, id, width, height);\n\t\t\t\tFrameLayout preview = (FrameLayout) view\n\t\t\t\t\t\t.findViewById(R.id.camera_preview);\n\t\t\t\tpreview.addView(mPreview);\n\t\t\t}\n\t\t\tmCamera.startPreview();\n\t\t}\n\t}", "public void open(Activity activity, boolean isSecureCamera, boolean isCaptureIntent);", "private void initCamera(SurfaceHolder surfaceHolder) {\n\t\tif (surfaceHolder == null) {\n\t\t throw new IllegalStateException(\"No SurfaceHolder provided\");\n\t\t }\n\t\tif (cameraManager.isOpen()) {\n\t\t Log.w(TAG, \"initCamera() while already open -- late SurfaceView callback?\");\n\t\t return;\n\t\t }\n\t\ttry {\n\t\t\tcameraManager.openDriver(surfaceHolder);\n\t\t\t// Creating the handler starts the preview, which can also throw a\n\t\t\t// RuntimeException.\n\t\t\t if (handler == null) {\n\t\t\t handler = new CaptureActivityHandler(this, null, null, \"UTF-8\", cameraManager);\n\t\t\t }\n\t\t\t decodeOrStoreSavedBitmap(null, null);\n\t\t} catch (IOException ioe) {\n\t\t\tLog.w(TAG, ioe);\n\t\t\t// displayFrameworkBugMessageAndExit();\n\t\t\tCommonTask.ShowMessage(this, \"IOException\\n\" + ioe.getMessage());\n\t\t} catch (RuntimeException e) {\n\t\t\t// Barcode Scanner has seen crashes in the wild of this variety:\n\t\t\t// java.?lang.?RuntimeException: Fail to connect to camera service\n\t\t\tLog.w(TAG, \"Unexpected error initializating camera\", e);\n\t\t\tCommonTask.ShowMessage(this, \"RuntimeException\\n\" + e.getMessage());\n\t\t\t// displayFrameworkBugMessageAndExit();\n\t\t}\n\t}", "public void onLaunchCamera() {\n takePic.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n // create Intent to take a picture and return control to the calling application\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n // Create a File reference to access to future access\n photoFile = getPhotoFileUri(photoFileName);\n\n // wrap File object into a content provider\n // required for API >= 24\n // See https://guides.codepath.com/android/Sharing-Content-with-Intents#sharing-files-with-api-24-or-higher\n Uri fileProvider = FileProvider.getUriForFile(Driver_License_Scan.this, \"com.codepath.fileprovider\", photoFile);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, fileProvider);\n\n // If you call startActivityForResult() using an intent that no app can handle, your app will crash.\n // So as long as the result is not null, it's safe to use the intent.\n if (intent.resolveActivity(getPackageManager()) != null) {\n // Start the image capture intent to take photo\n startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);\n }\n }\n });\n }", "protected void startCamera() {\n profileImageCaptured = new File(\n Environment.getExternalStorageDirectory() + \"/\" + \"temp.png\");\n if (profileImageCaptured.exists())\n profileImageCaptured.delete();\n\n outputFileUri = Uri.fromFile(profileImageCaptured);\n Intent intent = new Intent(\n android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);\n intent.putExtra(\"return-data\", true);\n startActivityForResult(intent, CAMERA_REQUEST);\n\n }", "private void requestCameraPermission() {\r\n Dexter.withActivity(this)\r\n .withPermission(Manifest.permission.CAMERA)\r\n .withListener(new PermissionListener() {\r\n @Override\r\n public void onPermissionGranted(PermissionGrantedResponse response) {\r\n // permission is granted\r\n Toast.makeText(getApplicationContext(), \"Camera permission are granted!\", Toast.LENGTH_SHORT).show();\r\n\r\n Intent camera_intent=new Intent(MainActivity.this,CameraActivity.class);\r\n startActivity(camera_intent);\r\n }\r\n\r\n @Override\r\n public void onPermissionDenied(PermissionDeniedResponse response) {\r\n // check for permanent denial of permission\r\n if (response.isPermanentlyDenied()) {\r\n showSettingsDialog();\r\n }\r\n }\r\n\r\n @Override\r\n public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {\r\n token.continuePermissionRequest();\r\n }\r\n }).check();\r\n }", "public void openDriver(SurfaceHolder holder, int cameraPosition)\n\t{\n\t\tif (camera == null) {\n\t\t\tcamera = openCamera(cameraPosition);\n\t\t\tif (camera == null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tcamera.setPreviewDisplay(holder);\n\t\t\t} catch (IOException e) {\n\t\t\t\tLog.d(TAG, \"cannot set preview display\");\n\t\t\t}\n\t\t\tupdateCameraDisplayOrientation();\n\t\t\tif (!initialized) {\n\t\t\t\tinitialized = true;\n\t\t\t\tconfigManager.initFromCameraParameters(camera);\n\t\t\t}\n\t\t\tconfigManager.setDesiredCameraParameters(camera);\n\t\t\t\n\t\t}\n\t}", "public synchronized void openDriver(SurfaceHolder holder) throws IOException {\n OpenCamera theCamera = camera;\n if (theCamera == null) {\n theCamera = OpenCameraInterface.open(-1);\n if (theCamera == null) {\n throw new IOException(\"Camera.open() failed to return object from driver\");\n }\n camera = theCamera;\n }\n\n Camera cameraObject = theCamera.getCamera();\n Camera.Parameters parameters = cameraObject.getParameters();\n String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily\n try {\n setDesiredCameraParameters(theCamera, false);\n } catch (RuntimeException re) {\n // Driver failed\n Log.w(TAG, \"Camera rejected parameters. Setting only minimal safe-mode parameters\");\n Log.i(TAG, \"Resetting to saved camera params: \" + parametersFlattened);\n // Reset:\n if (parametersFlattened != null) {\n parameters = cameraObject.getParameters();\n parameters.unflatten(parametersFlattened);\n try {\n cameraObject.setParameters(parameters);\n setDesiredCameraParameters(theCamera, true);\n } catch (RuntimeException re2) {\n // Well, darn. Give up\n Log.w(TAG, \"Camera rejected even safe-mode parameters! No configuration\");\n }\n }\n }\n cameraObject.setPreviewDisplay(holder);\n previewCallback = new PreviewCallback(previewSize);\n }", "@Override\n public void imageFromCamera() {\n Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n if (takePictureIntent.resolveActivity(getPackageManager()) != null) {\n startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);\n }\n }", "@Override\n public void startCamera() {\n super.startCamera();\n\n if(cameraListener != null)\n cameraListener.onCameraStart();\n }", "protected void open_camera_and_save_image() {\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n\n // Ensure that there is a camera activity to handle the intent.\n if(intent.resolveActivity(getPackageManager()) != null) {\n // create the file where the photo should go\n File photoFile = null;\n try {\n photoFile = createImageFile();\n } catch (IOException e) {\n // error occurred while creating the file\n result.setText(R.string.fail_in_creating_photo);\n }\n\n if(photoFile != null) {\n Uri photoURI = FileProvider.getUriForFile(this,\n \"com.example.jiankaiwang.fileprovider\", photoFile);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n\n // pass to another external activity\n startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);\n }\n }\n }", "private void addWithCamera() {\n if (PermissionUtils.isPermissionGranted(Manifest.permission.CAMERA)) {\n startCameraPage();\n } else {\n PermissionUtils.requestPermission(\n this,\n Manifest.permission.CAMERA,\n CAMERA_PERMISSION_REQUEST);\n }\n }", "void connectToCameraSystem(@NonNull CameraSystem cameraSystem);", "private void startCameraSource() {\n if (cameraSource != null) {\n try {\n if (preview == null) {\n //Log.d(TAG, \"resume: Preview is null\");\n }\n if (graphicOverlay == null) {\n //Log.d(TAG, \"resume: graphOverlay is null\");\n }\n preview.start(cameraSource, graphicOverlay);\n } catch (IOException e) {\n Log.e(TAG, \"Unable to start camera source.\", e);\n cameraSource.release();\n cameraSource = null;\n }\n }\n }", "public void onCameraPressed(View view) {\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\r\n\r\n // create a file handle for the phoot that will be taken\r\n this.photoFile = getFileForPhoto(this.filename);\r\n Uri fileProvider = FileProvider.getUriForFile(PersonDetailsActivity.this, \"com.example.labtest1\", this.photoFile);\r\n intent.putExtra(MediaStore.EXTRA_OUTPUT, fileProvider);\r\n\r\n // Try to open the camera app\r\n if (intent.resolveActivity(getPackageManager()) != null) {\r\n startActivityForResult(intent, TAKE_PHOTO_ACTIVITY_REQUEST_CODE);\r\n }\r\n }", "public interface CameraOpenListener {\n void onCameraError(Exception exc);\n\n void onCameraOpened(CameraController cameraController, int i, int i2);\n}", "@TargetApi(9)\n\t@Override\n\tpublic void onResume() {\n\t\tsuper.onResume();\n\t\tif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {\n\t\t\tmCamera = Camera.open(0);\t\t\t\t\t\t\t\t\t//For API 9 and above. Open first camera available on device\n\t\t} else {\n\t\t\tmCamera = Camera.open();\t\t\t\t\t\t\t\t\t//For API 8\n\t\t}\n\t}", "void startCamera() throws IOException {\n if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this, CAMERA) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(this,\n new String[]{WRITE_EXTERNAL_STORAGE, CAMERA},\n WRITE_EXTERNAL_STORAGE_REQUEST);\n return;\n }\n dispatchTakePictureIntent();\n\n }", "public static Camera getCameraInstance() {\n Camera c = null;\n try {\n c = Camera.open(nextCam); // attempt to get a Camera instance\n } catch (Exception e) {\n // Camera is not available (in use or does not exist)\n }\n return c; // returns null if camera is unavailable\n }", "private void onCameraOpened() {\n SurfaceTexture texture = targetView.getSurfaceTexture();\n\n if (texture != null) {\n targetSurface = new Surface(texture);\n onSurfaceReceived();\n }\n else {\n targetView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {\n @Override\n public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {\n targetSurface = new Surface(surfaceTexture);\n onSurfaceReceived();\n }\n public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {\n return false;\n }\n\n @Override\n public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {\n\n }\n\n @Override\n public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) {\n\n }\n });\n }\n }", "@Override\n public void onOpened(CameraDevice cameraDevice) {\n mCameraOpenCloseLock.release();\n mCameraDevice = cameraDevice;\n createCameraPreviewSession();\n }", "private void clickpic() {\n if (getApplicationContext().getPackageManager().hasSystemFeature(\n PackageManager.FEATURE_CAMERA)) {\n // Open default camera\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);\n\n // start the image capture Intent\n startActivityForResult(intent, 100);\n\n\n } else {\n Toast.makeText(getApplication(), \"Camera not supported\", Toast.LENGTH_LONG).show();\n }\n }", "public void chooseCamera() {\n if (cameraFront) {\n int cameraId = findBackFacingCamera();\n if (cameraId >= 0) {\n //open the backFacingCamera\n //set a picture callback\n //refresh the preview\n\n mCamera = Camera.open(cameraId);\n setRotation(mCamera, mCamera.getParameters(), cameraId);\n // mCamera.setDisplayOrientation(90);\n mPicture = getPictureCallback();\n mPreview.refreshCamera(mCamera);\n }\n } else {\n int cameraId = findFrontFacingCamera();\n if (cameraId >= 0) {\n //open the backFacingCamera\n //set a picture callback\n //refresh the preview\n mCamera = Camera.open(cameraId);\n setRotation(mCamera, mCamera.getParameters(), cameraId);\n // mCamera.setDisplayOrientation(90);\n mPicture = getPictureCallback();\n mPreview.refreshCamera(mCamera);\n }\n }\n }", "private void requestCameraPermission(){\n requestPermissions(cameraPermissions, CAMERA_REQUESTED_CODE);\n }", "public Camera open(int cameraId) {\r\n Camera camera = null;\r\n try {\r\n if (mMethodOpenLevel9 != null) {\r\n Object[] argList = new Object[1];\r\n argList[0] = cameraId;\r\n camera = (Camera) mMethodOpenLevel9.invoke(null, argList);\r\n }\r\n } catch (Exception e) {\r\n Log.w(LOG_TAG, \"CameraHideMethods:mMethodOpenLevel9()\", e);\r\n }\r\n\r\n return camera;\r\n }", "public void takePictureFromCamera() {\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n startActivityForResult(intent, CAMERA_REQUEST_CODE);\n\n }", "private void startCameraSource() throws SecurityException {\n // check that the device has play services available.\n int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(\n getApplicationContext());\n if (code != ConnectionResult.SUCCESS) {\n Dialog dlg =\n GoogleApiAvailability.getInstance().getErrorDialog(this, code, RC_HANDLE_GMS);\n dlg.show();\n }\n\n if (mCameraSource != null) {\n try {\n mPreview.start(mCameraSource, mGraphicOverlay);\n } catch (IOException e) {\n Log.e(TAG, \"Unable to start camera source.\", e);\n mCameraSource.release();\n mCameraSource = null;\n }\n }\n }", "private void requestCameraPermission() {\n\t\tLog.d(TAG, \"Requesting CAMERA permission\");\n\t\tActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, PERMISSION_REQUEST_CAMERA);\n\t}", "@Override\n public void onOpened(@NonNull CameraDevice cameraDevice) {\n Log.d(TAG, \"Camera opened\");\n\n mImageReader = ImageReader.newInstance(\n CAMERA_RESOLUTION_WIDTH,\n CAMERA_RESOLUTION_HEIGHT,\n ImageFormat.YUV_420_888,\n 1);\n\n mImageReader.setOnImageAvailableListener(mImageAvailableListener, null);\n mCaptureSurface = mImageReader.getSurface();\n try {\n cameraDevice.createCaptureSession(\n Collections.singletonList(mCaptureSurface),\n mCameraCaptureSessionStateCallback,\n null);\n } catch (CameraAccessException cae) {\n throw new RuntimeException(\"Error encountered creating camera capture session\", cae);\n }\n }", "private void startCameraSource() throws SecurityException {\n // Check that the device has play services available.\n int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(\n getApplicationContext());\n if (code != ConnectionResult.SUCCESS) {\n Dialog dlg =\n GoogleApiAvailability.getInstance().getErrorDialog(this, code, RC_HANDLE_GMS);\n dlg.show();\n }\n\n if (mCameraSource != null) {\n try {\n mPreview.start(mCameraSource, mGraphicOverlay);\n } catch (IOException e) {\n Log.e(TAG, \"Unable to start camera source.\", e);\n mCameraSource.release();\n mCameraSource = null;\n }\n }\n }", "private void openCamera() {\n currentDateTimeString = new SimpleDateFormat(\"yyyy-MM-dd\").format(new Date());\n txtDate.setText(currentDateTimeString);\n txtDate.setEnabled(false);\n String state = Environment.getExternalStorageState();\n imageName = currentDateTimeString+\"@\"+userName+\"@\"+timestamp+ ApplicationConstant.EXTENTION_JPG;\n if (Environment.MEDIA_MOUNTED.equals(state)) {\n mFileTemp = new File(ApplicationConstant.FOLDER_PATH, imageName);\n } else {\n mFileTemp = new File(getFilesDir(), imageName);\n }\n /*Uri.fromFile(mFileTemp)*/\n Uri photoURI = null;\n if (android.os.Build.VERSION.SDK_INT >= ApplicationConstant.API_LEVEL_23) {\n photoURI = FileProvider.getUriForFile(UploadActivity.this, BuildConfig.APPLICATION_ID + \".provider\", mFileTemp);\n } else {\n photoURI = Uri.fromFile(mFileTemp);\n }\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);\n } else {\n List<ResolveInfo> resInfoList = UploadActivity.this.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);\n for (ResolveInfo resolveInfo : resInfoList) {\n String packageName = resolveInfo.activityInfo.packageName;\n UploadActivity.this.grantUriPermission(packageName, photoURI, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);\n }\n }\n intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n startActivityForResult(intent, ApplicationConstant.RESULT_OPEN_CAMERA);\n }", "private void startCameraSource() throws SecurityException {\n int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(\n getApplicationContext());\n if (code != ConnectionResult.SUCCESS) {\n Dialog dlg =\n GoogleApiAvailability.getInstance().getErrorDialog(this, code, RC_HANDLE_GMS);\n dlg.show();\n }\n\n if (mCameraSource != null) {\n try {\n mPreview.start(mCameraSource, mGraphicOverlay);\n } catch (IOException e) {\n Log.e(TAG, \"Unable to start camera source.\", e);\n mCameraSource.release();\n mCameraSource = null;\n }\n }\n }", "public static Camera getCameraInstance(){\n Camera c = null;\n try {\n c = Camera.open(); // attempt to get a Camera instance\n }\n catch (Exception e){\n // Camera is not available (in use or does not exist)\n }\n return c; // returns null if camera is unavailable\n }", "public static Camera getCameraInstance(){\n Camera c = null;\n try {\n c = Camera.open(); // attempt to get a Camera instance\n }\n catch (Exception e){\n // Camera is not available (in use or does not exist)\n }\n return c; // returns null if camera is unavailable\n }", "@Override\n public void openVideoCapture(Map<String, Object> parameters) throws Exception {\n checkNotNull(camera, \"Camera required\");\n ImageView viewCamera = checkNotNull((ImageView) parameters.get(\"viewCamera\"),\n \"Camera's ImageView required\");\n\n videoCapture.open(camera.getWebCamIndex());\n\n videoCapture.set(3, camera.getWidth());\n videoCapture.set(4, camera.getHeight());\n\n Runnable frameGrabber = () -> viewCamera.setImage(grabFrame(new HashMap<>()));\n timer = Executors.newSingleThreadScheduledExecutor();\n timer.scheduleAtFixedRate(frameGrabber, 0, 33, TimeUnit.MICROSECONDS);\n }", "public static Camera getCameraInstance() {\n Camera c = null;\n try {\n c = Camera.open();\n } catch (Exception e) {\n }\n return c;\n }", "public void obtainCameraOrFinish() {\n mCamera = getCameraInstance();\n if (mCamera == null) {\n Toast.makeText(VideoCapture.getSelf(), \"Fail to get Camera\", Toast.LENGTH_LONG).show();\n VideoCapture.getSelf().finish();\n }\n }", "@Override\n public void onOpened(@NonNull CameraDevice cameraDevice) {\n mCameraOpenCloseLock.release();\n mCameraDevice = cameraDevice;\n createCameraPreviewSession();\n }", "private static Camera getCameraInstance(int cameraId) {\n Camera c = null;\n try {\n c = Camera.open(cameraId);\n }\n catch (Exception e) {\n // Camera is not available (in use or does not exist)\n Log.w(LOG_TAG, \"Camera is not available: \" + e.getMessage());\n }\n return c;\n }", "private native void iniciarCamara(int idCamera);", "public void openCamera(String cameraId,\n CameraDevice.StateCallback stateCallback)\n throws CameraAccessException {\n mCameraManager.openCamera(cameraId, stateCallback, null);\n }", "public static Camera getCameraInstance(){\n\t Camera c = null;\n\t try {\n\t \tLog.d(TAG, \"not null\");\n\t c = Camera.open(); // attempt to get a Camera instance\n\t }\n\t catch (Exception e){\n\t // Camera is not available (in use or does not exist)\n\t }\n\t return c; // returns null if camera is unavailable\n\t}", "private void setupCamera(final int camera) {\n try {\n // mPreview = new CamPreview(this, camera, CamPreview.LayoutMode.NoBlank);// .FitToParent);\n } catch (Exception e) {\n Toast.makeText(this, R.string.cannot_connect_to_camera, Toast.LENGTH_LONG).show();\n finish();\n return;\n }\n\n RelativeLayout.LayoutParams previewLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n Display display = getWindowManager().getDefaultDisplay();\n DisplayMetrics outMetrics = new DisplayMetrics();\n display.getMetrics(outMetrics);\n\n int width = outMetrics.widthPixels;\n int height = outMetrics.heightPixels;\n\n previewLayoutParams.height = width;\n previewLayoutParams.width = width;\n\n // Un-comment below line to specify the position.\n // mPreview.setCenterPosition(width / 2, height / 2);\n\n // previewParent.addView(mPreview, 0, previewLayoutParams);\n\n\n }", "void initializeCamera() {\n camera_linear = (LinearLayout) findViewById(R.id.camera_linear);\n //The preview frame is overlayed on the layout which shows the camera view.\n preview = (FrameLayout) findViewById(R.id.camera_preview);\n //Get an instance of the phone's camera.\n mCamera = cameraRecorder.getCameraInstance();\n //Find content fort the camera preview frame using the instance of the camera initialized.\n mPreview = new CameraPreview(getApplicationContext(), mCamera);\n //Apply the camera previes content from the camera to the preview frame itself.\n preview.addView(mPreview);\n }", "private void startCameraActivity(){\n if (checkPermissions() && !startingActivity) {\n startingActivity = true;\n goodVibes.vibrate(200);\n Intent intent = new Intent(this, CameraActivity.class);\n intent.putExtra(\"EYE_COLOR\", eyeColorSelection);\n startActivity(intent);\n }else{\n getPermissions();\n }\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n private void requestCameraPermission() {\n requestPermissions(cameraPermissions, CAMERA_REQUEST_CODE);\n }", "private void askCameraPermission(){\n /** {@PERMISSION_GRANTED} value is 0 that means if permission is granted then checkSelfPermission will inform us by int\n * and if {@checkSelfPermission} is not 0 that means permission is not granted so we need to ask the permission at run time\n * only for API above 23*/\n if(ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED){\n ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.CAMERA},CAMERA_CAPTURE_IMAGE_PERMISSION_CODE);\n }else{\n // if permission is granted then open camera directly\n dispatchTakePictureIntent();\n }\n }", "private void pickFromCamera() {\n Intent startCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n startCamera.putExtra(MediaStore.EXTRA_OUTPUT, uriImage);\n startActivityForResult(startCamera, IMAGE_PICK_CAMERA_CODE);\n\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "static void proceedWithOpenedCamera(final Context context, final CameraManager manager, final CameraDevice camera, final File outputFile, final Looper looper, final PrintWriter stdout) throws CameraAccessException, IllegalArgumentException {\n final List<Surface> outputSurfaces = new ArrayList<>();\n\n final CameraCharacteristics characteristics = manager.getCameraCharacteristics(camera.getId());\n\n int autoExposureMode = CameraMetadata.CONTROL_AE_MODE_OFF;\n for (int supportedMode : characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES)) {\n if (supportedMode == CameraMetadata.CONTROL_AE_MODE_ON) {\n autoExposureMode = supportedMode;\n }\n }\n final int autoExposureModeFinal = autoExposureMode;\n\n // Use largest available size:\n StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n Comparator<Size> bySize = (lhs, rhs) -> {\n // Cast to ensure multiplications won't overflow:\n return Long.signum((long) lhs.getWidth() * lhs.getHeight() - (long) rhs.getWidth() * rhs.getHeight());\n };\n List<Size> sizes = Arrays.asList(map.getOutputSizes(ImageFormat.JPEG));\n Size largest = Collections.max(sizes, bySize);\n\n final ImageReader mImageReader = ImageReader.newInstance(largest.getWidth(), largest.getHeight(), ImageFormat.JPEG, 2);\n mImageReader.setOnImageAvailableListener(reader -> new Thread() {\n @Override\n public void run() {\n try (final Image mImage = reader.acquireNextImage()) {\n ByteBuffer buffer = mImage.getPlanes()[0].getBuffer();\n byte[] bytes = new byte[buffer.remaining()];\n buffer.get(bytes);\n try (FileOutputStream output = new FileOutputStream(outputFile)) {\n output.write(bytes);\n } catch (Exception e) {\n stdout.println(\"Error writing image: \" + e.getMessage());\n TermuxApiLogger.error(\"Error writing image\", e);\n } finally {\n closeCamera(camera, looper);\n }\n }\n }\n }.start(), null);\n final Surface imageReaderSurface = mImageReader.getSurface();\n outputSurfaces.add(imageReaderSurface);\n\n // create a dummy PreviewSurface\n SurfaceTexture previewTexture = new SurfaceTexture(1);\n Surface dummySurface = new Surface(previewTexture);\n outputSurfaces.add(dummySurface);\n\n camera.createCaptureSession(outputSurfaces, new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(final CameraCaptureSession session) {\n try {\n // create preview Request\n CaptureRequest.Builder previewReq = camera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n previewReq.addTarget(dummySurface);\n previewReq.set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE);\n previewReq.set(CaptureRequest.CONTROL_AE_MODE, autoExposureModeFinal);\n\n // continous preview-capture for 1/2 second\n session.setRepeatingRequest(previewReq.build(), null, null);\n TermuxApiLogger.info(\"preview started\");\n Thread.sleep(500);\n session.stopRepeating();\n TermuxApiLogger.info(\"preview stoppend\");\n previewTexture.release();\n dummySurface.release();\n\n final CaptureRequest.Builder jpegRequest = camera.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);\n // Render to our image reader:\n jpegRequest.addTarget(imageReaderSurface);\n // Configure auto-focus (AF) and auto-exposure (AE) modes:\n jpegRequest.set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE);\n jpegRequest.set(CaptureRequest.CONTROL_AE_MODE, autoExposureModeFinal);\n jpegRequest.set(CaptureRequest.JPEG_ORIENTATION, correctOrientation(context, characteristics));\n\n saveImage(camera, session, jpegRequest.build());\n } catch (Exception e) {\n TermuxApiLogger.error(\"onConfigured() error in preview\", e);\n closeCamera(camera, looper);\n }\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession session) {\n TermuxApiLogger.error(\"onConfigureFailed() error in preview\");\n closeCamera(camera, looper);\n }\n }, null);\n }", "@Override\n\t\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\tcam.setCamera(getCameraInstance(getDefaultCameraId()));\n\t\t\t\t}", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n openCamera();\n }", "@Override\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\tLog.e(TAG,\"Surface Created\");\n\t\tcamera = Camera.open();\n\t}" ]
[ "0.7982744", "0.781916", "0.78052455", "0.7804821", "0.7726779", "0.7602588", "0.75539374", "0.75385535", "0.7318735", "0.73109025", "0.72650856", "0.7229907", "0.7229907", "0.7209537", "0.7193969", "0.71796995", "0.7170999", "0.71671087", "0.7157013", "0.71533793", "0.71518576", "0.7114678", "0.7114678", "0.7111921", "0.7102409", "0.7084341", "0.7039229", "0.7031353", "0.70080656", "0.7003309", "0.6995707", "0.6969637", "0.6945251", "0.6937934", "0.6917275", "0.6892936", "0.6888015", "0.68784666", "0.6869863", "0.68531346", "0.6837192", "0.68351537", "0.6817601", "0.68040115", "0.6795648", "0.6793603", "0.6789879", "0.6771223", "0.6762531", "0.67485785", "0.6729312", "0.67293066", "0.6715714", "0.6710973", "0.6707032", "0.67043906", "0.67014176", "0.66866547", "0.6677441", "0.6666387", "0.6651671", "0.66437155", "0.66418236", "0.66316146", "0.66078657", "0.6569583", "0.65373296", "0.6536426", "0.65353703", "0.65324515", "0.65268725", "0.6520361", "0.6512369", "0.6510431", "0.6509155", "0.6507191", "0.6502693", "0.64829063", "0.6482883", "0.6482883", "0.64787835", "0.64739454", "0.6465847", "0.64577925", "0.6447656", "0.64396137", "0.64392966", "0.64374536", "0.64258975", "0.6408666", "0.64084846", "0.6396514", "0.63923794", "0.6392327", "0.6390004", "0.63795906", "0.6368345", "0.6366657", "0.6366657", "0.6363246" ]
0.72374773
11
The camera is already closed
@Override public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) { if (null == mCameraDevice) { return; } // Auto focus should be continuous for camera preview. mCaptureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE); // Finally, we start displaying the camera preview. mPreviewRequest = mCaptureRequestBuilder.build(); mPreviewCaptureSession = cameraCaptureSession; // preview is a video, so we set a repeating request try { mPreviewCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), mPreviewCaptureCallback, mBackgroundHandler); } catch (CameraAccessException e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void cameraClosed();", "public void closeCamera()\n {\n }", "private void closeCamera() {\n if (null != cameraDevice) {\n cameraDevice.close();\n cameraDevice = null;\n }\n if (null != imageReader) {\n imageReader.close();\n imageReader = null;\n }\n }", "private void closeCamera() {\n if (mCameraDevice != null) {\n mCameraDevice.close();\n mCameraDevice = null;\n }\n if (mIsRecording) {\n long elapsedMillis = SystemClock.elapsedRealtime() - mTimer.getBase();\n mTimer.stop();\n mTimer.setVisibility(View.GONE);\n scrollContents();\n mIsRecording = false;\n mRecordButton.setImageResource(R.drawable.ic_record_white);\n mMediaRecorder.stop();\n mMediaRecorder.reset();\n\n //Scan the file to appear in the device studio\n Intent mediaScannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);\n mediaScannerIntent.setData(Uri.fromFile(new File(mVideoFilePath)));\n sendBroadcast(mediaScannerIntent);\n\n logFirebaseVideoEvent(elapsedMillis);\n\n }\n if (mMediaRecorder != null) {\n mMediaRecorder.release();\n mMediaRecorder = null;\n }\n if (mAnimator != null && mAnimator.isStarted()) {\n mAnimator.cancel();\n }\n }", "protected void closeCamera() {\n try {\n mCameraOpenCloseLock.acquire();\n if (null != mCameraDevice) {\n mCameraDevice.close();\n mCameraDevice = null;\n }\n if (null != mMediaRecorder) {\n mMediaRecorder.release();\n mMediaRecorder = null;\n }\n } catch (InterruptedException e) {\n throw new RuntimeException(\"Interrupted while trying to lock camera closing.\");\n } finally {\n mCameraOpenCloseLock.release();\n }\n }", "void releaseCamera() {\n\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.release();\n }\n }", "private void releaseCamera() {\n if(camera != null) {\n camera.stopPreview();\n camera.release();\n camera = null;\n }\n }", "@Override\n protected void onPause() {\n ReleaseCamera();\n super.onPause();\n }", "public void releaseCamera()\n {\n\n if (mcCamera != null)\n {\n //stop the preview\n mcCamera.stopPreview();\n //release the camera\n mcCamera.release();\n //clear out the camera\n mcCamera = null;\n }\n }", "private void releaseCamera() {\n if (mCamera != null) {\n mCamera.release(); // release the camera for other applications\n mCamera = null;\n }\n }", "@Override\n protected void onPause() {\n closeCamera();\n\n stopBackgroundThread();\n super.onPause();\n }", "private void releaseCamera() {\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.release();\n mCamera = null;\n }\n }", "public void onStop() {\n super.onStop();\n this.mZxingview.stopCamera();\n }", "@Override\n protected void onPause() {\n super.onPause();\n releaseCamera();\n }", "public void onPause() {\n releaseCamera();\n }", "@Override\n public void onCameraPreviewStopped() {\n }", "private void releaseCamera() {\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.setPreviewCallback(null);\n mCamera.release();\n mCamera = null;\n }\n }", "private void releaseCamera() {\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.setPreviewCallback(null);\n mCamera.release();\n mCamera = null;\n }\n }", "private static void releaseCameraAndPreview() {\n if (cam != null) {\n cam.release();\n cam = null;\n }\n }", "public synchronized void closeDriver() {\n if (camera != null) {\n camera.getCamera().release();\n camera = null;\n }\n }", "@Override\n public void surfaceDestroyed(SurfaceHolder holder)\n {\n this.releaseCamera();\n }", "public void surfaceDestroyed(SurfaceHolder holder) {\n stopCamera();\n }", "public void stop(){\n if (mCamera != null){\n mCamera.stopPreview();\n mCamera.setPreviewCallback(null);\n mCamera.release();\n mCamera = null;\n }\n if (mHolder != null) {\n mHolder.getSurface().release();\n mHolder = null;\n }\n }", "public void closeDriver() {\n\t\tif (camera != null) {\n\t\t\tcamera.release();\n\t\t\tcamera = null;\n\t\t\tinitialized = false;\n\t\t}\n\t}", "@SuppressLint(\"NewApi\")\n public void onPause() {\n Log.d(TAG, \"onPause\");\n try {\n mCameraOpenCloseLock.acquire();\n if (null != mCameraDevice) {\n mCameraDevice.close();\n mCameraDevice = null;\n Log.d(TAG, \"CameraDevice Close\");\n }\n } catch (InterruptedException e) {\n throw new RuntimeException(\"Interrupted while trying to lock camera closing.\");\n } finally {\n mCameraOpenCloseLock.release();\n }\n }", "@Override\r\n\tpublic void surfaceDestroyed(SurfaceHolder holder) \r\n\t{\n\t\tmCamera.stopPreview();\r\n\t\tmCamera.release(); \r\n\t}", "@Override\r\n\tpublic void surfaceDestroyed(SurfaceHolder holder) {\n\t\tif(myCamera!=null){\r\n\t\t\tmyCamera.stopPreview();\r\n\t\t\tmyCamera.release();//釋放相機\r\n\t\t\tmyCamera=null;\r\n\t\t}\r\n\t}", "protected static void stopInternalCamera() {\n if (internalCamera != null) {\n internalCamera.stopStreaming();\n internalCamera.closeCameraDevice();\n }\n }", "@Override\n public void onDisconnected(CameraDevice camera) {\n Log.e(TAG, \"onDisconnected\");\n }", "public final void destroy(){\n stop();\n LIBRARY.CLEyeDestroyCamera(camera_);\n camera_ = null;\n PS3_LIST_.remove(this);\n }", "public void end()\r\n\t{\n\t\ttry{\r\n\t\tNIVision.IMAQdxStopAcquisition(curCam);\n\t\t}\n\t\tcatch(Exception e){\n\t\t\t\n\t\t}\r\n\t}", "public void stop() {\n\n\t\tif (!started.compareAndSet(true, false)) {\n\t\t\treturn;\n\t\t}\n\n\t\tLOG.debug(\"Stopping panel rendering and closing attached webcam\");\n\n\t\tupdater.stop();\n\t\tupdater = null;\n\n\t\timage = null;\n\n\t\ttry {\n\t\t\terrored = !webcam.close();\n\t\t} catch (WebcamException e) {\n\n\t\t\terrored = true;\n\n\t\t\tDisplay.getDefault().syncExec(new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tredraw();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthrow e;\n\t\t}\n\t}", "@Override\n public void onClick(View v) {\n int camerasNumber = Camera.getNumberOfCameras();\n if (camerasNumber > 1) {\n //release the old camera instance\n //switch camera, from the front and the back and vice versa\n\n releaseCamera();\n chooseCamera();\n } else {\n\n }\n }", "@Override\n protected void onPause() {\n super.onPause();\n if (theCamera != null){\n theCamera.stopPreview();\n theCamera.release();\n theCamera = null;\n }\n }", "@Override\n\tpublic void onCameraViewStopped() {\n\n\t}", "@Override\n public void stopCamera() {\n super.stopCamera();\n\n if(cameraListener != null)\n cameraListener.onCameraStop();\n }", "@Override\n public void windowClosing(WindowEvent e) {\n new Thread(new Runnable() {\n public void run() {\n pcu.setDone();\n camera.getDriver().cleanUp();\n frame.setVisible(false);\n frame.dispose();\n }\n }).start();\n }", "@Override // com.master.cameralibrary.CameraViewImpl\n public void stop() {\n Camera camera = this.mCamera;\n if (camera != null) {\n camera.stopPreview();\n }\n this.mShowingPreview = false;\n releaseCamera();\n }", "@Override\n\t\t\tpublic void surfaceDestroyed(SurfaceHolder holder) {\n\t\t\t\tif (mCamera != null) {\n\t\t\t\t\tmCamera.stopPreview();\t\t\t\t\t\t\t\t\t\t//Stop the preview \n\t\t\t\t}\n\t\t\t}", "@Override\n\tprotected void onPause() {\n\t\tsuper.onPause();\n\t\treleaseCamera();\n\t}", "public void surfaceDestroyed(SurfaceHolder holder) {\n camera.stopPreview();\n camera.release();\n camera = null;\n previewing = false;\n }", "@Override\n public void onPause() {\n mCameraView.stop();\n super.onPause();\n }", "@Override\n\tprotected void onDestroy() {\n\t\tsuper.onDestroy();\n\t\t//\t\tLog.e(\"destroy\", \"CameraActivity �׾�Ф�\");\n\t\t//\t\tsendMessage(\"exit\");\n\t\t//\t\tmodeEasyActivity.finish();\n\t}", "public void surfaceDestroyed(SurfaceHolder holder) {\n camera.stopPreview();\n camera.release();\n camera = null;\n }", "public void destroy(){\n Log.d(TAG, \"onDestroy called\");\n runRunnable = false;\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.release();\n mCamera = null;\n }\n isPaused = true;\n // TODO stop executorService\n\n //executor.shutdown();\n cameraThread.stop();\n\n }", "@Override\n public void onClick(View v) {\n if (camera != null && previewing) {\n camera.stopPreview();\n camera.release();\n camera = null;\n\n previewing = false;\n }\n }", "private void stopAcquisition() {\r\n if (this.timer != null && !this.timer.isShutdown()) {\r\n try {\r\n // stop the timer\r\n this.timer.shutdown();\r\n this.timer.awaitTermination(33, TimeUnit.MILLISECONDS);\r\n } catch (InterruptedException e) {\r\n // log any exception\r\n System.err.println(\"Exception in stopping the frame capture, trying to close the video now... \" + e);\r\n }\r\n }\r\n\r\n if (this.capture.isOpened()) {\r\n // release the camera\r\n this.capture.release();\r\n }\r\n }", "private void stopAcquisition() {\n if (this.timer != null && !this.timer.isShutdown()) {\n try {\n // stop the timer\n this.timer.shutdown();\n this.timer.awaitTermination(33, TimeUnit.MILLISECONDS);\n } catch (InterruptedException e) {\n // log any exception\n System.err.println(\"Exception in stopping the frame capture, trying to release the camera now... \" + e);\n }\n }\n\n if (this.capture.isOpened()) {\n // release the camera\n this.capture.release();\n }\n }", "void closeVideo();", "@Override\n public void onCanceled(EasyImage.ImageSource source) {\n if (source == EasyImage.ImageSource.CAMERA) {\n File photoFile = EasyImage.lastlyTakenButCanceledPhoto(MainActivity.this);\n if (photoFile != null) photoFile.delete();\n }\n }", "@Override\n protected void onDestroy() {\n super.onDestroy();\n Log.d(TAG, \"onDestroy\");\n// mPhotoLoader.stop();\n if (mMatrixCursor != null)\n mMatrixCursor.close();\n }", "@Override\n\t\tpublic void surfaceDestroyed(SurfaceHolder holder) {\n\t\t\tif (DEBUG>=2) Log.d(TAG, \"surfaceDestroyed'd\");\n\n\t\t\t// Surface will be destroyed when we return, so stop the preview.\n\t\t\t// Because the CameraDevice object is not a shared resource, it's\n\t\t\t// very important to release it when the activity is paused.\n\t\t\tif (mCamera != null) {\n\t\t\t\tSHOWING_PREVIEW = false;\n\t\t\t\tmCamera.stopPreview();\n\t\t\t}\n\n\t\t\t//Log.d(TAG, \"surfaceDestroyed'd finish\");\n\t\t}", "private void checkCameraBeforeOpen() {\n // First get the back up camera\n List<String> backUpPreviewCamera = mCameraIdManager.getBackUpPreviewCameraId();\n // Second,get the remote camera and filter is connect camera\n LinkedHashMap<String, IRemoteDevice> remoteConnectedCamera = mIMultiCameraDeviceAdapter\n .queryRemoteDevices();\n // key-value is cameraId-deviceId\n LinkedHashMap<String, String> deviceId = mCameraIdManager.getDeviceId();\n List<String> deleteItem = new ArrayList<String>();\n int status = IMultiCameraDeviceAdapter.REMOTE_CAEMRA_STATUS_UNKNOWN;\n LogHelper.d(TAG, \"[checkCameraBeforeOpen],before check camera, the camera id :\"\n + backUpPreviewCamera);\n // back up camera maybe not equals remote camera,such as pause camera\n // and disconnect remote camera from cross mount setting.\n for (String needOpenCamera : mCameraIdManager.getDeviceId().keySet()) {\n if (!MultiCameraModuleUtil.isLocalCamera(needOpenCamera)) {\n if (remoteConnectedCamera.size() == 0) {\n deleteItem.add(needOpenCamera);\n } else {\n // get the device id according camera id from mDeviceId\n String needCheckdeviceId = deviceId.get(needOpenCamera);\n IRemoteDevice device = remoteConnectedCamera.get(needCheckdeviceId);\n if (device != null) {\n status = device.get(IRemoteDevice.KEY_REMOTE_SERVICE_STATUS);\n }\n // If the remote camera status is not connected,need remove it.\n if (IMultiCameraDeviceAdapter.REMOTE_CAEMRA_STATUS_CONNECTED != status) {\n deleteItem.add(needOpenCamera);\n }\n }\n }\n }\n // Update the back up preview camera id and update the camera id.\n for (String cameraId : deleteItem) {\n backUpPreviewCamera.remove(cameraId);\n updateCameraBeforeOpened(false, cameraId, null);\n }\n // if the camera id is null,need add the local camera into the preview list\n if (backUpPreviewCamera.size() == 0) {\n backUpPreviewCamera.add(mCameraId);\n updateCameraBeforeOpened(true, mCameraId, mLocalDeviceIdKeyPref + mCameraId);\n }\n\n LogHelper.d(TAG, \"[checkCameraBeforeOpen],after check camera, the camera id :\"\n + backUpPreviewCamera);\n }", "@Override\n\t\t\t\tpublic void onError(int error, Camera camera) {\n\t\t\t\t\tif (error == Camera.CAMERA_ERROR_SERVER_DIED) {\n\t\t\t\t\t\t// In this case the application must release the camera and instantiate a new one\n\t\t\t\t\t\tLog.e(TAG,\"Media server died !\");\n\t\t\t\t\t\t// We don't know in what thread we are so stop needs to be synchronized\n\t\t\t\t\t\tmCameraOpenedManually = false;\n\t\t\t\t\t\tstop();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tLog.e(TAG,\"Error unknown with the camera: \"+error);\n\t\t\t\t\t}\n\t\t\t\t}", "protected void close()\n {\n stopped = true;\n }", "@Override\n public void onPause() {\n super.onPause();\n zXingScannerView.stopCamera();\n }", "private void shutdown() {\n mMediaRecorder.reset();\n mMediaRecorder.release();\n mCamera.release();\n\n // once the objects have been released they can't be reused\n mMediaRecorder = null;\n mCamera = null;\n }", "public void getCameraInstance() {\n newOpenCamera();\n }", "@Override\r\n protected void onDestroy() {\n \r\n \r\n \r\n if(DJIDrone.getDjiCamera() != null)\r\n DJIDrone.getDjiCamera().setReceivedVideoDataCallBack(null);\r\n mDjiGLSurfaceView.destroy();\r\n super.onDestroy();\r\n }", "public void stopPreview() {\n\t\tif (autoFocusManager != null) {\n\t\t\tautoFocusManager.stop();\n\t\t\tautoFocusManager = null;\n\t\t}\n\t\tif (camera != null && previewing) {\n//\t\t\tLog.d(TAG, \"stopPreview\");\n\t\t\tcamera.stopPreview();\n//\t\t\tpreviewCallback.setHandler(null, 0);\n\t\t\tpreviewing = false;\n\t\t}\n\t\t\n\t}", "@Override\n\tpublic void onDestroy() {\n\t\t\n\t\tLog.d(TAG,\"onDestroy\");\n\t\tif(mCameraDevices!=null){\n\t\t\tmCameraDevices.release();\n\t\t}\n\t\tshowFloatTool(false);\n\t\tsuper.onDestroy();\n\t}", "public void obtainCameraOrFinish() {\n mCamera = getCameraInstance();\n if (mCamera == null) {\n Toast.makeText(VideoCapture.getSelf(), \"Fail to get Camera\", Toast.LENGTH_LONG).show();\n VideoCapture.getSelf().finish();\n }\n }", "@Override\r\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tmVideoContrl.closeMediaControl();\r\n\r\n\t\t\t\t\t}", "@Override\n public void onCameraOpenFailed(Exception e) {\n }", "public void surfaceDestroyed(SurfaceHolder holder) {\n \tif(CameraActivity.mCamera == null) return; \n \tCameraActivity.mCamera.release();\n \tCameraActivity.mCamera = null;\n }", "public void releaseCameraAndPreview() {\n if (mCameraActivity.mCamera != null) {\n mCameraActivity.mCamera.setPreviewCallback(null);\n mCameraActivity.mCamera.stopPreview();\n mImageCapture.mSurfaceHolder.removeCallback(mCameraPreview);\n mCameraPreview.surfaceDestroyed(mImageCapture.mSurfaceHolder);\n mSurfaceHolder.getSurface().release();\n mSurfaceHolder = null;\n releaseCamera();\n }\n }", "@Override\n\tpublic void surfaceDestroyed(SurfaceHolder holder) {\n\t\tLog.e(TAG, \"Surface Destroyed\");\n\t\tcamera.stopPreview();\n\t\tmPreviewRunning = false;\n\t\tcamera.release();\n\t\tcamera = null;\n\t}", "public void surfaceDestroyed(SurfaceHolder holder) {\n\t\tif(camera != null){\r\n\t\t\tcamera.stopPreview();\r\n\t\t\tcamera.release();\r\n\t\t\tcamera = null;\r\n\t\t}\r\n\t}", "private void oldOpenCamera() {\n try {\n mCamera = Camera.open(); // attempt to get a Camera instance\n mCamera.setPreviewCallbackWithBuffer(this);\n Log.i(TAG, \"Instance created\");\n } catch (Exception e) {\n Log.e(TAG, \"Error getting Camera instance: \" + e.getMessage());\n }\n }", "@Override // com.master.cameralibrary.CameraViewImpl\n public boolean isCameraOpened() {\n return this.mCamera != null;\n }", "public int cameraOff() {\r\n System.out.println(\"hw- desligarCamera\");\r\n return serialPort.enviaDados(\"!111F*\"); //camera OFF\r\n }", "@Override\n public void surfaceDestroyed(SurfaceHolder holder) {\n stopPreview();\n }", "void onCameraError();", "public void stop() {\n synchronized (mLock) {\n //if (!mRunning)\n //{\n // throw new IllegalStateException(\"CameraStreamer is already stopped\");\n //} // if\n \t\n \tLog.d(TAG, \"Stop\");\n \t\n mRunning = false;\n if (mMJpegHttpStreamer != null) {\n mMJpegHttpStreamer.stop();\n mMJpegHttpStreamer = null;\n } // if\n \n if (mCamera != null) {\n mCamera.release();\n mCamera = null;\n } // if\n } // synchronized\n mLooper.quit();\n }", "@Override\n public void run() {\n mySurfaceView.setVisibility(View.GONE);\n qrEader.stop();\n\n\n }", "public void openCamera() {\n \n\n }", "public boolean hideCamera() {\n return false;\n }", "public boolean hideCamera() {\n return false;\n }", "public Camera() {\n\t\treset();\n\t}", "@Override\n public void onClick(DialogInterface dialog, int which) {\n FrontCameraVerificationActivity.this.finish();\n }", "private void end() {\r\n isRunning = false;\r\n if( mineField.exploder.isRunning() ) mineField.exploder.stop();\r\n if( settingsOpen ) settingsFrame.dispose();\r\n }", "public native final void stopPreview();", "public void closeFrame() {\n framesize = wordpointer = bitindex = -1;\n }", "@Override\n\tpublic void close() {\n\t\tframe = null;\n\t\tclassic = null;\n\t\trace = null;\n\t\tbuild = null;\n\t\tbt_classic = null;\n\t\tbt_race = null;\n\t\tbt_build = null;\n\t\tGameView.VIEW.removeDialog();\n\t}", "public void onCameraOpened() {\n openCameraCommon();\n initializeControlByIntent();\n new Thread() {\n public void run() {\n try {\n Thread.sleep(500);\n PhotoModule.this.mIsCameraOpened = true;\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }.start();\n }", "public void surfaceDestroyed(SurfaceHolder holder) {\n mCamera.stopPreview();\n mCamera.release();\n mHolder.removeCallback(mPreview);\n preview = false;\n }", "@Override public void close() {\n\t\tthis.timer.cancel();\n\t\tthis.motionStream.removeListener(this);\n\t}", "@Override\r\n\t\tpublic void surfaceDestroyed(SurfaceHolder arg0) {\n\t\t\tIsRunning = false;\r\n\t\t}", "public void close(){\n \tisClosed = true;\n \tClawAct.set(true);\n\t\tRobot.oi.armRumble(RUMBLE_DURATION);\n }", "public void closeImage() {\n\n\t}", "@Override\n public void onCanceled(EasyImage.ImageSource source, int type) {\n if (source == EasyImage.ImageSource.CAMERA) {\n File photoFile = EasyImage.lastlyTakenButCanceledPhoto(MainActivity.this);\n if (photoFile != null) photoFile.delete();\n }\n }", "@Override\n public void onDisconnect(final UsbDevice device, final UsbControlBlock ctrlBlock) {\n if (mUVCCamera != null) {\n mUVCCamera.close();\n if (mPreviewSurface != null) {\n mPreviewSurface.release();\n mPreviewSurface = null;\n }\n }\n }", "@Override\n public void onClick(View arg0) {\n Intent i = new Intent(mContext, AddCameraThirdActivity.class);\n startActivity(i);\n finish();//@@8.10\n }", "public boolean canDismissWithTouchOutside() {\n return this.cameraOpened ^ 1;\n }", "@Override\n public void onOpened(CameraDevice cameraDevice) {\n mCameraOpenCloseLock.release();\n mCameraDevice = cameraDevice;\n createCameraPreviewSession();\n }", "@Override\n public void stop() throws Exception {\n mapView.dispose();\n map.dispose();\n System.exit(0);\n\n }", "@Override\n protected void onDestroy() {\n Bimp.tempSelectBitmap.clear();\n Bimp.max = 0;\n super.onDestroy();\n Constants.removeActivity(this);\n }", "public void closeGrabber() {\n grabberServo.setPosition(GRABBER_CLOSE);\n isGrab = false;\n }", "public void surfaceDestroyed(SurfaceHolder holder) {\n if (mCamera != null) {\n mCamera.setPreviewCallback(null);\n mCamera.stopPreview();\n mCamera.release();\n }\n mCamera = null;\n }", "@Override\n protected void onDestroy() {\n \tsuper.onDestroy();\n \tmActivities.removeActivity(\"AddCamera\");\n \tunregisterReceiver(receiver);\n }", "public void deactivate() {\n\t\tcameraNXT.enableTracking(false);\n\t}" ]
[ "0.819081", "0.80881274", "0.7260934", "0.7144884", "0.7136317", "0.7016478", "0.68920213", "0.68624574", "0.6841933", "0.6812349", "0.68049127", "0.67768633", "0.67685986", "0.674063", "0.66460407", "0.6603918", "0.6600197", "0.6600197", "0.6600033", "0.65916586", "0.65903795", "0.6564473", "0.65279543", "0.6526591", "0.6518447", "0.6476769", "0.64725345", "0.6454674", "0.6440186", "0.6426116", "0.64211875", "0.6408823", "0.6381997", "0.63772935", "0.63224244", "0.6316986", "0.63151515", "0.6314943", "0.63110447", "0.63093525", "0.6301668", "0.62920076", "0.62697035", "0.62569", "0.62545025", "0.6253917", "0.6249693", "0.62377644", "0.62345976", "0.6231464", "0.6213723", "0.61777276", "0.6174347", "0.6169776", "0.61599153", "0.61436385", "0.6140526", "0.61395156", "0.6116788", "0.61021703", "0.6099802", "0.60944635", "0.60927874", "0.60893375", "0.6057748", "0.60471934", "0.60381305", "0.60359216", "0.6031963", "0.60292304", "0.60257643", "0.6014675", "0.60048544", "0.60046744", "0.5994691", "0.5980291", "0.5979896", "0.5979896", "0.5968691", "0.5948731", "0.59459424", "0.59437674", "0.5941802", "0.5904438", "0.5897853", "0.5896336", "0.588362", "0.588242", "0.5877413", "0.5873143", "0.58545095", "0.5852079", "0.5841447", "0.58355254", "0.58343416", "0.583124", "0.58303636", "0.58284575", "0.5819756", "0.5818154", "0.58180344" ]
0.0
-1
Check for permissions and start video recording.
public void startVideoRecording() { try { mVideoFileTest = createVideoFile(mVideoFolder); } catch (IOException e) { e.printStackTrace(); } // set up Recorder try { setupMediaRecorder(); } catch (IOException e) { e.printStackTrace(); } // prepare for recording sendVideoRecordingRequest(); // start recording mMediaRecorder.start(); if (mRokidCameraRecordingListener != null) { mRokidCameraRecordingListener.onRokidCameraRecordingStarted(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void startVideoRecording() {\n this.mActivity.getCameraAppUI().switchShutterSlidingAbility(false);\n if (this.mCameraState == 1) {\n setCameraState(2);\n Tag tag = TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"startVideoRecording: \");\n stringBuilder.append(Thread.currentThread());\n Log.i(tag, stringBuilder.toString());\n ToastUtil.showToast(this.mActivity, this.mActivity.getString(R.string.video_recording_start_toast), 0);\n this.mAppController.onVideoRecordingStarted();\n if (this.mModeSelectionLockToken == null) {\n this.mModeSelectionLockToken = this.mAppController.lockModuleSelection();\n }\n this.mUI.showVideoRecordingHints(false);\n this.mUI.cancelAnimations();\n this.mUI.setSwipingEnabled(false);\n this.mUI.showFocusUI(false);\n this.mAppController.getCameraAppUI().hideRotateButton();\n this.mAppController.getButtonManager().hideEffectsContainerWrapper();\n final long updateStorageSpaceTime = System.currentTimeMillis();\n this.mActivity.updateStorageSpaceAndHint(new OnStorageUpdateDoneListener() {\n public void onStorageUpdateDone(long bytes) {\n Tag access$100 = VideoModule.TAG;\n StringBuilder stringBuilder = new StringBuilder();\n stringBuilder.append(\"updateStorageSpaceAndHint cost time :\");\n stringBuilder.append(System.currentTimeMillis() - updateStorageSpaceTime);\n stringBuilder.append(\"ms.\");\n Log.d(access$100, stringBuilder.toString());\n if (VideoModule.this.mCameraState != 2) {\n VideoModule.this.pendingRecordFailed();\n return;\n }\n if (bytes <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {\n Log.w(VideoModule.TAG, \"Storage issue, ignore the start request\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mCameraDevice == null) {\n Log.v(VideoModule.TAG, \"in storage callback after camera closed\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mPaused) {\n Log.v(VideoModule.TAG, \"in storage callback after module paused\");\n VideoModule.this.pendingRecordFailed();\n } else if (VideoModule.this.mMediaRecorderRecording) {\n Log.v(VideoModule.TAG, \"in storage callback after recording started\");\n } else if (VideoModule.this.isSupported(VideoModule.this.mProfile.videoFrameWidth, VideoModule.this.mProfile.videoFrameHeight)) {\n VideoModule.this.mCurrentVideoUri = null;\n VideoModule.this.mCameraDevice.enableShutterSound(false);\n if (VideoModule.this.mNeedGLRender && VideoModule.this.isSupportEffects()) {\n VideoModule.this.playVideoSound();\n VideoModule.this.initGlRecorder();\n VideoModule.this.pauseAudioPlayback();\n VideoModule.this.mActivity.getCameraAppUI().startVideoRecorder();\n } else {\n VideoModule.this.initializeRecorder();\n if (VideoModule.this.mMediaRecorder == null) {\n Log.e(VideoModule.TAG, \"Fail to initialize media recorder\");\n VideoModule.this.pendingRecordFailed();\n return;\n }\n VideoModule.this.pauseAudioPlayback();\n try {\n long mediarecorderStart = System.currentTimeMillis();\n VideoModule.this.mMediaRecorder.start();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder2 = new StringBuilder();\n stringBuilder2.append(\"mMediaRecorder.start() cost time : \");\n stringBuilder2.append(System.currentTimeMillis() - mediarecorderStart);\n Log.d(access$100, stringBuilder2.toString());\n VideoModule.this.playVideoSound();\n VideoModule.this.mCameraDevice.refreshSettings();\n VideoModule.this.mCameraSettings = VideoModule.this.mCameraDevice.getSettings();\n VideoModule.this.setFocusParameters();\n } catch (RuntimeException e) {\n Log.e(VideoModule.TAG, \"Could not start media recorder. \", e);\n VideoModule.this.releaseMediaRecorder();\n VideoModule.this.mCameraDevice.lock();\n VideoModule.this.releaseAudioFocus();\n if (VideoModule.this.mModeSelectionLockToken != null) {\n VideoModule.this.mAppController.unlockModuleSelection(VideoModule.this.mModeSelectionLockToken);\n }\n VideoModule.this.setCameraState(1);\n if (VideoModule.this.shouldHoldRecorderForSecond()) {\n VideoModule.this.mAppController.setShutterEnabled(true);\n }\n VideoModule.this.mAppController.getCameraAppUI().showModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(true);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.onVideoRecordingStop();\n }\n ToastUtil.showToast(VideoModule.this.mActivity.getApplicationContext(), (int) R.string.video_record_start_failed, 0);\n return;\n }\n }\n VideoModule.this.mAppController.getCameraAppUI().setSwipeEnabled(false);\n VideoModule.this.setCameraState(3);\n VideoModule.this.tryLockFocus();\n VideoModule.this.mMediaRecorderRecording = true;\n VideoModule.this.mActivity.lockOrientation();\n VideoModule.this.mRecordingStartTime = SystemClock.uptimeMillis() + 600;\n VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().setAngle(VideoModule.this.mOrientation);\n VideoModule.this.mAppController.getCameraAppUI().hideModeOptions();\n if (VideoModule.this.updateModeSwitchUIinModule()) {\n VideoModule.this.mAppController.getCameraAppUI().setModeSwitchUIVisibility(false);\n }\n if (VideoModule.this.isVideoShutterAnimationEnssential()) {\n VideoModule.this.mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);\n }\n if (VideoModule.this.isNeedStartRecordingOnSwitching()) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoCaptureButton(true);\n }\n if (VideoModule.this.mAppController.getCameraAppUI().getCurrentModeIndex() == VideoModule.this.mActivity.getResources().getInteger(R.integer.camera_mode_video)) {\n VideoModule.this.mAppController.getCameraAppUI().showVideoPauseButton(false);\n }\n VideoModule.this.mUI.showRecordingUI(true);\n if (VideoModule.this.mAppController.getCameraAppUI().getCameraGLSurfaceView().getVisibility() == 0) {\n VideoModule.this.mUI.hideCapButton();\n }\n VideoModule.this.showBoomKeyTip();\n VideoModule.this.updateRecordingTime();\n access$100 = VideoModule.TAG;\n StringBuilder stringBuilder3 = new StringBuilder();\n stringBuilder3.append(\"startVideoRecording cost time 1 : \");\n stringBuilder3.append(System.currentTimeMillis() - VideoModule.this.mShutterButtonClickTime);\n Log.d(access$100, stringBuilder3.toString());\n if (VideoModule.this.isSendMsgEnableShutterButton()) {\n VideoModule.this.mHandler.sendEmptyMessageDelayed(6, VideoModule.MIN_VIDEO_RECODER_DURATION);\n }\n VideoModule.this.mActivity.enableKeepScreenOn(true);\n VideoModule.this.mActivity.startInnerStorageChecking(new OnInnerStorageLowListener() {\n public void onInnerStorageLow(long bytes) {\n VideoModule.this.mActivity.stopInnerStorageChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_storage_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n VideoModule.this.mActivity.startBatteryInfoChecking(new OnBatteryLowListener() {\n public void onBatteryLow(int level) {\n VideoModule.this.mActivity.stopBatteryInfoChecking();\n if (VideoModule.this.mCameraState == 3) {\n VideoModule.this.showQuitDialog(R.string.quit_dialog_title_battery_low, R.string.quit_dialog_msg, VideoModule.this.saveAndQuit);\n }\n }\n });\n } else {\n Log.e(VideoModule.TAG, \"Unsupported parameters\");\n VideoModule.this.pendingRecordFailed();\n }\n }\n });\n }\n }", "private void checkPermission(){\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},\n MY_READ_EXTERNAL_STORAGE);\n }else{\n playVideoWithIntent();\n }\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n private void checkWriteStoragePermission() throws IOException {\n if (mIsTimelapse) {\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n\n\n if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {\n mIsTimelapse = true;\n mRecordImageButton.setImageResource(R.mipmap.btn_timelapse);\n createVideoFileName();\n startRecord();\n mMediaRecorder.start();\n //Toast.makeText(getApplicationContext(), \"Recording Timelapse\", Toast.LENGTH_SHORT).show();\n mChronometer.setBase(SystemClock.elapsedRealtime());\n mChronometer.setVisibility(View.VISIBLE);\n mChronometer.start();\n\n\n } else {\n if (shouldShowRequestPermissionRationale(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n Toast.makeText(this, \"app needs to be able to save videos\", Toast.LENGTH_SHORT).show();\n\n }\n requestPermissions(new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_WRITE_EXTERNAL_STORAGE_PERMISSION_RESULT);\n }\n } else {\n mIsRecording = true;\n mRecordImageButton.setImageResource(R.mipmap.btn_timelapse);\n try {\n createVideoFileName();\n } catch (IOException e) {\n e.printStackTrace();\n }\n startRecord();\n mMediaRecorder.start();\n mChronometer.setBase(SystemClock.elapsedRealtime());\n mChronometer.setVisibility(View.VISIBLE);\n mChronometer.start();\n }\n\n } else {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n\n if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {\n mIsRecording = true;\n mRecordImageButton.setImageResource(R.mipmap.vidpicbusy);\n\n try {\n createVideoFileName();\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n startRecord();\n\n mMediaRecorder.start();\n Toast.makeText(this, \"Recording Video\", Toast.LENGTH_SHORT).show();\n mChronometer.setBase(SystemClock.elapsedRealtime());\n mChronometer.setVisibility(View.VISIBLE);\n mChronometer.start();\n } else {\n //Toast.makeText(this, \"Permission to write is not granted\", Toast.LENGTH_SHORT).show();\n if (shouldShowRequestPermissionRationale(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n Toast.makeText(this, \"app needs to be able to save videos\", Toast.LENGTH_SHORT).show();\n\n\n }\n requestPermissions(new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_WRITE_EXTERNAL_STORAGE_PERMISSION_RESULT);\n }\n } else {\n mIsRecording = true;\n mRecordImageButton.setImageResource(R.mipmap.vidpicbusy);\n try {\n createVideoFileName();\n } catch (IOException e) {\n e.printStackTrace();\n }\n startRecord();\n mMediaRecorder.start();\n mChronometer.setBase(SystemClock.elapsedRealtime());\n mChronometer.setVisibility(View.VISIBLE);\n mChronometer.start();\n\n }\n\n }\n }", "private void startCapture() {\n if (checkAudioPermissions()) {\n requestScreenCapture();\n }\n }", "private void checkPermission() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED) {\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this)\n .setMessage(getString(R.string.can_not_handle_calls))\n .setCancelable(false)\n .setPositiveButton(R.string.text_ok, (dialog, id) -> {\n requestPermission();\n });\n\n builder.create().show();\n } else {\n presenter.gotPermissions = true;\n }\n }", "private void checkRuntimePermisson(boolean flag) {\n try {\n int hasRecordAudioPermission = 0;\n int hasWriteExternalStoragePermission = 0;\n if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {\n hasWriteExternalStoragePermission = getActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);\n hasRecordAudioPermission = getActivity().checkSelfPermission(Manifest.permission.RECORD_AUDIO);\n if (hasWriteExternalStoragePermission != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CODE_ASK_PERMISSIONS_STORAGE);\n return;\n } else if (hasRecordAudioPermission != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO},\n REQUEST_CODE_ASK_PERMISSIONS_RECORD_AUDIO);\n return;\n }\n }\n if (flag) {\n intializeRecorder();\n }\n } catch (Exception e) {\n logException(e, \"MicManualFragment_checkRuntimePermisson()\");\n }\n\n }", "@Override\n public void onPermissionRequest(final PermissionRequest request) {\n Log.i(TAG, \"onPermissionRequest\");\n mPermissionRequest = request;\n final String[] requestedResources = request.getResources();\n for (String r : requestedResources) {\n if (r.equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) {\n // In this sample, we only accept video capture request.\n AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(TestActivity.this)\n .setTitle(\"Allow Permission to camera\")\n .setPositiveButton(\"Allow\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n mPermissionRequest.grant(new String[]{PermissionRequest.RESOURCE_VIDEO_CAPTURE});\n Log.d(TAG,\"Granted\");\n }\n })\n .setNegativeButton(\"Deny\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n mPermissionRequest.deny();\n Log.d(TAG,\"Denied\");\n }\n });\n AlertDialog alertDialog = alertDialogBuilder.create();\n alertDialog.show();\n\n break;\n }\n }\n }", "private void RequestPermissions() {\n ActivityCompat.requestPermissions(MainActivity.this, new String[]{RECORD_AUDIO, WRITE_EXTERNAL_STORAGE}, REQUEST_AUDIO_PERMISSION_CODE);\r\n }", "public void verifyPermission() {\n Permissions.check(this/*context*/, Manifest.permission.WRITE_EXTERNAL_STORAGE, null, new PermissionHandler() {\n @Override\n public void onGranted() {\n addVideoInFolder();\n setupExoPlayer();\n settingListener();\n }\n\n @Override\n public void onDenied(Context context, ArrayList<String> deniedPermissions) {\n super.onDenied(context, deniedPermissions);\n verifyPermission();\n }\n });\n\n }", "private void videoRecordingPrepared() {\n Log.d(\"Camera\", \"videoRecordingPrepared()\");\n isCameraXHandling = false;\n // Keep disabled status for a while to avoid fast click error with \"Muxer stop failed!\".\n binding.capture.postDelayed(() -> binding.capture.setEnabled(true), 500);\n }", "public void recordVideo() {\n\n }", "private void requestCameraPermission() {\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {\n Toast.makeText(this, \"No Permissions\" , Toast.LENGTH_LONG).show();\n ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO}, 0);\n }\n else\n {\n Toast.makeText(this, \"Has Permissions\" , Toast.LENGTH_LONG).show();\n }\n }", "@Override\n public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {\n if(requestCode == RECORD_AUDIO_PERMISSION){\n\n //If permission is granted\n if(grantResults.length >0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){\n\n //Displaying a toast\n Toast.makeText(this,\"Permission granted now you can record audio \",Toast.LENGTH_LONG).show();\n }else{\n //Displaying another toast if permission is not granted\n Toast.makeText(this,\"Oops you just denied the permission\",Toast.LENGTH_LONG).show();\n }\n }\n }", "public void checkPermission() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) +\n ContextCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS)\n != PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(this, perms, permsRequestCode);\n permissionGranted = false;\n } else {\n permissionGranted = true;\n }\n }", "private void requestPermission() {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) !=\n PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(this, new String[]{\n Manifest.permission.CAMERA}, 1);\n //if not permitted by the user ,send a message to the user to get the right\n } else {\n opencamera();\n //if permitted by the user already ,then start open the camera directly\n }\n }", "public void startRecording() {\n // prepare the recorder\n if (!prepareMediaRecorder()) {\n Toast.makeText(VideoCapture.getSelf(), \"Fail in prepareMediaRecorder()!\\n - Ended -\",\n Toast.LENGTH_LONG).show();\n VideoCapture.getSelf().finish();\n }\n\n // start the recording\n mediaRecorder.start();\n mIsRecording = true;\n\n // start snapshots\n mSnapshotSensor.startSnapshot();\n }", "void configure_permissions() {\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(new String[]{Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}\n , 10);\n }\n return;\n }\n }", "public boolean checkPermissionToRecordAudio(Activity context, Fragment fragment) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n if (ContextCompat.checkSelfPermission(context, Manifest.permission.RECORD_AUDIO)\n == PackageManager.PERMISSION_GRANTED\n && ContextCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED\n && ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED) {\n return true;\n } else {\n if (fragment != null)\n fragment.requestPermissions(new String[]{\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.RECORD_AUDIO,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n Constants.RECORD_AUDIO_REQUEST_CODE);\n else\n ActivityCompat.requestPermissions(context,\n new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.RECORD_AUDIO,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n Constants.RECORD_AUDIO_REQUEST_CODE);\n }\n }else {\n return true ;\n }\n return false;\n }", "public void requestPermissionsIfNeeded() {\n ArrayList<String> requiredPermissions = new ArrayList<String>();\n checkIfPermissionGranted(requiredPermissions, Manifest.permission.WRITE_EXTERNAL_STORAGE);\n checkIfPermissionGranted(requiredPermissions, Manifest.permission.CAMERA);\n\n if(requiredPermissions.size() > 0) {\n // Request Permissions Now\n ActivityCompat.requestPermissions(activity,\n requiredPermissions.toArray(new String[requiredPermissions.size()]),\n Constants.REQUEST_PERMISSIONS);\n }\n }", "@Override\n public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {\n super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n\n //Depending on whether the request is audio or picture, attempt to grant request\n switch (requestCode) {\n case REQUEST_RECORD_AUDIO_PERMISSION:\n permissionToRecordAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;\n break;\n case CAMERA_REQUEST:\n if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n Toast.makeText(this, \"camera permission granted\", Toast.LENGTH_LONG).show();\n } else {\n Toast.makeText(this, \"camera permission denied\", Toast.LENGTH_LONG).show();\n }\n break;\n }\n\n //If permission to record is denied, close request.\n if (!permissionToRecordAccepted) {\n\n finish();\n }\n }", "private void checkPermissions() {\n // if permissions are not granted for camera, and external storage, request for them\n if ((ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) ||\n (ActivityCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED)) {\n ActivityCompat.\n requestPermissions(this,\n new String[]{Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_CODE_CAMERA_PERMISSION);\n\n }\n }", "@Override\n public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {\n super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n switch (requestCode) {\n\n case MicrophoneHelper.REQUEST_PERMISSION: {\n if (grantResults.length > 0 && grantResults[0] != PackageManager.PERMISSION_GRANTED) {\n Toast.makeText(this, \"Permission to record audio denied\", Toast.LENGTH_SHORT).show();\n }\n }\n }\n\n }", "boolean isLocalVideoAllowed(Call call);", "public boolean CheckPermissions() {\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED;\r\n }", "@NeedsPermission(Manifest.permission.CAMERA)\n void canGo() {\n }", "private void requestCameraPermission(){\n requestPermissions(cameraPermissions, CAMERA_REQUESTED_CODE);\n }", "private void requestCameraPermission() {\r\n Dexter.withActivity(this)\r\n .withPermission(Manifest.permission.CAMERA)\r\n .withListener(new PermissionListener() {\r\n @Override\r\n public void onPermissionGranted(PermissionGrantedResponse response) {\r\n // permission is granted\r\n Toast.makeText(getApplicationContext(), \"Camera permission are granted!\", Toast.LENGTH_SHORT).show();\r\n\r\n Intent camera_intent=new Intent(MainActivity.this,CameraActivity.class);\r\n startActivity(camera_intent);\r\n }\r\n\r\n @Override\r\n public void onPermissionDenied(PermissionDeniedResponse response) {\r\n // check for permanent denial of permission\r\n if (response.isPermanentlyDenied()) {\r\n showSettingsDialog();\r\n }\r\n }\r\n\r\n @Override\r\n public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {\r\n token.continuePermissionRequest();\r\n }\r\n }).check();\r\n }", "private void requestRecordAudioPermission() {\n int currentapiVersion = android.os.Build.VERSION.SDK_INT;\n if (currentapiVersion > android.os.Build.VERSION_CODES.LOLLIPOP) {\n\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.RECORD_AUDIO)) {\n\n // Show an expanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.RECORD_AUDIO}, 1);\n }\n }\n }\n }", "@Override\n public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {\n try {\n switch (requestCode) {\n case REQUEST_CODE_ASK_PERMISSIONS_RECORD_AUDIO:\n if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n // Permission Granted\n checkRuntimePermisson(false);\n } else {\n // Permission Denied\n utils.showAlert(ctx, (InterfaceAlertDissmiss) MicManualFragment.this, ctx.getResources().getString(R.string.txtPermissionMessageMic), ctx.getResources().getString(R.string.txtPermissionRequired),\n ctx.getResources().getString(R.string.txtRetry), ctx.getResources().getString(R.string.Cancel), 121);\n }\n break;\n\n case REQUEST_CODE_ASK_PERMISSIONS_STORAGE:\n if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n // Permission Granted\n checkRuntimePermisson(false);\n } else {\n // Permission Denied\n utils.showAlert(ctx, (InterfaceAlertDissmiss) MicManualFragment.this, ctx.getResources().getString(R.string.txtPermissionMessageMic), ctx.getResources().getString(R.string.txtPermissionRequired),\n ctx.getResources().getString(R.string.txtRetry), ctx.getResources().getString(R.string.Cancel), 1234);\n }\n break;\n\n default:\n super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n }\n } catch (Exception e) {\n logException(e, \"MicManualFragment_onRequestPermissionsResult()\");\n }\n\n }", "private void captureImageWithPermission() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);\n if (rc == PackageManager.PERMISSION_GRANTED) {\n captureImage();\n } else {\n EasyPermissions.requestPermissions(\n this,\n getString(R.string.msg_no_camera_permission),\n RC_CAMERA,\n Manifest.permission.CAMERA);\n }\n } else {\n captureImage();\n }\n }", "public void requestCameraPermission() {\n int currentapiVersion = Build.VERSION.SDK_INT;\n if (currentapiVersion >= Build.VERSION_CODES.M) {\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED\n && checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA) &&\n ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE},\n 1);\n\n } else {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE},\n 1);\n }\n }\n }\n }", "public void runTimePermission(){\n Dexter.withActivity(this).withPermission(Manifest.permission.READ_EXTERNAL_STORAGE)\n .withListener(new PermissionListener() {\n @Override\n public void onPermissionGranted(PermissionGrantedResponse response) {\n play();\n }\n\n @Override\n public void onPermissionDenied(PermissionDeniedResponse response) {\n\n }\n\n @Override\n public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {\n token.continuePermissionRequest();\n }\n }).check();\n }", "private void requestPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Permission is not granted\n // Should we show an explanation?\n if (!ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.CAMERA)) {\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n } else {\n // No explanation needed; request the permission\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.CAMERA},\n 1);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n } else {\n // Permission has already been granted\n }\n }", "private void addWithCamera() {\n if (PermissionUtils.isPermissionGranted(Manifest.permission.CAMERA)) {\n startCameraPage();\n } else {\n PermissionUtils.requestPermission(\n this,\n Manifest.permission.CAMERA,\n CAMERA_PERMISSION_REQUEST);\n }\n }", "protected void startVideoCall() {\n if (!EMClient.getInstance().isConnected())\n Toast.makeText(ChatDetailsActivity.this, R.string.not_connect_to_server, Toast.LENGTH_SHORT).show();\n else {\n startActivity(new Intent(ChatDetailsActivity.this, VideoCallActivity.class).putExtra(\"username\", mBean.getMobile())\n .putExtra(\"isComingCall\", false).putExtra(\"nickname\", mBean.getUser_nickname()));\n // videoCallBtn.setEnabled(false);\n// inputMenu.hideExtendMenuContainer();\n }\n }", "private boolean checkPermission() {\n\n if ((ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED)\n\n ) {\n\n // Permission is not granted\n return false;\n\n }\n return true;\n }", "@Override\n public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {\n switch (requestCode) {\n case CameraUtils.MY_PERMISSIONS_REQUEST_CAMERA:\n if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n // permission was granted!\n beginPreview();\n } else {\n T(\"we have not get access to your camera!\");\n // permission denied! Disable the functionality that depends on this permission.\n }\n return;\n }\n\n // other 'case' lines to check for other\n // permissions this app might request\n }", "public boolean videoSupported();", "private void checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED){\n\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION,\n Manifest.permission.CAMERA}, 56);\n }\n }", "private void startRecording() {\n\n }", "private void requestCameraPermission(){\n if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, //has the user already denied the permission?\n Manifest.permission.CAMERA)) {\n //show explanation to user\n Toast.makeText(this, \"Camera permission needed to scan QR codes\", Toast.LENGTH_LONG).show();\n //request the permission\n ActivityCompat.requestPermissions(MainActivity.this,\n new String[]{Manifest.permission.CAMERA},\n CAMERA_PERMISSION_CODE);\n } else {\n // No explanation needed; request the permission\n ActivityCompat.requestPermissions(MainActivity.this,\n new String[]{Manifest.permission.CAMERA},\n CAMERA_PERMISSION_CODE);\n\n // CAMERA_PERMISSION_CODE is an\n // app-defined int constant. The onRequestPermissionsResult method gets the code\n }\n }", "public void record() {\n if (mCarContext.checkSelfPermission(RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED) {\n CarToast.makeText(mCarContext, \"Grant mic permission on phone\",\n CarToast.LENGTH_LONG).show();\n List<String> permissions = Collections.singletonList(RECORD_AUDIO);\n mCarContext.requestPermissions(permissions, (grantedPermissions,\n rejectedPermissions) -> {\n if (grantedPermissions.contains(RECORD_AUDIO)) {\n record();\n }\n });\n return;\n }\n CarAudioRecord record = CarAudioRecord.create(mCarContext);\n\n Thread recordingThread =\n new Thread(\n () -> doRecord(record),\n \"AudioRecorder Thread\");\n recordingThread.start();\n }", "private void checkCameraPermission() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Permission is not granted\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.CAMERA)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed; request the permission\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.CAMERA},\n 0);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n } else {\n cameraView = (JavaCameraView) findViewById(R.id.camera);\n cameraView.setVisibility(SurfaceView.VISIBLE);\n cameraView.setCvCameraViewListener(this);\n\n mLoaderCallback = new BaseLoaderCallback(this) {\n\n @Override\n public void onManagerConnected(int status) {\n switch (status) {\n case LoaderCallbackInterface.SUCCESS: {\n Log.i(\"\", \"Opencv loading success.\");\n cameraView.enableView();\n break;\n }\n default: {\n Log.i(\"OPENCV\", \"Opencv loading failed!\");\n super.onManagerConnected(status);\n }\n break;\n }\n }\n };\n }\n }", "@Override\r\n public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {\n switch (requestCode) {\r\n case REQUEST_AUDIO_PERMISSION_CODE:\r\n if (grantResults.length > 0) {\r\n boolean permissionToRecord = grantResults[0] == PackageManager.PERMISSION_GRANTED;\r\n boolean permissionToStore = grantResults[1] == PackageManager.PERMISSION_GRANTED;\r\n if (permissionToRecord && permissionToStore) {\r\n Toast.makeText(getApplicationContext(), \"Permission Granted\", Toast.LENGTH_LONG).show();\r\n } else {\r\n Toast.makeText(getApplicationContext(), \"Permission Denied\", Toast.LENGTH_LONG).show();\r\n }\r\n }\r\n break;\r\n }\r\n }", "@Override\n public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {\n if (requestCode == CAMERA_PERMISSION_REQUEST_CODE) {\n if (grantResults.length != 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n setupCamera();\n }\n }\n }", "public boolean onStopVideoRecording() {\n if (this.mNeedGLRender && isSupportEffects()) {\n this.mCurrentVideoFilename = this.mVideoFilename;\n this.mActivity.getCameraAppUI().stopVideoRecorder();\n }\n if (this.PhoneFlag) {\n int moduleId = getModuleId();\n CameraActivity cameraActivity = this.mActivity;\n if (moduleId == 8) {\n this.mActivity.getCameraAppUI().setCalldisable(true);\n this.mActivity.getCameraAppUI().resetAlpha(true);\n }\n }\n if (this.mMediaRecoderRecordingPaused) {\n this.mRecordingStartTime = SystemClock.uptimeMillis() - this.mVideoRecordedDuration;\n this.mVideoRecordedDuration = 0;\n this.mMediaRecoderRecordingPaused = false;\n this.mUI.mMediaRecoderRecordingPaused = false;\n this.mUI.setRecordingTimeImage(true);\n }\n this.mAppController.getCameraAppUI().showRotateButton();\n this.mAppController.getCameraAppUI().setSwipeEnabled(true);\n this.mActivity.stopBatteryInfoChecking();\n this.mActivity.stopInnerStorageChecking();\n boolean recordFail = stopVideoRecording();\n releaseAudioFocus();\n if (this.mIsVideoCaptureIntent) {\n if (this.mQuickCapture) {\n doReturnToCaller(recordFail ^ 1);\n } else if (recordFail) {\n this.mAppController.getCameraAppUI().showModeOptions();\n this.mHandler.sendEmptyMessageDelayed(6, SHUTTER_BUTTON_TIMEOUT);\n } else {\n showCaptureResult();\n }\n } else if (!(recordFail || this.mPaused)) {\n boolean z = ApiHelper.HAS_SURFACE_TEXTURE_RECORDING;\n }\n return recordFail;\n }", "public void onVideoRecordingStarted() {\n this.mUI.unlockCaptureView();\n }", "private void startCall() {\n // If firebase isn't auth don't call\n if (mUser == null) return;\n setupLocalVideo();\n joinChannel();\n }", "private void sendVideoRecordingRequest() {\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n assert surfaceTexture != null;\n surfaceTexture.setDefaultBufferSize(mSizePreview.getSize().getWidth(), mSizePreview.getSize().getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n\n try {\n\n // create request for RECORDING template\n /**\n * Create a request suitable for video recording. Specifically, this means\n * that a stable frame rate is used, and post-processing is set for\n * recording quality. These requests would commonly be used with the\n * {@link CameraCaptureSession#setRepeatingRequest} method.\n * This template is guaranteed to be supported on all camera devices except\n * {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT DEPTH_OUTPUT} devices\n * that are not {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE\n * BACKWARD_COMPATIBLE}.\n *\n * @see #createCaptureRequest\n */\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n configureCameraParameters(mCaptureRequestBuilder, mRokidCameraParamAEMode, mRokidCameraParamAFMode, mRokidCameraParamAWBMode);\n\n if (mPreviewEnabled) {\n // add Preview surface to target\n mCaptureRequestBuilder.addTarget(previewSurface);\n }\n\n // add Record surface to target\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface), new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n try {\n cameraCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void checkRequestPermission(){\n\n\n hasPermission = (ActivityCompat.checkSelfPermission(this, Manifest.permission.VIBRATE)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n == PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_GRANTED );\n//check group permissons\n if (!hasPermission){\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.VIBRATE,\n Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE,\n Manifest.permission.READ_EXTERNAL_STORAGE\n\n },\n REQUEST_NETWORK_ACCESS);\n }\n }", "private boolean checkPermissionFromDevice(int permissions) {\n\n switch (permissions) {\n case RECORD_AUDIO_PERMISSION_CODE: {\n // int variables will be 0 if permissions are not granted already\n int write_external_storage_result =\n ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);\n int record_audio_result =\n ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO);\n\n // returns true if both permissions are already granted\n return write_external_storage_result == PackageManager.PERMISSION_GRANTED &&\n record_audio_result == PackageManager.PERMISSION_GRANTED;\n }\n default:\n return false;\n }\n }", "@Override\n\tpublic void videoStart() {\n\t\t\n\t}", "@Override\n public void onClick(View view) {\n if (ContextCompat.checkSelfPermission(MainActivity.this,\n Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) {\n\n\n ActivityCompat.requestPermissions(MainActivity.this,\n new String[]{Manifest.permission.CAMERA},\n MY_PERMISSIONS_REQUEST_CAMERA);\n\n } else {\n // Permission has already been granted\n Intent intent = new Intent(MainActivity.this, ActScanner.class);\n startActivity(intent);\n }\n\n }", "protected void setPermissions(){\n //Set permissions\n //READ_PHONE_STATE\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO)\n != PackageManager.PERMISSION_GRANTED ||\n ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED ||\n ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED ||\n ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED ||\n ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED\n ) {\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.RECORD_AUDIO)) {\n //Show an explanation to the user *asynchronously* -- don't block\n //this thread waiting for the user's response! After the user\n //sees the explanation, request the permission again.\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.RECORD_AUDIO,Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.CAMERA,Manifest.permission.READ_PHONE_STATE},\n GET_PERMISSION);\n } else {\n //No explanation needed, we can request the permission.\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.RECORD_AUDIO,Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.CAMERA,Manifest.permission.READ_PHONE_STATE},\n GET_PERMISSION);\n\n //MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n //app-defined int constant. The callback method gets the\n //result of the request.\n }\n }\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "void startCamera() throws IOException {\n if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED ||\n ContextCompat.checkSelfPermission(this, CAMERA) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(this,\n new String[]{WRITE_EXTERNAL_STORAGE, CAMERA},\n WRITE_EXTERNAL_STORAGE_REQUEST);\n return;\n }\n dispatchTakePictureIntent();\n\n }", "@Override\n public void run() {\n mLogView.logI(\"Remote video starting, uid: \" + (uid & 0xFFFFFFFFL));\n setupRemoteVideo(uid, uid == WINDOW_SHARE_UID ? mRemoteShareContainerSplit : mRemoteCameraContainer);\n }", "public void handleRecButtonOnPressed() {\n ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_SYSTEM, true);\n ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_MUSIC, true);\n ((AudioManager) AppDelegate.getAppContext().getSystemService(Context.AUDIO_SERVICE)).setStreamMute(AudioManager.STREAM_RING, true);\n AudioManager audioMgr = ((AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE));\n\n cameraView.setVisibility(View.VISIBLE);\n mapView.getView().setVisibility(View.GONE);\n //updateMessage();\n if (timerCounter != null) {\n timerCounter.cancel();\n timerCounter = null;\n }\n\n if (isCameraRecording) {\n\n isCameraRecording = false;\n mStartRecordingButton.setChecked(false);\n mTextViewInfoAboutVideoStreaming.setVisibility(View.GONE);\n disableAuthorityAlertedText();\n\n cameraView.stopRecording();\n\n // Control view group\n cameraView.setVisibility(View.VISIBLE);\n mapView.getView().setVisibility(View.GONE);\n\n toolBarTitle.setText(dateFormat.format(new Date(userPreferences.recordTime() * 1000)));\n handler.removeCallbacksAndMessages(null);\n handler.removeCallbacks(counterMessage);\n counterMessage = null;\n\n //VIDEO FINISHING ALERT\n CommonAlertDialog dialog = new CommonAlertDialog(getActivity(), mAlertDialogButtonClickListerer); // Setting dialogview\n dialog.show();\n\n } else {\n\n userPreferences.setEventId(UUID.randomUUID().toString());\n isCameraRecording = true;\n\n mStartRecordingButton.setChecked(true);\n mTextViewInfoAboutVideoStreaming.setVisibility(View.VISIBLE);\n cameraView.setVisibility(View.VISIBLE);\n\n if (cacheFolder == null) {\n cacheFolder = new FwiCacheFolder(AppDelegate.getAppContext(), String.format(\"%s/%s\", userPreferences.currentProfileId(), userPreferences.eventId()));\n cameraView.setDelegate(this);\n cameraView.setCacheFolder(cacheFolder);\n }\n\n this.startRecording();\n\n }\n if (userPreferences.enableTorch()) {\n isenableTourch = true;\n cameraView.torchOn();\n }\n\n }", "public boolean videoEnabled();", "public void onVideoStarted () {}", "@Override\r\n\tpublic void onCreate (Bundle savedInstanceState) \r\n\t{\r\n\t\t// -------------------------------------------------------------------------\r\n\t\tsuper.onCreate (savedInstanceState);\r\n\t\t// -------------------------------------------------------------------------\r\n\t\t// 16/06/2017 ECU check if the camera settings have been set - if not then\r\n\t\t// create the object\r\n\t\t// -------------------------------------------------------------------------\r\n\t\tif (PublicData.storedData.cameraSettings == null)\r\n\t\t{\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 16/06/2017 ECU create a new instance of the settings\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tPublicData.storedData.cameraSettings = new CameraSettings ();\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t}\r\n\t\t// -------------------------------------------------------------------------\r\n\t\tif (savedInstanceState == null)\r\n\t\t{\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 03/05/2015 ECU cannot use the normal Utilities.SetUpActivity because of\r\n\t\t\t// the orientation and trying to keep the screen on\r\n\t\t\t// ECU updated the SetUpActivity so that orientation can be\r\n\t\t\t// passed through\r\n\t\t\t// 29/05/2016 ECU change to use 'portrait' mode\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tUtilities.SetUpActivity (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT,\r\n\t\t\t\t\t\t\t\t\t this,\r\n\t\t\t\t\t\t\t\t\t StaticData.ACTIVITY_FULL_SCREEN,\r\n\t\t\t\t\t\t\t\t\t !StaticData.ACTIVITY_SCREEN_ON);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 29/05/2016 ECU remember the context for later use\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tcontext = this;\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 15/06/2017 ECU initialise any static variables\r\n\t\t\t// 18/09/2017 ECU added video streaming\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tdestinationFileName\t= null;\r\n\t\t\tvideoStreaming\t\t= false;\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 15/06/2017 ECU create the handler that will process the record actions\r\n\t\t\t// when a destination file has been specified and the\r\n\t\t\t// recorder is to be started automatically\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\trecordHandler\t\t= new MessageHandler ();\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 15/06/2017 ECU check if a destination file name has been fed through\r\n\t\t\t// which indicates that recording is to start automatically\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tBundle extras = getIntent().getExtras();\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tif (extras != null)\r\n\t\t\t{\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\t// 15/06/2017 ECU check if file name passed through\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\tdestinationFileName = extras.getString (StaticData.PARAMETER_FILE_NAME);\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\t// 18/09/2017 ECU check if video streaming has been requested\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\tvideoStreaming = extras.getBoolean (StaticData.PARAMETER_VIDEO_STREAM, false);\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\t// 27/09/2017 ECU if video streaming is on then allow access to\r\n\t\t\t\t// the network from the UI\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t\tif (videoStreaming)\r\n\t\t\t\t\tAPIIssues.NetworkOnMainUIThread (android.os.Build.VERSION.SDK_INT);\r\n\t\t\t\t// -----------------------------------------------------------------\r\n\t\t\t}\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 11/10/2015 ECU the activity has been created anew\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tsetContentView (R.layout.activity_video_recorder);\r\n\t\t\tsurfaceView = (SurfaceView) findViewById (R.id.camera_surface_view);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 17/06/2017 ECU get details of the timer\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\ttimerTextView = (TextView) findViewById (R.id.video_timer);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 18/06/2017 ECU declare the text view that will be used to hide the\r\n\t\t\t// surface view\r\n\t\t\t// ----------------------------------------------------------------------\r\n\t\t\thideSurfaceView = (TextView) findViewById (R.id.video_hide_view);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 25/05/2016 ECU set up the surface that will be used for the camera\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tsurfaceHolder = surfaceView.getHolder(); \r\n\t\t\tsurfaceHolder.addCallback (this); \r\n\t\t\tsurfaceHolder.setType (SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 25/05/2016 ECU set up the buttons and their listeners\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tchangeCameraButton\t= (ImageButton) findViewById (R.id.video_camera);\r\n\t\t\trecordButton \t\t= (ImageButton) findViewById (R.id.video_record_button);\r\n\t\t\t\r\n\t\t\tchangeCameraButton.setOnClickListener (cameraChangeOnClickListener);\r\n\t\t\trecordButton.setOnClickListener (buttonOnClickListener);\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 29/05/2016 ECU preset some variables\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\trecording \t\t= false;\r\n\t\t\trecordingMode \t= StaticData.VIDEO_RECORDER_RECORD;\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\t// 11/10/2015 ECU the activity has been recreated after having been\r\n\t\t\t// destroyed by the Android OS\r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t\tfinish (); \r\n\t\t\t// ---------------------------------------------------------------------\r\n\t\t}\r\n\t}", "public void checkPermissionsCamera() {\n PackageManager packageManager = EditProfile.this.getPackageManager();\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n //Checking the permissions for using the camera.\n if (checkSelfPermission(Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{Manifest.permission.CAMERA},\n MY_PERMISSIONS_REQUEST_CAMERA);\n } else if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY) == false) {\n Toast.makeText(EditProfile.this, \"This device does not have a camera.\", Toast.LENGTH_LONG)\n .show();\n return;\n }\n }\n }", "private boolean checkCameraPermission() {\n if (ActivityCompat.checkSelfPermission(parentActivity, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(parentActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(parentActivity, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 200);\n return false;\n }\n return true;\n }", "private void checkVoiceCommandPermission()\n {\n // Android 6 er uporer version gula te voice neoar capability ache, and they require permissions.\n // that's why we check first the SDK version is above 6 or not\n if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)\n {\n // jodi persmission pai voice er then\n if(!(ContextCompat.checkSelfPermission(SmartPlayerActivity.this, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED))\n {\n // we can start the activity\n Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse(\"package:\" + getPackageName()));\n startActivity(intent);\n finish();\n }\n }\n }", "@Override\n public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,\n @NonNull int[] grantResults) {\n if (AUDIO_ECHO_REQUEST != requestCode) {\n super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n return;\n }\n\n if (grantResults.length != 1 ||\n grantResults[0] != PackageManager.PERMISSION_GRANTED) {\n /*\n * When user denied the permission, throw a Toast to prompt that RECORD_AUDIO\n * is necessary; on UI, we display the current status as permission was denied so\n * user know what is going on.\n * This application go back to the original state: it behaves as if the button\n * was not clicked. The assumption is that user will re-click the \"start\" button\n * (to retry), or shutdown the app in normal way.\n */\n Toast.makeText(getApplicationContext(),\n getString(R.string.NeedRecordAudioPermission),\n Toast.LENGTH_SHORT)\n .show();\n return;\n }\n\n // The callback runs on app's thread, so we are safe to resume the action\n startApp();\n }", "public void EnableRuntimePermission(){\n\n if (ActivityCompat.shouldShowRequestPermissionRationale(EditProfileActivity.this,\n Manifest.permission.CAMERA))\n {\n\n Toast.makeText(getApplicationContext(),\"CAMERA permission allows us to Access CAMERA app\", Toast.LENGTH_LONG).show();\n\n } else {\n\n ActivityCompat.requestPermissions(EditProfileActivity.this,new String[]{\n Manifest.permission.CAMERA}, RequestPermissionCode);\n\n }\n }", "private void onPlayVideoClick() {\n Intent intent = new Intent(Intent.ACTION_VIEW);\n intent.setDataAndType(Uri.parse(\"file://\" + mediaPath), \"video/mp4\");\n startActivity(intent);\n }", "private void requestCameraPermission() {\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.CAMERA)) {\n\n new AlertDialog.Builder(this)\n .setTitle(\"Permission needed\")\n .setMessage(\"The camera is needed to scan QR Codes\")\n .setPositiveButton(\"OK\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n ActivityCompat.requestPermissions(ScavengerHunt.this,\n new String[]{Manifest.permission.CAMERA}, 1);\n }\n })\n .setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n Toast.makeText(ScavengerHunt.this, \"Camera is needed to scan QR codes\", Toast.LENGTH_SHORT).show();\n }\n })\n .create()\n .show();\n\n } else {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.CAMERA}, 1);\n }\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n private void requestCameraPermission() {\n requestPermissions(cameraPermissions, CAMERA_REQUEST_CODE);\n }", "private void requestCameraPermission() {\n\t\tLog.d(TAG, \"Requesting CAMERA permission\");\n\t\tActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, PERMISSION_REQUEST_CAMERA);\n\t}", "private void requestCameraPermission() {\n Log.w(TAG, \"Camera permission is not granted. Requesting permission\");\n\n final String[] permissions = new String[]{Manifest.permission.CAMERA};\n\n if (!mPermissionRequestor\n .shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {\n mPermissionRequestor.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);\n return;\n }\n\n View.OnClickListener listener = new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n mPermissionRequestor\n .requestPermissions(BarcodeCaptureActivity.this, permissions, RC_HANDLE_CAMERA_PERM);\n }\n };\n\n Snackbar.make(mGraphicOverlay, R.string.permission_camera_rationale,\n Snackbar.LENGTH_INDEFINITE)\n .setAction(R.string.ok, listener)\n .show();\n }", "@Override\n public void onPermissionsChecked(MultiplePermissionsReport report) {\n if (report.areAllPermissionsGranted()) {\n //Toast.makeText(getApplicationContext(), \"All permissions are granted!\", Toast.LENGTH_SHORT).show();\n openCamera();\n }\n\n // check for permanent denial of any permission\n if (report.isAnyPermissionPermanentlyDenied()) {\n // show alert dialog navigating to Settings\n showSettingsDialog();\n }\n }", "private void requestPermissions(){\n Intent intent = new Intent(this.getApplication(), MainActivity.class);\r\n intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n startActivity(intent);\r\n }", "private void startCameraActivity(){\n if (checkPermissions() && !startingActivity) {\n startingActivity = true;\n goodVibes.vibrate(200);\n Intent intent = new Intent(this, CameraActivity.class);\n intent.putExtra(\"EYE_COLOR\", eyeColorSelection);\n startActivity(intent);\n }else{\n getPermissions();\n }\n }", "@Override\n public void onVideoStarted() {\n }", "private boolean checkAndRequestPermissions() {\n\n List<String> listPermissionsNeeded = new ArrayList<>();\n /*if (camera != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.CAMERA);\n }\n\n if (wstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\n }\n\n if (rstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\n }\n if (rphoneState != PackageManager.PERMISSION_GRANTED)\n {\n listPermissionsNeeded.add(Manifest.permission.READ_PHONE_STATE);\n }*/\n\n// if(cLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n// }\n//\n// if(fLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n// }\n\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray\n (new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n success();\n return true;\n }", "private void requestCameraPermission() {\n ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.CALL_PHONE},\n REQUEST_CALL);\n }", "@Override\n public void run() {\n setupRemoteVideo(uid);\n }", "void requestCameraPermission() {\n\n String[] permissions = {Manifest.permission.CAMERA};\n ActivityCompat.requestPermissions(this, permissions, CAMERA_PERMISSION_REQUEST_CODE);\n }", "public void start(boolean bRec) throws IOException {\r\n String state = android.os.Environment.getExternalStorageState();\r\n if(!state.equals(android.os.Environment.MEDIA_MOUNTED)) {\r\n throw new IOException(\"SD Card is not mounted. It is \" + state + \".\");\r\n }\r\n\r\n // make sure the directory we plan to store the recording in exists\r\n File directory = new File(path).getParentFile();\r\n if (!directory.exists() && !directory.mkdirs()) {\r\n throw new IOException(\"Path to file could not be created.\");\r\n }\r\n if (bRec){\r\n\t recorder.setAudioSource(MediaRecorder.AudioSource.MIC);\r\n\t recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);\r\n\t recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);\r\n\t recorder.setOutputFile(path);\r\n\t recorder.prepare();\r\n\t recorder.start();\r\n\t _bRecording=true;\r\n }\r\n else\r\n {\tif (_pfd!=null)\r\n \t\tplayer.setDataSource(_pfd.getFileDescriptor());\r\n \telse\r\n \t\tplayer.setDataSource(path);\r\n \tplayer.prepare();\r\n \tplayer.start();\r\n }\r\n }", "private void requestTakePhotoPermissions() {\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.CAMERA,\n Manifest.permission.READ_EXTERNAL_STORAGE,\n Manifest.permission.WRITE_EXTERNAL_STORAGE},\n REQUEST_PERMISSON_CAMERA);\n return;\n } else {\n initViews();\n }\n\n }", "private void requestCameraPermission(final int type) {\n Dexter.withActivity(this)\n .withPermissions(Manifest.permission.CAMERA,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)\n .withListener(new MultiplePermissionsListener() {\n @Override\n public void onPermissionsChecked(MultiplePermissionsReport report) {\n if (report.areAllPermissionsGranted()) {\n\n openCamera(type);\n Log.e(\"tipe cam :\", String.valueOf(type));\n\n } else if (report.isAnyPermissionPermanentlyDenied()) {\n showPermissionsAlert();\n }\n }\n\n @Override\n public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {\n token.continuePermissionRequest();\n }\n }).check();\n }", "private void requestPermissions() {\n mWaiting4Permission = Boolean.TRUE;\n\n ActivityCompat.requestPermissions(this, permissionsToAsk(), PERMISSIONS_REQUEST_CODE);\n }", "public void startRecording() {\r\n\t\t( new Thread() {\r\n\t\t\tpublic void run() {\r\n\t\t\t\tstart(); // startAudioRecording\r\n\t\t\t}\r\n\t\t} ).start();\r\n\t}", "private void checkAndRequestPermissions() {\n missingPermission = new ArrayList<>();\n // Check for permissions\n for (String eachPermission : REQUIRED_PERMISSION_LIST) {\n if (ContextCompat.checkSelfPermission(this, eachPermission) != PackageManager.PERMISSION_GRANTED) {\n missingPermission.add(eachPermission);\n }\n }\n // Request for missing permissions\n if (missingPermission.isEmpty()) {\n DroneModel.getInstance(this).setDjiProductStateCallBack(this);\n DroneModel.getInstance(this).startSDKRegistration();\n } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n ActivityCompat.requestPermissions(this,\n missingPermission.toArray(new String[missingPermission.size()]),\n REQUEST_PERMISSION_CODE);\n }\n }", "@Override\n protected void onResume() {\n // Call up to the superclass.\n super.onResume();\n\n // Register BroadcastReceiver that receives result from\n // UploadVideoService when a video upload completes.\n registerReceiver();\n if(!videoPresentOnDevice()){\n // Todo show download button\n mDownloadButton.setVisibility(View.VISIBLE);\n mDownloadButton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n //Todo start downloading via DownloadVideoService\n getOps().downloadVideo();\n }\n });\n\n }\n }", "public void takevideo() {\nSystem.out.println(\"take a video\");\r\n}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n setContentView(R.layout.pro);\n Button info=(Button)findViewById(R.id.info);\n Button back=(Button) findViewById(R.id.back);\n Button power=(Button) findViewById(R.id.power);\n Button home=(Button) findViewById(R.id.home);\n Button next=(Button) findViewById(R.id.next);\n // pro=(VideoView)findViewById(R.id.videoView1);\n \n MediaController mc = new MediaController(this);\n \n VideoView vv = (VideoView)this.findViewById(R.id.video);\n vv.setMediaController(mc);\n String fileName = \"android.resource://\" + getPackageName() + \"/\" + R.raw.backhand_male;\n vv.getDuration();\n vv.setVideoURI(Uri.parse(fileName));\n \n vv.start();\n vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {\n\n \n public void onCompletion(MediaPlayer mp) {\n // not playVideo\n // playVideo();\n\n \tIntent intent = new Intent(Probackhandmale.this, Probackhandmale.class);\n \t startActivity(intent);\n \t finish();\n }\n });\n \n power.setOnClickListener(new View.OnClickListener() {\n\t public void onClick(View view) {\n\t \t power(); \n\t \t \n\t \t \t \t \n\t\t \t }\n\t\t });\n \n back.setOnClickListener(new View.OnClickListener() {\n\t public void onClick(View view) {\n\t \t back(); \n\t \t \n\t \t \t \t \n\t\t \t }\n\t\t });\n next.setOnClickListener(new View.OnClickListener() {\n public void onClick(View view) {\n \t \n \t Context context = getApplicationContext();\n \tCharSequence text = \"Please press back then proceed to record a video.\";\n \tint duration = Toast.LENGTH_SHORT;\n \tToast toast = Toast.makeText(context, text, duration);\n \ttoast.show();\n \t \t \t \n\t \t }\n\t });\n info.setOnClickListener(new View.OnClickListener() {\n\t public void onClick(View view) {\n\t \tinfo(); \n\t \t \n\t \t \t \t \n\t\t \t }\n\t\t });\n home.setOnClickListener(new View.OnClickListener() {\n public void onClick(View view) {\n \t home(); \n \t \n \t \t \t \n \t }\n });\n \n \t }", "private void startRecord() {\n try {\n if (mIsRecording) {\n setupMediaRecorder();\n } else if (mIsTimelapse) {\n setupTimelapse();\n }\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n surfaceTexture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n mCaptureRequestBuilder.addTarget(previewSurface);\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface, mImageReader.getSurface()),\n new CameraCaptureSession.StateCallback() {\n\n\n @Override\n public void onConfigured(CameraCaptureSession session) {\n\n mRecordCaptureSession = session;\n\n try {\n mRecordCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession session) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public boolean videoDisplayEnabled();", "public void record(View view) {\n checkPermission();\n if (permissionGranted) {\n // Resetting button\n startButton.setText(\"Start\");\n\n Intent intent = new Intent(this, MusicRecord2.class);\n startActivity(intent);\n } else {\n // Notifying user that not functional without audio permission\n startButton.setTextSize(originalTextSize / 8);\n startButton.setText(\"Must aquire audio permission\");\n }\n }", "private boolean prepareMediaRecorder() {\n if (mediaRecorder == null)\n mediaRecorder = new MediaRecorder();\n\n // according to API documents, this should not really be necessary, but the app crashes if not called\n mCamera.unlock();\n\n mediaRecorder.setCamera(mCamera);\n mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);\n mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);\n\n mProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);\n mediaRecorder.setProfile(mProfile);\n\n mediaRecorder.setOutputFile(getOutputFileName());\n //mediaRecorder.setMaxDuration(60000); // Set max duration 60 sec.\n //mediaRecorder.setMaxFileSize(5000000); // Set max file size 5M\n\n // set preview to previewholder\n // this is actually not needed when it is already set on the Camera object\n if (mCameraPreview != null) {\n mediaRecorder.setPreviewDisplay(mCameraPreview.getHolder().getSurface());\n }\n\n try {\n mediaRecorder.prepare();\n } catch (IllegalStateException e) {\n releaseMediaRecorder();\n return false;\n } catch (IOException e) {\n releaseMediaRecorder();\n return false;\n }\n\n return true;\n }", "@Override\n public void onClick(View v) {\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n if (checkSelfPermission(Manifest.permission.CAMERA) ==\n PackageManager.PERMISSION_DENIED ||\n checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) ==\n PackageManager.PERMISSION_DENIED) {\n //Permission not enabled, on la demande\n String[] permission = {Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE};\n //pop up pour la demande de permission\n requestPermissions(permission, PERMISSION_CODE);\n } else {\n //permission deja validée\n openCamera();\n }\n } else {\n openCamera();\n }\n }", "public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,\n @NonNull int[] grantResults) {\n super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n switch (requestCode) {\n case 1:\n if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {\n opencamera();\n //if the user permmited to open the camera ,open it\n } else {\n Toast.makeText(this, \"权限被拒绝了\", Toast.LENGTH_SHORT).show();\n }\n break;\n default:\n break;\n }\n }", "private void requestCameraPermission() {\n Log.w(TAG, \"Camera permission is not granted. Requesting permission\");\n final String[] permissions = new String[]{Manifest.permission.CAMERA};\n if (!ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.CAMERA)) {\n ActivityCompat.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);\n }\n }", "public void enableVideoCapture(boolean enable);", "public void startCamera()\n \t{\n\t\t// start the video capture\n\t\t//this.capture.open(0);\n\t\tcapture.open(cameraNumber);\n\n\n\n\t\t// is the video stream available?\n\t\tif (capture.isOpened())\n\t\t{\n\t\t\t// grab a frame every 33 ms (30 frames/sec)\n\t\t\tRunnable frameGrabber = new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run()\n\t\t\t\t{\n\t\t\t\t\tgrabFrame();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttimer = Executors.newSingleThreadScheduledExecutor();\n\t\t\ttimer.scheduleAtFixedRate(frameGrabber, 0, 500, TimeUnit.MILLISECONDS);\n\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// log the error\n\t\t\tSystem.err.println(\"Impossible to open the camera connection...\");\n\t\t}\n \t}", "public void onResume() {\n List<String> a2;\n try {\n super.onResume();\n if (Build.VERSION.SDK_INT >= 23 && this.a) {\n String[] strArr = this.needPermissions;\n try {\n if (Build.VERSION.SDK_INT >= 23 && getApplicationInfo().targetSdkVersion >= 23 && (a2 = a(strArr)) != null && a2.size() > 0) {\n try {\n getClass().getMethod(\"requestPermissions\", String[].class, Integer.TYPE).invoke(this, (String[]) a2.toArray(new String[a2.size()]), 0);\n } catch (Throwable th) {\n }\n }\n } catch (Throwable th2) {\n th2.printStackTrace();\n }\n }\n } catch (Throwable th3) {\n th3.printStackTrace();\n }\n }", "private void requestWriteStoragePermission() {\n if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this,\n Manifest.permission.WRITE_EXTERNAL_STORAGE)) {\n //show explanation to user\n Toast.makeText(this, \"Write storage permission is needed to save photos/videos\", Toast.LENGTH_LONG).show();\n //request the permission\n ActivityCompat.requestPermissions(MainActivity.this,\n new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n WRITE_EXTERNAL_STORAGE_CODE);\n } else {\n // No explanation needed; request the permission\n ActivityCompat.requestPermissions(MainActivity.this,\n new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},\n WRITE_EXTERNAL_STORAGE_CODE);\n\n // WRITE_EXTERNAL_STORAGE_CODE is an\n // app-defined int constant. The onRequestPermissionsResult method gets the code\n }\n }", "@TargetApi(Build.VERSION_CODES.LOLLIPOP)\n private void startScreenRecord(final Intent intent) {\n if (DEBUG) {\n Log.v(TAG, \"startScreenRecord:sMuxer=\" + sMuxer);\n }\n synchronized (sSync) {\n if (sMuxer == null) {\n\n videoEncodeConfig = (VideoEncodeConfig) intent.getSerializableExtra(EXTRA_VIDEO_CONFIG);\n audioEncodeConfig = (AudioEncodeConfig) intent.getSerializableExtra(EXTRA_AUDIO_CONFIG);\n\n final int resultCode = intent.getIntExtra(EXTRA_RESULT_CODE, 0);\n // get MediaProjection\n final MediaProjection projection = mMediaProjectionManager.getMediaProjection(resultCode, intent);\n if (projection != null) {\n\n int width = videoEncodeConfig.width;\n int height = videoEncodeConfig.height;\n final DisplayMetrics metrics = getResources().getDisplayMetrics();\n\n if (videoEncodeConfig.width == 0 || videoEncodeConfig.height == 0) {\n width = metrics.widthPixels;\n height = metrics.heightPixels;\n }\n if (width > height) {\n // 横長\n final float scale_x = width / 1920f;\n final float scale_y = height / 1080f;\n final float scale = Math.max(scale_x, scale_y);\n width = (int) (width / scale);\n height = (int) (height / scale);\n } else {\n // 縦長\n final float scale_x = width / 1080f;\n final float scale_y = height / 1920f;\n final float scale = Math.max(scale_x, scale_y);\n width = (int) (width / scale);\n height = (int) (height / scale);\n }\n if (DEBUG) {\n Log.v(TAG, String.format(\"startRecording:(%d,%d)(%d,%d)\", metrics.widthPixels, metrics.heightPixels, width, height));\n }\n\n try {\n sMuxer = new MediaMuxerWrapper(this, \".mp4\"); // if you record audio only, \".m4a\" is also OK.\n if (true) {\n // for screen capturing\n new MediaScreenEncoder(sMuxer, mMediaEncoderListener,\n projection, width, height, metrics.densityDpi, videoEncodeConfig.bitrate * 1000, videoEncodeConfig.framerate);\n }\n if (true) {\n // for audio capturing\n new MediaAudioEncoder(sMuxer, mMediaEncoderListener);\n }\n sMuxer.prepare();\n sMuxer.startRecording();\n } catch (final IOException e) {\n Log.e(TAG, \"startScreenRecord:\", e);\n }\n }\n }\n }\n }" ]
[ "0.69025886", "0.6620929", "0.6598681", "0.6589281", "0.65782255", "0.64950913", "0.6454522", "0.6360643", "0.62480694", "0.62075853", "0.6179489", "0.6151773", "0.61072963", "0.6090383", "0.6074278", "0.60737735", "0.60419816", "0.602489", "0.60238326", "0.6020804", "0.6016615", "0.6004347", "0.5981874", "0.5965179", "0.5948326", "0.59320533", "0.5877549", "0.5875088", "0.58212656", "0.58200926", "0.58104026", "0.5781225", "0.5779006", "0.57562226", "0.5751259", "0.5749946", "0.57423717", "0.57297826", "0.57286984", "0.57258433", "0.5720087", "0.5719728", "0.5700165", "0.5698289", "0.56899434", "0.5666935", "0.5660234", "0.56540704", "0.56364083", "0.5633722", "0.5632298", "0.56284463", "0.56088424", "0.56073964", "0.5603902", "0.55944335", "0.55896544", "0.5583486", "0.55807316", "0.55756134", "0.55686873", "0.5565606", "0.5561481", "0.5531611", "0.5528323", "0.55229455", "0.55126274", "0.5502156", "0.5481801", "0.5480799", "0.5477764", "0.54753035", "0.54728246", "0.5461219", "0.5449116", "0.5446695", "0.5424262", "0.54175484", "0.5416511", "0.5411794", "0.5411508", "0.54074514", "0.5405824", "0.5397148", "0.5389176", "0.5388888", "0.5388154", "0.5386367", "0.53815216", "0.5378293", "0.53727907", "0.5361127", "0.53588736", "0.53472215", "0.532447", "0.5323826", "0.5318184", "0.5317426", "0.5311319", "0.5310022" ]
0.72903633
0
Set up Preview surface and Recording surface to prepare for recording
private void sendVideoRecordingRequest() { SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture(); assert surfaceTexture != null; surfaceTexture.setDefaultBufferSize(mSizePreview.getSize().getWidth(), mSizePreview.getSize().getHeight()); Surface previewSurface = new Surface(surfaceTexture); try { // create request for RECORDING template /** * Create a request suitable for video recording. Specifically, this means * that a stable frame rate is used, and post-processing is set for * recording quality. These requests would commonly be used with the * {@link CameraCaptureSession#setRepeatingRequest} method. * This template is guaranteed to be supported on all camera devices except * {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT DEPTH_OUTPUT} devices * that are not {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE * BACKWARD_COMPATIBLE}. * * @see #createCaptureRequest */ mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD); configureCameraParameters(mCaptureRequestBuilder, mRokidCameraParamAEMode, mRokidCameraParamAFMode, mRokidCameraParamAWBMode); if (mPreviewEnabled) { // add Preview surface to target mCaptureRequestBuilder.addTarget(previewSurface); } // add Record surface to target Surface recordSurface = mMediaRecorder.getSurface(); mCaptureRequestBuilder.addTarget(recordSurface); mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface), new CameraCaptureSession.StateCallback() { @Override public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) { try { cameraCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null); } catch (CameraAccessException e) { e.printStackTrace(); } } @Override public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) { } }, null); } catch (Exception e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void startPreview() {\n if (null == mCameraDevice || !mTextureView.isAvailable()) {\n return;\n }\n try {\n //\n // Media Recorder\n //\n setUpMediaRecorder();\n\n //\n // Preview Builder - Video Recording\n //\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n\n //\n // Surfaces: Preview and Record\n //\n List<Surface> surfaces = new ArrayList<>();\n\n //\n // Preview Surface\n //\n SurfaceTexture texture = mTextureView.getSurfaceTexture();\n texture.setDefaultBufferSize(screenWidth, screenHeight);\n Surface previewSurface = new Surface(texture);\n surfaces.add(previewSurface);\n mPreviewBuilder.addTarget(previewSurface);\n\n\n //\n // Record Surface\n //\n Surface recorderSurface = mMediaRecorder.getSurface();\n surfaces.add(recorderSurface);\n mPreviewBuilder.addTarget(recorderSurface);\n\n //\n // Setup Capture Session\n //\n mCameraDevice.createCaptureSession(surfaces, new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n Log.e(TAG, \"onConfigured(CameraCaptureSession cameraCaptureSession) ...\");\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onSurfacePrepared(CameraCaptureSession session, Surface surface) {\n Log.e(TAG, \"onSurfacePrepared(CameraCaptureSession session, Surface surface) ...\");\n //previewView = (LinearLayout) findViewById(R.id.camera_preview);\n //previewView.addView(mVideoCapture.mTextureView);\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n Log.e(TAG, \"onConfigureFailed(CameraCaptureSession cameraCaptureSession) ...\");\n Toast.makeText(mCameraActivity, \"failed to configure video camera\", Toast.LENGTH_SHORT).show();\n onBackPressed();\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void startRecord() {\n try {\n if (mIsRecording) {\n setupMediaRecorder();\n } else if (mIsTimelapse) {\n setupTimelapse();\n }\n SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();\n surfaceTexture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n Surface previewSurface = new Surface(surfaceTexture);\n Surface recordSurface = mMediaRecorder.getSurface();\n mCaptureRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n mCaptureRequestBuilder.addTarget(previewSurface);\n mCaptureRequestBuilder.addTarget(recordSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, recordSurface, mImageReader.getSurface()),\n new CameraCaptureSession.StateCallback() {\n\n\n @Override\n public void onConfigured(CameraCaptureSession session) {\n\n mRecordCaptureSession = session;\n\n try {\n mRecordCaptureSession.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession session) {\n\n }\n }, null);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private void startPreview() {\n if (null == mCameraDevice || !mVideoPreview.isAvailable() || null == mPreviewSize) {\n return;\n }\n try {\n closePreviewSession();\n SurfaceTexture texture = mVideoPreview.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n\n Surface previewSurface = new Surface(texture);\n mPreviewBuilder.addTarget(previewSurface);\n\n mCameraDevice.createCaptureSession(Arrays.asList(previewSurface), new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession cameraCaptureSession) {\n mPreviewSession = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {\n if (mVideoRecordListener != null) {\n mVideoRecordListener.onRecordingFailed(\"Capture session for previewing video failed.\");\n }\n }\n }, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void initRecorder(Surface surface) throws IOException {\n if (mCamera == null) {\n mCamera = Camera.open();\n mCamera.setDisplayOrientation(90);\n mCamera.setPreviewDisplay(mHolder);\n mCamera.startPreview();\n mCamera.unlock();\n }\n\n if (mMediaRecorder == null) mMediaRecorder = new MediaRecorder();\n //mMediaRecorder.setPreviewDisplay(surface);\n mMediaRecorder.setCamera(mCamera);\n\n mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);\n mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);\n\n mMediaRecorder.setProfile(CamcorderProfile.get(Camera.CameraInfo.CAMERA_FACING_BACK, CamcorderProfile.QUALITY_HIGH));\n mMediaRecorder.setVideoFrameRate(30);\n //mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);\n\n mMediaRecorder.setOrientationHint(90);\n\n mCameraInitSuccesful = true;\n }", "protected void setupCameraAndPreview() {\n\n //\n // always release\n //\n releaseImageObjects();\n releaseVideoCapturebjects(true);\n\n // now setup...\n if (isImageButtonSelected) {\n\n //\n // Image Camera can be fetched here\n //\n if (!isBackCameraSelected) {\n mCamera = getCameraInstance(frontCamera);\n } else {\n mCamera = getCameraInstance(backCamera);\n }\n\n if (mImageCapture == null) {\n // Initiate MImageCapture\n mImageCapture = new MImageCapture(MCameraActivity.this);\n }\n\n //\n // Set Orientation\n //\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);\n // Create our Preview view and set it as the content of our activity.\n // Add the copyright as an overlay...\n if (mImageCapture.mCameraPreview == null) {\n previewView = (LinearLayout) findViewById(R.id.camera_preview);\n mImageCapture.setCameraPreview(this, mCamera);\n previewView.addView(mImageCapture.mCameraPreview);\n }\n } else {\n //\n // Set Orientation\n //\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);\n\n /** handle video here... */\n if (mVideoCapture == null) {\n // now start over\n mVideoCapture = new MVideoCapture(this);\n }\n // Create our Preview view and set it as the content of our activity.\n // Add the copyright as an overlay...\n if (mVideoCapture.mTextureView != null) {\n previewView = (LinearLayout) findViewById(R.id.camera_preview);\n previewView.addView(mVideoCapture.mTextureView);\n }\n }\n\n }", "@SuppressLint({\"NewApi\"})\n public void setUpPreview() {\n try {\n if (this.mPreview.getOutputClass() == SurfaceHolder.class) {\n boolean z = this.mShowingPreview && Build.VERSION.SDK_INT < 14;\n if (z) {\n this.mCamera.stopPreview();\n }\n this.mCamera.setPreviewDisplay(this.mPreview.getSurfaceHolder());\n if (z) {\n this.mCamera.startPreview();\n return;\n }\n return;\n }\n this.mCamera.setPreviewTexture((SurfaceTexture) this.mPreview.getSurfaceTexture());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }", "@SuppressLint(\"NewApi\")\n protected void startPreview() {\n if(null == mCameraDevice || !mTextureView.isAvailable() || null == mPreviewSize) {\n Log.e(TAG, \"startPreview fail, return\");\n }\n\n SurfaceTexture texture = mTextureView.getSurfaceTexture();\n if(null == texture) {\n Log.e(TAG,\"texture is null, return\");\n return;\n }\n\n texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());\n Surface surface = new Surface(texture);\n\n try {\n mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n } catch (CameraAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n mPreviewBuilder.addTarget(surface);\n\n try {\n mCameraDevice.createCaptureSession(Arrays.asList(surface), new CameraCaptureSession.StateCallback() {\n\n @Override\n public void onConfigured(CameraCaptureSession session) {\n // TODO Auto-generated method stub\n mPreviewSession = session;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession session) {\n // TODO Auto-generated method stub\n Toast.makeText(mContext, \"onConfigureFailed\", Toast.LENGTH_LONG).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "protected void createCameraPreview() {\n try {\n SurfaceTexture texture = textureView.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(imageDimension.getWidth(), imageDimension.getHeight());\n Surface surface = new Surface(texture);\n captureRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n captureRequestBuilder.addTarget(surface);\n cameraDevice.createCaptureSession(Collections.singletonList(surface), new CameraCaptureSession.StateCallback(){\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n if (null == cameraDevice) {\n return;\n }\n cameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n Toast.makeText(MainActivity.this, \"Configuration change\", Toast.LENGTH_SHORT).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n Toast.makeText(MainActivity.this, \"Camera Surface failed to load.\", Toast.LENGTH_SHORT).show();\n e.printStackTrace();\n }\n }", "@Override\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//in the lifecycle of the Surface\n\t\t\tpublic void surfaceCreated(SurfaceHolder holder) {\t\t\t\t\t//This is where you connect Surface with its client\n\t\t\t\t//Tell the camera to use this surface as its preview area\n\t\t\t\ttry {\n\t\t\t\t\tif (mCamera != null) {\n\t\t\t\t\t\tmCamera.setPreviewDisplay(holder);\t\t\t\t\t\t//Set the surface to be used for preview\n\t\t\t\t\t}\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tLog.e(TAG, \"Error setting up preview display\", e);\n\t\t\t\t}\n\t\t\t}", "public void surfaceCreated(SurfaceHolder holder) {\n try {\n \tCamera.Parameters parameters = getOptimalPreviewSize(mCamera);\n \t\n \tthis.setLayoutParams(getLayoutParams(parameters.getPreviewSize()));\n \n parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);\n \n parameters.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO);\n \n parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);\n\n mCamera.setDisplayOrientation(90);\n \n mCamera.setParameters(parameters);\n mCamera.setPreviewDisplay(holder);\n mCamera.startPreview();\n } catch (IOException e) {\n Log.d(\"CameraView\", \"Error setting camera preview: \" + e.getMessage());\n }\n }", "public void surfaceCreated(SurfaceHolder holder) {\n try {\n mCamera.setPreviewDisplay(mImageCapture.mSurfaceHolder);\n setCameraDisplayOrientationByCameraSelected();\n } catch (IOException e) {\n Log.d(TAG, \"Error setting camera preview: \" + e.getMessage());\n }\n }", "public void setupPreview() {\n Log.i(TAG, \"setupPreview\");\n this.mFocusManager.resetTouchFocus();\n if (this.mAppController.getCameraProvider().isBoostPreview()) {\n this.mActivity.clearBoost();\n }\n startPreview();\n }", "@Override\n public void surfaceCreated(SurfaceHolder holder)\n {\n try\n {\n if (mCamera != null)\n {\n mCamera.setPreviewDisplay(holder);\n mCamera.setDisplayOrientation(90);\n }\n }\n catch (IOException e)\n {\n Log.e(\"ProfileCamera\", \"Error setting up preview display\", e);\n }\n }", "public void surfaceCreated(SurfaceHolder holder) {\n \t// Open camera \n\t\tCameraActivity.mCamera = Camera.open(); \n\t\tCameraActivity.mCamera.setDisplayOrientation(90);\n\t\t\n // The Surface has been created, now tell the camera where to draw the preview.\n try {\n\t\t\tCameraActivity.mCamera.setPreviewDisplay(holder);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n CameraActivity.mCamera.startPreview();\n }", "public void surfaceCreated(SurfaceHolder holder) {\n try {\n if (mCamera == null) {\n mCamera = getCameraInstance();\n }\n holder.addCallback(this);\n mCamera.setPreviewDisplay(holder);\n mCamera.startPreview();\n preview = true;\n } catch (IOException e) {\n Log.d(TAG, \"Error setting camera preview: \" + e.getMessage());\n }\n }", "public void surfaceCreated(SurfaceHolder holder) {\n try {\n mCamera.setPreviewDisplay(holder);\n mCamera.startPreview();\n } catch (IOException e) {\n Log.d(\"Preview\", \"Error setting camera preview: \" + e.getMessage());\n }\n }", "protected void createCameraPreview() {\n try {\n SurfaceTexture texture = mCameraTextureView.getSurfaceTexture();\n assert texture != null;\n texture.setDefaultBufferSize(mImageDimension.getWidth(), mImageDimension.getHeight());\n Surface surface = new Surface(texture);\n mCaptureRequestBuilder = mCameraDevice.\n createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\n mCaptureRequestBuilder.addTarget(surface);\n mCameraDevice.createCaptureSession(Collections.singletonList(surface),\n new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {\n //The camera is already closed\n if (null == mCameraDevice) {\n return;\n }\n // When the session is ready, we start displaying the preview.\n mCameraCaptureSessions = cameraCaptureSession;\n updatePreview();\n }\n\n @Override\n public void onConfigureFailed(@NonNull CameraCaptureSession cameraCaptureSession) {\n Toast.makeText(CameraActivity.this, \"Configuration change\",\n Toast.LENGTH_SHORT).show();\n }\n }, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "public void surfaceCreated(SurfaceHolder holder) {\n\t\tthis.camera = Camera.open();\r\n\t\t\r\n\t\ttry {\r\n\t\t\tcamera.setDisplayOrientation(90);\r\n\t\t\tcamera.setPreviewDisplay(holder);\r\n\t\t} catch (IOException e) {\r\n\t\t\tcamera.release();\r\n\t\t\tcamera = null;\r\n\t\t\tToast.makeText(this.getContext(), \"Error \"+e.toString(), Toast.LENGTH_LONG).show();\r\n\t\t}\r\n\t\t\t\t\t\t\r\n\t}", "private void initCaptureSetting(GLSurfaceView preview, FrameLayout window, GLSurfaceView remote) {\n RTCMediaStreamingManager.init(getApplicationContext());\n\n /**\n * Step 2: find & init views\n */\n\n /**\n * Step 3: config camera settings\n */\n CameraStreamingSetting.CAMERA_FACING_ID facingId = chooseCameraFacingId();\n if (mCameraStreamingSetting == null) {\n mCameraStreamingSetting = new CameraStreamingSetting();\n }\n mCameraStreamingSetting.setCameraFacingId(facingId)\n .setContinuousFocusModeEnabled(true)\n .setRecordingHint(false)\n .setResetTouchFocusDelayInMs(3000)\n .setFocusMode(CameraStreamingSetting.FOCUS_MODE_CONTINUOUS_PICTURE)\n .setCameraPrvSizeLevel(CameraStreamingSetting.PREVIEW_SIZE_LEVEL.MEDIUM)\n .setCameraPrvSizeRatio(CameraStreamingSetting.PREVIEW_SIZE_RATIO.RATIO_16_9)\n .setBuiltInFaceBeautyEnabled(true) // Using sdk built in face beauty algorithm\n .setFaceBeautySetting(new CameraStreamingSetting.FaceBeautySetting(0.8f, 0.8f, 0.6f)) // sdk built in face beauty settings\n .setVideoFilter(CameraStreamingSetting.VIDEO_FILTER_TYPE.VIDEO_FILTER_BEAUTY); // set the beauty on/off\n mCurrentCamFacingIndex = facingId.ordinal();\n\n /**\n * Step 4: create streaming manager and set listeners\n */\n if (mRTCStreamingManager == null) {\n mRTCStreamingManager = new RTCMediaStreamingManager(getApplicationContext(),\n preview, AVCodecType.SW_VIDEO_WITH_SW_AUDIO_CODEC);\n mRTCStreamingManager.prepare(mCameraStreamingSetting, null);\n }\n mRTCStreamingManager.setConferenceStateListener(mRTCStreamingStateChangedListener);\n mRTCStreamingManager.setRemoteWindowEventListener(mRTCRemoteWindowEventListener);\n mRTCStreamingManager.setUserEventListener(mRTCUserEventListener);\n mRTCStreamingManager.setDebugLoggingEnabled(false);\n mRTCStreamingManager.mute(true);\n\n /**\n * Step 5: set conference options\n */\n RTCConferenceOptions confOptions = new RTCConferenceOptions();\n // vice anchor can use a smaller size\n // RATIO_4_3 & VIDEO_ENCODING_SIZE_HEIGHT_240 means the output size is 320 x 240\n // 4:3 looks better in the mix frame\n confOptions.setVideoEncodingSizeRatio(RTCConferenceOptions.VIDEO_ENCODING_SIZE_RATIO.RATIO_4_3);\n confOptions.setVideoEncodingSizeLevel(RTCConferenceOptions.VIDEO_ENCODING_SIZE_HEIGHT_240);\n // vice anchor can use a higher conference bitrate for better image quality\n confOptions.setVideoBitrateRange(300 * 1000, 800 * 1000);\n // 20 fps is enough\n confOptions.setVideoEncodingFps(20);\n confOptions.setHWCodecEnabled(false);\n mRTCStreamingManager.setConferenceOptions(confOptions);\n\n /**\n * Step 6: create the remote windows\n */\n if (mRTCVideoWindow == null) {\n mRTCVideoWindow = new RTCVideoWindow(window, remote);\n\n /**\n * Step 8: add the remote windows\n */\n mRTCStreamingManager.addRemoteWindow(mRTCVideoWindow);\n }\n\n /**\n * Step 9: do prepare, anchor should config streaming profile first\n */\n StreamingProfile mStreamingProfile = new StreamingProfile();\n mStreamingProfile.setEncodingOrientation(\n isLandscape() ? StreamingProfile.ENCODING_ORIENTATION.LAND : StreamingProfile.ENCODING_ORIENTATION.PORT);\n mRTCStreamingManager.setStreamingProfile(mStreamingProfile);\n }", "public void surfaceCreated(SurfaceHolder holder) {\n\t\t\tif (DEBUG>=2) Log.d(TAG, \"surfaceCreated'd\");\n\n\t\t\t// The Surface has been created, acquire the camera and tell it\n\t\t\t// where to draw.\n\t\t\t//mCamera = Camera.open();\n\t\t\ttry {\n\n\t\t\t\tmCamera.setPreviewDisplay(holder);\n\t\t\t\tmCamera.setPreviewCallback(new PreviewCallback() {\n\t\t\t\t\t//\n\t\t\t\t\t// FIXME - Take these callbacks out of inline. Read\n\t\t\t\t\t// somewhere this was an efficiency problem\n\t\t\t\t\t//\n\t\t\t\t\t// Called for each frame previewed\n\t\t\t\t\tpublic void onPreviewFrame(byte[] data, Camera camera) {\n\t\t\t\t\t\t//Log.w(TAG, \"onPreviewFrame'd\");\n\n\t\t\t\t\t\t// Allocate space for processing buffer. Allow it\n\t\t\t\t\t\t// to grow if necessary. No max cap.\n\t\t\t\t\t\tint size = data.length;\n\t\t\t\t\t\tif (data.length > BUFALLOCSIZE) {\n\t\t\t\t\t\t\t// Buffer is not big enough for data\n\t\t\t\t\t\t\t// allocate more spacs.\n\t\t\t\t\t\t\t//Log.v(TAG, \"Allocating bufer for size: \" + Integer.toString(size));\n\t\t\t\t\t\t\tdecodeBuf = new int[size];\n\t\t\t\t\t\t\tBUFALLOCSIZE = size;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Set the w and h for the yuv image processing. \n\t\t\t\t\t\t\t// Don't need an actual picture dimension because\n\t\t\t\t\t\t\t// I am not doing anything with the converted\n\t\t\t\t\t\t\t// rgb image except grabbing a pixel. Set dims\n\t\t\t\t\t\t\t// to just a single row.\n\t\t\t\t\t\t\tyuv_w = size;\n\t\t\t\t\t\t\tyuv_h = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Discard frames until processing completes\n\t\t\t\t\t\tif (FRAMEBUFFER_IS == AVAILABLE) {\n\t\t\t\t\t\t\tif (DEBUG>=2) Log.d(TAG, \"Framebuffer available for reuse\");\n\t\t\t\t\t\t\tnew HandleFrameTask().execute(data);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tPreview.this.invalidate();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} catch (IOException e) {\n\t\t\t\tmCamera.release();\n\t\t\t\tmCamera = null;\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}", "public void surfaceCreated(SurfaceHolder holder) {\n\t\topenCamera(holder);\n\t\trequestAF();\n\t\trequestPreview();\n\t}", "private void initData() {\n mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {\n @Override\n public void surfaceCreated(SurfaceHolder surfaceHolder) {\n CameraControl.getInstance().initRender(mSurfaceView.getHolder(), mSurfaceView);\n CameraControl.getInstance().startStreamAndPreview();\n }\n\n @Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {\n if (mSurfaceView.getHolder() == holder) {\n CameraControl.getInstance().setDrawingArea(width, height);\n }\n }\n\n @Override\n public void surfaceDestroyed(SurfaceHolder surfaceHolder) {\n CameraControl.getInstance().stopMediaStreamAndPreview();\n }\n });\n flyControlData = FlyControlData.getInstance();\n }", "private void onSurfaceReceived() {\n List<Surface> surfaceList = new ArrayList<Surface>();\n surfaceList.add(targetSurface);\n try {\n cameraDevice.createCaptureSession(surfaceList, new CameraCaptureSession.StateCallback() {\n @Override\n public void onConfigured(CameraCaptureSession session) {\n onSurfaceConfigured(session);\n }\n\n @Override\n public void onConfigureFailed(CameraCaptureSession session) {\n System.out.println(\"CAMERA CONFIGURE FAILED\");\n }\n }, null);\n } catch(Exception e) {\n System.out.println(\"FAILED TO START CAPTURE SESSION\");\n e.printStackTrace();\n }\n }", "private void startPreview() {\n if (cameraConfigured && camera!=null) {\n camera.startPreview();\n inPreview=true;\n }\n }", "protected void initRecorderParameters() {\n\t\tmMediaRecorder.setCamera(mCamera);\n\t\tmMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);\n\t\tmMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);\n\t\tmMediaRecorder.setVideoEncoder(mVideoEncoder);\n\t\tmMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());\n\t\tmMediaRecorder.setVideoSize(mQuality.resX,mQuality.resY);\n\t\tmMediaRecorder.setVideoFrameRate(mQuality.framerate);\n\t\tmMediaRecorder.setVideoEncodingBitRate(mQuality.bitrate);\n\t\tmMediaRecorder.setOrientationHint(mQuality.orientation);\n\t}", "private void onSurfaceConfigured(CameraCaptureSession session) {\n try {\n CaptureRequest.Builder requestBuilder = session.getDevice().createCaptureRequest(CameraDevice.TEMPLATE_RECORD);\n requestBuilder.addTarget(targetSurface);\n\n session.setRepeatingRequest(requestBuilder.build(), new CameraCaptureSession.CaptureCallback() {\n public void process(CaptureResult result) {\n onImageProcessed();\n }\n\n @Override\n public void onCaptureProgressed(@NonNull CameraCaptureSession session,\n @NonNull CaptureRequest request,\n @NonNull CaptureResult partialResult) {\n process(partialResult);\n }\n\n @Override\n public void onCaptureCompleted(@NonNull CameraCaptureSession session,\n @NonNull CaptureRequest request,\n @NonNull TotalCaptureResult result) {\n process(result);\n }\n }, new Handler());\n\n } catch (CameraAccessException e) {\n System.out.println(\"CAPTURE CONFIGURE FAILED\");\n e.printStackTrace();\n }\n }", "public void onPreviewStarted() {\n Log.w(TAG, \"KPI video preview started\");\n this.mAppController.setShutterEnabled(true);\n this.mAppController.onPreviewStarted();\n this.mUI.clearEvoPendingUI();\n if (this.mFocusManager != null) {\n this.mFocusManager.onPreviewStarted();\n }\n if (isNeedStartRecordingOnSwitching()) {\n onShutterButtonClick();\n }\n }", "@Override\n protected void onStart() {\n camera_ = getCameraInstance();\n Parameters params;\n\n if (camera_ != null) {\n params = camera_.getParameters();\n params.setPreviewFormat(ImageFormat.NV21);\n getSmallestPreviewSize(params);\n params.setPreviewSize(width_, height_);\n //params.setFlashMode(Parameters.FLASH_MODE_TORCH);\n params.setWhiteBalance(Parameters.WHITE_BALANCE_AUTO);\n camera_.setParameters(params);\n\n frame_ = new RGB[width_ * height_];\n for (int i = 0; i < frame_.length; ++i) {\n frame_[i] = new RGB();\n }\n\n camera_.setPreviewCallback(new PreviewCallback() {\n @Override\n public void onPreviewFrame(byte[] data, Camera camera) {\n synchronized (frame_) {\n decodeYUV420SP(frame_, data, width_, height_);\n }\n }\n });\n SurfaceTexture texture_ = new SurfaceTexture(0);\n try {\n camera_.setPreviewTexture(texture_);\n } catch (IOException e) {\n e.printStackTrace();\n }\n camera_.startPreview();\n }\n\n super.onStart();\n }", "public void surfaceCreated(SurfaceHolder holder) {\n Log.i(TAG, \"surface created\");\n if (mCamera != null) {\n final Camera.Parameters params = mCamera.getParameters();\n final List<Camera.Size> sizes = params.getSupportedPreviewSizes();\n final int screenWidth = ((View) getParent()).getWidth();\n int minDiff = Integer.MAX_VALUE;\n Camera.Size bestSize = null;\n\n /*\n * Impostazione dimensione frame a seconda delle dimensioni ottimali e dell'orientamento\n */\n if (getResources().getConfiguration().orientation\n == Configuration.ORIENTATION_LANDSCAPE) {\n for (Camera.Size size : sizes) {\n final int diff = Math.abs(size.width - screenWidth);\n if (diff < minDiff) {\n minDiff = diff;\n bestSize = size;\n }\n }\n } else {\n mCamera.setDisplayOrientation(90);\n for (Camera.Size size : sizes) {\n final int diff = Math.abs(size.height - screenWidth);\n if (Math.abs(size.height - screenWidth) < minDiff) {\n minDiff = diff;\n bestSize = size;\n }\n }\n }\n\n final int previewWidth = bestSize.width;\n final int previewHeight = bestSize.height;\n mHeight = previewHeight;\n mWidth = previewWidth;\n\n ViewGroup.LayoutParams layoutParams = getLayoutParams();\n layoutParams.height = previewHeight;\n layoutParams.width = previewWidth;\n setLayoutParams(layoutParams);\n\n // FORMATO PREVIEW\n params.setPreviewFormat(ImageFormat.NV21);\n params.setPreviewSize(previewWidth, previewHeight);\n params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\n\n mCamera.setParameters(params);\n\n //buffer di uscita\n int size = previewWidth * previewHeight *\n ImageFormat.getBitsPerPixel(params.getPreviewFormat()) / 8;\n setupCallback(size);\n\n // Esecuzione preview\n try {\n mCamera.setPreviewDisplay(holder);\n mCamera.startPreview();\n Log.i(TAG, \"preview started\");\n } catch (IOException e) {\n Log.e(TAG, \"Error setting camera preview: \" + e.getMessage());\n }\n\n }\n }", "private void startPreview(CameraCaptureSession session) throws CameraAccessException{\n mPreviewBuilder.addTarget(mSurface);\n mPreviewBuilder.addTarget(mImageReader.getSurface());\n session.setRepeatingRequest(mPreviewBuilder.build(), mSessionCaptureCallback, mCamSessionHandler);\n }", "public void prepareCamera() {\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n\n autoFocusHandler = new Handler();\n mCamera = getCameraInstance();\n\n /* Instance barcode scanner */\n scanner = new ImageScanner();\n scanner.setConfig(0, Config.X_DENSITY, 3);\n scanner.setConfig(0, Config.Y_DENSITY, 3);\n\n mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);\n\n cameraPreview.addView(mPreview);\n\n }", "public void surfaceCreated(SurfaceHolder holder)\n {\n System.out.println( \"surfaceCreated\" );\n ready = true;\n if (thread == null)\n {\n thread = new DriverThread(renderer);\n thread.start();\n }\n }", "private void initPreview(int width, int height) {\n if (camera!=null && previewHolder.getSurface()!=null) {\n try {\n camera.setPreviewDisplay(previewHolder);\n }\n catch (Throwable t) {\n Log.e(\"PreviewDemo-surfaceCallback\",\n \"ExceptionsetPreviewDisplay()\", t);\n // Toast.makeText(PreviewDemo.this, t.getMessage(), Toast.LENGTH_LONG).show();\n }\n\n if (!cameraConfigured) {\n Camera.Parameters parameters=camera.getParameters();\n Camera.Size size=getBestPreviewSize(width, height,\n parameters);\n\n if (size!=null) {\n parameters.setPreviewSize(size.width, size.height);\n camera.setParameters(parameters);\n cameraConfigured=true;\n }\n }\n }\n }", "@Override\r\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\tinitialCamera();\r\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n this.requestWindowFeature(Window.FEATURE_NO_TITLE);\n this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);\n setContentView(R.layout.main);\n cameraframe = (FrameLayout) findViewById(R.id.preview);\n overlayview = new ImageView(getApplicationContext());\n\t overlayview.setScaleType(ImageView.ScaleType.FIT_XY);\n\n previewing=false;\n freestyle=false;\n \n\t// set up camera, start button\n cameraView = new Preview(this); // <3>\n\n\t cameraframe.addView(cameraView,0); // <4>\n\n\t \n\t\n\t\n\t setupButtons();\n initCamera();\n \n \n\t\n\t\n\t\n \n\tloadFrames();\n\t initFileSystem();\n\t \n //retakeButton.setEnabled(false);\n\t toggleMode();\n \n Log.d(TAG, \"Fully initialized\");\n }", "public void surfaceCreated(SurfaceHolder holder) {\n mSurface = holder.getSurface();\n startARX();\n }", "public void onPreviewStarted() {\n if (!this.mPaused) {\n Log.w(TAG, \"KPI photo preview started\");\n this.mAppController.onPreviewStarted();\n this.mAppController.setShutterEnabled(true);\n this.mAppController.setShutterButtonLongClickable(this.mIsImageCaptureIntent ^ 1);\n this.mAppController.getCameraAppUI().enableModeOptions();\n this.mUI.clearEvoPendingUI();\n if (this.mEvoFlashLock != null) {\n this.mAppController.getButtonManager().enableButtonWithToken(0, this.mEvoFlashLock.intValue());\n this.mEvoFlashLock = null;\n }\n if (this.mCameraState == 7) {\n setCameraState(5);\n } else {\n setCameraState(1);\n }\n if (isCameraFrontFacing()) {\n this.mUI.setZoomBarVisible(false);\n } else {\n this.mUI.setZoomBarVisible(true);\n }\n if (this.mActivity.getCameraAppUI().isNeedBlur() || onGLRenderEnable()) {\n new Handler().postDelayed(new Runnable() {\n public void run() {\n PhotoModule.this.startFaceDetection();\n }\n }, 1500);\n } else {\n startFaceDetection();\n }\n BoostUtil.getInstance().releaseCpuLock();\n if (this.mIsGlMode) {\n this.mActivity.getCameraAppUI().hideImageCover();\n if (this.mActivity.getCameraAppUI().getBeautyEnable()) {\n this.mActivity.getCameraAppUI().getCameraGLSurfaceView().queueEvent(new Runnable() {\n public void run() {\n PhotoModule.this.mActivity.getButtonManager().setSeekbarProgress((int) PhotoModule.this.mActivity.getCameraAppUI().getBeautySeek());\n PhotoModule.this.updateBeautySeek(PhotoModule.this.mActivity.getCameraAppUI().getBeautySeek() / 20.0f);\n }\n });\n }\n if (this.mActivity.getCameraAppUI().getEffectEnable()) {\n this.mActivity.getCameraAppUI().getCameraGLSurfaceView().queueEvent(new Runnable() {\n public void run() {\n if (TextUtils.isEmpty(PhotoModule.this.mActivity.getCameraAppUI().getCurrSelect())) {\n BeaurifyJniSdk.preViewInstance().nativeDisablePackage();\n } else {\n BeaurifyJniSdk.preViewInstance().nativeChangePackage(PhotoModule.this.mActivity.getCameraAppUI().getCurrSelect());\n }\n }\n });\n }\n }\n }\n }", "public void surfaceCreated(SurfaceHolder holder) {\n startCamera(holder);\n }", "public void surfaceChanged(SurfaceHolder holder, int format, int width,\n int height) {\n if(previewing){\n camera.stopPreview();\n previewing = false;\n }\n\n if (camera != null){\n try {\n camera.setPreviewDisplay(surfaceHolder);\n camera.startPreview();\n previewing = true;\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n }", "@Override\n public Camera setupCamera() {\n mCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);\n try {\n Camera.Parameters parameters = mCamera.getParameters();\n parameters.setPreviewSize(mWidth, mHeight);\n parameters.setPreviewFormat(mFormat);\n mCamera.setDisplayOrientation(90);\n for (Camera.Size size : parameters.getSupportedPreviewSizes()) {\n Log.d(TAG, \"SIZE:\" + size.width + \"x\" + size.height);\n }\n for (Integer format : parameters.getSupportedPreviewFormats()) {\n Log.d(TAG, \"FORMAT:\" + format);\n }\n\n List<int[]> fps = parameters.getSupportedPreviewFpsRange();\n for (int[] count : fps) {\n Log.d(TAG, \"T:\");\n for (int data : count) {\n Log.d(TAG, \"V=\" + data);\n }\n }\n mCamera.setParameters(parameters);\n } catch (Exception e) {\n e.printStackTrace();\n }\n if (mCamera != null) {\n mWidth = mCamera.getParameters().getPreviewSize().width;\n mHeight = mCamera.getParameters().getPreviewSize().height;\n }\n return mCamera;\n }", "private void createCamera() {\n camera = getCameraInstance();\n // Setting the right parameters in the camera\n SetCameraParameters();\n // Create our Preview view and set it as the content of our activity.\n camera_preview = new CameraPreview(this, camera);\n // Adding the camera preview after the FrameLayout and before the mainact_btn_InOutAct\n // as a separated element.\n InOut_cameraLayout.addView(camera_preview, 0);\n }", "public void testSurfaceRecording() {\n assertTrue(testRecordFromSurface(false /* persistent */, false /* timelapse */));\n }", "@Override\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\tLog.e(TAG,\"Surface Created\");\n\t\tcamera = Camera.open();\n\t}", "public void surfaceCreated(SurfaceHolder holder)\n {\n Log.d(LOGTAG, \"surfaceCreated\");\n\n MediaProxy.getInstance().setDisplay(holder);\n }", "public void onStart() {\n\n mVideoFolder = createVideoFolder();\n mImageFolder = createImageFolder();\n mMediaRecorder = new MediaRecorder();\n\n startBackgroundThread();\n\n if (mTextureView.isAvailable()) {\n // TODO: see Google Example add comments\n // pause and resume\n openCamera(mTextureView.getWidth(), mTextureView.getHeight());\n\n } else {\n // first time\n mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);\n }\n }", "@Override\n public void onClick(View v) {\n if (!previewing) {\n camera = Camera.open();\n if (camera != null) {\n try {\n camera.setPreviewDisplay(surfaceHolder);\n camera.startPreview();\n previewing = true;\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n }\n }", "public final void setPreviewDisplay(SurfaceHolder holder) throws IOException {\n setPreviewDisplay(holder.getSurface());\n }", "void initializeCamera() {\n camera_linear = (LinearLayout) findViewById(R.id.camera_linear);\n //The preview frame is overlayed on the layout which shows the camera view.\n preview = (FrameLayout) findViewById(R.id.camera_preview);\n //Get an instance of the phone's camera.\n mCamera = cameraRecorder.getCameraInstance();\n //Find content fort the camera preview frame using the instance of the camera initialized.\n mPreview = new CameraPreview(getApplicationContext(), mCamera);\n //Apply the camera previes content from the camera to the preview frame itself.\n preview.addView(mPreview);\n }", "@Override\r\n\tpublic void surfaceCreated(SurfaceHolder holder) \r\n\t{\n\t\t if (mCamera != null)\r\n\t\t {\r\n\t\t\t Parameters params = mCamera.getParameters();\r\n\t mCamera.setParameters(params);\r\n\t Log.i(\"Surface\", \"Created\");\r\n\t }\r\n\t\t else\r\n\t\t {\r\n\t\t\t Toast.makeText(getApplicationContext(), \"Camera not available!\",\r\n\t Toast.LENGTH_LONG).show();\r\n\r\n\t finish();\r\n\t }\r\n\t}", "@Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)\n {\n this.setCameraParameters(mcCamera);\n\n if (mcCamera != null)\n mcCamera.startPreview();\n }", "@Override\n public void surfaceCreated(SurfaceHolder holder) {\n Log.d(TAG, \"surfaceCreated\");\n mRenderingPaused = false;\n mHolder = holder;\n updateRenderingState();\n }", "@Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {\n Log.i(TAG, \"surface changed\");\n\n if (mHolder.getSurface() == null) {\n // preview surface does not exist\n return;\n }\n\n // stop preview before making changes\n try {\n mCamera.stopPreview();\n } catch (Exception e) {\n // ignore: tried to stop a non-existent preview\n }\n\n // start preview with new settings\n try {\n mCamera.setPreviewCallback(this);\n mCamera.setPreviewDisplay(mHolder);\n mCamera.startPreview();\n Log.i(TAG, \"surface changed\");\n } catch (Exception e) {\n Log.e(TAG, \"Error starting camera preview: \" + e.getMessage());\n }\n }", "public void startPreview() {\r\n\t\tCamera localCamera = camera;\r\n\t\tif (localCamera != null && !isPreview) {\r\n\t\t\tcamera.startPreview();\r\n\t\t\tisPreview = true;\r\n\t\t}\r\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n \tsuper.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n\n checkCameraHardware(this);\n // Create an instance of Camera\n mCamera = getCameraInstance();\n\n // Create our Preview view and set it as the content of our activity.\n mPreview = new CameraPreview(this, mCamera);\n FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);\n preview.addView(mPreview);\n\n // Add a listener to the Capture button\n\t\tButton captureButton = (Button) findViewById(R.id.button_capture);\n\t\tcaptureButton.setOnClickListener(\n\t\t new View.OnClickListener() {\n\t\t @Override\n\t\t public void onClick(View v) {\n\n\t\t if (isRecording) {\n\t\t \t// stop recording and release camera\n\t\t Log.d(TAG, \"isRecording: \");\n\t\t \t\n\t\t releaseMediaRecorder(); // release the MediaRecorder object\n\n\t\t try {\n\t\t \tif (socket != null) {\n\t\t \t\tsocket.close();\n\t\t \t}\n\t\t } catch (IOException e) {\n\t\t \tLog.d(TAG, \"IOException: \" + e.getMessage());\n\t\t }\n\n\t \tmCamera.lock(); // take camera access back from MediaRecorder\n\t\t isRecording = false;\n\n\t\t } else {\n\t\t \t// initialize video camera\n\t\t if (prepareVideoRecorder()) {\n\t\t // Camera is available and unlocked, MediaRecorder is prepared,\n\t\t // now you can start recording\n\t\t mMediaRecorder.start();\n\n\t\t // inform the user that recording has started\n\t\t //setCaptureButtonText(\"Stop\");\n\t\t isRecording = true;\n\t\t } else {\n\t\t // prepare didn't work, release the camera\n\t\t releaseMediaRecorder();\n\t\t // inform user\n\t\t }\n\t\t }\n\t\t }\n\t\t }\n\t\t);\n }", "public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {\n if (preview) {\n Cam.stopPreview();\n preview = false;\n }\n // stop preview before making changes\n try {\n mCamera.setPreviewDisplay(holder);\n setCameraDisplayOrientation(mCamera);\n mCamera.startPreview();\n preview = true;\n } catch (Exception e) {\n // ignore: tried to stop a non-existent preview\n Log.d(TAG, \"Error starting camera preview 1: \" + e.getMessage());\n\n }\n\n // set preview size and make any resize, rotate or\n // reformatting changes here\n // start preview with new settings\n }", "public void display() {\n startPreview();\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_camera);\n\n Button buttonStartCameraPreview = (Button) findViewById(R.id.startcamerapreview);\n Button buttonStopCameraPreview = (Button) findViewById(R.id.stopcamerapreview);\n\n getWindow().setFormat(PixelFormat.UNKNOWN);\n surfaceView = (SurfaceView) findViewById(R.id.surfaceview);\n surfaceHolder = surfaceView.getHolder();\n surfaceHolder.addCallback(this);\n surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);\n\n buttonStartCameraPreview.setOnClickListener(new Button.OnClickListener() {\n\n @Override\n public void onClick(View v) {\n // TODO Auto-generated method stub\n if (!previewing) {\n camera = Camera.open();\n if (camera != null) {\n try {\n camera.setPreviewDisplay(surfaceHolder);\n camera.startPreview();\n previewing = true;\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n }\n }\n });\n\n buttonStopCameraPreview.setOnClickListener(new Button.OnClickListener() {\n\n @Override\n public void onClick(View v) {\n // TODO Auto-generated method stub\n if (camera != null && previewing) {\n camera.stopPreview();\n camera.release();\n camera = null;\n\n previewing = false;\n }\n }\n });\n\n\n camera.startPreview();\n\n\n Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {\n public void onPictureTaken(byte[] imageData, Camera c) {\n\n\n camera.startPreview();\n }\n };\n\n\n }", "private Surface getPreviewSurface() {\n return surface_texture;\n }", "@Override\n public void onOpened(@NonNull CameraDevice camera) {\n mCameraDevice = camera;\n if (mIsRecording) {\n try {\n mVideoFilePath = FileUtils.createVideoFile(getApplicationContext());\n } catch (IOException e) {\n e.printStackTrace();\n }\n startNewVideo();\n } else {\n startPreview();\n }\n }", "@Override\n public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {\n setupCamera(width, height);\n openCamera();\n }", "@Override\n public void run() {\n preview.startAnimation(fadein);\n //Launch camera layout\n camera_linear.startAnimation(fadein);\n //Launch capture button\n captureButton.startAnimation(fadein);\n //Make these components visible\n preview.setVisibility(View.VISIBLE);\n captureButton.setVisibility(View.VISIBLE);\n camera_linear.setVisibility(View.VISIBLE);\n //Create onClickListener for the capture button\n captureButton.setOnClickListener(\n new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n // get an image from the camera\n if(cameraRecorder.getSafeToTakePicture()) {\n Log.i(\"Taking Picture: \", \"Safe\");\n captureButton.setImageResource(R.drawable.kids_ui_record_anim_alt_mini);\n mCamera.takePicture(null, null, mPicture);\n cameraRecorder.setSafeToTakePicture(false);\n }\n\n else {\n Log.i(\"Taking Picture: \", \"Unsafe\");\n }\n }\n }\n );\n\n }", "public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {\n if (mHolder.getSurface() == null){\n // preview surface does not exist\n return;\n }\n // stop preview before making changes\n try {\n mCamera.stopPreview();\n } catch (Exception e){\n // ignore: tried to stop a non-existent preview\n }\n // set preview size and make any resize, rotate or\n // reformatting changes here\n // start preview with new settings\n try {\n Camera.Parameters parameters = getOptimalPreviewSize(mCamera);\n \n this.setLayoutParams(getLayoutParams(parameters.getPreviewSize()));\n \n parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);\n \n parameters.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO);\n \n parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);\n\n mCamera.setDisplayOrientation(90);\n \n mCamera.setParameters(parameters);\n mCamera.setPreviewDisplay(mHolder);\n mCamera.startPreview();\n } catch (Exception e){\n Log.d(\"CameraView\", \"Error starting camera preview: \" + e.getMessage());\n }\n }", "public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {\n\n if (mHolder.getSurface() == null){\n // preview surface does not exist\n return;\n }\n\n // stop preview before making changes\n try {\n \tCameraActivity.mCamera.stopPreview();\n } catch (Exception e){\n // ignore: tried to stop a non-existent preview\n }\n\n // set preview size and make any resize, rotate or\n // reformatting changes here\n\n // start preview with new settings\n try {\n \tCameraActivity.mCamera.setPreviewDisplay(mHolder);\n \tCameraActivity.mCamera.startPreview();\n } catch (Exception e){\n Log.d(TAG, \"Error starting camera preview: \" + e.getMessage());\n }\n }", "public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {\n\n if (this.holder.getSurface() == null){\n // preview surface does not exist\n return;\n }\n\n stopCamera();\n startCamera(holder);\n }", "@Override\n public void surfaceCreated(SurfaceHolder holder) {\n // создаём поток прорисовки\n drawThread = new DrawThread(getHolder());\n drawThread.setRunning(true);\n drawThread.start();\n }", "private void initCameraPreview() {\n\t\tcameraPreview = (CameraPreview) findViewById(R.id.camera_preview);\n\t\tcameraPreview.init(camera);\n\t}", "public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {\n\n\t\tif (mHolder.getSurface() == null) {\n\t\t\t// preview surface does not exist\n\t\t\treturn;\n\t\t}\n\n\t\t// stop preview before making changes\n\t\ttry {\n\t\t\tmCamera.stopPreview();\n\t\t} catch (Exception e) {\n\t\t\t// camera does not exist or is not previewing\n\t\t}\n\n\t\t// Once rotation is enabled, code for that will go here\n\n\t\t// start preview with new settings\n\t\ttry {\n\t\t\tmCamera.setPreviewDisplay(mHolder);\n\t\t\tmCamera.startPreview();\n\n\t\t} catch (Exception e) {\n\t\t\tLog.d(VIEW_LOG_TAG,\n\t\t\t\t\t\"Error starting camera preview: \" + e.getMessage());\n\t\t}\n\t}", "private void setupCamera(final int camera) {\n try {\n // mPreview = new CamPreview(this, camera, CamPreview.LayoutMode.NoBlank);// .FitToParent);\n } catch (Exception e) {\n Toast.makeText(this, R.string.cannot_connect_to_camera, Toast.LENGTH_LONG).show();\n finish();\n return;\n }\n\n RelativeLayout.LayoutParams previewLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);\n Display display = getWindowManager().getDefaultDisplay();\n DisplayMetrics outMetrics = new DisplayMetrics();\n display.getMetrics(outMetrics);\n\n int width = outMetrics.widthPixels;\n int height = outMetrics.heightPixels;\n\n previewLayoutParams.height = width;\n previewLayoutParams.width = width;\n\n // Un-comment below line to specify the position.\n // mPreview.setCenterPosition(width / 2, height / 2);\n\n // previewParent.addView(mPreview, 0, previewLayoutParams);\n\n\n }", "@Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {\n if (holder.getSurface() == null) {\n Log.d(TAG, \"holder.getSurface() == null\");\n return;\n }\n\n mSurfaceHolder = holder;\n\n if (mPausing) {\n // We're pausing, the screen is off and we already stopped\n // video recording. We don't want to start the camera again\n // in this case in order to conserve power.\n // The fact that surfaceChanged is called _after_ an onPause appears\n // to be legitimate since in that case the lockscreen always returns\n // to portrait orientation possibly triggering the notification.\n return;\n }\n\n // The mCameraDevice will be null if it is fail to connect to the\n // camera hardware. In this case we will show a dialog and then\n // finish the activity, so it's OK to ignore it.\n if (mCameraDevice == null) {\n return;\n }\n\n // Set preview display if the surface is being created. Preview was\n // already started.\n if (holder.isCreating()) {\n setPreviewDisplay(holder);\n } else {\n restartPreview();\n }\n }", "private void init()\n {\n holder = getHolder();\n holder.addCallback(this);\n holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);\n }", "@Override\n\tpublic void surfaceChanged(SurfaceHolder holder, int format, int width,\n\t\t\tint height) {\n\t\tLog.e(TAG,\"SurfaceChanged\");\n\t\ttry{\n\t\t\tif(mPreviewRunning){\n\t\t\t\tcamera.stopPreview();\n\t\t\t\tmPreviewRunning = false;\n\t\t\t}\n\t\t\t\n\t\t\tCamera.Parameters p = camera.getParameters();\n\t\t\tp.setPreviewSize(width,height);\n\t\t\t\n\t\t\tcamera.setParameters(p);\n\t\t\tcamera.setPreviewDisplay(holder);\n\t\t\tcamera.startPreview();\n\t\t\tmPreviewRunning = true;\n\t\t}catch(Exception e){\n\t\t\tLog.d(\"\",e.toString());\n\t\t}\n\t}", "private void videoRecordingPrepared() {\n Log.d(\"Camera\", \"videoRecordingPrepared()\");\n isCameraXHandling = false;\n // Keep disabled status for a while to avoid fast click error with \"Muxer stop failed!\".\n binding.capture.postDelayed(() -> binding.capture.setEnabled(true), 500);\n }", "@Override\n public void onConfigured(@NonNull CameraCaptureSession session) {\n if (MyDebug.LOG) {\n Log.d(TAG, \"onConfigured: \" + session);\n Log.d(TAG, \"captureSession was: \" + captureSession);\n }\n if (camera == null) {\n if (MyDebug.LOG) {\n Log.d(TAG, \"camera is closed\");\n }\n synchronized (background_camera_lock) {\n callback_done = true;\n background_camera_lock.notifyAll();\n }\n return;\n }\n synchronized (background_camera_lock) {\n captureSession = session;\n Surface surface = getPreviewSurface();\n previewBuilder.addTarget(surface);\n if (video_recorder != null)\n previewBuilder.addTarget(video_recorder_surface);\n try {\n setRepeatingRequest();\n } catch (CameraAccessException e) {\n if (MyDebug.LOG) {\n Log.e(TAG, \"failed to start preview\");\n Log.e(TAG, \"reason: \" + e.getReason());\n Log.e(TAG, \"message: \" + e.getMessage());\n }\n e.printStackTrace();\n // we indicate that we failed to start the preview by setting captureSession back to null\n // this will cause a CameraControllerException to be thrown below\n captureSession = null;\n }\n }\n synchronized (background_camera_lock) {\n callback_done = true;\n background_camera_lock.notifyAll();\n }\n }", "private boolean prepareMediaRecorder() {\n if (mediaRecorder == null)\n mediaRecorder = new MediaRecorder();\n\n // according to API documents, this should not really be necessary, but the app crashes if not called\n mCamera.unlock();\n\n mediaRecorder.setCamera(mCamera);\n mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);\n mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);\n\n mProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);\n mediaRecorder.setProfile(mProfile);\n\n mediaRecorder.setOutputFile(getOutputFileName());\n //mediaRecorder.setMaxDuration(60000); // Set max duration 60 sec.\n //mediaRecorder.setMaxFileSize(5000000); // Set max file size 5M\n\n // set preview to previewholder\n // this is actually not needed when it is already set on the Camera object\n if (mCameraPreview != null) {\n mediaRecorder.setPreviewDisplay(mCameraPreview.getHolder().getSurface());\n }\n\n try {\n mediaRecorder.prepare();\n } catch (IllegalStateException e) {\n releaseMediaRecorder();\n return false;\n } catch (IOException e) {\n releaseMediaRecorder();\n return false;\n }\n\n return true;\n }", "@Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width,\n int height) {\n if (holder.getSurface() == null) {\n Log.d(TAG, \"holder.getSurface() == null\");\n return;\n }\n\n // We need to save the holder for later use, even when the mCameraDevice\n // is null. This could happen if onResume() is invoked after this\n // function.\n mSurfaceHolder = holder;\n\n // The mCameraDevice will be null if it fails to connect to the camera\n // hardware. In this case we will show a dialog and then finish the\n // activity, so it's OK to ignore it.\n if (mCameraDevice == null)\n return;\n\n // Sometimes surfaceChanged is called after onPause or before onResume.\n // Ignore it.\n if (mPausing || isFinishing())\n return;\n\n // Set preview display if the surface is being created. Preview was\n // already started. Also restart the preview if display rotation has\n // changed. Sometimes this happens when the device is held in portrait\n // and camera app is opened. Rotation animation takes some time and\n // display rotation in onCreate may not be what we want.\n if (mCameraState == PREVIEW_STOPPED) {\n startPreview();\n } else {\n if (Util.getDisplayRotation(this) != mDisplayRotation) {\n setDisplayOrientation();\n }\n if (holder.isCreating()) {\n // Set preview display if the surface is being created and\n // preview\n // was already started. That means preview display was set to\n // null\n // and we need to set it now.\n setPreviewDisplay(holder);\n }\n }\n\n // If first time initialization is not finished, send a message to do\n // it later. We want to finish surfaceChanged as soon as possible to let\n // user see preview first.\n if (!mFirstTimeInitialized) {\n mHandler.sendEmptyMessage(FIRST_TIME_INIT);\n } else {\n initializeSecondTime();\n }\n }", "@Override public void surfaceCreated(SurfaceHolder holder) {\n\t\t\t}", "public interface CameraPreview {\n\n /**\n * Set the camera system this will act as the preview for.\n * <p/>\n * The preview will update the camera system as necessary for certain events, such as\n * setting the surface holder, or pausing/restarting the preview when reconfiguring the surface.\n *\n * @param cameraSystem the camera system to connect to\n */\n void connectToCameraSystem(@NonNull CameraSystem cameraSystem);\n\n}", "public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {\n\n if (mHolder.getSurface() == null){\n // preview surface does not exist\n return;\n }\n\n // stop preview before making changes\n try {\n mCamera.stopPreview();\n } catch (Exception e){\n // ignore: tried to stop a non-existent preview\n }\n\n // set preview size and make any resize, rotate or\n // reformatting changes here\n\n // start preview with new settings\n try {\n mCamera.setPreviewDisplay(mHolder);\n mCamera.startPreview();\n\n } catch (Exception e){\n Log.d(\"Preview\", \"Error starting camera preview: \" + e.getMessage());\n }\n }", "public void startRecording() {\n // prepare the recorder\n if (!prepareMediaRecorder()) {\n Toast.makeText(VideoCapture.getSelf(), \"Fail in prepareMediaRecorder()!\\n - Ended -\",\n Toast.LENGTH_LONG).show();\n VideoCapture.getSelf().finish();\n }\n\n // start the recording\n mediaRecorder.start();\n mIsRecording = true;\n\n // start snapshots\n mSnapshotSensor.startSnapshot();\n }", "public void resume() {\n // This must be safe to call multiple times\n Util.validateMainThread();\n Log.d(TAG, \"resume()\");\n\n // initCamera() does nothing if called twice, but does log a warning\n initCamera();\n\n if (currentSurfaceSize != null) {\n // The activity was paused but not stopped, so the surface still exists. Therefore\n // surfaceCreated() won't be called, so init the camera here.\n startPreviewIfReady();\n } else if(surfaceView != null) {\n // Install the callback and wait for surfaceCreated() to init the camera.\n surfaceView.getHolder().addCallback(surfaceCallback);\n } else if(textureView != null && Build.VERSION.SDK_INT >= 14) {\n textureView.setSurfaceTextureListener(surfaceTextureListener());\n }\n\n // To trigger surfaceSized again\n requestLayout();\n rotationListener.listen(getContext(), rotationCallback);\n }", "private void setupVisualizerFxAndUI() {\n\n mLinearLayout = (LinearLayout) findViewById(R.id.linearLayoutVisual);\n // Create a VisualizerView to display the audio waveform for the current settings\n mVisualizerView = new VisualizerView(this);\n mVisualizerView.setLayoutParams(new ViewGroup.LayoutParams(\n ViewGroup.LayoutParams.MATCH_PARENT,\n (int) (VISUALIZER_HEIGHT_DIP * getResources().getDisplayMetrics().density)));\n mLinearLayout.addView(mVisualizerView);\n\n // Create the Visualizer object and attach it to our media player.\n\n\n\n\n\n\n mVisualizer = new Visualizer(mMediaPlayer.getAudioSessionId());\n //mVisualizer = new Visualizer(0);\n mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);\n\n mVisualizer.setDataCaptureListener(new Visualizer.OnDataCaptureListener() {\n public void onWaveFormDataCapture(Visualizer visualizer, byte[] bytes,\n int samplingRate) {\n mVisualizerView.updateVisualizer(bytes);\n }\n\n public void onFftDataCapture(Visualizer visualizer, byte[] bytes, int samplingRate) {\n }\n }, Visualizer.getMaxCaptureRate() / 2, true, false);\n }", "public void surfaceCreated(SurfaceHolder holder) {\n this.holder=holder;\n\twidth=this.getWidth();\n\theight=this.getHeight();\n\tags.surfaceCreated(holder);\n\tag.surfaceCreated(holder);\n\t\n\n\t\n\tgs.start();\n\tgs.setRunnning(true);\n\t\n}", "@Override\r\n\tpublic void surfaceChanged(SurfaceHolder holder, int format, int width,\r\n\t\t\tint height) {\n\t\tif(myCamera!=null){\r\n\t\t\tCamera.Parameters parameters = myCamera.getParameters();//得到initial參數\r\n\t\t\tmyCamera.setParameters(parameters);\r\n\t\t\tmyCamera.startPreview();\r\n\t\t}\r\n\t}", "public void surfaceCreated(SurfaceHolder holder) {\n\t \n camera = Camera.open();\n Camera.Parameters p = camera.getParameters();\n p.set(\"orientation\", \"landscape\");\n }", "protected void previewStarted() {\n\n }", "public void initializeCamera(){\n mCamera = Camera.open();\n\n Camera.Parameters parameters = mCamera.getParameters();\n parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);\n\n List<Camera.Size> previewSizes = parameters.getSupportedPreviewSizes();\n // Get the supported preview size closest to the requested dimensions:\n Camera.Size previewSize = previewSizes.get(previewSizes.size() - 1); // getOptimalPreviewSize(previewSizes, width, height);\n width = previewSize.width;\n height = previewSize.height;\n Log.d(TAG, \"width: \" + width + \" , height: \" + height);\n nPixels = width * height;\n pixels = new int[nPixels];\n setSize(width, height);\n parameters.setPreviewSize(width, height);\n\n mCamera.setParameters(parameters);\n\n int dataBufferSize=(int)(height * width * (ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())/8.0));\n\n mCamera.addCallbackBuffer(new byte[dataBufferSize]);\n mCamera.setPreviewCallbackWithBuffer(this);\n }", "@Override\n public void surfaceCreated(SurfaceHolder holder) {\n }", "@Override\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\trequestRender();\n\t}", "@Override\n public void surfaceCreated(SurfaceHolder holder) {\n Log.d(TAG,\"surfaceCreated\");\n mSurfaceHolder = holder;\n initPlay();\n play();\n }", "private void startCamera() {\n PreviewConfig previewConfig = new PreviewConfig.Builder().setTargetResolution(new Size(640, 480)).build();\n Preview preview = new Preview(previewConfig);\n preview.setOnPreviewOutputUpdateListener(output -> {\n ViewGroup parent = (ViewGroup) dataBinding.viewFinder.getParent();\n parent.removeView(dataBinding.viewFinder);\n parent.addView(dataBinding.viewFinder, 0);\n dataBinding.viewFinder.setSurfaceTexture(output.getSurfaceTexture());\n updateTransform();\n });\n\n\n // Create configuration object for the image capture use case\n // We don't set a resolution for image capture; instead, we\n // select a capture mode which will infer the appropriate\n // resolution based on aspect ration and requested mode\n ImageCaptureConfig imageCaptureConfig = new ImageCaptureConfig.Builder().setCaptureMode(ImageCapture.CaptureMode.MIN_LATENCY).build();\n\n // Build the image capture use case and attach button click listener\n ImageCapture imageCapture = new ImageCapture(imageCaptureConfig);\n dataBinding.captureButton.setOnClickListener(v -> {\n File file = new File(getExternalMediaDirs()[0], System.currentTimeMillis() + \".jpg\");\n imageCapture.takePicture(file, executor, new ImageCapture.OnImageSavedListener() {\n @Override\n public void onImageSaved(@NonNull File file) {\n String msg = \"Photo capture succeeded: \" + file.getAbsolutePath();\n Log.d(\"CameraXApp\", msg);\n dataBinding.viewFinder.post(\n () -> Toast.makeText(CameraXDemo.this, msg, Toast.LENGTH_SHORT).show()\n );\n }\n\n @Override\n public void onError(@NonNull ImageCapture.ImageCaptureError\n imageCaptureError, @NonNull String message, @Nullable Throwable cause) {\n String msg = \"Photo capture failed: \" + message;\n Log.e(\"CameraXApp\", msg, cause);\n dataBinding.viewFinder.post(\n () -> Toast.makeText(CameraXDemo.this, msg, Toast.LENGTH_SHORT).show()\n );\n }\n });\n });\n\n\n // Setup image analysis pipeline that computes average pixel luminance\n ImageAnalysisConfig analyzerConfig = new ImageAnalysisConfig.Builder().setImageReaderMode(\n ImageAnalysis.ImageReaderMode.ACQUIRE_LATEST_IMAGE).build();\n // Build the image analysis use case and instantiate our analyzer\n ImageAnalysis analyzerUseCase = new ImageAnalysis(analyzerConfig);\n analyzerUseCase.setAnalyzer(executor, new LuminosityAnalyzer());\n\n CameraX.bindToLifecycle(this, preview, imageCapture, analyzerUseCase);\n }", "private void startRecording() {\n\n }", "@Override\r\n\tpublic void surfaceCreated(SurfaceHolder holder) {\n\t\tLog.v(LOGTAG, \"surfaceCreated Called\");\r\n\t\tmediaPlayer.setDisplay(holder);\r\n\t\ttry {\r\n\t\t\tmediaPlayer.prepare();\r\n\t\t} catch (IllegalStateException e) {\r\n\t\t\t//Log.v(LOGTAG, e.getMessage());\r\n\t\t\tfinish();\r\n\t\t} catch (IOException e) {\r\n\t\t\t//Log.v(LOGTAG, e.getMessage());\r\n\t\t\tfinish();\r\n\t\t}\r\n\t}", "public void surfaceCreated(SurfaceHolder holder) {\n camera.setDisplayOrientation(90);\n\n }", "public native final void startPreview();", "private void setUpAndConfigureCamera() {\n\t\t// Open and configure the camera\n\t\tmCamera = selectAndOpenCamera();\n\n\t\tCamera.Parameters param = mCamera.getParameters();\n\n\t\t// Smaller images are recommended because some computer vision operations are very expensive\n\t\tList<Camera.Size> sizes = param.getSupportedPreviewSizes();\n\t\tCamera.Size s = sizes.get(closest(sizes,640,360));\n\t\tparam.setPreviewSize(s.width,s.height);\n\t\tmCamera.setParameters(param);\n\n\t\t// start image processing thread\n\n\t\t// Start the video feed by passing it to mPreview\n\t\tmPreview.setCamera(mCamera);\n\t}", "@SuppressLint(\"NewApi\")\n protected void updatePreview() {\n if(null == mCameraDevice) {\n Log.e(TAG, \"updatePreview error, return\");\n }\n\n mPreviewBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);\n HandlerThread thread = new HandlerThread(\"CameraPreview\");\n thread.start();\n Handler backgroundHandler = new Handler(thread.getLooper());\n\n try {\n mPreviewSession.setRepeatingRequest(mPreviewBuilder.build(), null, backgroundHandler);\n } catch (CameraAccessException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {\n\n\t\tif (mHolder.getSurface() == null){\n\t\t\t// preview surface does not exist\n\t\t\treturn;\n\t\t}\n\n\t\t// stop preview before making changes\n\t\ttry {\n\t\t\tmCamera.stopPreview();\n\t\t} catch (Exception e){\n\t\t\t// ignore: tried to stop a non-existent preview\n\t\t}\n\n\t\t// set preview size and make any resize, rotate or\n\t\t// reformatting changes here\n\n\t\t// start preview with new settings\n\t\ttry {\n\t\t\tmCamera.setPreviewDisplay(mHolder);\n\t\t\tCamera.Size size = getCameraPreviewSize(mCamera);\n\t\t\tCamera.Parameters params = setMaxCameraSize(mCamera);\n\t\t\tCamera.CameraInfo info = new Camera.CameraInfo();\n\t\t\tandroid.hardware.Camera.getCameraInfo(0, info);\n\t\t\tint rotation = this.getDisplay().getRotation();\n\t\t\tint degrees = 0;\n\t\t\tswitch (rotation) {\n\t\t\tcase Surface.ROTATION_0: degrees = 0; break;\n\t\t\tcase Surface.ROTATION_90: degrees = 90; break;\n\t\t\tcase Surface.ROTATION_180: degrees = 180; break;\n\t\t\tcase Surface.ROTATION_270: degrees = 270; break;\n\t\t\t}\n\n\t\t\tint result;\n\t\t\tif (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {\n\t\t\t\tresult = (info.orientation + degrees) % 360;\n\t\t\t\tresult = (360 - result) % 360; // compensate the mirror\n\t\t\t} else { // back-facing\n\t\t\t\tresult = (info.orientation - degrees + 360) % 360;\n\t\t\t}\n\t\t\tmCamera.setDisplayOrientation(result);\n\t\t\tparams.setRotation(result);\n\t\t\tparams.setPreviewSize(size.width, size.height);\n\t\t\tmCamera.setParameters(params);\n\t\t\tmCamera.startPreview();\n\t\t\tmCamera.autoFocus(null);\n\t\t} catch (Exception e){\n\n\t\t}\n\t}", "protected void updatePreview() {\n if (null == mCameraDevice) {\n Toast.makeText(CameraActivity.this, \"Couldn't find Camera\", Toast.LENGTH_SHORT).show();\n }\n mCaptureRequestBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);\n try {\n mCameraCaptureSessions.setRepeatingRequest(mCaptureRequestBuilder.build(), null, null);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void setupVisualizerFxAndUi() {\n mVisualizer = new Visualizer(0); // Using system audio session ID\n mVisualizer.setEnabled(false);\n mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1] );\n mVisualizer.setScalingMode(SCALING_MODE_AS_PLAYED);//SCALING_MODE_NORMALIZED);//\n mVisualizer.setDataCaptureListener(\n new Visualizer.OnDataCaptureListener() {\n public void onWaveFormDataCapture(\n Visualizer visualizer,\n byte[] bytes,\n int samplingRate) {\n // mVisualizerView.updateVisualizer(bytes);\n }\n\n public void onFftDataCapture(\n Visualizer visualizer,\n byte[] bytes,\n int samplingRate) {\n //mVisualizerView.updateVisualizer(bytes);\\\n if(debugModeOn) {\n debugViewModel.update(bytes);\n }\n // Do nothing for now\n }\n }, Visualizer.getMaxCaptureRate()-1 , false, true);\n }", "void cameraSetup();" ]
[ "0.795996", "0.7732268", "0.7604987", "0.75382507", "0.74399966", "0.74196464", "0.7414591", "0.73389435", "0.7314764", "0.7229792", "0.7166446", "0.71616894", "0.71315396", "0.71143395", "0.71122247", "0.71091664", "0.70754683", "0.7040478", "0.700692", "0.69644076", "0.6942523", "0.69167745", "0.6877853", "0.687012", "0.68116874", "0.6810757", "0.6805565", "0.6782736", "0.6780238", "0.67654353", "0.6693533", "0.6686476", "0.6663028", "0.66450363", "0.6641741", "0.6614682", "0.6582877", "0.65610623", "0.6555942", "0.6524922", "0.65239716", "0.65223205", "0.65021205", "0.64933026", "0.6477077", "0.64692664", "0.64663804", "0.6461946", "0.64454484", "0.6438244", "0.6399652", "0.6396437", "0.6387239", "0.6380344", "0.6357112", "0.63490766", "0.632642", "0.6310683", "0.63026214", "0.6287548", "0.628056", "0.62714696", "0.6270042", "0.6257083", "0.6241331", "0.62388456", "0.62364155", "0.6235693", "0.6233787", "0.62260985", "0.621276", "0.6207104", "0.62029254", "0.6200341", "0.61951417", "0.6184058", "0.6177231", "0.61723477", "0.61704314", "0.6169658", "0.6163658", "0.6144831", "0.61403227", "0.6138947", "0.6135", "0.61348736", "0.6126663", "0.61113685", "0.6111277", "0.61049294", "0.61032873", "0.60944486", "0.6087652", "0.60841084", "0.6080376", "0.60731435", "0.6067542", "0.606691", "0.60596234", "0.60527754" ]
0.700832
18
Unlock the focus. This method should be called when still image capture sequence is finished.
private void unlockFocus() { try { // Reset the auto-focus trigger mCaptureRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL); mPreviewCaptureSession.capture(mCaptureRequestBuilder.build(), mPreviewCaptureCallback, mBackgroundHandler); // After this, the camera will go back to the normal state of preview. mCaptureState = STATE_PREVIEW; mPreviewCaptureSession.setRepeatingRequest(mPreviewRequest, mPreviewCaptureCallback, mBackgroundHandler); } catch (CameraAccessException e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void unlockFocus() {\n try {\n // Reset the auto-focus trigger\n mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,\n CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);\n setAutoFlash(mPreviewRequestBuilder);\n mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,\n mBackgroundHandler);\n // After this, the camera will go back to the normal state of preview.\n mState = STATE_PREVIEW;\n mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback,\n mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void unlockFocus() {\n if (DEBUG)\n MLog.d(TAG, \"unlockFocus(): \" + printThis());\n try {\n // Reset the auto-focus trigger\n // 重置自动对焦\n mPreviewRequestBuilder.set(\n CaptureRequest.CONTROL_AF_TRIGGER,\n CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);\n setAutoFlash(mPreviewRequestBuilder);\n mCaptureSession.capture(\n mPreviewRequestBuilder.build(),\n // 这里好像可以设置为null\n mCaptureCallback,\n mBackgroundHandler);\n\n // After this, the camera will go back to the normal state of preview.\n mState = STATE_PREVIEW;\n // 打开连续取景模式\n mCaptureSession.setRepeatingRequest(\n mPreviewRequest,\n // 如果想要拍照,那么绝不能设置为null\n // 如果单纯预览,那么可以设置为null\n mCaptureCallback,\n mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void unlockFocus() {\n try {\n // Reset the auto-focus trigger\n if (mCaptureSession != null) {\n mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);\n mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback, mBackgroundHandler);\n // After this, the camera will go back to the normal state of preview.\n mState = STATE_PREVIEW;\n mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, mBackgroundHandler);\n }\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void lockFocus() {\n try {\n // This is how to tell the camera to lock focus.\n mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START);\n // Tell #mCaptureCallback to wait for the lock.\n mState = STATE_WAITING_LOCK;\n mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback, mBackgroundHandler);\n } catch (CameraAccessException e) {\n e.printStackTrace();\n }\n }", "private void stopAcquisition() {\n if (this.timer != null && !this.timer.isShutdown()) {\n try {\n // stop the timer\n this.timer.shutdown();\n this.timer.awaitTermination(33, TimeUnit.MILLISECONDS);\n } catch (InterruptedException e) {\n // log any exception\n System.err.println(\"Exception in stopping the frame capture, trying to release the camera now... \" + e);\n }\n }\n\n if (this.capture.isOpened()) {\n // release the camera\n this.capture.release();\n }\n }", "public void unlock() {\n islandLocked = false;\n }", "private void takePicture() {\n lockFocus();\n }", "void unlockScanner() {\n\t\ttry {\n\t\t\t\n\t\t\tWindow window = getWindow(); // in Activity's onCreate() for instance\n\t\t\twindow.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);\n\t\t\n\t\t} catch (Exception ex) {\n\n\t\t}\n\t}", "private void stopAcquisition() {\r\n if (this.timer != null && !this.timer.isShutdown()) {\r\n try {\r\n // stop the timer\r\n this.timer.shutdown();\r\n this.timer.awaitTermination(33, TimeUnit.MILLISECONDS);\r\n } catch (InterruptedException e) {\r\n // log any exception\r\n System.err.println(\"Exception in stopping the frame capture, trying to close the video now... \" + e);\r\n }\r\n }\r\n\r\n if (this.capture.isOpened()) {\r\n // release the camera\r\n this.capture.release();\r\n }\r\n }", "@Override\n public void cancelAutoFocus() {\n mCameraDevice.cancelAutoFocus();\n if (mCameraState != SELFTIMER_COUNTING\n && mCameraState != SNAPSHOT_IN_PROGRESS) {\n setCameraState(IDLE);\n }\n setCameraParameters(UPDATE_PARAM_PREFERENCE);\n isTouchCalled = false;\n }", "public void stopPreview() {\n\t\tif (autoFocusManager != null) {\n\t\t\tautoFocusManager.stop();\n\t\t\tautoFocusManager = null;\n\t\t}\n\t\tif (camera != null && previewing) {\n//\t\t\tLog.d(TAG, \"stopPreview\");\n\t\t\tcamera.stopPreview();\n//\t\t\tpreviewCallback.setHandler(null, 0);\n\t\t\tpreviewing = false;\n\t\t}\n\t\t\n\t}", "public void endFocus() {\n\t\tlog.fine(\"Ending focus\");\n\t\tthis.placeTime = Calendar.getInstance().getTimeInMillis();\n\t\tthis.focusTime = 0;\n\t\tthis.focused = false;\n\t\tthis.userId = -1;\n\t}", "private void releaseCamera() {\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.release();\n mCamera = null;\n }\n }", "public void releaseImagePreview() {\n previewView.removeView(mImageCapture.mCameraPreview);\n mImageCapture.mCameraPreview = null;\n }", "public synchronized void stopPreview() {\n if (autoFocusManager != null) {\n autoFocusManager.stop();\n autoFocusManager = null;\n }\n if (camera != null && previewing) {\n camera.getCamera().stopPreview();\n previewCallback.setHandler(null, 0);\n previewing = false;\n }\n }", "private void releaseCamera() {\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.setPreviewCallback(null);\n mCamera.release();\n mCamera = null;\n }\n }", "private void releaseCamera() {\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.setPreviewCallback(null);\n mCamera.release();\n mCamera = null;\n }\n }", "protected void closeCamera() {\n try {\n mCameraOpenCloseLock.acquire();\n if (null != mCameraDevice) {\n mCameraDevice.close();\n mCameraDevice = null;\n }\n if (null != mMediaRecorder) {\n mMediaRecorder.release();\n mMediaRecorder = null;\n }\n } catch (InterruptedException e) {\n throw new RuntimeException(\"Interrupted while trying to lock camera closing.\");\n } finally {\n mCameraOpenCloseLock.release();\n }\n }", "void releaseCamera() {\n\n if (mCamera != null) {\n mCamera.stopPreview();\n mCamera.release();\n }\n }", "private void setFocus() {\n\t\tif (held) {\n\t\t\tfocus.x = img.getWidth() / 2;\n\t\t\tfocus.y = img.getHeight();\n\t\t} else {\n\t\t\tfocus.x = img.getWidth();\n\t\t\tfocus.y = img.getHeight() /2;\n\t\t} // end else\n\t}", "public void onVideoRecordingStarted() {\n this.mUI.unlockCaptureView();\n }", "public synchronized void stopPreview() {\n if (autoFocusManager != null) {\n autoFocusManager.stop();\n autoFocusManager = null;\n }\n if (camera != null && previewing) {\n camera.getCamera().stopPreview();\n previewing = false;\n }\n }", "public void unlockBack()\n {\n m_bBackLock = false;\n }", "public void end()\r\n\t{\n\t\ttry{\r\n\t\tNIVision.IMAQdxStopAcquisition(curCam);\n\t\t}\n\t\tcatch(Exception e){\n\t\t\t\n\t\t}\r\n\t}", "private void releaseCamera() {\n if(camera != null) {\n camera.stopPreview();\n camera.release();\n camera = null;\n }\n }", "@Override\n public void stop() {\n animatorThread = null;\n\n //Get rid of the objects necessary for double buffering.\n offGraphics = null;\n offImage = null;\n }", "public void releaseCamera()\n {\n\n if (mcCamera != null)\n {\n //stop the preview\n mcCamera.stopPreview();\n //release the camera\n mcCamera.release();\n //clear out the camera\n mcCamera = null;\n }\n }", "private void endDrawing() {\n\t\tp_view.getHolder().unlockCanvasAndPost(p_canvas);\n\t}", "public void stop(){\n if (mCamera != null){\n mCamera.stopPreview();\n mCamera.setPreviewCallback(null);\n mCamera.release();\n mCamera = null;\n }\n if (mHolder != null) {\n mHolder.getSurface().release();\n mHolder = null;\n }\n }", "public void clearFocusWithoutChangingState() {\n this.mFocusManager.removeMessages();\n this.mUI.clearFocus();\n this.mCameraDevice.cancelAutoFocus();\n this.mUI.clearEvoPendingUI();\n if (this.mEvoFlashLock != null) {\n this.mAppController.getButtonManager().enableButtonWithToken(0, this.mEvoFlashLock.intValue());\n this.mEvoFlashLock = null;\n }\n this.mFocusManager.setAeAwbLock(false);\n setCameraParameters(4);\n }", "public native final void stopPreview();", "@Override\n public void unlock() {\n }", "@Override // com.master.cameralibrary.CameraViewImpl\n public void stop() {\n Camera camera = this.mCamera;\n if (camera != null) {\n camera.stopPreview();\n }\n this.mShowingPreview = false;\n releaseCamera();\n }", "private void releaseCamera() {\n if (mCamera != null) {\n mCamera.release(); // release the camera for other applications\n mCamera = null;\n }\n }", "public void unlock() {\n setLock.unlock(this);\n }", "@Override\n public void onCaptureAreaReleased(Point point) {\n switch (this.mCameraType) {\n case 1: {\n this.setFocusPositionToDeviceAndViewFinder(point, FocusRectangles.FocusSetType.RELEASE);\n }\n default: {\n break;\n }\n case 2: {\n FastViewFinder.this.mStateMachine.sendEvent(StateMachine.TransitterEvent.EVENT_SCREEN_CLEAR, new Object[0]);\n }\n }\n FastViewFinder.this.mStateMachine.sendEvent(StateMachine.TransitterEvent.EVENT_CANCEL_TOUCH_ZOOM, new Object[0]);\n }", "public void releaseCameraAndPreview() {\n if (mCameraActivity.mCamera != null) {\n mCameraActivity.mCamera.setPreviewCallback(null);\n mCameraActivity.mCamera.stopPreview();\n mImageCapture.mSurfaceHolder.removeCallback(mCameraPreview);\n mCameraPreview.surfaceDestroyed(mImageCapture.mSurfaceHolder);\n mSurfaceHolder.getSurface().release();\n mSurfaceHolder = null;\n releaseCamera();\n }\n }", "protected void unlock() {\n synchronized ( lock )\n {\n lock.notify();\n }\n }", "public void unlockGarage()\n {\n m_bGarageLock = false;\n }", "public void stopRecording() {\n cameraPreview.stopRecording();\n mediaRecorder.stop(); // stop the recording\n releaseMediaRecorder(); // release the MediaRecorder object\n camera.lock(); // take camera access back from MediaRecorder\n isRecording = false;\n }", "@Override\n\tpublic void unlock() {\n\t\t\n\t}", "void onCaptureEnd();", "public final void stop() {\n isKeyPressed = false;\n keyReleased();\n }", "public void releaseOCR(){\n \tif(baseApi != null){ baseApi.end(); baseApi = null; } \n\t\tmState = State.UNINITIALIZED;\n }", "void unlockInputConnection() {\n if (proxyAdapterView == null) {\n return;\n }\n\n proxyAdapterView.setLocked(false);\n }", "public void loseFocus(){\r\n\t//\tthis.setId(\"single-image-widget\");\r\n//\t\t((ColumnViewPane) this.getParent()).refresh();\r\n\t\thasFocus = false;\r\n\t}", "public void stop() {\n\n\t\tif (!started.compareAndSet(true, false)) {\n\t\t\treturn;\n\t\t}\n\n\t\tLOG.debug(\"Stopping panel rendering and closing attached webcam\");\n\n\t\tupdater.stop();\n\t\tupdater = null;\n\n\t\timage = null;\n\n\t\ttry {\n\t\t\terrored = !webcam.close();\n\t\t} catch (WebcamException e) {\n\n\t\t\terrored = true;\n\n\t\t\tDisplay.getDefault().syncExec(new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tredraw();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthrow e;\n\t\t}\n\t}", "@SuppressLint(\"NewApi\")\n public void onPause() {\n Log.d(TAG, \"onPause\");\n try {\n mCameraOpenCloseLock.acquire();\n if (null != mCameraDevice) {\n mCameraDevice.close();\n mCameraDevice = null;\n Log.d(TAG, \"CameraDevice Close\");\n }\n } catch (InterruptedException e) {\n throw new RuntimeException(\"Interrupted while trying to lock camera closing.\");\n } finally {\n mCameraOpenCloseLock.release();\n }\n }", "public void onUnfocusAnimationShortCircuited() {\n mShortCircuitUnfocusAnimation = false;\n }", "public void stop() {\r\n\t\tisRecording = false;\r\n\t}", "private static void releaseCameraAndPreview() {\n if (cam != null) {\n cam.release();\n cam = null;\n }\n }", "@Override\n\tprotected void OnRelease() {\n\t\tsetSelected(false);\n\t}", "public void deactivate() {\n\t\tcameraNXT.enableTracking(false);\n\t}", "public void unlockDevice() {\n ((AndroidDriver) getDriver()).pressKey(new KeyEvent().withKey(AndroidKey.HOME));\n }", "public void abandonAudioFocus() {\n if (this.needAbandonAudioFocus && this.mAudioManager != null && this.mAudioFocusListener != null) {\n Log.m26i(TAG, \"abandonAudioFocus\");\n this.mAudioManager.abandonAudioFocusRequest(getAudioFocusRequest());\n }\n }", "private void finishReset() {\n DefenceField.fieldActivated = true;\n time.setPaused(false);\n nuiManager.closeScreen(DefenceUris.DEATH_SCREEN);\n }", "private void toggle_focus() {\n\t\ttry {\n\t\t\tif (!lock_autofocus) {\n\t\t\t\t//getCameraManager().requestAutoFocus(handler, R.id.auto_focus);\n\t\t\t\t\n\t\t\t\tlockAutoFocus.setBackgroundResource(R.drawable.eye_selected);\n\t\t\t} else {\n\t\t\t\tlockAutoFocus.setBackgroundResource(R.drawable.eye);\n\t\t\t\tstatusView.setText(getString(R.string.set_focus));\n\t\t\t\tCommonValues.getInstance().CameraMessage = CameraMessageStatus.Stopped;\n\t\t\t //getCameraManager().requestAutoFocus(handler, R.id.auto_focus);\n\t\t\t\t\n\t\t\t}\n\t\t\tlock_autofocus = !lock_autofocus;\n\t\t\tcameraManager.setAutoFocus(lock_autofocus);\n\t\t} catch (Exception oEx) {\n\n\t\t}\n\t}", "public native void exitScreenShotModeNative();", "@Override\r\n\tpublic void releaseObject() {\r\n\t\tfinished = false;\r\n\r\n\t\tarm.rotate(90);\r\n\r\n\t\topenHand();\r\n\t\ttry {\r\n\t\t\tThread.sleep(WAIT_TIME);\r\n\t\t} catch (InterruptedException e) {\r\n\t\t}\r\n\r\n\t\tarm.rotate(-90);\r\n\t\tarm.stop();\r\n\t\tarm.flt();\r\n\t\tfinished = true;\r\n\t}", "@Override\n protected void onDestroy() {\n Bimp.tempSelectBitmap.clear();\n Bimp.max = 0;\n super.onDestroy();\n Constants.removeActivity(this);\n }", "@Override\n protected void onPause() {\n super.onPause();\n if (theCamera != null){\n theCamera.stopPreview();\n theCamera.release();\n theCamera = null;\n }\n }", "public void setScreenUnlockSecurityNone() {\n // try {\n // new LockPatternUtils(mContext).clearLock();\n // } catch (Exception e) {\n // // e.printStackTrace();\n // }\n }", "public final void release() {\n explicitlyLocked = false;\n byteBase.unlock();\n }", "@Override\n public void onFinish() {\n if (camera == null)\n return;\n\n Camera.Parameters parameters = camera.getParameters();\n parameters.setFocusAreas(null);\n if (supportedFocusModes == null)\n supportedFocusModes = getSupportedFocusModes(parameters);\n if (supportedFocusModes.get(FOCUS_CONTINUOUS_PICTURE)) {\n parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);\n } else if (supportedFocusModes.get(FOCUS_CONTINUOUS_VIDEO)) {\n parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\n }\n camera.setParameters(parameters);\n }", "public void closeGrabber() {\n grabberServo.setPosition(GRABBER_CLOSE);\n isGrab = false;\n }", "private void takePicture() {\n\n captureStillPicture();\n }", "public void stop ()\n\t{\n\t\tif (core.hasLock (frame))\n\t\t{\n\t\t\tif (model != null) model.stop();\n\t\t\tstop = true;\n\t\t}\n\t}", "@Override\r\n\tpublic boolean unlockIt() {\n\t\treturn false;\r\n\t}", "public void releaseVideoPreview() {\n previewView.removeView(mVideoCapture.mTextureView);\n }", "@Override public void stop() {\n\t\t_active = false;\n\t}", "public void unlock(){\n logger.log(Level. INFO,\"unlock() \"+lockState+\".\");\n this.lock.lock();\n logger.log(Level. INFO,\"unlock taking mutex :\"+lockState+\".\");\n switch(this.lockState){\n \t\t\tcase RLT:\n \t\t\tlockState = State.RLC;\n \t\t\tbreak;\n \t\t\tcase WLT:\n \t\t\tlockState = State.WLC;\n \t\t\tcase RLT_WLC:\n \t\t\tlockState = State.WLC;\t\n break;\n default:\n logger.log(Level.WARNING,\"Unlock with : \"+lockState+\".\");\n break;\n \t\t}\n this.available.signal();\t\n logger.log(Level.WARNING,\"SIGNAL\");\n this.lock.unlock();\n \t}", "public void notifyPausing() {\n if (mSurfaceTexture != null) {\n Log.d(TAG, \"renderer pausing -- releasing SurfaceTexture\");\n mSurfaceTexture.release();\n mSurfaceTexture = null;\n }\n if (mFullScreen != null) {\n mFullScreen.release(false); // assume the GLSurfaceView EGL context is about\n mFullScreen = null; // to be destroyed\n }\n mIncomingWidth = mIncomingHeight = -1;\n }", "public void endDrawing() {\r\n SelectionResult res = SelectionResult.getInstance();\r\n\r\n res.selection = selection;\r\n res.referenceY = selectedY;\r\n\r\n res.previewWidth = getWidth();\r\n res.previewHeight = getHeight();\r\n\r\n selectedY = -1;\r\n }", "private void Back() {\n this.dispose();\n tmrTime.stop();\n }", "public void unlock() {\n if(semaphore != null && semaphore.availablePermits() == 0) {\n semaphore.release();\n }\n }", "public void unlockUI (ProcessInfo pi)\r\n\t {\r\n\t\t this.setEnabled(true);\r\n\t\t this.setCursor(Cursor.getDefaultCursor());\r\n\t\t //\r\n\t\t //generateShipments_complete(pi);\r\n\t }", "public void stop() {\n\t\tmAudioManager.abandonAudioFocus(mOuterEventsListener);\n\t\tinternalStop();\n\t}", "private void release() {\n\t\tinitialized = false;\n\t\tpause();\n\t\tsetOnCompletionListener(null);\n\t\tgetMp().release();\n\t\tmp = null;\n\t}", "@Override\n protected void onPause() {\n closeCamera();\n\n stopBackgroundThread();\n super.onPause();\n }", "private void handleScreenTurnedOff() {\n DejankUtils.startDetectingBlockingIpcs(\"KeyguardUpdateMonitor#handleScreenTurnedOff\");\n Assert.isMainThread();\n this.mHardwareFingerprintUnavailableRetryCount = 0;\n this.mHardwareFaceUnavailableRetryCount = 0;\n for (int i = 0; i < this.mCallbacks.size(); i++) {\n KeyguardUpdateMonitorCallback keyguardUpdateMonitorCallback = this.mCallbacks.get(i).get();\n if (keyguardUpdateMonitorCallback != null) {\n keyguardUpdateMonitorCallback.onScreenTurnedOff();\n }\n }\n DejankUtils.stopDetectingBlockingIpcs(\"KeyguardUpdateMonitor#handleScreenTurnedOff\");\n }", "void deleteCurrentImageBuffered();", "private void unlockButton() {\n\t\tconversionPdf_Txt.setEnabled(true);\n\t\tavisJury.setEnabled(true);\n\t\tstatistique.setEnabled(true);\n bData.setEnabled(true);\n\t}", "public final void restore() {\r\n\t\tbi_image.restore();\r\n\t}", "public void deactivate()\n\t{\n\t\t_active = false;\n\t\t_leader.setObjectHandler(null);\n\t}", "@Override\n\tpublic boolean unlockIt() {\n\t\treturn false;\n\t}", "protected void end() {\n \t//Robot.motor.disable();\n \tRobot.motor.disable();\n }", "public synchronized void closeDriver() {\n if (camera != null) {\n camera.getCamera().release();\n camera = null;\n }\n }", "public void stop() {\n\tanimator = null;\n\toffImage = null;\n\toffGraphics = null;\n }", "public void tryLockFocus() {\n }", "public void release() {\n synchronized (mLock) {\n super.release();\n detachMediaController();\n setContentUri(PlayMode.NONE, null);\n setContentFd(PlayMode.NONE, null);\n setCurrentState(State.RELEASED);\n mContext = null;\n }\n }", "@Override\n public void onStop() {\n if(toggleButton.isChecked()) {\n toggleButton.setChecked(false);\n mediaRecorder.stop();\n mediaRecorder.reset();\n Log.v(TAG, \"Recording Stopped\");\n }\n\n mediaProjection = null;\n stopScreenSharing();\n }", "public static void pause() {\n\t\tmyWasPausedInPreview = false;\n\t\tif (myCurrentCamera != null) {\n\t\t\tif (myIsInPreview == true) {\n\t\t\t\tmyWasPausedInPreview = true;\n\t\t\t\tstop();\n\t\t\t}\n\n\t\t\tmyCurrentCamera.setPreviewCallbackWithBuffer(null);\n\t\t\tmyCurrentCamera.release();\n\t\t}\n\t}", "private void stop() {\r\n\t\tif (!running)\r\n\t\t\treturn;\r\n\t\trunning = false;\r\n\t\ttry {\r\n\t\t\tthread.join();//ends thread to close program correctly\r\n\t\t} catch (InterruptedException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\tSystem.exit(0);//closes canvas\r\n\t\t}\r\n\t}", "public void stop() {\n pause();\n if (isInPreviewMode) {\n isInPreviewMode = false;\n }\n seekTo(0, new OnCompletionListener() {\n @Override\n public void onComplete() {\n //no-op\n }\n });\n }", "private void closeCamera() {\n if (mCameraDevice != null) {\n mCameraDevice.close();\n mCameraDevice = null;\n }\n if (mIsRecording) {\n long elapsedMillis = SystemClock.elapsedRealtime() - mTimer.getBase();\n mTimer.stop();\n mTimer.setVisibility(View.GONE);\n scrollContents();\n mIsRecording = false;\n mRecordButton.setImageResource(R.drawable.ic_record_white);\n mMediaRecorder.stop();\n mMediaRecorder.reset();\n\n //Scan the file to appear in the device studio\n Intent mediaScannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);\n mediaScannerIntent.setData(Uri.fromFile(new File(mVideoFilePath)));\n sendBroadcast(mediaScannerIntent);\n\n logFirebaseVideoEvent(elapsedMillis);\n\n }\n if (mMediaRecorder != null) {\n mMediaRecorder.release();\n mMediaRecorder = null;\n }\n if (mAnimator != null && mAnimator.isStarted()) {\n mAnimator.cancel();\n }\n }", "protected void end() {\n // Robot.drive.setMoveVisionAssist(0);\n // Robot.drive.setTurnVisionAssist(0);\n Robot.limelight.setPipeline(1.0); \n }", "void removeFocus();", "public void pause() {\n // This must be safe to call multiple times.\n Util.validateMainThread();\n Log.d(TAG, \"pause()\");\n\n openedOrientation = -1;\n if (cameraInstance != null) {\n cameraInstance.close();\n cameraInstance = null;\n previewActive = false;\n }\n if (currentSurfaceSize == null && surfaceView != null) {\n SurfaceHolder surfaceHolder = surfaceView.getHolder();\n surfaceHolder.removeCallback(surfaceCallback);\n }\n if(currentSurfaceSize == null && textureView != null && Build.VERSION.SDK_INT >= 14) {\n textureView.setSurfaceTextureListener(null);\n }\n\n this.containerSize = null;\n this.previewSize = null;\n this.previewFramingRect = null;\n rotationListener.stop();\n\n fireState.previewStopped();\n }", "protected void ACTION_B_STOP(ActionEvent e) {\n\t\tcaptureState=false;\r\n\t\tCAPTAIN.finished();\r\n\t}", "public void onUnlockHintFinished() {\n super.onUnlockHintFinished();\n this.mNotificationStackScroller.setUnlockHintRunning(false);\n }" ]
[ "0.7994598", "0.79731876", "0.7944067", "0.6697191", "0.6481172", "0.646617", "0.6455761", "0.6430685", "0.641867", "0.639637", "0.6201543", "0.616481", "0.6141927", "0.61394435", "0.6132339", "0.6130657", "0.6130657", "0.6095788", "0.60863024", "0.60519296", "0.60391814", "0.60204494", "0.6015925", "0.60118365", "0.60066766", "0.5994985", "0.5984529", "0.5972354", "0.5965743", "0.595738", "0.5912324", "0.5906897", "0.58586997", "0.5839174", "0.58365417", "0.5834879", "0.58308095", "0.58281565", "0.58266026", "0.58241826", "0.58210546", "0.57950175", "0.57933104", "0.5789004", "0.5782419", "0.5762165", "0.5737709", "0.5697305", "0.5690336", "0.5666235", "0.5663366", "0.5643366", "0.5641686", "0.56373656", "0.56331563", "0.56265265", "0.5589962", "0.5579649", "0.5578025", "0.557654", "0.5557951", "0.5539944", "0.5532482", "0.55271685", "0.5523936", "0.55233455", "0.55229694", "0.5510969", "0.5510268", "0.5508689", "0.55059403", "0.550037", "0.5492101", "0.54778403", "0.5476531", "0.54730517", "0.5467672", "0.54644334", "0.5461023", "0.5443591", "0.54384875", "0.54361486", "0.54307276", "0.54299724", "0.54220945", "0.541977", "0.54078776", "0.54074097", "0.5402591", "0.54011965", "0.5400538", "0.5378921", "0.5376365", "0.53762907", "0.53738666", "0.53725713", "0.5368377", "0.53511757", "0.5347843", "0.53462243" ]
0.7986453
1
TODO: put to a Util class
public File createVideoFolder() { // File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory( // Environment.DIRECTORY_MOVIES + File.separator), "RokidCameraVideo"); // mVideoFolder = mediaStorageDir; File movieFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); File mVideoFolder = new File(movieFile, "Camera"); if (!mVideoFolder.exists()) { mVideoFolder.mkdirs(); } return mVideoFolder; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Util() { }", "private void strin() {\n\n\t}", "private FormatUtilities() {}", "private JacobUtils() {}", "private static void cajas() {\n\t\t\n\t}", "private ProcessorUtils() { }", "private OMUtil() { }", "private Utils() {}", "private Utils() {}", "private Utils() {}", "private Utils() {}", "String processing();", "private stendhal() {\n\t}", "private AsciiUtils() {\r\n\t}", "private void poetries() {\n\n\t}", "private BuilderUtils() {}", "public interface CommonUtils {\n\tpublic static String getPrintStackTrace(Exception e){\n\t\t//StringWriter writes upon the string\n\t\tStringWriter sw = new StringWriter();\n\t\t//PrintWriter integrates with StringWriter\n\t\tPrintWriter pw = new PrintWriter(sw);\n\t\t//This line used to write in catch block then it will writes in the console prints upon the console\n\t\t//Basically prints the data upon the console\n\t\te.printStackTrace(pw);\n\t\t//it will converts to tostring method into some meaningful data\n\t\treturn sw.toString();\n\t}\n}", "private String m16127b(String str) {\n BufferedReader bufferedReader;\n BufferedReader bufferedReader2 = null;\n try {\n bufferedReader = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(\"getprop \" + str).getInputStream()), OguryChoiceManager.TcfV2.Purpose.DEVELOP_AND_IMPROVE_PRODUCTS);\n try {\n String readLine = bufferedReader.readLine();\n bufferedReader.close();\n C4647b.m16104a((Closeable) bufferedReader);\n return readLine;\n } catch (IOException unused) {\n C4647b.m16104a((Closeable) bufferedReader);\n return null;\n } catch (Throwable th) {\n th = th;\n bufferedReader2 = bufferedReader;\n C4647b.m16104a((Closeable) bufferedReader2);\n throw th;\n }\n } catch (IOException unused2) {\n bufferedReader = null;\n C4647b.m16104a((Closeable) bufferedReader);\n return null;\n } catch (Throwable th2) {\n th = th2;\n C4647b.m16104a((Closeable) bufferedReader2);\n throw th;\n }\n }", "public void method_4270() {}", "private StringUtil() {\n\t\tsuper();\n\t}", "private Util() {\n }", "private ReportGenerationUtil() {\n\t\t\n\t}", "private static byte[] m2539e(Context context) {\n Throwable th;\n int i = 0;\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n byte[] bArr = new byte[0];\n String a = Log.m2547a(context, Log.f1857e);\n DiskLruCache diskLruCache = null;\n try {\n diskLruCache = DiskLruCache.m2767a(new File(a), 1, 1, 10240);\n File file = new File(a);\n if (file != null && file.exists()) {\n String[] list = file.list();\n int length = list.length;\n while (i < length) {\n String str = list[i];\n if (str.contains(\".0\")) {\n byteArrayOutputStream.write(StatisticsManager.m2535a(diskLruCache, str.split(\"\\\\.\")[0]));\n }\n i++;\n }\n }\n bArr = byteArrayOutputStream.toByteArray();\n if (byteArrayOutputStream != null) {\n try {\n byteArrayOutputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n if (diskLruCache != null) {\n try {\n diskLruCache.close();\n } catch (Throwable th2) {\n th = th2;\n }\n }\n } catch (IOException th3) {\n BasicLogHandler.m2542a(th3, \"StatisticsManager\", \"getContent\");\n if (byteArrayOutputStream != null) {\n try {\n byteArrayOutputStream.close();\n } catch (IOException e2) {\n e2.printStackTrace();\n }\n }\n if (diskLruCache != null) {\n diskLruCache.close();\n }\n } catch (Throwable th4) {\n th3 = th4;\n }\n return bArr;\n th3.printStackTrace();\n return bArr;\n }", "private HeaderUtil() {}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "private MetallicityUtils() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "java.lang.String getResult();", "private FaceConversionUtil() {\n\n\t}", "protected abstract Set method_1559();", "private void kk12() {\n\n\t}", "public final void mo51373a() {\n }", "protected boolean func_70814_o() { return true; }", "Compatibility compatibility();", "private java.lang.String c(java.lang.String r7) {\n /*\n r6 = this;\n r2 = \"\";\n r0 = r6.e;\t Catch:{ FileNotFoundException -> 0x0052 }\n if (r0 == 0) goto L_0x0050;\n L_0x0006:\n r0 = new java.lang.StringBuilder;\t Catch:{ FileNotFoundException -> 0x0052 }\n r1 = java.lang.String.valueOf(r7);\t Catch:{ FileNotFoundException -> 0x0052 }\n r0.<init>(r1);\t Catch:{ FileNotFoundException -> 0x0052 }\n r1 = \".\";\n r0 = r0.append(r1);\t Catch:{ FileNotFoundException -> 0x0052 }\n r1 = r6.e;\t Catch:{ FileNotFoundException -> 0x0052 }\n r0 = r0.append(r1);\t Catch:{ FileNotFoundException -> 0x0052 }\n r0 = r0.toString();\t Catch:{ FileNotFoundException -> 0x0052 }\n L_0x001f:\n r1 = r6.d;\t Catch:{ FileNotFoundException -> 0x0052 }\n r1 = r1.openFileInput(r0);\t Catch:{ FileNotFoundException -> 0x0052 }\n L_0x0025:\n r3 = new java.io.BufferedReader;\n r4 = new java.io.InputStreamReader;\n r0 = r1;\n r0 = (java.io.InputStream) r0;\n r5 = \"UTF-8\";\n r5 = java.nio.charset.Charset.forName(r5);\n r4.<init>(r0, r5);\n r3.<init>(r4);\n r0 = new java.lang.StringBuffer;\n r0.<init>();\n L_0x003d:\n r4 = r3.readLine();\t Catch:{ IOException -> 0x0065, all -> 0x0073 }\n if (r4 != 0) goto L_0x0061;\n L_0x0043:\n r0 = r0.toString();\t Catch:{ IOException -> 0x0065, all -> 0x0073 }\n r1 = (java.io.InputStream) r1;\t Catch:{ IOException -> 0x007d }\n r1.close();\t Catch:{ IOException -> 0x007d }\n r3.close();\t Catch:{ IOException -> 0x007d }\n L_0x004f:\n return r0;\n L_0x0050:\n r0 = r7;\n goto L_0x001f;\n L_0x0052:\n r0 = move-exception;\n r0 = r6.d;\t Catch:{ IOException -> 0x005e }\n r0 = r0.getAssets();\t Catch:{ IOException -> 0x005e }\n r1 = r0.open(r7);\t Catch:{ IOException -> 0x005e }\n goto L_0x0025;\n L_0x005e:\n r0 = move-exception;\n r0 = r2;\n goto L_0x004f;\n L_0x0061:\n r0.append(r4);\t Catch:{ IOException -> 0x0065, all -> 0x0073 }\n goto L_0x003d;\n L_0x0065:\n r0 = move-exception;\n r1 = (java.io.InputStream) r1;\t Catch:{ IOException -> 0x0070 }\n r1.close();\t Catch:{ IOException -> 0x0070 }\n r3.close();\t Catch:{ IOException -> 0x0070 }\n r0 = r2;\n goto L_0x004f;\n L_0x0070:\n r0 = move-exception;\n r0 = r2;\n goto L_0x004f;\n L_0x0073:\n r0 = move-exception;\n r1 = (java.io.InputStream) r1;\t Catch:{ IOException -> 0x007f }\n r1.close();\t Catch:{ IOException -> 0x007f }\n r3.close();\t Catch:{ IOException -> 0x007f }\n L_0x007c:\n throw r0;\n L_0x007d:\n r1 = move-exception;\n goto L_0x004f;\n L_0x007f:\n r1 = move-exception;\n goto L_0x007c;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.tencent.a.b.b.c(java.lang.String):java.lang.String\");\n }", "private StringUtil() {}", "private StringUtil() {}", "@Override\n\tpublic void initUtils() {\n\n\t}", "private Util() {\n }", "private Util() {\n }", "private WebStringUtils() {}", "private static java.io.File c(java.lang.String r8, java.lang.String r9) {\n /*\n r0 = 0;\n r1 = 0;\n r2 = new java.io.File;\t Catch:{ Exception -> 0x00e8, all -> 0x00e4 }\n r2.<init>(r8);\t Catch:{ Exception -> 0x00e8, all -> 0x00e4 }\n r8 = r2.exists();\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n if (r8 != 0) goto L_0x001d;\n L_0x000d:\n r8 = \"DecryptUtils\";\n r9 = \"unZipSingleFile file don't exist\";\n r3 = new java.lang.Object[r0];\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n com.taobao.sophix.e.d.e(r8, r9, r3);\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n com.taobao.sophix.e.b.a(r1);\n r2.delete();\n return r1;\n L_0x001d:\n r8 = new java.lang.StringBuilder;\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r8.<init>();\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r8.append(r9);\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r9 = java.io.File.separator;\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r8.append(r9);\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r9 = \"unzip\";\n r8.append(r9);\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r8 = r8.toString();\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r9 = new java.io.File;\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r9.<init>(r8);\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n com.taobao.sophix.e.b.a(r9);\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r3 = r9.exists();\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n if (r3 != 0) goto L_0x0044;\n L_0x0041:\n r9.mkdirs();\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n L_0x0044:\n r9 = new java.util.zip.ZipInputStream;\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r3 = new java.io.FileInputStream;\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r3.<init>(r2);\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n r9.<init>(r3);\t Catch:{ Exception -> 0x00e1, all -> 0x00de }\n L_0x004e:\n r3 = r9.getNextEntry();\t Catch:{ Exception -> 0x00dc }\n if (r3 == 0) goto L_0x00f4;\n L_0x0054:\n r4 = r3.getName();\t Catch:{ Exception -> 0x00dc }\n r3 = r3.isDirectory();\t Catch:{ Exception -> 0x00dc }\n if (r3 == 0) goto L_0x0085;\n L_0x005e:\n r3 = r4.length();\t Catch:{ Exception -> 0x00dc }\n r3 = r3 + -1;\n r3 = r4.substring(r0, r3);\t Catch:{ Exception -> 0x00dc }\n r4 = new java.io.File;\t Catch:{ Exception -> 0x00dc }\n r5 = new java.lang.StringBuilder;\t Catch:{ Exception -> 0x00dc }\n r5.<init>();\t Catch:{ Exception -> 0x00dc }\n r5.append(r8);\t Catch:{ Exception -> 0x00dc }\n r6 = java.io.File.separator;\t Catch:{ Exception -> 0x00dc }\n r5.append(r6);\t Catch:{ Exception -> 0x00dc }\n r5.append(r3);\t Catch:{ Exception -> 0x00dc }\n r3 = r5.toString();\t Catch:{ Exception -> 0x00dc }\n r4.<init>(r3);\t Catch:{ Exception -> 0x00dc }\n r4.mkdirs();\t Catch:{ Exception -> 0x00dc }\n goto L_0x004e;\n L_0x0085:\n r3 = new java.io.File;\t Catch:{ Exception -> 0x00dc }\n r5 = new java.lang.StringBuilder;\t Catch:{ Exception -> 0x00dc }\n r5.<init>();\t Catch:{ Exception -> 0x00dc }\n r5.append(r8);\t Catch:{ Exception -> 0x00dc }\n r6 = java.io.File.separator;\t Catch:{ Exception -> 0x00dc }\n r5.append(r6);\t Catch:{ Exception -> 0x00dc }\n r5.append(r4);\t Catch:{ Exception -> 0x00dc }\n r4 = r5.toString();\t Catch:{ Exception -> 0x00dc }\n r3.<init>(r4);\t Catch:{ Exception -> 0x00dc }\n r3.createNewFile();\t Catch:{ Exception -> 0x00dc }\n r4 = new java.io.FileOutputStream;\t Catch:{ Exception -> 0x00c7, all -> 0x00c4 }\n r4.<init>(r3);\t Catch:{ Exception -> 0x00c7, all -> 0x00c4 }\n r5 = 1024; // 0x400 float:1.435E-42 double:5.06E-321;\n r5 = new byte[r5];\t Catch:{ Exception -> 0x00c2 }\n L_0x00aa:\n r6 = r9.read(r5);\t Catch:{ Exception -> 0x00c2 }\n r7 = -1;\n if (r6 == r7) goto L_0x00b8;\n L_0x00b1:\n r4.write(r5, r0, r6);\t Catch:{ Exception -> 0x00c2 }\n r4.flush();\t Catch:{ Exception -> 0x00c2 }\n goto L_0x00aa;\n L_0x00b8:\n com.taobao.sophix.e.b.a(r4);\t Catch:{ Exception -> 0x00dc }\n com.taobao.sophix.e.b.a(r9);\n r2.delete();\n return r3;\n L_0x00c2:\n r3 = move-exception;\n goto L_0x00c9;\n L_0x00c4:\n r8 = move-exception;\n r4 = r1;\n goto L_0x00d8;\n L_0x00c7:\n r3 = move-exception;\n r4 = r1;\n L_0x00c9:\n r5 = \"DecryptUtils\";\n r6 = \"unZipSingleFile unZip hotfix patch file error\";\n r7 = new java.lang.Object[r0];\t Catch:{ all -> 0x00d7 }\n com.taobao.sophix.e.d.a(r5, r6, r3, r7);\t Catch:{ all -> 0x00d7 }\n com.taobao.sophix.e.b.a(r4);\t Catch:{ Exception -> 0x00dc }\n goto L_0x004e;\n L_0x00d7:\n r8 = move-exception;\n L_0x00d8:\n com.taobao.sophix.e.b.a(r4);\t Catch:{ Exception -> 0x00dc }\n throw r8;\t Catch:{ Exception -> 0x00dc }\n L_0x00dc:\n r8 = move-exception;\n goto L_0x00eb;\n L_0x00de:\n r8 = move-exception;\n r9 = r1;\n goto L_0x00fc;\n L_0x00e1:\n r8 = move-exception;\n r9 = r1;\n goto L_0x00eb;\n L_0x00e4:\n r8 = move-exception;\n r9 = r1;\n r2 = r9;\n goto L_0x00fc;\n L_0x00e8:\n r8 = move-exception;\n r9 = r1;\n r2 = r9;\n L_0x00eb:\n r3 = \"DecryptUtils\";\n r4 = \"unZipSingleFile unZip hotfix patch file error\";\n r0 = new java.lang.Object[r0];\t Catch:{ all -> 0x00fb }\n com.taobao.sophix.e.d.a(r3, r4, r8, r0);\t Catch:{ all -> 0x00fb }\n L_0x00f4:\n com.taobao.sophix.e.b.a(r9);\n r2.delete();\n return r1;\n L_0x00fb:\n r8 = move-exception;\n L_0x00fc:\n com.taobao.sophix.e.b.a(r9);\n r2.delete();\n throw r8;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.taobao.sophix.e.a.c(java.lang.String, java.lang.String):java.io.File\");\n }", "private RdfFormatUtils() {\n }", "private TagsBenchmarksUtil() {}", "private void m50366E() {\n }", "private static void iterator() {\n\t\t\r\n\t}", "private CollectionUtils() {\n\n\t}", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "private LookupUtil(){}", "String dibujar();", "private void parseData() {\n\t\t\r\n\t}", "protected CombinatoricsUtils() {\n super();\n }", "abstract String mo1748c();", "private ArraySetHelper() {\n\t\t// nothing\n\t}", "private void getStatus() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n protected void getExras() {\n }", "protected java.util.List x (java.lang.String r19){\n /*\n r18 = this;\n r0 = r18;\n r2 = r0.K;\n r0 = r19;\n r2 = r2.getAllSortStackTraces(r0);\n r2 = (java.util.List) r2;\n if (r2 == 0) goto L_0x000f;\n L_0x000e:\n return r2;\n L_0x000f:\n r12 = java.util.Collections.emptyList();\n r2 = r18.bp();\n r3 = r18.TaskHandler(r19);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n r4 = r2.setDrawable(r3);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n if (r4 != 0) goto L_0x0026;\n L_0x0021:\n r18.bq();\n r2 = r12;\n goto L_0x000e;\n L_0x0026:\n r13 = r2.getScaledMaximumFlingVelocity(r3);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n r14 = new java.io.ByteArrayOutputStream;\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n r2 = 2048; // 0x800 float:2.87E-42 double:1.0118E-320;\n r14.<creatCallTask>(r2);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r13, r14);\t Catch:{ all -> 0x00f2 }\n r2 = r14.toByteArray();\t Catch:{ all -> 0x00f2 }\n r2 = com.duokan.kernel.DkUtils.decodeSimpleDrm(r2);\t Catch:{ all -> 0x00f2 }\n r3 = new java.lang.String;\t Catch:{ all -> 0x00f2 }\n r4 = \"UTF-8\";\n r3.<creatCallTask>(r2, r4);\t Catch:{ all -> 0x00f2 }\n r2 = new org.json.JSONObject;\t Catch:{ all -> 0x00f2 }\n r2.<creatCallTask>(r3);\t Catch:{ all -> 0x00f2 }\n if (r2 != 0) goto L_0x0055;\n L_0x004a:\n com.duokan.core.io.getTriangleEdge.setDrawable(r13);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r14);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n r18.bq();\n r2 = r12;\n goto L_0x000e;\n L_0x0055:\n r3 = \"pictures\";\n r15 = com.duokan.reader.common.getPhysicalYPixels.setDrawable(r2, r3);\t Catch:{ all -> 0x00f2 }\n r16 = new java.util.ArrayList;\t Catch:{ all -> 0x00f2 }\n r2 = r15.length();\t Catch:{ all -> 0x00f2 }\n r0 = r16;\n r0.<creatCallTask>(r2);\t Catch:{ all -> 0x00f2 }\n r2 = 0;\n L_0x0067:\n r3 = r15.length();\t Catch:{ all -> 0x00f2 }\n if (r2 >= r3) goto L_0x00d0;\n L_0x006d:\n r3 = r15.getJSONObject(r2);\t Catch:{ all -> 0x00f2 }\n r4 = \"sm_md5\";\n r7 = r3.getString(r4);\t Catch:{ all -> 0x00f2 }\n r4 = \"sm_url\";\n r6 = r3.getString(r4);\t Catch:{ all -> 0x00f2 }\n r4 = \"sm_size\";\n r8 = r3.getLong(r4);\t Catch:{ all -> 0x00f2 }\n r4 = \"width\";\n r10 = r3.getInt(r4);\t Catch:{ all -> 0x00f2 }\n r4 = \"height\";\n r11 = r3.getInt(r4);\t Catch:{ all -> 0x00f2 }\n r3 = new java.lang.StringBuilder;\t Catch:{ all -> 0x00f2 }\n r3.<creatCallTask>();\t Catch:{ all -> 0x00f2 }\n r0 = r19;\n r3 = r3.append(r0);\t Catch:{ all -> 0x00f2 }\n r4 = \".\";\n r3 = r3.append(r4);\t Catch:{ all -> 0x00f2 }\n r3 = r3.append(r2);\t Catch:{ all -> 0x00f2 }\n r4 = r3.toString();\t Catch:{ all -> 0x00f2 }\n r5 = new java.lang.String;\t Catch:{ all -> 0x00f2 }\n r3 = new java.lang.StringBuilder;\t Catch:{ all -> 0x00f2 }\n r3.<creatCallTask>();\t Catch:{ all -> 0x00f2 }\n r17 = \"file:///stuffs/\";\n r0 = r17;\n r3 = r3.append(r0);\t Catch:{ all -> 0x00f2 }\n r3 = r3.append(r7);\t Catch:{ all -> 0x00f2 }\n r3 = r3.toString();\t Catch:{ all -> 0x00f2 }\n r5.<creatCallTask>(r3);\t Catch:{ all -> 0x00f2 }\n r3 = r18;\n r3 = r3.setDrawable(r4, r5, r6, r7, r8, r10, r11);\t Catch:{ all -> 0x00f2 }\n r0 = r16;\n r0.add(r3);\t Catch:{ all -> 0x00f2 }\n r2 = r2 + 1;\n goto L_0x0067;\n L_0x00d0:\n r0 = r18;\n r2 = r0.K;\t Catch:{ all -> 0x00f2 }\n r0 = r19;\n r1 = r16;\n r2.putIfAbsent(r0, r1);\t Catch:{ all -> 0x00f2 }\n r0 = r18;\n r2 = r0.K;\t Catch:{ all -> 0x00f2 }\n r0 = r19;\n r2 = r2.getAllSortStackTraces(r0);\t Catch:{ all -> 0x00f2 }\n r2 = (java.util.List) r2;\t Catch:{ all -> 0x00f2 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r13);\t Catch:{ Throwable -> 0x0106, all -> 0x0101 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r14);\t Catch:{ Throwable -> 0x0106, all -> 0x0101 }\n r18.bq();\n goto L_0x000e;\n L_0x00f2:\n r2 = move-exception;\n com.duokan.core.io.getTriangleEdge.setDrawable(r13);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r14);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n throw r2;\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n L_0x00fa:\n r2 = move-exception;\n r2 = r12;\n L_0x00fc:\n r18.bq();\n goto L_0x000e;\n L_0x0101:\n r2 = move-exception;\n r18.bq();\n throw r2;\n L_0x0106:\n r3 = move-exception;\n goto L_0x00fc;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.duokan.reader.domain.bookshelf.jv.MyContextWrapper(java.lang.String):java.util.List\");\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "private CheckUtil(){ }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "public void testEntrySetIteratorHasProperMappings() {\n return;\r\n }", "public abstract String mo13682d();", "private XhtmlUtils()\n\t{\n\t}", "void unableToListContents();", "zzafe mo29840Y() throws RemoteException;", "@Test\n public void test25() throws Throwable {\n\t\tfr.inria.diversify.sosie.logger.LogWriter.writeTestStart(1346,\"org.apache.commons.collections4.IteratorUtilsEvoSuiteTest.test25\");\n HashMap<StringTokenizer, Properties> hashMap0 = new HashMap<StringTokenizer, Properties>();\n EntrySetMapIterator<StringTokenizer, Properties> entrySetMapIterator0 = new EntrySetMapIterator<StringTokenizer, Properties>((Map<StringTokenizer, Properties>) hashMap0);\n Object[] objectArray0 = IteratorUtils.toArray((Iterator<?>) entrySetMapIterator0);\n assertNotNull(objectArray0);\n }", "private SBomCombiner()\n\t{}", "static int size_of_xri(String passed){\n\t\treturn 2;\n\t}", "private static Object Stringbuilder() {\n\t\treturn null;\n\t}", "private FileUtil() {\n \t\tsuper();\n \t}", "public abstract String use();", "public abstract String mo9239aw();", "public void mo38117a() {\n }", "private S2EdgeUtil() {}", "java.lang.String getHowToUse();", "java.lang.String getHowToUse();", "protected String compString() {\n\t\treturn null;\n\t}", "public abstract String mo41079d();", "private StringUtilities() {\n // nothing to do\n }", "Object getXtrc();", "Object getXtrc();", "protected void mo6255a() {\n }", "private Utils() {\n\t}", "private Utils() {\n\t}", "public abstract String mo118046b();", "abstract String mo1747a(String str);", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo70713b();", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n\tprotected void parseResult() {\n\t\t\n\t}", "static void init() {}", "private ClassUtil() {}", "private void init() {\n\n\t}", "protected MetadataUGWD() {/* intentionally empty block */}", "private CanonizeSource() {}", "public abstract String mo24851a(String str);", "public abstract String mo11611b();" ]
[ "0.55688167", "0.51044494", "0.49528146", "0.4911743", "0.49005276", "0.48898774", "0.48555157", "0.48341578", "0.48341578", "0.48341578", "0.48341578", "0.48264524", "0.4815448", "0.48087093", "0.47693783", "0.47481418", "0.47356623", "0.47290322", "0.47135755", "0.4712402", "0.47057486", "0.47050238", "0.4694694", "0.46918577", "0.4686812", "0.4682773", "0.467436", "0.4668782", "0.46632898", "0.46372482", "0.46330371", "0.46290663", "0.46271327", "0.46065083", "0.4605441", "0.46047118", "0.46047118", "0.46001226", "0.45923367", "0.45923367", "0.45798573", "0.4568388", "0.45564824", "0.45509616", "0.4547929", "0.45391893", "0.45344988", "0.45322284", "0.45322284", "0.45279112", "0.4524696", "0.45244375", "0.4517606", "0.4513367", "0.4509192", "0.4502639", "0.450201", "0.4489702", "0.44849324", "0.4482221", "0.44749954", "0.4474348", "0.4466942", "0.4455342", "0.44455552", "0.4439922", "0.4435383", "0.44349265", "0.44347724", "0.4431073", "0.44308463", "0.44258627", "0.4424139", "0.4420058", "0.44122976", "0.44119757", "0.44107306", "0.44095644", "0.44076535", "0.44076535", "0.43888608", "0.43856052", "0.43838874", "0.43795505", "0.43795505", "0.43782267", "0.43772578", "0.43772578", "0.4373785", "0.43660545", "0.4360126", "0.43515947", "0.43509892", "0.4347327", "0.4346467", "0.43462083", "0.43454608", "0.43412158", "0.43403816", "0.4337888", "0.43357262" ]
0.0
-1
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES + File.separator), "RokidCameraCamera"); mImageFolder = mediaStorageDir;
public File createImageFolder() { File imageFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); File mImageFolder = new File(imageFile, "Camera"); if (!mImageFolder.exists()) { mImageFolder.mkdirs(); } return mImageFolder; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void fixMediaDir() {\n String appDirectoryName = PICTURES;\n File imageRoot = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES), appDirectoryName);\n imageRoot.mkdirs();\n }", "void fixMediaDir(){\n File sdcard = Environment.getExternalStorageDirectory();\n if (sdcard != null) {\n File mediaDir = new File(sdcard, \"DCIM/Camera\");\n if (!mediaDir.exists()) {\n mediaDir.mkdirs();\n }\n }\n }", "private File getExternalPhotoStorageDir() {\n File file = new File(getExternalFilesDir(\n Environment.DIRECTORY_PICTURES), \"ApparelApp\");\n if (!file.exists() && !file.mkdirs()) {\n Log.e(TAG, \"Directory not created\");\n }\n return file;\n }", "private void openImageIntent() {\n File pictureFolder = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES\n );\n final File root = new File(pictureFolder, \"SkilExImages\");\n// final File root = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), \"MyDir\");\n\n if (!root.exists()) {\n if (!root.mkdirs()) {\n Log.d(TAG, \"Failed to create directory for storing images\");\n return;\n }\n }\n Calendar newCalendar = Calendar.getInstance();\n int month = newCalendar.get(Calendar.MONTH) + 1;\n int day = newCalendar.get(Calendar.DAY_OF_MONTH);\n int year = newCalendar.get(Calendar.YEAR);\n int hours = newCalendar.get(Calendar.HOUR_OF_DAY);\n int minutes = newCalendar.get(Calendar.MINUTE);\n int seconds = newCalendar.get(Calendar.SECOND);\n final String fname = PreferenceStorage.getUserMasterId(this) + \"_\" + day + \"_\" + month + \"_\" + year + \"_\" + hours + \"_\" + minutes + \"_\" + seconds + \".png\";\n final File sdImageMainDirectory = new File(root.getPath() + File.separator + fname);\n destFile = sdImageMainDirectory;\n outputFileUri = Uri.fromFile(sdImageMainDirectory);\n Log.d(TAG, \"camera output Uri\" + outputFileUri);\n\n // Camera.\n file = new File(Environment.getExternalStorageDirectory()\n + \"/\" + IMAGE_DIRECTORY);\n if (!file.exists()) {\n file.mkdirs();\n }\n final List<Intent> cameraIntents = new ArrayList<Intent>();\n final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n final PackageManager packageManager = getPackageManager();\n final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0);\n for (ResolveInfo res : listCam) {\n final String packageName = res.activityInfo.packageName;\n final Intent intent = new Intent(captureIntent);\n intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));\n intent.setPackage(packageName);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);\n cameraIntents.add(intent);\n }\n\n // Filesystem.\n final Intent galleryIntent = new Intent();\n galleryIntent.setType(\"image/*\");\n galleryIntent.setAction(Intent.ACTION_PICK);\n\n // Chooser of filesystem options.\n final Intent chooserIntent = Intent.createChooser(galleryIntent, \"Select Profile Photo\");\n\n // Add the camera options.\n chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()]));\n\n startActivityForResult(chooserIntent, REQUEST_IMAGE_GET);\n }", "public File createVideoFolder() {\n// File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n// Environment.DIRECTORY_MOVIES + File.separator), \"RokidCameraVideo\");\n// mVideoFolder = mediaStorageDir;\n\n File movieFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);\n File mVideoFolder = new File(movieFile, \"Camera\");\n\n if (!mVideoFolder.exists()) {\n mVideoFolder.mkdirs();\n }\n\n return mVideoFolder;\n }", "private void openImageIntent() {\n File pictureFolder = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES\n );\n final File root = new File(pictureFolder, \"SkilExImages\");\n// final File root = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), \"MyDir\");\n\n if (!root.exists()) {\n if (!root.mkdirs()) {\n d(TAG, \"Failed to create directory for storing images\");\n return;\n }\n }\n Calendar newCalendar = Calendar.getInstance();\n int month = newCalendar.get(Calendar.MONTH) + 1;\n int day = newCalendar.get(Calendar.DAY_OF_MONTH);\n int year = newCalendar.get(Calendar.YEAR);\n int hours = newCalendar.get(Calendar.HOUR_OF_DAY);\n int minutes = newCalendar.get(Calendar.MINUTE);\n int seconds = newCalendar.get(Calendar.SECOND);\n final String fname = PreferenceStorage.getUserMasterId(this) + \"_\" + day + \"_\" + month + \"_\" + year + \"_\" + hours + \"_\" + minutes + \"_\" + seconds + \".png\";\n final File sdImageMainDirectory = new File(root.getPath() + File.separator + fname);\n destFile = sdImageMainDirectory;\n outputFileUri = Uri.fromFile(sdImageMainDirectory);\n d(TAG, \"camera output Uri\" + outputFileUri);\n\n // Camera.\n file = new File(Environment.getExternalStorageDirectory()\n + \"/\" + IMAGE_DIRECTORY);\n if (!file.exists()) {\n file.mkdirs();\n }\n final List<Intent> cameraIntents = new ArrayList<Intent>();\n final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n final PackageManager packageManager = getPackageManager();\n final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0);\n for (ResolveInfo res : listCam) {\n final String packageName = res.activityInfo.packageName;\n final Intent intent = new Intent(captureIntent);\n intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));\n intent.setPackage(packageName);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);\n cameraIntents.add(intent);\n }\n\n // Filesystem.\n final Intent galleryIntent = new Intent();\n galleryIntent.setType(\"image/*\");\n galleryIntent.setAction(Intent.ACTION_PICK);\n\n // Chooser of filesystem options.\n final Intent chooserIntent = Intent.createChooser(galleryIntent, \"Select Profile Photo\");\n\n // Add the camera options.\n chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()]));\n\n startActivityForResult(chooserIntent, REQUEST_IMAGE_GET);\n }", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_photo_capture);\n\n // Here, we are making a folder named picFolder to store\n // pics taken by the camera using this application.\n final String dir = Environment.getExternalStorageDirectory().toString();\n// File newdir = new File(dir);\n// newdir.mkdirs();\n\n Button capture = (Button) findViewById(R.id.btnCapture);\n capture.setOnClickListener(new View.OnClickListener() {\n public void onClick(View v) {\n\n Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n try {\n startActivityForResult(takePictureIntent, 9999);\n } catch (ActivityNotFoundException e) {\n // display error state to the user\n }\n }\n });\n\n checkPermission();\n }", "public void getImageFromCamera() {\n String capturedPath = \"image_\" + System.currentTimeMillis() + \".jpg\";\n File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()\n + \"/DCIM\", capturedPath);\n file.getParentFile().mkdirs();\n mCapturedImageUri = Uri.fromFile(file);\n\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageUri);\n startActivityForResult(intent, CAPTURE_IMAGE_REQUEST_CODE);\n }", "private static File getOutputMediaFile(){\r\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\r\n Environment.DIRECTORY_PICTURES), \"CameraDemo\");\r\n\r\n if (!mediaStorageDir.exists()){\r\n if (!mediaStorageDir.mkdirs()){\r\n return null;\r\n }\r\n }\r\n\r\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n return new File(mediaStorageDir.getPath() + File.separator +\r\n \"IMG_\"+ timeStamp + \".jpg\");\r\n }", "private File getOutputMediaFile(){\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), \"reliant\");\n // Create the storage directory if it does not exist\n if (! mediaStorageDir.exists()){\n if (! mediaStorageDir.mkdirs()){\n Log.d(\"MyCameraApp\", \"failed to create directory\");\n return null;\n }\n }\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File mediaFile;\n mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n \"IMG_\"+ timeStamp + \".jpg\");\n return mediaFile;\n }", "private void captureImage() {\n String imagename = \"urPics.jpg\";\n File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + imagename);\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n FileUri = Uri.fromFile(file);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, FileUri);\n // start the image capture Intent\n startActivityForResult(intent, REQUEST_CODE_CAMERA);\n }", "private static void SaveImage(Bitmap finalBitmap) {\n File path = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File file = new File(path, \"DemoPicture.jpg\");\n\n String fname = \"Image\" +\".jpg\";\n\n try {\n path.mkdirs();\n FileOutputStream out = new FileOutputStream(file);\n finalBitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);\n out.flush();\n out.close();\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "private File imageFile() throws IOException {\n File directory = Environment.getExternalStorageDirectory();\n\n // FileOperations.checkDirectory(directory, false);\n Photopath = directory.getAbsolutePath();\n return new File(directory,\"displaypic.jpg\");\n\n }", "private void prepararImagenYStorage() {\n mImageBitmap = null;\n\n //this.capturarFotoButton = (Button) findViewById(R.id.capturarFotoButton);\n// setBtnListenerOrDisable(\n// this.capturarFotoButton,\n// mTakePicSOnClickListener,\n// MediaStore.ACTION_IMAGE_CAPTURE\n// );\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {\n mAlbumStorageDirFactory = new FroyoAlbumDirFactory();\n } else {\n mAlbumStorageDirFactory = new BaseAlbumDirFactory();\n }\n }", "public Uri getImageFileUri()\n {\n imagePath = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES), \"Tuxuri\");\n Log.d(tag, \"Find \" + imagePath.getAbsolutePath());\n\n\n if (! imagePath.exists())\n {\n if (! imagePath.mkdirs())\n {\n Log.d(\"CameraTestIntent\", \"failed to create directory\");\n return null;\n }else{\n Log.d(tag,\"create new Tux folder\");\n }\n }\n\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File image = new File(imagePath,\"TUX_\"+ timeStamp + \".jpg\");\n file = image;\n name = file.getName();\n path = imagePath;\n\n\n if(!image.exists())\n {\n try {\n image.createNewFile();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n return Uri.fromFile(image);\n }", "private File getOutputMediaFile() {\n\r\n File mediaStorageDir = new File(Environment.getExternalStorageDirectory().getPath() + File.separator + \"ImageUpload\" + File.separator + \"Pictures\");\r\n if (!mediaStorageDir.exists()) {\r\n if (!mediaStorageDir.mkdirs()) {\r\n Log.d(\"ImageUpload\", \"failed to create external directory\");\r\n Log.d(\"ImageUpload\", \"creating to internal directory\");\r\n mediaStorageDir = getFilesDir();\r\n }\r\n }\r\n\r\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n return new File(mediaStorageDir.getPath() + File.separator + \"IMG_\" + timeStamp + \".jpg\");\r\n }", "private void createVideoFolder() {\n File movieFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);\n mVideoFolder = new File(movieFile, \"Camera2_Video_Image\");\n //check to see if the folder is already created\n if (!mVideoFolder.exists()) {\n mVideoFolder.mkdirs();\n\n }\n\n }", "private static File getStorageDir(Context context) {\n File file = new File(context.getExternalFilesDir(\n Environment.MEDIA_MOUNTED), \"ZhouImage\");\n if (!file.exists()) {\n if (!file.mkdirs()) {\n Log.e(\"TAG\", \"Directory not created\");\n }\n }\n\n return file;\n }", "private static File getOutputMediaFile(){\n // To be safe, you should check that the SDCard is mounted\n // using Environment.getExternalStorageState() before doing this.\n\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES), \"MyCameraApp\");\n // This location works best if you want the created images to be shared\n // between applications and persist after your app has been uninstalled.\n\n // Create the storage directory if it does not exist\n if (! mediaStorageDir.exists()){\n if (! mediaStorageDir.mkdirs()){\n return null;\n }\n }\n\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n \"IMG_\"+ timeStamp + \".jpg\");\n\n return mediaFile;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"NDS_\" + timeStamp + \"_\";\n //File mediaStorageDir = Environment.getExternalStoragePublicDirectory(\"/NDS images\");\n String CameraFolder = \"Camera\";\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString() + \"/\" + CameraFolder + \"/\");\n\n if (!mediaStorageDir.exists()) {\n if (!mediaStorageDir.mkdirs()) {\n return null;\n }\n }\n\n\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n //-------------\n\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n mediaStorageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "public void takePictureByCamera(Context context){\n\n String state = Environment.getExternalStorageState();\n if (state.equals(Environment.MEDIA_MOUNTED)) {\n Intent getImageByCamera = new Intent(\"android.media.action.IMAGE_CAPTURE\");\n ((Activity)context).startActivityForResult(getImageByCamera, TAG_takepicture);\n }\n else {\n MyToast.showToast(context,\"please install SDcard\");\n }\n }", "@SuppressLint(\"SimpleDateFormat\")\n\tprivate static File getOutputMediaFile() {\n\n\t\t// Create Folder\n\t\tFile folder = new File(Environment.getExternalStorageDirectory()\n\t\t\t\t.toString() + \"/JuzFood/image\");\n\t\tfolder.mkdirs();\n\n\t\tif (!folder.exists()) {\n\t\t\tif (!folder.mkdirs()) {\n\t\t\t\tLog.v(\"MyCameraApp\", \"failed to create directory\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\t// Create a media file name\n\t\tString timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\")\n\t\t.format(new Date());\n\n\t\t// Save the path as a string value\n\t\tString extStorageDirectory = folder.toString();\n\n\t\tSystem.out.println(\"Folder Path ===== \" + extStorageDirectory);\n\n\t\tFile mediaFile = new File(extStorageDirectory + File.separator\n\t\t\t\t+ \"JUZFOOD_\" + timeStamp + \".jpg\");\n\n\t\treturn mediaFile;\n\t}", "@Override\n public void onClick(View v) {\n\n writeFile();\n\n File INTERNAL = getFilesDir();\n File EXT_DIR = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File dataDir = Environment.getExternalStorageDirectory();\n\n Log.d(\"FILE\", \"INTERNAL: \" + INTERNAL.getAbsolutePath());\n Log.d(\"FILE\", \"EXTERNAL: \" + EXT_DIR.getAbsolutePath());\n Log.d(\"FILE\", \"DATA: \" + dataDir.getAbsolutePath());\n }", "public void takePhoto(){\n // We create the intent and the file\n Intent intent = new Intent(\"android.media.action.IMAGE_CAPTURE\");\n File path = new File(Environment.getExternalStorageDirectory().toString() + PATH);\n if (!path.exists()) {\n path.mkdir();\n }\n File picture = new File(path.getAbsolutePath(),\"Foto.jpg\");\n intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(picture));\n // We have the path for the photo\n this.pictureId = Uri.fromFile(picture);\n // Begin the camera activity\n startActivityForResult(intent, CAMERA_APP);\n }", "public void saveFile(Bitmap imageToSave, String folder) {\n File folderName = new File(Environment.\n getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), folder);\n\n if (!folderName.exists()) {\n Log.i(TAG, \"Folder doesn't exist, creating it...\");\n boolean rv = folderName.mkdir();\n Log.i(TAG, \"Folder creation \" + (rv ? \"success\" : \"failed\"));\n } else {\n Log.i(TAG, \"Folder already exists.\");\n }\n\n String captured = Global.currUser.email + \"Deja_\" + Global.imageNumber + \".jpg\";\n Global.imageNumber++;\n\n File file = new File(folderName, captured);\n\n try {\n FileOutputStream out = new FileOutputStream(file);\n imageToSave.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.flush();\n out.close();\n\n Global.uploadImageQueue.add(file.getAbsolutePath());\n Log.d(TAG, \"filePath added: \" + file.getAbsolutePath());\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n scanSD(file);\n\n Log.d(TAG, \"+++++++\");\n }", "public void camara(){\n Intent fotoPick = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n String fecha = new SimpleDateFormat(\"yyyy_MM_dd_HH_mm_ss\").format(new Date());\n Uri uriSavedImage=Uri.fromFile(new File(getExternalFilesDir(Environment.DIRECTORY_DCIM),\"inmueble_\"+id+\"_\"+fecha+\".jpg\"));\n fotoPick.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);\n startActivityForResult(fotoPick,TAKE_PICTURE);\n\n }", "public static File getOutputMediaFile(int type, String name) {\n File Test = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File Test1 = Environment.getExternalStorageDirectory();\n Log.d(\"Environment\", \"Environment path \" + Test.getAbsolutePath().toString());\n File mediaStorageDir = new File(Environment.getExternalStorageDirectory(), \"RateMe\");\n Log.d(\"Environment\", \"Environment path \" + mediaStorageDir.getAbsolutePath().toString());\n if (!mediaStorageDir.exists()) {\n /*if (! mediaStorageDir.mkdirs()){\n Log.d(\"MyCameraApp\", \"failed to create directory\");\n\t\t\t return null;\n\t\t\t }*/\n mediaStorageDir.mkdir();\n }\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File mediaFile;\n if (type == 20) {\n mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n \"IMG_\" + name.toLowerCase() + timeStamp + \".jpg\");\n } else\n return null;\n\n return mediaFile;\n }", "private File getOutputMediaFile(){\n File mediaStorageDir = new File(Environment.getExternalStorageDirectory()\n + \"/Android/data/\"\n + getApplicationContext().getPackageName()\n + \"/Captures\");\n\n // This location works best if you want the created images to be shared\n // between applications and persist after your app has been uninstalled.\n\n // Create the storage directory if it does not exist\n if (! mediaStorageDir.exists()){\n if (! mediaStorageDir.mkdirs()){\n return null;\n }\n }\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"ddMMyyyy_HHmm\").format(new Date());\n File mediaFile;\n String mImageName=\"MI_\"+ timeStamp +\".jpg\";\n mediaFile = new File(mediaStorageDir.getPath() + File.separator + mImageName);\n return mediaFile;\n }", "private boolean prepare() {\r\n\t\tif (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {\r\n\t\t\tLog.e(TAG,\"External media not ready.\");\r\n\t\t\tisReady = false;\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tisReady = true;\t\t\r\n\t\tdirectory = parent.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\r\n\t\treturn true;\r\n\t}", "private void openCamera() {\n currentDateTimeString = new SimpleDateFormat(\"yyyy-MM-dd\").format(new Date());\n txtDate.setText(currentDateTimeString);\n txtDate.setEnabled(false);\n String state = Environment.getExternalStorageState();\n imageName = currentDateTimeString+\"@\"+userName+\"@\"+timestamp+ ApplicationConstant.EXTENTION_JPG;\n if (Environment.MEDIA_MOUNTED.equals(state)) {\n mFileTemp = new File(ApplicationConstant.FOLDER_PATH, imageName);\n } else {\n mFileTemp = new File(getFilesDir(), imageName);\n }\n /*Uri.fromFile(mFileTemp)*/\n Uri photoURI = null;\n if (android.os.Build.VERSION.SDK_INT >= ApplicationConstant.API_LEVEL_23) {\n photoURI = FileProvider.getUriForFile(UploadActivity.this, BuildConfig.APPLICATION_ID + \".provider\", mFileTemp);\n } else {\n photoURI = Uri.fromFile(mFileTemp);\n }\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);\n } else {\n List<ResolveInfo> resInfoList = UploadActivity.this.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);\n for (ResolveInfo resolveInfo : resInfoList) {\n String packageName = resolveInfo.activityInfo.packageName;\n UploadActivity.this.grantUriPermission(packageName, photoURI, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);\n }\n }\n intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n startActivityForResult(intent, ApplicationConstant.RESULT_OPEN_CAMERA);\n }", "public static File getStorageDir2(Context context) {\n File file = new File(Environment.getExternalStorageDirectory()+File.separator+\"ZhouImage\", OUTGOING_DATE_FORMAT.format(new Date())+\".jpg\");\n if (!file.exists()) {\n if (!file.mkdirs()) {\n Log.e(\"TAG\", \"Directory not created\");\n }\n }\n\n return file;\n }", "private File getOutputMediaFile(){\n File mediaStorageDir = new File(Environment.getExternalStorageDirectory()\n + \"/Android/data/\"\n + getApplicationContext().getPackageName()\n + \"/Files\");\n\n // This location works best if you want the created images to be shared\n // between applications and persist after your app has been uninstalled.\n\n // Create the storage directory if it does not exist\n if (! mediaStorageDir.exists()){\n if (! mediaStorageDir.mkdirs()){\n return null;\n }\n }\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"ddMMyyyy_HHmm\").format(new Date());\n File mediaFile;\n String mImageName=\"MI_\"+ timeStamp +\".jpg\";\n mediaFile = new File(mediaStorageDir.getPath() + File.separator + mImageName);\n return mediaFile;\n }", "private static File getOutputMediaFile(String namex, Context context) {\n\r\n String pathToExternalStorage = context.getFilesDir().toString();\r\n File mediaStorageDir = new File(pathToExternalStorage + \"/\" + \"eKMIS\");\r\n\r\n //if (!appDirectory.isDirectory() || !appDirectory.exists()) //Checks if the directory exists\r\n // appDirectory.mkdir();\r\n\r\n if (!mediaStorageDir.exists()) {\r\n if (!mediaStorageDir.mkdirs()) {\r\n //Log.d(\"surevy\", \"failed to create directory\");\r\n return null;\r\n }\r\n }\r\n // Create a media file name\r\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\")\r\n .format(new Date());\r\n File mediaFile;\r\n //mediaFile = new File(mediaStorageDir.getPath() + File.separator\r\n // + \"IMG_\" + timeStamp + \".jpg\");\r\n\r\n mediaFile = new File(mediaStorageDir.getPath() + File.separator\r\n + \"IMG_\" + namex + \".jpg\");\r\n\r\n\r\n Log.d(\"Camera activty\", mediaStorageDir.getPath());\r\n\r\n return mediaFile;\r\n }", "private static String getOutputMediaFile(){\n\n\t File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n\t Environment.DIRECTORY_PICTURES), \"MyCameraApp\");\n\t // This location works best if you want the created images to be shared\n\t // between applications and persist after your app has been uninstalled.\n\n\t // Create the storage directory if it does not exist\n\t if (! mediaStorageDir.exists()){\n\t if (! mediaStorageDir.mkdirs()){\n\t Log.d(\"MyCameraApp\", \"failed to create directory\");\n\t return null;\n\t }\n\t }\n\n\t // Create a media file name\n\t String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.US).format(new Date());\n\t return new File(mediaStorageDir.getPath() + File.separator + \"VID_\"+ timeStamp + \".mp4\").toString();\n\t}", "private String storeImage(Bitmap imageData) {\n // get path to external storage (SD card)\n String filePath = null;\n if (imageData != null) {\n\n\n try {\n //boolean s = sdIconStorageDir.mkdirs();\n filePath = Environment.getExternalStorageState()\n + System.currentTimeMillis() + \".jpg\";\n Log.d(\"Donde\", filePath);\n FileOutputStream fileOutputStream = new FileOutputStream(\n filePath);\n\n BufferedOutputStream bos = new BufferedOutputStream(\n fileOutputStream);\n\n // choose another format if PNG doesn't suit you\n imageData.compress(Bitmap.CompressFormat.JPEG, 0, bos);\n\n bos.flush();\n bos.close();\n return filePath;\n } catch (IOException e) {\n return \"fail\";\n }\n } else {\n return \"fail\";\n }\n\n }", "private void saveToInternalStorage(Bitmap bitmapImage) {\n String root = Environment.getExternalStorageDirectory().toString();\n File myDir = new File(root + \"/saved_images\");\n if (!myDir.exists()) {\n myDir.mkdirs();\n }\n String fname = \"profile.jpg\";\n File file = new File(myDir, fname);\n if (file.exists()){\n file.delete();\n }\n try {\n FileOutputStream out = new FileOutputStream(file);\n bitmapImage.compress(Bitmap.CompressFormat.JPEG, 90, out);\n out.flush();\n out.close();\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private void dispatchTakePictureIntent() { // to camera\n\n // must be\n StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();\n StrictMode.setVmPolicy(builder.build());\n\n //stworzenie nazwy pliku dla nowego zdjęcia, bedzie nadpisywana za każdym razem\n File outFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), \"example.jpg\");\n\n //zapisanie ścieżki do nowego zdjęcia z aparatu\n mCameraFileName = outFile.toString();\n Uri outUri = Uri.fromFile(outFile);\n Intent intent = new Intent();\n intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, outUri);\n if (intent.resolveActivity(getPackageManager()) != null) {\n startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);\n } else {\n Toast.makeText(this, \"External storage not available\", Toast.LENGTH_SHORT).show();\n }\n }", "public void saveImageToExternal(String imgName, Bitmap bm) throws IOException {\n String appFolder = \" MashCam\";\n File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES + appFolder); //Creates app specific folder\n path.mkdirs();\n File imageFile = new File(path, imgName + \".png\"); // Imagename.png\n FileOutputStream out = new FileOutputStream(imageFile);\n try {\n bm.compress(Bitmap.CompressFormat.PNG, 100, out); // Compress Image\n out.flush();\n out.close();\n\n // Tell the media scanner about the new file so that it is\n // immediately available to the user.\n MediaScannerConnection.scanFile(getWindow().getContext(), new String[]{imageFile.getAbsolutePath()}, null, new MediaScannerConnection.OnScanCompletedListener() {\n public void onScanCompleted(String path, Uri uri) {\n Log.i(\"ExternalStorage\", \"Scanned \" + path + \":\");\n Log.i(\"ExternalStorage\", \"-> uri=\" + uri);\n }\n });\n } catch (Exception e) {\n throw new IOException();\n }\n }", "@Override\n public void onClick(View v) {\n String fileName = new Date().getTime() + \".jpg\";\n File outputImage = new File(getExternalCacheDir(), fileName);\n// 创建一个新的文件夹,用fileName命名,实际上就是时间戳来命名,但是jpg格式的,在sd卡下面按日期命名\n\n //String path = Environment.getExternalStorageDirectory()+File.separator+ \"image\";\n //File finalImage = new File(path, fileName);\n //if(!finalImage.getParentFile().exists()){\n //finalImage.getParentFile().mkdirs();\n //}\n// 更新图片,如果输出图片存在的话,则删除\n try {\n if (outputImage.exists()) {\n outputImage.delete();\n }\n outputImage.createNewFile();\n } catch (IOException e) {\n e.printStackTrace();\n }\n imageUri = PhotoClipperUtil.getUriFromFile(Activity_camera.this,outputImage);\n requestPermission();\n //to ask the right to visit camera\n }", "private File getOutputMediaFile() {\n\t\tFile picDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n\n\t\t// get the current time\n//\t\tString timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n\t\t\n\t\tif(mBackCameraCount < 5){\n\t\t\treturn new File(picDir.getPath() + File.separator + \"backimage_\" + mBackCameraCount + \".jpg\");\n\t\t}else {\n\t\t\treturn new File(picDir.getPath() + File.separator + \"frontimage_\" + mFrontCameraCount + \".jpg\");\n\t\t}\n\t}", "public File createImageFile() {\n // the public picture director\n File picturesDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); // To get pictures directory from android system\n\n // timestamp makes unique name.\n @SuppressLint(\"SimpleDateFormat\") SimpleDateFormat sdf = new SimpleDateFormat(\"yyyyMMdd_HHmmss\");\n String timestamp = sdf.format(new Date());\n\n // put together the directory and the timestamp to make a unique image location.\n File imageFile = new File(picturesDirectory, timestamp + \".jpg\");\n\n return imageFile;\n }", "private void galleryAddPic() {\n Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);\n mediaScanIntent.setData(currentImageUri);\n this.sendBroadcast(mediaScanIntent);\n }", "private File getStorageDir(String albumName) {\n File file = null;\n try {\n file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+\"system app\"+File.separator+albumName);\n if (!file.mkdirs()) {\n Log.e(TAG, \"Directory not created\");\n }\n }catch (Exception e){\n Log.e(TAG, \"getPublicAlbumStorageDir: \",e );\n }\n\n return file;\n }", "public File getOutputMediaFile(int type){\n // To be safe, you should check that the SDCard is mounted\n // using Environment.getExternalStorageState() before doing this.\n\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES), \"MyCameraApp\");\n // This location works best if you want the created images to be shared\n // between applications and persist after your app has been uninstalled.\n\n // Create the storage directory if it does not exist\n if (! mediaStorageDir.exists()){\n if (! mediaStorageDir.mkdirs()){\n Log.d(\"MyCameraApp\", \"failed to create directory\");\n return null;\n }\n }\n Log.d(\"asda\", mediaStorageDir.getPath());\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File mediaFile;\n if (type == MEDIA_TYPE_IMAGE){\n mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n \"IMG_\"+ timeStamp + \".jpg\");\n } else if(type == MEDIA_TYPE_VIDEO) {\n mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n \"VID_\"+ timeStamp + \".mp4\");\n } else {\n return null;\n }\n\n return mediaFile;\n }", "public void takePictureFromCamera() {\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n startActivityForResult(intent, CAMERA_REQUEST_CODE);\n\n }", "private File getOutputMediaFile() {\n File mediaStorageDir = new\n File(Environment.getExternalStorageDirectory()\n + \"/FoodChain/\"\n + \"/Files\");\n\n\n if (!mediaStorageDir.exists()) {\n if (!mediaStorageDir.mkdirs()) {\n return null;\n }\n }\n File mediaFile;\n mediaFile = new File(mediaStorageDir.getPath() + File.separator + \"QRCodeImage.png\");\n return mediaFile;\n }", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n String folder_main = \"DNote\";\n String path = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES).toString() + File.separator + folder_main;\n File storageDir = new File(path);\n if (!storageDir.exists()) {\n storageDir.mkdir();\n }\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n fileName = image.getAbsolutePath();\n MediaScannerConnection.scanFile(getApplicationContext(), new String[]{image.getPath()}, null,\n new MediaScannerConnection.OnScanCompletedListener() {\n @Override\n public void onScanCompleted(String path, Uri uri) {\n// Log.i(TAG, \"Scanned \" + path);\n }\n });\n return image;\n }", "public void save(View view) {\n String root = Environment.getExternalStorageDirectory().toString();\n File myDir = new File(root + \"/App_images\");\n if (!myDir.exists()) {\n myDir.mkdir();\n }\n // STOP creating directory for images\n Random generator = new Random();\n int n = 10000;\n n = generator.nextInt(n);\n String fname = \"Image-\" + n + \".jpg\";\n File file = new File(myDir, fname);\n if (file.exists()) file.delete();\n try {\n FileOutputStream out = new FileOutputStream(file);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);\n out.flush();\n out.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private File getOutputMediaFile(){\n File mediaStorageDir = new File(Environment.getExternalStorageDirectory()\n + \"/Android/data/\"\n + App.getActiveActivity().getPackageName()\n + \"/Files\");\n\n // This location works best if you want the created images to be shared\n // between applications and persist after your app has been uninstalled.\n\n // Create the storage directory if it does not exist\n if (! mediaStorageDir.exists()){\n if (! mediaStorageDir.mkdirs()){\n return null;\n }\n }\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"ddMMyyyy_HHmm\").format(new Date());\n File mediaFile;\n String mImageName=\"MI_\"+ timeStamp +\".jpg\";\n mediaFile = new File(mediaStorageDir.getPath() + File.separator + mImageName);\n return mediaFile;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));\n if (!storageDir.exists()){\n storageDir.mkdir();\n }\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n return image;\n }", "public void onImageGalleryClicked(View v){\n //invoke the image gallery using an implicit intent\n Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);\n\n //decides where to store pictures\n File pictureDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n String pictureDirectoryPath = pictureDirectory.getPath();\n\n //gets URI representation\n Uri data = Uri.parse(pictureDirectoryPath);\n\n //sets the data and type of media to look for\n photoPickerIntent.setDataAndType(data,\"image/*\");\n startActivityForResult(photoPickerIntent, Image_Gallery_Request);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_deneme2);\n ImageView imageView = findViewById(R.id.imageView);\n\n\n path= getExternalFilesDir(null)+\"/aa/\"+\"/ScreenShot\"+(MainActivity.PHOTO_COUNT-1+\".jpg\");\n File imgFile= new File(path);\n if(imgFile.exists())\n {\n imageView.setImageURI(Uri.fromFile(imgFile));\n\n }\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n return image;\n }", "private void salvaFoto(){\n\n try {\n\n File f = new File(Environment.getExternalStorageDirectory() +getResources().getString(R.string.folder_package)+ \"/\" +id_Familiar+ \".jpg\");\n\n if(f.exists()){ boolean deleted = f.delete();}\n\n ByteArrayOutputStream bytes = new ByteArrayOutputStream();\n bitmap.compress(Bitmap.CompressFormat.JPEG, qualidade_image_profile, bytes);\n\n try {\n f.createNewFile();\n FileOutputStream fo = new FileOutputStream(f);\n fo.write(bytes.toByteArray());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }\n catch (Exception E){\n Log.e(\"error\",\"Erro ao carregar imagem\");\n }\n }", "public File getPublicAlbumStorageDir(String albumName) {\n File file = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES), albumName);\n if (!file.mkdirs()) {\n //Log.e(LOG_TAG, \"Directory not created\");\n }\n return file;\n }", "private File getFileForPhoto(String fileName) {\r\n File mediaStorageDir = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), TAG);\r\n\r\n if (mediaStorageDir.exists() == false && mediaStorageDir.mkdirs() == false) {\r\n Log.d(TAG, \"Cannot create directory for storing photos\");\r\n }\r\n\r\n File file = new File(mediaStorageDir.getPath() + File.separator + fileName);\r\n return file;\r\n }", "private void openImageIntent() {\n final File root = new File(Environment.getExternalStorageDirectory() + File.separator + \"MyDir\" + File.separator);\n root.mkdirs();\n final String fname = UUID.randomUUID().toString();\n final File sdImageMainDirectory = new File(root, fname);\n outputFileUri = Uri.fromFile(sdImageMainDirectory);\n\n // Camera.\n final List<Intent> cameraIntents = new ArrayList<Intent>();\n final Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n final PackageManager packageManager = getPackageManager();\n final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0);\n for(ResolveInfo res : listCam) {\n final String packageName = res.activityInfo.packageName;\n final Intent intent = new Intent(captureIntent);\n intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));\n intent.setPackage(packageName);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);\n cameraIntents.add(intent);\n }\n\n // Filesystem.\n final Intent galleryIntent = new Intent();\n galleryIntent.setType(\"image/*\");\n galleryIntent.setAction(Intent.ACTION_GET_CONTENT);\n\n // Chooser of filesystem options.\n final Intent chooserIntent = Intent.createChooser(galleryIntent, \"Select Source\");\n\n // Add the camera options.\n chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[]{}));\n\n startActivityForResult(chooserIntent, SELECT_PICTURE);\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n return image;\n }", "public String saveimage(Bitmap bmp, String file_name) {\n String path = null;\n File filepath = Environment.getExternalStorageDirectory();\n OutputStream output;\n // Create a new folder in SD Card\n\n File dir = new File(filepath.getAbsolutePath()\n + \"/JVHUB/\");\n if (dir.exists() && dir.isDirectory()) {\n // do something here\n\n\n // Create a name for the saved image\n String timeStamp = \"JVHUB_pic\";\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyyMMdd_HH_mm_ss\");\n String currentTimeStamp = dateFormat.format(new Date());\n File file = new File(dir, currentTimeStamp + \".png\");\n\n // Show a toast message on successful save\n\n try {\n\n output = new FileOutputStream(file);\n path = file.getAbsolutePath();\n\n // Compress into png format image from 0% - 100%\n bmp.compress(Bitmap.CompressFormat.PNG, 100, output);\n output.flush();\n output.close();\n } catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n } else {\n dir.mkdirs();\n String timeStamp = \"JVHUB_pic\";\n File file = new File(dir, timeStamp + \".png\");\n\n // Show a toast message on successful save\n\n try {\n\n output = new FileOutputStream(file);\n path = file.getAbsolutePath();\n\n // Compress into png format image from 0% - 100%\n bmp.compress(Bitmap.CompressFormat.PNG, 100, output);\n output.flush();\n output.close();\n } catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n return path;\n }", "private File createImageFile() {\n\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.getDefault()).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES + APP_PICTURE_DIRECTORY);\n storageDir.mkdirs();\n\n File imageFile = null;\n\n try {\n imageFile = File.createTempFile(\n imageFileName, /* prefix */\n FILE_SUFFIX_JPG, /* suffix */\n storageDir /* directory */\n );\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return imageFile;\n }", "private Uri getOutputMediaFileUri(int mediaType) {\n\t\t\tFile mediaStorageDir = null;\n\t\t\tif(isExternalStorageAvailable()) {\n\t\t\t\tmediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n\t\t\t Environment.DIRECTORY_PICTURES), \"SChat\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmediaStorageDir = new File(Environment.DIRECTORY_DCIM);\n\t\t\t\t//Toast.makeText(MainActivity.this, mediaStorageDir.getParent()+\"\", Toast.LENGTH_LONG).show();\n\t\t\t}\n\t\t\t if (! mediaStorageDir.exists()){\n\t\t\t if (! mediaStorageDir.mkdirs()){\n\t\t\t Log.d(\"MyCameraApp\", \"failed to create directory\");\n\t\t\t return null;\n\t\t\t }\n\t\t\t }\n\t\t\t\n\t\t\t String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n\t\t\t File mediaFile;\n\t\t\t if (mediaType == MEDIA_TYPE_IMAGE){\n\t\t\t mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n\t\t\t \"IMG_\"+ timeStamp + \".jpg\");\n\t\t\t Log.d(\"MyCameraApp\", mediaFile.toString());\n\t\t\t } else if(mediaType == MEDIA_TYPE_VIDEO) {\n\t\t\t mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n\t\t\t \"VID_\"+ timeStamp + \".mp4\");\n\t\t\t } else {\n\t\t\t return null;\n\t\t\t }\n\t\t\t return Uri.fromFile(mediaFile);\n\t\t}", "protected Uri saveImageToInternalStorage(Bitmap bitmap){\n // Initialize ContextWrapper\n ContextWrapper wrapper = new ContextWrapper(context);\n\n // Initializing a new file\n // The bellow line return a directory in internal storage\n File file = wrapper.getDir(\"Images\",MODE_PRIVATE);\n\n // Create a file to save the image\n file = new File(file, \"check12\"+\".jpg\");\n\n try{\n // Initialize a new OutputStream\n OutputStream stream = null;\n\n // If the output file exists, it can be replaced or appended to it\n stream = new FileOutputStream(file);\n\n // Compress the bitmap\n bitmap.compress(Bitmap.CompressFormat.JPEG,100,stream);\n\n // Flushes the stream\n stream.flush();\n\n // Closes the stream\n stream.close();\n\n }catch (IOException e) // Catch the exception\n {\n e.printStackTrace();\n }\n\n // Parse the gallery image url to uri\n Uri savedImageURI = Uri.parse(file.getAbsolutePath());\n\n // Return the saved image Uri\n return savedImageURI;\n }", "private void captureImage() {\n\n if (ContextCompat.checkSelfPermission(Main2Activity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(Main2Activity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);\n } else {\n Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n if (takePictureIntent.resolveActivity(getPackageManager()) != null) {\n // Create the File where the photo should go\n try {\n\n photoFile = createImageFile();\n //displayMessage(getBaseContext(), photoFile.getAbsolutePath());\n //Log.i(\"path_check\", photoFile.getAbsolutePath());\n\n // Continue only if the File was successfully created\n if (photoFile != null) {\n Uri photoURI = FileProvider.getUriForFile(Main2Activity.this,\n \"com.example.mobileai.fileprovider\",\n photoFile);\n takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n startActivityForResult(takePictureIntent, requestCode);\n }\n } catch (Exception ex) {\n // Error occurred while creating the File\n //displayMessage(getBaseContext(), ex.getMessage().toString());\n }\n\n\n } else {\n // displayMessage(getBaseContext(), \"Null\");\n }\n }\n\n\n }", "private File getOutputMediaFile() {\n if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {\n Toast.makeText(this, \"请检查SDCard!\", Toast.LENGTH_SHORT).show();\n return null;\n }\n\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), \"MyCameraApp\");\n if (!mediaStorageDir.exists()) {\n mediaStorageDir.mkdirs();\n }\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File mediaFile = new File(mediaStorageDir.getPath() + File.separator + \"VID_\" + timeStamp + \".mp4\");\n return mediaFile;\n }", "private Uri getPicOutputUri(){\n String filePath = getExternalFilesDir(Environment.DIRECTORY_PICTURES) + File.separator + String.valueOf(System.currentTimeMillis())+\".jpg\";\n return Uri.fromFile(new File(filePath));\n }", "public File getAlbumStorageDir(String albumName) {\n File file = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), albumName);\n if (!file.exists() && !file.mkdirs()) {\n Log.e(\"CAPTURE\", \"Directory not created\");\n }\n return file;\n }", "private void saveImageToGallery() {\n ContentValues image = new ContentValues();\n image.put(MediaStore.Images.Media.TITLE, mPictureFile);\n image.put(MediaStore.Images.Media.DISPLAY_NAME, mPictureFile);\n image.put(MediaStore.Images.Media.DESCRIPTION, \"Processed by the MFace App\");\n image.put(MediaStore.Images.Media.DATE_TAKEN, System.nanoTime()); //\n image.put(MediaStore.Images.Media.MIME_TYPE, \"image/jpeg\");//png!!!\n image.put(MediaStore.Images.Media.ORIENTATION, 0);\n image.put(MediaStore.Images.Media.DATA, mPictureFile);\n getContext().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, image);\n }", "@RequiresApi(api = Build.VERSION_CODES.N)\n private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n Log.i(TAG, \"Time Stamp: \" + timeStamp);\n\n String imageFileName = \"jpeg_\" + timeStamp + \"_\";\n Log.i(TAG, \"imageFileName: \" + imageFileName);\n\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n Log.i(TAG, \"Photo file path: \" + cameraFilePath);\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"1mind_\" + timeStamp + \".png\";\n File photo = new File(Environment.getExternalStorageDirectory(), imageFileName);\n mCurrentPhotoPath = photo.getAbsolutePath();\n return photo;\n }", "private File createImageFile() {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"GIS\");\n File image = null;\n\n if(!storageDir.exists()){\n\n storageDir.mkdirs();\n\n }\n try {\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }catch (Exception e){\n\n e.printStackTrace();\n\n }\n // Save a file: path for use with ACTION_VIEW intents\n\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.CANADA).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = mActivity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName,\n \".jpg\",\n storageDir\n );\n\n cameraFilePath = image.getAbsolutePath();\n return image;\n }", "private static File getOutputMediaFile(int type){\n\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES), \"PanoClicks\");\n // This location works best if you want the created images to be shared\n // between applications and persist after your app has been uninstalled.\n\n // Create the storage directory if it does not exist\n if (! mediaStorageDir.exists()){\n if (! mediaStorageDir.mkdirs()){\n Log.d(\"MyCameraApp\", \"failed to create directory\");\n return null;\n }\n }\n\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File mediaFile;\n if (type == MEDIA_TYPE_IMAGE) {\n mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n \"IMG_\" + timeStamp + \".jpg\");\n } else {\n return null;\n }\n\n return mediaFile;\n }", "@RequiresApi(api = Build.VERSION_CODES.N)\n private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n System.out.println(\"StorageDir \" + storageDir);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n try {\n\n // camera photo\n if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {\n imageUri = Uri.fromFile(new File(mCameraFileName)); //zwraca zdjęcie z aparatu jako ścieszkę uri\n Log.d(TAG, \"onActivityResult: imageUri z aparatu: \" + imageUri);\n }\n\n // save picture to imageBitmap from taken mageUri from camera\n imageBitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri);\n imageViewOfPhotoFromCamera.setImageBitmap(imageBitmap); // set imageBitmap in image View\n Log.d(TAG, \"onActivityResult, imageBitmap SAVED and set in imageView\");\n\n } catch (Exception e) {\n Log.d(TAG, \"onActivityResult, ERROr, imageBitmap NOT saved because e: \" + e);\n }\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private String setFileDestinationPath(){\n String filePathEnvironment = Environment.getExternalStorageDirectory().getAbsolutePath();\n Log.d(TAG, \"Full path edited \" + filePathEnvironment + \"/earwormfix/\" + generatedFilename + EXTENSION_JPG);\n return filePathEnvironment+ \"/earwormfix/\" + generatedFilename + EXTENSION_JPG;\n }", "private String saveBitmapToInternalStorage(Bitmap bitmapImage, String imageName){\n\n\t\tContextWrapper cw = new ContextWrapper(getApplicationContext());\n\t\t// path to /data/data/yourapp/app_data/imageDir\n\t\tFile directory = cw.getDir(\"imageDir\", Context.MODE_PRIVATE);\t//readable is just for testing\n\t\t// Create imageDir\n\t\tFile mypath=new File(directory, imageName.replaceFirst(\"/\", \"\")+\".jpg\");\n\n\t\tFileOutputStream fos = null;\n\n\t\ttry { \n\t\t\tfos = new FileOutputStream(mypath);\n\n\t\t\tbitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fos);\n\n\t\t\tfos.close();\n\n\t\t} catch (Exception e) {\n\t\t\tToast.makeText(getBaseContext(), \"Catch #12:49\", Toast.LENGTH_LONG).show();\n\t\t}\n\n\t\treturn directory.getAbsolutePath();\n\t}", "@Override\n public void onClick(View v) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n if (checkSelfPermission(Manifest.permission.CAMERA)\n == PackageManager.PERMISSION_DENIED\n || checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)\n == PackageManager.PERMISSION_DENIED){\n //permission not enable request it\n String[] permission ={Manifest.permission.CAMERA,Manifest.permission.WRITE_EXTERNAL_STORAGE};\n requestPermissions(permission, PERMISSION_CODE);\n }\n else{\n openCamera();\n }\n\n }\n }", "public File getMagicMazeVideosDir() {\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\r\n Environment.DIRECTORY_MOVIES), \"MagicMaze\");\r\n // This location works best if you want the created images to be shared\r\n // between applications and persist after your app has been uninstalled.\r\n\r\n // Create the storage directory if it does not exist\r\n if (!mediaStorageDir.exists()) {\r\n if (!mediaStorageDir.mkdirs()) {\r\n Log.d(\"MagicMaze\", \"failed to create directory\");\r\n return null;\r\n }\r\n }\r\n return mediaStorageDir;\r\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.ENGLISH).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private void saveImage(Bitmap bitmap, String fileName) {\n File createFolder = new File(Environment.getExternalStorageDirectory(), FILEPATH);\n if (!createFolder.exists())\n createFolder.mkdir();\n\n File output = new File(Environment.getExternalStorageDirectory(),\n FILEPATH + \"/\" + fileName + \".jpg\");\n if (output.exists()) {\n output.delete();\n\n /*Whenever you delete a file, let MediaStore Content Provider knows about it*/\n// getContentResolver().delete(Uri.fromFile(output), null, null);\n }\n\n// System.currentTimeMillis()\n File saveImage = new File(createFolder, fileName + \".jpg\");\n try {\n OutputStream outputStream = new FileOutputStream(saveImage);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);\n outputStream.flush();\n outputStream.close();\n if (saveImage.exists()) {\n /*Whenever you add a file, let MediaStore Content Provider knows about it using*/\n sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(saveImage)));\n\n\n publishResults(fileName, result);//output.getAbsolutePath()\n Log.v(TAG, fileName + \", size : \" + saveImage.getAbsoluteFile().length());\n }\n } catch (FileNotFoundException e) {\n publishResults(fileName, result);\n e.printStackTrace();\n } catch (IOException e) {\n publishResults(fileName, result);\n e.printStackTrace();\n }\n }", "private void openCamera() {\n CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);\n try {\n String cameraId = manager.getCameraIdList()[0];\n CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);\n StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);\n assert map != null;\n imageDimension = map.getOutputSizes(SurfaceTexture.class)[0];\n // Add permission for camera and let user grant the permission\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_CAMERA_PERMISSION);\n return;\n }\n manager.openCamera(cameraId, stateCallback, null);\n } catch (CameraAccessException e) {\n Toast.makeText(this, \"Camera failed to open.\", Toast.LENGTH_SHORT).show();\n e.printStackTrace();\n }\n }", "public void cargarGaleriaImgs(View view) {\n//Comprobamos el estado de la memoria externa (tarjeta SD)\n String estado = Environment.getExternalStorageState();\n//indica que la memoria externa está disponible y podemos tanto leer como escribir en ella.\n if (estado.equals(Environment.MEDIA_MOUNTED))\n {\n System.out.println(\"Podemos leer y escribir\");\n sdDisponible = true;\n sdAccesoEscritura = true;\n crearIntentGallery();\n }\n else if (estado.equals(Environment.MEDIA_MOUNTED_READ_ONLY))\n {\n System.out.println(\"Podemos SOLO leer\");\n sdDisponible = true;\n sdAccesoEscritura = false;\n }\n else\n {\n System.out.println(\"No Podemos hacer nada\");\n sdDisponible = false;\n sdAccesoEscritura = false;\n }\n }", "protected void open_camera_and_save_image() {\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n\n // Ensure that there is a camera activity to handle the intent.\n if(intent.resolveActivity(getPackageManager()) != null) {\n // create the file where the photo should go\n File photoFile = null;\n try {\n photoFile = createImageFile();\n } catch (IOException e) {\n // error occurred while creating the file\n result.setText(R.string.fail_in_creating_photo);\n }\n\n if(photoFile != null) {\n Uri photoURI = FileProvider.getUriForFile(this,\n \"com.example.jiankaiwang.fileprovider\", photoFile);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n\n // pass to another external activity\n startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);\n }\n }\n }", "private Uri getOutputMediaFileUri(int mediaType) {\n //parvo triabva da se proveri dali ima external storage\n\n if (isExternalStorageAvailable()) {\n\n //sled tova vrashtame directoriata za pictures ili ia sazdavame\n //1.Get external storage directory\n String appName = SendMessage.this.getString(R.string.app_name);\n String environmentDirectory; //\n //ako snimame picture zapismave v papkata za kartiniki, ako ne v papkata za Movies\n\n if(mediaType == MEDIA_TYPE_IMAGE) {\n environmentDirectory = Environment.DIRECTORY_PICTURES;\n } else {\n environmentDirectory = Environment.DIRECTORY_MOVIES;\n }\n File mediaStorageDirectory = new File(\n Environment.getExternalStoragePublicDirectory(environmentDirectory),\n appName);\n\n //2.Create subdirectory if it does not exist\n if (! mediaStorageDirectory.exists()) {\n if (!mediaStorageDirectory.mkdirs()) {\n Log.e(TAG, \"failed to create directory\");\n return null;\n }\n }\n\n //3.Create file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File mediaFile;\n if (mediaType == MEDIA_TYPE_IMAGE) {\n mediaFile = new File(mediaStorageDirectory.getPath() + File.separator +\n \"IMG_\" + timeStamp + \".jpg\");\n } else if (mediaType == MEDIA_TYPE_VIDEO) {\n mediaFile = new File(mediaStorageDirectory.getPath() + File.separator +\n \"MOV_\" + timeStamp + \".mp4\");\n } else {\n return null;\n }\n //4.Return the file's URI\n Log.d(TAG, \"File path: \" + Uri.fromFile(mediaFile));\n return Uri.fromFile(mediaFile);\n\n } else //ako niama external storage\n Log.d(\"Vic\",\"no external strogage, mediaUri si null\");\n return null;\n\n }", "public static Uri createImageUri() {\n \t\tUri imageFileUri;\n \t\tString folder = Environment.getExternalStorageDirectory()\n \t\t\t\t.getAbsolutePath() + \"/tmp\";\n \t\tFile folderF = new File(folder);\n \t\tif (!folderF.exists()) {\n \t\t\tfolderF.mkdir();\n \t\t}\n \n \t\tString imageFilePath = folder + \"/\"\n \t\t\t\t+ String.valueOf(System.currentTimeMillis()) + \"jpg\";\n \t\tFile imageFile = new File(imageFilePath);\n \t\timageFileUri = Uri.fromFile(imageFile);\n \n \t\treturn imageFileUri;\n \t}", "private void takePicture() {\n Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n // check if there is a camera app installed\n if (takePictureIntent.resolveActivity(getPackageManager()) != null) {\n // build the photo file\n mPhotoFile = new File(getExternalFilesDir(null), code + \".jpg\");\n // get URI using a file provider\n Uri photoURI = FileProvider.getUriForFile(this,\n \"com.martindisch.fileprovider\",\n mPhotoFile);\n // put URI into Intent\n takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n // send Intent\n startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);\n } else {\n Toast.makeText(this, R.string.no_camera, Toast.LENGTH_SHORT).show();\n }\n }", "protected void startCamera() {\n profileImageCaptured = new File(\n Environment.getExternalStorageDirectory() + \"/\" + \"temp.png\");\n if (profileImageCaptured.exists())\n profileImageCaptured.delete();\n\n outputFileUri = Uri.fromFile(profileImageCaptured);\n Intent intent = new Intent(\n android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);\n intent.putExtra(\"return-data\", true);\n startActivityForResult(intent, CAMERA_REQUEST);\n\n }", "public File getMediaDir() {\r\n return mediaDir;\r\n }", "@SuppressLint(\"SimpleDateFormat\")\n public static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + JPEG_FILE_SUFFIX;\n String nameAlbum = Environment.getExternalStorageDirectory().getAbsolutePath() + \"/\" + nameDir;// getString(R.string.app_name);\n File albumF = new File(nameAlbum);\n if (!albumF.exists()) {\n albumF.mkdirs();\n File noMedia = new File(albumF, \".nomedia\");\n noMedia.createNewFile();\n }\n\n File imageF = new File(albumF, imageFileName);\n imageF.createNewFile();\n return imageF;\n }", "@Override\n public void onClick(View view) {\n Intent takeFoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n if(takeFoto.resolveActivity(getPackageManager()) != null){\n File photoFile = null;\n try{\n photoFile = createImageFile();\n } catch (IOException ex) {\n Log.d(\"FALLO\",\"TOMAR FOTO\");\n }\n if(photoFile != null) {\n Uri photoURI = FileProvider.getUriForFile(getApplicationContext(), \"com.B3B.farmbros.android.fileprovider\", photoFile);\n takeFoto.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);\n startActivityForResult(takeFoto, REQUEST_IMAGE_SAVE);\n }\n }\n }", "public void getImagesFromFolder() {\n File file = new File(Environment.getExternalStorageDirectory().toString() + \"/saveclick\");\n if (file.isDirectory()) {\n fileList = file.listFiles();\n for (int i = 0; i < fileList.length; i++) {\n files.add(fileList[i].getAbsolutePath());\n Log.i(\"listVideos\", \"file\" + fileList[0]);\n }\n }\n }", "private String saveToInternalStorage(Bitmap bitmapImage) {\n\n compteurPhoto++;\n\n Random rd = new Random();\n int randomnum = 1+ (int)(Math.random()*4000);\n\n\n ContextWrapper cw = new ContextWrapper(getApplicationContext());\n // path to /data/data/yourapp/app_data/imageDir\n File directory = cw.getDir(\"imageDir\", Context.MODE_PRIVATE);\n // Create imageDir\n File mypath = new File(directory, randomnum+\".jpg\");\n\n FileOutputStream fos = null;\n try {\n\n fos = new FileOutputStream(mypath);\n\n // Use the compress method on the BitMap object to write image to the OutputStream\n bitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fos);\n fos.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n return mypath.getPath();\n }", "private File createImageFile() throws IOException {\n String imageFileName = new SimpleDateFormat(\"yyyyMMdd-HHmmss\", Locale.ENGLISH).format(new Date());\n String storageDir = Environment.getExternalStorageDirectory() + \"/DokuChat\";\n File dir = new File(storageDir);\n if (!dir.exists())\n dir.mkdir();\n\n image = new File(storageDir + \"/\" + imageFileName + \".jpg\");\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private void takePicture() {\n\n Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n startActivityForResult(intent, REQUEST_CAMERA);\n\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tif (new FileUtil().getFilesList() != null) {\n\t\t\t\t\tPictureToBye.deletePhotos();// 清空Pad上的图片\n\t\t\t\t}\n\t\t\t\tIntent intentCamera = new Intent(\n\t\t\t\t\t\tMediaStore.ACTION_IMAGE_CAPTURE);\n\n\t\t\t\tUri uri = null;\n\t\t\t\ttry {\n\t\t\t\t\turi = Uri.fromFile(new FileUtil().createFileInSDCard(\n\t\t\t\t\t\t\tDateUtils.toString(new Date(), \"yyyyMMddHHmmss\")\n\t\t\t\t\t\t\t\t\t+ \"test.jpg\", \"/\"));\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\t// intentCamera.putExtra(name, value);\n\t\t\t\tintentCamera.putExtra(MediaStore.EXTRA_OUTPUT, uri);\n\t\t\t\tstartActivity(intentCamera);\n\t\t\t}", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = imageFileName + \"camera.jpg\";\n return image;\n }", "private static File getOutputMediaFile(int type){\n\n File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES), \"MyCameraApp\");\n // This location works best if you want the created images to be shared\n // between applications and persist after your app has been uninstalled.\n\n // Create the storage directory if it does not exist\n if (! mediaStorageDir.exists()){\n if (! mediaStorageDir.mkdirs()){\n Log.d(\"MyCameraApp\", \"failed to create directory\");\n return null;\n }\n }\n\n // Create a media file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n File mediaFile;\n if (type == MEDIA_TYPE_IMAGE){\n mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n \"IMG_\"+ timeStamp + \".jpg\");\n } else if(type == MEDIA_TYPE_VIDEO) {\n mediaFile = new File(mediaStorageDir.getPath() + File.separator +\n \"VID_\"+ timeStamp + \".mp4\");\n } else {\n return null;\n }\n\n return mediaFile;\n }", "private File createImageFile() {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File storageDir = new File(utils.getSentImagesDirectory());\n\n File image = null;\n try {\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n // Save a file: path for use with ACTION_VIEW intents\n //LOG.info(\"test place3\");\n try {\n imageFilePath = image.getAbsolutePath();\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n //LOG.info(\"test place4\");\n if (image == null) {\n LOG.info(\"image file is null\");\n } else {\n LOG.info(\"image file is not null path is:\" + imageFilePath);\n }\n return image;\n }" ]
[ "0.7528324", "0.7393338", "0.72090846", "0.7159961", "0.7127435", "0.7112427", "0.7105568", "0.7044399", "0.7039726", "0.70320284", "0.7027157", "0.6885333", "0.68834734", "0.68793523", "0.6833828", "0.6797662", "0.6773855", "0.67598933", "0.6759714", "0.66613454", "0.6639261", "0.66197574", "0.6613589", "0.6591859", "0.6560487", "0.65580624", "0.65136236", "0.65096587", "0.64935434", "0.6468684", "0.6463418", "0.64612573", "0.64379567", "0.6435762", "0.64264905", "0.6422802", "0.6410862", "0.639421", "0.63904774", "0.6385516", "0.63614464", "0.6344086", "0.63279057", "0.6314332", "0.6312249", "0.63095313", "0.63058615", "0.63030285", "0.6293402", "0.6285846", "0.6282232", "0.62803644", "0.6262045", "0.6262045", "0.62620157", "0.6259175", "0.6254281", "0.6243325", "0.6242059", "0.62328154", "0.622567", "0.62191486", "0.62183815", "0.6202317", "0.61979884", "0.61903876", "0.61815906", "0.6176011", "0.6170651", "0.61684626", "0.6164586", "0.61525095", "0.61434203", "0.613902", "0.61339444", "0.61204576", "0.611866", "0.61149615", "0.6111938", "0.6109234", "0.6104862", "0.6103597", "0.6086769", "0.6079148", "0.6077848", "0.6070989", "0.60686314", "0.60665005", "0.6063494", "0.6060769", "0.6060397", "0.60511136", "0.6046446", "0.60440224", "0.60395133", "0.60298216", "0.6025584", "0.60238165", "0.6012294", "0.6006511" ]
0.78888935
0
Author: Oluwatobi Adenekan date: 15/08/2019
public interface CompetitionDetailPresenter { void setCompetition(NameAndId competitionDetail); void onDestroy(); void onPause(); void onResume(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void cajas() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "private stendhal() {\n\t}", "public void mo4359a() {\n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n protected void getExras() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public final void mo51373a() {\n }", "private void poetries() {\n\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public void mo6081a() {\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "public void mo55254a() {\n }", "@Override\n public void memoria() {\n \n }", "public void mo12930a() {\n }", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "public void mo1531a() {\n }", "@Override\n\tpublic void anular() {\n\n\t}", "private UsineJoueur() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "Petunia() {\r\n\t\t}", "public void mo9848a() {\n }", "private DittaAutonoleggio(){\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "private void kk12() {\n\n\t}", "public Pitonyak_09_02() {\r\n }", "public static void listing5_14() {\n }", "private void strin() {\n\n\t}", "private void limpiarDatos() {\n\t\t\n\t}", "private void m50366E() {\n }", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public void mo5382o() {\n }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public void mo21877s() {\n }", "public void mo12628c() {\n }", "public static void main(String args[]) throws Exception\n {\n \n \n \n }", "protected void mo6255a() {\n }", "@Override\n\tpublic void nghe() {\n\n\t}", "public contrustor(){\r\n\t}", "static void feladat7() {\n\t}", "@Override\n\tpublic int mettreAJour() {\n\t\treturn 0;\n\t}", "@Override\npublic String toString() {// PARA MOSTRAR LOS DATOS DE ESTA CLASE\n// TODO Auto-generated method stub\nreturn MuestraCualquiera();\n}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "static void feladat4() {\n\t}", "void kiemTraThangHopLi() {\n }", "private Rekenhulp()\n\t{\n\t}", "public void themesa()\n {\n \n \n \n \n }", "public void onderbreek(){\n \n }", "private zza.zza()\n\t\t{\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "static void feladat9() {\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public void Ordenamiento() {\n\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override//sobrescribir metodo\n public String getDescripcion(){\n return hamburguesa.getDescripcion()+\" + lechuga\";//retorna descripcion del oobj hamburguesa y le agrega +lechuga\n }", "public void autoDetails() {\n\t\t\r\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "public void mo97908d() {\n }", "private void cargartabla() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }", "public void mo21779D() {\n }", "public void mo21825b() {\n }", "public void Exterior() {\n\t\t\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "static void feladat5() {\n\t}", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "public void verliesLeven() {\r\n\t\t\r\n\t}", "@Override\n\tvoid geraDados() {\n\n\t}", "public void mo21782G() {\n }", "private void getStatus() {\n\t\t\n\t}", "public void mo21785J() {\n }", "@Override\n public int describeContents() { return 0; }", "public void mo3749d() {\n }", "@Override\r\n\tpublic void 먹기() {\n\t\tSystem.out.println(\"다람쥐,도토리를 먹는다.\");\r\n\t}", "static void feladat6() {\n\t}", "public void mo21878t() {\n }", "private void remplirPrestaraireData() {\n\t}", "public void mo21794S() {\n }", "void berechneFlaeche() {\n\t}", "public static void listing5_16() {\n }", "public void mo21783H() {\n }", "public void estiloAcierto() {\r\n\t\t /**Bea y Jose**/\t\t\r\n \r\n\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}" ]
[ "0.6012568", "0.5843541", "0.5817111", "0.57552576", "0.57339245", "0.5695001", "0.56003964", "0.55872273", "0.55872273", "0.55872273", "0.55872273", "0.55872273", "0.55872273", "0.55872273", "0.5583071", "0.55576164", "0.5546312", "0.5533875", "0.5533773", "0.5524138", "0.5503816", "0.54821914", "0.54821914", "0.5475139", "0.5468133", "0.5463091", "0.54577106", "0.54518133", "0.5428305", "0.5421806", "0.53910303", "0.5381718", "0.53639424", "0.5362605", "0.53534", "0.53320736", "0.5323116", "0.5319892", "0.5315", "0.5307482", "0.5288567", "0.5278673", "0.5274336", "0.527337", "0.5264703", "0.5261809", "0.52405834", "0.52360296", "0.5231772", "0.52299243", "0.522182", "0.522182", "0.52183837", "0.52115756", "0.5211351", "0.5206635", "0.5200081", "0.5198195", "0.5197553", "0.51965755", "0.5192231", "0.5190337", "0.5182268", "0.51809084", "0.5175294", "0.51741266", "0.5173845", "0.51718843", "0.51595294", "0.51580465", "0.51484257", "0.51399535", "0.5128797", "0.5128664", "0.5113128", "0.51065844", "0.51039714", "0.5103231", "0.51005197", "0.5083142", "0.5078966", "0.5075476", "0.5069873", "0.50679064", "0.5067255", "0.505866", "0.5058142", "0.5056767", "0.5056357", "0.5052966", "0.5052666", "0.5050406", "0.504924", "0.50492215", "0.5048719", "0.5045865", "0.5044173", "0.5037656", "0.50292146", "0.50225824", "0.5021116" ]
0.0
-1
used to async call instead of runnable
public interface Callable<V> { public void onCall(int state, V jo); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n public void callSync() {\n\n }", "@Override\n\t\t\t\t\t\t public void run() {\n\t\t\t\t\t\t\t getResponse();\n\t\t\t\t\t\t }", "@Override\r\n\t\tprotected void run() {\n\t\t\t\r\n\t\t}", "@Override\n public void run() {\n task.run();\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\npublic void run() {\n perform();\t\n}", "@Override\r\n public void run() {}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tAbsTaskAsynCallBack.this.run();\n\t\t\t\tAbsTaskAsynCallBack.this.callback();\n\t\t\t}", "public abstract void onAsyncRun(View view);", "@Override\n public void run() {\n load_remote_data();\n }", "@Override\n\t\t\tpublic void run() {\n\n\t\t\t}", "@Override\n public void run(){\n }", "@Override\r\n\t\t\t\tpublic void run() {\n\r\n\t\t\t\t}", "@Override\r\n\t\t\t\tpublic void run() {\n\r\n\t\t\t\t}", "@Override\n public void run()\n {\n }", "@Override\n public void run()\n {\n }", "@Override\n public void run() {\n }", "@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tinvoke();\n\t\t\t\t\t}", "@Override\n public void run() {\n }", "@Override\n\t\t\tpublic void callbackCall() {\n\t\t\t}", "private void async(Runnable runnable) {\n Bukkit.getScheduler().runTaskAsynchronously(KitSQL.getInstance(), runnable);\n }", "@Override\n\tpublic void run()\n\t{\n\n\t}", "protected void onQueued() {}", "@Override\n\t\tpublic void run() {\n\n\t\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void run() {\n\t\t\r\n\t}", "@Override\n\t\tpublic void run() {\n\t\t\ttask();\n\t\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\tpublic void run() {\n\t\t\n\t}", "@Override\n\t\tpublic void run() {\n\t\t\t\n\t\t}", "@Override\n\t\tpublic void run() {\n\t\t\t\n\t\t}", "@Override\n\tpublic void run()\n\t{\n\t}", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n\tpublic void run() {\n\n\t}", "@Override\n\tpublic void run() {\n\n\t}", "@Override\n\tpublic void run() {\n\n\t}", "@Override\n\tpublic void run() {\n\n\t}", "@Override\n\tpublic void run() {\n\n\t}", "@Override\n public void run() {\n runTask();\n\n }", "@Override\r\n\tpublic void run() {\n\t}", "@Override\r\n\tpublic void run() {\n\t}", "@Override\n\tpublic void run() {\n\t}", "@Override\n public void run()\n {\n\n }", "@Override\n\tpublic void run() {\n\t\t\n\t\t\t\t\t\t\n\t}", "@Override\n public void run() {\n new NdefReaderTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "private void requestData(String uri) {\n MyTask myTask = new MyTask();\n\n // Work parralial\n myTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, uri);\n }", "public void run() {\n\t\t\t\t\t\t}", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void run() {\n }", "@Override\n public void execute() {\n Task<Void> task = new Task<Void>() {\n @Override\n protected Void call() throws Exception {\n exportData();\n return null;\n }\n\n @Override\n protected void succeeded(){\n callback.onSuccess();\n super.succeeded();\n }\n\n @Override\n protected void failed(){\n callback.onFail(this.getException());\n super.failed();\n }\n };\n new Thread(task).start();\n }", "@Override\r\n\tpublic void doTask() {\n\t}", "@Override\n public void run() {\n\n }", "@Override\n public void run() {\n refreshData();\n }", "@Override\r\n\tvoid execute(Runnable task);" ]
[ "0.66032803", "0.66032803", "0.65749574", "0.65664226", "0.6564685", "0.6546132", "0.6536174", "0.6536174", "0.6533965", "0.6533965", "0.6533965", "0.65255356", "0.65255356", "0.6520946", "0.6520946", "0.6520946", "0.6520946", "0.6520946", "0.6520946", "0.6520946", "0.6510601", "0.6488217", "0.64714885", "0.64714885", "0.6467823", "0.64457285", "0.64294565", "0.6429322", "0.64231133", "0.6416862", "0.6416862", "0.6403929", "0.6403929", "0.6381661", "0.63655555", "0.63465756", "0.6320894", "0.6302351", "0.6301936", "0.62965775", "0.6293342", "0.6279559", "0.6279559", "0.6279559", "0.6279559", "0.6279559", "0.6279559", "0.6279559", "0.6279559", "0.6279559", "0.62771976", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.62752676", "0.6271423", "0.6271423", "0.6266053", "0.62632906", "0.62632906", "0.62632906", "0.62632906", "0.62632906", "0.62632906", "0.62632906", "0.6252258", "0.6252258", "0.6252258", "0.6252258", "0.6252258", "0.6243118", "0.62324977", "0.62324977", "0.62255675", "0.62232506", "0.6212864", "0.6197454", "0.61818004", "0.61818004", "0.6181483", "0.61567086", "0.61509275", "0.61509275", "0.61509275", "0.61483204", "0.61482674", "0.61423403", "0.61397636", "0.61259276" ]
0.0
-1
Open the database in writable mode
public void openDatabase(@NonNull Context context){ if (databaseClosed) { NoteDatabaseHelper dbHelper = new NoteDatabaseHelper(context, Util.DATABASE_NAME, null, Util.DATABASE_VERSION); noteDatabase = dbHelper.getWritableDatabase(); databaseClosed = false; } else if (noteDatabase.isReadOnly()) { //the database is open, but in the wrong mode (i.e. readonly, and not writeable), // so it needs to be closed, and reopened in writable mode. closeDatabase(); openDatabase(context); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void openRWDB() throws SQLException {\r\n\t\tString mPath = DATABASE_PATH + DATABASE_NAME;\r\n\t\tmDataBase = SQLiteDatabase.openDatabase(mPath, null,\r\n\t\t\t\tSQLiteDatabase.OPEN_READWRITE);\r\n\t}", "public DaoSession openWritableDb() {\n isInitOk();\n SQLiteDatabase db = openHelper.getWritableDatabase();\n DaoMaster daoMaster = new DaoMaster(db);\n DaoSession daoSession = daoMaster.newSession();\n return daoSession;\n }", "public int openWritableDB()\n {\n int statusCode = OPEN_SUCCESS;\n\n try {\n db = dbHelper.getWritableDatabase();\n }\n catch (SQLiteException dbWriteableException) {\n statusCode = OPEN_FAIL;\n // Log the exception\n }\n\n return statusCode;\n }", "public DBAdapter open_rw() throws SQLException {\n db = DBHelper.getWritableDatabase();\n return this;\n }", "public void open() {\n\n\t\t_database = _dbHelper.getWritableDatabase();\n\t}", "public void openRODB() throws SQLException {\r\n\t\tString mPath = DATABASE_PATH + DATABASE_NAME;\r\n\t\tmDataBase = SQLiteDatabase.openDatabase(mPath, null,\r\n\t\t\t\tSQLiteDatabase.OPEN_READONLY);\r\n\t}", "public void open() throws SQLException {\r\n this.database = dbhelper.getWritableDatabase();\r\n }", "public void open() throws SQLException {\n\t\tdatabase = dbHelper.getWritableDatabase();\n\t}", "public void open() {\n this.db = this.mSqlHelper.getWritableDatabase();\n }", "public void open() throws SQLException {\n database = helper.getWritableDatabase();\n }", "public void open() throws SQLException {\n database = helperAngkot.getWritableDatabase();\n }", "public void open(){\n\t\tbdd = maBaseSQLite.getWritableDatabase();\n\t}", "@Override\n\tprotected SQLiteDatabase openWritableDb() {\n\t\treturn super.openWritableDb();\n\t}", "@Override\n\tpublic SQLiteDatabase getWritableDatabase() {\n \t// TODO Auto-generated method stub\n \tsynchronized(DBOpenHelper.class) {\n \t\tif ((myWritableDb == null) || (!myWritableDb.isOpen())) {\n \t\t\treturn super.getWritableDatabase();\n \t\t}\n \t}\n \treturn myWritableDb;\n\t}", "public void open() throws SQLException {\n database = dbHelper.getWritableDatabase();\n }", "public void open() throws SQLException {\n database = dbHelper.getWritableDatabase();\n }", "public void open() throws SQLException {\n database = dbHelper.getWritableDatabase();\n }", "public DBinterface open() throws SQLException {\r\n db = helper.getWritableDatabase();\r\n return this;\r\n }", "public void open() throws SQLException {\n\t\t// creates or opens a database\n\t\tdatabase = dbHelper.getWritableDatabase();\n//\t\tdbHelper.onUpgrade(database, 1, 1); // Use this statement to reset database\n\t}", "public void open(){\n this.db = this.typeDatabase.getWritableDatabase();\n }", "public synchronized SQLiteDatabase getMyWritableDatabase() {\r\n if ((myWritableDb == null) || (!myWritableDb.isOpen())) {\r\n myWritableDb = this.getWritableDatabase();\r\n }\r\n return myWritableDb;\r\n }", "public void open() {\n this.database = openHelper.getWritableDatabase();\n }", "public void open() {\n this.database = openHelper.getWritableDatabase();\n }", "public void open() {\n this.database = openHelper.getWritableDatabase();\n }", "public void open() {\n this.database = openHelper.getWritableDatabase();\n }", "public void open() {\n this.database = openHelper.getWritableDatabase();\n }", "private void setWrite() {\n db = handler.getWritableDatabase();\n }", "public void writeDatabase();", "public void open() {\n\t\tbanco =BancoHelper.getWritableDatabase();\n\t}", "public DatabaseManager open() throws SQLException {\n db = DBHelper.getWritableDatabase();\n return this;\n }", "private void open()\n\t\t{\n\t\t\tconfig=Db4oEmbedded.newConfiguration();\n\t\t\tconfig.common().objectClass(Census.class).cascadeOnUpdate(true);\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\tDB=Db4oEmbedded.openFile(config, PATH);\n\t\t\t\tSystem.out.println(\"[DB4O]Database was open\");\n\t\t\t\t\n\t\t\t}\n\t\t\tcatch(Exception e)\n\t\t\t{\n\t\t\t\tSystem.out.println(\"[DB4O]ERROR:Database could not be open\");\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}", "public void open() throws SQLException {\n\t\t \n\t\t mDatabase = mDbHelper.getWritableDatabase();\n\t\t mDatabase = mDbHelper.getWritableDatabase();\n\n\t\t //refreshCompanies();\n\t }", "public abstract ODatabaseInternal<?> openDatabase();", "public void open() {\n db = dbHelper.getWritableDatabase();\n articleDAO.open(db);\n categoryDAO.open(db);\n sourceDAO.open(db);\n }", "private void openDatabase() {\n database = new DatabaseExpenses(this);\n database.open();\n }", "public void open() {\n dbHelper = new DatabaseHelper(context);\n sqLiteDatabase = dbHelper.getWritableDatabase();\n }", "public DBHandler open() throws SQLException\r\n {\r\n DBHelper = new DBHelper(context);\r\n DB = DBHelper.getWritableDatabase();\r\n return this;\r\n }", "private void openDatabase() {\r\n if ( connect != null )\r\n return;\r\n\r\n try {\r\n // Setup the connection with the DB\r\n String host = System.getenv(\"DTF_TEST_DB_HOST\");\r\n String user = System.getenv(\"DTF_TEST_DB_USER\");\r\n String password = System.getenv(\"DTF_TEST_DB_PASSWORD\");\r\n read_only = true;\r\n if (user != null && password != null) {\r\n read_only = false;\r\n }\r\n if ( user == null || password == null ) {\r\n user = \"guest\";\r\n password = \"\";\r\n }\r\n Class.forName(\"com.mysql.jdbc.Driver\"); // required at run time only for .getConnection(): mysql-connector-java-5.1.35.jar\r\n connect = DriverManager.getConnection(\"jdbc:mysql://\"+host+\"/qa_portal?user=\"+user+\"&password=\"+password);\r\n } catch ( Exception e ) {\r\n System.err.println( \"ERROR: DescribedTemplateCore.openDatabase() could not open database connection, \" + e.getMessage() );\r\n }\r\n }", "public SQLiteDatabase openDatabaseSafe() {\n SQLiteDatabase db = null;\n try {\n db = SQLiteDatabase.openDatabase(DB_PATH, null, SQLiteDatabase.OPEN_READONLY);\n } catch(SQLiteException e){\n Log.i(TAG, \"Error: could not open database.\", e);\n }\n return db;\n }", "private void open() throws SQLiteException {\n\n database = dbHelper.getWritableDatabase();\n }", "public SQLiteDatabase openDatabase() {\n synchronized (mLock) {\n Log.d(\"Opening database.\");\n File path = mContext.getDatabasePath(DatabaseOpenHelper.NAME);\n //Check if database exists and if not copy from assests folder\n if (!path.exists()) {\n try {\n mOpenHelper = new DatabaseOpenHelper(mContext);\n mOpenHelper.getWritableDatabase();\n\n copyDataBase();\n }\n catch (IOException e) {\n Log.e(\"Could not copy dictionary.\", e);\n }\n }\n if (mOpenHelper == null) {\n mOpenHelper = new DatabaseOpenHelper(mContext);\n }\n return mOpenHelper.getWritableDatabase();\n }\n }", "private void open() {\n\t\tFile dbf = new File( dbName );\n\n\t\tif ( dbf.exists( ) == false ) {\n\t\t\tSystem.out.println(\n\t\t\t\t \"SQLite database file [\"\n\t\t\t\t+ dbName\n\t\t\t\t+ \"] does not exist\");\n\t\t\tSystem.exit( 0 );\n\t\t}\n\t\n\t\ttry {\n\t\t\tClass.forName( JDBC_DRIVER );\n\t\t\tgetConnection( );\n\t\t}\n\t\tcatch ( ClassNotFoundException cnfe ) {\n\t\t\tnotify( \"Db.Open\", cnfe );\n\t\t}\n\n\t\tif ( debug )\n\t\t\tSystem.out.println( \"Db.Open : leaving\" );\n\t}", "public DaoSession openReadableDb() {\n isInitOk();\n SQLiteDatabase db = openHelper.getReadableDatabase();\n DaoMaster daoMaster = new DaoMaster(db);\n DaoSession daoSession = daoMaster.newSession();\n return daoSession;\n }", "public int openReadableDB() {\n int statusCode = OPEN_SUCCESS;\n\n try {\n db = dbHelper.getReadableDatabase();\n }\n catch (SQLiteException dbReadableException) {\n statusCode = OPEN_FAIL;\n // Log the exception\n }\n\n return statusCode;\n }", "@Override\n\tprotected SQLiteDatabase openReadableDb() {\n\t\treturn super.openReadableDb();\n\t}", "public synchronized SQLiteDatabase open() {\n\n mOpenCounter++;\n\n if(mOpenCounter == 1) {\n // Opening new database\n mDatabase = mDatabaseHelper.getWritableDatabase();\n }\n return mDatabase;\n }", "protected void open() throws TzException {\n synchronized (dbLock) {\n if (!isOpen()) {\n getDb();\n open = true;\n return;\n }\n }\n }", "private SQLiteDatabase openConnection() {\n\n sqlLiteHelper = new SQLLiteHelper(DatabaeServiceContext);\n return sqlLiteHelper.getWritableDatabase();\n\n }", "public void open() {\n if (mDB == null || !mDB.isOpen()) {\n Log.d(this.getClass().getName(), \"open new DB connection\");\n mDB = mDBHelper.getWritableDatabase();\n }\n }", "public static void openDatabase() {\n\t\ttry {\n\t\t\tClass.forName(\"org.postgresql.Driver\");\n\n\t\t\t/* change the name and password here */\n\t\t\tc = DriverManager.getConnection(\n\t\t\t\t\t\"jdbc:postgresql://localhost:5432/testdata\", \"postgres\",\n\t\t\t\t\t\" \");\n\n\t\t\tlogger.info(\"Opened database successfully\");\n\t\t\tc.setAutoCommit(false);\n\t\t\tstatus = OPEN_SUCCESS;\n\n\t\t} catch (Exception e) {\n\t\t\tstatus = OPEN_FAILED;\n\t\t\tlogger.warn(e.getClass().getName() + \": \" + e.getMessage());\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "public int maDBOpen(String path)\n \t{\n \t\ttry\n \t\t{\n \t\t\tMoDatabase database = MoDatabase.create(path);\n \t\t\t++mDatabaseCounter;\n \t\t\taddDatabase(mDatabaseCounter, database);\n \t\t\treturn mDatabaseCounter;\n \t\t}\n \t\tcatch (SQLiteException ex)\n \t\t{\n \t\t\tlogStackTrace(ex);\n \t\t\treturn MA_DB_ERROR;\n \t\t}\n \t}", "@Override\n public synchronized SQLiteDatabase getWritableDatabase() {\n \treturn super.getWritableDatabase();\n }", "public DataBase open(){\n myDB = new MyHelper(ourContext);\n myDataBase = myDB.getWritableDatabase();\n return this;\n }", "public void close(){\n\t\tif(dbReadable != null && dbReadable.isOpen()){\n\t\t\tdbReadable.close();\n\t\t\tdbReadable = null;\n\t\t}\n\t\t\n\t\tif(dbWritable != null && dbWritable.isOpen()){\n\t\t\tdbWritable.close();\n\t\t\tdbWritable = null;\n\t\t}\n\t}", "private SQLiteDatabase openDatabase(String name){\n\n SQLiteDatabase result = null;\n\n try{\n result = SQLiteDatabase.openDatabase(name, null, 0);\n this.isActive = true;\n }\n catch(Exception e){\n // result = this.createDatabase(name);\n }\n\n return result;\n\n }", "private void openDB()\r\n \t{\n \t\tif ( lootDB != null )\r\n \t\t\treturn;\r\n \t\t\r\n \t\ttry\r\n \t\t{\r\n \t\t\tlootDB = SQLiteDatabase.openDatabase( DB_PATH, null, SQLiteDatabase.OPEN_READWRITE );\r\n \t\t\tif ( lootDB.needUpgrade( DB_VERSION ) )\r\n \t\t\t\tif ( !this.upgradeDB( DB_VERSION ) )\r\n \t\t\t\t\tlootDB = null;\r\n \t\t}\r\n \t\t// catch SQLiteException if the database doesn't exist, then create it\r\n \t\tcatch (SQLiteException sqle)\r\n \t\t{\r\n \t\t\ttry\r\n \t\t\t{\r\n \t\t\t\tlootDB = SQLiteDatabase.openOrCreateDatabase( DB_PATH, null);\r\n \t\t\t\tif ( !createDB(lootDB) )\r\n \t\t\t\t\tlootDB = null;\r\n \t\t\t}\r\n \t\t\t// something went wrong creating the database\r\n \t\t\tcatch ( SQLiteException e )\r\n \t\t\t{\r\n \t\t\t\tlootDB = null;\r\n \t\t\t}\r\n \t\t}\r\n \t\t\r\n \t\t// throw an exception if we've made it through the try/catch block\r\n \t\t// and the database is still not opened\r\n \t\tif ( lootDB == null )\r\n \t\t{\r\n \t\t\tthrow new SQLException( \"Database could not be opened\" );\r\n \t\t}\r\n \t}", "public TrucksDB open() throws SQLException {\n mDbHelper = new DatabaseHelper(mCtx);\n mDb = mDbHelper.getWritableDatabase();\n return this;\n }", "public CommonStorage open() {\r\n ++accessNb;\r\n getDatabase(); // To trigger the possible database setup if it has not been yet done\r\n return this;\r\n }", "private void openDB() {\n\t\tmyDb = new DBAdapter(this);\n\t\t// open the DB\n\t\tmyDb.open();\n\t\t\n\t\t//populate the list from the database\n\t\tpopulateListViewFromDB();\n\t}", "public void openDataBase() throws SQLException {\n try {\n this.createDataBase();\n }\n catch (IOException var1_1) {\n throw new Error(\"Ha sido imposible crear la Base de Datos\");\n }\n this.myDataBase = SQLiteDatabase.openDatabase((String)(DB_PATH + DB_NAME), (SQLiteDatabase.CursorFactory)null, (int)0);\n }", "public DbAdapter open() throws SQLException{\n\t\tdbHelper = new DbHelper(context);\n\t\tdb = dbHelper.getWritableDatabase();\n\t\treturn this;\n\t}", "public static void open()\n\t{\n\t\ttry\n\t\t{\n\t\t\tClass.forName(PATH_DRIVER_JDBC).newInstance();\n\t\t\tCONNECTION \t= DriverManager.getConnection(PATH_DB,USER,PASSWORT);\n\t\t\tSTATEMENT \t= CONNECTION.createStatement();\n\t\t\tlink = true;\n\t\t\n\t\t} catch (Exception e) \n\t\t{\t\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public MoviesDBHelper open() throws SQLException {\n\t\tLog.d(\"INIT\", \"MoviesDBHelper.........\");\n\t\tmDbHelper = new DatabaseHelper(mContext);\n\t\tmDb = mDbHelper.getWritableDatabase();\n\t\treturn this;\n\t}", "public void obrir() throws SQLException {\n\t\tbdClimb = dbHelper.getWritableDatabase();\n\t}", "public DBAdapter open() throws SQLException\n {\n db = DBHelper.getWritableDatabase();\n return this;\n }", "public Connection openConnection() throws DataAccessException {\n try {\n //The Structure for this Connection is driver:language:path\n //The path assumes you start in the root of your project unless given a non-relative path\n final String CONNECTION_URL = \"jdbc:sqlite:myfamilymap.sqlite\";\n\n // Open a database connection to the file given in the path\n conn = DriverManager.getConnection(CONNECTION_URL);\n\n // Start a transaction\n conn.setAutoCommit(false);\n } catch (SQLException e) {\n e.printStackTrace();\n throw new DataAccessException(\"Unable to open connection to database\");\n }\n\n return conn;\n }", "private void openConnection() throws IOException {\n String path = \"D:/MSSQL-DB.txt\";\n file = new File(path);\n bufferedWriter = new BufferedWriter(new FileWriter(file, true));\n }", "public LdDaoWritable getDaoWritable() {\r\n return getMyDao();\r\n }", "private void openDatabase() {\r\n SearchHelper = new DBHelper(this);\r\n }", "private void setRead() {\n db = handler.getReadableDatabase();\n }", "public DBAdapter open() {\n db = myDBHelper.getWritableDatabase();\n return this;\n }", "public void openDB() {\n\n\t\t// Connect to the database\n\t\tString url = \"jdbc:mysql://localhost:2000/X__367_2020?user=X__367&password=X__367\";\n\t\t\n\t\ttry {\n\t\t\tconn = DriverManager.getConnection(url);\n\t\t} catch (SQLException e) {\n\t\t\tSystem.out.println(\"using url:\"+url);\n\t\t\tSystem.out.println(\"problem connecting to MariaDB: \"+ e.getMessage());\t\t\t\n\t\t\t//e.printStackTrace();\n\t\t}\n\n\t}", "boolean isWriteAccess();", "public NdbAdapter open() throws SQLException {\n dbHelper = new DbHelper(context);\n mDb = dbHelper.getWritableDatabase();\n return this;\n }", "private void createDatabase() {\n String parentPath = mContext.getDatabasePath(DBNAME).getParent();\n String path = mContext.getDatabasePath(DBNAME).getPath();\n\n File file = new File(parentPath);\n if (!file.exists()) {\n if (!file.mkdir()) {\n Log.w(TAG, \"Unable to create database directory\");\n return;\n }\n }\n\n InputStream is = null;\n OutputStream os = null;\n try {\n is = mContext.getAssets().open(DBNAME);\n os = new FileOutputStream(path);\n\n byte[] buffer = new byte[1024];\n int length;\n while ((length = is.read(buffer)) > 0) {\n os.write(buffer, 0, length);\n }\n os.flush();\n SharedPreferences prefs = PreferenceManager\n .getDefaultSharedPreferences(mContext);\n SharedPreferences.Editor editor = prefs.edit();\n editor.putInt(SP_KEY_DB_VER, DATABASE_VERSION);\n editor.commit();\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (is != null) {\n try {\n is.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n if (os != null) {\n try {\n os.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n }", "public LoginDataBaseAdapter open() throws SQLException {\n db = dbHelper.getWritableDatabase();\n return this;\n }", "public void OpenDB() {\n\t\tString JDriver = \"com.microsoft.sqlserver.jdbc.SQLServerDriver\";// 数据库驱动\n\t\tSystem.out.println(\"数据库驱动成功\");\n\t\tString connectDB = \"jdbc:sqlserver://localhost:1433;DatabaseName=bookstoreDB\";// 数据库连接\n\t\ttry {\n\t\t\tClass.forName(JDriver);// 加载数据库引擎,返回给定字符串名的类\n\t\t} catch (ClassNotFoundException e) {// e.printStackTrace();\n\t\t\tSystem.out.println(\"加载数据库引擎失败\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\ttry {\n\t\t\tconDB = DriverManager.getConnection(connectDB, \"sa\", \"123456\");// 连接数据库对象\n\t\t\tSystem.out.println(\"连接数据库成功\");\n\t\t\tstaDB = conDB.createStatement();\n\t\t} // 创建SQL命令对象\n\t\tcatch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.out.println(\"数据库连接错误\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "public SQLiteDatabase open(String databaseName) {\n return context.openOrCreateDatabase(databaseName);\n }", "@Override\n public SQLiteDatabase openOrCreateDatabase(String name,\n int mode,\n SQLiteDatabase.CursorFactory factory) {\n final File path = getDatabasePath(name);\n Logger.pii(LOG_TAG, \"Opening database through absolute path \" + path.getAbsolutePath());\n return SQLiteDatabase.openOrCreateDatabase(path, null);\n }", "public PlayerDBAdapter open() throws SQLException {\r\n\t\tthis.mDbHelper = new DatabaseHelper(this.mCtx);\r\n\t\tthis.mDb = this.mDbHelper.getWritableDatabase();\r\n\t\treturn this;\r\n\t}", "public void testOSReadOnly() throws Exception {\n // start with some simple checks\n setAutoCommit(false);\n Statement stmt = createStatement();\n JDBC.assertFullResultSet(stmt.executeQuery(\n \"select count(*) from foo\"), new String[][] {{\"512\"}});\n stmt.executeUpdate(\"delete from foo where a = 1\");\n JDBC.assertFullResultSet(stmt.executeQuery(\n \"select count(*) from foo\"), new String[][] {{\"384\"}});\n rollback();\n JDBC.assertFullResultSet(stmt.executeQuery(\n \"select count(*) from foo\"), new String[][] {{\"512\"}});\n stmt.executeUpdate(\"insert into foo select * from foo where a = 1\");\n JDBC.assertFullResultSet(stmt.executeQuery(\n \"select count(*) from foo\"), new String[][] {{\"640\"}});\n commit();\n stmt.executeUpdate(\"delete from foo where a = 1\");\n JDBC.assertFullResultSet(stmt.executeQuery(\n \"select count(*) from foo\"), new String[][] {{\"384\"}});\n rollback();\n JDBC.assertFullResultSet(stmt.executeQuery(\n \"select count(*) from foo\"), new String[][] {{\"640\"}});\n setAutoCommit(false);\n \n TestConfiguration.getCurrent().shutdownDatabase();\n \n // so far, we were just playing. Now for the test.\n String phDbName = getPhysicalDbName();\n // copy the database to one called 'readOnly'\n copyDatabaseOnOS(phDbName, \"readOnly\");\n // change filePermissions on readOnly, to readonly.\n changeFilePermissions(\"readOnly\");\n \n DataSource ds = JDBCDataSource.getDataSource();\n JDBCDataSource.setBeanProperty(ds, \n \"databaseName\", \"singleUse/readOnly\");\n assertReadDB(ds);\n assertExpectedInsertBehaviour(ds, false, 10, \"will fail\");\n shutdownDB(ds);\n \n // copy the database to one called 'readWrite' \n // this will have the default read/write permissions upon\n // copying\n copyDatabaseOnOS(\"readOnly\", \"readWrite\");\n ds = JDBCDataSource.getDataSource();\n JDBCDataSource.setBeanProperty(ds, \"databaseName\", \"singleUse/readWrite\");\n assertReadDB(ds);\n assertExpectedInsertBehaviour(ds, true, 20, \"will go in\");\n shutdownDB(ds);\n \n // do it again...\n copyDatabaseOnOS(\"readWrite\", \"readOnly2\");\n // change filePermissions on readOnly, to readonly.\n changeFilePermissions(\"readOnly2\");\n \n ds = JDBCDataSource.getDataSource();\n JDBCDataSource.setBeanProperty(ds, \n \"databaseName\", \"singleUse/readOnly2\");\n assertReadDB(ds);\n assertExpectedInsertBehaviour(ds, false, 30, \"will also fail\");\n shutdownDB(ds);\n \n // testharness will try to remove the original db; put it back\n copyDatabaseOnOS(\"readOnly2\", phDbName);\n }", "private Database openTestDb(ReplicatedEnvironment master)\n throws DatabaseException {\n\n Environment env = master;\n DatabaseConfig config = new DatabaseConfig();\n config.setAllowCreate(true);\n config.setTransactional(true);\n config.setSortedDuplicates(true);\n Database testDb = env.openDatabase(null, TEST_DB, config);\n return testDb;\n }", "private void openStore()\n throws Exception {\n\n dbStore = Utils.openStore(master, Utils.DB_NAME);\n primaryIndex = \n dbStore.getPrimaryIndex(Integer.class, RepTestData.class);\n }", "@Override\n\tpublic void onOpen(SQLiteDatabase db) {\n\t\tsuper.onOpen(db);\n\t\tif (!db.isReadOnly()) {\n\t\t\t// Enable foreign key constraints\n\t\t\tdb.execSQL(\"PRAGMA foreign_keys=ON;\");\n\t\t}\n\t}", "public RevisionDbAdapter open() throws SQLException {\n\t\tif (mDbHelper == null) {\n\t\t\tmDbHelper = new DatabaseHelper(mCtx);\n\t\t}\n\t\tmDb = mDbHelper.getWritableDatabase();\n\t\treturn this;\n\t}", "public DBInterface obre() throws SQLException {\n bd = helper.getWritableDatabase();\n return this;\n\n }", "public void createDatabase() throws IOException{\r\n\r\n boolean dbDoesExist = checkDatabase();\r\n if(!dbDoesExist)\r\n {\r\n // Create or open db if db is not connected\r\n this.getReadableDatabase();\r\n try{\r\n createNewDB();\r\n }catch (IOException e){\r\n throw new Error(\"DB Copy Failed\");\r\n }\r\n }\r\n }", "public void database() throws IOException\n {\n \tFile file =new File(\"data.txt\");\n\t if(!file.exists())\n\t {\n\t \tSystem.out.println(\"File 'data.txt' does not exit\");\n\t System.out.println(file.createNewFile());\n\t file.createNewFile();\n\t databaseFileWrite(file);//call the databaseFileRead() method, to initialize data from ArrayList and write data into data.txt\n\t }\n\t else\n\t {\n\t \tdatabaseFileRead();//call the databaseFileRead() method, to load data directly from data.txt\n\t }\n }", "public final SQLiteDatabase mo40210c_() {\n zzd();\n try {\n return this.zzj.getWritableDatabase();\n } catch (SQLiteException e) {\n zzr().zzi().zza(\"Error opening database\", e);\n throw e;\n }\n }", "public boolean isWriteable();", "public Connection openConnection(){\n try {\n c = DriverManager.getConnection(\"jdbc:sqlite:LIB.db\");\n s = c.createStatement();\n\n System.out.println(\"Database connection open\");\n return c;\n }catch (SQLException e) {\n System.err.println(\"Opening connection failed: \" + e.getMessage());\n }\n return null;\n }", "@Override\r\n public synchronized void close() {\r\n super.close();\r\n if (myWritableDb != null) {\r\n myWritableDb.close();\r\n myWritableDb = null;\r\n }\r\n }", "public static void createDatabase() throws ArcException {\n\t\tcreateDatabase(userWithRestrictedRights);\t\t\n\t}", "public SQLiteDatabase getSqliteObjectWithReadable(){\n return getReadableDatabase();\n }", "private void configureDB() {\n\t\tmDb = mDbHelper.getWritableDatabase();\n\t}", "private static void openDBIfClosed(Context context) {\n if (mMetaDb == null || !mMetaDb.isOpen()) {\n openDB(context);\n }\n }", "protected void openConnection() {\n\t\ttry {\n\t\t\tconn = DriverManager.getConnection(\"jdbc:sqlite:\" + name);\n\t\t\tif (conn == null) {\n\t\t\t\tconnectionOpened = false;\n\t\t\t} else {\n\t\t\t\tconnectionOpened = true;\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\tSystem.out.println(\"Connect problem: \" + e.getMessage());\n\t\t\tconn = null;\n\t\t}\n\t}", "public WriteMode getWriteMode()\n {\n return writeMode;\n }", "private SQLiteDatabase getConnection(Boolean readOnly, String secret) throws Exception {\n SQLiteDatabase db = null;\n if (readOnly) {\n db = getReadableDatabase(secret);\n } else {\n db = getWritableDatabase(secret);\n }\n try {\n String cmd = \"PRAGMA foreign_keys = ON;\";\n db.execSQL(cmd);\n return db;\n } catch (Exception e) {\n Log.d(TAG, \"Error: getConnection PRAGMA FOREIGN KEY failed: \", e);\n throw new Exception(\"getConnection PRAGMA FOREIGN KEY failed\");\n }\n }", "public boolean isWritable() {\n return accessControl != null && accessControl.getOpenStatus().isOpen() && !sandboxed;\n }" ]
[ "0.7671973", "0.6971642", "0.6964957", "0.69261", "0.6912246", "0.6862251", "0.683994", "0.68348426", "0.6801179", "0.67870384", "0.6763074", "0.6719026", "0.6717559", "0.6667575", "0.6657045", "0.6657045", "0.6657045", "0.6574777", "0.6542141", "0.6536686", "0.65284395", "0.65058696", "0.65058696", "0.65058696", "0.65058696", "0.65058696", "0.645623", "0.6399202", "0.638061", "0.6351938", "0.63479763", "0.6325776", "0.63190615", "0.6303158", "0.62758195", "0.6265683", "0.625631", "0.62259144", "0.6187801", "0.6118936", "0.6074373", "0.6051717", "0.6050608", "0.60459626", "0.60406876", "0.6035317", "0.60275036", "0.60129297", "0.6012463", "0.59310067", "0.58834064", "0.58088857", "0.5800186", "0.57907134", "0.5768386", "0.5755753", "0.57508796", "0.57390213", "0.57381004", "0.5697377", "0.5694909", "0.5683926", "0.5677252", "0.566168", "0.56418926", "0.5635475", "0.5627138", "0.561445", "0.5612491", "0.5609954", "0.5605326", "0.5604079", "0.5589679", "0.556279", "0.55450004", "0.55432516", "0.5541714", "0.5540124", "0.55295426", "0.55172706", "0.54918766", "0.54654783", "0.5438777", "0.5434629", "0.5432562", "0.54281414", "0.54273087", "0.5410073", "0.5393308", "0.53906494", "0.53833497", "0.5376584", "0.5373758", "0.537154", "0.5370325", "0.53421336", "0.5334916", "0.5312622", "0.5302362", "0.5298896" ]
0.6410905
27
only close the database if it wasn't already open. allows the user to manually control open and close of database for perf. reasons.
public void add(@NonNull Context context, @NonNull Note newNote) { boolean closeDatabase = false; if (databaseClosed) { //the database will be opened by this call, set this to true to // ensure it is closed upon exit. closeDatabase = true; openDatabase(context); } addNewNoteQuery(newNote); if (closeDatabase) { noteDatabase.close(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public synchronized void close() {\n\n mOpenCounter--;\n\n if(mOpenCounter == 0) {\n // Closing database\n mDatabase.close();\n }\n }", "public static void closeDatabase() {\n\t\ttry {\n\t\t\tif (status == OPEN_SUCCESS) {\n\t\t\t\tif (stmt != null)\n\t\t\t\t\tstmt.close();\n\t\t\t\tif (c != null)\n\t\t\t\t\tc.close();\n\t\t\t\tlogger.info(\"Closed database successfully\");\n\t\t\t} else {\n\t\t\t\tlogger.warn(\"Can not close: previous operation failed.\");\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tstatus = OPEN_FAILED;\n\t\t\tlogger.warn(e.getClass().getName() + \": \" + e.getMessage());\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "@Override\n public void close() {\n closeDB();\n }", "public void close() {\r\n closeDatabase();\r\n }", "public void close() {\n if (db.isOpen()) {\n db.close();\n }\n }", "public static void closeDatabase() {\n if (instance != null) {\n instance.kill();\n instance = null;\n }\n }", "public void close() {\n \t\tdb.close();\n \t}", "@Override\n\tpublic void closeDB()\n\t{\n\n\t}", "@Override\n\tpublic void closeDB() {\n\t\tcommonDao.closeDB();\n\t}", "public void close(){\n\t\tif(dbReadable != null && dbReadable.isOpen()){\n\t\t\tdbReadable.close();\n\t\t\tdbReadable = null;\n\t\t}\n\t\t\n\t\tif(dbWritable != null && dbWritable.isOpen()){\n\t\t\tdbWritable.close();\n\t\t\tdbWritable = null;\n\t\t}\n\t}", "public void close(){\n this.db.close();\n }", "public void close() {\n\t\t\tdb.close();\n\t\t}", "public void closeDB() {\n\t\tSQLiteDatabase db = this.getReadableDatabase();\n\t\tif (db != null && db.isOpen())\n\t\t\tdb.close();\n\t}", "private void closeDatabase() {\r\n try {\r\n if ( connect != null ) {\r\n connect.close();\r\n }\r\n } catch ( Exception e ) {\r\n System.err.println( \"ERROR: Could not close database connection, \" + e.getMessage() );\r\n } finally {\r\n connect = null;\r\n }\r\n }", "public void close() {\n db.close();\n }", "public void close() {\n db.close();\n }", "private void closeConnection() { // TEMPORARILY PUBLIC\n if (db != null) {\n db.close();\n }\n }", "public void close(){\n\t\tif(tr != null && tr.inTransaction()){\n\t\t\ttr.rollback();\n\t\t}\n\t\ttry{\n\t\t\tif(db != null)\n\t\t\t\tdb.close();\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void closeDatabase() {\n hoardDBOpenHelper.close();\n }", "@Override\r\n\tpublic synchronized void close() {\r\n\t\t// Log.i(\"DBHelper:\", \" close()\");\r\n\t\tif (isOpened())\r\n\t\t\tdb.close();\r\n\r\n\t}", "private static void openDBIfClosed(Context context) {\n if (mMetaDb == null || !mMetaDb.isOpen()) {\n openDB(context);\n }\n }", "public void closeDB() {\n\t\ttry {\n\t\t\tconn.close();\n\t\t\tconn = null;\n\t\t} catch (SQLException e) {\n\t\t\tSystem.err.println(\"Failed to close database connection: \" + e);\n\t\t}\n\t}", "public void schliessen() {\n mDb.close();\n }", "public void closeDB() {\n\t\tboolean gotSQLExc = false;\n\t\ttry {\n\t\t\tconn.close();\n //DriverManager.getConnection(\"jdbc:derby:;shutdown=true\"); \n \n\t\t} catch (SQLException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tif (e.getSQLState().equals(\"XJ015\") ) {\t\t\n\t gotSQLExc = true;\n\t } else e.printStackTrace();\n\t\t}\n\t\t\n\t}", "public final void close() {\n\t\ttry {\n\t\t\tcon.commit( ); // Commit any updates\n\t\t\tcon.close ( );\n\t\t}\n\t\tcatch ( Exception e ) {\n\t\t\tnotify( \"Db.close\", e );\n\t\t};\n\t}", "public void CloseDB() {\n \n }", "public void schliessen() {\n try {\n mDb.close();\n } catch (SQLException ex) {\n System.out.println(ex);\n }\n }", "private void closeDB() {\n locationDBAdapter.close();\n }", "@Override\r\n public synchronized void close() {\r\n super.close();\r\n if (myWritableDb != null) {\r\n myWritableDb.close();\r\n myWritableDb = null;\r\n }\r\n }", "public void close() {\n if (database != null) {\n this.database.close();\n }\n }", "public void close() {\n if (database != null) {\n this.database.close();\n }\n }", "public void close() {\n if (database != null) {\n this.database.close();\n }\n }", "public void close() {\n if (database != null) {\n this.database.close();\n }\n }", "public void close() {\n\t\tthis.closed = true;\n\t\ttry {\n\t\t\tbdb.close();\n\t\t\tbdb = null;\n\t\t} catch (Exception e) {\n\n\t\t}\n\t}", "public void close(){\n myDB.close();\n myDataBase.close();\n }", "private void closeDatabase() {\r\n SearchHelper.close();\r\n }", "public void closeDatabase(){\n mDbHelper.close();\n }", "private void closeDB() {\n/* 29 */ Connection conn = null;\n/* 30 */ PreparedStatement pstmt = null;\n/* 31 */ ResultSet rs = null;\n/* */ \n/* */ try {\n/* 34 */ if (rs != null) rs.close(); \n/* 35 */ if (pstmt != null) pstmt.close(); \n/* 36 */ if (conn != null) conn.close(); \n/* 37 */ System.out.println(\"DB 접속 해제\");\n/* 38 */ } catch (Exception e) {\n/* 39 */ e.printStackTrace();\n/* */ } \n/* */ }", "public void closeAndDeleteDB() {\n\t\tboolean gotSQLExc = false;\n\t\ttry {\n\t\t\tthis.deleteAllTable();\n\t\t\tconn.close();\n //DriverManager.getConnection(\"jdbc:derby:;shutdown=true\"); \n \n\t\t} catch (SQLException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tif (e.getSQLState().equals(\"XJ015\") ) {\t\t\n\t gotSQLExc = true;\n\t } else e.printStackTrace();\n\t\t}\n//\t\t\n//\t\tif (!gotSQLExc) {\n//\t \t System.out.println(\"Database did not shut down normally\");\n//\t } else {\n//\t System.out.println(\"Database shut down normally\");\t\n//\t }\n\t\t\n\t}", "private void close() {\n\t\t\tDB.close(m_rs, m_pstmt);\n\t\t\tm_rs = null;\n\t\t\tm_pstmt = null;\n\t\t}", "public void close()\n {\n if (_forbidClose)\n throw new IllegalStateException(\"illegal to call close() for this DBPool\");\n forceClose();\n }", "public void closeDB(Cursor cursor) throws SQLException {\n if (cursor != null) {\n cursor.close();\n }\n DB_OPEN_MODE = \"C\";\n }", "public void close() {\n\t\t_dbHelper.close();\n\t}", "private void closeDirtyConnection() {\n\t\ttry {\n\t\t\tif (dirtyConnection != null) {\n\t\t\t\tdirtyConnection.close();\n\t\t\t}\n\t\t} catch (DatabaseException e) {\n\t\t} finally {\n\t\t\tdirtyConnection = null;\n\t\t}\n\t}", "private void openDatabase() {\n database = new DatabaseExpenses(this);\n database.open();\n }", "public void close() {\n\t\tdbHelper.close();\n\t}", "public void closeDBConnection() {\r\n\t\ttry {//如果连接有效(存在),关闭他\r\n\t\t\tif (dbConnection != null /*&& !dbConnection.isClosed()*/){\r\n\t\t\t\tdbConnection.close();// Return to connection pool\r\n\t\t\t\tdbConnection = null; //Make sure we don't close it twice\r\n\t\t\t}\r\n\t\t} catch (SQLException e) {\r\n\t\t\tErrorLog.log(\"Database->closeDBConnection:\" + e.getMessage()+\"//\"+ e);\r\n\t\t}\r\n\t}", "public void close() {\r\n --accessNb;\r\n if (accessNb == 0) {\r\n databaseHelper.close();\r\n }\r\n }", "@Override\r\n @SuppressWarnings(\"empty-statement\")\r\n public void close()\r\n {\r\n curDb_ = null;\r\n curConnection_ = null;\r\n try\r\n {\r\n for(Map.Entry<Db_db, Connection> entry: connections_.entrySet())\r\n {\r\n entry.getValue().close();\r\n }\r\n }catch(Exception e){};\r\n \r\n connections_.clear();\r\n }", "public void close() {\r\n\t\tthis.mDbHelper.close();\r\n\t}", "public void close()\r\n {\r\n DBHelper.close();\r\n }", "public void closeDB() throws SQLException\r\n {\r\n conn.close();\r\n }", "public void close()\n\n {\n DBHelper.close();\n }", "public static void close_DB() {\n try {\n for (int i=0; i<conns; i++) {\n if (con_pool[i]!=null)\n con_pool[i].close();\n }\n } catch (SQLException ex) {\n Logger.getLogger(DB_Backend.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public void open() throws SQLException {\r\n this.database = dbhelper.getWritableDatabase();\r\n }", "public void close()\n {\n DBHelper.close();\n }", "public void close()\n {\n DBHelper.close();\n }", "public void close() {\n\t mDbHelper.close();\n\t }", "public void openDatabase(@NonNull Context context){\n if (databaseClosed)\n {\n NoteDatabaseHelper dbHelper = new NoteDatabaseHelper(context, Util.DATABASE_NAME, null, Util.DATABASE_VERSION);\n noteDatabase = dbHelper.getWritableDatabase();\n databaseClosed = false;\n } else if (noteDatabase.isReadOnly())\n {\n //the database is open, but in the wrong mode (i.e. readonly, and not writeable),\n // so it needs to be closed, and reopened in writable mode.\n closeDatabase();\n openDatabase(context);\n }\n }", "@Override\r\n\tprotected void onDestroy() {\n\t\tsuper.onDestroy();\r\n\t\tdb.close();\t\r\n\t}", "@After\n @Override\n public void closeDB() {\n super.closeDB();\n }", "private static void disconnectDatabase(){\n\t\ttry{\n\t\t\tif (connection != null) connection.close();\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void open() throws SQLException {\n\t\t \n\t\t mDatabase = mDbHelper.getWritableDatabase();\n\t\t mDatabase = mDbHelper.getWritableDatabase();\n\n\t\t //refreshCompanies();\n\t }", "public void close() throws SQLException;", "public void open() throws SQLException {\n\t\tdatabase = dbHelper.getWritableDatabase();\n\t}", "private void closePersistence (){\n\t\tif (this.pm==null){\n\t\t\treturn;\n\t\t}\n\t\tif (this.pm.currentTransaction().isActive ()){\n\t\t\tthis.pm.currentTransaction().commit();\n\t\t}\n\t\tif (!this.pm.isClosed ()){\n\t\t\tthis.pm.close ();\n\t\t}\n\t}", "@Override\n\t\tprotected void onDestroy() {\n\t\t\tsuper.onDestroy();\n\t\t\tif(dbHelper!=null&&dbHelper.getReadableDatabase().isOpen())\n\t\t\t{\n\t\t\t\tdbHelper.getReadableDatabase().close();\n\t\t\t\tdbHelper.close();\n\t\t\t}\n\t\t}", "@Test public void closeAndOpen() {\n ok(new CreateDB(NAME, FILE), session2);\n pins(1, NAME);\n ok(new Close(), session1);\n pins(1, NAME);\n ok(new Close(), session2);\n pins(0, NAME);\n ok(new Open(NAME), session1);\n pins(1, NAME);\n ok(new Open(NAME), session2);\n pins(2, NAME);\n ok(new Close(), session1);\n pins(1, NAME);\n ok(new Close(), session2);\n pins(0, NAME);\n ok(new DropDB(NAME), session1);\n }", "public void close() {\n mDbHelper.close();\n }", "public void open() throws SQLException {\n\t\t// creates or opens a database\n\t\tdatabase = dbHelper.getWritableDatabase();\n//\t\tdbHelper.onUpgrade(database, 1, 1); // Use this statement to reset database\n\t}", "@Override\n public void close() {\n dbOptions.close();\n columnFamilyOptions.close();\n }", "void close() throws SQLException;", "@Override\n public void closeDBConnection() throws SQLException {\n if (sessionFactory.getCurrentSession() != null && sessionFactory.getCurrentSession().isOpen()) {\n sessionFactory.getCurrentSession().close();\n }\n }", "public void open() throws SQLException {\n database = helper.getWritableDatabase();\n }", "public void close() {\n dbHelper.close();\n }", "public void close() {\n dbHelper.close();\n }", "public void close() {\n dbHelper.close();\n }", "public void close() {\n myDBHelper.close();\n }", "public void close() {\n myDBHelper.close();\n }", "public void close() {\n if (connection == null) {\n LOGGER.error(\"DB : Uninitialized DB Connection.\");\n return;\n }\n\n try {\n if (connection.isClosed()) {\n LOGGER.warn(\"Connection is already closed.\");\n return;\n }\n connection.close();\n } catch (SQLException e) {\n LOGGER.error(\"Error closing the connection.\", e);\n }\n\n }", "public static Transaction close(String database) {\n HashMap<String, Transaction> transactions = instance.getTransactions();\n Transaction transaction = transactions.get(database);\n if (transaction != null) {\n transaction.close();\n } else {\n ensureConfigured(database);\n }\n return transaction;\n }", "public void close() throws SQLException {\n stmt.close();\n con.close();\n isOpen = false;\n }", "@Override\n\tpublic boolean close() throws SQLException {\n\t\treturn false;\n\t}", "private void open() {\n\t\tFile dbf = new File( dbName );\n\n\t\tif ( dbf.exists( ) == false ) {\n\t\t\tSystem.out.println(\n\t\t\t\t \"SQLite database file [\"\n\t\t\t\t+ dbName\n\t\t\t\t+ \"] does not exist\");\n\t\t\tSystem.exit( 0 );\n\t\t}\n\t\n\t\ttry {\n\t\t\tClass.forName( JDBC_DRIVER );\n\t\t\tgetConnection( );\n\t\t}\n\t\tcatch ( ClassNotFoundException cnfe ) {\n\t\t\tnotify( \"Db.Open\", cnfe );\n\t\t}\n\n\t\tif ( debug )\n\t\t\tSystem.out.println( \"Db.Open : leaving\" );\n\t}", "public DBinterface open() throws SQLException {\r\n db = helper.getWritableDatabase();\r\n return this;\r\n }", "public abstract void close() throws SQLException;", "public abstract ODatabaseInternal<?> openDatabase();", "public void close() {\n mDBHelper.close();\n }", "public void open() throws SQLException {\n database = helperAngkot.getWritableDatabase();\n }", "public void close() {\n\n\t\tdebug();\n\n\t\tif (isDebug == true) {\n\t\t\tlog.debug(\"=== CLOSE === \");\n\t\t}\n\n\t\ttry {\n\n\t\t\tif (connection != null) {\n\n\t\t\t\tlog.debug(\"Antes Connection Close\");\n\t\t\t\tconnection.close();\n\t\t\t\tlog.debug(\"Pos Connection Close\");\n\t\t\t}\n\n\t\t\tif (m_dbConn != null) {\n\t\t\t\tm_dbConn.close();\n\t\t\t}\n\n\t\t\tif (isDebug == true) {\n\t\t\t\tlog.debug(\"Connection Close\");\n\n\t\t\t}\n\n\t\t} catch (SQLException e) {\n\t\t\tlog.debug(\"ERRO Connection Close\");\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tconnection = null;\n\t\tm_dbConn = null;\n\n\t}", "public void open() {\n this.db = this.mSqlHelper.getWritableDatabase();\n }", "public void open() throws SQLException {\n database = dbHelper.getWritableDatabase();\n }", "public void open() throws SQLException {\n database = dbHelper.getWritableDatabase();\n }", "public void open() throws SQLException {\n database = dbHelper.getWritableDatabase();\n }", "private void openDB() {\n\t\tmyDb = new DBAdapter(this);\n\t\t// open the DB\n\t\tmyDb.open();\n\t\t\n\t\t//populate the list from the database\n\t\tpopulateListViewFromDB();\n\t}", "public void openRWDB() throws SQLException {\r\n\t\tString mPath = DATABASE_PATH + DATABASE_NAME;\r\n\t\tmDataBase = SQLiteDatabase.openDatabase(mPath, null,\r\n\t\t\t\tSQLiteDatabase.OPEN_READWRITE);\r\n\t}", "protected void close() {\n if (conn == null)\n return;\n // Close our prepared statements (if any) \n try {\n ps.close();\n } catch (Throwable f) {\n ExceptionUtils.handleThrowable(f);\n }\n this.ps = null;\n // Close this database connection, and log any errors \n try {\n conn.close();\n } catch (SQLException e) {\n container.getLogger().error(sm.getString(\"jdbcAccessLogValeve.close\"), e);\n } finally {\n this.conn = null;\n }\n}", "public static void closeAllDb() {\r\n\t\tlogger.info(\"Close all database connections\");\r\n\t\tcloseAllMsiDb();\r\n\t\tcloseUdsDb();\r\n\t}", "public boolean disconnectDB(){\r\n try{\r\n if( sql != null )\r\n sql.close();\r\n if( ps != null )\r\n ps.close();\r\n if( rs != null )\r\n rs.close();\r\n if( connection != null)\r\n connection.close();\r\n return true;\r\n }\r\n catch(SQLException se)\r\n {\r\n System.err.println(\"SQL Exception.\" + \"<Message>: \" + se.getMessage());\r\n return false;\r\n }\r\n catch(Exception e)\r\n {\r\n System.err.println(\"Exception.\" + \"<Message>: \" + e.getMessage());\r\n return false; \r\n }\r\n }", "public void closeConnection() {\n try {\n if (db.isOpen())\n db.close();\n } catch(SQLException e) {\n Log.e(TAG, e.getMessage());\n }\n }", "private void deleteDatabase() {\n mOpenHelper.close();\r\n Context context = getContext();\r\n NoteDatabase.deleteDatabase(context);\r\n mOpenHelper = new NoteDatabase(getContext());\r\n }" ]
[ "0.795343", "0.7947412", "0.7941975", "0.7933515", "0.7906428", "0.78522", "0.7786198", "0.77632135", "0.7678995", "0.7674817", "0.76553196", "0.7649959", "0.7640312", "0.76355827", "0.7621712", "0.7621712", "0.7588453", "0.7582098", "0.75714564", "0.75697815", "0.7500559", "0.74450535", "0.74450004", "0.743193", "0.74168235", "0.73730326", "0.73712415", "0.7344264", "0.7336599", "0.7322632", "0.7322632", "0.7322632", "0.7322632", "0.7294812", "0.72655654", "0.7230457", "0.713431", "0.71149397", "0.71027625", "0.70575184", "0.7055841", "0.70145285", "0.7006892", "0.69937545", "0.69772744", "0.6958088", "0.6938679", "0.69190484", "0.69072795", "0.6907258", "0.69002277", "0.68884987", "0.68843627", "0.6881657", "0.6871073", "0.6869709", "0.6869709", "0.68414176", "0.68328273", "0.6830132", "0.6803047", "0.6800209", "0.67706484", "0.6753553", "0.67534465", "0.6723745", "0.6722805", "0.67197", "0.67176324", "0.6711542", "0.67012304", "0.66920924", "0.66881305", "0.6686851", "0.66829604", "0.66829604", "0.66829604", "0.66808975", "0.66808975", "0.66688687", "0.66486", "0.66362333", "0.6623641", "0.6621938", "0.6620196", "0.6619745", "0.661749", "0.661361", "0.66025114", "0.6600371", "0.6600123", "0.65973836", "0.65973836", "0.65973836", "0.65933484", "0.65832293", "0.655781", "0.6553842", "0.65499735", "0.65482444", "0.65425855" ]
0.0
-1
Its take the payment type or any inputs from excel sheet & pass it to JSON objects in the name of"to modify" Kishor
public static PageElement modifyPageElement( RepositoryParser repositoryParser, String pageName, String objectName, String... modificationStrings) { PageElement element = repositoryParser.getPageObject(pageName, objectName); PageElement modifiedElement = new PageElement(element); String locatorValue = modifiedElement.getLocatorValue(); for (String modification : modificationStrings) { locatorValue = StringUtils.replaceOnce(locatorValue, "toModify", modification); } modifiedElement.setLocatorValue(locatorValue); return modifiedElement; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Object generateDeleteAlertsTypeDataJSON(XSSFWorkbook workbook, String sheetName, String scenarioID,ExcelOperation excelOperation) {\n\t\tJSONObject deleteAlertsRequestJsonObject=new JSONObject();\n\t\tList<LinkedHashMap<String, String>>jsonMap=excelOperation.getScenarioData(workbook, sheetName, scenarioID);\n\t\tfor(LinkedHashMap<String, String> json:jsonMap) {\n\t\t\tdeleteAlertsRequestJsonObject.put(\"MarketAlertType\", json.get(\"MarketAlertType\"));\n\t\t\tdeleteAlertsRequestJsonObject.put(\"MarketAlertOperationType\", json.get(\"MarketAlertOperationType\"));\n\t\t}\n\t\treturn deleteAlertsRequestJsonObject;\n\t}", "public JSONArray getGoodsReceiptsJsonMerged(HashMap<String, Object> request, List<GoodsReceipt> list, JSONArray jArr, AccountingHandlerDAO accountingHandlerDAOobj, accCurrencyDAO accCurrencyDAOobj, accGoodsReceiptDAO accGoodsReceiptobj, accAccountDAO accAccountDAOobj, accGoodsReceiptCMN accGoodsReceiptCommon, accTaxDAO accTaxObj) throws ServiceException {\n try {\n String companyid = (String) request.get(GoodsReceiptCMNConstants.COMPANYID);\n String currencyid = (String) request.get(GoodsReceiptCMNConstants.GCURRENCYID);\n// DateFormat userDateFormat = (DateFormat) request.get(Constants.userdf);\n DateFormat userDateFormat=null;\n if (request.containsKey(Constants.userdf) && request.get(Constants.userdf) != null) {\n userDateFormat = (DateFormat) request.get(Constants.userdf);\n }\n DateFormat df = (DateFormat) request.get(GoodsReceiptCMNConstants.DATEFORMAT);\n String only1099AccStr = (String) request.get(GoodsReceiptCMNConstants.ONLY1099ACC);\n DateFormat dateFormat=(DateFormat) authHandler.getDateOnlyFormat();\n List ll = null;\n /*\n * amoutinbase is used to calculate excnahnge rate for transaction \n */\n double amountInBase=0.0;\n KwlReturnObject extraprefresult = null;\n ExtraCompanyPreferences extraCompanyPreferences = null;\n if(!StringUtil.isNullOrEmpty(companyid)){\n extraprefresult = accountingHandlerDAOobj.getObject(ExtraCompanyPreferences.class.getName(), companyid);\n extraCompanyPreferences = extraprefresult != null ? (ExtraCompanyPreferences) extraprefresult.getEntityList().get(0) : null;\n }\n boolean isMalaysian = extraCompanyPreferences != null ? extraCompanyPreferences.getCompany().getCountry().getID().equalsIgnoreCase(\"137\") : false;\n KwlReturnObject curresult = accountingHandlerDAOobj.getObject(KWLCurrency.class.getName(), currencyid);\n KWLCurrency currency = (KWLCurrency) curresult.getEntityList().get(0);\n boolean isBadDebtInvoices = false;// for Malasian Company\n boolean isproductCategory=false;\n boolean isproductType = false;\n KwlReturnObject cmp = accountingHandlerDAOobj.getObject(Company.class.getName(), companyid);\n Company company = (Company) cmp.getEntityList().get(0);\n int countryid = company.getCountry() != null ? Integer.parseInt(company.getCountry().getID()) : 0;\n request.put(\"countryid\", countryid);\n if (request.containsKey(\"isBadDebtInvoices\") && request.get(\"isBadDebtInvoices\") != null) {\n isBadDebtInvoices = (Boolean) request.get(\"isBadDebtInvoices\");\n }\n if (request.containsKey(\"productCategoryid\") && request.get(\"productCategoryid\")!=null && !StringUtil.isNullOrEmpty((String) request.get(\"productCategoryid\"))) {\n isproductCategory = true;\n }\n if (request.containsKey(InvoiceConstants.productid) && request.get(InvoiceConstants.productid) != null && !StringUtil.isNullOrEmpty((String) request.get(InvoiceConstants.productid))) {\n isproductType = true;\n }\n int noOfInterval = Constants.DefaultNoOfIntervals;\n if(request.containsKey(\"noOfInterval\") && request.get(\"noOfInterval\") != null) {\n noOfInterval = request.get(\"noOfInterval\").toString().equals(\"\") ? Constants.DefaultNoOfIntervals : Integer.parseInt(request.get(\"noOfInterval\").toString());\n }\n\n double taxPercent = 0;\n boolean belongsTo1099 = false;\n boolean isAged = (request.containsKey(\"isAged\") && request.get(\"isAged\") != null) ? Boolean.parseBoolean(request.get(\"isAged\").toString()) : false;\n boolean isProduct = (request.containsKey(GoodsReceiptCMNConstants.PRODUCTID) && !StringUtil.isNullOrEmpty((String) request.get(GoodsReceiptCMNConstants.PRODUCTID))) ? true : false;\n boolean only1099Acc = (only1099AccStr != null ? Boolean.parseBoolean(only1099AccStr) : false);\n boolean ignoreZero = request.get(GoodsReceiptCMNConstants.IGNOREZERO) != null;\n boolean onlyAmountDue = request.get(GoodsReceiptCMNConstants.ONLYAMOUNTDUE) != null;\n boolean report = request.get(\"report\") != null;\n boolean isFixedAsset = request.containsKey(\"isFixedAsset\") ? (Boolean) request.get(\"isFixedAsset\") : false;\n boolean isConsignment = request.containsKey(\"isConsignment\") ? (Boolean) request.get(\"isConsignment\") : false;\n int duration = (request.containsKey(GoodsReceiptCMNConstants.DURATION) && request.get(GoodsReceiptCMNConstants.DURATION) != null) ? Integer.parseInt(request.get(GoodsReceiptCMNConstants.DURATION).toString()) : 30;\n int invoiceLinkedWithGRNStatus = (request.containsKey(\"invoiceLinkedWithGRNStatus\") && request.get(\"invoiceLinkedWithGRNStatus\") != null) ? Integer.parseInt(request.get(\"invoiceLinkedWithGRNStatus\").toString()) : 0;\n boolean isExport = (request.get(\"isExport\") == null) ? false : (Boolean) request.get(\"isExport\");\n\n Date startDate=null;\n if(request.containsKey(Constants.REQ_startdate) && request.get(Constants.REQ_startdate)!=null){\n try{\n startDate=dateFormat.parse(request.get(Constants.REQ_startdate).toString());\n }catch(Exception ex){\n startDate = null;\n }\n }\n String curDateString = \"\";\n Date curDate = null;\n boolean booleanAged = false;//Added for aged payable/receivable\n\n //Custom field details Maps for Global data\n HashMap<String, String> customFieldMap = new HashMap<String, String>();\n HashMap<String, String> customDateFieldMap = new HashMap<String, String>();\n\n HashMap<String, Object> fieldrequestParams = new HashMap();\n int moduleid=isFixedAsset ? Constants.Acc_FixedAssets_PurchaseInvoice_ModuleId :isConsignment?Constants.Acc_Consignment_GoodsReceipt_ModuleId: Constants.Acc_Vendor_Invoice_ModuleId;\n fieldrequestParams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid));\n fieldrequestParams.put(Constants.filter_values, Arrays.asList(companyid, moduleid));\n HashMap<String, String> replaceFieldMap = new HashMap<String, String>();\n HashMap<String, Integer> FieldMap = accAccountDAOobj.getFieldParamsCustomMap(fieldrequestParams, replaceFieldMap, customFieldMap, customDateFieldMap);\n\n //Custom field details Maps for Line Level data\n HashMap<String, Object> fieldrequestParamsRows = new HashMap();\n HashMap<String, String> replaceFieldMapRows = new HashMap();\n HashMap<String, String> customFieldMapRows = new HashMap();\n HashMap<String, String> customDateFieldMapRows = new HashMap();\n fieldrequestParamsRows.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, Constants.customcolumn));\n fieldrequestParamsRows.put(Constants.filter_values, Arrays.asList(companyid, moduleid, 1));\n HashMap<String, Integer> fieldMapRows = null;\n fieldMapRows = accAccountDAOobj.getFieldParamsCustomMap(fieldrequestParamsRows, replaceFieldMapRows, customFieldMapRows, customDateFieldMapRows);\n\n List InvoiceList=new ArrayList();\n String compids[] = Constants.Companyids_Chkl_And_Marubishi.split(\",\");\n boolean isFromChklorMarubishi = false;\n for (int cnt = 0; cnt < compids.length; cnt++) {\n String compid = compids[cnt];\n if (compid.equalsIgnoreCase(companyid)) {\n isFromChklorMarubishi = true;\n }\n }\n Calendar oneDayBeforeCal1 = Calendar.getInstance();\n Calendar cal1 = Calendar.getInstance();\n Calendar cal2 = Calendar.getInstance();\n Calendar cal3 = Calendar.getInstance();\n Calendar cal4 = Calendar.getInstance();\n Calendar cal5 = Calendar.getInstance();\n Calendar cal6 = Calendar.getInstance();\n Calendar cal7 = Calendar.getInstance();\n Calendar cal8 = Calendar.getInstance();\n Calendar cal9 = Calendar.getInstance();\n Calendar cal10 = Calendar.getInstance();\n\n if (request.get(Constants.asOfDate) != null) {//Added for aged payable/receivable\n curDateString = (String) request.get(Constants.asOfDate);\n\n if (request.get(\"MonthlyAgeingCurrDate\") != null) {\n curDate = (Date) request.get(\"MonthlyAgeingCurrDate\");\n } else {\n curDate = df.parse(curDateString);\n }\n booleanAged = true;\n oneDayBeforeCal1.setTime(curDate);\n cal1.setTime(curDate);\n cal2.setTime(curDate);\n cal3.setTime(curDate);\n cal4.setTime(curDate);\n cal5.setTime(curDate);\n cal6.setTime(curDate);\n cal7.setTime(curDate);\n cal8.setTime(curDate);\n cal9.setTime(curDate);\n cal10.setTime(curDate);\n oneDayBeforeCal1.add(Calendar.DAY_OF_YEAR, -1); //Need to verify in multiple cases, then only take action on it\n cal2.add(Calendar.DAY_OF_YEAR, -duration);\n cal3.add(Calendar.DAY_OF_YEAR, -(duration * 2));\n cal4.add(Calendar.DAY_OF_YEAR, -(duration * 3));\n cal5.add(Calendar.DAY_OF_YEAR, -(duration * 4));\n cal6.add(Calendar.DAY_OF_YEAR, -(duration * 5));\n cal7.add(Calendar.DAY_OF_YEAR, -(duration * 6));\n cal8.add(Calendar.DAY_OF_YEAR, -(duration * 7));\n cal9.add(Calendar.DAY_OF_YEAR, -(duration * 8));\n cal10.add(Calendar.DAY_OF_YEAR, -(duration * 9));\n }\n\n Date oneDayBeforeCal1Date = null;\n Date cal1Date = null;\n Date cal2Date = null;\n Date cal3Date = null;\n Date cal4Date = null;\n Date cal5Date = null;\n Date cal6Date = null;\n Date cal7Date = null;\n Date cal8Date = null;\n Date cal9Date = null;\n Date cal10Date = null;\n\n String oneDayBeforeCal1String = dateFormat.format(oneDayBeforeCal1.getTime());\n oneDayBeforeCal1Date = dateFormat.parse(oneDayBeforeCal1String);\n\n String cal1String = dateFormat.format(cal1.getTime());\n cal1Date = dateFormat.parse(cal1String);\n\n String cal2String = dateFormat.format(cal2.getTime());\n cal2Date = dateFormat.parse(cal2String);\n\n String cal3String = dateFormat.format(cal3.getTime());\n cal3Date = dateFormat.parse(cal3String);\n\n String cal4String = dateFormat.format(cal4.getTime());\n cal4Date = dateFormat.parse(cal4String);\n\n String cal5String = dateFormat.format(cal5.getTime());\n cal5Date = dateFormat.parse(cal5String);\n\n String cal6String = dateFormat.format(cal6.getTime());\n cal6Date = dateFormat.parse(cal6String);\n\n String cal7String = dateFormat.format(cal7.getTime());\n cal7Date = dateFormat.parse(cal7String);\n\n String cal8String = dateFormat.format(cal8.getTime());\n cal8Date = dateFormat.parse(cal8String);\n\n String cal9String = dateFormat.format(cal9.getTime());\n cal9Date = dateFormat.parse(cal9String);\n\n String cal10String = dateFormat.format(cal10.getTime());\n cal10Date = dateFormat.parse(cal10String);\n\n double amountdue1 = 0;\n double amountdue2 = 0;\n double amountdue3 = 0;\n double amountdue4 = 0;\n double amountdue5 = 0;\n double amountdue6 = 0;\n double amountdue7 = 0;\n double amountdue8 = 0;\n double amountdue9 = 0;\n double amountdue10 = 0;\n double amountdue11 = 0;\n// double accruedbalance = 0;\n if (list != null && !list.isEmpty()) {\n for (Object objectArr : list) {\n Object[] oj = (Object[]) objectArr;\n String invid = oj[0].toString();\n //Withoutinventory 0 for normal, 1 for billing\n boolean withoutinventory = Boolean.parseBoolean(oj[1].toString());\n {\n amountdue1 = amountdue2 = amountdue3 = amountdue4 = amountdue5 = amountdue6 = amountdue7 = amountdue8 = amountdue9 = amountdue10 = amountdue11 = 0;\n KwlReturnObject objItr = accountingHandlerDAOobj.getObject(GoodsReceipt.class.getName(), invid);\n GoodsReceipt gReceipt = (GoodsReceipt) objItr.getEntityList().get(0);\n\n \n \n \n /*------- Code for Loading Data in Invoice Grid as per Applied filter of PI linking with GR--------- */\n if (invoiceLinkedWithGRNStatus != 0) {\n boolean invoiceLinkedWithGRNStatusFilter = false;\n\n if (invoiceLinkedWithGRNStatus == 11) {//When PI is fully received\n invoiceLinkedWithGRNStatusFilter = isInvoiceFullyLinkedWithGR(gReceipt);\n } else if (invoiceLinkedWithGRNStatus == 12) {//When PI is not linked with GR\n invoiceLinkedWithGRNStatusFilter = isInvoiceNotLinkedWithAnyGR(gReceipt);\n } else if (invoiceLinkedWithGRNStatus == 13) {//When PI is partially received\n invoiceLinkedWithGRNStatusFilter = isInvoicePartiallyLinkedWithGR(gReceipt);\n }\n /*--------Only relevant Data will load as per applied filter--------- */\n if (!invoiceLinkedWithGRNStatusFilter) {\n continue;\n }\n\n }\n\n \n //Below If Block code is used to remove duplicate invoice id's when filter on the basis of Product category or Product name\n if (isproductCategory || isproductType) {\n if (InvoiceList.contains(gReceipt.getID())) {\n continue;\n } else {\n InvoiceList.add(gReceipt.getID());\n }\n }\n JournalEntry je = null;\n JournalEntryDetail d = null;\n if (gReceipt.isNormalInvoice()) {\n je = gReceipt.getJournalEntry();\n d = gReceipt.getVendorEntry();\n }\n\n double invoiceOriginalAmt = 0d;\n double externalCurrencyRate = 0d;\n boolean isopeningBalanceInvoice = gReceipt.isIsOpeningBalenceInvoice();\n Date creationDate = null;\n\n currencyid = (gReceipt.getCurrency() == null ? currency.getCurrencyID() : gReceipt.getCurrency().getCurrencyID());\n Account account = null;\n if (gReceipt.isIsOpeningBalenceInvoice() && !gReceipt.isNormalInvoice()) {\n KwlReturnObject accObjItr = accountingHandlerDAOobj.getObject(Account.class.getName(), gReceipt.getVendor().getAccount().getID());\n account = (Account) accObjItr.getEntityList().get(0);\n externalCurrencyRate = gReceipt.getExchangeRateForOpeningTransaction();\n creationDate = gReceipt.getCreationDate();\n invoiceOriginalAmt = gReceipt.getOriginalOpeningBalanceAmount();\n } else {\n account = d.getAccount();\n externalCurrencyRate = je.getExternalCurrencyRate();\n JSONObject jObj = extraCompanyPreferences.getColumnPref() != null ? new JSONObject(extraCompanyPreferences.getColumnPref()) : new JSONObject();\n boolean isPostingDateCheck = false;\n if (!StringUtil.isNullObject(jObj) && jObj.has(Constants.IS_POSTING_DATE_CHECK) && jObj.get(Constants.IS_POSTING_DATE_CHECK) != null && jObj.optBoolean(Constants.IS_POSTING_DATE_CHECK, false)) {\n isPostingDateCheck = true;\n }\n if(isPostingDateCheck){\n creationDate = gReceipt.getCreationDate();\n }else{\n creationDate = je.getEntryDate();\n }\n invoiceOriginalAmt = d.getAmount();\n }\n double amountdue = 0,amountdueinbase = 0, deductDiscount = 0,amountDueOriginal=0.0;\n if (gReceipt.isIsExpenseType()) {\n if(Constants.InvoiceAmountDueFlag && !isAged){\n ll = accGoodsReceiptCommon.getUpdatedExpGRAmountDue(request, gReceipt);\n } else {\n ll = accGoodsReceiptCommon.getExpGRAmountDue(request, gReceipt);\n amountdueinbase = (Double) ll.get(5);\n }\n amountdue = (Double) ll.get(1);\n belongsTo1099 = (Boolean) ll.get(3);\n } else {\n if (gReceipt.isIsOpeningBalenceInvoice() && !gReceipt.isNormalInvoice()) {\n ll = new ArrayList();\n ll.add(gReceipt.getOriginalOpeningBalanceAmount());\n ll.add(gReceipt.getOpeningBalanceAmountDue());\n ll.add(\"\");\n ll.add(false);\n ll.add(0.0);\n ll.add(gReceipt.getOpeningBalanceAmountDue());\n } else {\n if (Constants.InvoiceAmountDueFlag && !isAged) {\n ll = accGoodsReceiptCommon.getInvoiceDiscountAmountInfo(request, gReceipt);\n } else {\n ll = accGoodsReceiptCommon.getGRAmountDue(request, gReceipt);\n amountdueinbase = (Double) ll.get(6);\n }\n }\n\n amountdue = (Double) ll.get(1);\n belongsTo1099 = (Boolean) ll.get(3);\n deductDiscount = (Double) ll.get(4);\n amountDueOriginal = (Double) ll.get(5);\n }\n if (onlyAmountDue && authHandler.round(amountdue, companyid) == 0 || (only1099Acc && !belongsTo1099)) {//remove //belongsTo1099&&gReceipt.isIsExpenseType()\\\\ in case of viewing all accounts. [PS]\n continue;\n }\n if ((ignoreZero && authHandler.round(amountdue, companyid) <= 0)) {\n continue;\n }\n int isReval = 0;\n if (report) {\n KwlReturnObject brdAmt = accGoodsReceiptobj.getRevalFlag(gReceipt.getID());\n List reval = brdAmt.getEntityList();\n if (!reval.isEmpty() && (Long) reval.get(0) > 0) {\n isReval = 1;\n }\n }\n\n if (request.containsKey(\"excludeInvoiceId\") && request.get(\"excludeInvoiceId\") != null) {\n String excludeInvoiceId = (String) request.get(\"excludeInvoiceId\");\n if (gReceipt.getGoodsReceiptNumber().equals(excludeInvoiceId)) {\n continue;\n }\n }\n Vendor vendor=gReceipt.getVendor();\n HashMap<String, Object> hashMap = new HashMap<>();\n hashMap.put(\"invoiceID\", gReceipt.getID());\n hashMap.put(\"companyid\", companyid);\n KwlReturnObject object = accInvoiceDAOobj.getinvoiceDocuments(hashMap);\n int attachemntcount = object.getRecordTotalCount();\n com.krawler.utils.json.base.JSONObject obj = new com.krawler.utils.json.base.JSONObject();\n obj.put(GoodsReceiptCMNConstants.BILLID, gReceipt.getID());\n obj.put(\"isdropshipchecked\", gReceipt.isIsDropshipDocument());\n obj.put(Constants.isDraft, gReceipt.isIsDraft());\n boolean isForTemplate = (request.containsKey(\"isForTemplate\") && Boolean.parseBoolean(request.get(\"isForTemplate\").toString()))?true:false;\n //KwlReturnObject cmp = accountingHandlerDAOobj.getObject(Company.class.getName(), companyid);\n // Company company = (Company) cmp.getEntityList().get(0);\n // int countryid = company.getCountry() != null ? Integer.parseInt(company.getCountry().getID()) : 0;\n // Comment this code because get Company object availble for method\n\n String landedInvoice = accProductObj.consignmentInvoice(gReceipt.getID(), companyid);\n\n \n if (Constants.indian_country_id == countryid) {\n List<ExciseDetailsInvoice> ed = null;\n if (!isForTemplate) {\n if (extraCompanyPreferences.isExciseApplicable()) {\n KwlReturnObject exciseDetails = accGoodsReceiptobj.getExciseDetails(gReceipt.getID());\n// if (!exciseDetails.getEntityList().isEmpty()){\n ed = exciseDetails.getEntityList();\n// }\n }\n if (extraCompanyPreferences.isExciseApplicable() && ed.size() > 0) {\n if (isFixedAsset) {\n obj.put(\"assetExciseid\", ed.get(0).getId());\n } else {\n obj.put(\"exciseDetailid\", ed.get(0).getId());\n }\n obj.put(\"suppliers\", ed.get(0).getSupplier());\n obj.put(\"supplierTINSalesTAXNo\", ed.get(0).getSupplierTINSalesTaxNo());\n obj.put(\"supplierExciseRegnNo\", ed.get(0).getSupplierExciseRegnNo());\n obj.put(\"cstnumber\", ed.get(0).getCstnumber());\n obj.put(\"supplierRange\", ed.get(0).getSupplierRange());\n obj.put(\"supplierCommissionerate\", ed.get(0).getSupplierCommissioneRate());\n obj.put(\"supplierAddress\", ed.get(0).getSupplierAddress());\n obj.put(\"supplierImporterExporterCode\", ed.get(0).getSupplierImporterExporterCode());\n obj.put(\"supplierDivision\", ed.get(0).getSupplierDivision());\n obj.put(\"manufacturername\", ed.get(0).getManufacturerName());\n obj.put(\"manufacturerExciseRegnNo\", ed.get(0).getManufacturerExciseregnNo());\n obj.put(\"manufacturerRange\", ed.get(0).getManufacturerRange());\n obj.put(\"manufacturerCommissionerate\", ed.get(0).getManufacturerCommissionerate());\n obj.put(\"manufacturerDivision\", ed.get(0).getManufacturerDivision());\n obj.put(\"manufacturerAddress\", ed.get(0).getManufacturerAddress());\n obj.put(\"manufacturerImporterExporterCode\", ed.get(0).getManufacturerImporterexporterCode());\n obj.put(\"supplierState\", ed.get(0).getSupplierstate());\n obj.put(\"registrationType\", ed.get(0).getRegistrationType());\n obj.put(\"UnitName\", ed.get(0).getUnitname());\n obj.put(\"ECCNo\", ed.get(0).getECCNo());\n obj.put(\"isExciseInvoiceWithTemplate\", (!ed.get(0).getRegistrationType().equals(\"\") || !ed.get(0).getUnitname().equals(\"\") || !ed.get(0).getECCNo().equals(\"\")) ? true : false);\n }\n HashMap tmpHashMap = new HashMap();\n tmpHashMap.put(\"moduleRecordId\", invid);\n tmpHashMap.put(\"companyid\", companyid);\n KwlReturnObject exciseTemp = accountingHandlerDAOobj.getExciseTemplatesMap(tmpHashMap);\n if (exciseTemp != null && exciseTemp.getEntityList().size() > 0) {\n ExciseDetailsTemplateMap moduleTemp = (ExciseDetailsTemplateMap) exciseTemp.getEntityList().get(0);\n if (moduleTemp != null) {\n// obj.put(\"manufacturerType\", moduleTemp.getManufacturerType());\n obj.put(\"registrationType\", moduleTemp.getRegistrationType());\n obj.put(\"UnitName\", moduleTemp.getUnitname());\n obj.put(\"ECCNo\", moduleTemp.getECCNo());\n }\n }\n obj.put(\"vvattin\", !StringUtil.isNullOrEmpty(gReceipt.getVendor().getVATTINnumber())?gReceipt.getVendor().getVATTINnumber():\"\");\n obj.put(\"vcsttin\", !StringUtil.isNullOrEmpty(gReceipt.getVendor().getCSTTINnumber())?gReceipt.getVendor().getCSTTINnumber():\"\");\n obj.put(\"veccno\", !StringUtil.isNullOrEmpty(gReceipt.getVendor().getECCnumber())?gReceipt.getVendor().getECCnumber():\"\");\n obj.put(\"vservicetaxregno\", !StringUtil.isNullOrEmpty(gReceipt.getVendor().getSERVICEnumber())?gReceipt.getVendor().getSERVICEnumber():\"\");\n obj.put(\"vattinno\", !StringUtil.isNullOrEmpty(vendor.getVATTINnumber())?vendor.getVATTINnumber():\"\");\n obj.put(\"csttinno\", !StringUtil.isNullOrEmpty(vendor.getCSTTINnumber())?vendor.getCSTTINnumber():\"\");\n obj.put(\"eccno\", !StringUtil.isNullOrEmpty(vendor.getECCnumber())?vendor.getECCnumber():\"\");\n obj.put(\"panno\", !StringUtil.isNullOrEmpty(vendor.getPANnumber())?vendor.getPANnumber():\"\");\n obj.put(\"servicetaxno\", !StringUtil.isNullOrEmpty(vendor.getSERVICEnumber())?vendor.getSERVICEnumber():\"\");\n obj.put(\"tanno\", !StringUtil.isNullOrEmpty(vendor.getTANnumber())?vendor.getTANnumber():\"\");\n obj.put(\"formtypeid\", !StringUtil.isNullOrEmpty(gReceipt.getFormtype()) ? gReceipt.getFormtype() : 0);\n obj.put(\"gtaapplicable\", gReceipt.isGtaapplicable());\n obj.put(\"gstapplicable\", gReceipt.isIsIndGSTApplied());\n obj.put(\"isInterstateParty\", gReceipt.getVendor().isInterstateparty());\n obj.put(\"formseriesno\", !StringUtil.isNullOrEmpty(gReceipt.getFormseriesno()) ? gReceipt.getFormseriesno() : \"\");\n obj.put(\"formno\", !StringUtil.isNullOrEmpty(gReceipt.getFormno()) ? gReceipt.getFormno() : \"\");\n obj.put(\"formdate\", gReceipt.getFormdate());\n obj.put(\"formamount\", gReceipt.getFormamount());\n if (!StringUtil.isNullOrEmpty(gReceipt.getFormstatus())) {\n if (gReceipt.getFormstatus().equals(\"1\")) {\n obj.put(\"formstatus\", \"NA\");\n } else if (gReceipt.getFormstatus().equals(\"2\")) {\n obj.put(\"formstatus\", \"Pending\");\n } else if (gReceipt.getFormstatus().equals(\"3\")) {\n obj.put(\"formstatus\", \"Submitted\");\n }\n } else{\n obj.put(\"formstatus\", \"NA\");\n }\n } else {\n if (company.getCountry() != null && Integer.parseInt(company.getCountry().getID()) == Constants.indian_country_id && extraCompanyPreferences.isExciseApplicable()) {\n obj.put(\"suppliers\", vendor.getName());\n obj.put(\"supplierCommissionerate\", vendor.getCommissionerate() != null ? vendor.getCommissionerate() : \"\");\n obj.put(\"supplierDivision\", vendor.getDivision() != null ? vendor.getDivision() : \"\");\n obj.put(\"supplierRange\", vendor.getRangecode() != null ? vendor.getRangecode() : \"\");\n obj.put(\"supplierImporterExporterCode\", vendor.getIECNo() != null ? vendor.getIECNo() : \"\");\n obj.put(\"cstnumber\", vendor.getCSTTINnumber() != null ? vendor.getCSTTINnumber() : \"\");\n obj.put(\"supplierTINSalesTAXNo\", vendor.getVATTINnumber() != null ? vendor.getVATTINnumber() : \"\");\n obj.put(\"supplierExciseRegnNo\", vendor.getECCnumber() != null ? vendor.getECCnumber() : \"\");\n\n HashMap<String, Object> addrRequestParams = new HashMap<String, Object>();\n addrRequestParams.put(\"vendorid\", vendor.getID());\n addrRequestParams.put(\"companyid\", companyid);\n addrRequestParams.put(\"isBillingAddress\", true);//only billing address \n KwlReturnObject addressResult = accountingHandlerDAOobj.getVendorAddressDetails(addrRequestParams);\n if (!addressResult.getEntityList().isEmpty()) {\n List<VendorAddressDetails> casList = addressResult.getEntityList();\n if (casList.size() > 0) {\n VendorAddressDetails vas = (VendorAddressDetails) casList.get(0);\n String fullAddress = \"\";\n if (!StringUtil.isNullOrEmpty(vas.getAddress())) {\n fullAddress += vas.getAddress() + \", \";\n }\n if (!StringUtil.isNullOrEmpty(vas.getCity())) {\n fullAddress += vas.getCity() + \", \";\n }\n if (!StringUtil.isNullOrEmpty(vas.getState())) {\n fullAddress += vas.getState() + \", \";\n }\n if (!StringUtil.isNullOrEmpty(vas.getCountry())) {\n fullAddress += vas.getCountry() + \", \";\n }\n if (!StringUtil.isNullOrEmpty(fullAddress)) {\n fullAddress = fullAddress.substring(0, fullAddress.length() - 2);\n }\n obj.put(\"supplierAddress\", fullAddress);\n obj.put(\"supplierState\", vas.getState() != null ? vas.getState() : \"\");\n }\n }\n }\n }\n /**\n * Get Module template and its mapped Unit details for company if Line level term flag ON \n */\n if(extraCompanyPreferences!=null && extraCompanyPreferences.getLineLevelTermFlag()==1 && isForTemplate){\n HashMap<String, Object> ModuleTempParams = new HashMap<>();\n ModuleTempParams.put(\"modulerecordid\", invid);\n ModuleTempParams.put(\"companyid\", companyid);\n /** Get Module template from invoice id . In module template invoice id add as modulerecordid */\n KwlReturnObject ModuleTempObj = accountingHandlerDAOobj.getModuleTemplates(ModuleTempParams);\n if(ModuleTempObj!=null && ModuleTempObj.getEntityList().size() > 0){\n ModuleTemplate moduleTemp = (ModuleTemplate) ModuleTempObj.getEntityList().get(0);\n obj.put(\"companyunitid\", moduleTemp.getCompanyUnitid());\n\n HashMap tmpHashMap = new HashMap();\n tmpHashMap.put(\"companyunitid\", moduleTemp.getCompanyUnitid());\n tmpHashMap.put(Constants.companyKey, companyid);\n /* Get Company Unit details from companyunitid mapped with module template */\n KwlReturnObject exciseTemp = accountingHandlerDAOobj.getExciseTemplatesMap(tmpHashMap);\n if (exciseTemp != null && exciseTemp.getEntityList()!=null && exciseTemp.getEntityList().size() > 0) {\n ExciseDetailsTemplateMap ExcisemoduleTemp = (ExciseDetailsTemplateMap) exciseTemp.getEntityList().get(0);\n if (ExcisemoduleTemp != null) {\n obj.put(\"registrationType\", ExcisemoduleTemp.getRegistrationType());\n obj.put(\"UnitName\", ExcisemoduleTemp.getUnitname());\n obj.put(\"ECCNo\", ExcisemoduleTemp.getECCNo());\n }\n }\n }\n }\n if (extraCompanyPreferences.isExciseApplicable()) {\n KwlReturnObject grDetailsRes = accountingHandlerDAOobj.getObject(GoodsReceipt.class.getName(), gReceipt.getID());\n GoodsReceipt goodsReceiptDetail = (GoodsReceipt) grDetailsRes.getEntityList().get(0);\n if (goodsReceiptDetail.isIsExciseInvoice()) {\n Set<GoodsReceiptDetail> rows = goodsReceiptDetail.getRows();\n for (GoodsReceiptDetail goodsReceiptDetailsRow : rows) {\n KwlReturnObject result = accGoodsReceiptobj.getSupplierExciseDetailsMapping(goodsReceiptDetailsRow.getID(), companyid); //while deleting GR check wether it is used in Consignment Cost\n list = result.getEntityList();\n if (list != null && !list.isEmpty()) {\n obj.put(\"isSupplierLinekd\", true);\n break;\n }\n }\n }\n }\n /**\n * Put GST document history.\n */\n if (gReceipt.getCompany().getCountry().getID().equalsIgnoreCase(\"\" + Constants.indian_country_id)) {\n obj.put(\"refdocid\", gReceipt.getID());\n fieldDataManagercntrl.getGSTDocumentHistory(obj);\n }\n /**\n * Put Merchant Exporter Check\n */\n obj.put(Constants.isMerchantExporter, gReceipt.isIsMerchantExporter());\n\n \n \n }\n if (company.getCountry() != null && Integer.parseInt(company.getCountry().getID()) == Constants.indian_country_id && extraCompanyPreferences.isTDSapplicable()) {\n //For Indian Country related fields\n obj.put(\"TotalAdvanceTDSAdjustmentAmt\", gReceipt.getTotalAdvanceTDSAdjustmentAmt());\n obj.put(\"natureOfPayment\", gReceipt.getVendor() != null ? gReceipt.getVendor().getNatureOfPayment() : \"\");\n obj.put(\"deducteetype\", gReceipt.getVendor() != null ? gReceipt.getVendor().getDeducteeType() : \"\");\n obj.put(\"residentialstatus\", gReceipt.getVendor() != null ? gReceipt.getVendor().getResidentialstatus() : \"\");\n String tdsPayableAccount = \"\";\n MasterItem masterItem2 = null;\n if (!StringUtil.isNullOrEmpty(vendor.getNatureOfPayment())) {\n KwlReturnObject catresult = accountingHandlerDAOobj.getObject(MasterItem.class.getName(), vendor.getNatureOfPayment());\n masterItem2 = (MasterItem) catresult.getEntityList().get(0);\n obj.put(\"natureOfPaymentname\", masterItem2.getCode() + \" - \" + masterItem2.getValue());//INDIAN Company for TDS Calculation\n tdsPayableAccount = masterItem2.getAccID();\n } else {\n obj.put(\"natureOfPaymentname\", \"\");\n }\n if (!StringUtil.isNullOrEmpty(vendor.getDeducteeType())) {\n KwlReturnObject catresult = accountingHandlerDAOobj.getObject(MasterItem.class.getName(), vendor.getDeducteeType());\n masterItem2 = (MasterItem) catresult.getEntityList().get(0);\n obj.put(\"deducteetypename\", (masterItem2!=null)?masterItem2.getValue():\"\");//INDIAN Company for TDS Calculation in Make Payment\n } else {\n obj.put(\"deducteetypename\", \"\");\n }\n obj.put(\"tdsPayableAccount\", tdsPayableAccount);\n }\n\n \n HashMap<String, Object> ModuleTempParams = new HashMap<>();\n ModuleTempParams.put(\"modulerecordid\", invid);\n ModuleTempParams.put(\"companyid\", companyid);\n /**\n * Get Module template from invoice id . In module\n * template invoice id add as modulerecordid\n */\n KwlReturnObject ModuleTempObj = accountingHandlerDAOobj.getModuleTemplates(ModuleTempParams);\n if (ModuleTempObj != null && ModuleTempObj.getEntityList().size() > 0) {\n ModuleTemplate moduleTemp = (ModuleTemplate) ModuleTempObj.getEntityList().get(0);\n obj.put(\"companyunitid\", moduleTemp.getCompanyUnitid());\n obj.put(\"populateproducttemplate\", moduleTemp.isPopulateproductintemp());\n obj.put(\"populatecustomertemplate\", moduleTemp.isPopulatecustomerintemp());\n obj.put(\"populateautodointemp\", moduleTemp.isPopulateautodointemp());\n }\n// MasterItem gstRegistrationType = vendor != null ? vendor.getGSTRegistrationType() : null;\n// if (gstRegistrationType != null && gstRegistrationType.getDefaultMasterItem() != null) {\n// obj.put(\"GSTINRegTypeDefaultMstrID\", gstRegistrationType.getDefaultMasterItem().getID());\n// }\n obj.put(\"tdsrate\", gReceipt.getTdsRate());\n obj.put(\"tdsamount\", gReceipt.getTdsAmount());\n obj.put(\"tdsmasterrateruleid\", gReceipt.getTdsMasterRateRuleId());\n obj.put(\"isInterstateParty\", (gReceipt.getVendor() !=null ? gReceipt.getVendor().isInterstateparty() : false));\n obj.put(\"isOpeningBalanceTransaction\", gReceipt.isIsOpeningBalenceInvoice());\n obj.put(\"isExciseInvoice\", gReceipt.isIsExciseInvoice());\n obj.put(\"defaultnatureofpurchase\", gReceipt.getDefaultnatureOfPurchase());\n obj.put(\"manufacturertype\", gReceipt.getManufacturerType());\n obj.put(\"isNormalTransaction\", gReceipt.isNormalInvoice());\n obj.put(\"parentinvoiceid\", gReceipt.getParentInvoice()!=null?gReceipt.getParentInvoice().getID():\"\");\n obj.put(\"companyid\", gReceipt.getCompany().getCompanyID());\n obj.put(\"companyname\", gReceipt.getCompany().getCompanyName());\n obj.put(\"withoutinventory\", withoutinventory);\n obj.put(Constants.HAS_ACCESS, vendor.isActivate());\n obj.put(GoodsReceiptCMNConstants.PERSONID,vendor == null ? account.getID() : vendor.getID());\n obj.put(GoodsReceiptCMNConstants.ALIASNAME, vendor == null ? \"\" : vendor.getAliasname());\n obj.put(GoodsReceiptCMNConstants.PERSONEMAIL, vendor == null ? \"\" : vendor.getEmail());\n obj.put(\"code\", vendor == null ? \"\" : vendor.getAcccode());\n obj.put(GoodsReceiptCMNConstants.BILLNO, gReceipt.getGoodsReceiptNumber());\n obj.put(GoodsReceiptCMNConstants.CURRENCYID, currencyid);\n obj.put(GoodsReceiptCMNConstants.CURRENCYSYMBOL, (gReceipt.getCurrency() == null ? currency.getSymbol() : gReceipt.getCurrency().getSymbol()));\n obj.put(\"currencyCode\", (gReceipt.getCurrency() == null ? currency.getCurrencyCode() : gReceipt.getCurrency().getCurrencyCode()));\n obj.put(\"currencycode\", (gReceipt.getCurrency() == null ? currency.getCurrencyCode() : gReceipt.getCurrency().getCurrencyCode()));\n obj.put(GoodsReceiptCMNConstants.CURRENCYNAME, (gReceipt.getCurrency() == null ? currency.getName() : gReceipt.getCurrency().getName()));\n obj.put(GoodsReceiptCMNConstants.COMPANYADDRESS, gReceipt.getCompany().getAddress());\n obj.put(GoodsReceiptCMNConstants.COMPANYNAME, gReceipt.getCompany().getCompanyName());\n// KwlReturnObject bAmt = accCurrencyDAOobj.getBaseToCurrencyAmount(request, 1.0, currencyid, creationDate, 0);\n KwlReturnObject bAmt = accCurrencyDAOobj.getBaseToCurrencyAmount(request, 1.0, currencyid, gReceipt.getCreationDate(), 0);\n obj.put(GoodsReceiptCMNConstants.OLDCURRENCYRATE, bAmt.getEntityList().get(0));\n obj.put(GoodsReceiptCMNConstants.BILLTO, gReceipt.getBillFrom());\n obj.put(GoodsReceiptCMNConstants.ISEXPENSEINV, gReceipt.isIsExpenseType());\n obj.put(GoodsReceiptCMNConstants.SHIPTO, gReceipt.getShipFrom());\n obj.put(GoodsReceiptCMNConstants.JOURNALENTRYID, je != null ? je.getID() : \"\");\n obj.put(GoodsReceiptCMNConstants.EXTERNALCURRENCYRATE, externalCurrencyRate);\n obj.put(GoodsReceiptCMNConstants.ENTRYNO, je != null ? je.getEntryNumber() : \"\");\n obj.put(GoodsReceiptCMNConstants.DATE, df.format(creationDate));\n obj.put(GoodsReceiptCMNConstants.SHIPDATE, gReceipt.getShipDate() == null ? \"\" : df.format(gReceipt.getShipDate()));\n obj.put(GoodsReceiptCMNConstants.DUEDATE, df.format(gReceipt.getDueDate()));\n obj.put(GoodsReceiptCMNConstants.PERSONNAME, vendor == null ? account.getName() : vendor.getName());\n obj.put(\"personcode\", vendor == null ? (account.getAcccode()==null?\"\":account.getAcccode()) : (vendor.getAcccode()==null?\"\":vendor.getAcccode()));\n obj.put(GoodsReceiptCMNConstants.PERSONINFO, vendor == null ? (account.getAcccode()==null?\"\":account.getAcccode()) : (vendor.getName()+\"(\"+vendor.getAcccode()+\")\"));\n obj.put(\"agent\", gReceipt.getMasterAgent() == null ? \"\" : gReceipt.getMasterAgent().getID());\n obj.put(\"agentname\", gReceipt.getMasterAgent() == null ? \"\" : gReceipt.getMasterAgent().getValue());\n obj.put(GoodsReceiptCMNConstants.MEMO, gReceipt.getMemo());\n obj.put(\"posttext\", gReceipt.getPostText());\n obj.put(\"shiplengthval\", gReceipt.getShiplength());\n obj.put(\"invoicetype\", gReceipt.getInvoicetype());\n obj.put(\"purchaseinvoicetype\",gReceipt.isIsExpenseType() ? \"Expense\" : \"Product\");\n obj.put(GoodsReceiptCMNConstants.TERMNAME, vendor == null ? \"\" : ((vendor.getDebitTerm() == null) ? \"\" : vendor.getDebitTerm().getTermname()));\n obj.put(GoodsReceiptCMNConstants.DELETED, gReceipt.isDeleted());\n obj.put(GoodsReceiptCMNConstants.TAXINCLUDED, gReceipt.getTax() == null ? false : true);\n obj.put(GoodsReceiptCMNConstants.TAXID, gReceipt.getTax() == null ? \"\" : gReceipt.getTax().getID());\n// obj.put(GoodsReceiptCMNConstants.TAXNAME, gReceipt.getTax() == null ? \"\" : gReceipt.getTax().getName());\n obj.put(GoodsReceiptCMNConstants.ExchangeRate, \"1 \"+currency.getCurrencyCode()+\" = \"+externalCurrencyRate+\" \"+(gReceipt.getCurrency() == null ? \"\" : gReceipt.getCurrency().getCurrencyCode()));\n obj.put(\"status\", gReceipt.isIsOpenInGR()?\"Open\":\"Closed\");\n obj.put(\"amountDueStatus\", gReceipt.isIsOpenPayment()? \"Open\" : \"Closed\");\n obj.put(\"isTDSApplicable\", gReceipt.isIsTDSApplicable());// TDS Applicable Flag where at time of creating invoice TDS Applicable or not\n obj.put(Constants.SUPPLIERINVOICENO, gReceipt.getSupplierInvoiceNo()!=null? gReceipt.getSupplierInvoiceNo():\"\");\n obj.put(Constants.importExportDeclarationNo, gReceipt.getImportDeclarationNo()!=null? gReceipt.getImportDeclarationNo():\"\");\n obj.put(Constants.IsRoundingAdjustmentApplied, gReceipt.isIsRoundingAdjustmentApplied());\n obj.put(Constants.isCreditable, isExport ? (gReceipt.isIsCreditable() ? \"Yes\" : \"No\") : gReceipt.isIsCreditable());\n\n if (!StringUtil.isNullObject(gReceipt.getBillingShippingAddresses())) {\n obj.put(\"billingAddContactPerson\", gReceipt.getBillingShippingAddresses().getBillingContactPerson() != null ? gReceipt.getBillingShippingAddresses().getBillingContactPerson() : \"\");\n obj.put(\"shippingAddContactPerson\", gReceipt.getBillingShippingAddresses().getShippingContactPerson() != null ? gReceipt.getBillingShippingAddresses().getShippingContactPerson() : \"\");\n obj.put(\"billingAddContactNo\", gReceipt.getBillingShippingAddresses().getBillingContactPersonNumber() != null ? gReceipt.getBillingShippingAddresses().getBillingContactPersonNumber() : \"\");\n obj.put(\"shippingAddContactNo\", gReceipt.getBillingShippingAddresses().getShippingContactPersonNumber() != null ? gReceipt.getBillingShippingAddresses().getShippingContactPersonNumber() : \"\");\n obj.put(\"BillingAddEmail\", gReceipt.getBillingShippingAddresses().getBillingEmail() != null ? gReceipt.getBillingShippingAddresses().getBillingEmail() : \"\");\n obj.put(\"shippingAddEmail\", gReceipt.getBillingShippingAddresses().getShippingEmail() != null ? gReceipt.getBillingShippingAddresses().getShippingEmail() : \"\");\n } else {\n obj.put(\"billingAddContactPerson\", \"\");\n obj.put(\"shippingAddContactPerson\", \"\");\n obj.put(\"billingAddContactNo\", \"\");\n obj.put(\"shippingAddContactNo\", \"\");\n obj.put(\"BillingAddEmail\", \"\");\n obj.put(\"shippingAddEmail\", \"\");\n }\n\n Set<LccManualWiseProductAmount> manualProductDetailsSet = gReceipt.getLccmanualwiseproductamount() != null ? (Set<LccManualWiseProductAmount>) gReceipt.getLccmanualwiseproductamount() : null;\n if (manualProductDetailsSet != null && !manualProductDetailsSet.isEmpty()) {\n JSONArray manuProductDetailsJArr = new JSONArray();\n for (LccManualWiseProductAmount lccManualWiseProductAmountObj : manualProductDetailsSet) {\n JSONObject manuProductDetailsJOBJ = new JSONObject();\n manuProductDetailsJOBJ.put(\"id\", lccManualWiseProductAmountObj.getID());\n manuProductDetailsJOBJ.put(\"billid\", lccManualWiseProductAmountObj.getGrdetailid().getGoodsReceipt().getID());\n manuProductDetailsJOBJ.put(\"rowid\", lccManualWiseProductAmountObj.getGrdetailid().getID());\n manuProductDetailsJOBJ.put(\"originalTransactionRowid\", lccManualWiseProductAmountObj.getGrdetailid().getID());\n manuProductDetailsJOBJ.put(\"productid\", lccManualWiseProductAmountObj.getGrdetailid().getInventory().getProduct().getID());\n manuProductDetailsJOBJ.put(\"billno\", lccManualWiseProductAmountObj.getGrdetailid().getGoodsReceipt().getGoodsReceiptNumber());\n manuProductDetailsJOBJ.put(\"productname\", lccManualWiseProductAmountObj.getGrdetailid().getInventory().getProduct().getName());\n manuProductDetailsJOBJ.put(\"enterpercentage\", lccManualWiseProductAmountObj.getPercentage());\n manuProductDetailsJOBJ.put(\"enteramount\", lccManualWiseProductAmountObj.getAmount());\n if (lccManualWiseProductAmountObj.getAssetDetails() != null) {\n manuProductDetailsJOBJ.put(\"productname\", lccManualWiseProductAmountObj.getAssetDetails().getAssetId());\n }\n manuProductDetailsJOBJ.put(\"assetId\", lccManualWiseProductAmountObj.getAssetDetails() != null ? lccManualWiseProductAmountObj.getAssetDetails().getAssetId() : \"\");\n if (lccManualWiseProductAmountObj.isCustomDutyAllocationType()) {\n manuProductDetailsJOBJ.put(\"igstamount\", lccManualWiseProductAmountObj.getIgstamount());\n manuProductDetailsJOBJ.put(\"igstrate\", lccManualWiseProductAmountObj.getIgstrate());\n manuProductDetailsJOBJ.put(\"taxablevalueforigst\", lccManualWiseProductAmountObj.getTaxablevalueforigst());\n manuProductDetailsJOBJ.put(\"customdutyandothercharges\", lccManualWiseProductAmountObj.getCustomdutyandothercharges());\n manuProductDetailsJOBJ.put(\"customdutyandothercharges\", lccManualWiseProductAmountObj.getCustomdutyandothercharges());\n manuProductDetailsJOBJ.put(\"taxablevalueforcustomduty\", lccManualWiseProductAmountObj.getTaxablevalueforcustomduty());\n int hsncolnum = 0, producttaxcolnum = 0;\n HashMap fieldparams = new HashMap<>();\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyid, lccManualWiseProductAmountObj.getGrdetailid().getGoodsReceipt().isFixedAssetInvoice() ? Constants.Acc_FixedAssets_AssetsGroups_ModuleId : Constants.Acc_Product_Master_ModuleId, \"Custom_\" + Constants.HSN_SACCODE));\n\n KwlReturnObject kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n List<FieldParams> fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n hsncolnum = fieldParams.getColnum();\n }\n fieldparams = new HashMap<>();\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyid, lccManualWiseProductAmountObj.getGrdetailid().getGoodsReceipt().isFixedAssetInvoice() ? Constants.Acc_FixedAssets_AssetsGroups_ModuleId : Constants.Acc_Product_Master_ModuleId, \"Custom_\" + Constants.GSTProdCategory));\n\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n producttaxcolnum = fieldParams.getColnum();\n }\n manuProductDetailsJOBJ.put(\"producttaxcolnum\", producttaxcolnum);\n manuProductDetailsJOBJ.put(\"hsncolnum\", hsncolnum);\n List temp = fieldManagerDAOobj.getFieldComboValue(hsncolnum, lccManualWiseProductAmountObj.getGrdetailid().getInventory().getProduct().getID());\n if (list != null && !temp.isEmpty()) {\n Object[] tempArr = (Object[]) temp.get(0);\n String hsncode = (String) tempArr[0];\n manuProductDetailsJOBJ.put(\"hsncode\", hsncode);\n }\n temp = fieldManagerDAOobj.getFieldComboValue(producttaxcolnum, lccManualWiseProductAmountObj.getGrdetailid().getInventory().getProduct().getID());\n if (temp != null && !temp.isEmpty()) {\n Object[] tempArr = (Object[]) temp.get(0);\n String producttaxclassvalue = (String) tempArr[0];\n manuProductDetailsJOBJ.put(\"producttaxclass\", producttaxclassvalue);\n }\n }\n manuProductDetailsJArr.put(manuProductDetailsJOBJ);\n }\n //manuProductDetailsJOBJTemp.put(\"data\", manuProductDetailsJArr);\n obj.put(\"manualLandedCostCategory\", manuProductDetailsJArr.toString());\n }\n double taxAmt = 0d;\n if(isopeningBalanceInvoice){\n taxAmt = gReceipt.getTaxamount();\n } else {\n if (gReceipt.getTaxEntry() != null) {// if Invoice Level Tax is available\n taxAmt = gReceipt.getTaxEntry() == null ? 0 : gReceipt.getTaxEntry().getAmount();\n // obj.put(GoodsReceiptCMNConstants.TAXAMOUNT, gReceipt.getTaxEntry() == null ? 0 : gReceipt.getTaxEntry().getAmount());\n }\n }\n /**\n * Finding Term Mapped to Invoice and Discount Mapped to\n * Term and passing discount value, Type, applicable\n * days, Purchase invoice date and amount due of invoice\n * because these are used on JS side for calculation of\n * discount while making bulk payment of selected invoice.\n * ERM-981.\n */\n JSONObject columnPrefJObj = null;\n if (!StringUtil.isNullOrEmpty(extraCompanyPreferences.getColumnPref())) {\n columnPrefJObj = new JSONObject((String) extraCompanyPreferences.getColumnPref());\n if (columnPrefJObj.has(Constants.DISCOUNT_ON_PAYMENT_TERMS) && columnPrefJObj.get(Constants.DISCOUNT_ON_PAYMENT_TERMS) != null && columnPrefJObj.optBoolean(Constants.DISCOUNT_ON_PAYMENT_TERMS, false)) {\n obj.put(\"grcreationdate\", je != null ? je.getEntryDate() : creationDate);\n }\n }\n obj.put(\"amountDueOriginal\", (amountDueOriginal <= 0) ? 0 : authHandler.round(amountDueOriginal, companyid));\n// obj.put(\"amountbeforegst\", gReceipt.getTaxEntry() == null ? invoiceOriginalAmt : (invoiceOriginalAmt - gReceipt.getTaxEntry().getAmount()));\n obj.put(GoodsReceiptCMNConstants.DISCOUNT, gReceipt.getDiscountAmount()); //Discount according to created transaction.\n obj.put(\"discountinbase\", gReceipt.getDiscountAmountInBase()); //Discount according to created transaction.\n obj.put(GoodsReceiptCMNConstants.ISPERCENTDISCOUNT, gReceipt.getDiscount() == null ? false : gReceipt.getDiscount().isInPercent());\n obj.put(GoodsReceiptCMNConstants.DISCOUNTVAL, gReceipt.getDiscount() == null ? 0 : gReceipt.getDiscount().getDiscount());\n obj.put(CCConstants.JSON_costcenterid, je != null ? (je.getCostcenter() == null ? \"\" : je.getCostcenter().getID()) : \"\");\n obj.put(CCConstants.JSON_costcenterName, je != null ? (je.getCostcenter() == null ? \"\" : je.getCostcenter().getName()) : \"\");\n obj.put(\"isfavourite\", gReceipt.isFavourite());\n obj.put(\"isprinted\", gReceipt.isPrinted());\n obj.put(\"isEmailSent\", gReceipt.isIsEmailSent());\n obj.put(\"cashtransaction\", gReceipt.isCashtransaction());\n obj.put(\"archieve\", 0);\n obj.put(\"shipvia\", gReceipt.getShipvia() == null ? \"\" : gReceipt.getShipvia());\n obj.put(\"fob\", gReceipt.getFob() == null ? \"\" : gReceipt.getFob());\n obj.put(\"termdetails\", getPurchaseInvoiceTermDetails(gReceipt.getID(), accGoodsReceiptobj));\n boolean isApplyTaxToTerms=gReceipt.isApplyTaxToTerms();\n obj.put(\"isapplytaxtoterms\", isApplyTaxToTerms);\n if (gReceipt.getTermsincludegst() != null) {\n obj.put(Constants.termsincludegst, gReceipt.getTermsincludegst());\n }\n KwlReturnObject result = accLinkDataDao.checkEntryForTransactionInLinkingTableForForwardReference(\"GoodsReceipt\", gReceipt.getID());\n list = result.getEntityList();\n KwlReturnObject linkedDebitNoteResult = accGoodsReceiptobj.getCreditNoteLinkedWithInvoice(gReceipt.getID(), companyid);\n List listDn = linkedDebitNoteResult.getEntityList();\n\n KwlReturnObject linkedDNForOverchargeResult = accGoodsReceiptobj.getDebitNoteForOverchargedLinkedWithInvoice(gReceipt.getID(), companyid);\n List dnOverchargelist = linkedDNForOverchargeResult.getEntityList();\n\n /*\n * TDS Payment is Done - Set true IsLinkedTransaction \n */\n List listtdspayment = null;\n if (Constants.indian_country_id == countryid) {\n KwlReturnObject linkedTDSPaymentObj = accGoodsReceiptobj.getGoodsReceiptTDSPayment(gReceipt.getID(), companyid);\n listtdspayment = linkedTDSPaymentObj.getEntityList();\n }\n if ((list != null && !list.isEmpty())||(!StringUtil.isNullOrEmpty(landedInvoice))||(!gReceipt.isCashtransaction() && (authHandler.round((Double)invoiceOriginalAmt,companyid)!=authHandler.round(amountdue, companyid))) || (listDn!=null && !listDn.isEmpty()) || (listtdspayment!=null && !listtdspayment.isEmpty()) || (dnOverchargelist != null && !dnOverchargelist.isEmpty())){\n obj.put(Constants.IS_LINKED_TRANSACTION, true);\n } else {\n obj.put(Constants.IS_LINKED_TRANSACTION, false);\n }\n /*\n * Check if invoice is claimed as bad debt\n */\n if(gReceipt.getClaimAmountDue()!= 0){\n obj.put(\"isClaimedTransaction\", true);\n }\n// double termAmount = CommonFunctions.getTotalTermsAmount(getTermDetails(gReceipt.getID(), accGoodsReceiptobj));\n// obj.put(\"termamount\", termAmount);\n obj.put(\"termdays\", gReceipt.getTermid() == null ? 0 : gReceipt.getTermid().getTermdays());\n obj.put(\"termid\", gReceipt.getTermid() == null ? \"\" : gReceipt.getTermid().getID());\n //ERP-20637\n if (gReceipt.getLandedInvoice() != null) {\n Set<GoodsReceipt> landInvoiceSet = gReceipt.getLandedInvoice();\n String landedInvoiceId = \"\", landedInvoiceNumber = \"\";\n for (GoodsReceipt grObj : landInvoiceSet) {\n if (!(StringUtil.isNullOrEmpty(landedInvoiceId) && StringUtil.isNullOrEmpty(landedInvoiceId))) {\n landedInvoiceId += \",\";\n landedInvoiceNumber += \",\";\n }\n landedInvoiceId += grObj.getID();\n landedInvoiceNumber += grObj.getGoodsReceiptNumber();\n }\n obj.put(\"landedInvoiceID\", landedInvoiceId);\n obj.put(\"landedInvoiceNumber\", landedInvoiceNumber);\n }\n// obj.put(\"landedInvoiceID\", gReceipt.getLandedInvoice() == null ? \"\" : gReceipt.getLandedInvoice().getID());\n// obj.put(\"landedInvoiceNumber\", gReceipt.getLandedInvoice() == null ? \"\" : gReceipt.getLandedInvoice().getGoodsReceiptNumber());\n obj.put(\"billto\", gReceipt.getBillTo() == null ? \"\" : gReceipt.getBillTo());\n obj.put(\"shipto\", gReceipt.getShipTo() == null ? \"\" : gReceipt.getShipTo());\n obj.put(\"isCapitalGoodsAcquired\", gReceipt.isCapitalGoodsAcquired());\n obj.put(\"isRetailPurchase\", gReceipt.isRetailPurchase());\n obj.put(\"importService\", gReceipt.isImportService());\n obj.put(\"attachment\", attachemntcount);\n obj.put(Constants.isDraft, gReceipt.isIsDraft());\n obj.put(\"isConsignment\", gReceipt.isIsconsignment());\n obj.put(\"landingCostCategoryCombo\", gReceipt.getLandingCostCategory()!=null?gReceipt.getLandingCostCategory().getId():\"\");\n Set<GoodsReceiptDetail> goodsReceiptDetails = gReceipt.getRows();\n // Calculating total invoice amount in base currency\n KwlReturnObject invoiceTotalAmtInBaseResult=null;\n KwlReturnObject taxTotalAmtInBaseResult=null;\n if (isopeningBalanceInvoice && gReceipt.isConversionRateFromCurrencyToBase()) {// if invoice is opening balance invoice and Conversion rate is taken from user is Currency to base then following method will be called.\n// invoiceTotalAmtInBaseResult = accCurrencyDAOobj.getCurrencyToBaseAmountAccordingToCurrencyToBaseExchangeRate(request, invoiceOriginalAmt, currencyid, creationDate, externalCurrencyRate);\n invoiceTotalAmtInBaseResult = accCurrencyDAOobj.getCurrencyToBaseAmountAccordingToCurrencyToBaseExchangeRate(request, invoiceOriginalAmt, currencyid, gReceipt.getCreationDate(), externalCurrencyRate);\n } else {\n// invoiceTotalAmtInBaseResult = accCurrencyDAOobj.getCurrencyToBaseAmount(request, invoiceOriginalAmt, currencyid, creationDate, externalCurrencyRate);\n invoiceTotalAmtInBaseResult = accCurrencyDAOobj.getCurrencyToBaseAmount(request, invoiceOriginalAmt, currencyid, gReceipt.getCreationDate(), externalCurrencyRate);\n }\n double invoiceTotalAmountInBase=authHandler.round((Double) invoiceTotalAmtInBaseResult.getEntityList().get(0),companyid);\n if (isBadDebtInvoices) {// in case of Malasian Company\n int baddebttype = (Integer) request.get(\"baddebttype\");\n double totalTaxAmt = 0d;\n double totalTaxAmtInBase = 0d;\n String taxId = \"\";\n if (isopeningBalanceInvoice) {\n totalTaxAmt = gReceipt.getTaxamount();\n } else {\n double invoiceLevelTaxAmt = gReceipt.getTaxEntry() == null ? 0 : gReceipt.getTaxEntry().getAmount();\n taxId = gReceipt.getTaxEntry() == null ? \"\" : gReceipt.getTax().getID();\n double rowTaxAmt = 0d;\n for (GoodsReceiptDetail invoiceDetail : goodsReceiptDetails) {\n rowTaxAmt += invoiceDetail.getRowTaxAmount();\n rowTaxAmt += invoiceDetail.getRowTermTaxAmount();\n taxId = (invoiceDetail.getTax() != null) ? invoiceDetail.getTax().getID() : taxId;\n }\n totalTaxAmt = invoiceLevelTaxAmt + rowTaxAmt;\n }\n\n if (totalTaxAmt == 0) {// no need to put invoice in bad debt section if it has tax 0\n continue;\n }\n\n if (isopeningBalanceInvoice) {\n totalTaxAmtInBase = gReceipt.getTaxamountinbase();\n } else {\n taxTotalAmtInBaseResult = accCurrencyDAOobj.getCurrencyToBaseAmount(request, totalTaxAmt, currencyid, gReceipt.getCreationDate(), externalCurrencyRate);\n totalTaxAmtInBase = authHandler.round((Double) taxTotalAmtInBaseResult.getEntityList().get(0), companyid);\n }\n\n// if (baddebttype == 1) {\n // get Paid amount of invoice\n Date badDebtCalculationToDate = null;\n if (request.get(\"badDebtCalculationToDate\") != null) {\n badDebtCalculationToDate = df.parse((String) request.get(\"badDebtCalculationToDate\"));\n }\n KwlReturnObject invoicePaidAmtObj = accPaymentDAOobj.getPaymentFromBadDebtClaimedInvoice(gReceipt.getID(), true, badDebtCalculationToDate);//accPaymentDAOobj.getPaymentAmountofBadDebtGoodsReceipt(gReceipt.getID(),true);\n// double paidAmt = (Double) invoicePaidAmtObj.getEntityList().get(0);\n\n double paidAmt = 0;\n\n List paidList = invoicePaidAmtObj.getEntityList();\n if (paidList != null && !paidList.isEmpty()) {\n Iterator pmtIt = paidList.iterator();\n while (pmtIt.hasNext()) {\n PaymentDetail rd = (PaymentDetail) pmtIt.next();\n\n double paidAmtInPaymentCurrency = rd.getAmount();\n\n// KwlReturnObject bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, paidAmtInPaymentCurrency, rd.getPayment().getCurrency().getCurrencyID(), rd.getPayment().getJournalEntry().getEntryDate(), rd.getPayment().getJournalEntry().getExternalCurrencyRate());\n KwlReturnObject bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, paidAmtInPaymentCurrency, rd.getPayment().getCurrency().getCurrencyID(), rd.getPayment().getCreationDate(), rd.getPayment().getJournalEntry().getExternalCurrencyRate());\n double paidAmtInBase = authHandler.round((Double) bAmt1.getEntityList().get(0), companyid);\n\n paidAmt += paidAmtInBase;\n\n }\n }\n\n // paidAmt should be converted into base currency\n// KwlReturnObject taxObj = accTaxObj.getTaxPercent(companyid, isopeningBalanceInvoice ? gReceipt.getCreationDate() : gReceipt.getJournalEntry().getEntryDate(), taxId);\n KwlReturnObject taxObj = accTaxObj.getTaxPercent(companyid, isopeningBalanceInvoice ? gReceipt.getCreationDate() : gReceipt.getCreationDate(), taxId);\n\n double taxPer = (Double) taxObj.getEntityList().get(0);\n\n// double gstToRecover = paidAmt*taxPer/(100+taxPer);\n // Gst claimable amount\n double grAmountDue = isopeningBalanceInvoice ? gReceipt.getOpeningBalanceAmountDue() : gReceipt.getInvoiceamountdue();\n\n // Converting grAmountDue to base currency\n KwlReturnObject bAmt1 = null;\n String fromcurrencyid = gReceipt.getCurrency().getCurrencyID();\n if (isopeningBalanceInvoice) {\n grAmountDue = gReceipt.getOpeningBalanceBaseAmountDue();\n } else {\n// bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, grAmountDue, fromcurrencyid, gReceipt.getJournalEntry().getEntryDate(), gReceipt.getJournalEntry().getExternalCurrencyRate());\n bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, grAmountDue, fromcurrencyid, gReceipt.getCreationDate(), gReceipt.getJournalEntry().getExternalCurrencyRate());\n grAmountDue = authHandler.round((Double) bAmt1.getEntityList().get(0), companyid);\n }\n\n double gstclaimableamount = 0.0;\n// double gstclaimableamount = grAmountDue * taxPer / (100 + taxPer);\n gstclaimableamount = (totalTaxAmtInBase * grAmountDue) / invoiceTotalAmountInBase;\n gstclaimableamount = authHandler.round(gstclaimableamount, companyid);\n //Calculate Bad Debt Recoverable Amount\n // Get Recovered Amount of invoice\n\n HashMap<String, Object> badMaps = new HashMap<String, Object>();\n badMaps.put(\"companyid\", companyid);\n badMaps.put(\"invoiceid\", invid);\n\n KwlReturnObject badDebtMappingResult = accGoodsReceiptobj.getBadDebtPurchaseInvoiceMappingForGoodsReceipt(badMaps);\n\n Date badDebtClaimedDate = null;\n double totalRecoveredAmt = 0;\n List badDebtMapping = badDebtMappingResult.getEntityList();\n if (!badDebtMapping.isEmpty()) {\n Iterator badIt = badDebtMapping.iterator();\n while (badIt.hasNext()) {\n BadDebtPurchaseInvoiceMapping debtInvoiceMapping = (BadDebtPurchaseInvoiceMapping) badIt.next();\n totalRecoveredAmt += debtInvoiceMapping.getBadDebtAmtRecovered();\n if (debtInvoiceMapping.getBadDebtClaimedDate() != null) {\n badDebtClaimedDate = debtInvoiceMapping.getBadDebtClaimedDate();\n }\n }\n }\n\n // Calculate Recover Amount in base\n if (isopeningBalanceInvoice) {\n if (gReceipt.isConversionRateFromCurrencyToBase()) {\n totalRecoveredAmt = totalRecoveredAmt / gReceipt.getExchangeRateForOpeningTransaction();\n } else {\n totalRecoveredAmt = totalRecoveredAmt * gReceipt.getExchangeRateForOpeningTransaction();\n }\n } else {\n// bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, totalRecoveredAmt, fromcurrencyid, gReceipt.getJournalEntry().getEntryDate(), gReceipt.getJournalEntry().getExternalCurrencyRate());\n bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, totalRecoveredAmt, fromcurrencyid, gReceipt.getCreationDate(), gReceipt.getJournalEntry().getExternalCurrencyRate());\n totalRecoveredAmt = authHandler.round((Double) bAmt1.getEntityList().get(0), companyid);\n }\n\n if (baddebttype == 1) {\n\n// System.out.println(gReceipt.getGoodsReceiptNumber());\n// HashMap<String, Object> hm = new HashMap<String, Object>();\n//\n// hm.put(\"companyid\", companyid);\n// hm.put(\"invoiceId\", gReceipt.getID());\n// // hm.put(\"invoiceId\", invoice.getI);\n//\n// double consumedAmt = accGoodsReceiptCommon.getAmountDueOfGRBeforeClaimedDate(hm);\n// double invoiceOrigAmt = d.getAmount();\n//\n// double remainedAmtBeforeClaim = invoiceOrigAmt - consumedAmt;\n//\n// double claimedGST = remainedAmtBeforeClaim * taxPer/(100+taxPer);\n double claimedGST = 0;\n\n if (!badDebtMapping.isEmpty()) {\n Iterator badIt = badDebtMapping.iterator();\n while (badIt.hasNext()) {\n BadDebtPurchaseInvoiceMapping debtInvoiceMapping = (BadDebtPurchaseInvoiceMapping) badIt.next();\n if (debtInvoiceMapping.getBadDebtType() == 0) {\n claimedGST += debtInvoiceMapping.getBadDebtGSTAmtClaimed();\n }\n }\n }\n\n // converting claimed GST in Base Currency\n// bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, claimedGST, fromcurrencyid, gReceipt.getJournalEntry().getEntryDate(), gReceipt.getJournalEntry().getExternalCurrencyRate());\n bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, claimedGST, fromcurrencyid, gReceipt.getCreationDate(), gReceipt.getJournalEntry().getExternalCurrencyRate());\n claimedGST = authHandler.round((Double) bAmt1.getEntityList().get(0), companyid);\n\n obj.put(\"gstclaimableamount\", claimedGST);\n } else {\n obj.put(\"gstclaimableamount\", gstclaimableamount);\n\n Date selectedCriteriaDate = df.parse((String) request.get(\"selectedCriteriaDate\"));\n int badDebtCriteria = (Integer) request.get(\"badDebtCriteria\");\n\n long diff = 0;\n if (badDebtCriteria == 0 && gReceipt.getDueDate() != null) {// on Invoice Due Date\n diff = selectedCriteriaDate.getTime() - gReceipt.getDueDate().getTime();\n } else if (badDebtCriteria == 1) {// on Invoice Creation Date\n diff = selectedCriteriaDate.getTime() - creationDate.getTime();\n }\n long diffInDays = diff / (24 * 60 * 60 * 1000);\n\n obj.put(\"agingDays\", diffInDays);\n\n }\n\n double gstToRecover = (paidAmt - totalRecoveredAmt) * taxPer / (100 + taxPer);\n double paidAfterClaimed = paidAmt - totalRecoveredAmt;\n\n// obj.put(\"gstclaimableamount\", gstclaimableamount);\n obj.put(\"paidAfterClaimed\", paidAfterClaimed);\n obj.put(\"gstToRecover\", gstToRecover);\n obj.put(\"claimedPeriod\", gReceipt.getClaimedPeriod());\n obj.put(\"badDebtClaimedDate\", (badDebtClaimedDate != null) ? df.format(badDebtClaimedDate) : null);\n\n if (authHandler.round(amountdue, companyid) == 0 && authHandler.round(paidAfterClaimed, companyid) == 0) {// don't put invoices which has amount due zero and whole gst has been recovered\n continue;\n }\n// }\n }\n obj=AccountingAddressManager.getTransactionAddressJSON(obj,gReceipt.getBillingShippingAddresses(),true);\n obj.put(\"sequenceformatid\", gReceipt.getSeqformat() == null ? \"\" : gReceipt.getSeqformat().getID());\n obj.put(\"gstIncluded\", gReceipt.isGstIncluded());\n obj.put(\"selfBilledInvoice\", gReceipt.isSelfBilledInvoice());\n obj.put(\"RMCDApprovalNo\", gReceipt.getRMCDApprovalNo());\n obj.put(\"fixedAssetInvoice\", gReceipt.isFixedAssetInvoice());\n obj.put(\"isConsignment\", gReceipt.isIsconsignment());\n if (gReceipt.isCashtransaction()) {\n obj.put(Constants.IS_PYMENT_STATUS_CLEARED, false);\n PayDetail payDetail = gReceipt.getPayDetail();\n if (payDetail != null) {\n PaymentMethod paymentMethod = payDetail.getPaymentMethod();\n obj.put(\"paymentname\", paymentMethod.getMethodName());\n obj.put(\"methodid\", paymentMethod.getID());\n obj.put(\"detailtype\", paymentMethod.getDetailType());\n if (paymentMethod.getDetailType() == PaymentMethod.TYPE_CARD) {\n Card card = payDetail.getCard();\n obj.put(\"cardno\", card != null ? card.getCardNo() : \"\");\n obj.put(\"nameoncard\", card != null ? card.getCardHolder() : \"\");\n obj.put(\"cardexpirydate\", card != null ? df.format(card.getExpiryDate()) : \"\");\n obj.put(\"cardtype\", card != null ? card.getCardType() : \"\");\n obj.put(\"cardrefno\", card != null ? card.getRefNo() : \"\");\n\n } else if (paymentMethod.getDetailType() == PaymentMethod.TYPE_BANK) {\n Cheque cheque = payDetail.getCheque();\n obj.put(\"chequeno\", cheque != null ? cheque.getChequeNo() : \"\");\n obj.put(\"chequedescription\", cheque != null ? cheque.getDescription() : \"\");\n obj.put(\"bankname\", cheque != null ? cheque.getBankName() : \"\");\n obj.put(\"chequedate\", cheque != null ? df.format(cheque.getDueDate()) : \"\");\n obj.put(\"clearanceDate\", \"\");\n obj.put(\"paymentStatus\", \"Uncleared\");\n if (gReceipt.getPayDetail() != null) {\n KwlReturnObject clearanceDate = accBankReconciliationObj.getBRfromJE(gReceipt.getJournalEntry().getID(), gReceipt.getCompany().getCompanyID(), false);\n if (clearanceDate != null && clearanceDate.getEntityList() != null && clearanceDate.getEntityList().size() > 0) {\n BankReconciliationDetail brd = (BankReconciliationDetail) clearanceDate.getEntityList().get(0);\n if (brd.getBankReconciliation().getClearanceDate() != null) {\n obj.put(\"clearanceDate\", df.format(brd.getBankReconciliation().getClearanceDate()));\n obj.put(\"paymentStatus\", \"Cleared\");\n obj.put(Constants.IS_PYMENT_STATUS_CLEARED, true);// To Disable Feilds in Edit Case for Cleard Cash Payment\n }\n }\n }\n }\n\n } else {\n obj.put(\"paymentname\", \"\");\n obj.put(\"methodid\", \"\");\n }\n } else {\n obj.put(\"paymentname\", \"NA\");\n }\n if (gReceipt.getModifiedby() != null) {\n obj.put(\"lasteditedby\", StringUtil.getFullName(gReceipt.getModifiedby()));\n }\n obj.put(\"createdby\", gReceipt.getCreatedby() == null ? \"\" : StringUtil.getFullName(gReceipt.getCreatedby()));\n if (report) {\n obj.put(\"isreval\", isReval);\n }\n// int pendingApprovalInt = gReceipt.getPendingapproval();\n// obj.put(\"approvalstatusint\", pendingApprovalInt);\n// if (pendingApprovalInt == Constants.LEVEL_ONE) {\n// obj.put(\"approvalstatus\", \"Pending level 1 approval\");\n// } else if (pendingApprovalInt == Constants.LEVEL_TWO) {\n// obj.put(\"approvalstatus\", \"Pending level 2 approval\");\n// } else {\n// obj.put(\"approvalstatus\", \"\");\n// }\n obj.put(\"approvalstatus\", gReceipt.getApprovestatuslevel());\n obj.put(\"isjobworkoutrec\", gReceipt.isIsJobWorkOutInv());\n String approvalStatus=\"\";\n ScriptEngineManager mgr = new ScriptEngineManager();\n ScriptEngine engine = mgr.getEngineByName(\"JavaScript\");\n String multipleRuleids=\"\";\n if(gReceipt.getApprovestatuslevel() < 0){\n approvalStatus=\"Rejected\";\n }else if(gReceipt.getApprovestatuslevel() < 11){\n String ruleid = \"\",userRoleName=\"\";\n HashMap<String, Object> qdDataMap = new HashMap<String, Object>();\n qdDataMap.put(\"companyid\", companyid);\n qdDataMap.put(\"level\",gReceipt.getApprovestatuslevel());\n qdDataMap.put(\"moduleid\", Constants.Acc_Vendor_Invoice_ModuleId);\n KwlReturnObject flowresult = accMultiLevelApprovalDAOObj.getMultiApprovalRuleData(qdDataMap);\n Iterator ruleitr = flowresult.getEntityList().iterator();\n while (ruleitr.hasNext()) {\n Object[] rulerow = (Object[]) ruleitr.next();\n ruleid = rulerow[0].toString();\n boolean sendForApproval = false;\n int appliedUpon = Integer.parseInt(rulerow[5].toString());\n String discountRule = \"\";\n String rule = \"\";\n if (rulerow[2] != null) {\n rule = rulerow[2].toString();\n }\n if (rulerow[7] != null) {\n discountRule = rulerow[7].toString();\n }\n if (appliedUpon == Constants.Total_Amount) {\n /*\n Added to get condition of approval rule i.e set when creating approval rule \n */\n rule = rule.replaceAll(\"[$$]+\", String.valueOf(gReceipt.getInvoiceAmountInBase()));\n } else if (appliedUpon == Constants.Specific_Products || appliedUpon == Constants.Specific_Products_Discount || appliedUpon == Constants.Specific_Products_Category) {\n /*\n Handled for Product,product discount And product category\n */\n HashMap<String, Object> GlobalParams = new HashMap<String, Object>();\n JSONArray productDiscountJArr = new JSONArray();\n Set<GoodsReceiptDetail> grDetails = gReceipt.getRows();\n for (GoodsReceiptDetail grDetail : grDetails) {\n if (grDetail.getInventory() != null) {\n String productId = grDetail.getInventory().getProduct().getID();\n Discount invDiscount = grDetail.getDiscount();\n double discAmountinBase = 0;\n if (invDiscount != null) {\n double discountVal = invDiscount.getDiscountValue();\n KwlReturnObject dAmount = accCurrencyDAOobj.getCurrencyToBaseAmount(request, discountVal, currencyid, gReceipt.getCreationDate(), gReceipt.getExternalCurrencyRate());\n discAmountinBase = (Double) dAmount.getEntityList().get(0);\n }\n discAmountinBase = authHandler.round(discAmountinBase, companyid);\n JSONObject productDiscountObj = new JSONObject();\n productDiscountObj.put(\"productId\", productId);\n productDiscountObj.put(\"discountAmount\", discAmountinBase);\n productDiscountJArr.put(productDiscountObj);\n }\n }\n if (appliedUpon == Constants.Specific_Products || appliedUpon == Constants.Specific_Products_Discount) {\n /*\n * Check If Rule is apply on specefic product\n * and Specific product discount from multiapproverule window\n */\n if (productDiscountJArr != null) {\n sendForApproval = AccountingManager.checkForProductAndProductDiscountRule(productDiscountJArr, appliedUpon, rule, discountRule);\n }\n } else if (appliedUpon == Constants.Specific_Products_Category) {\n /*\n * Check If Rule is apply on product\n * category from multiapproverule window\n */\n sendForApproval = accountingHandlerDAOobj.checkForProductCategoryForProduct(productDiscountJArr, appliedUpon, rule);\n }\n }\n /*\n Added to check if record falls in total amount approval rule \n */\n if (StringUtil.isNullOrEmpty(rule) || sendForApproval || (!StringUtil.isNullOrEmpty(rule) && appliedUpon == Constants.Total_Amount && Boolean.parseBoolean(engine.eval(rule).toString()))) {\n multipleRuleids += ruleid + \",\";\n }\n }\n /*\n Added to get multiple ruleid if record falls in multiple approval rule \n */\n String[] multipleRuleidsArray = multipleRuleids.split(\",\");\n for (int multiRule = 0; multiRule < multipleRuleidsArray.length; multiRule++) {\n ruleid = multipleRuleidsArray[multiRule];\n if (!StringUtil.isNullOrEmpty(ruleid)) {\n qdDataMap.put(\"ruleid\", ruleid);\n KwlReturnObject userResult = accMultiLevelApprovalDAOObj.getApprovalRuleTargetUsers(qdDataMap);\n Iterator useritr = userResult.getEntityList().iterator();\n while (useritr.hasNext()) {\n Object[] userrow = (Object[]) useritr.next();\n String userId = userrow[0].toString();\n\n String fname = userrow[1].toString();\n String lname = userrow[2].toString();\n String userName = fname+\" \"+lname;\n /*\n Addded so duplicate approve's can be eleminated \n */\n if(userRoleName.contains(userName)){\n continue;\n }\n KwlReturnObject kmsg = null;\n String roleName=\"Company User\";\n kmsg = permissionHandlerDAOObj.getRoleofUser(userId);\n Iterator ite2 = kmsg.getEntityList().iterator();\n while (ite2.hasNext()) {\n Object[] row = (Object[]) ite2.next();\n roleName = row[1].toString();\n }\n userRoleName += roleName+\" \"+userName + \",\";\n }\n }\n }\n if (!StringUtil.isNullOrEmpty(userRoleName)) {\n userRoleName = userRoleName.substring(0, userRoleName.length() - 1);\n }\n approvalStatus=\"Pending Approval\" + ( StringUtil.isNullOrEmpty(userRoleName) ? \"\" : \" by \"+userRoleName )+\" at Level - \"+gReceipt.getApprovestatuslevel();\n } else {\n approvalStatus=\"Approved\";\n }\n obj.put(\"approvalstatusinfo\",approvalStatus);\n\n if (request.containsKey(\"pendingapproval\") && request.get(\"pendingapproval\") != null && (Boolean) request.containsKey(\"pendingapproval\")) {\n int nextApprovalLevel = 11;\n HashMap<String, Object> qdDataMap = new HashMap<String, Object>();\n qdDataMap.put(\"companyid\", companyid);\n qdDataMap.put(\"level\", gReceipt.getApprovestatuslevel() + 1);\n qdDataMap.put(\"moduleid\", Constants.Acc_Vendor_Invoice_ModuleId);\n KwlReturnObject flowresult = accMultiLevelApprovalDAOObj.getMultiApprovalRuleData(qdDataMap);\n List<Object[]> approvalRuleItr = flowresult.getEntityList();\n if (approvalRuleItr != null && approvalRuleItr.size() > 0) {\n for (Object[] rowObj : approvalRuleItr) {\n String rule = \"\";\n if (rowObj[2] != null) {\n rule = rowObj[2].toString();\n }\n int appliedUpon = Integer.parseInt(rowObj[5].toString());\n rule = rule.replaceAll(\"[$$]+\", String.valueOf(gReceipt.getInvoiceAmountInBase()));\n if (StringUtil.isNullOrEmpty(rule) || (!StringUtil.isNullOrEmpty(rule) && ( appliedUpon != Constants.Specific_Products && appliedUpon != Constants.Specific_Products_Discount && appliedUpon != Constants.Specific_Products_Category) && Boolean.parseBoolean(engine.eval(rule).toString()))) {\n nextApprovalLevel = gReceipt.getApprovestatuslevel() + 1;\n }\n }\n }\n obj.put(\"isFinalLevelApproval\", nextApprovalLevel == Constants.APPROVED_STATUS_LEVEL ? true : false);\n }\n /*\n * For Product search, add Products details from Invoice\n * details\n */\n\n if (isProduct && gReceipt.isNormalInvoice()) {\n String idvString = isProduct ? oj[4].toString() : \"\"; //as in list invoiedetail id comes 4th\n KwlReturnObject objItrGRD = accountingHandlerDAOobj.getObject(GoodsReceiptDetail.class.getName(), idvString);\n GoodsReceiptDetail idvObj = (GoodsReceiptDetail) objItrGRD.getEntityList().get(0);\n if (idvObj != null) {\n obj.put(\"rowproductname\", idvObj.getInventory().getProduct().getName());\n obj.put(\"rowquantity\", idvObj.getInventory().isInvrecord() ? idvObj.getInventory().getQuantity() : idvObj.getInventory().getActquantity());\n obj.put(\"rowrate\", idvObj.getRate());\n\n Discount disc = idvObj.getDiscount();\n if (disc != null && disc.isInPercent()) {\n obj.put(\"rowprdiscount\", disc.getDiscount()); //product discount in percent\n } else {\n obj.put(\"rowprdiscount\", 0);\n }\n\n double rowTaxPercent = 0;\n if (idvObj.getTax() != null) {\n// KwlReturnObject perresult = accTaxObj.getTaxPercent(companyid, gReceipt.getJournalEntry().getEntryDate(), idvObj.getTax().getID());\n KwlReturnObject perresult = accTaxObj.getTaxPercent(companyid, gReceipt.getCreationDate(), idvObj.getTax().getID());\n rowTaxPercent = (Double) perresult.getEntityList().get(0);\n }\n obj.put(\"rowprtaxpercent\", rowTaxPercent);\n }\n }\n\n //For getting tax in percent applyied on invoice [PS]\n if (gReceipt.getTax() != null) {\n// KwlReturnObject taxresult = accTaxObj.getTaxPercent(companyid, je.getEntryDate(), gReceipt.getTax().getID());\n KwlReturnObject taxresult = accTaxObj.getTaxPercent(companyid, gReceipt.getCreationDate(), gReceipt.getTax().getID());\n taxPercent = (Double) taxresult.getEntityList().get(0);\n }\n obj.put(GoodsReceiptCMNConstants.TAXPERCENT, taxPercent);\n\n //For getting amountdue [PS]\n if (gReceipt.isCashtransaction()) {\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUEINBASE, 0);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE, 0);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUENONNEGATIVE, 0);\n obj.put(GoodsReceiptCMNConstants.INCASH, true);\n } else {\n if ((Constants.InvoiceAmountDueFlag && !isAged) || isopeningBalanceInvoice) {\n if (isopeningBalanceInvoice && gReceipt.isConversionRateFromCurrencyToBase()) {// if invoice is opening balance invoice and Conversion rate is taken from user is Currency to base then following method will be called.\n// bAmt = accCurrencyDAOobj.getCurrencyToBaseAmountAccordingToCurrencyToBaseExchangeRate(request, amountdue, currencyid, creationDate, externalCurrencyRate);\n bAmt = accCurrencyDAOobj.getCurrencyToBaseAmountAccordingToCurrencyToBaseExchangeRate(request, amountdue, currencyid, gReceipt.getCreationDate(), externalCurrencyRate);\n } else {\n// bAmt = accCurrencyDAOobj.getCurrencyToBaseAmount(request, amountdue, currencyid, creationDate, externalCurrencyRate);\n bAmt = accCurrencyDAOobj.getCurrencyToBaseAmount(request, amountdue, currencyid, gReceipt.getCreationDate(), externalCurrencyRate);\n }\n amountInBase = (Double) bAmt.getEntityList().get(0);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUEINBASE, authHandler.round((Double) bAmt.getEntityList().get(0), companyid));\n } else { // For aged we are fetching amount in base as well so no need for calculation\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUEINBASE, amountdueinbase);\n }\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE, authHandler.round(amountdue, companyid));\n /*\n * To calulate exchange rate\n */\n obj.put(\"exchangeratefortransaction\", (amountInBase <= 0 && amountdue <= 0) ? 0 : (amountInBase / amountdue));\n\n if (booleanAged) {//Added for aged payable/receivable\n int datefilter = (request.containsKey(\"datefilter\") && request.get(\"datefilter\") != null) ? Integer.parseInt(request.get(\"datefilter\").toString()) : 0;// 0 = Invoice Due date OR 1 = Invoice date\n Date dueDate = null;\n if (!StringUtil.isNullOrEmpty(df.format(gReceipt.getDueDate()))) {\n dueDate = df.parse(df.format(gReceipt.getDueDate()));\n }\n if (datefilter == 0 || datefilter == Constants.agedDueDate0to30Filter) {\n dueDate = df.parse(df.format(gReceipt.getDueDate()));\n } else {\n dueDate = df.parse(df.format(creationDate));\n }\n// if(startDate!=null && dueDate.before(startDate)){//In Aged Report amountdue goes in Accruade Balance for those transaction whose creation/due date is previous to Start date will goes into the accrued balance, likes opening balance \n// accruedbalance = authHandler.round(amountdue, companyid);\n// } else\n if (dueDate.after(oneDayBeforeCal1Date)) {\n if (dueDate.equals(cal1Date) && (datefilter == Constants.agedDueDate0to30Filter || datefilter == Constants.agedInvoiceDate0to30Filter)) {\n amountdue2 = authHandler.round(amountdue, companyid); // 0-30 Days\n } else {\n amountdue1 = authHandler.round(amountdue, companyid); // Current\n }\n } else if ((cal2Date.before(dueDate) || cal2Date.equals(dueDate)) && cal1Date.after(dueDate)) { // 1-30\n amountdue2 = authHandler.round(amountdue, companyid);\n } else if ((cal3Date.before(dueDate) || cal3Date.equals(dueDate)) && cal2Date.after(dueDate)) { // 31-60\n amountdue3 = authHandler.round(amountdue, companyid);\n } else if ((cal4Date.before(dueDate) || cal4Date.equals(dueDate)) && cal3Date.after(dueDate)) { // 61-90\n amountdue4 = authHandler.round(amountdue, companyid);\n } else if ((cal5Date.before(dueDate) || cal5Date.equals(dueDate)) && cal4Date.after(dueDate)) { // 91-120\n amountdue5 = authHandler.round(amountdue, companyid);\n } else if ((cal6Date.before(dueDate) || cal6Date.equals(dueDate)) && cal5Date.after(dueDate)) { // 121-150\n amountdue6 = authHandler.round(amountdue, companyid);\n } else if ((cal7Date.before(dueDate) || cal7Date.equals(dueDate)) && cal6Date.after(dueDate)) { // 151-180\n amountdue7 = authHandler.round(amountdue, companyid);\n } else if ((cal8Date.before(dueDate) || cal8Date.equals(dueDate)) && cal7Date.after(dueDate)) { // 181-210\n amountdue8 = authHandler.round(amountdue, companyid);\n } else if ((cal9Date.before(dueDate) || cal9Date.equals(dueDate)) && cal8Date.after(dueDate)) { // 211-240\n amountdue9 = authHandler.round(amountdue, companyid);\n } else if ((cal10Date.before(dueDate) || cal10Date.equals(dueDate)) && cal9Date.after(dueDate)) { // 241-270\n amountdue10 = authHandler.round(amountdue, companyid);\n } else { // > 270 \n amountdue11 = authHandler.round(amountdue, companyid);\n }\n \n switch(noOfInterval){\n case 2:\n amountdue3 += amountdue4 + amountdue5 + amountdue6 + amountdue7 + amountdue8 + amountdue9 + amountdue10 + amountdue11;\n amountdue4 = amountdue5 = amountdue6 = amountdue7 = amountdue8 = amountdue9 = amountdue10 = amountdue11 = 0;\n break;\n case 3:\n amountdue4 += amountdue5 + amountdue6 + amountdue7 + amountdue8 + amountdue9 + amountdue10 + amountdue11;\n amountdue5 = amountdue6 = amountdue7 = amountdue8 = amountdue9 = amountdue10 = amountdue11 = 0;\n break;\n case 4:\n amountdue5 += amountdue6 + amountdue7 + amountdue8 + amountdue9 + amountdue10 + amountdue11;\n amountdue6 = amountdue7 = amountdue8 = amountdue9 = amountdue10 = amountdue11 = 0;\n break;\n case 5:\n amountdue6 += amountdue7 + amountdue8 + amountdue9 + amountdue10 + amountdue11;\n amountdue7 = amountdue8 = amountdue9 = amountdue10 = amountdue11 = 0;\n break;\n case 6:\n amountdue7 += amountdue8 + amountdue9 + amountdue10 + amountdue11;\n amountdue8 = amountdue9 = amountdue10 = amountdue11 = 0;\n break;\n case 7:\n amountdue8 += amountdue9 + amountdue10 + amountdue11;\n amountdue9 = amountdue10 = amountdue11 = 0;\n break;\n case 8:\n amountdue9 += amountdue10 + amountdue11;\n amountdue10 = amountdue11 = 0;\n break;\n case 9:\n amountdue10 += amountdue11;\n amountdue11 = 0;\n break;\n }\n }\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUENONNEGATIVE, (amountdue <= 0) ? 0 : authHandler.round(amountdue, companyid));\n }\n boolean includeprotax = false;\n String taxname=\"\";\n double rowTaxAmt = 0d, rowOtherTermNonTaxableAmount = 0;\n boolean isLineLevelTermFlag = false;//To Check Whether LinelevelTerms are applicable or not.\n if(extraCompanyPreferences != null && extraCompanyPreferences.getLineLevelTermFlag()==1){\n isLineLevelTermFlag = true;//If LineLevelTerms are applicable, then update the flag.\n }\n double subtotal=0.0;\n double productTotalAmount=0.0;\n double discountAmount = 0.0;\n// double taxAmountOfTerms=0d;\n if (!gReceipt.isIsExpenseType() && gReceipt.isNormalInvoice()) {\n// Set<GoodsReceiptDetail> goodsReceiptDetails = gReceipt.getRows();\n for (GoodsReceiptDetail goodsReceiptDetail : goodsReceiptDetails) {\n double rowsubtotal = 0d;\n double invquantity = goodsReceiptDetail.getInventory().getQuantity();\n if (goodsReceiptDetail.getGoodsReceipt().isGstIncluded()) {\n rowsubtotal = goodsReceiptDetail.getRateincludegst() * invquantity;\n } else {\n rowsubtotal = goodsReceiptDetail.getRate() * invquantity;\n }\n /**\n * Getting the Discount Value(Amount) and\n * subtracting from subtotal.\n */\n Discount disc = goodsReceiptDetail.getDiscount();\n if (disc != null) {\n discountAmount += disc.getDiscountValue();\n }\n productTotalAmount += authHandler.round(rowsubtotal, companyid);\n if(isLineLevelTermFlag){\n // Append OtherTermNonTaxableAmount for rach row.\n rowOtherTermNonTaxableAmount += goodsReceiptDetail.getOtherTermNonTaxableAmount();\n rowTaxAmt += goodsReceiptDetail.getRowTermAmount();\n rowTaxAmt += goodsReceiptDetail.getRowTermTaxAmount();\n// taxAmountOfTerms += goodsReceiptDetail.getRowTermTaxAmount();\n }else if (goodsReceiptDetail.getTax() != null) {\n includeprotax = true;\n taxname += goodsReceiptDetail.getTax().getName() + \", \";\n rowTaxAmt += goodsReceiptDetail.getRowTaxAmount();\n// rowTaxAmt += goodsReceiptDetail.getRowTermTaxAmount();\n// taxAmountOfTerms += goodsReceiptDetail.getRowTermTaxAmount();\n }\n }\n } else if (gReceipt.isIsExpenseType()) {\n Set<ExpenseGRDetail> expenseGRDetails = gReceipt.getExpenserows();\n for (ExpenseGRDetail expGReceiptDetail : expenseGRDetails) {\n if (!expGReceiptDetail.getGoodsReceipt().isGstIncluded()) {\n productTotalAmount += expGReceiptDetail.isIsdebit() ? expGReceiptDetail.getRate() : -(expGReceiptDetail.getRate());\n } else {\n productTotalAmount += expGReceiptDetail.isIsdebit() ? expGReceiptDetail.getRate() : -(expGReceiptDetail.getRate());\n // productTotalAmount +=expGReceiptDetail.getRate();\n }\n /**\n * Getting the Discount Value(Amount) and\n * subtracting from subtotal.(ERP-38123)\n */\n Discount disc = expGReceiptDetail.getDiscount();\n if (disc != null) {\n if (expGReceiptDetail.isIsdebit()) {\n discountAmount += disc.getDiscountValue();\n } else {\n discountAmount -= disc.getDiscountValue();\n }\n }\n// System.out.println(expGReceiptDetail.getGoodsReceipt().getGoodsReceiptNumber());\n if (expGReceiptDetail.getTax() != null) {\n includeprotax = true;\n taxname += expGReceiptDetail.getTax().getName() + \", \";\n rowTaxAmt += expGReceiptDetail.isIsdebit()?expGReceiptDetail.getRowTaxAmount():-(expGReceiptDetail.getRowTaxAmount());// SDP- 4676 PO/PI Expense type records to show tax amount in report\n }\n }\n }\n obj.put(\"productTotalAmount\", productTotalAmount); \n double termTaxAmount = 0d;\n double termAmountInBase = 0d;\n double termAmount = 0d;\n List receiptTermMapList = kwlCommonTablesDAOObj.getSummationOfTermAmtAndTermTaxAmt(Constants.receipttermsmap, invid);\n if(receiptTermMapList != null && !receiptTermMapList.isEmpty()){\n Iterator termItr = receiptTermMapList.iterator();\n while (termItr.hasNext()) {\n Object[] termObj = (Object[]) termItr.next();\n /* \n * [0] : Sum of termamount \n * [1] : Sum of termamountinbase \n * [2] : Sum of termTaxamount \n * [3] : Sum of termTaxamountinbase \n * [4] : Sum of termamountexcludingtax \n * [5] : Sum of termamountexcludingtaxinbase\n */ \n if (gReceipt.isGstIncluded()) {\n if(termObj[4] != null && termObj[5] != null){\n termAmount += authHandler.round((Double) termObj[4],companyid);\n termAmountInBase += authHandler.round((Double) termObj[5],companyid);\n }\n } else {\n if(termObj[0] != null && termObj[1] != null){\n termAmount += authHandler.round((Double) termObj[0],companyid);\n termAmountInBase += authHandler.round((Double) termObj[1],companyid);\n }\n }\n if(termObj[2] != null){\n termTaxAmount += authHandler.round((Double) termObj[2],companyid);\n }\n }\n }\n \n taxAmt += rowTaxAmt + termTaxAmount;\n if (gReceipt.isGstIncluded()) {\n subtotal = productTotalAmount - discountAmount - rowTaxAmt;\n } else {\n subtotal = productTotalAmount - discountAmount;\n }\n obj.put(\"subtotal\", subtotal);\n obj.put(\"termamount\", termAmount);\n obj.put(\"termamountinBase\", termAmountInBase);\n obj.put(\"amountBeforeTax\", authHandler.formattingDecimalForAmount((subtotal+termAmount),companyid));\n double tdsAmountandOtherCharges = 0.0;\n if (Constants.indian_country_id == countryid) { // For india Company\n tdsAmountandOtherCharges = gReceipt.getTdsAmount() - rowOtherTermNonTaxableAmount;\n obj.put(\"totalAmountWithTDS\", authHandler.round(invoiceOriginalAmt + gReceipt.getTdsAmount(), companyid)); // Amount with TDS\n }\n// obj.put(\"amountbeforegst\", authHandler.round(invoiceOriginalAmt-taxAmt-termAmount+tdsAmountandOtherCharges, 2)); // Amount before both kind of tax row level or transaction level\n obj.put(\"amountbeforegst\", gReceipt.getExcludingGstAmount());\n obj.put(GoodsReceiptCMNConstants.TAXAMOUNT, taxAmt);\n\n //*** For GTA - Start***//\n if (Constants.indian_country_id == countryid && gReceipt.isGtaapplicable() && !gReceipt.isIsExciseInvoice() && taxAmt > 0) { // exclude service tax from totaltax on grid\n obj.put(\"amountbeforegst\", authHandler.round(invoiceOriginalAmt - (taxAmt) - termAmount + tdsAmountandOtherCharges, companyid)); // Amount before both kind of tax row level or transaction level\n }\n //*** For GTA - END***//\n\n if (isLineLevelTermFlag) {\n // If LineLevelTerm is applicable then add the value in JSON Object.\n obj.put(Constants.OtherTermNonTaxableAmount, rowOtherTermNonTaxableAmount);\n }\n// obj.put(\"taxamountinbase\", accCurrencyDAOobj.getCurrencyToBaseAmount(request, taxAmt, currencyid, creationDate, externalCurrencyRate).getEntityList().get(0));\n obj.put(\"taxamountinbase\", gReceipt.getTaxamountinbase());\n// obj.put(\"taxamountsaved\", gReceipt.getTaxamount());\n// obj.put(\"taxamountinbasesaved\", gReceipt.getTaxamountinbase());\n// obj.put(\"excludinggstamountsaved\", gReceipt.getExcludingGstAmount());\n// obj.put(\"excludinggstamountinbasesaved\", gReceipt.getExcludingGstAmountInBase());\n if (includeprotax) {\n obj.put(GoodsReceiptCMNConstants.TAXNAME, taxname.substring(0, taxname.length() > 1 ? taxname.length() - 2 : taxname.length()));\n } else {\n obj.put(GoodsReceiptCMNConstants.TAXNAME, gReceipt.getTax() == null ? \"\" : gReceipt.getTax().getName());\n }\n\n obj.put(\"includeprotax\", includeprotax);\n obj.put(GoodsReceiptCMNConstants.AMOUNT, authHandler.round((Double)invoiceOriginalAmt,companyid)); //actual invoice amount\n obj.put(GoodsReceiptCMNConstants.AMOUNTINBASE, invoiceTotalAmountInBase);\n obj.put(GoodsReceiptCMNConstants.ACCOUNTNAMES, (String) ll.get(2));\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE1, amountdue1);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE2, amountdue2);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE3, amountdue3);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE4, amountdue4);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE5, amountdue5);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE6, amountdue6);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE7, amountdue7);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE8, amountdue8);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE9, amountdue9);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE10, amountdue10);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE11, amountdue11);\n// obj.put(GoodsReceiptCMNConstants.ACCRUEDBALANCE, accruedbalance);\n obj.put(GoodsReceiptCMNConstants.TYPE, \"Purchase Invoice\");\n obj.put(GoodsReceiptCMNConstants.DEDUCTDISCOUNT, deductDiscount);\n\n KwlReturnObject custumObjresult = null;\n if (gReceipt.isNormalInvoice()) {\n// boolean isExport = (request.get(\"isExport\") == null) ? false : (Boolean) request.get(\"isExport\");\n Map<String, Object> variableMap = new HashMap<String, Object>();\n custumObjresult = accountingHandlerDAOobj.getObject(AccJECustomData.class.getName(), je.getID());\n replaceFieldMap = new HashMap<String, String>();\n if (custumObjresult != null && custumObjresult.getEntityList().size() > 0) {\n AccJECustomData jeDetailCustom = (AccJECustomData) custumObjresult.getEntityList().get(0);\n if (jeDetailCustom != null) {\n AccountingManager.setCustomColumnValues(jeDetailCustom, FieldMap, replaceFieldMap, variableMap);\n JSONObject params = new JSONObject();\n params.put(\"companyid\", companyid);\n params.put(Constants.userdf,userDateFormat);\n if (!isExport) {\n isExport = (request.get(\"isAgedPayables\") == null) ? false : (Boolean) request.get(\"isAgedPayables\");\n }\n params.put(\"isExport\", isExport);\n// if (request.containsKey(\"browsertz\") && request.get(\"browsertz\") != null) {\n// params.put(\"browsertz\", request.get(\"browsertz\").toString());\n// }\n fieldDataManagercntrl.addCustomData(variableMap, customFieldMap, customDateFieldMap, obj, params);\n }\n }\n \n \n if (booleanAged ) \n {\n if (!request.containsKey(\"isAgedPayables\") || !(Boolean) request.get(\"isAgedPayables\")) {\n accGoodsReceiptServiceDAO.getCustmDataForPurchaseInvoice(request, jArr, companyid, replaceFieldMap, customFieldMap, customDateFieldMap, FieldMap, replaceFieldMapRows, customFieldMapRows, customDateFieldMapRows, fieldMapRows);\n //getPurchaseInvoiceCustomField(gReceipt,goodsReceiptDetails,fieldMapRows,replaceFieldMapRows,customFieldMapRows,customDateFieldMapRows,obj,userDateFormat);\n }\n }\n }\n RepeatedInvoices repeatedInvoice = gReceipt.getRepeateInvoice();\n obj.put(\"isRepeated\", repeatedInvoice == null ? false : true);\n if (repeatedInvoice != null) {\n obj.put(\"repeateid\", repeatedInvoice.getId());\n obj.put(\"interval\", repeatedInvoice.getIntervalUnit());\n obj.put(\"intervalType\", repeatedInvoice.getIntervalType());\n SimpleDateFormat sdf = new SimpleDateFormat(\"MMMM d, yyyy hh:mm:ss aa\");\n // sdf.setTimeZone(TimeZone.getTimeZone(\"GMT\"+sessionHandlerImpl.getTimeZoneDifference(request)));\n obj.put(\"NoOfpost\", repeatedInvoice.getNoOfInvoicespost());\n obj.put(\"NoOfRemainpost\", repeatedInvoice.getNoOfRemainInvoicespost());\n obj.put(\"startDate\", sdf.format(repeatedInvoice.getStartDate()));\n obj.put(\"nextDate\", sdf.format(repeatedInvoice.getNextDate()));\n obj.put(\"isactivate\", repeatedInvoice.isIsActivate());\n obj.put(\"ispendingapproval\", repeatedInvoice.isIspendingapproval());\n obj.put(\"approver\", repeatedInvoice.getApprover());\n obj.put(\"expireDate\", repeatedInvoice.getExpireDate() == null ? \"\" : sdf.format(repeatedInvoice.getExpireDate()));\n obj.put(\"advancedays\", repeatedInvoice.getAdvanceNoofdays()== 0 ? 0 : repeatedInvoice.getAdvanceNoofdays());\n obj.put(\"advanceDate\", repeatedInvoice.getInvoiceAdvanceCreationDate()== null ? \"\" : sdf.format(repeatedInvoice.getInvoiceAdvanceCreationDate()));\n request.put(\"parentInvoiceId\", gReceipt.getID());\n KwlReturnObject details = accGoodsReceiptobj.getRepeateVendorInvoicesDetails(request);\n List detailsList = details.getEntityList();\n obj.put(\"childCount\", detailsList.size());\n }\n \n\n if (gReceipt.isIsOpeningBalenceInvoice()) {\n Map<String, Object> variableMap = new HashMap<String, Object>();\n custumObjresult = accountingHandlerDAOobj.getObject(OpeningBalanceVendorInvoiceCustomData.class.getName(), gReceipt.getID());\n replaceFieldMap = new HashMap<String, String>();\n if (custumObjresult != null && custumObjresult.getEntityList().size() > 0) {\n OpeningBalanceVendorInvoiceCustomData openingBalanceVendorInvoiceCustomData = (OpeningBalanceVendorInvoiceCustomData) custumObjresult.getEntityList().get(0);\n if (openingBalanceVendorInvoiceCustomData != null) {\n AccountingManager.setCustomColumnValues(openingBalanceVendorInvoiceCustomData, FieldMap, replaceFieldMap, variableMap);\n DateFormat defaultDateFormat=new SimpleDateFormat(Constants.MMMMdyyyy);\n Date dateFromDB=null;\n for (Map.Entry<String, Object> varEntry : variableMap.entrySet()) {\n String coldata = varEntry.getValue() != null ? varEntry.getValue().toString() : \"\";\n if (customFieldMap.containsKey(varEntry.getKey())) {\n KwlReturnObject rdresult = accountingHandlerDAOobj.getObject(FieldComboData.class.getName(), coldata);\n FieldComboData fieldComboData = (FieldComboData) rdresult.getEntityList().get(0);\n if (fieldComboData != null) {\n obj.put(varEntry.getKey(), fieldComboData.getValue() != null ? fieldComboData.getValue() : \"\");\n }\n } else if (customDateFieldMap.containsKey(varEntry.getKey())) {\n DateFormat sdf = userDateFormat != null?userDateFormat:new SimpleDateFormat(\"yyyy-MM-dd\");\n dateFromDB=defaultDateFormat.parse(coldata);\n coldata=sdf.format(dateFromDB);\n obj.put(varEntry.getKey(), coldata);\n } else {\n if (!StringUtil.isNullOrEmpty(coldata)) {\n obj.put(varEntry.getKey(), coldata);\n }\n }\n }\n }\n }\n }\n try { // check if credit/cash purchase is allowed to edit\n // isAllowToEdit= if credit/cash purchase created using auto generate GR option and credit/cash purchase/GR hasn't been forward linked in any document\n result = accGoodsReceiptobj.getAutoGRFromInvoice(gReceipt.getID(), companyid);\n list = result.getEntityList();\n if (list != null && !list.isEmpty()) { // SI/CS created with auto generate DO option\n boolean isDOLinkedInPR = false;\n String groID = \"\";\n Object groid = list.get(0);\n groID = (String) groid;\n KwlReturnObject resultPR = accGoodsReceiptobj.getPurchaseReturnLinkedWithGR(groID, companyid);\n List listPR = resultPR.getEntityList();\n if (!listPR.isEmpty()) { // is DO forward linked in any SR\n isDOLinkedInPR = true;\n }\n if (!isDOLinkedInPR && obj.optDouble(GoodsReceiptCMNConstants.AMOUNTDUEINBASE, 0.0) == obj.optDouble(GoodsReceiptCMNConstants.AMOUNTINBASE, 0.0) && !gReceipt.isCashtransaction()) {\n obj.put(Constants.IS_INVOICE_ALLOW_TO_EDIT, true);\n } else if (gReceipt.isCashtransaction() && !isDOLinkedInPR) {\n obj.put(Constants.IS_INVOICE_ALLOW_TO_EDIT, true);\n } else {\n obj.put(Constants.IS_INVOICE_ALLOW_TO_EDIT, false);\n }\n } else {\n obj.put(Constants.IS_INVOICE_ALLOW_TO_EDIT, false);\n }\n if (!StringUtil.isNullOrEmpty(landedInvoice)) {\n obj.put(Constants.IS_INVOICE_ALLOW_TO_EDIT, false);\n }\n } catch (Exception ex) {\n Logger.getLogger(AccGoodsReceiptServiceImpl.class.getName()).log(Level.WARNING, ex.getMessage());\n obj.put(Constants.IS_INVOICE_ALLOW_TO_EDIT, false);\n }\n if (!(ignoreZero && authHandler.round(amountdue, companyid) <= 0)) {\n jArr.put(obj);\n }\n }\n }\n }\n } catch (Exception ex) {\n throw ServiceException.FAILURE(\"AccGoodsReceiptServiceHandler.getGoodsReceiptsJson : \" + ex.getMessage(), ex);\n }\n return jArr;\n }", "public void modifyPayment(Payment[] paymentArr) {\n \t for(int j =0;j<paymentNum;j++) {\n \t\t ((JSONObject)items.get(j)).put(\"availability\",paymentArr[j].getAvailability());\n \t }\n \t try {\n FileWriter fw = new FileWriter(jsonFile);\n PrintWriter pw = new PrintWriter(fw);\n \n String str[] = Data.toString().split(\",\");\n int i;\n for(i=0; i<str.length-1; i++) {\n pw.println(str[i]+\",\");\n }\n pw.println(str[i]);\n pw.close();\n fw.close();\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n }", "private OSPARRecords parseExcelFile(String excelFilePath) {\n\n\t\ttry {\n\n\t\t\tGsonBuilder builder = new GsonBuilder();\n\t\t\tbuilder.setPrettyPrinting();\n\t\t\tGson gson = builder.create();\n\t\t\t\n\t\t\t\n\t\t\tOSPARRecords or = new OSPARRecords();\n\n\t\t\tFile file = new File(excelFilePath);\n\t\t\tFileInputStream inputStream = new FileInputStream(new File(excelFilePath));\n\n\t\t\tWorkbook workbook = new HSSFWorkbook(inputStream);\n\t\t\tSheet firstSheet = workbook.getSheetAt(0);\n\n\t\t\tint row = 0;\n\n\t\t\tDataFormatter formatter = new DataFormatter();\n\t\t\t\n\t\t\t\n\t\t\twhile (true) {\n\t\t\t\tRow nextRow = firstSheet.getRow(row);\n\n\t\t\t\tif (nextRow == null) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tString value=nextRow.getCell(0)+\"\";\n\t\t\t\t\n\t\t\t\tif (value.equals(\"\")) {\n\t\t\t\t\t\n\t\t\t\t\tString v3=nextRow.getCell(3)+\"\";\n\t\t\t\t\t\n\t\t\t\t\tif (!v3.equals(\"Source/Reference\")) {\n\t\t\t\t\t\tSystem.out.println(excelFilePath+\"\\t\"+or.CasNo+\"\\t\"+v3+\"\\t\"+value);\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\trow++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (value.equals(\"null\")) break;\n\t\t\t\t\n\t\t\t\tfloat fvalue=Float.parseFloat(value);\n\t\t\t\tDecimalFormat decform=new DecimalFormat(\"0.0\");\n\t\t\t\tString svalue=decform.format(fvalue);\n\t\t\t\t\n//\t\t\t\tSystem.out.println(or.CasNo+\"\\t\"+svalue);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tdata_field df = createDataField(nextRow);\n\t\t\t\t\n\t\t\t\tif (df.Value.equals(\"\") && df.Source_Reference.equals(\"\")) {\n\t\t\t\t\trow++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t\tif (svalue.equals(\"0.0\")) \n\t\t\t\t\tor.Name=df.Value;\n\t\t\t\tif (svalue.equals(\"1.1\"))\n\t\t\t\t\tor.CasNo=convertCAS(df.Value);\n\t\t\t\tif (svalue.equals(\"1.2\"))\n\t\t\t\t\tor.EINECS=df.Value;\n\t\t\t\tif (svalue.equals(\"1.3\"))\n\t\t\t\t\tor.Synonym=df.Value;\n\t\t\t\tif (svalue.equals(\"1.4\"))\n\t\t\t\t\tor.Group_Function=df.Value;\n\t\t\t\tif (svalue.equals(\"1.5\"))\n\t\t\t\t\tor.Initial_Selection=df.Value;\n\t\t\t\tif (svalue.equals(\"1.6\"))\n\t\t\t\t\tor.Prioritized_For_Action=df.Value;\n\n\t\t\t\tif (svalue.equals(\"2.1\"))\n\t\t\t\t\tor.Molecular_weight.add(df);\n\t\t\t\tif (svalue.equals(\"2.2\"))\n\t\t\t\t\tor.Water_Solubility.add(df);\n\t\t\t\tif (svalue.equals(\"2.3\"))\n\t\t\t\t\tor.Vapor_Pressure.add(df);\n\n\t\t\t\tif (svalue.equals(\"3.1\"))\n\t\t\t\t\tor.Abiotic_OH_Oxidation_t1_2_d.add(df);\n\t\t\t\tif (svalue.equals(\"3.2\"))\n\t\t\t\t\tor.Photolysis_t1_2_d.add(df);\n\t\t\t\tif (svalue.equals(\"3.3\"))\n\t\t\t\t\tor.Ready_Biodegradability.add(df);\n\t\t\t\tif (svalue.equals(\"3.4\"))\n\t\t\t\t\tor.Halflife.add(df);\n\t\t\t\tif (svalue.equals(\"3.5\"))\n\t\t\t\t\tor.Inherent_Biodegradability.add(df);\n\t\t\t\tif (svalue.equals(\"3.6\"))\n\t\t\t\t\tor.Biodeg_QSAR.add(df);\n\t\t\t\t\n\t\t\t\tif (svalue.equals(\"4.1\"))\n\t\t\t\t\tor.logKow.add(df);\n\t\t\t\tif (svalue.equals(\"4.2\"))\n\t\t\t\t\tor.Bcf.add(df);\n\n\t\t\t\tif (svalue.equals(\"5.1\"))\n\t\t\t\t\tor.Acute_toxicity_algae.add(df);\n\t\t\t\tif (svalue.equals(\"5.2\"))\n\t\t\t\t\tor.Acute_toxicity_daphnia.add(df);\n\t\t\t\tif (svalue.equals(\"5.3\"))\n\t\t\t\t\tor.Acute_toxicity_fish.add(df);\n\t\t\t\tif (svalue.equals(\"5.4\"))\n\t\t\t\t\tor.Chronic_toxicity_daphnia.add(df);\n\t\t\t\tif (svalue.equals(\"5.5\"))\n\t\t\t\t\tor.Chronic_toxicity_fish.add(df);\n\t\t\t\tif (svalue.equals(\"5.6\"))\n\t\t\t\t\tor.Aquatox_QSAR.add(df);\n\t\t\t\tif (svalue.equals(\"5.7\"))\n\t\t\t\t\tor.Aquatic_toxicity_Other.add(df);\n\n\n\t\t\t\tif (svalue.equals(\"6.1\"))\n\t\t\t\t\tor.Acute_toxicity.add(df);\n\t\t\t\tif (svalue.equals(\"6.2\"))\n\t\t\t\t\tor.Carcinogenicity.add(df);\n\t\t\t\tif (svalue.equals(\"6.3\"))\n\t\t\t\t\tor.Chronic_toxicity.add(df);\n\t\t\t\tif (svalue.equals(\"6.4\"))\n\t\t\t\t\tor.Mutagenicity.add(df);\n\t\t\t\tif (svalue.equals(\"6.5\"))\n\t\t\t\t\tor.Reprotoxicity.add(df);\n\n\n\t\t\t\tif (svalue.equals(\"7.1\"))\n\t\t\t\t\tor.Production_Volume.add(df);\n\t\t\t\tif (svalue.equals(\"7.2\"))\n\t\t\t\t\tor.Use_Industry_Category.add(df);\n\t\t\t\tif (svalue.equals(\"7.3\"))\n\t\t\t\t\tor.Use_in_articles.add(df);\n\t\t\t\tif (svalue.equals(\"7.4\"))\n\t\t\t\t\tor.Environm_Occur_Measured.add(df);\n\t\t\t\tif (svalue.equals(\"7.5\"))\n\t\t\t\t\tor.Environm_Occur_Modelled.add(df);\n\n\t\t\t\tif (svalue.equals(\"8.1\"))\n\t\t\t\t\tor.Dir_67_548_EEC_Classification.add(df);\n\t\t\t\tif (svalue.equals(\"8.2\"))\n\t\t\t\t\tor.Reg_793_93_EEC_Existing_substances.add(df);\n\t\t\t\tif (svalue.equals(\"8.3\"))\n\t\t\t\t\tor.Dir_2000_60_EEC_WFD.add(df);\n\t\t\t\tif (svalue.equals(\"8.4\"))\n\t\t\t\t\tor.Dir_76_769_EEC_M_U.add(df);\n\t\t\t\tif (svalue.equals(\"8.5\"))\n\t\t\t\t\tor.Dir_76_464_EEC_water.add(df);\n\t\t\t\tif (svalue.equals(\"8.6\"))\n\t\t\t\t\tor.Dir_91_414_EEC_ppp.add(df);\n\t\t\t\tif (svalue.equals(\"8.7\"))\n\t\t\t\t\tor.Dir_98_8_EEC_biocid.add(df);\n\n\t\t\t\tif (svalue.equals(\"9.1\"))\n\t\t\t\t\tor.Hazard_assessment_OECD.add(df);\n\t\t\t\tif (svalue.equals(\"9.2\"))\n\t\t\t\t\tor.Other_risk_assessments.add(df);\n\n\t\t\t\trow++;\n\n\t\t\t}\n\n\t\t\tinputStream.close();\n\t\t\treturn or;\n\t\t\t\n\t\t} catch (Exception ex) {\n\t\t\tex.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}", "public JSONObject getInvoiceForGSTR3BTaxable(JSONObject reqParams) throws JSONException, ServiceException {\n /**\n * Get Invoice total sum\n */\n String companyId=reqParams.optString(\"companyid\");\n reqParams.put(\"entitycolnum\", reqParams.optString(\"invoiceentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"invoiceentityValue\"));\n JSONObject jSONObject = new JSONObject();\n List<Object> invoiceData = accEntityGstDao.getInvoiceDataWithDetailsInSql(reqParams);\n reqParams.remove(\"isb2cs\"); // remove to avoid CN index while fetching data\n double taxableAmountInv = 0d;\n double totalAmountInv = 0d;\n double IGSTAmount = 0d;\n double CGSTAmount = 0d;\n double SGSTAmount = 0d;\n double CESSAmount = 0d;\n int count=0;\n if (!reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n for (Object object : invoiceData) {\n Object[] data = (Object[]) object;\n String term = data[1]!=null?data[1].toString():\"\";\n double termamount = data[0]!=null?(Double) data[0]:0;\n count = data[4]!=null?((BigInteger) data[4]).intValue():0;\n totalAmountInv = data[3]!=null?(Double) data[3]:0;\n if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputIGST\").toString())) {\n taxableAmountInv += data[2]!=null?(Double) data[2]:0;\n IGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCGST\").toString())) {\n taxableAmountInv += data[2]!=null?(Double) data[2]:0;\n CGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputSGST\").toString())) {\n SGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputUTGST\").toString())) {\n SGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCESS\").toString())) {\n CESSAmount += termamount;\n } else if(StringUtil.isNullOrEmpty(term)){\n taxableAmountInv += data[2]!=null?(Double) data[2]:0;\n }\n }\n jSONObject.put(\"count\", count);\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount(taxableAmountInv, companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount(IGSTAmount,companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount(CGSTAmount,companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount(SGSTAmount,companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount(CESSAmount,companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount(IGSTAmount+CGSTAmount+SGSTAmount+CESSAmount,companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount(taxableAmountInv+IGSTAmount+CGSTAmount+SGSTAmount+CESSAmount,companyId));\n } else {\n jSONObject = accGSTReportService.getSalesInvoiceJSONArrayForGSTR3B(invoiceData, reqParams, companyId);\n }\n return jSONObject;\n }", "public JSONObject getAdvanceForGSTR3BTaxable(JSONObject reqParams) throws JSONException, ServiceException {\n String companyId=reqParams.optString(\"companyid\");\n JSONObject jSONObject = new JSONObject();\n double taxableAmountAdv = 0d;\n double IGSTAmount = 0d;\n double CGSTAmount = 0d;\n double SGSTAmount = 0d;\n double CESSAmount = 0d;\n reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n if (reqParams.optBoolean(\"at\")) {\n /**\n * Get Advance for which invoice not linked yet\n */\n\n reqParams.put(\"at\", true);\n List<Object> receiptList = accEntityGstDao.getAdvanceDetailsInSql(reqParams);\n JSONArray bulkData = gSTR1DeskeraServiceDao.createJsonForAdvanceDataFetchedFromDB(receiptList, reqParams);\n Map<String, JSONArray> advanceMap = AccountingManager.getSortedArrayMapBasedOnJSONAttribute(bulkData, GSTRConstants.receiptadvanceid);\n for (String advdetailkey : advanceMap.keySet()) {\n double rate = 0d;\n JSONArray adDetailArr = advanceMap.get(advdetailkey);\n JSONObject advanceobj = adDetailArr.getJSONObject(0);\n taxableAmountAdv += advanceobj.optDouble(GSTRConstants.receiptamount) - advanceobj.optDouble(GSTRConstants.receipttaxamount);\n for (int index = 0; index < adDetailArr.length(); index++) {\n JSONObject invdetailObj = adDetailArr.getJSONObject(index);\n String defaultterm = invdetailObj.optString(GSTRConstants.defaultterm);\n\n /**\n * Iterate applied GST and put its Percentage and Amount\n * accordingly\n */\n double termamount = invdetailObj.optDouble(GSTRConstants.termamount);\n double taxrate = invdetailObj.optDouble(GSTRConstants.taxrate);\n /**\n * calculate tax amount by considering partial case\n */\n termamount = (advanceobj.optDouble(GSTRConstants.receiptamount) - advanceobj.optDouble(GSTRConstants.receipttaxamount)) * invdetailObj.optDouble(GSTRConstants.taxrate) / 100;\n if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputIGST\").toString())) {\n IGSTAmount += termamount;\n } else if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCGST\").toString())) {\n CGSTAmount += termamount;\n } else if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputSGST\").toString())) {\n SGSTAmount += termamount;\n } else if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputUTGST\").toString())) {\n SGSTAmount += termamount;\n } else if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCESS\").toString())) {\n CESSAmount += termamount;\n }\n }\n }\n\n// reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n// reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n// List<Object> AdvData = accEntityGstDao.getAdvanceDetailsInSql(reqParams);\n// for (Object object : AdvData) {\n// Object[] data = (Object[]) object;\n// String term = data[1].toString();\n// double termamount = (Double) data[0];\n// if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputIGST\").toString())) {\n// taxableAmountAdv += (Double) data[2];\n// IGSTAmount += termamount;\n// } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCGST\").toString())) {\n// taxableAmountAdv += (Double) data[2];\n// CGSTAmount += termamount;\n// } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputSGST\").toString())) {\n// SGSTAmount += termamount;\n// } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputUTGST\").toString())) {\n// SGSTAmount += termamount;\n// } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCESS\").toString())) {\n// CESSAmount += termamount;\n// }\n// }\n } else {\n /**\n * Get Advance for which invoice isLinked\n */\n reqParams.put(\"atadj\", true);\n List<Object> receiptList = accEntityGstDao.getAdvanceDetailsInSql(reqParams);\n JSONArray bulkData = gSTR1DeskeraServiceDao.createJsonForAdvanceDataFetchedFromDB(receiptList, reqParams);\n Map<String, JSONArray> advanceMap = AccountingManager.getSortedArrayMapBasedOnJSONAttribute(bulkData, GSTRConstants.receiptadvanceid);\n for (String advdetailkey : advanceMap.keySet()) {\n double rate = 0d;\n JSONArray adDetailArr = advanceMap.get(advdetailkey);\n JSONObject advanceobj = adDetailArr.getJSONObject(0);\n taxableAmountAdv += advanceobj.optDouble(GSTRConstants.adjustedamount);\n for (int index = 0; index < adDetailArr.length(); index++) {\n JSONObject invdetailObj = adDetailArr.getJSONObject(index);\n String defaultterm = invdetailObj.optString(GSTRConstants.defaultterm);\n\n /**\n * Iterate applied GST and put its Percentage and Amount\n * accordingly\n */\n double termamount = invdetailObj.optDouble(GSTRConstants.termamount);\n double taxrate = invdetailObj.optDouble(GSTRConstants.taxrate);\n /**\n * calculate tax amount by considering partial case\n */\n termamount = advanceobj.optDouble(GSTRConstants.adjustedamount) * invdetailObj.optDouble(GSTRConstants.taxrate) / 100;\n if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputIGST\").toString())) {\n IGSTAmount += termamount;\n } else if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCGST\").toString())) {\n CGSTAmount += termamount;\n } else if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputSGST\").toString())) {\n SGSTAmount += termamount;\n } else if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputUTGST\").toString())) {\n SGSTAmount += termamount;\n } else if (defaultterm.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCESS\").toString())) {\n CESSAmount += termamount;\n }\n }\n }\n\n// reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n// reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n// List<Object> AdvDataLinked = accEntityGstDao.getAdvanceDetailsInSql(reqParams);\n// for (Object object : AdvDataLinked) {\n// Object[] data = (Object[]) object;\n// String term = data[1].toString();\n// double termamount = (Double) data[0];\n// taxableAmountAdv = (Double) data[2];\n// if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputIGST\").toString())) {\n// taxableAmountAdv += (Double) data[2];\n// IGSTAmount += termamount;\n// } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCGST\").toString())) {\n// taxableAmountAdv += (Double) data[2];\n// CGSTAmount += termamount;\n// } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputSGST\").toString())) {\n// SGSTAmount += termamount;\n// } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputUTGST\").toString())) {\n// SGSTAmount += termamount;\n// } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCESS\").toString())) {\n// CESSAmount += termamount;\n// }\n// }\n }\n\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount(taxableAmountAdv,companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount(IGSTAmount,companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount(CGSTAmount,companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount(SGSTAmount,companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount(CESSAmount,companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount(IGSTAmount+CGSTAmount+SGSTAmount+CESSAmount,companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount(taxableAmountAdv+IGSTAmount+CGSTAmount+SGSTAmount+CESSAmount,companyId));\n return jSONObject;\n }", "public InventoryOrder transferExcelToObj(){\r\n\t\tList<InventoryOrderProduct> orderProducts = new ArrayList<InventoryOrderProduct>();\r\n\t\t\r\n\t\tHSSFSheet sheet = templateWorkbook.getSheetAt(0);\r\n\t\tint row_start = data_row;\r\n\r\n\t\twhile (true){\r\n\t\t\tHSSFRow row = sheet.getRow(row_start);\r\n\t\t\tif (row == null)\r\n\t\t\t\tbreak;\r\n\t\t\telse {\r\n\t\t\t\tHSSFCell cell = row.getCell(serial_column);\r\n\t\r\n\t\t\t\tif (cell == null)\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t\tString barcode = getBarcodeFromExcel(row.getCell(barcode_column));\r\n\t\t\t\tloggerLocal.info(\"Import : \" + barcode);\r\n\t\t\t\t\r\n\t\t\t\tint quantity = ExcelUtil.getPuzzleNum(row.getCell(quantity_column)).intValue();\r\n\t\t\t\tdouble salesPriceSelected = ExcelUtil.getPuzzleNum(row.getCell(salePrice_column));\r\n\t\t\t\tdouble wholeSalePrice = ExcelUtil.getPuzzleNum(row.getCell(wholePrice_column));\r\n\t\t\t\tdouble discount = ExcelUtil.getPuzzleNum(row.getCell(discount_column));\r\n\t\t\t\t\r\n\t\t\t\tInventoryOrderProduct orderProduct = new InventoryOrderProduct();\r\n\t\t\t\torderProduct.setQuantity(quantity);\r\n\t\t\t\torderProduct.setWholeSalePrice(wholeSalePrice);\r\n\t\t\t\t//orderProduct.setSalesPrice(salesPrice);\r\n\t\t\t\torderProduct.setSalePriceSelected(salesPriceSelected);\r\n\t\t\t\torderProduct.setDiscount(discount);\r\n\t\t\t\torderProduct.getProductBarcode().setBarcode(barcode);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\torderProducts.add(orderProduct);\r\n\t\t\t\t\r\n\t\t\t\trow_start++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\torder.setProduct_List(orderProducts);\r\n\t\t\r\n\t\treturn order;\r\n\t}", "public JSONArray getGoodsReceiptsJsonForMonthlyAgedPayables(HashMap<String, Object> request, List<GoodsReceipt> list, JSONArray jArr, AccountingHandlerDAO accountingHandlerDAOobj, accCurrencyDAO accCurrencyDAOobj, accGoodsReceiptDAO accGoodsReceiptobj, accAccountDAO accAccountDAOobj, accGoodsReceiptCMN accGoodsReceiptCommon, accTaxDAO accTaxObj) throws ServiceException {\n try {\n String companyid = (String) request.get(GoodsReceiptCMNConstants.COMPANYID);\n String currencyid = (String) request.get(GoodsReceiptCMNConstants.GCURRENCYID);\n DateFormat df = (DateFormat) request.get(GoodsReceiptCMNConstants.DATEFORMAT);\n String only1099AccStr = (String) request.get(GoodsReceiptCMNConstants.ONLY1099ACC);\n List ll = null;\n KwlReturnObject curresult = accountingHandlerDAOobj.getObject(KWLCurrency.class.getName(), currencyid);\n KWLCurrency currency = (KWLCurrency) curresult.getEntityList().get(0);\n boolean isBadDebtInvoices = false;// for Malasian Company\n boolean isproductCategory = false;\n boolean isproductType = false;\n if (request.containsKey(\"isBadDebtInvoices\") && request.get(\"isBadDebtInvoices\") != null) {\n isBadDebtInvoices = (Boolean) request.get(\"isBadDebtInvoices\");\n }\n if (request.containsKey(\"productCategoryid\") && request.get(\"productCategoryid\") != null && !StringUtil.isNullOrEmpty((String) request.get(\"productCategoryid\"))) {\n isproductCategory = true;\n }\n if (request.containsKey(InvoiceConstants.productid) && request.get(InvoiceConstants.productid) != null && !StringUtil.isNullOrEmpty((String) request.get(InvoiceConstants.productid))) {\n isproductType = true;\n }\n boolean belongsTo1099 = false;\n boolean isAged = (request.containsKey(\"isAged\") && request.get(\"isAged\") != null) ? Boolean.parseBoolean(request.get(\"isAged\").toString()) : false;\n boolean only1099Acc = (only1099AccStr != null ? Boolean.parseBoolean(only1099AccStr) : false);\n boolean ignoreZero = request.get(GoodsReceiptCMNConstants.IGNOREZERO) != null;\n boolean onlyAmountDue = request.get(GoodsReceiptCMNConstants.ONLYAMOUNTDUE) != null;\n boolean booleanAged = true;//Added for aged payable/receivable\n List InvoiceList = new ArrayList();\n Calendar oneDayBeforeCal1 = (Calendar) request.get(\"oneDayBeforeCal1\");\n Calendar cal1 = (Calendar) request.get(\"cal1\");\n Calendar cal2 = (Calendar) request.get(\"cal2\");\n Calendar cal3 = (Calendar) request.get(\"cal3\");\n Calendar cal4 = (Calendar) request.get(\"cal4\");\n Calendar cal5 = (Calendar) request.get(\"cal5\");\n Calendar cal6 = (Calendar) request.get(\"cal6\");\n Calendar cal7 = (Calendar) request.get(\"cal7\");\n Date oneDayBeforeCal1Date = null;\n Date cal1Date = null;\n Date cal2Date = null;\n Date cal3Date = null;\n Date cal4Date = null;\n Date cal5Date = null;\n Date cal6Date = null;\n Date cal7Date = null;\n DateFormat dateFormat=(DateFormat) authHandler.getDateOnlyFormat();\n String oneDayBeforeCal1String = dateFormat.format(oneDayBeforeCal1.getTime());\n oneDayBeforeCal1Date = dateFormat.parse(oneDayBeforeCal1String);\n String cal1String = dateFormat.format(cal1.getTime());\n cal1Date = dateFormat.parse(cal1String);\n String cal2String = dateFormat.format(cal2.getTime());\n cal2Date = dateFormat.parse(cal2String);\n String cal3String = dateFormat.format(cal3.getTime());\n cal3Date = dateFormat.parse(cal3String);\n String cal4String = dateFormat.format(cal4.getTime());\n cal4Date = dateFormat.parse(cal4String);\n String cal5String = dateFormat.format(cal5.getTime());\n cal5Date = dateFormat.parse(cal5String);\n String cal6String = dateFormat.format(cal6.getTime());\n cal6Date = dateFormat.parse(cal6String);\n String cal7String = dateFormat.format(cal7.getTime());\n cal7Date = dateFormat.parse(cal7String);\n double amountdue1 = 0;\n double amountdue2 = 0;\n double amountdue3 = 0;\n double amountdue4 = 0;\n double amountdue5 = 0;\n double amountdue6 = 0;\n double amountdue7 = 0;\n double amountdue8 = 0;\n Date asOfDate = null, today = new Date();\n if (request.containsKey(\"asofdate\") && request.get(\"asofdate\") != null) {\n String asOfDateString = (String) request.get(\"asofdate\");\n asOfDate = df.parse(asOfDateString);\n }\n boolean asOfDateEqualsToday = asOfDate != null ? DateUtils.isSameDay(today, asOfDate) : false;\n request.put(\"asOfDateEqualsToday\", asOfDateEqualsToday);\n if (list != null && !list.isEmpty()) {\n for (Object objectArr : list) {\n Object[] oj = (Object[]) objectArr;\n String invid = oj[0].toString();\n amountdue1 = amountdue2 = amountdue3 = amountdue4 = amountdue5 = amountdue6 = amountdue7 = amountdue8 = 0;\n KwlReturnObject objItr = accountingHandlerDAOobj.getObject(GoodsReceipt.class.getName(), invid);\n GoodsReceipt gReceipt = (GoodsReceipt) objItr.getEntityList().get(0);\n //Below If Block code is used to remove duplicate invoice id's when filter on the basis of Product category or Product name\n if (isproductCategory || isproductType) {\n if (InvoiceList.contains(gReceipt.getID())) {\n continue;\n } else {\n InvoiceList.add(gReceipt.getID());\n }\n }\n JournalEntry je = null;\n JournalEntryDetail d = null;\n if (gReceipt.isNormalInvoice()) {\n je = gReceipt.getJournalEntry();\n d = gReceipt.getVendorEntry();\n }\n double invoiceOriginalAmt = 0d;\n double externalCurrencyRate = 0d;\n boolean isopeningBalanceInvoice = gReceipt.isIsOpeningBalenceInvoice();\n Date creationDate = null;\n currencyid = (gReceipt.getCurrency() == null ? currency.getCurrencyID() : gReceipt.getCurrency().getCurrencyID());\n Account account = null;\n creationDate = gReceipt.getCreationDate();\n if (gReceipt.isIsOpeningBalenceInvoice() && !gReceipt.isNormalInvoice()) {\n KwlReturnObject accObjItr = accountingHandlerDAOobj.getObject(Account.class.getName(), gReceipt.getVendor().getAccount().getID());\n account = (Account) accObjItr.getEntityList().get(0);\n externalCurrencyRate = gReceipt.getExchangeRateForOpeningTransaction();\n invoiceOriginalAmt = gReceipt.getOriginalOpeningBalanceAmount();\n } else {\n account = d.getAccount();\n externalCurrencyRate = je.getExternalCurrencyRate();\n// creationDate = je.getEntryDate();\n invoiceOriginalAmt = d.getAmount();\n }\n double amountdue = 0;\n boolean invoiceAmountDueEqualsInvAmount= ((!gReceipt.isIsOpeningBalenceInvoice() && gReceipt.isNormalInvoice()) ? (gReceipt.getInvoiceAmount() == gReceipt.getInvoiceamountdue()) : false);\n request.put(\"invoiceAmtDueEqualsInvoiceAmt\",invoiceAmountDueEqualsInvAmount);\n if (asOfDateEqualsToday || invoiceAmountDueEqualsInvAmount) {\n if (gReceipt.isIsExpenseType()) {\n if (Constants.InvoiceAmountDueFlag && !isAged) {\n ll = accGoodsReceiptCommon.getUpdatedExpGRAmountDue(request, gReceipt);\n } else {\n ll = accGoodsReceiptCommon.getExpGRAmountDue(request, gReceipt);\n }\n if(gReceipt.isIsOpeningBalenceInvoice()){\n amountdue=gReceipt.getOpeningBalanceAmountDue();\n }else{\n amountdue=gReceipt.getInvoiceamountdue();\n }\n belongsTo1099 = (Boolean) ll.get(3);\n } else {\n if (gReceipt.isIsOpeningBalenceInvoice() && !gReceipt.isNormalInvoice()) {\n ll = new ArrayList();\n ll.add(gReceipt.getOriginalOpeningBalanceAmount());\n ll.add(gReceipt.getOpeningBalanceAmountDue());\n ll.add(\"\");\n ll.add(false);\n ll.add(0.0);\n } else {\n if (Constants.InvoiceAmountDueFlag && !isAged) {\n ll = accGoodsReceiptCommon.getInvoiceDiscountAmountInfo(request, gReceipt);\n } else {\n ll = accGoodsReceiptCommon.getGRAmountDueForMonthlyAgedPayable(request, gReceipt);\n }\n }\n\n if (gReceipt.isIsOpeningBalenceInvoice()) {\n amountdue = gReceipt.getOpeningBalanceAmountDue();\n } else {\n amountdue = gReceipt.getInvoiceamountdue();\n }\n belongsTo1099 = (Boolean) ll.get(3);\n }\n } else {\n if (gReceipt.isIsExpenseType()) {\n if (Constants.InvoiceAmountDueFlag && !isAged) {\n ll = accGoodsReceiptCommon.getUpdatedExpGRAmountDue(request, gReceipt);\n } else {\n ll = accGoodsReceiptCommon.getExpGRAmountDue(request, gReceipt);\n }\n amountdue = (Double) ll.get(1);\n belongsTo1099 = (Boolean) ll.get(3);\n } else {\n if (gReceipt.isIsOpeningBalenceInvoice() && !gReceipt.isNormalInvoice()) {\n ll = new ArrayList();\n ll.add(gReceipt.getOriginalOpeningBalanceAmount());\n ll.add(gReceipt.getOpeningBalanceAmountDue());\n ll.add(\"\");\n ll.add(false);\n ll.add(0.0);\n } else {\n if (Constants.InvoiceAmountDueFlag && !isAged) {\n ll = accGoodsReceiptCommon.getInvoiceDiscountAmountInfo(request, gReceipt);\n } else {\n ll = accGoodsReceiptCommon.getGRAmountDueForMonthlyAgedPayable(request, gReceipt);\n }\n }\n amountdue = (Double) ll.get(1);\n belongsTo1099 = (Boolean) ll.get(3);\n }\n }\n if (onlyAmountDue && authHandler.round(amountdue, companyid) == 0 || (only1099Acc && !belongsTo1099)) {//remove //belongsTo1099&&gReceipt.isIsExpenseType()\\\\ in case of viewing all accounts. [PS]\n continue;\n }\n if ((ignoreZero && authHandler.round(amountdue, companyid) <= 0)) {\n continue;\n }\n if (request.containsKey(\"excludeInvoiceId\") && request.get(\"excludeInvoiceId\") != null) {\n String excludeInvoiceId = (String) request.get(\"excludeInvoiceId\");\n if (gReceipt.getGoodsReceiptNumber().equals(excludeInvoiceId)) {\n continue;\n }\n }\n Vendor vendor = gReceipt.getVendor();\n HashMap<String, Object> hashMap = new HashMap<>();\n hashMap.put(\"invoiceID\", gReceipt.getID());\n com.krawler.utils.json.base.JSONObject obj = new com.krawler.utils.json.base.JSONObject();\n obj.put(GoodsReceiptCMNConstants.BILLID, gReceipt.getID());\n obj.put(\"isOpeningBalanceTransaction\", gReceipt.isIsOpeningBalenceInvoice());\n obj.put(\"isNormalTransaction\", gReceipt.isNormalInvoice());\n obj.put(GoodsReceiptCMNConstants.PERSONID, vendor == null ? account.getID() : vendor.getID());\n obj.put(GoodsReceiptCMNConstants.BILLNO, gReceipt.getGoodsReceiptNumber());\n obj.put(GoodsReceiptCMNConstants.CURRENCYID, currencyid);\n obj.put(GoodsReceiptCMNConstants.CURRENCYSYMBOL, (gReceipt.getCurrency() == null ? currency.getSymbol() : gReceipt.getCurrency().getSymbol()));\n obj.put(\"currencyCode\", (gReceipt.getCurrency() == null ? currency.getCurrencyCode() : gReceipt.getCurrency().getCurrencyCode()));\n obj.put(\"currencycode\", (gReceipt.getCurrency() == null ? currency.getCurrencyCode() : gReceipt.getCurrency().getCurrencyCode()));\n obj.put(\"termname\", (gReceipt.getTermid() == null ? vendor.getDebitTerm().getTermname() : gReceipt.getTermid().getTermname()));\n obj.put(GoodsReceiptCMNConstants.CURRENCYNAME, (gReceipt.getCurrency() == null ? currency.getName() : gReceipt.getCurrency().getName()));\n KwlReturnObject bAmt = accCurrencyDAOobj.getBaseToCurrencyAmount(request, 1.0, currencyid, creationDate, 0);\n obj.put(GoodsReceiptCMNConstants.OLDCURRENCYRATE, bAmt.getEntityList().get(0));\n obj.put(GoodsReceiptCMNConstants.DATE, df.format(creationDate));\n obj.put(GoodsReceiptCMNConstants.DUEDATE, df.format(gReceipt.getDueDate()));\n obj.put(GoodsReceiptCMNConstants.PERSONNAME, vendor == null ? account.getName() : vendor.getName());\n obj.put(GoodsReceiptCMNConstants.PERSONINFO, vendor == null ? account.getName() : vendor.getName()+\"(\"+vendor.getAcccode()+\")\");\n obj.put(GoodsReceiptCMNConstants.EXTERNALCURRENCYRATE, externalCurrencyRate);\n obj.put(GoodsReceiptCMNConstants.JOURNALENTRYID, je != null ? je.getID() : \"\"); //'journalentryid' is used to fetch data of this invoice to show in journal entry tab\n obj.put(GoodsReceiptCMNConstants.ENTRYNO, je != null ? je.getEntryNumber() : \"\"); // 'entryno' is used to show journalentry no. in entry no. column\n obj.put(\"cashtransaction\", gReceipt.isCashtransaction());\n obj.put(GoodsReceiptCMNConstants.TYPE, \"Purchase Invoice\");\n Set<GoodsReceiptDetail> goodsReceiptDetails = gReceipt.getRows();\n // Calculating total invoice amount in base currency\n KwlReturnObject invoiceTotalAmtInBaseResult = null;\n if (isopeningBalanceInvoice && gReceipt.isConversionRateFromCurrencyToBase()) {// if invoice is opening balance invoice and Conversion rate is taken from user is Currency to base then following method will be called.\n invoiceTotalAmtInBaseResult = accCurrencyDAOobj.getCurrencyToBaseAmountAccordingToCurrencyToBaseExchangeRate(request, invoiceOriginalAmt, currencyid, creationDate, externalCurrencyRate);\n } else {\n invoiceTotalAmtInBaseResult = accCurrencyDAOobj.getCurrencyToBaseAmount(request, invoiceOriginalAmt, currencyid, creationDate, externalCurrencyRate);\n }\n double invoiceTotalAmountInBase = authHandler.round((Double) invoiceTotalAmtInBaseResult.getEntityList().get(0), companyid);\n if (isBadDebtInvoices) {// in case of Malasian Company\n double totalTaxAmt = 0d;\n double invoiceLevelTaxAmt = gReceipt.getTaxEntry() == null ? 0 : gReceipt.getTaxEntry().getAmount();\n String taxId = gReceipt.getTaxEntry() == null ? \"\" : gReceipt.getTax().getID();\n double rowTaxAmt = 0d;\n for (GoodsReceiptDetail invoiceDetail : goodsReceiptDetails) {\n rowTaxAmt += invoiceDetail.getRowTaxAmount() + invoiceDetail.getRowTermTaxAmount();\n taxId = (invoiceDetail.getTax() != null) ? invoiceDetail.getTax().getID() : taxId;\n }\n totalTaxAmt = invoiceLevelTaxAmt + rowTaxAmt;\n if (totalTaxAmt == 0) {// no need to put invoice in bad debt section if it has tax 0\n continue;\n }\n // get Paid amount of invoice\n Date badDebtCalculationToDate = null;\n if (request.get(\"badDebtCalculationToDate\") != null) {\n badDebtCalculationToDate = df.parse((String) request.get(\"badDebtCalculationToDate\"));\n }\n KwlReturnObject invoicePaidAmtObj = accPaymentDAOobj.getPaymentFromBadDebtClaimedInvoice(gReceipt.getID(), true, badDebtCalculationToDate);//accPaymentDAOobj.getPaymentAmountofBadDebtGoodsReceipt(gReceipt.getID(),true);\n double paidAmt = 0;\n List paidList = invoicePaidAmtObj.getEntityList();\n if (paidList != null && !paidList.isEmpty()) {\n Iterator pmtIt = paidList.iterator();\n while (pmtIt.hasNext()) {\n PaymentDetail rd = (PaymentDetail) pmtIt.next();\n double paidAmtInPaymentCurrency = rd.getAmount();\n// KwlReturnObject bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, paidAmtInPaymentCurrency, rd.getPayment().getCurrency().getCurrencyID(), rd.getPayment().getJournalEntry().getEntryDate(), rd.getPayment().getJournalEntry().getExternalCurrencyRate());\n KwlReturnObject bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, paidAmtInPaymentCurrency, rd.getPayment().getCurrency().getCurrencyID(), rd.getPayment().getCreationDate(), rd.getPayment().getJournalEntry().getExternalCurrencyRate());\n double paidAmtInBase = authHandler.round((Double) bAmt1.getEntityList().get(0), companyid);\n paidAmt += paidAmtInBase;\n\n }\n }\n String fromcurrencyid = gReceipt.getCurrency().getCurrencyID();\n HashMap<String, Object> badMaps = new HashMap<String, Object>();\n badMaps.put(\"companyid\", companyid);\n badMaps.put(\"invoiceid\", invid);\n\n KwlReturnObject badDebtMappingResult = accGoodsReceiptobj.getBadDebtPurchaseInvoiceMappingForGoodsReceipt(badMaps);\n double totalRecoveredAmt = 0;\n List badDebtMapping = badDebtMappingResult.getEntityList();\n if (!badDebtMapping.isEmpty()) {\n Iterator badIt = badDebtMapping.iterator();\n while (badIt.hasNext()) {\n BadDebtPurchaseInvoiceMapping debtInvoiceMapping = (BadDebtPurchaseInvoiceMapping) badIt.next();\n totalRecoveredAmt += debtInvoiceMapping.getBadDebtAmtRecovered();\n }\n }\n // Calculate Recover Amount in base\n// KwlReturnObject bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, totalRecoveredAmt, fromcurrencyid, gReceipt.getJournalEntry().getEntryDate(), gReceipt.getJournalEntry().getExternalCurrencyRate());\n KwlReturnObject bAmt1 = accCurrencyDAOobj.getCurrencyToBaseAmount(request, totalRecoveredAmt, fromcurrencyid, gReceipt.getCreationDate(), gReceipt.getJournalEntry().getExternalCurrencyRate());\n totalRecoveredAmt = authHandler.round((Double) bAmt1.getEntityList().get(0), companyid);\n double paidAfterClaimed = paidAmt - totalRecoveredAmt;\n if (authHandler.round(amountdue, companyid) == 0 && authHandler.round(paidAfterClaimed, companyid) == 0) {// don't put invoices which has amount due zero and whole gst has been recovered\n continue;\n }\n }\n\n //For getting amountdue [PS]\n if (gReceipt.isCashtransaction()) {\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUEINBASE, 0);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE, 0);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUENONNEGATIVE, 0);\n obj.put(GoodsReceiptCMNConstants.INCASH, true);\n } else {\n if (isopeningBalanceInvoice && gReceipt.isConversionRateFromCurrencyToBase()) {// if invoice is opening balance invoice and Conversion rate is taken from user is Currency to base then following method will be called.\n bAmt = accCurrencyDAOobj.getCurrencyToBaseAmountAccordingToCurrencyToBaseExchangeRate(request, authHandler.round(amountdue,companyid), currencyid, creationDate, externalCurrencyRate);\n } else {\n bAmt = accCurrencyDAOobj.getCurrencyToBaseAmount(request, authHandler.round(amountdue,companyid), currencyid, creationDate, externalCurrencyRate);\n }\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUEINBASE, authHandler.round((Double) bAmt.getEntityList().get(0), companyid));\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE, authHandler.round(amountdue, companyid));\n\n if (booleanAged) {//Added for aged payable/receivable\n int datefilter = (request.containsKey(\"datefilter\") && request.get(\"datefilter\") != null) ? Integer.parseInt(request.get(\"datefilter\").toString()) : 0;// 0 = Invoice Due date OR 1 = Invoice date\n Date dueDate = null;\n if (!StringUtil.isNullOrEmpty(df.format(gReceipt.getDueDate()))) {\n dueDate = df.parse(df.format(gReceipt.getDueDate()));\n }\n if (datefilter == 0) {\n dueDate = df.parse(df.format(gReceipt.getDueDate()));\n } else {\n dueDate = df.parse(df.format(creationDate));\n }\n\n if (dueDate.after(oneDayBeforeCal1Date) && (dueDate.before(cal1Date) || dueDate.equals(cal1Date))) {\n amountdue1 = authHandler.round(amountdue, companyid);\n } else if ((cal2Date.before(dueDate) || cal2Date.equals(dueDate)) && cal1Date.after(dueDate)) {\n amountdue2 = authHandler.round(amountdue, companyid);\n } else if ((cal3Date.before(dueDate) || cal3Date.equals(dueDate)) && cal2Date.after(dueDate)) {\n amountdue3 = authHandler.round(amountdue, companyid);\n } else if ((cal4Date.before(dueDate) || cal4Date.equals(dueDate)) && cal3Date.after(dueDate)) {\n amountdue4 = authHandler.round(amountdue, companyid);\n } else if ((cal5Date.before(dueDate) || cal5Date.equals(dueDate)) && cal4Date.after(dueDate)) {\n amountdue5 = authHandler.round(amountdue, companyid);\n } else if ((cal6Date.before(dueDate) || cal6Date.equals(dueDate)) && cal5Date.after(dueDate)) {\n amountdue6 = authHandler.round(amountdue, companyid);\n } else if ((cal7Date.before(dueDate) || cal7Date.equals(dueDate)) && cal6Date.after(dueDate)) {\n amountdue7 = authHandler.round(amountdue, companyid);\n } else {\n amountdue8 = authHandler.round(amountdue, companyid);\n }\n }\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUENONNEGATIVE, (amountdue <= 0) ? 0 : authHandler.round(amountdue, companyid));\n }\n obj.put(GoodsReceiptCMNConstants.AMOUNT, authHandler.round((Double) invoiceOriginalAmt, companyid)); //actual invoice amount\n obj.put(GoodsReceiptCMNConstants.AMOUNTINBASE, invoiceTotalAmountInBase);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE1, amountdue1);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE2, amountdue2);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE3, amountdue3);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE4, amountdue4);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE5, amountdue5);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE6, amountdue6);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE7, amountdue7);\n obj.put(GoodsReceiptCMNConstants.AMOUNTDUE8, amountdue8);\n if (!(ignoreZero && authHandler.round(amountdue, companyid) <= 0)) {\n jArr.put(obj);\n }\n }\n }\n } catch (Exception ex) {\n throw ServiceException.FAILURE(\"accGoodsReceiptController.getGoodsReceiptsJsonForMonthlyAgedPayables : \" + ex.getMessage(), ex);\n }\n return jArr;\n }", "public void addPayment(String name) {\n \t String data=\"\";\n String str;\n try { \n FileReader fr = new FileReader(jsonFile);\n BufferedReader br = new BufferedReader(fr);\n while ((str=br.readLine())!=null) {\n data = data + str + \"\\n\";\n } \n JSONObject dataJson = new JSONObject(data);\n JSONArray jsonArray = dataJson.getJSONArray(\"payments\");\n br.close();\n FileWriter fw = new FileWriter(jsonFile);\n PrintWriter pw = new PrintWriter(fw);\n \n \tJSONObject payment=new JSONObject();\n \tpayment.put(\"name\", name);\n \tpayment.put(\"availability\",\"Yes\"); \t\n \tjsonArray.put(payment); \t\n \tdataJson.put(\"payments\", jsonArray);\n \tString jsonString = dataJson.toString(); \n \n String str1[] = jsonString.toString().split(\",\");\n int i;\n for(i=0; i<str1.length-1; i++) {\n pw.println(str1[i]+\",\");\n }\n pw.println(str1[i]);\n pw.close();\n fw.close();\n }\n catch (Exception error) {\n System.out.println(\"json.txt\");\n }\n }", "public JSONObject getGoodsReceiptForGSTR3BTaxable(JSONObject reqParams) throws JSONException, ServiceException {\n reqParams.put(\"entitycolnum\", reqParams.optString(\"goodsreceiptentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"goodsreceiptentityValue\"));\n JSONObject jSONObject = new JSONObject();\n List<Object> invoiceData = gstr2Dao.getInvoiceDataWithDetailsInSql(reqParams);\n String companyId = reqParams.optString(\"companyid\");\n double taxableAmountInv = 0d;\n double totalAmountInv = 0d;\n double IGSTAmount = 0d;\n double CGSTAmount = 0d;\n double SGSTAmount = 0d;\n double CESSAmount = 0d;\n int count=0;\n if (!reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n for (Object object : invoiceData) {\n Object[] data = (Object[]) object;\n String term = data[1] != null ? data[1].toString() : \"\";\n double termamount = data[0] != null ? (Double) data[0] : 0;\n totalAmountInv = data[3] != null ? (Double) data[3] : 0;\n count = data[4] != null ? ((BigInteger) data[4]).intValue() : 0;\n if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"InputIGST\").toString()) || term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputIGST\").toString())) {\n IGSTAmount += termamount;\n taxableAmountInv += data[2] != null ? (Double) data[2] : 0;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"InputCGST\").toString()) || term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCGST\").toString())) {\n CGSTAmount += termamount;\n taxableAmountInv += data[2] != null ? (Double) data[2] : 0;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"InputSGST\").toString()) || term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputSGST\").toString())) {\n SGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"InputUTGST\").toString()) || term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputUTGST\").toString())) {\n SGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"InputCESS\").toString()) || term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCESS\").toString())) {\n CESSAmount += termamount;\n } else if (StringUtil.isNullOrEmpty(term)) {\n taxableAmountInv += data[2] != null ? (Double) data[2] : 0;\n }\n }\n jSONObject.put(\"count\", count);\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount(taxableAmountInv, companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount(IGSTAmount, companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount(CGSTAmount, companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount(SGSTAmount, companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount(CESSAmount, companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount(IGSTAmount + CGSTAmount + SGSTAmount + CESSAmount, companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount(taxableAmountInv + IGSTAmount + CGSTAmount + SGSTAmount + CESSAmount, companyId));\n } else {\n jSONObject = accGSTReportService.getPurchaseInvoiceJSONArrayForGSTR3B(invoiceData, reqParams, companyId);\n }\n return jSONObject;\n }", "public void ProcessFields(int rowNum, String clientType, int iteratorCount, String sheetName, String signType, String paymentType) {\n\t\t\n\t\tString currentURL =\"\";\n\t\tcurrentURL = driver.getCurrentUrl();\n\t\t\n\t\tbeneficiariesPage = new BeneficiariesPage();\n\t\n\t\t\n\t\t\n\t\ttry{\n\t\t\tinputData = ProductUtil.GetInputData(sheetName, 129, 5);\n\t\t\t//agentWebHomePage = new AgentWebHomePage();\n\t\n\t\t\tint formFlag = 0;\n\t\t\tint checkboxFlag = 0;\n\t\t\tint buttonFlag = 0;\n\t\t\tint dropDownFlag = 0;\n\t\t\tint autoSuggFlag = 0;\n\t\t\tint datePickerFlag = 0;\n\t\t\tint googleAutoCompleteFlag = 0;\n\t\t\tint i = 0;\n\t\t\tint counter = 0;\n\t\t\tBy byFormL = null;\n\t\t\tBy byFormF = null;\n\t\t\tBy byGoogleAutoCompleteL = null;\n\t\t\tBy byGoogleAutoCompleteF = null;\n\t\t\tBy byButtonL = null;\n\t\t\tBy byButtonF = null;\n\t\t\tBy byNoButtonF = null;\n\t\t\tBy byAutoSuggL = null;\n\t\t\tBy byautoSuggF = null;\n\t\t\tBy byDropdownF = null;\n\t\t\tBy byDropdownL = null;\n\t\t\tBy byCheckboxL = null;\n\t\t\tBy byCheckboxF = null;\n\t\t\tBy byDatepickerL = null;\n\t\t\tBy byDatepickerF = null;\n\t\t\tString fieldFlag = null;\n\t\t\tboolean doneFlag = false;\n\t\t\tboolean agentFlag = false;\n\t\t\tboolean flowFlag = false;\n\t\t\t//String currentURL =\"\";\n\t\t\t\n\t\n\t\t\tbyFormL = By.cssSelector(\".form-group\");\n\t\t\tbyFormF = By.cssSelector(\".form-group .field .form-control\");\n\t\t\t\n\t\t\t\n\t\t\tbyGoogleAutoCompleteL = By.cssSelector(\".form-group\");\n\t\t\tbyGoogleAutoCompleteF = By.cssSelector(\".form-group .field .google-autocomplete-input-container\");\t\t\n\t\t\t\n\t\n\t\t\tbyButtonL = By.cssSelector(\".c-subheader-text.fs18.col-sm-12\"); // class\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// btn\n\t\t\tbyButtonF = By.cssSelector(\".single-select-btn-container .c-button-default\");\n\t\t\tbyNoButtonF = By.cssSelector(\"button[class='c-button-default circular single-select-btn btn btn-default']\");\n\t\n\t\t\tbyAutoSuggL = By.cssSelector(\".c-subheader-text.fs18.col-sm-12\"); // auto\n\t\t\tbyautoSuggF = By.xpath(\"//input[@autocomplete='off']\");\n\t\n\t\t\tbyDropdownL = By.cssSelector(\".c-subheader-text.fs18\"); // select\n\t\t\tbyDropdownF = By.cssSelector(\".Select-placeholder\");\n\t\t\t\n\t\t\tbyCheckboxL = By.cssSelector(\".custom-checkbox-container\");\n\t\t\tbyCheckboxF = By.cssSelector(\".custom-checkbox-container .custom-checkbox-checkmark\");\n\t\n\t\t\tbyDatepickerL = By.cssSelector(\".c-subheader-text.fs18.col-sm-12\");\n\t\t\tbyDatepickerF = By.cssSelector(\".react-datepicker-wrapper\");\n\t\n\t\t\tHashMap<String, Integer> ele = FindElements();\n\t\n\t\t\tfor (Entry eleType : ele.entrySet()) {\n\t\n\t\t\t\tString line = eleType.getKey() + \" \" + eleType.getValue();\n\t\t\t\tSystem.out.println(\"Fields: \" + line);\n\t\n\t\t\t\tfieldFlag = eleType.getKey().toString();\n\t\n\t\t\t\tswitch (fieldFlag) {\n\t\n\t\t\t\tcase \"googleAutoCompleteFlag\":\n\t\t\t\t\tbyGoogleAutoCompleteL = By.cssSelector(\".form-group\");\n\t\t\t\t\tbyGoogleAutoCompleteF = By.cssSelector(\".form-group .field .google-autocomplete-input-container\");\n\t\t\t\t\t//byFormF = By.cssSelector(\".form-group .field\");\n\t\t\t\t\tformFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase \"formFlag\":\n\t\t\t\t\tbyFormL = By.cssSelector(\".form-group\");\n\t\t\t\t\tbyFormF = By.cssSelector(\".form-group .field .form-control\");\n\t\t\t\t\t//byFormF = By.cssSelector(\".form-group .field\");\n\t\t\t\t\tformFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase \"buttonFlag\":\n\t\t\t\t\tbyButtonL = By.cssSelector(\".c-subheader-text.fs18.col-sm-12\"); // class\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// btn\n\t\t\t\t\tbyButtonF = By.cssSelector(\".single-select-btn-container .c-button-default\");\n\t\t\t\t\tbyNoButtonF = By\n\t\t\t\t\t\t\t.cssSelector(\"button[class='c-button-default circular single-select-btn btn btn-default']\");\n\t\t\t\t\tbuttonFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"autoSuggFlag\":\n\t\t\t\t\tbyAutoSuggL = By.cssSelector(\".c-subheader-text.fs18.col-sm-12\"); // auto\n\t\t\t\t\tbyautoSuggF = By.xpath(\"//input[@autocomplete='off']\");\n\t\t\t\t\tautoSuggFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dropDownFlag\":\n\t\t\t\t\tbyDropdownF = By.cssSelector(\".Select-placeholder\");\n\t\t\t\t\tbyDropdownL = By.cssSelector(\".c-subheader-text.fs18\"); // select\n\t\t\t\t\tdropDownFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"checkboxFlag\":\n\t\t\t\t\tbyCheckboxL = By.cssSelector(\".custom-checkbox-container\");\n\t\t\t\t\tbyCheckboxF = By.cssSelector(\".custom-checkbox-container .custom-checkbox-checkmark\");\n\t\t\t\t\tcheckboxFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"datePickerFlag\":\n\t\t\t\t\tbyDatepickerL = By.cssSelector(\".c-subheader-text.fs18.col-sm-12\");\n\t\t\t\t\tbyDatepickerF = By.cssSelector(\".react-datepicker-wrapper\");\n\t\t\t\t\tdatePickerFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\n\t\t\t\t}\n\t\n\t\t\t\tSystem.out.println(line);\n\t\n\t\t\t}\n\t\n\t\t\tString pageType = \"def\";\n\t\t\tboolean flag = false, breakFlag = true, errorFlag = false, beneficiaryFlag = true;\n\t\n\t\t\tdo {\n\t\n\t\t\t\t\n\t\t\t\tcurrentURL = driver.getCurrentUrl();\n\t\t\t\t//Testutil.updateResult(Testutil.resultSheet, \"URL\", rowNum, currentURL);\n\t\t\t\tif (i == iteratorCount) {\n\t\t\t\t\tSystem.out.println(\"Iterator Limit\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*formFlag = 0;\n\t\t\t\tcheckboxFlag = 0;\n\t\t\t\tbuttonFlag = 0;\n\t\t\t\tdropDownFlag = 0;\n\t\t\t\tautoSuggFlag = 0;\n\t\t\t\tdatePickerFlag = 0;*/\n\t\t\t\t\n\t\n\t\t\t\tif (autoSuggFlag > 0) {\n\t\t\t\t\tpageType = \"autoSugg\";\n\t\t\t\t\tSystem.out.println(\"This is a page filled with \" + pageType);\n\t\t\t\t\t// checkPage(CheckNextElement(byautoSuggF),\n\t\t\t\t\t// byautoSuggF,pageType);\n\t\t\t\t\tbreakFlag = checkPage(CheckNextElement(autoSuggFlag, byAutoSuggL),\n\t\t\t\t\t\t\tCheckNextElement(autoSuggFlag, byautoSuggF), byAutoSuggL, byautoSuggF, pageType, sheetName);\n\t\n\t\t\t\t\tif (!breakFlag) {\n\t\t\t\t\t\tSystem.out.println(\"Break point\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t\n\t\n\t\t\t\tif (datePickerFlag > 0) {\n\t\t\t\t\tpageType = \"datepicker\";\n\t\t\t\t\tSystem.out.println(\"This is a page filled with \" + pageType);\n\t\t\t\t\t// checkPage(CheckNextElement(byDatepickerF),\n\t\t\t\t\t// byDatepickerF,pageType);\n\t\t\t\t\tbreakFlag = checkPage(CheckNextElement(datePickerFlag, byDatepickerL),\n\t\t\t\t\t\t\tCheckNextElement(datePickerFlag, byDatepickerF), byDatepickerL, byDatepickerF, pageType, sheetName);\n\t\t\t\t\tif (!breakFlag) {\n\t\t\t\t\t\tSystem.out.println(\"Break point\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t\n\t\t\t\tif (checkboxFlag > 0) {\n\t\t\t\t\tpageType = \"checkbox\";\n\t\t\t\t\tSystem.out.println(\"This is a page filled with \" + pageType);\n\t\t\t\t\tbreakFlag = checkPage(CheckNextElement(checkboxFlag, byCheckboxL),\n\t\t\t\t\t\t\tCheckNextElement(checkboxFlag, byCheckboxF), byCheckboxL, byCheckboxF, pageType, sheetName);\n\t\t\t\t\tif (!breakFlag) {\n\t\t\t\t\t\tSystem.out.println(\"Break point\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t\n\t\t\t\tif (formFlag > 0) {\n\t\t\t\t\tpageType = \"form\";\n\t\t\t\t\tSystem.out.println(\"This is a page filled with \" + pageType);\n\t\t\t\t\tbreakFlag = checkPage(CheckNextElement(formFlag, byFormL), CheckNextElement(formFlag, byFormF), byFormL,\n\t\t\t\t\t\t\tbyFormF, pageType, sheetName);\n\t\t\t\t\tif (!breakFlag) {\n\t\t\t\t\t\tSystem.out.println(\"Break point\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t\n\t\t\t\tif (buttonFlag > 0) {\n\t\t\t\t\tpageType = \"button\";\n\t\t\t\t\tSystem.out.println(\"This is a page filled with \" + pageType);\n\t\t\t\t\t// checkPage(CheckNextElement(byButtonF), byButtonF, pageType);\n\t\t\t\t\tbreakFlag = checkPage(CheckNextElement(buttonFlag, byButtonL), CheckNextElement(buttonFlag, byButtonF),\n\t\t\t\t\t\t\tbyButtonL, byButtonF, pageType, sheetName);\n\t\t\t\t\tif (!breakFlag) {\n\t\t\t\t\t\tSystem.out.println(\"Break point\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t\n\t\t\t\tif (dropDownFlag > 0) {\n\t\t\t\t\tpageType = \"dropdown\";\n\t\t\t\t\tSystem.out.println(\"This is a page filled with \" + pageType);\n\t\t\t\t\t\n\t\t\t\t\tbreakFlag = checkPage(CheckNextElement(dropDownFlag, byDropdownL),\n\t\t\t\t\t\t\tCheckNextElement(dropDownFlag, byDropdownF), byDropdownL, byDropdownF, pageType, sheetName);\n\t\t\t\t\tif (!breakFlag) {\n\t\t\t\t\t\tSystem.out.println(\"Break point\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\tboolean singlebutton = false;\n\t\n\t\t\t\tif (formFlag == 0 && checkboxFlag == 0 && buttonFlag == 0 && dropDownFlag == 0 && autoSuggFlag == 0\n\t\t\t\t\t\t&& datePickerFlag == 0) {\n\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\tflowFlag = true;\n\t\t\t\t\t\tdoneFlag = beneficiariesPage.addBeneficiaries(rowNum, clientType, signType, paymentType);\t\t\t\t\t\n\t\t\t\t\t\t//errorFlag = true;\n\t\t\t\t\t\tSystem.out.println(\"completed\");\n\t\t\t\t\t\tsinglebutton = true;\n\t\n\t\t\t\t\t} catch (NoSuchElementException e) {\n\t\t\t\t\t\tSystem.out.println(e.getStackTrace());\n\t\t\t\t\t\tSystem.out.println(\"issue with sign-up/beneficiary not reached\");\n\t\t\t\t\t\terrorFlag = true;\n\t\t\t\t\t\tsinglebutton = true;\n\t\t\t\t\t\tTestutil.updateResult(Testutil.resultSheet, \"Questions\", rowNum, \"Fail\");\n\t\t\t\t\t\tTestutil.updateResult(Testutil.resultSheet, \"URL\", rowNum, currentURL);\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tSystem.out.println(e.getStackTrace());\n\t\t\t\t\t\tSystem.out.println(\"other exception in addBeneficiaries\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\ti++;\n\t\t\t\t\n\t\t\t\tboolean singlebuttonFlag = false;\n\t\n\t\t\t\tif (formFlag == 0 && checkboxFlag == 0 && buttonFlag == 1 && dropDownFlag == 0 && autoSuggFlag == 0\n\t\t\t\t\t\t&& datePickerFlag == 0){\n\t\t\t\t\tsinglebutton = true;\n\t\t\t\t\tsinglebuttonFlag = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tboolean doubleButton = false;\n\t\n\t\t\t\tif (Testutil.doubleButtosFlag && singlebuttonFlag){\n\t\t\t\t\tsinglebutton = false;\n\t\t\t\t\tdoubleButton = true;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tboolean completeFlag = false;\n\t\t\t\t\n\t\t\t\tif(doubleButton && !Testutil.doubleButtosFlag ) completeFlag = true;\n\t\t\t\t\n\t\t\t\tif(clientType.equalsIgnoreCase(\"agent\") && doneFlag) agentFlag = true;\t\n\t\t\t\t\n\t\t\t\tif(flag || agentFlag){\n\t\t\t\t\tSystem.out.println(\"execution completed for agent type\");\n\t\t\t\t\tTestutil.updateResult(Testutil.resultSheet, \"Questions\", rowNum, \"Pass\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(!doneFlag && flowFlag){\n\t\t\t\t\tSystem.out.println(\"something went wrong\");\n\t\t\t\t\tTestutil.updateResult(Testutil.resultSheet, \"Questions\", rowNum, \"Fail\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (singlebutton || completeFlag || agentFlag) {\n\t\t\t\t\tSystem.out.println(\"only button with single page \" + i + \", auto load\");\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"All submited in page \" + i + \", going to next page. Clicking on Next button\");\n\t\n\t\t\t\t\tdriver.findElement(By.xpath(\"//button[@class='c-button-default circular action btn btn-default']\"))\n\t\t\t\t\t\t\t.click();\n\t\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tProductUtil.CheckElementDoNotExists(\".fa.fa-circle-o-notch\", true);\t\t\t\n\t\n\t\t\t\tformFlag = 0;\n\t\t\t\tcheckboxFlag = 0;\n\t\t\t\tbuttonFlag = 0;\n\t\t\t\tdropDownFlag = 0;\n\t\t\t\tautoSuggFlag = 0;\n\t\t\t\tdatePickerFlag = 0;\n\t\n\t\t\t\tele = null;\n\t\n\t\t\t\tele = FindElements();\n\t\n\t\t\t\tfor (Entry eleType : ele.entrySet()) {\n\t\n\t\t\t\t\tString line = eleType.getKey() + \" \" + eleType.getValue();\n\t\t\t\t\tSystem.out.println(\"Fields: \" + line);\n\t\t\t\t\tfieldFlag = eleType.getKey().toString();\n\t\n\t\t\t\t\tswitch (fieldFlag) {\n\t\n\t\t\t\t\tcase \"formFlag\":\n\t\t\t\t\t\tformFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"buttonFlag\":\n\t\t\t\t\t\tbuttonFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"autoSuggFlag\":\n\t\t\t\t\t\tautoSuggFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"dropDownFlag\":\n\t\t\t\t\t\tdropDownFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"checkboxFlag\": // byCheckboxL =\n\t\t\t\t\t\tBy.cssSelector(\".custom-checkbox-container\");\n\t\t\t\t\t\t\n\t\t\t\t\t\tcheckboxFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"datePickerFlag\": // byDatepickerL =\n\t\t\t\t\t\tBy.cssSelector(\".c-subheader-text.fs18.col-sm-12\");\n\t\t\t\t\t\t\n\t\t\t\t\t\tdatePickerFlag = Integer.parseInt(eleType.getValue().toString());\n\t\t\t\t\t\tbreak;\n\t\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\n\t\t\t\t\t}\n\t\n\t\t\t\t\tSystem.out.println(line);\n\t\n\t\t\t\t}\n\t\n\t\t\t\t\n\t\n\t\t\t\tif (formFlag == 0 && checkboxFlag == 0 && buttonFlag == 0 && dropDownFlag == 0 && autoSuggFlag == 0\n\t\t\t\t\t\t&& datePickerFlag == 0) {\n\t\t\t\t\tcounter++;\n\t\t\t\t\tif (counter == 2)\n\t\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\n\t\t\t\tif (!breakFlag){\n\t\t\t\t\tSystem.out.println(\"break point stopped the execution\");\n\t\t\t\t\tTestutil.updateResult(Testutil.resultSheet, \"Questions\", rowNum, \"Break\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tif(flag || doneFlag){\n\t\t\t\t\tSystem.out.println(\"execution completed\");\n\t\t\t\t\tTestutil.updateResult(Testutil.resultSheet, \"Questions\", rowNum, \"Pass\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\t\t\n\t\t\t\t\n\t\t\t\tif(errorFlag){\n\t\t\t\t\tSystem.out.println(\"execution completed with error\");\n\t\t\t\t\tTestutil.updateResult(Testutil.resultSheet, \"Questions\", rowNum, \"Fail\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\n\t\t\t} while (formFlag > 0 || checkboxFlag > 0 || buttonFlag > 0 || dropDownFlag > 0 || autoSuggFlag > 0\n\t\t\t\t\t|| datePickerFlag > 0 || beneficiaryFlag);\n\t\n\t\t\t//while (formFlag > 0 || checkboxFlag > 0 || buttonFlag > 0 || dropDownFlag > 0 || autoSuggFlag > 0 \t|| datePickerFlag > 0 || flag || doneFlag || errorFlag);\n\t\t\t// return new PersonalPage();\n\t\t\t\n\t\t\t//Testutil.updateResult(Testutil.resultSheet, \"URL\", rowNum, currentURL);\t\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(e.getStackTrace());\n\t\t\tSystem.out.println(\"other exception, Test failed/by passed\");\n\t\t\t\t\t\t\n\t\t}\n\n\t}", "public void getColumnModelForGSTR2_B2BDetails(JSONArray jarrRecords, JSONArray jarrColumns, JSONObject params) throws JSONException {\n String storeRec = \"\";\n\n String section = params.optString(\"section\");\n Locale requestcontextutilsobj = null;\n if (params.has(\"requestcontextutilsobj\")) {\n requestcontextutilsobj = (Locale) params.opt(\"requestcontextutilsobj\");\n }\n JSONObject jobjTemp = new JSONObject();\n storeRec = \",supplierName,date,gstin,billno,hsnno,value,taxableAmt,type,invNum,cess,igstamt,cgstamt,sgstamt,entityid,documentType,portcode,invoicetype\"\n + \",IGSTrate,IGSTamount,CGSTrate,CGSTamount,SGSTrate,SGSTamount,placeofsupply,ecomoperator,statecode,customer,originalhsnno,originaltype,totalTax,totalAmt,transtype,invoiceid,originalinvoicedate,originalinvoiceno,supplierType,supplierinvoiceno\";\n \n String[] recArr = storeRec.split(\",\");\n // Get those fields in record for whome, no special properties present like type, defVal, mapping etc.\n for (String rec : recArr) {\n jobjTemp = new JSONObject();\n jobjTemp.put(\"name\", rec);\n if (rec.equals(\"taxableAmt\") || rec.equals(\"igstamt\") || rec.equals(\"cgstamt\") || rec.equals(\"sgstamt\")\n || rec.equals(\"totalTax\") || rec.equals(\"totalAmt\") || rec.equals(\"cess\")) {\n jobjTemp.put(\"type\", \"float\");\n }\n jarrRecords.put(jobjTemp);\n }\n boolean hideFlag=false;\n if(params.optString(\"InvType\").equals(\"Import_of_service\")||params.optString(\"InvType\").equals(\"B2B_Unregistered\")||params.optString(\"InvType\").equals(\"Credit_note_unreg\")){\n hideFlag=true;\n }\n\n //\"Customer Name\"\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.supplierName\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"supplierName\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n \n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.supplierGSTIN\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"gstin\");\n jobjTemp.put(\"hidden\", hideFlag);\n jobjTemp.put(\"summaryRenderer\", \"function(){\\n\"\n + \" return '<div class=\\\"grid-summary-common\\\">'+WtfGlobal.getLocaleText(\\\"acc.common.total\\\")+'</div>'\\n\"\n + \" }\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n \n if (params.optString(\"InvType\").equals(\"Import_of_goods\") || params.optString(\"InvType\").equals(\"Nil_rated\")) {\n hideFlag = true;\n }\n if(params.optString(\"InvType\").equals(\"Import_of_service\")||params.optString(\"InvType\").equals(\"B2B_Unregistered\")){\n hideFlag = false;\n }\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.invoice.gridInvNo\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"invNum\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"hidden\", hideFlag);\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n \n if(params.optString(\"InvType\").equals(\"Import_of_service\")){\n hideFlag = true;\n }\n \n if (params.optString(\"InvType\").equals(\"Import_of_service\")||params.optString(\"InvType\").equals(\"Credit_note_reg\")||params.optString(\"InvType\").equals(\"B2B_reg\")||params.optString(\"InvType\").equals(\"B2B_Unregistered\")) {\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.agedPay.invoiceDate\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"date\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n }\n if (params.optString(\"InvType\").equals(\"Import_of_service\")||params.optString(\"InvType\").equals(\"Import_of_goods\")||params.optString(\"InvType\").equals(\"B2B_reg\")) {\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.CP.supplierinvoicenumber\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"supplierinvoiceno\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n }\n if (params.optString(\"InvType\").equals(\"Import_of_goods\")) {\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.billNo\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"invNum\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.billEntryDate\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"date\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n \n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.portCode\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"portcode\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n }\n if (params.optString(\"InvType\").equals(\"Credit_note_reg\")) {\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.field.DocumentType\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"invoicetype\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n }\n if (params.optString(\"InvType\").equals(\"Credit_note_unreg\")) {\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.invoice.gridInvNo\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"invNum\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.agedPay.invoiceDate\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"date\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.field.DocumentType\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"invoicetype\");\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.supplierType\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"supplierType\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.masterConfig.22\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.dnList.reason\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"reason\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n }\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.field.TotalInvoiceAmount\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"totalAmt\");\n jobjTemp.put(\"align\", \"right\");\n jobjTemp.put(\"renderer\", \"WtfGlobal.withoutRateCurrencyDeletedSymbol\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"summaryType\", \"sum\");\n jobjTemp.put(\"summaryRenderer\", \"WtfGlobal.currencySummaryRenderer\");\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n\n if (params.optString(\"InvType\").equals(\"B2B_Unregistered\")) {\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr1.placeofsupply\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"placeofsupply\");\n jobjTemp.put(\"summaryRenderer\", \"function(){\\n\"\n + \" return '<div class=\\\"grid-summary-common\\\">'+WtfGlobal.getLocaleText(\\\"acc.common.total\\\")+'</div>'\\n\"\n + \" }\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.supplierType\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"supplierType\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n }\n if(params.optString(\"InvType\").equals(\"Import_of_service\")){\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.dnList.reason\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"reason\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp); \n \n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr1.placeofsupply\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"placeofsupply\");\n jobjTemp.put(\"summaryRenderer\", \"function(){\\n\"\n + \" return '<div class=\\\"grid-summary-common\\\">'+WtfGlobal.getLocaleText(\\\"acc.common.total\\\")+'</div>'\\n\"\n + \" }\");\n jobjTemp.put(\"width\", 110);\n jobjTemp.put(\"pdfwidth\", 110);\n jarrColumns.put(jobjTemp);\n }\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.contract.product.replacement.Status\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"\"); \n jobjTemp.put(\"hidden\", hideFlag); \n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n \n if(params.optString(\"InvType\").equals(\"Credit_note_reg\")){\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.noteNumber\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"originalinvoiceno\");\n jobjTemp.put(\"hidden\", hideFlag);\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr2.noteDate\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"originalinvoicedate\"); \n jobjTemp.put(\"hidden\", hideFlag);\n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n }\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr1.taxableamount\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"taxableAmt\");\n jobjTemp.put(\"align\", \"right\");\n jobjTemp.put(\"renderer\", \"WtfGlobal.withoutRateCurrencyDeletedSymbol\");\n jobjTemp.put(\"summaryType\", \"sum\");\n jobjTemp.put(\"summaryRenderer\", \"WtfGlobal.currencySummaryRenderer\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr1.IGST\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"igstamt\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"renderer\", \"WtfGlobal.withoutRateCurrencyDeletedSymbol\");\n jobjTemp.put(\"align\", \"right\");\n jobjTemp.put(\"summaryType\", \"sum\");\n jobjTemp.put(\"summaryRenderer\", \"WtfGlobal.currencySummaryRenderer\");\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr1.CGST\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"cgstamt\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"renderer\", \"WtfGlobal.withoutRateCurrencyDeletedSymbol\");\n jobjTemp.put(\"align\", \"right\");\n jobjTemp.put(\"summaryType\", \"sum\");\n jobjTemp.put(\"summaryRenderer\", \"WtfGlobal.currencySummaryRenderer\");\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr1.SGST\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"sgstamt\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"renderer\", \"WtfGlobal.withoutRateCurrencyDeletedSymbol\");\n jobjTemp.put(\"align\", \"right\");\n jobjTemp.put(\"summaryType\", \"sum\");\n jobjTemp.put(\"summaryRenderer\", \"WtfGlobal.currencySummaryRenderer\");\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n \n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.gstr1.cessamount\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"cess\");\n jobjTemp.put(\"align\", \"right\");\n jobjTemp.put(\"renderer\", \"WtfGlobal.withoutRateCurrencyDeletedSymbol\");\n jobjTemp.put(\"summaryType\", \"sum\");\n jobjTemp.put(\"summaryRenderer\", \"WtfGlobal.currencySummaryRenderer\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n \n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", \"<b>\" + messageSource.getMessage(\"acc.contract.product.replacement.Status\", null, requestcontextutilsobj) + \"<b>\");\n jobjTemp.put(\"dataIndex\", \"\"); \n jobjTemp.put(\"align\", \"left\");\n jobjTemp.put(\"width\", 120);\n jobjTemp.put(\"pdfwidth\", 120);\n jarrColumns.put(jobjTemp);\n \n\n }", "private void putRequiredParameterForGSTReports(JSONObject params) throws JSONException, ServiceException {\n /* * before starting sectional data need to get column no for Product Tax\n * Class (HSN)\n */\n String companyId = params.optString(\"companyid\");\n int colnum = 0;\n HashMap fieldparams = new HashMap<>();\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Product_Master_ModuleId, \"Custom_\" + Constants.HSN_SACCODE));\n\n KwlReturnObject kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n List<FieldParams> fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n }\n params.put(\"hsncolnum\", colnum);\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Product_Master_ModuleId, \"Custom_\" + Constants.GSTProdCategory));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n }\n params.put(\"taxclasscolnum\", colnum);\n /**\n * Get Entity Value and its column no for invoice\n */\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Invoice_ModuleId, \"Custom_\" + Constants.ENTITY));\n String fieldid = \"\";\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n String entityValue = params.optString(\"entity\");\n String ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n params.put(\"invoiceentitycolnum\", colnum);\n params.put(\"invoiceentityValue\", ids);\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Receive_Payment_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n params.put(\"receiptentitycolnum\", colnum);\n params.put(\"receiptentityValue\", ids);\n\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Credit_Note_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n params.put(\"cnentitycolnum\", colnum);\n params.put(\"cnentityValue\", ids);\n\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Vendor_Invoice_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n params.put(\"goodsreceiptentitycolnum\", colnum);\n params.put(\"goodsreceiptentityValue\", ids);\n\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Debit_Note_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n params.put(\"dnentitycolnum\", colnum);\n params.put(\"dnentityValue\", ids);\n\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Make_Payment_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n params.put(\"paymententitycolnum\", colnum);\n params.put(\"paymententityValue\", ids);\n\n /**\n * get State column no for Invoice module\n */\n int colnumforstate = fieldManagerDAOobj.getColumnFromFieldParams(Constants.STATE, companyId, Constants.Acc_Invoice_ModuleId, 0);\n params.put(\"salesstatecolnum\", colnumforstate);\n\n colnumforstate = fieldManagerDAOobj.getColumnFromFieldParams(Constants.STATE, companyId, Constants.Acc_Vendor_Invoice_ModuleId, 0);\n params.put(\"purchasestatecolnum\", colnumforstate);\n\n String entityId = params.optString(\"entityid\");\n params.put(\"companyid\", companyId);\n params.put(\"entityid\", entityId);\n String localState = fieldManagerDAOobj.getStateForEntity(params);\n params.put(\"localState\", localState);\n params.put(GSTR3BConstants.DETAILED_VIEW_REPORT, true);\n /**\n * Put Asset Disposal/ Acquire Invoice Dimension column number details\n */\n putAssetInvoiceDimensionColumnDetails(params, params);\n /**\n * Put Lease Sales Invoice Dimension column number details\n */\n putLeaseInvoiceDimensionColumnDetails(params, params);\n }", "public JSONObject validateEwayFieldsData(JSONObject requestJobj) throws JSONException, FileNotFoundException, IOException, ServiceException {\n JSONObject jobj = new JSONObject();\n String msg = \"\";\n boolean issuccess = true;\n int total = 0, failed = 0, fileSize = 0;\n String fileName = \"\", extn = \"\";\n String exceededLimit = \"no\", channelName = \"\";\n try {\n fileName = (String) requestJobj.get(\"filename\");\n extn = fileName.substring(fileName.lastIndexOf(\".\") + 1);\n channelName = \"/ValidateFile/\" + fileName;\n String jsondata = requestJobj.optString(\"resjson\");\n jsondata = jsondata.replaceAll(\"\\\\n\", \"\").trim();\n JSONObject rootcsvjobj = new JSONObject(jsondata);\n JSONArray mapping = rootcsvjobj.getJSONArray(\"root\");\n\n String dateFormat = null, dateFormatId = requestJobj.optString(\"dateFormat\",\"\");\n if ((extn.equalsIgnoreCase(\"csv\") || extn.equalsIgnoreCase(\"xls\")) && !StringUtil.isNullOrEmpty(dateFormatId)) {\n KWLDateFormat kdf = (KWLDateFormat) kwlCommonTablesDAOObj.getClassObject(KWLDateFormat.class.getName(), dateFormatId);\n dateFormat = kdf != null ? kdf.getJavaForm() : null;\n }\n HashMap<String, Object> params = new HashMap<String, Object> ();\n params.put(\"moduleId\", String.valueOf(IndiaComplianceConstants.EWAY_BILL_IMPORT_MODULEID));\n params.put(\"companyid\", requestJobj.optString(\"companyid\"));\n params.put(\"isdocumentimport\", \"F\");\n params.put(\"subModuleFlag\", new Integer(0));\n params.put(\"isBomlessFile\", false);\n params.put(\"updateExistingRecordFlag\", false);\n JSONArray columnConfig = importHandler.getModuleColumnConfig(params);\n \n String tableName = importDao.getTableName(fileName);\n KwlReturnObject kresult = importDao.getFileData(tableName, new HashMap<String, Object>());\n List fileDataList = kresult.getEntityList();\n Iterator itr = fileDataList.iterator();\n\n importDao.markRecordValidation(tableName, -1, 1, \"\", \"\"); //reset all invalidation\n JSONArray recordJArr = new JSONArray(), columnsJArr = new JSONArray(), DataJArr = new JSONArray();\n if (itr.hasNext()) { //this if block create an array of column data of file\n Object[] fileData = (Object[]) itr.next();\n JSONObject jtemp = new JSONObject();\n jtemp.put(\"header\", \"Row No.\");\n jtemp.put(\"dataIndex\", \"col0\");\n jtemp.put(\"width\", 50);\n columnsJArr.put(jtemp);\n\n for (int i = 1; i < fileData.length - 3; i++) { //Discard columns, id at index 0 and isvalid,validationlog at last 2.\n jtemp = new JSONObject();\n jtemp.put(\"header\", fileData[i] == null ? \"\" : fileData[i].toString());\n jtemp.put(\"dataIndex\", \"col\" + i);\n columnsJArr.put(jtemp);\n }\n\n jtemp = new JSONObject();\n jtemp.put(\"header\", \"Validation Log\");\n jtemp.put(\"dataIndex\", \"validateLog\");\n columnsJArr.put(jtemp);\n\n //Create record Obj for grid's store\n for (int i = 0; i < fileData.length - 1; i++) {\n jtemp = new JSONObject();\n jtemp.put(\"name\", \"col\" + i);\n recordJArr.put(jtemp);\n }\n jtemp = new JSONObject();\n jtemp.put(\"name\", \"validateLog\");\n recordJArr.put(jtemp);\n }\n try {\n jobj.put(\"record\", recordJArr);\n jobj.put(\"columns\", columnsJArr);\n jobj.put(\"data\", DataJArr);\n jobj.put(\"count\", failed);\n jobj.put(\"valid\", 0);\n jobj.put(\"totalrecords\", total);\n jobj.put(\"isHeader\", true);\n jobj.put(\"finishedValidation\", false);\n ServerEventManager.publish(channelName, jobj.toString(), (ServletContext) requestJobj.get(\"servletContext\"));\n } catch (Exception ex) {\n throw ex;\n }\n fileSize = fileDataList.size() - 1;\n jobj.put(\"isHeader\", false);\n int recIndex = 0;\n /*\n * Get Custom Table and its All details\n */\n KwlReturnObject kwlReturnObject = accMasterItemsDAOobj.getCustomTableName(new JSONObject());\n List customTableList = kwlReturnObject.getEntityList();\n JSONArray customTablesArrayObj = accMasterItemsDAOobj.createJsonForCustomTableList(customTableList);\n \n while (itr.hasNext()) {\n Object[] fileData = (Object[]) itr.next();\n recIndex = (Integer) fileData[0];\n HashMap<String, Object> dataMap = new HashMap<String, Object>();\n HashMap<String, Object> columnHeaderMap = new HashMap<String, Object>();\n HashMap<String, Object> columnCSVindexMap = new HashMap<String, Object>();\n for (int k = 0; k < mapping.length(); k++) {\n JSONObject mappingJson = mapping.getJSONObject(k);\n String datakey = mappingJson.getString(\"columnname\");\n Object dataValue = importHandler.cleanHTML((String) fileData[mappingJson.getInt(\"csvindex\") + 1]); //+1 for id column at index-0\n dataMap.put(datakey, dataValue);\n columnHeaderMap.put(datakey, mappingJson.getString(\"csvheader\"));\n columnCSVindexMap.put(datakey, mappingJson.getInt(\"csvindex\") + 1);\n }\n try {\n //Update processing status at client side\n if (total > 0 && total % 10 == 0) {\n try {\n ServerEventManager.publish(channelName, \"{parsedCount:\" + total + \",invalidCount:\" + failed + \", fileSize:\" + fileSize + \", finishedValidation:false}\", (ServletContext) requestJobj.get(\"servletContext\"));\n } catch (Exception ex) {\n throw ex;\n }\n }\n /**\n * Validate each field from individual row\n */\n validateEwayFieldsImportColumns(requestJobj,columnConfig, dataMap,columnHeaderMap,columnCSVindexMap,customTablesArrayObj,dateFormat);\n } catch (Exception ex) {\n failed++;\n String errorMsg = ex.getMessage(), invalidColumns = \"\";\n try {\n JSONObject errorLog = new JSONObject(errorMsg);\n errorMsg = errorLog.getString(\"errorMsg\");\n invalidColumns = errorLog.getString(\"invalidColumns\");\n } catch (JSONException jex) {\n }\n\n importDao.markRecordValidation(tableName, recIndex, 0, errorMsg, invalidColumns);\n JSONObject jtemp = new JSONObject();\n for (int i = 0; i < fileData.length - 2; i++) {\n jtemp.put(\"col\" + i, fileData[i] == null ? \"\" : fileData[i].toString());\n }\n jtemp.put(\"invalidcolumns\", invalidColumns);\n jtemp.put(\"validateLog\", errorMsg);\n DataJArr.put(jtemp);\n }\n total++;\n }\n int success = total - failed;\n if (total == 0) {\n msg = \"Empty file.\";\n } else if (success == 0) {\n msg = \"All the records are invalid.\";\n } else if (success == total) {\n msg = \"All the records are valid.\";\n } else {\n msg = \"\" + success + \" valid record\" + (success > 1 ? \"s\" : \"\") + \"\";\n msg += (failed == 0 ? \".\" : \" and \" + failed + \" invalid record\" + (failed > 1 ? \"s\" : \"\") + \".\");\n }\n jobj.put(\"record\", recordJArr);\n jobj.put(\"columns\", columnsJArr);\n jobj.put(\"data\", DataJArr);\n jobj.put(\"count\", failed);\n jobj.put(\"valid\", success);\n jobj.put(\"totalrecords\", total);\n try {\n ServerEventManager.publish(channelName, \"{parsedCount:\" + total + \",invalidCount:\" + failed + \", fileSize:\" + fileSize + \", finishedValidation:true}\", (ServletContext) requestJobj.get(\"servletContext\"));\n } catch (Exception ex) {\n throw ex;\n }\n } catch (Exception e) {\n issuccess = false;\n msg = \"\" + e.getMessage();\n Logger.getLogger(AccEntityGstServiceImpl.class.getName()).log(Level.SEVERE, null, e);\n } finally {\n try {\n jobj.put(\"success\", issuccess);\n jobj.put(\"msg\", msg);\n jobj.put(\"exceededLimit\", exceededLimit);\n } catch (JSONException ex) {\n Logger.getLogger(AccEntityGstServiceImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n return jobj;\n }", "public static List<Models.Payment> parseFile(Models.Buyer buyerInfo) {\r\n\t\t\r\n BufferedReader br = null;\r\n String line = \"\";\r\n\t\tString[] columns;\r\n\t\tList<Models.Payment> payments = null;\t\t\r\n\r\n\t\tBoolean headerRow = true;\r\n\t\t\r\n \t//Get all possible files in the configured directory that match our file mask and iterate, parse and send json payload for each\r\n\t\theaderOrdinals = new ArrayList<Map.Entry<String, Integer>>();\r\n \ttry {\r\n \t\theaderRow = true;\r\n \t\tpayments = new ArrayList<Models.Payment>();\r\n \tString[] columnHeaders = null;\r\n \t\r\n \tFile file = findFileByMask(buyerInfo)[0];\r\n br = new BufferedReader(new FileReader(file.getPath()));\r\n csvParser parser = new csvParser();\r\n while ((line = br.readLine()) != null) {\r\n //split each line utilizing the RegEx pattern which will perfectly split CSV's and ignore commas within quotes or tics for a string field\r\n \tcolumns = parser.parse(line);\r\n \t\r\n //for the first row, grab the column header names and match against our container object, each iteration thereafter, just stuff values in our object[] which will become a json payload\r\n if (!headerRow) { \r\n \tModels.Payment invoice = new Models.Payment();\r\n \t\r\n \ttry {\r\n \t\t//match the column header key string in map to the property in our container object. Then use ordinal in map to snatch correct value from the String[]\r\n \t\tfor (Map.Entry<String, Integer> colMap:headerOrdinals) {\r\n \t\t\tMethod methodProperty = invoice.getClass().getMethod(String.format(\"set%s\", colMap.getKey()), new Class[] {String.class});\r\n \t\t\t\r\n \t\t\t//dynamically set the matching property in our payment container object by matching the previously fetched column headers\r\n \t\t\tif (methodProperty != null) methodProperty.invoke(invoice, columns[colMap.getValue()]);\r\n \t\t}\r\n \t\t\t//Our payment object should now be populated from the parsed line, now add to the collection that we shall POST to API as JSON.\r\n \t\t\tpayments.add(invoice); \t\r\n \t} catch (Exception ex) {\r\n \t\t//log any exception mapping fields\r\n \t\t\t\t//log any problems locally as well as remotely. Need to make an object to hold all needed fields to POST to our API for logging all\r\n \t\t\t\t// of this activity out in the field\r\n \t\t\t\t//This here will be a log of a failure to stuff the column value into the property data type, which shouldn't happen at all really. \t\t\r\n \t}\t \t\r\n }\r\n else {\r\n \t//we will take the 1st row in the csv file and do a sanity check of header column names against our container object utilizing reflection. This will make for\r\n \t// only clean and matching data to be sent to our API via json. \r\n \tcolumnHeaders = columns;\r\n \tif (!matchHeadersAgainstModel(columnHeaders, file.getName())) {\r\n \t\t\t\t\tlogger.log(Level.WARNING, String.format(\"No columns matched. It would appear there is no column header row in file %s.\", file.getName()), Thread.currentThread().getStackTrace());\t \r\n \t\t\t\t\t//send this message to us via api\r\n \t\t\t\t\t//we could proceed with a generic JObject push here if we really wanted to still see the data and just dump it to us.\r\n \t}\r\n \theaderRow = false;\r\n } \r\n \t}\r\n \t\t\t \t\t \t\r\n\t } catch (FileNotFoundException e) {\r\n\t\t\t\tlogger.log(Level.WARNING, String.format(\"No file found to process : %s\", e.getMessage()), Thread.currentThread().getStackTrace());\r\n\t e.printStackTrace();\r\n\t //Log this locally in custom event log and send\r\n\t } catch (IOException e) {\r\n\t\t\t\tlogger.log(Level.WARNING, String.format(\"IOException when attempting to access payment file for processing : %s\", e.getMessage()), Thread.currentThread().getStackTrace());\r\n\t e.printStackTrace();\r\n\t //log both locally and send log to us via API call\r\n\t } finally {\r\n\t if (br != null) {\r\n\t try { \r\n\t br.close();\r\n\t } catch (IOException e) {\r\n\t e.printStackTrace();\r\n\t //again, log locally and to us via API any problems here\r\n\t }\r\n\t }\r\n\t }\r\n\t\r\n\t String json = new Gson().toJson(payments);\r\n\t //the above payload is the payload to send the payment batch to our API\t\r\n\t\t\tlogger.log(Level.INFO, \"Json Payload to send: \" + json, new Object[] {});\r\n\t\t\t\r\n\t\t\t//POST our beautifully constructed invoice[] as JSON to our API\r\n\t try {\r\n\t \t//We want the payment batch to be processed as a batch for good batch logging, so each file's payload should be posted to the API separately as json for adequate batch processing\r\n\t \t\r\n\t \t//HttpClient httpClient = HttpClientBuilder.create().build();\r\n\t \t//HttpPost post = new HttpPost(buyerInfo.getApiLogUrl()); \t\r\n\t \t// post.invoke(new Gson().toJson(payments));\r\n\t } catch (HTTPException ex) {\r\n\t \t\r\n\t }\r\n \r\n \r\n\t return payments;\r\n\t}", "public List<HCLFieldTransaction> getTransactionbyType(String transactionType)\r\n\t\t\tthrows JsonProcessingException, IOException {\r\n\r\n\t\tlogger.info(\"Logger Name: getTransactionbyType() :: \" + logger.getName());\r\n\t\tlogger.debug(\"Transaction Type : getTransactionbyType() :: \" + transactionType);\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\r\n\t\tlogger.info(\"Open Bank API URL :: getTotalAmountbyTransactionType() :: \"\r\n\t\t\t\t+ TransactionConstant.THIRD_PARTY_REST_API);\r\n\t\tJsonNode root = mapper.readTree(new URL(TransactionConstant.THIRD_PARTY_REST_API));\r\n\r\n\t\tList<HCLFieldTransaction> transactionList = new ArrayList<HCLFieldTransaction>();\r\n\r\n\t\t/* Traversing Nested JSON node to publish the relevant data */\r\n\t\ttry {\r\n\t\t\tJsonNode transactionsNodes = root.path(\"transactions\");\r\n\r\n\t\t\tfor (JsonNode transactionsNode : transactionsNodes) {\r\n\r\n\t\t\t\tHCLFieldTransaction hclFieldTransaction = new HCLFieldTransaction();\r\n\t\t\t\tJsonNode details = transactionsNode.path(\"details\");\r\n\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\r\n\t\t\t\t/* When transactionType is null or empty */\r\n\t\t\t\tif (transactionType == null && details.path(\"type\").isNull() == true) {\r\n\t\t\t\t\thclFieldTransaction.setId(transactionsNode.path(\"id\").asText());\r\n\r\n\t\t\t\t\tJsonNode thisAccount_Node = transactionsNode.path(\"this_account\");\r\n\t\t\t\t\thclFieldTransaction.setAccountId(thisAccount_Node.path(\"id\").asText());\r\n\r\n\t\t\t\t\tJsonNode otherAccount_Node = transactionsNode.path(\"other_account\");\r\n\t\t\t\t\thclFieldTransaction.setCounterpartyAccount(otherAccount_Node.path(\"number\").asText());\r\n\r\n\t\t\t\t\tJsonNode otherAccount_holder_Node = otherAccount_Node.path(\"holder\");\r\n\t\t\t\t\thclFieldTransaction.setCounterpartyName(otherAccount_holder_Node.path(\"name\").asText());\r\n\t\t\t\t\tJsonNode metadata = otherAccount_Node.path(\"metadata\");\r\n\t\t\t\t\thclFieldTransaction.setCounterPartyLogoPath(metadata.path(\"open_corporates_URL\").asText());\r\n\r\n\t\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\t\t\t\t\thclFieldTransaction.setDescription(details.path(\"description\").asText());\r\n\r\n\t\t\t\t\tJsonNode value = details.path(\"value\");\r\n\t\t\t\t\thclFieldTransaction.setInstructedAmount(value.path(\"amount\").asDouble());\r\n\r\n\t\t\t\t\thclFieldTransaction.setInstructedCurrency(value.path(\"currency\").asText());\r\n\r\n\t\t\t\t\thclFieldTransaction.setTransactionAmount(value.path(\"amount\").asDouble());\r\n\t\t\t\t\thclFieldTransaction.setTransactionCurrency(value.path(\"currency\").asText());\r\n\t\t\t\t\tlogger.debug(\"Transaction Field Row Value:: \" + hclFieldTransaction.toString());\r\n\r\n\t\t\t\t\t/* Adding specific type of transaction list into one ArrayList */\r\n\t\t\t\t\ttransactionList.add(hclFieldTransaction);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/* When transactionType is not null or empty */\r\n\t\t\t\telse if (transactionType != null) {\r\n\r\n\t\t\t\t\tif (hclFieldTransaction.getTransactionType().equalsIgnoreCase(transactionType.trim())) {\r\n\r\n\t\t\t\t\t\tlogger.debug(\"Transaction Type :: \" + transactionType);\r\n\t\t\t\t\t\thclFieldTransaction.setId(transactionsNode.path(\"id\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode thisAccount_Node = transactionsNode.path(\"this_account\");\r\n\t\t\t\t\t\thclFieldTransaction.setAccountId(thisAccount_Node.path(\"id\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode otherAccount_Node = transactionsNode.path(\"other_account\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterpartyAccount(otherAccount_Node.path(\"number\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode otherAccount_holder_Node = otherAccount_Node.path(\"holder\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterpartyName(otherAccount_holder_Node.path(\"name\").asText());\r\n\t\t\t\t\t\tJsonNode metadata = otherAccount_Node.path(\"metadata\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterPartyLogoPath(metadata.path(\"open_corporates_URL\").asText());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\t\t\t\t\t\thclFieldTransaction.setDescription(details.path(\"description\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode value = details.path(\"value\");\r\n\t\t\t\t\t\thclFieldTransaction.setInstructedAmount(value.path(\"amount\").asDouble());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setInstructedCurrency(value.path(\"currency\").asText());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionAmount(value.path(\"amount\").asDouble());\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionCurrency(value.path(\"currency\").asText());\r\n\t\t\t\t\t\tlogger.debug(\"Transaction Field Row Value:: \" + hclFieldTransaction.toString());\r\n\r\n\t\t\t\t\t\t/* Adding specific type of transaction list into one ArrayList */\r\n\t\t\t\t\t\ttransactionList.add(hclFieldTransaction);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.error(\"Exception : getTransactionbyType() :: \", e);\r\n\t\t}\r\n\t\tlogger.info(\"Return value from service layer:: getTransactionbyType() :: \" + transactionList.toString());\r\n\t\treturn transactionList;\r\n\r\n\t}", "private JSONObject getGSTR3B_Section_3_1_E_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n JSONObject jSONObject = new JSONObject();\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA );\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Non_GST_Product);\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n jSONObject = getInvoiceForGSTR3BNillRated(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n }\n /**\n * Debit Note-\n * REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: NON-GST.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Non_GST_Product);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA );\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n temp = getDNAgainstSalesForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n\n }\n /**\n * Credit Note-\n * REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: NON-GST.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Non_GST_Product);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n temp = getCNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n }\n\n /**\n * Advance Liability-\n * REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: NON-GST.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Non_GST_Product);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n JSONObject tempObj = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_PAYMENT_RECEIPT || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n tempObj = getTaxLiabilityOnAdvance(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = tempObj.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n temp = tempObj.optJSONObject(\"gstr3Obj\");\n double totaltaxamt = temp.optDouble(\"csgst3b\", 0.0) + temp.optDouble(\"cgst3b\", 0.0) + temp.optDouble(\"sgst3b\", 0.0) + temp.optDouble(\"igst3b\", 0.0);\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt3b\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst3b\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst3b\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst3b\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst3b\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + totaltaxamt), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"taxableamt3b\", 0.0) + totaltaxamt), companyId));\n }\n /**\n * Adjusted Advance-\n * REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: NON-GST.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Non_GST_Product);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA );\n tempObj = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_PAYMENT_RECEIPT || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n tempObj = getAdjustedAdvance(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = tempObj.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n temp = tempObj.optJSONObject(\"gstr3Obj\");\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_3_1_E);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "@RequestMapping(value = \"/exportExcelAllSchoolOrder\", method = RequestMethod.POST)\r\n public ModelAndView exportExcelAllSchoolOrder(Model model, HttpServletRequest request) {\n \tString companyId = request.getParameter(\"companyId\");\r\n \tMap<String,Object>map = new HashMap<String,Object>();\r\n \tPayOrder payOrder = new PayOrder();\r\n \t//if(!\"0\".equals(isArea)){\r\n \t\tmap.put(\"companyId\",companyId);\r\n \t//}\r\n \tmap.put(\"orderNum\",request.getParameter(\"orderNum\"));\r\n \tmap.put(\"inpstart\",request.getParameter(\"inpstart\"));\r\n \tmap.put(\"inpend\",request.getParameter(\"inpend\"));\r\n \tmap.put(\"payMethod\",request.getParameter(\"payMethod\"));\r\n \tmap.put(\"firstPrice\",request.getParameter(\"firstPrice\"));\r\n \tmap.put(\"secondPrice\",request.getParameter(\"secondPrice\"));\r\n \tmap.put(\"pageSize\",1000000);\r\n \tmap.put(\"page\",payOrder.getFirstIndex());\r\n \t\r\n \t//2018-1-29 新增 支付方式\r\n \tmap.put(\"payStates\",request.getParameter(\"payStates\"));\r\n \t// 查询 订单 集合\r\n \tList<PayOrder> cpoList = this.payOrderServiceImpl.findPayOrderByParams(map);\r\n \tString tittle = \"订单编号:orderNum,课程名:commodityName,金额(元):payPrice,姓名:stuName,电话:discountNo,下单时间:orderTime,付款时间:payTime,订单状态:payStatus\";\r\n \tExcelSheetEntity entity = ExcelSheetEntity.newInstance(\r\n \t\t\ttittle,\r\n \t\t\tcpoList);\r\n \tMap<String,Object>map01 = new HashMap<String,Object>();\r\n \tmap01.put(\"entity\", entity);\r\n \tmap01.put(\"fileName\", \"订单.xls\");\r\n \tViewFiles excel = new ViewFiles();\r\n \treturn new ModelAndView(excel, map01);\r\n }", "private JSONObject getGSTR3B_Section_5_1_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Exempted);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.put(\"itctype\", Constants.GST_ITCTYPE_DEFAULT+\",\"+Constants.GST_ITCTYPE_REVERSED);\n JSONObject jSONObject = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n jSONObject = getGoodsReceiptForGSTR3BNonGST(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n }\n /**\n * Vendor DN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Exempted);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.remove(\"cnentityValue\");\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n }\n /**\n * Vendor CN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Exempted);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.put(\"onlycnagainstvendor\", true);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_5_1);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true); \n }\n /**\n * Purchase Invoice- REGTYPE:Unregistered.CUSTTYPE:NA. ERP-40740\n * Interstate/Intrastate: Both. RCM : FALSE.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isGSTINnull\", true);\n reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getGoodsReceiptForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_5_1);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n }\n /**\n * Vendor DN (ERP-40740)\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.remove(\"cnentityValue\");\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_5_1);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n }\n /**\n * Vendor CN (ERP-40740)\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.put(\"onlycnagainstvendor\", true);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_5_1);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "@Test\n public void createBillingLineTestHappyPath() {\n\n Billinglines BillingLineObj = new Billinglines();\n\n BillingLineObj.setOrderId(\"b1375915-6c3d-4df5-aac2-aaf400e3ebab\");\n BillingLineObj.setPlannerId(\"90C44CAE-2A4A-4B5D-A5EC-AA9500A6C839\");\n BillingLineObj.setProductId(\"3B50FC9A-26B1-42C7-A7B4-AACB0084B9E4\");\n BillingLineObj.setStartMonth(\"2019-11-30\");\n BillingLineObj.setDurationInMonths(2);\n\n // final JSONArray arr = new JSONArray();\n\n /*for(int i = 0 ; i< list.size() ; i++) {\n final JSONObject obj = new JSONObject();\n p = list.get(i);\n obj.add(\"id\", p.getId());\n arr.add(obj);\n }\n\n\n for(int i = 0 ; i< list.size() ; i++) {\n final JSONObject obj = new JSONObject();\n p = list.get(i);\n obj.add(\"date\", new MyDateFormatter().getStringFromDateDifference(p.getCreationDate()));\n obj.add(\"value\", p.getValue());\n }*/\n\n BillingLineObj.setBillingLineBuyingAreaRevenues(Arrays.asList(new String[]{\"id\",\"8798f1f5-cd1b-455e-b44a-aacb00845536\"}));\n BillingLineObj.setMonthBuyingAreaRevenues(Arrays.asList(new String[]{\"date\",\"2019-11-30\"}));\n //BillingLineObj.setValue(444);\n BillingLineObj.setRevenue(444);\n String json = Utilities.createJsonObject(BillingLineObj);\n System.out.println(\">>>>>>>\\n\\n\\n\" + json);\n\n Response response = APIRequests.PostAPI(path, json);\n Assert.assertEquals(\"Check status codes for successful response \", 200,response.getStatusCode());\n System.out.println(\">>>>> \" + response.getStatusCode());\n\n }", "public JSONObject convertHSNJSONForEfilling(JSONObject dataObj) throws JSONException {\n JSONObject returnobj = new JSONObject();\n JSONArray finalArr=new JSONArray();\n JSONArray dataArr = dataObj.optJSONArray(\"data\");\n Map<String, JSONArray> hsnMap = AccountingManager.getSortedArrayMapBasedOnJSONAttribute(dataArr,\"hsnno\");\n for (String hsnkey : hsnMap.keySet()) {\n JSONArray hsnArr = hsnMap.get(hsnkey);\n Map<String, JSONArray> uqcMap = AccountingManager.getSortedArrayMapBasedOnJSONAttribute(hsnArr, \"uqc\");\n for (String uqckey : uqcMap.keySet()) {\n JSONObject jSONObject=new JSONObject();\n JSONArray itemArr = uqcMap.get(uqckey);\n for (int i = 0; i < itemArr.length(); i++) {\n JSONObject itemObj = itemArr.getJSONObject(i);\n jSONObject.put(\"hsnno\", itemObj.optString(\"hsnno\"));\n jSONObject.put(\"description\", itemObj.optString(\"description\"));\n jSONObject.put(\"uqc\", itemObj.optString(\"uqc\"));\n jSONObject.put(\"totalquantity\", jSONObject.optDouble(\"totalquantity\",0) + itemObj.optDouble(\"totalquantity\",0));\n jSONObject.put(\"taxableAmt\", jSONObject.optDouble(\"taxableAmt\",0) + itemObj.optDouble(\"taxableAmt\",0));\n jSONObject.put(\"IGSTamount\", jSONObject.optDouble(\"IGSTamount\",0) + itemObj.optDouble(\"IGSTamount\",0));\n jSONObject.put(\"CGSTamount\", jSONObject.optDouble(\"CGSTamount\",0) + itemObj.optDouble(\"CGSTamount\",0));\n jSONObject.put(\"SGSTamount\", jSONObject.optDouble(\"SGSTamount\",0) + itemObj.optDouble(\"SGSTamount\",0));\n jSONObject.put(\"cess\", jSONObject.optDouble(\"cess\",0) + itemObj.optDouble(\"cess\",0));\n jSONObject.put(\"totaltax\", jSONObject.optDouble(\"totaltax\",0) + itemObj.optDouble(\"totaltax\",0));\n jSONObject.put(\"totalAmt\", jSONObject.optDouble(\"totalAmt\",0) + itemObj.optDouble(\"totalAmt\",0));\n jSONObject.put(\"gstin\", \"NA\");\n }\n finalArr.put(jSONObject);\n }\n }\n return returnobj.put(\"data\", finalArr) ;\n}", "@Override\r\n\tpublic void exportLogExcel(SapDataCollection sapDataCollection,\r\n\t\t\tJSONObject json, String optflag, String bdate, String edate,\r\n\t\t\tHttpServletResponse response) throws IOException,\r\n\t\t\tSecurityException, NoSuchMethodException, IllegalArgumentException,\r\n\t\t\tIllegalAccessException, InvocationTargetException,\r\n\t\t\tURISyntaxException {\n\t\tList<RuntimeColumnInfo> kna1list = runtime_ColumnInfo_Service.findAllActiveData(sapDataCollection, SjlxTypeName.TYPE_CUSTOMER_KNA1);\r\n\t\tList<RuntimeColumnInfo> knb1list = runtime_ColumnInfo_Service.findAllActiveData(sapDataCollection, SjlxTypeName.TYPE_CUSTOMER_KNB1);\r\n\t\tList<RuntimeColumnInfo> knvvlist = runtime_ColumnInfo_Service.findAllActiveData(sapDataCollection, SjlxTypeName.TYPE_CUSTOMER_KNVV);\r\n\t\tString[] kna1titles = new String[kna1list.size()*2+6],kna1fields=new String[kna1list.size()*2+6];\r\n\t\tString[] knb1titles = new String[knb1list.size()*2+6],knb1fields=new String[knb1list.size()*2+6];\r\n\t\tString[] knvvtitles = new String[knvvlist.size()*2+6],knvvfields=new String[knvvlist.size()*2+6];\r\n\t\tif(kna1list!=null&&kna1list.size()>0){\r\n\t\t\tkna1titles[0]=\"操作结果\";\r\n\t\t\tkna1fields[0]=\"optflag\";\r\n\t\t\tkna1titles[1]=\"操作时间\";\r\n\t\t\tkna1fields[1]=\"opttime\";\r\n\t\t\tkna1titles[2]=\"操作人\";\r\n\t\t\tkna1fields[2]=\"optuser\";\r\n\t\t\tkna1titles[3]=\"操作\";\r\n\t\t\tkna1fields[3]=\"opt\";\r\n\t\t\tkna1titles[4]=\"操作类型\";\r\n\t\t\tkna1fields[4]=\"opttype\";\r\n\t\t\tkna1titles[5]=\"异常信息\";\r\n\t\t\tkna1fields[5]=\"optmsg\";\r\n\t\t\tint count=6;\r\n\t\t\tfor(RuntimeColumnInfo runtimeColumnInfo : kna1list){\r\n\t\t\t\tkna1titles[count]=runtimeColumnInfo.getTargetColumnName();\r\n\t\t\t\tkna1fields[count]=runtimeColumnInfo.getTargetColumn();\r\n\t\t\t\tcount++;\r\n\t\t\t\tkna1titles[count]=runtimeColumnInfo.getTargetColumnName()+\"_原值\";\r\n\t\t\t\tkna1fields[count]=runtimeColumnInfo.getTargetColumn()+\"_old\";\r\n\t\t\t\tcount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(knb1list!=null&&knb1list.size()>0){\r\n\t\t\tknb1titles[0]=\"操作结果\";\r\n\t\t\tknb1fields[0]=\"optflag\";\r\n\t\t\tknb1titles[1]=\"操作时间\";\r\n\t\t\tknb1fields[1]=\"opttime\";\r\n\t\t\tknb1titles[2]=\"操作人\";\r\n\t\t\tknb1fields[2]=\"optuser\";\r\n\t\t\tknb1titles[3]=\"操作\";\r\n\t\t\tknb1fields[3]=\"opt\";\r\n\t\t\tknb1titles[4]=\"操作类型\";\r\n\t\t\tknb1fields[4]=\"opttype\";\r\n\t\t\tknb1titles[5]=\"异常信息\";\r\n\t\t\tknb1fields[5]=\"optmsg\";\r\n\t\t\tint count=6;\r\n\t\t\tfor(RuntimeColumnInfo runtimeColumnInfo : knb1list){\r\n\t\t\t\tknb1titles[count]=runtimeColumnInfo.getTargetColumnName();\r\n\t\t\t\tknb1fields[count]=runtimeColumnInfo.getTargetColumn();\r\n\t\t\t\tcount++;\r\n\t\t\t\tknb1titles[count]=runtimeColumnInfo.getTargetColumnName()+\"_原值\";\r\n\t\t\t\tknb1fields[count]=runtimeColumnInfo.getTargetColumn()+\"_old\";\r\n\t\t\t\tcount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(knvvlist!=null&&knvvlist.size()>0){\r\n\t\t\tknvvtitles[0]=\"操作结果\";\r\n\t\t\tknvvfields[0]=\"optflag\";\r\n\t\t\tknvvtitles[1]=\"操作时间\";\r\n\t\t\tknvvfields[1]=\"opttime\";\r\n\t\t\tknvvtitles[2]=\"操作人\";\r\n\t\t\tknvvfields[2]=\"optuser\";\r\n\t\t\tknvvtitles[3]=\"操作\";\r\n\t\t\tknvvfields[3]=\"opt\";\r\n\t\t\tknvvtitles[4]=\"操作类型\";\r\n\t\t\tknvvfields[4]=\"opttype\";\r\n\t\t\tknvvtitles[5]=\"异常信息\";\r\n\t\t\tknvvfields[5]=\"optmsg\";\r\n\t\t\tint count=6;\r\n\t\t\tfor(RuntimeColumnInfo runtimeColumnInfo : knvvlist){\r\n\t\t\t\tknvvtitles[count]=runtimeColumnInfo.getTargetColumnName();\r\n\t\t\t\tknvvfields[count]=runtimeColumnInfo.getTargetColumn();\r\n\t\t\t\tcount++;\r\n\t\t\t\tknvvtitles[count]=runtimeColumnInfo.getTargetColumnName()+\"_原值\";\r\n\t\t\t\tknvvfields[count]=runtimeColumnInfo.getTargetColumn()+\"_old\";\r\n\t\t\t\tcount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tlong kna1totalNum = commonLogService.findTotalNum(sapDataCollection,\"Kna1Log\", json, optflag, bdate, edate);\r\n\t\tlong knb1totalNum = commonLogService.findTotalNum(sapDataCollection,\"Knb1Log\", json, optflag, bdate, edate);\r\n\t\tlong knvvtotalNum = commonLogService.findTotalNum(sapDataCollection,\"KnvvLog\", json, optflag, bdate, edate);\r\n\t\tCalendar c = Calendar.getInstance();\r\n\t\tSimpleDateFormat sf = new SimpleDateFormat(\"yyyyMMdd\");\r\n\t\tString today = sf.format(c.getTime());\r\n\t\tString frefixOfFileName = \"customerLog_\"+today;\r\n\t\tlong kna1pages = kna1totalNum%PERSIZE==0?kna1totalNum/PERSIZE:kna1totalNum/PERSIZE+1;\r\n\t\tlong knb1pages = knb1totalNum%PERSIZE==0?knb1totalNum/PERSIZE:knb1totalNum/PERSIZE+1;\r\n\t\tlong knvvpages = knvvtotalNum%PERSIZE==0?knvvtotalNum/PERSIZE:knvvtotalNum/PERSIZE+1;\r\n\t\tString path = \"\";\r\n\t\tif(kna1pages>1){\r\n\t\t\tfor(int i=1;i<=kna1pages;i++){\r\n\t\t\t\tList<CompanyLog> datas = commonLogService.findByPage(sapDataCollection,\"Kna1Log\", json, optflag, bdate, edate, PERSIZE, i, null, null);\r\n\t\t\t\tString filename = frefixOfFileName+\"_kna1_\"+i;\r\n\t\t\t\tpath = excelService.generateExcel(kna1titles,kna1fields, datas,Kna1Log.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tString filename = frefixOfFileName+\"_kna1\";\r\n\t\t\tList<CompanyLog> datas = commonLogService.find(sapDataCollection,\"Kna1Log\", json, optflag, bdate, edate);\r\n\t\t\tpath = excelService.generateExcel(kna1titles,kna1fields, datas,Kna1Log.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t}\r\n\t\tif(knb1pages>1){\r\n\t\t\tfor(int i=1;i<=knb1pages;i++){\r\n\t\t\t\tList<CompanyLog> datas = commonLogService.findByPage(sapDataCollection,\"Knb1Log\", json, optflag, bdate, edate, PERSIZE, i, null, null);\r\n\t\t\t\tString filename = frefixOfFileName+\"_knb1_\"+i;\r\n\t\t\t\tpath = excelService.generateExcel(knb1titles,knb1fields, datas,Knb1Log.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tString filename = frefixOfFileName+\"_knb1\";\r\n\t\t\tList<CompanyLog> datas = commonLogService.find(sapDataCollection,\"Knb1Log\", json, optflag, bdate, edate);\r\n\t\t\tpath = excelService.generateExcel(knb1titles,knb1fields, datas,Knb1Log.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t}\r\n\t\tif(knvvpages>1){\r\n\t\t\tfor(int i=1;i<=knvvpages;i++){\r\n\t\t\t\tList<CompanyLog> datas = commonLogService.findByPage(sapDataCollection,\"KnvvLog\", json, optflag, bdate, edate, PERSIZE, i, null, null);\r\n\t\t\t\tString filename = frefixOfFileName+\"_knvv_\"+i;\r\n\t\t\t\tpath = excelService.generateExcel(knvvtitles,knvvfields, datas,KnvvLog.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tString filename = frefixOfFileName+\"_knvv\";\r\n\t\t\tList<CompanyLog> datas = commonLogService.find(sapDataCollection,\"KnvvLog\", json, optflag, bdate, edate);\r\n\t\t\tpath = excelService.generateExcel(knvvtitles,knvvfields, datas,KnvvLog.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t}\r\n\t\tString zipname = frefixOfFileName;\r\n\t\texcelService.downloadZip(path, zipname, response);\r\n\t\texcelService.deleteByFilePath(path);\r\n\t}", "public void parsingExcel() {\n theresFile = new File(pathTo).exists();\n if (theresFile) {\n try {\n FileInputStream myxls = new FileInputStream(pathTo);\n Workbook workbook = WorkbookFactory.create(myxls);\n //getting the sheet at index zero\n Sheet sheet = workbook.getSheetAt(0);\n int lastRow = sheet.getLastRowNum();\n System.out.println(\"currentID: \" + currentID);\n Row row2 = sheet.createRow(lastRow + 1);\n Data data = new Data(currentID++, jTextField1.getText(), jTextField2.getText(),\n jTextFieldModel.getText(), jTextFieldSerialN.getText(),\n Integer.parseInt(jTextFieldComments.getText()), jTextAreaDescription.getText());\n\n for (int i = 0; i < 7; i++) {\n Cell cell4 = row2.createCell(i);\n switch (i) {\n case 0:\n cell4.setCellValue(data.getID());\n break;\n case 1:\n cell4.setCellValue((String) data.getName());\n break;\n case 2:\n cell4.setCellValue((String) data.getDevice());\n break;\n case 3:\n cell4.setCellValue((String) data.getDeviceModel());\n break;\n case 4:\n cell4.setCellValue((String) data.getSerialNumber());\n break;\n case 5:\n cell4.setCellValue((int) data.getOptional());\n break;\n case 6:\n cell4.setCellValue((String) data.getDecription());\n break;\n }\n\n }\n FileOutputStream outputStream = new FileOutputStream(pathTo);\n workbook.write(outputStream);\n workbook.close();\n } catch (IOException ex) {\n Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);\n } catch (EncryptedDocumentException ex) {\n Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);\n }\n } else {\n if (jTextFieldComments.getText().equals(\"\") || jTextFieldComments.getText().equals(null)) {\n JOptionPane.showMessageDialog(null, \"Morate uneti količinu\");\n } else {\n try {\n Data data = new Data(1, jTextField1.getText(), jTextField2.getText(),\n jTextFieldModel.getText(), jTextFieldSerialN.getText(),\n Integer.parseInt(jTextFieldComments.getText()), jTextAreaDescription.getText());\n writtingExcelFile(makingExcelWorkbook(data));\n } catch (FileNotFoundException ex) {\n Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }\n\n// try {\n// FileInputStream myxls = new FileInputStream(pathTo);\n// HSSFWorkbook studentsSheet = new HSSFWorkbook(myxls);\n// HSSFSheet worksheet = studentsSheet.getSheetAt(0);\n// int lastRow = worksheet.getLastRowNum();\n// System.out.println(lastRow);\n// Row row = worksheet.createRow(++lastRow);\n// row.createCell(1).setCellValue(\"Dr.Hola\");\n// myxls.close();\n// FileOutputStream output_file =new FileOutputStream(new File(\"poi-testt.xls\")); \n// //write changes\n// studentsSheet.write(output_file);\n// output_file.close();\n// System.out.println(\" is successfully written\");\n// } catch (Exception e) {\n// }\n }", "@Override\n public ExtensionResult doSendComplaint(ExtensionRequest extensionRequest) {\n Map<String, String> output = new HashMap<>();\n ExtensionResult extensionResult = new ExtensionResult();\n StringBuilder sbCX = new StringBuilder();\n\n String ticketNumber = extensionRequest.getIntent().getTicket().getTicketNumber();\n\n String Bearer = \"\";\n String nama = getEasyMapValueByName(extensionRequest, \"person\");\n String perusahaan = getEasyMapValueByName(extensionRequest, \"company\");\n String posisi = getEasyMapValueByName(extensionRequest, \"position\");\n String email = getEasyMapValueByName(extensionRequest, \"email\");\n String nohp = getEasyMapValueByName(extensionRequest, \"phone\");\n String keluhan = \"\";\n String masukan = \"\";\n\n // 1.get data dari form\n // ambil token\n Bearer = getToken();\n\n // request API dolphin\n System.out.println(\"bearer = \" + Bearer);\n\n DatumComplaint data = new DatumComplaint();\n data = getFormComplaint(Bearer, ticketNumber);\n // 2. parsing data\n\n keluhan = data.getKeluhan();\n masukan = data.getMasukan();\n sbCX.append(\"<html>\").append(\"<body>\");\n sbCX.append(getHeaderEmail(\"Complaint\", nama, posisi, perusahaan, email, nohp).toString());\n sbCX\n .append(\"<td>6.</td>\").append(\"<td>Keluhan</td>\").append(\"<td>:</td>\").append(\"<td>\" + keluhan + \"</td>\")\n .append(\"</tr><tr>\")\n .append(\"<td>7.</td>\").append(\"<td>Masukan</td>\").append(\"<td>:</td>\").append(\"<td>\" + masukan + \"</td>\")\n .append(\"</tr>\");\n sbCX.append(\"</table>\");\n\n sbCX.append(getFooterEmail().toString())\n .append(\"</body>\").append(\"</html>\");\n\n int codeCX = sendGridEmail(sbCX, email, \"Kakak CX\", \"SAMI - Complaint (\" + keluhan + \")\");\n\n String result = \"\";\n if (codeCX == 202) {\n result = \"Baik kak silahkan tunggu konfirmasi ya kak\";\n } else {\n result = \"Maaf kak pengiriman email gagal. Boleh diulangi kak\";\n }\n\n output.put(OUTPUT, result);\n extensionResult.setAgent(false);\n extensionResult.setRepeat(false);\n extensionResult.setSuccess(true);\n extensionResult.setNext(true);\n extensionResult.setValue(output);\n return extensionResult;\n }", "public void saveFormData() throws edu.mit.coeus.exception.CoeusException {\r\n //Modified for COEUSDEV-413 : Subcontract Custom data bug - Data getting wiped out - Start\r\n// if( isDataChanged() ){\r\n\t\tif( isDataChanged() || getFunctionType() == NEW_ENTRY_SUBCONTRACT || getFunctionType() == NEW_SUBCONTRACT) { //COEUSDEV-413 : End\r\n Vector genericColumnValues = customElementsForm.getOtherColumnElementData();\r\n\t\t\tif( genericColumnValues != null && genericColumnValues.size() > 0 ){\r\n\t\t\t\tCustomElementsInfoBean genericCustElementsBean = null;\r\n\t\t\t\tint dataSize = genericColumnValues.size();\r\n\t\t\t\tfor( int indx = 0; indx < dataSize; indx++ ) {\r\n\t\t\t\t\tgenericCustElementsBean = (CustomElementsInfoBean)genericColumnValues.get(indx);\r\n\t\t\t\t\tSubContractCustomDataBean subContractCustomDataBean\r\n\t\t\t\t\t= new SubContractCustomDataBean(genericCustElementsBean);\r\n SubContractCustomDataBean oldSubContractCustomDataBean = (SubContractCustomDataBean)genericColumnValues.get(indx);\r\n\t\t\t\t\tif(getFunctionType() == NEW_ENTRY_SUBCONTRACT) {\r\n\t\t\t\t\t\tsubContractCustomDataBean.setAcType(\"I\");\r\n//\t\t\t\t\t\tsubContractCustomDataBean.setSubContractCode(this.subContractBean.getSubContractCode());\r\n//\t\t\t\t\t\tsubContractCustomDataBean.setSequenceNumber(this.subContractBean.getSequenceNumber());\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif( INSERT_RECORD.equals(subContractCustomDataBean.getAcType()) ) {\r\n\t\t\t\t\t\tsubContractCustomDataBean.setSubContractCode(this.subContractBean.getSubContractCode());\r\n\t\t\t\t\t\tsubContractCustomDataBean.setSequenceNumber(this.subContractBean.getSequenceNumber());\r\n \r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif( genericCustElementsBean instanceof SubContractCustomDataBean ) {\r\n//\t\t\t\t\t\t\tSubContractCustomDataBean oldSubContractCustomDataBean =\r\n//\t\t\t\t\t\t\t(SubContractCustomDataBean)genericCustElementsBean;\r\n\t\t\t\t\t\t\tsubContractCustomDataBean.setAcType(genericCustElementsBean.getAcType());\r\n\t\t\t\t\t\t\tsubContractCustomDataBean.setSubContractCode(oldSubContractCustomDataBean.getSubContractCode());\r\n\t\t\t\t\t\t\tsubContractCustomDataBean.setSequenceNumber(oldSubContractCustomDataBean.getSequenceNumber());\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tString custAcType = subContractCustomDataBean.getAcType();\r\n\t\t\t\t\t\tif( UPDATE_RECORD.equals(custAcType) ){\r\n//\t\t\t\t\t\t\tsubContractCustomDataBean.setSubContractCode(this.subContractBean.getSubContractCode());\r\n//\t\t\t\t\t\t\tsubContractCustomDataBean.setSequenceNumber(this.subContractBean.getSequenceNumber());\r\n\t\t\t\t\t\t\tqueryEngine.update(queryKey, subContractCustomDataBean);\r\n\t\t\t\t\t\t}else if( INSERT_RECORD.equals(custAcType)){\r\n\t\t\t\t\t\t\tsubContractCustomDataBean.setSubContractCode(this.subContractBean.getSubContractCode());\r\n\t\t\t\t\t\t\tsubContractCustomDataBean.setSequenceNumber(this.subContractBean.getSequenceNumber());\r\n\t\t\t\t\t\t\tqueryEngine.insert(queryKey, subContractCustomDataBean);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}catch ( CoeusException ce ) {\r\n\t\t\t\t\t\tce.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcustomElementsForm.setSaveRequired(false);\r\n\t\t}\r\n\t}", "@DataProvider(name=\"excle\")\n\tpublic static Object[][] createaccountTest() throws IOException {\n\t\tObject content[][];\n\t\tFileInputStream file = new FileInputStream(\n\t\t\t\t\"D:\\\\Java_Workspace\\\\FinalKDDFramework\\\\Input\\\\Account.xlsx\");\n\t\tXSSFWorkbook book = new XSSFWorkbook(file);\n\t\tXSSFSheet sheet = book.getSheet(\"Sheet1\");\n\t\tint rows = sheet.getLastRowNum();\n\t\tcontent = new Object[(sheet.getLastRowNum())-1][sheet.getRow(1)\n\t\t\t\t.getLastCellNum()];\n\t\tRow row;\n\t\tSystem.out.println(\"total no of rows \" + rows);\n\t\tfor (int i = 1; i <rows; i++) \n\t\t{\n\t\t\trow = sheet.getRow(i);\n\t\t\tint cells = row.getLastCellNum();\n\t\t\tfor (int j = 0; j < cells; j++) \n\t\t\t{\n\t\t\t\tCell cell = row.getCell(j);\n\t\t\t\tif (cell.getCellTypeEnum().name().equals(\"NUMERIC\")) \n\t\t\t\t{\n\t\t\t\t\tcontent[i-1][j] = cell.getNumericCellValue();\t\n\t\t\t\t\n\t\t\t\t} \n\t\t\t\telse if (cell.getCellTypeEnum().name().equals(\"STRING\")) \n\t\t\t\t{\n\t\t\t\t\tcontent[i-1][j] = cell.getStringCellValue();\t\n\t\t\t\t\n\t\t\t\t}\t\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t\t/*\n\t\t * catch (FileNotFoundException e) {\n\t\t * System.out.println(\"file not found\"); e.printStackTrace(); }\n\t\t */\n\t\treturn content;\n\t}", "public static void writeToExcelFromText() {\r\n\t\tExcelDataAccess payloadDataFile = new ExcelDataAccess(\r\n\t\t\t\t\"D:\\\\Users\\\\gawandejyostna\\\\Desktop\\\\WebServicesWorkspace\\\\GitRepo\\\\test-automation\\\\Bajaj_Automation\\\\Datatables\",\r\n\t\t\t\t\"CorrectPayloads\");\r\n\t\tpayloadDataFile.setDatasheetName(\"payloads\");\r\n\t\tint lastRowNum = payloadDataFile.getLastRowNum();\r\n\t\tfinal String TEXT_FILE_EXTENSION = \".txt\";\r\n\t\tFile[] packageDirectories = {\r\n\t\t\t\tnew File(\r\n\t\t\t\t\t\t\"D:\\\\Users\\\\gawandejyostna\\\\Desktop\\\\WebServicesWorkspace\\\\GitRepo\\\\test-automation\\\\Bajaj_Automation\\\\Datatables\\\\api\\\\inputrequests\"),\r\n\t\t\t\tnew File(\r\n\t\t\t\t\t\t\"D:\\\\Users\\\\gawandejyostna\\\\Desktop\\\\WebServicesWorkspace\\\\GitRepo\\\\test-automation\\\\Bajaj_Automation\\\\Datatables\\\\api\\\\exptresponse\\\\uat\") };\r\n\t\tfor (File packageDirectory : packageDirectories) {\r\n\t\t\tFile[] packageFiles = packageDirectory.listFiles();\r\n\t\t\tString packageName = packageDirectory.getName();\r\n\t\t\tString payloadColumn = \"Request Payload\";\r\n\t\t\tif (\"uat\".equals(packageName)) {\r\n\t\t\t\tpayloadColumn = \"Response Payload\";\r\n\t\t\t}\r\n\t\t\tfor (int i = 0; i < packageFiles.length; i++) {\r\n\t\t\t\tFile packageFile = packageFiles[i];\r\n\t\t\t\tString fileName = packageFile.getName();\r\n\t\t\t\tString fileNameWithoutExt = fileName.substring(0, fileName.indexOf(TEXT_FILE_EXTENSION));\r\n\t\t\t\t// We only want the .class files\r\n\t\t\t\tif (fileName.endsWith(TEXT_FILE_EXTENSION)) {\r\n\t\t\t\t\tString payload = readFromTextFile(packageFile);\r\n\t\t\t\t\tint rowNum = payloadDataFile.getRowNum(fileNameWithoutExt, 0);\r\n\t\t\t\t\tif (rowNum == -1) {\r\n\t\t\t\t\t\tlastRowNum = payloadDataFile.getLastRowNum();\r\n\t\t\t\t\t\trowNum = payloadDataFile.addRow();\r\n\t\t\t\t\t\tpayloadDataFile.setValue(rowNum, \"Test Case\", fileNameWithoutExt);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpayloadDataFile.setValue(rowNum, payloadColumn,\r\n\t\t\t\t\t\t\tpayload.length() > 32000 ? payload.substring(0, 32000) : payload);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void VerifyRecapBillinfo(){\r\n\t\tString BillingName = getValue(\"FirstName\")+\" \"+getValue(\"LastName\");\r\n\t\tString Companyname = getValue(\"CompanyName\");\r\n\t\tString Address = getValue(\"Address\");\r\n\t\tString ZipCity = getValue(\"Zip\")+\" , \"+getValue(\"City\");\r\n\t\tString CardType= getValue(\"CardType\");\r\n\r\n\t\tclass Local {};\r\n\t\tReporter.log(\"TestStepComponent\"+Local.class.getEnclosingMethod().getName());\r\n\t\tReporter.log(\"TestStepInput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepOutput:-\"+\"NA\");\r\n\t\tReporter.log(\"TestStepExpectedResult:- shopping cart image link should be clicked\");\r\n\r\n\r\n\t\ttry{\r\n\t\t\tString[] BD=getWebTableData(locator_split(\"txtRecapBillinfo\"), locator_split(\"txtRecapBillinfodata\"));\r\n\t\t\tif(BD[1].equalsIgnoreCase(BillingName)&&BD[2].equalsIgnoreCase(Companyname)\r\n\t\t\t\t\t&&BD[3].equalsIgnoreCase(Address)&&BD[5].equalsIgnoreCase(ZipCity)\r\n\t\t\t\t\t&&BD[6].contains(CardType)){\r\n\t\t\t\tSystem.out.println(\"The data from Web matches with Excel Registration data\");\r\n\t\t\t\tReporter.log(\"PASS_MESSAGE:- The data from Web matches with Excel Registration data\");\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tReporter.log(\"FAIL_MESSAGE:- The data from Web dosent match with Excel Registration data\");\r\n\t\t\t\tthrow new Exception(\"The data from Web dosent match with Excel Registration data\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(Exception e){\r\n\t\t\tReporter.log(\"FAIL_MESSAGE:- shopping cart image link is not clicked \");\r\n\t\t\tthrow new NoSuchElementException(\"The element with\"\r\n\t\t\t\t\t+ elementProperties.getProperty(\"txtRecapBillinfo\")\r\n\t\t\t\t\t+ elementProperties.getProperty(\"txtRecapBillinfodata\")\r\n\t\t\t\t\t+ \" not found\");\r\n\t\t}\r\n\r\n\t}", "public HSSFWorkbook process(){\r\n\t\tHSSFSheet sheet = templateWorkbook.getSheetAt(0);\r\n\r\n\t\t//write product infmration\r\n\t\torder.putSetToList();\r\n\t\tList<InventoryOrderProduct> orderProducts = order.getProduct_List();\r\n\t\tint totalDataRow = orderProducts.size();\r\n\t\tfor (int i = 0; i < totalDataRow; i++){\r\n\r\n\t\t\tInventoryOrderProduct orderProduct = orderProducts.get(i);\r\n\t\t\tRow row = sheet.createRow(data_row + i);\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tProduct product = orderProduct.getProductBarcode().getProduct();\r\n\t\t\trow.createCell(barcode_column).setCellValue(orderProduct.getProductBarcode().getBarcode());\r\n\t\t\t\r\n\t\t\tColor color = orderProduct.getProductBarcode().getColor();\r\n\t\t\tif (color == null)\r\n\t\t\t\trow.createCell(productCode_column).setCellValue(product.getProductCode());\r\n\t\t\telse \r\n\t\t\t\trow.createCell(productCode_column).setCellValue(product.getProductCode() + color.getName());\r\n\t\t\t\r\n\t\t\trow.createCell(unit_column).setCellValue(product.getUnit());\r\n\t\t\tint q = orderProduct.getQuantity();\r\n\t\t\t\r\n\t\t\trow.createCell(quantity_column).setCellValue(orderProduct.getQuantity());\r\n\t\t\trow.createCell(salePrice_column).setCellValue(orderProduct.getSalesPrice());\r\n\t\t\t\r\n\t\t\tString year = product.getYear().getYear();\r\n\t\t\tString quarter = product.getQuarter().getQuarter_Name();\r\n\t\t\tString brandName = product.getBrand().getBrand_Name();\r\n\t\t\t\r\n\t\t\tString productComment = year +\"年\" + brandName + quarter + \"装\";\r\n\t\t\t\t\t\r\n\t\t\t\r\n\t\t\trow.createCell(productComment_column).setCellValue(productComment);\r\n\t\t}\r\n\r\n\t\treturn templateWorkbook;\r\n\t}", "private Object generateDeleteAlertsEchoJSON(XSSFWorkbook workbook, String sheetName, String scenarioID,ExcelOperation excelOperation) {\n\t\tJSONObject deleteAlertsEchoJsonObject=new JSONObject();\n\t\tList<LinkedHashMap<String, String>>jsonMap=excelOperation.getScenarioData(workbook, sheetName, scenarioID);\n\t\tfor(LinkedHashMap<String, String> json:jsonMap) {\n\t\t\tdeleteAlertsEchoJsonObject.put(\"requestOwner\", json.get(\"requestOwner\"));\n\t\t}\n\t\treturn deleteAlertsEchoJsonObject;\n\t}", "Payment setPaymentFromBetalningsservice(List<String> paymentrows) throws ParseException {\n Payment payment = new Payment();\n List<PaymentLine> paymentLines = new ArrayList<>();\n for (String line: paymentrows) {\n String firstLetter = String.valueOf(line.charAt(0));\n if(firstLetter.equals(POST_TYPE_O)){\n payment.setOpeningType(firstLetter);\n payment.setAccountNumber(line.substring(1,16));\n String kd = line.substring(16,30).trim().replaceAll(\",\",\".\");\n BigDecimal bd = new BigDecimal(kd);\n payment.setTotalAmount(bd);\n payment.setNumberOfPaymentRows(Integer.valueOf(line.substring(30,40).trim()));\n Date date = dateform.parse(line.substring(40,48));\n payment.setPaymentDate(date);\n payment.setCurrency(line.substring(48,51));\n }else if(firstLetter.equals(POST_TYPE_B)){\n PaymentLine paymentLine = new PaymentLine();\n String kd = line.substring(1,15).trim().replaceAll(\",\",\".\");\n BigDecimal bd = new BigDecimal(kd);\n paymentLine.setAmount(bd);\n paymentLine.setReference(line.substring(15,50).trim());\n paymentLines.add(paymentLine);\n }\n }\n payment.setPaymentLines(paymentLines);\n return payment;\n }", "private JSONObject getGSTR3B_Section_4_A_2_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isServiceProduct\", true);\n// reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_Import);\n reqParams.put(GSTRConstants.ADD_LANDEDCOST_JOIN_FOR_IMPORT_INVOICES, true);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n// reqParams.put(\"interstate\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.put(\"itctype\", Constants.GST_ITCTYPE_DEFAULT+\",\"+Constants.GST_ITCTYPE_REVERSED);\n JSONObject jSONObject = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n jSONObject = getGoodsReceiptForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n }\n \n /**\n * Vendor DN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isServiceProduct\", true);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_Import);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.remove(\"cnentityValue\");\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n }\n /**\n * Vendor CN\n */\n\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isServiceProduct\", true);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_Import);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.put(\"onlycnagainstvendor\", true);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_4_A_2);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "private JSONObject getGSTR3B_Section_4_A_1_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isServiceProduct\", false);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_Import);\n reqParams.put(GSTRConstants.ADD_LANDEDCOST_JOIN_FOR_IMPORT_INVOICES, true);\n reqParams.put(\"excludetaxClassType\", true);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n// reqParams.put(\"interstate\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.put(\"itctype\", Constants.GST_ITCTYPE_DEFAULT+\",\"+Constants.GST_ITCTYPE_REVERSED);\n JSONObject jSONObject = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n jSONObject = getGoodsReceiptForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n }\n\n /**\n * Vendor DN \n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isServiceProduct\", false);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_Import);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.remove(\"cnentityValue\");\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n\n }\n\n /**\n * Vendor CN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isServiceProduct\", false);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_Import);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.put(\"onlycnagainstvendor\", true);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_4_A_1);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "private JSONObject getGSTR3B_Section_4_A_3_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"isGSTINnull\", false);\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", true);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.put(\"itctype\", Constants.GST_ITCTYPE_DEFAULT+\",\"+Constants.GST_ITCTYPE_REVERSED);\n JSONObject jSONObject = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n jSONObject = getGoodsReceiptForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } \n /**\n * Purchase Invoice- REGTYPE:Unregistered.CUSTTYPE:NA.\n * Interstate/Intrastate: Both. RCM: TRUE. InterState/IntraState : Both.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", true);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.put(\"itctype\", Constants.GST_ITCTYPE_DEFAULT+\",\"+Constants.GST_ITCTYPE_REVERSED);\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getGoodsReceiptForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n \n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_4_A_3);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "public JSONObject getCNForGSTR3BTaxable(JSONObject reqParams) throws JSONException, ServiceException {\n String companyId=reqParams.optString(\"companyid\");\n JSONObject jSONObject = new JSONObject();\n double taxableAmountCN = 0d;\n double totalAmountCN = 0d;\n double IGSTAmount = 0d;\n double CGSTAmount = 0d;\n double SGSTAmount = 0d;\n double CESSAmount = 0d;\n\n /**\n * Get CN amount\n */\n reqParams.put(\"entitycolnum\", reqParams.optString(\"cnentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"cnentityValue\"));\n List<Object> cnData = accEntityGstDao.getCNDNWithInvoiceDetailsInSql(reqParams);\n List<Object> cnWithoutInventory = accEntityGstDao.getCNAgainstCustomer(reqParams);\n if (cnWithoutInventory != null && !cnWithoutInventory.isEmpty()) {\n cnData.addAll(cnWithoutInventory);\n }\n /**\n * Add data for Cash Sales refund \n */\n reqParams.put(\"entitycolnum\", reqParams.optString(\"paymententitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"paymententityValue\"));\n List<Object> refundlist = accEntityGstDao.getCashRefundWithInvoiceDetailsInSql(reqParams);\n if (refundlist != null && refundlist.size() > 0) {\n cnData.addAll(refundlist);\n } \n if (!reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n for (Object object : cnData) {\n Object[] data = (Object[]) object;\n String term = data[1] != null ? data[1].toString() : \"\";\n double termamount = data[0] != null ? (Double) data[0] : 0;\n\n totalAmountCN = (Double) data[3];\n if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputIGST\").toString())) {\n taxableAmountCN += data[2] != null ? (Double) data[2] : 0;\n IGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCGST\").toString())) {\n taxableAmountCN += data[2] != null ? (Double) data[2] : 0;\n CGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputSGST\").toString())) {\n SGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputUTGST\").toString())) {\n SGSTAmount += termamount;\n } else if (term.equalsIgnoreCase(LineLevelTerms.GSTName.get(\"OutputCESS\").toString())) {\n CESSAmount += termamount;\n } else if (StringUtil.isNullOrEmpty(term)) {\n taxableAmountCN += data[2] != null ? (Double) data[2] : 0;\n }\n }\n\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount(taxableAmountCN,companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount(IGSTAmount,companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount(CGSTAmount,companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount(SGSTAmount,companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount(CESSAmount,companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount(IGSTAmount+CGSTAmount+SGSTAmount+CESSAmount,companyId));\n jSONObject.put(\"totalamount\",authHandler.formattedAmount(taxableAmountCN+IGSTAmount+CGSTAmount+SGSTAmount+CESSAmount,companyId));\n } else {\n jSONObject = accGSTReportService.getCreditNoteJSONArrayForGSTR3B(cnData, reqParams, companyId);\n }\n return jSONObject;\n }", "public static void main(String[] args) {\n\n String filePath = \"/Users/hubery/Desktop/泛金融销户/泛金融销户账户.xlsx\";\n String filePath1 = \"/Users/hubery/Desktop/泛金融销户/泛金融销户账户_bak.xlsx\";\n File excelFile = new File(filePath);\n\n try {\n Map<Integer, Map<Integer, Object>> content = readSheetContent(excelFile, 0);\n\n for (Map<Integer, Object> map : content.values()) {\n\n for (Object obj : map.values()) {\n System.out.print(obj + \"\\t\");\n }\n System.out.println();\n }\n\n writeNewSheet(new File(filePath1), content);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "private PayStub makePayStub(String empID, int row, Sheet report){\n\n PayStub stub = new PayStub(empID);\n int ind = 0;\n\n //set check number\n stub.setCheckNum(Integer.parseInt(report.getRow(row).getCell(8).getStringCellValue().substring(6)));\n row += 2; //skip empty rows\n\n stub.setCurRegEarnings(Float.parseFloat(report.getRow(row).getCell(2).toString()));\n stub.setYtdRegEarnings(Float.parseFloat(report.getRow(row).getCell(3).toString()));\n stub.setCurFedTax(Float.parseFloat(report.getRow(row).getCell(5).toString()));\n stub.setYtdFedTax(Float.parseFloat(report.getRow(row).getCell(6).toString()));\n\n row += 1;\n\n //check both curOTEarning and ytdOT for empty string, replace with 0\n if (report.getRow(row).getCell(2).toString() == \"\"){\n stub.setCurOTEarnings(0);\n }\n else{\n stub.setCurOTEarnings(Float.parseFloat(report.getRow(row).getCell(2).toString()));\n }\n if (report.getRow(row).getCell(3).toString() == \"\"){\n stub.setYtdOTEarnings(0);\n }\n else{\n stub.setYtdOTEarnings(Float.parseFloat(report.getRow(row).getCell(3).toString()));\n }\n\n stub.setCurSocSec(Float.parseFloat(report.getRow(row).getCell(5).toString()));\n stub.setYtdSocSec(Float.parseFloat(report.getRow(row).getCell(6).toString()));\n\n row += 1;\n\n stub.setCurMedicare(Float.parseFloat(report.getRow(row).getCell(5).toString()));\n stub.setYtdMedicare(Float.parseFloat(report.getRow(row).getCell(6).toString()));\n\n row += 1;\n\n //check both curAddlMedi and ytdAddlMedi for empty string, replace with 0\n if (report.getRow(row).getCell(5).toString() == \"\"){\n stub.setCurAddlMedi(0);\n }\n else {\n stub.setCurAddlMedi(Float.parseFloat(report.getRow(row).getCell(5).toString()));\n }\n if (report.getRow(row).getCell(6).toString() == \"\"){\n stub.setYtdAddlMedi(0);\n }\n else{\n stub.setYtdAddlMedi(Float.parseFloat(report.getRow(row).getCell(6).toString()));\n }\n\n row += 1;\n\n stub.setCurCaTax(Float.parseFloat(report.getRow(row).getCell(5).toString()));\n stub.setYtdCaTax(Float.parseFloat(report.getRow(row).getCell(6).toString()));\n\n row += 1;\n\n stub.setCurCaDisability(Float.parseFloat(report.getRow(row).getCell(5).toString()));\n stub.setYtdCaDisability(Float.parseFloat(report.getRow(row).getCell(6).toString()));\n\n row += 2;\n\n stub.setCurNetEarnings((float)(report.getRow(row).getCell(8).getNumericCellValue()));\n stub.setYtdNetEarnings((float)(report.getRow(row).getCell(9).getNumericCellValue()));\n\n return stub;\n }", "@Override\n public JSONObject getGSTRuleSetup(JSONObject requestParams) throws ServiceException, ParseException, com.krawler.utils.json.base.JSONException {\n JSONObject finalReturnObj = new JSONObject();\n try {\n String storeRec = \"\";\n JSONObject jMeta = new JSONObject();\n JSONArray jarrColumns = new JSONArray();\n JSONArray jarrRecords = new JSONArray();\n JSONObject jobjTemp = new JSONObject();\n JSONArray dataJArr = new JSONArray();\n JSONArray pagedJson = new JSONArray();\n\n /**\n * Create Column model\n */\n HashMap<String, Object> fieldParamsRequestMap = new HashMap<>();\n ArrayList fieldParamsfilter_names = new ArrayList();\n ArrayList fieldParamsfilter_params = new ArrayList();\n\n KwlReturnObject KWLObj = accountingHandlerDAOobj.getObject(Company.class.getName(), requestParams.optString(Constants.companyKey));\n Company company = (Company) KWLObj.getEntityList().get(0);\n String countryid = company.getCountry().getID();\n requestParams.put(\"countryid\", countryid);\n\n fieldParamsfilter_names.add(Constants.FIELDPARAMS_ISACTIVATE);\n fieldParamsfilter_params.add(1);\n fieldParamsfilter_names.add(Constants.GST_CONFIG_TYPE);\n fieldParamsfilter_params.add(Constants.GST_CONFIG_ISFORGST);\n fieldParamsfilter_names.add(Constants.moduleid);\n fieldParamsfilter_params.add(Constants.GSTModule);\n fieldParamsfilter_names.add(\"companyid\");\n fieldParamsfilter_params.add(requestParams.optString(\"companyid\"));\n fieldParamsRequestMap.put(Constants.filterNamesKey, fieldParamsfilter_names);\n fieldParamsRequestMap.put(Constants.filterParamsKey, fieldParamsfilter_params);\n KwlReturnObject result = accEntityGstDao.getChildFieldParamsForGSTRule(fieldParamsRequestMap);\n List<FieldParams> fieldParamses = result.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", fieldParams.getFieldlabel());\n jobjTemp.put(\"dataIndex\", \"shippedLoc\" + fieldParams.getGSTMappingColnum());\n jobjTemp.put(\"align\", \"center\");\n jobjTemp.put(\"width\", 150);\n jobjTemp.put(\"pdfwidth\", 150);\n jarrColumns.put(jobjTemp);\n //Records\n jobjTemp = new JSONObject();\n jobjTemp.put(\"name\", \"shippedLoc\" + fieldParams.getGSTMappingColnum());\n jarrRecords.put(jobjTemp);\n }\n\n JSONObject params = new JSONObject();\n params.put(\"termType\", 7);\n params.put(\"companyid\", requestParams.optString(\"companyid\"));\n params.put(\"isInput\", requestParams.optBoolean(\"isSales\"));\n /**\n * get GST master\n */\n\n KwlReturnObject kwlReturnObject = accEntityGstDao.getGSTTermDetails(params);\n List<LineLevelTerms> lineLevelTerms = kwlReturnObject.getEntityList();\n Map<String, String> GSTTermMap = new HashMap();\n for (LineLevelTerms lineLevelTerms1 : lineLevelTerms) {\n /**\n * Create Map for Term Id,Name\n */\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\", lineLevelTerms1.getTerm());\n jobjTemp.put(\"dataIndex\", lineLevelTerms1.getId());\n jobjTemp.put(\"align\", \"center\");\n jobjTemp.put(\"width\", 150);\n jobjTemp.put(\"renderer\", \"WtfGlobal.gstdecimalRenderer\");\n jobjTemp.put(\"pdfwidth\", 150);\n jarrColumns.put(jobjTemp);\n //Records\n jobjTemp = new JSONObject();\n jobjTemp.put(\"name\", lineLevelTerms1.getId());\n jarrRecords.put(jobjTemp);\n }\n /**\n * ERP-34044\n */\n if(countryid.equals(String.valueOf(Constants.indian_country_id))){\n jobjTemp = new JSONObject();\n jobjTemp.put(\"header\",\"\" );\n jobjTemp.put(\"dataIndex\", \"groupTerm\");\n jarrColumns.put(jobjTemp);\n //Records\n jobjTemp = new JSONObject();\n jobjTemp.put(\"name\", \"groupTerm\");\n jarrRecords.put(jobjTemp);\n }\n /**\n * get rule data from table\n */\n requestParams.put(\"df\", authHandler.getDateOnlyFormat());\n JSONObject dataObj = getEntityRuleSetup(requestParams);\n dataJArr = dataObj.optJSONArray(\"dataArr\");\n\n pagedJson = dataJArr;\n finalReturnObj.put(\"totalCount\", dataJArr.length());\n finalReturnObj.put(\"columns\", jarrColumns);\n finalReturnObj.put(\"coldata\", pagedJson);\n jMeta.put(\"totalProperty\", \"totalCount\");\n jMeta.put(\"root\", \"coldata\");\n jMeta.put(\"fields\", jarrRecords);\n finalReturnObj.put(\"metaData\", jMeta);\n boolean isExport = false;\n if (requestParams.has(\"isExport\")) {\n isExport = Boolean.parseBoolean(requestParams.optString(\"isExport\"));\n }\n if (isExport) {\n finalReturnObj.put(\"data\", dataJArr);\n }\n } catch (ServiceException | com.krawler.utils.json.base.JSONException ex) {\n Logger.getLogger(AccGstServiceImpl.class.getName()).log(Level.INFO, ex.getMessage());\n } catch (SessionExpiredException ex) {\n Logger.getLogger(AccGstServiceImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n return finalReturnObj;\n }", "public void parsingAdditionalData() {\n\t\tString AdditionalData = billPayBean.getAdditionalData();\n\t\tswitch (Integer.parseInt(billPayBean.getBillerId())) {\n\t\tcase 91901:\n\t\t\tbillPayBean.setCustomerName(AdditionalData.substring(95,120));\n\t\t\tbillPayBean.setMeterNumber(AdditionalData.substring(7,18));\n\t\t\tbillPayBean.setBillNumber(AdditionalData.substring(18,30));\n\t\t\tbreak;\n\t\tcase 91951:\n\t\t\tbillPayBean.setCustomerName(AdditionalData.substring(47,72));\n\t\t\tbillPayBean.setBillNumber(AdditionalData.substring(0,12));\n\t\t\tbreak;\n\t\tcase 91999:\n\t\t\tbillPayBean.setCustomerName(AdditionalData.substring(66,91));\n\t\t\tbillPayBean.setRegNumber(AdditionalData.substring(0,13));\n\t\t\tbreak;\n\t\tdefault:\n\t\t}\n\t\treturn ;\n\t}", "private Object generateDeleteAlertsRequestJSON(XSSFWorkbook workbook, String sheetName, String scenarioID,ExcelOperation excelOperation) {\n\t\tJSONObject deleteAlertsRequestJsonObject=new JSONObject();\n\t\tList<LinkedHashMap<String, String>>jsonMap=excelOperation.getScenarioData(workbook, sheetName, scenarioID);\n\t\tfor(LinkedHashMap<String, String> json:jsonMap) {\n\t\t\tdeleteAlertsRequestJsonObject.put(\"data\",generateDeleteAlertDataJSON(workbook, \"DT_AlertBookDataForDeleteAlert\", scenarioID, excelOperation));\n\t\t\tdeleteAlertsRequestJsonObject.put(\"appID\", json.get(\"appID\"));\n\t\t\tdeleteAlertsRequestJsonObject.put(\"formFactor\", json.get(\"formFactor\"));\n\t\t\tdeleteAlertsRequestJsonObject.put(\"requestType\", json.get(\"requestType\"));\n\t\t}\n\t\treturn deleteAlertsRequestJsonObject;\n\t}", "private JSONObject getGSTR3B_Section_3_1_C_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n\n JSONObject jSONObject = new JSONObject();\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n jSONObject = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n jSONObject = getInvoiceForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n }\n /**\n * Invoice- REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: Exempted.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", true);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Exempted);\n reqParams.put(\"typeofjoinisleft\", true);\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n temp = getInvoiceForGSTR3BNillRated(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"count\", (jSONObject.optInt(\"count\", 0) + temp.optInt(\"count\", 0)));\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n }\n \n \n /**\n * Debit Note- REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: 0%,Exempted.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge + \",\" + FieldComboData.TaxClass_Exempted);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n temp = getDNAgainstSalesForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n }\n /**\n * Credit Note- REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: 0%,Exempted.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge + \",\" + FieldComboData.TaxClass_Exempted);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA );\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n temp = getCNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n }\n \n /**\n * Advance Liability- REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: 0%,Exempted.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge + \",\" + FieldComboData.TaxClass_Exempted);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n JSONObject tempObj = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_PAYMENT_RECEIPT || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n tempObj = getTaxLiabilityOnAdvance(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = tempObj.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n temp = tempObj.optJSONObject(\"gstr3Obj\");\n double totaltaxamt = temp.optDouble(\"csgst3b\", 0.0) + temp.optDouble(\"cgst3b\", 0.0) + temp.optDouble(\"sgst3b\", 0.0) + temp.optDouble(\"igst3b\", 0.0);\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt3b\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst3b\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst3b\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst3b\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst3b\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + totaltaxamt), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"taxableamt3b\", 0.0) + totaltaxamt), companyId));\n }\n /**\n * Adjusted Advance- REGTYPE:Regular,Composition,Unregistered.CUSTTYPE:NA,Export,ExportWOPAY,SEZ,SEZWOPAY.\n * Product Tax Class: 0%,Exempted.\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge + \",\" + FieldComboData.TaxClass_Exempted);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Composition + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n tempObj = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_PAYMENT_RECEIPT || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n tempObj = getAdjustedAdvance(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = tempObj.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n temp = tempObj.optJSONObject(\"gstr3Obj\");\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n\n \n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_3_1_C);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "public static List<InputDto> readXLSXFile(File file) throws Exception {\n List<InputDto> inputDtos = new ArrayList<>();\n\n Integer i = 0;\n InputStream ExcelFileToRead = new FileInputStream(file);\n XSSFWorkbook wb = new XSSFWorkbook(ExcelFileToRead);\n\n XSSFWorkbook test = new XSSFWorkbook();\n\n XSSFSheet sheet = wb.getSheetAt(0);\n XSSFRow row;\n XSSFCell cell;\n\n Iterator rows = sheet.rowIterator();\n// ss = new String[sheet.getLastRowNum()];\n sheet.getLastRowNum();\n while (rows.hasNext()) {\n InputDto input = new InputDto();\n row = (XSSFRow) rows.next();\n Iterator cells = row.cellIterator();\n if (row.getRowNum() == 0) {\n continue; //just skip the rows if row number is 0 or 1\n }\n String s = \"\";\n while (cells.hasNext()) {\n cell = (XSSFCell) cells.next();\n\n if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {\n// System.out.print(cell.getStringCellValue() + \" \");\n s += cell.getStringCellValue().trim() + \"|\";\n } else if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {\n// System.out.print(cell.getNumericCellValue() + \" \");\n s += cell.getRawValue().trim() + \"|\";\n } else if (cell.getCellType() == HSSFCell.CELL_TYPE_BLANK) {\n// System.out.print(cell.getNumericCellValue() + \" \");\n s += cell.getStringCellValue().trim() + \"|\";\n }\n /*else {\n //U Can Handel Boolean, Formula, Errors\n }*/\n }\n if (!s.equals(\"\") && s.split(\"\\\\|\").length == 8) {\n input.setLoadName(s.split(\"\\\\|\")[6]);\n input.setLoadSize(s.split(\"\\\\|\")[1]);\n input.setLoadDate(s.split(\"\\\\|\")[0]);\n input.setLoadPath(s.split(\"\\\\|\")[4]);\n input.setLoadType(s.split(\"\\\\|\")[2]);\n input.setCicsName(s.split(\"\\\\|\")[5]);\n input.setRowId(s.split(\"\\\\|\")[7]);\n System.out.println(input.getRowId());\n inputDtos.add(input);\n// ss[i] = s;\n\n } else {\n throw new Exception(\"EXCEL DATA IS NOT COMPELETED\");\n }\n i++;\n }\n\n return inputDtos;\n }", "public JSONObject getInvoiceForGSTR3BNillRated(JSONObject reqParams) throws JSONException, ServiceException {\n String companyId=reqParams.optString(\"companyid\");\n double taxableAmountInv = 0d;\n double taxableAmountCN = 0d;\n double taxableAmountAdv = 0d;\n double taxableAmountAdvAdjusted = 0d;\n double IGSTAmount = 0d;\n double CGSTAmount = 0d;\n double SGSTAmount = 0d;\n double CESSAmount = 0d;\n int count=0;\n JSONObject jSONObject = new JSONObject();\n reqParams.put(\"entitycolnum\", reqParams.optString(\"invoiceentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"invoiceentityValue\"));\n// reqParams.put(\"isGSTINnull\", false);\n reqParams.put(\"GST3B\", !reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.remove(\"zerorated\");\n List invoiceData = accEntityGstDao.getNillInvoiceDataWithDetailsInSql(reqParams);\n if (!reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n for (Object object : invoiceData) {\n Object[] data = (Object[]) object;\n taxableAmountInv = data[0] != null ? (Double) data[0] : 0;\n count = data[1] != null ? ((BigInteger) data[1]).intValue() : 0;\n }\n\n//\n// /**\n// * Get CN amount\n// */\n// reqParams.put(\"entitycolnum\", reqParams.optString(\"cnentitycolnum\"));\n// reqParams.put(\"entityValue\", reqParams.optString(\"cnentityValue\"));\n// reqParams.put(\"isGSTINnull\", false);\n// reqParams.put(\"GST3B\", true);\n// List cnData = accEntityGstDao.getNillCNDNWithInvoiceDetailsInSql(reqParams);\n// if (!cnData.isEmpty() && cnData.get(0) != null) {\n// taxableAmountCN = (Double) cnData.get(0);\n// }\n//\n// /**\n// * Get Advance for which invoice not linked yet\n// */\n// reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n// reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n// reqParams.put(\"isGSTINnull\", false);\n// reqParams.put(\"GST3B\", true);\n// reqParams.put(\"at\", true);\n// reqParams.remove(\"atadj\");\n// List AdvData = accEntityGstDao.getNillAdvanceDetailsInSql(reqParams);\n// if (!AdvData.isEmpty() && AdvData.get(0) != null) {\n// taxableAmountAdv = (Double) AdvData.get(0);\n// }\n// /**\n// * Get Advance for which invoice isLinked\n// */\n// reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n// reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n// reqParams.put(\"isGSTINnull\", false);\n// reqParams.put(\"GST3B\", true);\n// reqParams.remove(\"at\");\n// reqParams.put(\"atadj\", true);\n// AdvData = accEntityGstDao.getNillAdvanceDetailsInSql(reqParams);\n// if (!AdvData.isEmpty() && AdvData.get(0) != null) {\n// taxableAmountAdvAdjusted = (Double) AdvData.get(0);\n// }\n jSONObject.put(\"count\", count);\n jSONObject.put(\"Nature of Supplies\", \"e) Non GST outward supplies\");\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount(taxableAmountInv,companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount(IGSTAmount,companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount(CGSTAmount,companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount(SGSTAmount,companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount(CESSAmount,companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount(IGSTAmount+CGSTAmount+SGSTAmount+CESSAmount,companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount(taxableAmountInv,companyId));\n } else {\n jSONObject = accGSTReportService.getSalesInvoiceJSONArrayForGSTR3B(invoiceData, reqParams, companyId);\n }\n return jSONObject;\n }", "public CustomerPayment getCustomerPayment(String response) throws Exception {\n CustomerPayment customerPayments = new CustomerPayment();\n\n JSONObject jsonObject = new JSONObject(response.trim());\n\n JSONObject payment = jsonObject.getJSONObject(\"payment\"); //No I18N\n\n customerPayments.setPaymentId(payment.getString(\"payment_id\"));\n customerPayments.setCustomerId(payment.getString(\"customer_id\"));\n customerPayments.setCustomerName(payment.getString(\"customer_name\"));\n customerPayments.setPaymentMode(payment.getString(\"payment_mode\"));\n customerPayments.setDate(payment.getString(\"date\"));\n customerPayments.setAccountId(payment.getString(\"account_id\"));\n customerPayments.setAccountName(payment.getString(\"account_name\"));\n customerPayments.setExchangeRate(payment.getDouble(\"exchange_rate\")); //No I18N\n customerPayments.setAmount(payment.getDouble(\"amount\")); //No I18N\n customerPayments.setBankCharges(payment.getDouble(\"bank_charges\")); //No I18N\n customerPayments.setTaxAccountId(payment.getString(\"tax_account_id\"));\n customerPayments.setTaxAccountName(payment.getString(\"tax_account_name\"));\n customerPayments.setTaxAmountWithheld(payment.getDouble(\"tax_amount_withheld\")); //No I18N\n customerPayments.setDescription(payment.getString(\"description\"));\n customerPayments.setReferenceNumber(payment.getString(\"reference_number\"));\n //customerPayments.setIsSingleInvoicePayment(payment.getBoolean(\"is_single_invoice_payment\"));\n\n JSONArray invoices = payment.getJSONArray(\"invoices\"); //No I18N\n\n List<Invoice> invoicesList = new ArrayList<Invoice>();\n\n for (int i = 0; i < invoices.length(); i++) {\n Invoice invoice = new Invoice();\n\n invoice.setInvoiceNumber(invoices.getJSONObject(i).getString(\"invoice_number\"));\n invoice.setInvoicePaymentId(invoices.getJSONObject(i).getString(\"invoice_payment_id\"));\n invoice.setInvoiceId(invoices.getJSONObject(i).getString(\"invoice_id\"));\n invoice.setAmountApplied(invoices.getJSONObject(i).getDouble(\"amount_applied\")); //No I18N\n invoice.setTaxAmountWithheld(invoices.getJSONObject(i).getDouble(\"tax_amount_withheld\")); //No I18N\n invoice.setTotal(invoices.getJSONObject(i).getDouble(\"total\")); //No I18N\n invoice.setBalance(invoices.getJSONObject(i).getDouble(\"balance\")); //No I18N\n invoice.setDate(invoices.getJSONObject(i).getString(\"date\"));\n invoice.setDueDate(invoices.getJSONObject(i).getString(\"due_date\"));\n\n invoicesList.add(i, invoice);\n }\n\n customerPayments.setInvoices(invoicesList);\n\n return customerPayments;\n }", "private Object generateDeleteAlertsDataJSON(XSSFWorkbook workbook, String sheetName, String scenarioID,ExcelOperation excelOperation) {\n\t\tJSONObject deleteAlertsRequestJsonObject=new JSONObject();\n\t\tList<LinkedHashMap<String, String>>jsonMap=excelOperation.getScenarioData(workbook, sheetName, scenarioID);\n\t\tfor(LinkedHashMap<String, String> json:jsonMap) {\n\t\t\tdeleteAlertsRequestJsonObject.put(\"ID\", json.get(\"ID\"));\n\t\t}\n\t\treturn deleteAlertsRequestJsonObject;\n\t}", "public void parser(JSONObject jo) {\n\n\t\n\t\tcontractId = JsonUtil.getJsonString(jo, \"contractId\");\n\t\tdate1 = JsonUtil.getJsonString(jo, \"date1\");\n\t\tstartDate = JsonUtil.getJsonString(jo, \"startDate\");\n\t\tendDate = JsonUtil.getJsonString(jo,\"endDate\");\n\t\tsupplierName = JsonUtil.getJsonString(jo,\"supplierName\");\n\t\ttxt7 = JsonUtil.getJsonString(jo,\"txt7\");\n\t\t\n\t\t\n\t\n\t}", "private static Ms3Person convertDataToRequiredDataType(String[] personArray,int index) {\r\n\t\t\r\n\t\tString firstName = \"\", lastName = \"\", email = \"\", gender = \"\", urlLink = \"\", card = \"\", city = \"\";\r\n\t\tfloat charges = 0f;\r\n\t\tboolean h_column = false, i_column = false;\r\n\t\t\r\n\t\tboolean flag = false;\r\n\t\tint i = 0;\r\n\t\t//ignore the bad data if read\r\n\t\tif(personArray.length<2 || personArray.length >11)\r\n\t\t\treturn null;\r\n\t\t//iterate the person details & set details in PErson object\r\n\t\tfor (; i < personArray.length; i++) {\r\n\t\t\tString temp = personArray[i];\r\n\t\t\tif(temp.length()<=1)\r\n\t\t\t\treturn null;\r\n\t\t\t// if current string is empty or null\r\n\t\t\tif (temp == null || temp.length() <=1) {\r\n\t\t\t\t// contains bad data\r\n\t\t\t\t// so new file is to be created & append\r\n\t\t\t\treturn null;\r\n\t\t\t} else {\r\n\t\t\t\tif (i == 0) {\r\n\t\t\t\t\tfirstName = personArray[0];\r\n\t\t\t\t} else if (i == 1) {\r\n\t\t\t\t\tlastName = personArray[1];\r\n\t\t\t\t} else if (i == 2) {\r\n\t\t\t\t\temail = personArray[2];\r\n\t\t\t\t} else if (i == 3) {\r\n\t\t\t\t\tgender = personArray[3];\r\n\t\t\t\t} else if (i == 4) {//urllink contains comma in it we need to be careful for this\r\n\t\t\t\t\turlLink = personArray[4] + personArray[i + 1];\r\n\t\t\t\t\ti = 5;\r\n\t\t\t\t} else if (i == 6) {//card name\r\n\t\t\t\t\tcard = personArray[6];\r\n\t\t\t\t} else if (i == 7) {//// $0.02 we need to trim $ from it\r\n\t\t\t\t\t//few ccolumns contains empty data so we need to check that as well\r\n\t\t\t\t\tString stringCharge = personArray[7];\r\n\t\t\t\t\tstringCharge = stringCharge.substring(1);\r\n\t\t\t\t\t//parse String to double to take care of \r\n\t\t\t\t\t//exception\r\n\t\t\t\t\t//System.out.println(\"Cost: \"+stringCharge);\r\n\t\t\t\t\tcharges = (float)Double.parseDouble(stringCharge);\r\n\t\t\t\t} else if (i == 8) {//parse String to Boolean \r\n\t\t\t\t\th_column = Boolean.parseBoolean(personArray[8]);\r\n\t\t\t\t} else if (i == 9) {\r\n\t\t\t\t\ti_column = Boolean.parseBoolean(personArray[9]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (i == 10)\r\n\t\t\t\t\t\tcity = personArray[10];\r\n \r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ti++;\r\n\t\t} // while loop ends\r\n\r\n\t\t//create object & initialise all data members\r\n\t\tMs3Person person = new Ms3Person(firstName, lastName, email, gender, urlLink, card, charges, h_column, i_column,\r\n\t\t\t\tcity);\r\n\t\tlineCount++;\r\n\t\t//know how many lines are being read\r\n\t\tSystem.out.println(person + \" lineNo: \" + lineCount);\r\n\t\treturn person;//return the PErson object\r\n \r\n\t}", "@Override\r\n\tpublic void exportExcel(SapDataCollection sapDataCollection,\r\n\t\t\tJSONObject json, HttpServletResponse response) throws IOException,\r\n\t\t\tSecurityException, NoSuchMethodException, IllegalArgumentException,\r\n\t\t\tIllegalAccessException, InvocationTargetException,\r\n\t\t\tURISyntaxException {\n\t\tString path = \"\";\r\n\t\tList<RuntimeColumnInfo> kna1cols = runtime_ColumnInfo_Service.findAllActiveData(sapDataCollection, SjlxTypeName.TYPE_CUSTOMER_KNA1);\r\n\t\tList<RuntimeColumnInfo> knb1cols = runtime_ColumnInfo_Service.findAllActiveData(sapDataCollection, SjlxTypeName.TYPE_CUSTOMER_KNB1);\r\n\t\tList<RuntimeColumnInfo> knvvcols = runtime_ColumnInfo_Service.findAllActiveData(sapDataCollection, SjlxTypeName.TYPE_CUSTOMER_KNVV);\r\n\t\tlong kna1totalNum = commonService.findTotalNum(sapDataCollection,\"Kna1\", json);\r\n\t\tlong knb1totalNum = commonService.findTotalNum(sapDataCollection,\"Knb1\", json);\r\n\t\tlong knvvtotalNum = commonService.findTotalNum(sapDataCollection,\"Knvv\", json);\r\n\t\tString[] kna1titles = new String[kna1cols.size()],kna1fields=new String[kna1cols.size()];\r\n\t\tString[] knb1titles = new String[kna1cols.size()],knb1fields=new String[knb1cols.size()];\r\n\t\tString[] knvvtitles = new String[kna1cols.size()],knvvfields=new String[knvvcols.size()];\r\n\t\tint k=0;\r\n\t\tfor(RuntimeColumnInfo col : kna1cols){\r\n\t\t\tkna1titles[k]=col.getTargetColumnName()+\"(\"+col.getTargetColumn()+\")\";\r\n\t\t\tkna1fields[k]=col.getTargetColumn();\r\n\t\t\tk++;\r\n\t\t}\r\n\t\tk=0;\r\n\t\tfor(RuntimeColumnInfo col : knb1cols){\r\n\t\t\tknb1titles[k]=col.getTargetColumnName()+\"(\"+col.getTargetColumn()+\")\";\r\n\t\t\tknb1fields[k]=col.getTargetColumn();\r\n\t\t\tk++;\r\n\t\t}\r\n\t\tk=0;\r\n\t\tfor(RuntimeColumnInfo col : knvvcols){\r\n\t\t\tknvvtitles[k]=col.getTargetColumnName()+\"(\"+col.getTargetColumn()+\")\";\r\n\t\t\tknvvfields[k]=col.getTargetColumn();\r\n\t\t\tk++;\r\n\t\t}\r\n\t\tCalendar c = Calendar.getInstance();\r\n\t\tSimpleDateFormat sf = new SimpleDateFormat(\"yyyyMMdd\");\r\n\t\tString today = sf.format(c.getTime());\r\n\t\tString frefixOfFileName = \"customer_\"+today;\r\n\t\tif(kna1totalNum>0){\r\n\t\t\tlong pages = kna1totalNum%PERSIZE==0?kna1totalNum/PERSIZE:kna1totalNum/PERSIZE+1;\r\n\t\t\tif(pages>1){\r\n\t\t\t\tfor(int i=1;i<=pages;i++){\r\n\t\t\t\t\tList<Kna1> datas = commonService.findByPage(sapDataCollection,\"Kna1\", json, PERSIZE, i,null,null);\r\n\t\t\t\t\tString filename = frefixOfFileName+\"_kna1_\"+i;\r\n\t\t\t\t\tpath = excelService.generateExcel(kna1titles,kna1fields, datas,Kna1.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tString filename = frefixOfFileName+\"_kna1\";\r\n\t\t\t\tList<Kna1> datas = commonService.findByPage(sapDataCollection,\"Kna1\", json, PERSIZE, 1,null,null);\r\n\t\t\t\tpath = excelService.generateExcel(kna1titles,kna1fields, datas,Kna1.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(knb1totalNum>0){\r\n\t\t\tlong pages = knb1totalNum%PERSIZE==0?knb1totalNum/PERSIZE:knb1totalNum/PERSIZE+1;\r\n\t\t\tif(pages>1){\r\n\t\t\t\tfor(int i=1;i<=pages;i++){\r\n\t\t\t\t\tList<Knb1> datas = commonService.findByPage(sapDataCollection,\"Knb1\", json, PERSIZE, i,null,null);\r\n\t\t\t\t\tString filename = frefixOfFileName+\"_knb1_\"+i;\r\n\t\t\t\t\tpath = excelService.generateExcel(knb1titles,knb1fields, datas,Knb1.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tString filename = frefixOfFileName+\"_knb1\";\r\n\t\t\t\tList<Knb1> datas = commonService.findByPage(sapDataCollection,\"Knb1\", json, PERSIZE, 1,null,null);\r\n\t\t\t\tpath = excelService.generateExcel(knb1titles,knb1fields, datas,Knb1.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(knvvtotalNum>0){\r\n\t\t\tlong pages = knvvtotalNum%PERSIZE==0?knvvtotalNum/PERSIZE:knvvtotalNum/PERSIZE+1;\r\n\t\t\tif(pages>1){\r\n\t\t\t\tfor(int i=1;i<=pages;i++){\r\n\t\t\t\t\tList<Knvv> datas = commonService.findByPage(sapDataCollection,\"Knvv\", json, PERSIZE, i,null,null);\r\n\t\t\t\t\tString filename = frefixOfFileName+\"_knvv_\"+i;\r\n\t\t\t\t\tpath = excelService.generateExcel(knvvtitles,knvvfields, datas,Knvv.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tString filename = frefixOfFileName+\"_knvv\";\r\n\t\t\t\tList<Knvv> datas = commonService.findByPage(sapDataCollection,\"Knvv\", json, PERSIZE, 1,null,null);\r\n\t\t\t\tpath = excelService.generateExcel(knvvtitles,knvvfields, datas,Knvv.class, sapDataCollection, SjlxTypeName.TYPE_CUSTOMER, filename);\r\n\t\t\t}\r\n\t\t}\r\n\t\tString zipname = frefixOfFileName;\r\n\t\texcelService.downloadZip(path, zipname, response);\r\n\t\texcelService.deleteByFilePath(path);\r\n\t}", "@Override\n\tpublic Map<String,Object> exinExcel(Map<String, Object> map) {\n\t\tMap<String,Object> resultmap = new HashMap<String, Object>();\n\t\tint result = 0;\n\t\tExinExcel exin = new ExinExcel();\n\t\tList<List<Object>> list = exin.exinExcel(map.get(\"filename\").toString(), (InputStream) map.get(\"content\"));\n\t\tint i = 0, error = 0;\n\t\tif (list.size() > 3) {\n\t\t\tresult = 0;\n\t\t\tresultmap.put(\"total\", list.size()-3);\n\t\t\tresultmap.put(\"returncode\", \"success\");\n\t\t\tfor (List<Object> bis : list) {\n\t\t\t\tif(i<=2){ //跳过前三行\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\ttry{\n\t\t\t\t\tERM_EmergencyResInstrumentEntity yjzb = new ERM_EmergencyResInstrumentEntity();\n\t\t\t\t\tTimestamp t = DateUtils.getSysTimestamp();\n\t\t\t\t\tyjzb.setS1(t);\n\t\t\t\t\tyjzb.setS2(t);\n\t\t\t\t\tyjzb.setS3(0);\n\t\t\t\t\tif(map.get(\"usertype\").equals(\"1\")){\n\t\t\t\t\t\tyjzb.setQyid(Long.valueOf(map.get(\"qyid\").toString()));\n\t\t\t\t\t}\n\t\t\t\t\tyjzb.setUserid(Long.parseLong(UserUtil.getCurrentUser().getId().toString()));\n\t\t\t\t\tyjzb.setM1(bis.get(0).toString());\n\t\t\t\t\tyjzb.setM2(bis.get(1).toString());\n\t\t\t\t\tyjzb.setM3(bis.get(2).toString());\n\t\t\t\t\tif(bis.get(3).toString()!=null&&bis.get(3).toString()!=\"\"){\n\t\t\t\t\t\tyjzb.setM4(Float.parseFloat(bis.get(3).toString()));\n\t\t\t\t\t}\n\t\t\t\t\tyjzb.setM5(bis.get(4).toString());\n\t\t\t\t\tif(bis.get(5).toString()!=null&&bis.get(5).toString()!=\"\"){\n\t\t\t\t\t\tyjzb.setM6(Float.parseFloat(bis.get(5).toString()));\n\t\t\t\t\t}\n\t\t\t\t\tif(bis.get(6).toString()!=null&&bis.get(6).toString()!=\"\"){\n\t\t\t\t\t\tyjzb.setM7(Float.parseFloat(bis.get(6).toString()));\n\t\t\t\t\t}\n\t\t\t\t\tyjzb.setM8(bis.get(7).toString());\n\t\t\t\t\tyjzb.setM9(bis.get(8).toString());\n\t\t\t\t\tyjzb.setM10(bis.get(9).toString());\n\t\t\t\t\tyjzb.setM11(bis.get(10).toString());\n\t\t\t\t\tyjzb.setM13(bis.get(11).toString());\n\t\t\t\t\termYjzbDao.addInfo(yjzb);\n\t\t\t\t\tresult++;\n\t\t\t\t}catch(Exception e){\n\t\t\t\t\terror++;\n\t\t\t\t}\n\t\t\t\tresultmap.put(\"success\",result);\n\t\t\t\tresultmap.put(\"error\", error);\n\t\t\t}\n\t\t}else if(list.size()==3){\n\t\t\tresultmap.put(\"success\",result);\n\t\t\tresultmap.put(\"error\", error);\n\t\t\tresultmap.put(\"returncode\", \"warn\");\n\t\t}else if(list.size()<3){\n\t\t\tresultmap.put(\"success\",result);\n\t\t\tresultmap.put(\"error\", error);\n\t\t\tresultmap.put(\"returncode\", \"ext\");\n\t\t}\n\t\tif(Integer.valueOf(resultmap.get(\"success\").toString())==0){\n\t\t\tresultmap.put(\"returncode\", \"warn\");\n\t\t}\n\t\treturn resultmap;\n\n\t}", "@Override\n public JSONObject getGSTR3BReportSectionCombo(JSONObject requestParams) throws JSONException {\n JSONArray dataJArr = new JSONArray();\n JSONObject sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_3_1_A);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_3_1_B);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_3_1_C);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_3_1_D);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_3_1_E);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_3_2_A);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_3_2_B);\n dataJArr.put(sectionNameObject);\n /**\n * Currently, we have not implemented UIN.\n */\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_3_2_C);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_A_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_A_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_A_3);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_A_4);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_A_5);\n dataJArr.put(sectionNameObject);\n /**\n * Currently, we don't show any values in this section.\n */\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_B_1);\n dataJArr.put(sectionNameObject);\n /**\n * Currently, we don't show any values in this section.\n */\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_B_2);\n dataJArr.put(sectionNameObject);\n /**\n * Currently, we don't show any values in this section.\n */\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_D_1);\n dataJArr.put(sectionNameObject);\n /**\n * Currently, we don't show any values in this section.\n */\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_4_D_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_5_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_5_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_5_3);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GSTR3B_SECTION_5_4);\n dataJArr.put(sectionNameObject);\n return new JSONObject().put(\"data\", dataJArr);\n }", "@Override\n\tpublic void export(HttpServletRequest request, HttpServletResponse response, Map<String, Object> map) {\n\t\tString sheetName = \"石砌边沟过路涵\";\n\t\t//表头\n\t\tString[] head0 = new String[] { \"编号\", \"中心桩号\", \"孔数-孔径(孔-米)\", \"位置\", \"L(m)\", \"工程数量\", \"工程数量\", \"工程数量\", \"工程数量\", \"工程数量\", \"工程数量\", \"工程数量\", \"工程数量\", \"工程数量\",\"备注\"};\n\t\tString[] head1 = new String[] { \"过路板钢筋(Kg)\", \"过路板混凝土C30(m3)\", \"涂料(m2)\", \"涵面铺装钢筋(Kg)\",\"涵面铺装混凝土C30(m3)\", \"C20混凝土台帽(m3)\", \"M15浆砌片石涵台身及基础(m2)\", \"涵身顶面1cm厚油毛毡(m2)\",\"透水性砾料(m3)\" };\n\t\t//对应excel中的行和列,下表从0开始{\"开始行,结束行,开始列,结束列\"}\n\t\tString[] headnum0 = new String[] { \"2,3,0,0\", \"2,3,1,1\", \"2,3,2,2\",\"2,3,3,3\", \"2,3,4,4\", \"2,2,5,13\" ,\"2,3,14,14\"};\n\t\tString[] headnum1 = new String[] { \"3,3,5,5\",\"3,3,6,6\", \"3,3,7,7\", \"3,3,8,8\",\"3,3,9,9\", \"3,3,10,10\", \"3,3,11,11\",\"3,3,12,12\",\"3,3,13,13\"};\n\t\t List<Map<String, Object>> dataList = passingCulvertNumberDao.getPassingCulvertNumberListEX(map);\n\t\t for (int i = 0; i < dataList.size(); i++) {\n\t\t\t dataList.get(i).put(\"row\", i+1);\n\t\t}\n\t\t String[] colName = new String[] { \"row\", \"PileNumber\", \"HoleCount\", \"Position\", \"L\", \"CrossingRebar\", \"CrossingConcrete\", \n\t\t\t\t \"Coating\", \"SpreadRebar\",\"SpreadConcrete\", \"ConcreteCap\", \"RubbleBasics\", \"ThickFelt\", \"PermeableGranules\",\"Remarks\"};\n\t\t Date now = new Date(); \n\t\t String date = \"创建时间\" + now.toString();\n\t\t try {\n\t\t\t //request, response, 数值,标题,第一行表头名字,第一行合并坐标,第二行表头名字,第二行合并坐标,数值对应列名称,创建时间,一共多少列,开始第二行表头列,结束第二行表头列,合计开始列\n\t\t\tReportMergeXls.reportMergeXls(request, response, dataList, sheetName, head0,headnum0, head1, headnum1, colName, date,15,5,14,5);\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public JSONObject getGSTR2Summary(JSONObject params) throws ServiceException, JSONException {\n JSONObject object = new JSONObject();\n JSONObject jMeta = new JSONObject();\n JSONArray jarrColumns = new JSONArray();\n JSONArray jarrRecords = new JSONArray();\n JSONArray dataJArr = new JSONArray();\n JSONArray array = new JSONArray();\n JSONArray array1 = new JSONArray();\n String start = params.optString(\"start\");\n String limit = params.optString(\"limit\");\n String companyId = params.optString(\"companyid\");\n Company company = null;\n KwlReturnObject companyResult = null;\n if (params.optBoolean(\"isforstore\", false)) {\n /**\n * If request for Section combo box\n */\n return object = getGSTR2ReportSectionCombo();\n }\n companyResult = accountingHandlerDAOobj.getObject(Company.class.getName(), companyId);\n company = (Company) companyResult.getEntityList().get(0);\n params.put(\"isPurchase\", true);\n JSONObject reqParams = params;\n /* * before starting sectional data need to get column no for Product Tax\n * Class (HSN)\n */\n int colnum = 0;\n HashMap fieldparams = new HashMap<>();\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Product_Master_ModuleId, \"Custom_\" + Constants.HSN_SACCODE));\n KwlReturnObject kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n List<FieldParams> fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n }\n reqParams.put(\"hsncolnum\", colnum);\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Product_Master_ModuleId, \"Custom_\" + Constants.GSTProdCategory));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n }\n params.put(\"taxclasscolnum\", colnum);\n /**\n * get State column no for Invoice module\n */\n int colnumforstate = fieldManagerDAOobj.getColumnFromFieldParams(Constants.STATE, companyId, Constants.Acc_Vendor_Invoice_ModuleId, 0);\n params.put(\"statecolnum\", colnumforstate);\n /**\n * Get Local state Value\n */\n String entityId = params.optString(\"entityid\");\n params.put(\"companyid\", companyId);\n params.put(\"entityid\", entityId);\n String localState = fieldManagerDAOobj.getStateForEntity(params);\n params.put(\"localState\", localState);\n params.put(\"entityState\", localState);\n /**\n * Get Entity Value and its column no for invoice\n */\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Vendor_Invoice_ModuleId, \"Custom_\" + Constants.ENTITY));\n String fieldid = \"\";\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n String entityValue = params.optString(\"entity\");\n String ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n reqParams.put(\"invoiceentitycolnum\", colnum);\n reqParams.put(\"invoiceentityValue\", ids);\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Make_Payment_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n reqParams.put(\"paymententitycolnum\", colnum);\n reqParams.put(\"paymententityValue\", ids);\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Debit_Note_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n reqParams.put(\"cnentitycolnum\", colnum);\n reqParams.put(\"cnentityValue\", ids);\n\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_GENERAL_LEDGER_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n reqParams.put(\"jeentitycolnum\", colnum);\n reqParams.put(\"jeentityValue\", ids);\n \n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_Credit_Note_ModuleId, \"Custom_\" + Constants.ENTITY));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n ids = fieldManagerDAOobj.getIdsUsingParamsValue(fieldid, entityValue);\n reqParams.put(\"cnentitycolnum\", colnum);\n reqParams.put(\"cnentityValue\", ids);\n reqParams.put(\"Report_type\",\"gstr2\");\n reqParams.put(\"isGSTR1\",false);\n try {\n /**\n * Put Asset Disposal/ Acquire Invoice Dimension column number\n * details\n */\n putAssetInvoiceDimensionColumnDetails(params, reqParams);\n /**\n * Put Lease Sales Invoice Dimension column number details\n */\n putLeaseInvoiceDimensionColumnDetails(params, reqParams);\n getColumnModelForGSTSummary(jarrRecords, jarrColumns, params);\n \n JSONObject header= new JSONObject();\n header.put(\"typeofinvoice\", \"<b>\" + GSTRConstants.GSTR2_ToBeReconciledWithTheGSTPortal + \"</b>\");\n params.put(\"isViewRenderer\", false);\n dataJArr.put(header);\n \n reqParams.put(\"entitycolnum\", reqParams.optString(\"invoiceentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"invoiceentityValue\"));\n /**\n * Add Additional parameter to reqParams\n */\n params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n params.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Regular_ECommerce);\n params.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_DEEMED_EXPORT + \",\" + Constants.CUSTVENTYPE_SEZ+ \",\" + Constants.CUSTVENTYPE_SEZWOPAY);\n params.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n// params.put(\"zerorated\", false);\n params.put(\"typeofjoinisleft\", true);\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_B2B);\n JSONObject b2bobj = getB2BInvoiceDetails(params, null);\n JSONObject B2B = new JSONObject();\n B2B = b2bobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n dataJArr.put(B2B);\n \n /**\n * CDN Invoices\n */\n params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n params.put(\"entitycolnum\", reqParams.optString(\"cnentitycolnum\"));\n params.put(\"registrationType\",Constants.GSTRegType_Regular+\",\"+Constants.GSTRegType_Regular_ECommerce);\n params.put(\"entityValue\", reqParams.optString(\"cnentityValue\"));\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_CDN);\n JSONObject cdnrobj = getCDNRInvoiceDetails(params, null);\n JSONObject CDNR = new JSONObject();\n CDNR = cdnrobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n dataJArr.put(CDNR);\n\n \n JSONObject header1= new JSONObject();\n header1.put(\"typeofinvoice\", \"<b>\" + GSTRConstants.GSTR2_ToBeUploadedOnTheGSTPortal + \"</b>\");\n dataJArr.put(header1); \n /**\n * B2B Unregistered Invoice\n */\n params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n params.put(\"registrationType\",Constants.GSTRegType_Unregistered);\n params.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_DEEMED_EXPORT + \",\" + Constants.CUSTVENTYPE_SEZ+ \",\" + Constants.CUSTVENTYPE_SEZWOPAY);\n params.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n// params.put(\"zerorated\", false);\n params.put(\"typeofjoinisleft\", true);\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_B2B_unregister);\n b2bobj = getB2BInvoiceDetails(params, null);\n B2B = new JSONObject();\n B2B = b2bobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n dataJArr.put(B2B);\n /**\n * Import of Services\n */\n params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n params.put(\"CustomerType\", Constants.CUSTVENTYPE_Import);\n// params.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n params.put(\"isServiceProduct\", true);\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_ImpServices);\n params.put(GSTRConstants.ADD_LANDEDCOST_JOIN_FOR_IMPORT_INVOICES, true);\n params.put(\"excludetaxClassType\", true);\n params.put(\"typeofjoinisleft\", true);\n JSONObject exportobj = getB2BInvoiceDetails(params, null);\n JSONObject EXPORT = new JSONObject();\n EXPORT = exportobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n dataJArr.put(EXPORT);\n /**\n * Import of Goods\n */\n params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n params.put(\"CustomerType\", Constants.CUSTVENTYPE_Import);\n// params.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n params.put(\"isServiceProduct\", false);\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_ImpGoods);\n params.put(GSTRConstants.ADD_LANDEDCOST_JOIN_FOR_IMPORT_INVOICES, true);\n params.put(\"typeofjoinisleft\", true);\n params.put(\"excludetaxClassType\", true);\n exportobj = getB2BInvoiceDetails(params, null);\n EXPORT = new JSONObject();\n EXPORT = exportobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n dataJArr.put(EXPORT);\n \n\n /**\n * CDN Unregistered\n */\n JSONObject CDNUR = new JSONObject();\n params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n params.put(\"entitycolnum\", reqParams.optString(\"cnentitycolnum\"));\n params.put(\"registrationType\", Constants.GSTRegType_Unregistered);\n params.put(\"entityValue\", reqParams.optString(\"cnentityValue\"));\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_CDN_unregister);\n JSONObject cdnurobj = getCDNRInvoiceDetails(params, null);\n CDNUR = new JSONObject();\n CDNUR = cdnurobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n dataJArr.put(CDNUR);\n\n /**\n * NIL Rated\n */\n \n params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n params.put(\"goodsreceiptentitycolnum\", reqParams.optString(\"invoiceentitycolnum\"));\n params.put(\"goodsreceiptentityValue\", reqParams.optString(\"invoiceentityValue\"));\n params.put(\"entitycolnum\", reqParams.optString(\"invoiceentitycolnum\"));\n params.put(\"entityValue\", reqParams.optString(\"invoiceentityValue\"));\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_nilRated);\n params.put(\"registrationType\", Constants.GSTRegType_Composition);\n params.put(\"typeofjoinisleft\", true);\n JSONObject exemptComposition = getExemptPurchaseInvoiceDetails(params);\n JSONObject exempComp = exemptComposition.getJSONArray(\"summaryArr\").getJSONObject(0);\n double sumTaxableAmt= 0.0,sumTotalAmt=0.0;\n int noOfInvoices=0;\n sumTaxableAmt = exempComp.optDouble(\"sumTaxableAmt\");\n sumTotalAmt = exempComp.optDouble(\"sumTotalAmt\");\n noOfInvoices=exempComp.optInt(\"numberofinvoices\");\n params.remove(\"registrationType\");\n params.put(\"taxClassType\", FieldComboData.TaxClass_Exempted + \",\" + FieldComboData.TaxClass_Non_GST_Product);\n params.put(\"typeofjoinisleft\", true);\n exportobj = getExemptPurchaseInvoiceDetails(params);\n JSONObject EXEMPT = new JSONObject();\n EXEMPT = exportobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n sumTaxableAmt += EXEMPT.optDouble(\"sumTaxableAmt\");\n sumTotalAmt += EXEMPT.optDouble(\"sumTotalAmt\");\n noOfInvoices += EXEMPT.optInt(\"numberofinvoices\");\n /**\n * For Product Tax Class 0%\n */\n params.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge);\n params.put(\"typeofjoinisleft\", true);\n params.put(GSTRConstants.IS_PRODUCT_TAX_ZERO, true);\n exportobj = getExemptPurchaseInvoiceDetails(params);\n params.remove(GSTRConstants.IS_PRODUCT_TAX_ZERO);\n EXEMPT = new JSONObject();\n EXEMPT = exportobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n sumTaxableAmt += EXEMPT.optDouble(\"sumTaxableAmt\");\n sumTotalAmt += EXEMPT.optDouble(\"sumTotalAmt\");\n noOfInvoices += EXEMPT.optInt(\"numberofinvoices\");\n \n EXEMPT.put(\"sumTaxableAmt\", sumTaxableAmt);\n EXEMPT.put(\"sumTotalAmt\",sumTotalAmt);\n EXEMPT.put(\"numberofinvoices\", noOfInvoices);\n dataJArr.put(EXEMPT);\n\n// JSONObject summaryObj = new JSONObject();\n// summaryObj.put(\"numberofinvoices\", 0);\n// summaryObj.put(\"typeofinvoice\", \"ISD Credit\");\n// summaryObj.put(\"sumTaxableAmt\", 0);\n// summaryObj.put(\"sumTaxAmt\", 0);\n// summaryObj.put(\"sumTotalAmt\", 0);\n// dataJArr.put(summaryObj);\n\n params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n params.put(\"entitycolnum\", reqParams.optString(\"paymententitycolnum\"));\n params.put(\"entityValue\", reqParams.optString(\"paymententityValue\"));\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_AdvancePaid);\n JSONObject atobj = getTaxLiabilityOnAdvance(params);\n JSONObject AT = new JSONObject();\n AT = atobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n dataJArr.put(AT);\n params.put(\"typeofinvoice\", GSTRConstants.GSTR2_AdvanceAdjust);\n JSONObject atadjobj = getAdjustedAdvance(params);\n JSONObject ATADJ = new JSONObject();\n ATADJ = atadjobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n dataJArr.put(ATADJ);\n//\n// summaryObj = new JSONObject();\n// summaryObj.put(\"numberofinvoices\", 0);\n// summaryObj.put(\"typeofinvoice\", \"ITC Reversal\");\n// summaryObj.put(\"sumTaxableAmt\", 0);\n// summaryObj.put(\"sumTaxAmt\", 0);\n// summaryObj.put(\"sumTotalAmt\", 0);\n// dataJArr.put(summaryObj);\n// /**\n// * HSN summary of Inward supplies\n// */\n// params = new JSONObject(reqParams, JSONObject.getNames(reqParams));\n// params.put(\"entitycolnum\", reqParams.optString(\"invoiceentitycolnum\"));\n// params.put(\"entityValue\", reqParams.optString(\"invoiceentityValue\"));\n// params.put(\"typeofinvoice\", \"HSN summary of Inward supplies\");\n// exportobj = getHSNSummarydetails(params);\n// EXPORT = new JSONObject();\n// EXPORT = exportobj.getJSONArray(\"summaryArr\").getJSONObject(0);\n// dataJArr.put(EXPORT);\n\n JSONArray pagedJson = new JSONArray();\n pagedJson = dataJArr;\n if (!StringUtil.isNullOrEmpty(start) && !StringUtil.isNullOrEmpty(limit)) {\n pagedJson = StringUtil.getPagedJSON(pagedJson, Integer.parseInt(start), Integer.parseInt(limit));\n }\n object.put(\"totalCount\", dataJArr.length());\n object.put(\"columns\", jarrColumns);\n object.put(\"coldata\", pagedJson);\n jMeta.put(\"totalProperty\", \"totalCount\");\n jMeta.put(\"root\", \"coldata\");\n jMeta.put(\"fields\", jarrRecords);\n object.put(\"metaData\", jMeta);\n if (params.optBoolean(\"isExport\")) {\n object.put(\"data\", dataJArr);\n object.put(\"columns\", jarrColumns);\n }\n } catch (JSONException ex) {\n throw ServiceException.FAILURE(ex.getMessage(), ex);\n }\n return object;\n }", "private Object generateDeleteAlertDataJSON(XSSFWorkbook workbook, String sheetName, String scenarioID,ExcelOperation excelOperation) {\n\t\tJSONObject deleteAlertsRequestJsonObject=new JSONObject();\n\t\tList<LinkedHashMap<String, String>>jsonMap=excelOperation.getScenarioData(workbook, sheetName, scenarioID);\n\t\tfor(LinkedHashMap<String, String> json:jsonMap) {\n\t\t\tdeleteAlertsRequestJsonObject.put(\"AlertType\",generateDeleteAlertsTypeDataJSON(workbook, \"DT_AlertTypeForDeleteAlert\", scenarioID, excelOperation));\n\t\t\n\t\t\tdeleteAlertsRequestJsonObject.put(\"AlertData\",generateDeleteAlertsDataJSON(workbook, \"DT_SetIDForAlertDelete\", scenarioID, excelOperation));\n\t\t}\n\t\treturn deleteAlertsRequestJsonObject;\n\t}", "public JSONObject getInvoiceForGSTR3BZeroRated(JSONObject reqParams) throws JSONException, ServiceException {\n /**\n * Get Invoice total sum\n */\n String companyId=reqParams.optString(\"companyid\");\n reqParams.put(\"entitycolnum\", reqParams.optString(\"invoiceentitycolnum\"));\n reqParams.put(\"entityValue\", reqParams.optString(\"invoiceentityValue\"));\n JSONObject jSONObject = new JSONObject();\n List<Object> invoiceData = accEntityGstDao.getInvoiceDataWithDetailsInSql(reqParams);\n if (!reqParams.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n double taxableAmountInv = 0d;\n double taxableAmountCN = 0d;\n double taxableAmountAdv = 0d;\n double taxableAmountAdvAdjusted = 0d;\n double IGSTAmount = 0d;\n double CGSTAmount = 0d;\n double SGSTAmount = 0d;\n double CESSAmount = 0d;\n for (Object object : invoiceData) {\n Object[] data = (Object[]) object;\n// String term = data[1]!=null?data[1].toString():\"\";\n// double termamount = data[0]!=null?(Double) data[0]:0;\n taxableAmountInv = data[2]!=null?(Double) data[2]:0;\n }\n\n// /**\n// * Get CN amount\n// */\n// reqParams.put(\"entitycolnum\", reqParams.optString(\"cnentitycolnum\"));\n// reqParams.put(\"entityValue\", reqParams.optString(\"cnentityValue\"));\n// reqParams.put(\"isGSTINnull\", false);\n// reqParams.put(\"GST3B\", true);\n// List<Object> cnData = accEntityGstDao.getCNDNWithInvoiceDetailsInSql(reqParams);\n// for (Object object : cnData) {\n// Object[] data = (Object[]) object;\n// String term = data[1].toString();\n// double termamount = (Double) data[0];\n// taxableAmountCN = (Double) data[2];\n// }\n//\n// /**\n// * Get Advance for which idx not linked yet\n// */\n// reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n// reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n// reqParams.put(\"isGSTINnull\", false);\n// reqParams.put(\"GST3B\", true);\n// reqParams.put(\"at\", true);\n// reqParams.remove(\"atadj\");\n// List<Object> AdvData = accEntityGstDao.getAdvanceDetailsInSql(reqParams);\n// for (Object object : AdvData) {\n// Object[] data = (Object[]) object;\n// String term = data[1].toString();\n// double termamount = (Double) data[0];\n// taxableAmountAdv = (Double) data[2];\n//\n// }\n// /**\n// * Get Advance for which invoice isLinked\n// */\n// reqParams.put(\"entitycolnum\", reqParams.optString(\"receiptentitycolnum\"));\n// reqParams.put(\"entityValue\", reqParams.optString(\"receiptentityValue\"));\n// reqParams.put(\"isGSTINnull\", false);\n// reqParams.put(\"GST3B\", true);\n// reqParams.remove(\"at\");\n// reqParams.put(\"atadj\", true);\n// AdvData = accEntityGstDao.getAdvanceDetailsInSql(reqParams);\n// for (Object object : AdvData) {\n// Object[] data = (Object[]) object;\n// String term = data[1].toString();\n// double termamount = (Double) data[0];\n// taxableAmountAdvAdjusted = (Double) data[2];\n//\n// }\n jSONObject.put(\"Nature of Supplies\", \"b) Outward taxable supplies (zero rated)\");\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount(taxableAmountInv,companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount(IGSTAmount,companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount(CGSTAmount,companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount(SGSTAmount,companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount(CESSAmount,companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount(IGSTAmount+CGSTAmount+SGSTAmount+CESSAmount,companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount(taxableAmountInv,companyId));\n } else {\n jSONObject = accGSTReportService.getSalesInvoiceJSONArrayForGSTR3B(invoiceData, reqParams, companyId);\n }\n return jSONObject;\n }", "@Override\n public JSONObject getGSTComputationReportSectionCombo(JSONObject requestParams) throws JSONException {\n JSONArray dataJArr = new JSONArray();\n JSONObject sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_1_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_1_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_1_3);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_2_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_3);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_3_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_4);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_4_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_4_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_3);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_4);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_5);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_8);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_9);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_9_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_9_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_10);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_10_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_10_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_1_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_3);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_3_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_3_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_4);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_5);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_6);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_7);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_7_1);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_7_2);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_11);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_11_10);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_12);\n dataJArr.put(sectionNameObject);\n sectionNameObject = new JSONObject();\n sectionNameObject.put(\"typeofinvoice\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_13_1);\n dataJArr.put(sectionNameObject);\n return new JSONObject().put(\"data\", dataJArr);\n }", "private JSONObject getGSTR3B_Section_5_2_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Non_GST_Product);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.put(\"itctype\", Constants.GST_ITCTYPE_DEFAULT+\",\"+Constants.GST_ITCTYPE_REVERSED);\n JSONObject jSONObject = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n jSONObject = getGoodsReceiptForGSTR3BNonGST(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n }\n\n /**\n * Vendor DN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Non_GST_Product);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.remove(\"cnentityValue\");\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n\n }\n\n /**\n * Vendor CN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Non_GST_Product);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.put(\"onlycnagainstvendor\", true);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_5_2);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "public JSONObject getCESSCalculationType(JSONObject reqParams) throws JSONException, ServiceException {\n JSONObject jSONObject = new JSONObject();\n KwlReturnObject kwlReturnObject = accEntityGstDao.getCESSCalculationType(reqParams);\n if (kwlReturnObject != null) {\n JSONArray JArray = new JSONArray();\n List<GSTCessRuleType> cessRuleTypes = kwlReturnObject.getEntityList();\n for (GSTCessRuleType ruleType : cessRuleTypes) {\n JSONObject obj = new JSONObject();\n obj.put(\"id\", ruleType.getId());\n obj.put(\"name\", ruleType.getName());\n JArray.put(obj);\n }\n jSONObject.put(\"data\", JArray);\n }\n return jSONObject;\n }", "public static JSONObject placeOrder(Map<String, String> orderDetails) {\n JSONObject responseJson = new JSONObject();\n\n System.out.println(\"building json\");\n\n try {\n JSONObject orderJson = new JSONObject();\n\n /* \n required attributes: \n 1. retailer\n 2. products\n 3. shipping_address\n 4. shipping_method\n 5. billing_address\n 6. payment_method\n 7. retailer_credentials\n \n /* other attributes we will use:\n 8. max_price \n \n */\n // 1.\n // put the retailer attribute in\n orderJson.put(\"retailer\", \"amazon\");\n\n // 2.\n // create the products array\n JSONArray products = new JSONArray();\n JSONObject product = createProductObject(orderDetails);\n // put product in array\n products.put(product);\n // put the products array in orderJson\n orderJson.put(\"products\", products);\n\n // 3. \n // create shipping address object\n JSONObject shipAddress = createShipAddressObject(orderDetails);\n orderJson.put(\"shipping_address\", shipAddress);\n\n // 4. \n // insert shipping method attribute\n orderJson.put(\"shipping_method\", \"cheapest\");\n\n // 5.\n // create billing address object\n JSONObject billAddress = createBillAddressObject(orderDetails);\n orderJson.put(\"billing_address\", billAddress);\n\n // 6. \n // create payment method object\n JSONObject paymentMethod = createPaymentMethod(orderDetails);\n orderJson.put(\"payment_method\", paymentMethod);\n\n // 7. \n // create retailer credentials object\n JSONObject retailerCredentials = createRetailerCredentialsObject();\n orderJson.put(\"retailer_credentials\", retailerCredentials);\n\n // 8.\n // put max_price in orderJson\n // NOTE: this is the last thing that will prevent an order from \n // actually going through. use 0 for testing purposes, change to \n // maxPrice to actually put the order through\n orderJson.put(\"max_price\", 0); // replace with: orderDetails.get(\"maxPrice\")\n\n //===--- finally: send the json to the api ---===//\n responseJson = sendRequest(orderJson);\n //===-----------------------------------------===//\n\n } catch (JSONException ex) {\n Logger.getLogger(ZincUtils.class.getName()).log(Level.SEVERE, null, ex);\n }\n\n return responseJson;\n }", "@Override\n\t\tprotected Void doInBackground(Void... params) {\n\t\t\tJSONObject obj_main = new JSONObject();\n\t\t\ttry {\n\t\t\t\tobj_main.put(\"restaurant_id\", Global_variable.restaurant_id);\n\t\t\t\tobj_main.put(\"restaurant_name\", Global_variable.logindata\n\t\t\t\t\t\t.getJSONObject(\"global_setting\").getString(\"name_en\"));\n\t\t\t\tobj_main.put(\n\t\t\t\t\t\t\"email\",\n\t\t\t\t\t\tGlobal_variable.logindata.getJSONObject(\n\t\t\t\t\t\t\t\t\"global_setting\").getString(\"contact_email\"));\n\t\t\t\t// System.out.println(\"himurtuza\"+obj_output.getJSONObject(\"data\").getJSONArray(\"manage_customer\"));\n\t\t\t\t// System.out.println(\"himurtuza\"+filter_array.length());\n\t\t\t\ttry {\n\t\t\t\t\tobj_main.put(\"pdf_data\", filter_array);\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tobj_main.put(\"pdf_data\", obj_output.getJSONObject(\"data\")\n\t\t\t\t\t\t\t.getJSONArray(\"manage_customer\"));\n\t\t\t\t}\n\t\t\t\tobj_main.put(\"sessid\", Global_variable.sessid.toString());\n\t\t\t\tSystem.out.println(\"obj_mainmanagcust\" + obj_main);\n\t\t\t\tmyconnection con = new myconnection();\n\t\t\t\tobj_output_invoice = new JSONObject(\n\t\t\t\t\t\tcon.connection(\n\t\t\t\t\t\t\t\tManageCustomersActivity.this,\n\t\t\t\t\t\t\t\tGlobal_variable.rf_api_generate_invoice_manage_customer,\n\t\t\t\t\t\t\t\tobj_main));\n\t\t\t\tSystem.out.println(\"obj_mainmanagcustoutput\" + obj_output_invoice);\n\n\t\t\t} catch (JSONException e2) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te2.printStackTrace();\n\t\t\t} catch (NullPointerException e2) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te2.printStackTrace();\n\t\t\t}\n\t\t\treturn null;\n\t\t}", "public void setData(){\n\t\tif(companyId != null){\t\t\t\n\t\t\tSystemProperty systemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"BUSINESS_TYPE\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tbusinessType = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"MAX_INVALID_LOGIN\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tinvalidloginMax = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"SKU_GENFLAG\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tautomaticItemCode = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"SKU_GENFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tformatItemCode = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"DO_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tdeliveryItemNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"STO_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tstockOpnameNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"RN_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\treceiptItemNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"PLU_GENFLAG\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tautomaticProdCode = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"PLU_FORMAT_TYPE\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tprodCodeFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"SO_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tsalesNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"SOINV_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tinvoiceNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"SORCPT_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\treceiptNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"DEFAULT_TAX_TYPE\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tsalesTax = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"DELIVERY_COST\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tdeliveryCost = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"PO_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tpurchaceNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"PINV_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tpurchaceInvoiceNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"PAYMENT_NUMBERFORMAT\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\tpaymentNoFormat = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t\t\n\t\t\tsystemProperty = systemPropertyService\n\t\t\t\t\t.searchSystemPropertyNameAndCompany(\"TAX_VALUE\", companyId);\n\t\t\tif(systemProperty!=null){\n\t\t\t\ttaxValue = systemProperty.getSystemPropertyValue();\n\t\t\t}\n\t\t} else {\n\t\t\tbusinessType = null;\n\t\t\tinvalidloginMax = null;\n\t\t\tautomaticItemCode = null;\n\t\t\tformatItemCode = null;\n\t\t\tdeliveryItemNoFormat = null;\n\t\t\tstockOpnameNoFormat = null;\n\t\t\treceiptItemNoFormat = null;\n\t\t\tautomaticProdCode = null;\n\t\t\tprodCodeFormat = null;\n\t\t\tsalesNoFormat = null;\n\t\t\tinvoiceNoFormat = null;\n\t\t\treceiptNoFormat = null;\n\t\t\tsalesTax = null;\n\t\t\tdeliveryCost = null;\n\t\t\tpurchaceNoFormat = null;\n\t\t\tpurchaceInvoiceNoFormat = null;\n\t\t\tpaymentNoFormat = null;\n\t\t\ttaxValue = null;\n\t\t}\n\t}", "@Test\n public void testPurInStock() {\n\n String s = \"{\\\"infos\\\":[{\\\"goodsCode\\\":\\\"A07090202450\\\",\\\"inStockNum\\\":1}],\\\"ouserId\\\":2,\\\"ouserName\\\":\\\"001\\\",\\\"purchaseNo\\\":\\\"CG160109000001\\\"}\";\n PurchaseBillInfo purchaseBillInfo = JSON.parseObject(s, PurchaseBillInfo.class);\n\n try {\n ServerStatus serverStatus = purchaseBillService.purInStock(purchaseBillInfo);\n// System.out.println(\"---------------------\" + JSON.toJSONString(pinfo));\n System.out.println(serverStatus);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public interface ExcelExport {\n\n //void buildSheet(XSSFWorkbook xssfWorkbook, String sheetName, String headerTitle, Map<String, String> commonExcelData, List<Map<String, String>> data);\n\n /**\n * 构建xlsx\n *\n * @param xssfWorkbook\n * @param config\n * @param result 数据\n */\n void buildXlsx(XSSFWorkbook xssfWorkbook, XlsxConfig config, JSONObject result);\n\n XlsxConfig getXlsxConfig(String path) throws IOException;\n}", "@SuppressLint(\"SetTextI18n\")\n private void processJsonData(String report)\n {\n try {\n JSONObject mainObject = new JSONObject(report);\n JSONArray reportArray = mainObject.optJSONArray(\"report\");\n\n JSONObject jsonIndex = reportArray.getJSONObject(0);\n JSONArray detailArray = jsonIndex.getJSONArray(\"detail\");\n JSONObject detailObject = detailArray.getJSONObject(0);\n\n if(!detailObject.getString(\"monthlyTaka\").equals(\"0\"))\n monthlyTaka = detailObject.getString(\"monthlyTaka\");\n else monthlyTaka = \"0\";\n\n if(!detailObject.getString(\"monthlyCost\").equals(\"0\"))\n monthlyCost = detailObject.getString(\"monthlyCost\");\n else monthlyCost = \"0\";\n\n if(!detailObject.getString(\"monthlyMeal\").equals(\"0\"))\n monthlyMeal = detailObject.getString(\"monthlyMeal\");\n else monthlyMeal = \"0\";\n\n if(!detailObject.getString(\"remaining\").equals(\"0\"))\n remain = detailObject.getString(\"remaining\");\n else remain = \"0\";\n\n if(!detailObject.getString(\"mealRate\").equals(\"0\"))\n mealRate = detailObject.getString(\"mealRate\");\n else mealRate = \"0\";\n\n String name,meal,taka,cost,status;\n\n for(int i=1;i<reportArray.length();i++)\n {\n int count=0;\n JSONObject index = reportArray.getJSONObject(i);\n JSONArray infoArray = index.getJSONArray(\"info\");\n while(count<infoArray.length())\n {\n JSONObject object = infoArray.getJSONObject(count);\n\n name = object.getString(\"name\");\n if(!object.getString(\"meal\").equals(\"null\"))\n meal = object.getString(\"meal\");\n else meal = \"0\";\n if(!object.getString(\"taka\").equals(\"null\"))\n taka = object.getString(\"taka\");\n else taka = \"0\";\n if(!object.getString(\"cost\").equals(\"null\"))\n cost = object.getString(\"cost\");\n else cost = \"0\";\n if(!object.getString(\"status\").equals(\"null\"))\n status = object.getString(\"status\");\n else status = \"0\";\n modelList.add(new CostModel(name,meal,taka,cost,status));\n count++;\n }\n }\n\n ReportAdapter adapter = new ReportAdapter(this, modelList, mealRate, sharedPreferenceData.getmyCurrentSession());\n listView.setAdapter(adapter);\n\n txtTotalTaka.setText(monthlyTaka);txtTotalMeal.setText(monthlyMeal);txtTotalCost.setText(monthlyCost);\n txtRemaining.setText(remain);txtMealRate.setText(mealRate+\" per meal\");\n\n }catch (JSONException e)\n {\n Log.d(\"Exception \",e.toString());\n }\n }", "public List updatePaymentDetailsInCRM(List inputList) {\n log.info(\"INSIDE update Payment Details In CRM json Input:\" + inputList.get(1));\n List retValue = new ArrayList();\n JSONObject jsonObject = null;\n retValue.add(0, \"false\");\n String str = null;\n log.info(\"update Payment Details list: \" + inputList);\n JSONObject jsonInput = new JSONObject();\n try {\n str =\n callServicePost(inputList.get(0).toString(), (JSONObject) (inputList.get(1)),\n EPICConstant.NON_SECURED_TOKEN,null);\n jsonObject = new JSONObject(str);\n log.info(\"json Response is: \" + jsonObject);\n if (jsonObject.getString(EPICConstant.ERROR_CODE) != null &&\n jsonObject.getString(EPICConstant.ERROR_CODE).equalsIgnoreCase(\"0\")) {\n retValue.set(0, \"true\");\n retValue.add(1, jsonObject);\n } else {\n retValue.set(0, \"false\");\n }\n } catch (Exception payUpd) {\n retValue.set(0, \"false\");\n\n try {\n throw payUpd;\n } catch (Exception payUpdf) {\n payUpdf.printStackTrace();\n }\n }\n return retValue;\n }", "public JSONObject createJSON(String dateModified, String type){\n ArrayList<Integer> keyArrl = getAllKeysOrdered();\n if(keyArrl == null || keyArrl.isEmpty()){\n return null;\n }\n\n //try to create a JSONObject\n try {\n JSONObject jObj = new JSONObject();\n //insert the file name and type\n jObj.put(\"Date Modified\", dateModified);\n jObj.put(\"Type\", type);\n\n //check to make sure not saving empty file\n if(keyArrl == null || keyArrl.isEmpty()){\n return null;\n }\n\n //insert JSONArray of the keys\n JSONArray jsArray = new JSONArray(keyArrl);\n jObj.put(\"Values\", jsArray);\n\n //return the JSONObject\n return jObj;\n\n //catch the error if JSONObject not made\n } catch (JSONException e) {\n Log.e(\"MYAPP\", \"unexpected JSON exception\", e);\n // Do something to recover ... or kill the app.\n return null;\n }\n }", "public String doPayy(Expence expence, BankRunning bankRunning, User user)\r\n/* 89: */ {\r\n/* 90: 86 */ String result = \"\";\r\n/* 91: 87 */ Expence persistent = (Expence)this.expenceDao.load(expence.getId());\r\n/* 92: 88 */ if ((\"3\".equals(persistent.getStat())) || (persistent.getStat() == \"3\")) {\r\n/* 93: 89 */ return result = \"[id=\" + persistent.getId() + \", \" + persistent.getStat() + \"]该项数据已经审批!\";\r\n/* 94: */ }\r\n/* 95: 92 */ ExpenceFlow expenceFlow = new ExpenceFlow();\r\n/* 96: 93 */ expenceFlow.setGxsj(new Date());\r\n/* 97: 94 */ expenceFlow.setExpence(expence);\r\n/* 98: 95 */ expenceFlow.setUser(user);\r\n/* 99: 96 */ expenceFlow.setOptContent(\"审批\");\r\n/* 100: 97 */ expenceFlow.setYwlc(Integer.valueOf(3));\r\n/* 101: 98 */ this.expenceFlowDao.save(expenceFlow);\r\n/* 102: */ \r\n/* 103: */ \r\n/* 104:101 */ BeanUtils.copyProperties(expence, persistent, new String[] { \"id\", \"user\", \"bxsj\", \"fssj\", \"bxnr\", \"bxje\", \"bxr\", \"skzh\", \"bxlx\" });\r\n/* 105:102 */ persistent.setGxr(user.getName());\r\n/* 106:103 */ persistent.setGxsj(new Date());\r\n/* 107:104 */ persistent.setStat(\"3\");\r\n/* 108:108 */ if (bankRunning != null)\r\n/* 109: */ {\r\n/* 110:110 */ bankRunning.setZcje(Double.parseDouble(bankRunning.getFkje()));\r\n/* 111:111 */ bankRunning.setLrje(0.0D - Double.parseDouble(bankRunning.getFkje()));\r\n/* 112:112 */ bankRunning.setLrsj(new Date());\r\n/* 113:113 */ bankRunning.setLrr(user.getName());\r\n/* 114:114 */ bankRunning.setShbj(\"1\");\r\n/* 115:115 */ bankRunning.setOrderId(expenceFlow.getId().toString());\r\n/* 116:116 */ bankRunning.setBz(expenceFlow.getOptContent());\r\n/* 117:117 */ Integer b_r_id = (Integer)this.bankRunningService.save(bankRunning);\r\n/* 118: */ \r\n/* 119:119 */ persistent.setBankRunningId(b_r_id);\r\n/* 120:120 */ this.expenceDao.update(persistent);\r\n/* 121: */ \r\n/* 122:122 */ Bank b = (Bank)this.bankService.get(bankRunning.getBank().getId());\r\n/* 123:123 */ double cush = new Double(b.getCush() + bankRunning.getLrje()).doubleValue();\r\n/* 124:124 */ this.bankService.updateBankCush(cush, Integer.valueOf(bankRunning.getBank().getId().intValue()));\r\n/* 125: */ }\r\n/* 126:126 */ return result;\r\n/* 127: */ }", "@Override\n\tpublic ResponseInfo addPurchasecontract(Map<String, Object> map) {\n\t\tResponseInfo info = new ResponseInfo();\n\t\tint result = 0;\n\t\tint upResult = 0;\n\t\tint staratCount = 0;\n\t\tString flag = map.get(\"flag\").toString();\n\t\tString purchaseorderinfoMapString = map.get(\"purchaseorderinfoMap\").toString();\n\t\tMap<String,Object> purchaseorder= JSON.parseObject(purchaseorderinfoMapString);\n\t\tMap <String,Object> updateApplySignMap = new HashMap<>();\n\t\tif(!purchaseorder.get(\"contractState\").toString().equals(\"3\")) {\n\t\t\tpurchaseorder.put(\"cancellationCause\", \"\");\n\t\t}\n\t\tif(!flag.equals(\"1\")) {\n\t\t\tresult = purchaseDao.addPurchasecontract(purchaseorder);\n\t\t}else {\n\t\t\tresult = purchaseDao.updatePurchasecontractById(purchaseorder);\n\t\t}\n\t\tif(result>0) {\n\t\t\tif(map.get(\"fileName\")!=null && map.get(\"fileName\") != \"\") {\n\t\t\t\tMap<String,Object> upLoadMap = new HashMap<>();\n\t\t\t\tupLoadMap.put(\"serialID\",map.get(\"contractNumber\"));\n\t\t\t\tupLoadMap.put(\"fileName\",map.get(\"fileName\"));\n\t\t\t\tupLoadMap.put(\"fileRoute\",map.get(\"uploadAddress\"));\n\t\t\t\tupResult = purchaseDao.adduploadfile(upLoadMap);\n\t\t\t\tif(!(upResult>0)) {\n\t\t\t\t\tinfo.setMessage(\"操作失败002\");\n\t\t\t\t\tinfo.setCode(\"error\");\n\t\t\t\t\tTransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\n\t\t\t\t\treturn info;\n\t\t\t\t}\n\t\t\t}\n\t\t\tString purchaseorderinfoListMap = map.get(\"purchaseorderinfoListMap\").toString();\n\t\t\tList<Object> list =JSON.parseArray(purchaseorderinfoListMap);\n\t\t\tfor (Object object : list){\n\t\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\t\tMap <String,Object> ret = (Map<String, Object>) object;//取出list里面的值转为map\n\t\t\t\tret.put(\"purchaseOrderId\", purchaseorder.get(\"Id\"));\n\t\t\t\tupdateApplySignMap.put(\"id\", Integer.parseInt(ret.get(\"purchaseRequisitionId\").toString()));\n\t\t\t\tif(!flag.equals(\"1\")) {\n\t\t\t\t\tinfo = this.addPurchaseorderinfo(ret);\n\t\t\t\t\tif(info.getCode().equals(\"success\")) {\n\t\t\t\t\t\tupdateApplySignMap.put(\"applySign\",1);\n\t\t\t\t\t\tinfo = this.updatePurchaserequisitionIsApplySign(updateApplySignMap);\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\tMap<String,Object> orderinfoId = new HashMap<>();\n\t\t\t\t\torderinfoId.put(\"id\", purchaseorder.get(\"Id\"));\n\t\t\t\t\t//麻烦死了\n\t\t\t\t\tList<Map<String,Object>> PurchaserequisitionByPurchasecontractIdList = purchaseDao.getPurchaserequisitionByPurchasecontractId(orderinfoId);\n\t\t\t\t\tif(staratCount == 0) {\n\t\t\t\t\t\tfor (int i = 0; i < PurchaserequisitionByPurchasecontractIdList.size(); i++) {\n\t\t\t\t\t\t\tPurchaserequisitionByPurchasecontractIdList.get(i).put(\"applySign\", 0);\n\t\t\t\t\t\t\tresult = purchaseDao.updatePurchaserequisitionIsApplySign(PurchaserequisitionByPurchasecontractIdList.get(i));\n\t\t\t\t\t\t\tif(result<0) {\n\t\t\t\t\t\t\t\tinfo.setMessage(\"操作失败\");\n\t\t\t\t\t\t\t\tinfo.setCode(\"error\");\n\t\t\t\t\t\t\t\tTransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\n\t\t\t\t\t\t\t\treturn info;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tList<Map <String,Object>> PurchaseorderinfoList = purchaseDao.getPurchaseorderinfoById(orderinfoId);\n\t\t\t\t\tboolean isHave = false;\n\t\t\t\t\tfor (int i = 0; i < PurchaseorderinfoList.size(); i++) {\n\t\t\t\t\t\tif(PurchaseorderinfoList.get(i).get(\"serialID\").toString().equals(ret.get(\"serialID\").toString())) {\n\t\t\t\t\t\t\tisHave = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\tisHave = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(isHave) {\n\t\t\t\t\t\tinfo = this.updatePurchaseorderinfoById(ret);\n\t\t\t\t\t\tif(info.getCode().equals(\"success\")) {\n\t\t\t\t\t\t\tupdateApplySignMap.put(\"applySign\",1);\n\t\t\t\t\t\t\tinfo = this.updatePurchaserequisitionIsApplySign(updateApplySignMap);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else {\n\t\t\t\t\t\tinfo = this.addPurchaseorderinfo(ret);\n\t\t\t\t\t\tif(info.getCode().equals(\"success\")) {\n\t\t\t\t\t\t\tupdateApplySignMap.put(\"applySign\",1);\n\t\t\t\t\t\t\tinfo = this.updatePurchaserequisitionIsApplySign(updateApplySignMap);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tstaratCount += 1;\n\t\t\t\t}\n\t\t\t\tif(info.getCode().equals(\"error\")) {\n\t\t\t\t\tinfo.setMessage(\"操作失败003\");\n\t\t\t\t\tinfo.setCode(\"error\");\n\t\t\t\t\tTransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\n\t\t\t\t\treturn info;\n\t\t\t\t}\n\t\t\t}\n\t\t}else {\n\t\t\tinfo.setMessage(\"操作失败001\");\n\t\t\tinfo.setCode(\"error\");\n\t\t\tTransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\n\t\t}\n\t\treturn info;\n\t}", "@DataProvider(name = \"RegisterData\")\n\n\tpublic Object[][] RegisterData() throws Exception {\n\n\t\tExcel.ExcelUtils.setExcelFile(URLFile, \"Feuil1\");\n\n//\t\tFileInputStream inputStream = new FileInputStream(\n//\t\t\t\tnew File(\"D:/Documents/AJC Formation/Cours AJC/10. selenium/CreateJobOrder.xlsx\"));\n//\t\t@SuppressWarnings(\"resource\")\n//\t\tXSSFWorkbook Workbook = new XSSFWorkbook(inputStream);\n//\t\tXSSFSheet sheet = Workbook.getSheetAt(0);\n//\t\tint NombreLigne=sheet.getLastRowNum();\n\n//\t\tThread.sleep(1000);\n\n\t\tint NombreLigne;\n\t\tNombreLigne = Excel.ExcelUtils.getRowCount();\n\n\t\tObject[][] Data = new Object[NombreLigne][22];\n//\t\tDataFormatter formatter = new DataFormatter();\n\n\t\tTitle = \"\";\n\t\tCompany = \"\";\n\t\tCity = \"\";\n\t\tState = \"\";\n\t\tRecruiter = \"\";\n\t\tOwner = \"\";\n\t\tType = \"\";\n\t\tOpenings = \"\";\n\t\tResultatAttendu = \"\";\n\t\t// optionnelles\n\t\tDepartment = \"\";\n\t\tContact = \"\";\n\t\tStartDate = \"\";\n\t\tDuration = \"\";\n\t\tMaximumRate = \"\";\n\t\tSalary = \"\";\n\t\tCompanyJobID = \"\";\n\t\tHot = \"\";\n\t\tPublic = \"\";\n\t\tDescription = \"\";\n\t\tInternalNotes = \"\";\n\t\tQuestionnaire = \"\";\n\n\t\tfor (int i = 1; i <= NombreLigne; i++) {\n\n//\t\t\tXSSFCell CellTitle = excelUtils.LireCell(0);\n//\t\t\tUsername=CellUsername.getStringCellValue();\n//\t\t\tformatter.formatCellValue(CellTitle);\n\n//\t\t\tXSSFCell CellCompany = sheet.getRow(i).getCell(1);\n//\t\t\tCompany = formatter.formatCellValue(CellCompany);\n\n//\t\t\tXSSFCell CellCity = sheet.getRow(i).getCell(2);\n//\t\t\tCity = formatter.formatCellValue(CellCity);\n//\n//\t\t\tXSSFCell CellState = sheet.getRow(i).getCell(3);\n//\t\t\tState = formatter.formatCellValue(CellState);\n//\n//\t\t\tXSSFCell CellRecruiter = sheet.getRow(i).getCell(4);\n//\t\t\tRecruiter = formatter.formatCellValue(CellRecruiter);\n//\n//\t\t\tXSSFCell CellOwner = sheet.getRow(i).getCell(5);\n//\t\t\tOwner = formatter.formatCellValue(CellOwner);\n//\n//\t\t\tXSSFCell CellType = sheet.getRow(i).getCell(6);\n//\t\t\tType = formatter.formatCellValue(CellType);\n//\n//\t\t\tXSSFCell CellOpenings = sheet.getRow(i).getCell(7);\n//\t\t\tOpenings = formatter.formatCellValue(CellOpenings);\n//\n//\t\t\tXSSFCell CellResultatAttendu = sheet.getRow(i).getCell(8);\n//\t\t\tResultatAttendu = formatter.formatCellValue(CellResultatAttendu);\n\n\t\t\tTitle = Excel.ExcelUtils.getCellData(i, 0);\n\t\t\tCompany = Excel.ExcelUtils.getCellData(i, 1);\n\t\t\tCity = Excel.ExcelUtils.getCellData(i, 2);\n\t\t\tState = Excel.ExcelUtils.getCellData(i, 3);\n\t\t\tRecruiter = Excel.ExcelUtils.getCellData(i, 4);\n\t\t\tOwner = Excel.ExcelUtils.getCellData(i, 5);\n\t\t\tType = Excel.ExcelUtils.getCellData(i, 6);\n\t\t\tOpenings = Excel.ExcelUtils.getCellData(i, 7);\n\t\t\tResultatAttendu = Excel.ExcelUtils.getCellData(i, 8);\n\n\t\t\tDepartment = Excel.ExcelUtils.getCellData(i, 13);\n\t\t\tContact = Excel.ExcelUtils.getCellData(i, 14);\n\t\t\tStartDate = Excel.ExcelUtils.getCellData(i, 15);\n\t\t\tDuration = Excel.ExcelUtils.getCellData(i, 16);\n\t\t\tMaximumRate = Excel.ExcelUtils.getCellData(i, 17);\n\t\t\tSalary = Excel.ExcelUtils.getCellData(i, 18);\n\t\t\tCompanyJobID = Excel.ExcelUtils.getCellData(i, 19);\n\t\t\tHot = Excel.ExcelUtils.getCellData(i, 20);\n\t\t\tPublic = Excel.ExcelUtils.getCellData(i, 21);\n\t\t\tDescription = Excel.ExcelUtils.getCellData(i, 22);\n\t\t\tInternalNotes = Excel.ExcelUtils.getCellData(i, 23);\n\t\t\tQuestionnaire = Excel.ExcelUtils.getCellData(i, 24);\n\n\t\t\tif (Recruiter.length() == 0) {\n\t\t\t\tRecruiter = \"(Select a User)\";\n\t\t\t}\n\n\t\t\tif (Owner.length() == 0) {\n\t\t\t\tOwner = \"(Select a User)\";\n\t\t\t}\n\n\t\t\tif (Type.length() == 0) {\n\t\t\t\tType = \"C (Contract)\";\n\t\t\t}\n\n\t\t\tData[i - 1][0] = Title;\n\t\t\tData[i - 1][1] = Company;\n\t\t\tData[i - 1][2] = City;\n\t\t\tData[i - 1][3] = State;\n\t\t\tData[i - 1][4] = Recruiter;\n\t\t\tData[i - 1][5] = Owner;\n\t\t\tData[i - 1][6] = Type;\n\t\t\tData[i - 1][7] = Openings;\n\t\t\tData[i - 1][8] = ResultatAttendu;\n\t\t\tData[i - 1][9] = i;\n\n\t\t\t// optionnelles\n\t\t\tData[i - 1][10] = Department;\n\t\t\tData[i - 1][11] = Contact;\n\t\t\tData[i - 1][12] = StartDate;\n\t\t\tData[i - 1][13] = Duration;\n\t\t\tData[i - 1][14] = MaximumRate;\n\t\t\tData[i - 1][15] = Salary;\n\t\t\tData[i - 1][16] = CompanyJobID;\n\t\t\tData[i - 1][17] = Hot;\n\t\t\tData[i - 1][18] = Public;\n\t\t\tData[i - 1][19] = Description;\n\t\t\tData[i - 1][20] = InternalNotes;\n\t\t\tData[i - 1][21] = Questionnaire;\n\n\t\t}\n\t\treturn Data;\n\t}", "@Override\r\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tJSONObject json = new JSONObject();\r\n\t\t\t\ttry {\r\n\t\t\t\t\tjson.putOpt(\"productId\", \"1\");\r\n\t\t\t\t\tjson.putOpt(\"productName\", \"60元宝\");\r\n\t\t\t\t\tjson.putOpt(\"productDesc\", \"6元\");\r\n\t\t\t\t\tjson.putOpt(\"paramPrice\", \"6\");\r\n\t\t\t\t\tjson.putOpt(\"buyNum\", \"1\");\r\n\t\t\t\t\tjson.putOpt(\"coinNum\", \"1\");\r\n\t\t\t\t\tjson.putOpt(\"paramZoneId\", \"1\");\r\n\t\t\t\t\tjson.putOpt(\"serverName\", \"魔兽一区\");\r\n\t\t\t\t\tjson.putOpt(\"paramRoleId\", \"10\");\r\n\t\t\t\t\tjson.putOpt(\"roleName\", \"好人\");\r\n\t \t\tRandom r = new Random();\r\n\t \t\tint nextInt = r.nextInt(10000);\r\n\t\t\t\t\tjson.putOpt(\"paramBillNo\",\"9ca7d741-6000-4c68-a18f-\"+String.valueOf(nextInt));\r\n\t\t\t\t\tjson.putOpt(\"roleLevel\", \"1\");\r\n\t\t\t\t\tjson.putOpt(\"vip\", \"12\");\r\n\t\t\t\t\tjson.putOpt(\"userid\", \"312\");\r\n\t\t\t\t\t\r\n//\t\t\t\t\tpayBean.setUserId(\"2312312\");\r\n//\t\t\t\t\tpayBean.setExchangeRate(\"1\");\r\n//\t\t\t\t\tpayBean.setOrderPrice(\"1\");\r\n//\t\t\t\t\tpayBean.setOrderId(\"9ca7d741-6000-4c68-a18f-95cdfcffe08d\");\r\n//\t\t\t\t\tpayBean.setProductId(\"1\");\r\n//\t\t\t\t\tpayBean.setProductCount(\"35\");\r\n//\t\t\t\t\tpayBean.setOrderTitle(\"100元宝\");\r\n//\t\t\t\t\tpayBean.setRoleId(\"e904e50f0c049ebe2fa99ddb172354d6\");\r\n//\t\t\t\t\tpayBean.setRoleName(\"sadfdf\");\r\n//\t\t\t\t\tpayBean.setZoneId(\"1\");\r\n//\t\t\t\t\tpayBean.setPayCallBackUrl(\"http://lzzg.talkyun.com.cn/Orders/Pay/CallBack/360\");\r\n//\t\t\t\t\tpayBean.setAppName(\"我的三国\");\r\n//\t\t\t\t\tpayBean.setAppKey(\"27d7a59844aa83e97ca32f4db9d2b524\");\r\n//\t\t\t\t\tpayBean.setNoteOne(\"1\");\r\n//\t\t\t\t\tpayBean.setNoteTwo(\"\");\r\n//\t\t\t\t\tpayBean.setAppPrivateKey(\"c49d7aadc42eba752bd9410eaaabd30f\");\r\n//\t\t\t\t\tpayBean.setRoleLevel(\"1\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tpay(json.toString());\r\n\t\t\t\t} catch (JSONException e) {\r\n\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t\t// pay(payJson);\r\n\t\t\t}", "public void putAssetInvoiceDimensionColumnDetails(JSONObject params, JSONObject reqParams)throws ServiceException, JSONException{\n String companyId = params.optString(\"companyid\");\n int colnum = 0;\n HashMap fieldparams = new HashMap<>();\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_FixedAssets_AssetsGroups_ModuleId, \"Custom_\" + Constants.HSN_SACCODE));\n\n KwlReturnObject kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n List<FieldParams> fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n }\n reqParams.put(GSTRConstants.ASSET_HSNCOLUMN, colnum);\n params.put(GSTRConstants.ASSET_HSNCOLUMN, colnum);\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_FixedAssets_AssetsGroups_ModuleId, \"Custom_\" + Constants.GSTProdCategory));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n }\n reqParams.put(GSTRConstants.ASSET_TAXCLASSCOLUMN, colnum);\n params.put(GSTRConstants.ASSET_TAXCLASSCOLUMN, colnum);\n /*\n To get Unit Quantity Code column number asset Group\n */\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_FixedAssets_AssetsGroups_ModuleId, \"Custom_\" + Constants.GST_UNIT_QUANTITY_CODE));\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n }\n reqParams.put(GSTRConstants.ASSET_UQCCOLUMN, colnum);\n params.put(GSTRConstants.ASSET_UQCCOLUMN, colnum);\n /**\n * get State column no for asset Sales Invoice module\n */\n int colnumforstate = fieldManagerDAOobj.getColumnFromFieldParams(Constants.STATE, companyId, Constants.Acc_FixedAssets_DisposalInvoice_ModuleId, 0);\n reqParams.put(GSTRConstants.ASSET_STATE_SALES_COLUMN, colnumforstate);\n params.put(GSTRConstants.ASSET_STATE_SALES_COLUMN, colnumforstate);\n /**\n * get State column no for asset Purchase Invoice module\n */\n colnumforstate = fieldManagerDAOobj.getColumnFromFieldParams(Constants.STATE, companyId, Constants.Acc_FixedAssets_PurchaseInvoice_ModuleId, 0);\n reqParams.put(GSTRConstants.ASSET_STATE_PURCHASE_COLUMN, colnumforstate);\n params.put(GSTRConstants.ASSET_STATE_PURCHASE_COLUMN, colnumforstate);\n \n /**\n * Get Entity Value and its column no for asset Sales invoice\n */\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_FixedAssets_DisposalInvoice_ModuleId, \"Custom_\" + Constants.ENTITY));\n String fieldid = \"\";\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n String entityValue = params.optString(\"entity\");\n String ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n reqParams.put(GSTRConstants.ASSET_SALES_INVOICE_ENTITYCOLUMN, colnum);\n params.put(GSTRConstants.ASSET_SALES_INVOICE_ENTITYCOLUMN, colnum);\n reqParams.put(GSTRConstants.ASSET_SALES_INVOICE_ENTIYVALUE, ids);\n params.put(GSTRConstants.ASSET_SALES_INVOICE_ENTIYVALUE, ids);\n /**\n * Get Entity Value and its column no for asset Purchase invoice\n */\n fieldparams.put(Constants.filter_names, Arrays.asList(Constants.companyid, Constants.moduleid, \"fieldname\"));\n fieldparams.put(Constants.filter_values, Arrays.asList(companyId, Constants.Acc_FixedAssets_PurchaseInvoice_ModuleId, \"Custom_\" + Constants.ENTITY));\n fieldid = \"\";\n kwlReturnObjectGstCust = fieldManagerDAOobj.getFieldParams(fieldparams);\n fieldParamses = kwlReturnObjectGstCust.getEntityList();\n for (FieldParams fieldParams : fieldParamses) {\n colnum = fieldParams.getColnum();\n fieldid = fieldParams.getId();\n }\n entityValue = params.optString(\"entity\");\n ids = fieldManagerDAOobj.getIdsUsingParamsValueWithoutInsert(fieldid, entityValue);\n reqParams.put(GSTRConstants.ASSET_PURCHASE_INVOICE_ENTITYCOLUMN, colnum);\n params.put(GSTRConstants.ASSET_PURCHASE_INVOICE_ENTITYCOLUMN, colnum);\n reqParams.put(GSTRConstants.ASSET_PURCHASE_INVOICE_ENTIYVALUE, ids);\n params.put(GSTRConstants.ASSET_PURCHASE_INVOICE_ENTIYVALUE, ids);\n }", "public static void main(String[] args){\n int months = 48;\n double principal = 25000.0;\n double intrate = 3.85;\n PICalcJson myCalc = new PICalcJson();\n String result = myCalc.calculatePayment(months,principal,intrate);\n System.out.format(\"%s\", result);\n}", "private JSONObject getGSTR3B_Section_5_4_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isGSTINnull\", false);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Composition);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"itctype\", Constants.GST_ITCTYPE_DEFAULT+\",\"+Constants.GST_ITCTYPE_REVERSED);\n// reqParams.put(\"taxClassType\", FieldComboData.TaxClass_Percenatge);\n reqParams.put(\"excludetaxClassType\", true);\n JSONObject jSONObject = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n jSONObject = getGoodsReceiptForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n }\n\n /**\n * Vendor DN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isGSTINnull\", false);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Composition);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.remove(\"cnentityValue\");\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n\n }\n\n /**\n * Vendor CN\n *\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isGSTINnull\", false);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Composition);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"onlycnagainstvendor\", true);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_5_4);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "@Override\n\tpublic JSONObject getJSONObject() throws JSONException {\n\t\tJSONObject jsonObj = super.getJSONObject();\n\t\tif (this.isAudit){\n\t JSONDataUtil.put(jsonObj, COLUMN_RESULT_PRODUCT_ROW_ID, this.resultProductRowId); \n }else{\n JSONDataUtil.put(jsonObj, COLUMN_RESULT_PRODUCT_ROW_ID, this.productRowID); \n }\n\t\t\n\t\tJSONDataUtil.put(jsonObj, ATT_JOB_NO, this.jobNo);\n\t\tif (this.marketPriceID == 0){\n\t\t\tJSONDataUtil.put(jsonObj, COLUMN_MARKET_PRICE_ID, \"null\");//is null = empty\n\t\t}else{\n\t\t\tJSONDataUtil.put(jsonObj, COLUMN_MARKET_PRICE_ID, this.marketPriceID);\n\t\t}\n\t\t\n\t\tJSONDataUtil.put(jsonObj, \"godownId\", this.customerSurveySiteID);\n\t\t\n\t\t\n\t\t//JSONDataUtil.put(jsonObj, COLUMN_MARKET_PRICE,this.marketPrice);\n\t\t/*\n\t\t * skip \"productType\", \"itemNo\", \"productValueText\", \"jobRequestID\", \"productGroup\", \"productRowId\"\n\t\t * public final static String COLUMN_PRODUCT_TYPE = \"productType\";\n\t\t * public final static String COLUMN_ITEM_NO = \"itemNo\";\n\t\t public final static String COLUMN_PRODUCT_VALUE_TEXT = \"productValueText\";\n\t\t public final static String COLUMN_JOB_REQUEST_ID = \"jobRequestID\";\n\t\t public final static String COLUMN_PRODUCT_ROW_ID = \"productRowId\";\n\t\t public final static String COLUMN_PRODUCT_GROUP = \"productGroup\";\n\t\t */\n\t\tjsonObj.remove(COLUMN_JOB_NO);\n\t\tjsonObj.remove(COLUMN_PRODUCT_TYPE);\n\t\tjsonObj.remove(COLUMN_ITEM_NO);\n\t\tjsonObj.remove(COLUMN_PRODUCT_VALUE_TEXT);\n\t\tjsonObj.remove(COLUMN_JOB_REQUEST_ID);\n\t\tjsonObj.remove(COLUMN_PRODUCT_ROW_ID);\n\t\tjsonObj.remove(COLUMN_PRODUCT_GROUP);\n\n\t\treturn jsonObj;\n\t}", "public void apiPostValues(String title,String type,String Holdertype,String accno,String Balance ) throws IOException\n {\n Path path=Paths.get(\"src/test/resources/Body.json\");\n String json=new String(Files.readAllBytes(path));\n json=json.replace(\"titleArg\",title).replace(\"typeArge\",type).replace(\"HolderArge\", Holdertype).replace(\"AccountArg\",accno).replace(\"Balarge\", Balance);\n com.jayway.restassured.response.Response response= given().relaxedHTTPSValidation().when().body(json).post(\"http://18.222.188.206:3333/accounts\");\n response.then().assertThat().statusCode(201);\n response.prettyPrint();\n }", "public static Object[] getVehicleData(){\n String make, model;\n double price, fuelConsumption;\n int power, year;\n FuelType fuelType;\n\n System.out.println(\"\\n1. Car\\n2. Truck\");\n int res = ConsoleReader.getInt();\n System.out.print(\"\\nEnter make :\");\n ConsoleReader.getString();\n make = ConsoleReader.getString();\n System.out.print(\"Enter model :\");\n model = ConsoleReader.getString();\n System.out.print(\"Enter price($) :\");\n price = Double.parseDouble(ConsoleReader.getString());\n System.out.print(\"Enter fuelConsumption(l) :\");\n fuelConsumption = Double.parseDouble(ConsoleReader.getString());\n System.out.print(\"Enter power(kW) :\");\n power = ConsoleReader.getInt();\n System.out.print(\"Enter year :\");\n year = ConsoleReader.getInt();\n System.out.print(\"Enter fuelType :\\n\");\n\n FuelType[] fuelTypes = FuelType.values();\n for(int i = 0; i < fuelTypes.length; i++){\n System.out.print(\" \" + i + \". \" + fuelTypes[i].toString() + \"\\n\");\n }\n fuelType = FuelType.valueOf((fuelTypes[ConsoleReader.getInt()]).toString());\n\n if (res == 1){\n int seatCount, doorCount;\n BodyType bodyType;\n\n System.out.print(\"Enter seatCount :\");\n seatCount = ConsoleReader.getInt();\n System.out.print(\"Enter doorCount :\\n\");\n doorCount = ConsoleReader.getInt();\n\n BodyType[] bodyTypes = BodyType.values();\n for(int i = 0; i < bodyTypes.length; i++){\n System.out.print(\" \" + i + \". \" + bodyTypes[i].toString() + \"\\n\");\n }\n bodyType = BodyType.valueOf((bodyTypes[ConsoleReader.getInt()]).toString());\n\n return new Object[] {res, make, model, price, fuelConsumption,\n power, year, fuelType, seatCount, doorCount, bodyType};\n }else {\n int capacity;\n TruckCategory truckCategory;\n\n System.out.print(\"Enter capacity :\");\n capacity = ConsoleReader.getInt();\n\n TruckCategory[] truckCategories = TruckCategory.values();\n for (int i = 0; i < truckCategories.length; i++) {\n System.out.print(\" \" + i + \". \" + truckCategories[i].toString() + \"\\n\");\n }\n truckCategory = TruckCategory.valueOf((truckCategories[ConsoleReader.getInt()]).toString());\n\n return new Object[]{res, make, model, price, fuelConsumption,\n power, year, fuelType, capacity, truckCategory};\n }\n }", "public HSSFWorkbook exportGSTComputationDetails(JSONObject params) throws JSONException, ServiceException {\n String companyId = params.optString(\"companyid\");\n\n getEntityDataForRequestedModule(params);\n getColNumForRequestedModules(params);\n getLocalStateOfEntity(params);\n params.put(GSTR3BConstants.DETAILED_VIEW_REPORT, true);\n HSSFWorkbook wb = new HSSFWorkbook();\n JSONArray dataJArr = new JSONArray();\n\n JSONObject dataObj = getGSTComputation_Sales_Section_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_4.1\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_1, params);\n\n dataObj = getGSTComputation_Sales_Section_1_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_4.2\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_1_1, params);\n\n dataObj = getGSTComputation_Sales_Section_1_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_4.3\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_1_2, params);\n\n dataObj = getGSTComputation_Sales_Section_1_3(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_4.4\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_1_3, params);\n\n dataObj = getGSTComputation_Sales_Section_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_5.1\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_2, params);\n\n dataObj = getGSTComputation_Sales_Section_2_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_7.1\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_2_2, params);\n\n dataObj = getGSTComputation_Sales_Section_3(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_6.1\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_3, params);\n\n dataObj = getGSTComputation_Sales_Section_3_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_6.2\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_3_1, params);\n\n dataObj = getGSTComputation_Sales_Section_4(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_8.1\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_4, params);\n\n dataObj = getGSTComputation_Sales_Section_4_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_8.2\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_4_1, params);\n\n dataObj = getGSTComputation_Sales_Section_4_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_8.3\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_4_2, params);\n\n dataObj = getGSTComputation_Sales_Section_7(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_9.1\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7, params);\n\n dataObj = getGSTComputation_Sales_Section_7_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_9.2\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_1, params);\n\n dataObj = getGSTComputation_Sales_Section_7_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_9.3\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_2, params);\n\n dataObj = getGSTComputation_Sales_Section_7_3(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_9.4\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_3, params);\n\n dataObj = getGSTComputation_Sales_Section_7_4(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_9.5\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_4, params);\n\n dataObj = getGSTComputation_Sales_Section_7_5(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_9.6\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_7_5, params);\n\n dataObj = getGSTComputation_Sales_Section_8(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_9.7\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_8, params);\n\n dataObj = getGSTComputation_Sales_Section_9(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_11.1\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_9, params);\n\n dataObj = getGSTComputation_Sales_Section_9_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_11.2\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_9_1, params);\n\n dataObj = getGSTComputation_Sales_Section_9_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_11.3\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_9_2, params);\n\n dataObj = getGSTComputation_Sales_Section_10(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_11.4\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_10, params);\n\n dataObj = getGSTComputation_Sales_Section_10_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_11.5\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_10_1, params);\n\n dataObj = getGSTComputation_Sales_Section_10_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Sales_11.6\", GSTRConstants.GST_COMPUTATION_SECTION_SALES_10_2, params);\n\n dataObj = getGSTComputation_Purchase_Section_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.1\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_1, params);\n\n dataObj = getGSTComputation_Purchase_Section_1_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.2\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_1_1, params);\n\n dataObj = getGSTComputation_Purchase_Section_3(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.3\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_3, params);\n\n dataObj = getGSTComputation_Purchase_Section_3_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.4\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_3_1, params);\n\n dataObj = getGSTComputation_Purchase_Section_3_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.5\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_3_2, params);\n\n dataObj = getGSTComputation_Purchase_Section_4(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.6\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_4, params);\n\n dataObj = getGSTComputation_Purchase_Section_5(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.7\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_5, params);\n\n dataObj = getGSTComputation_Purchase_Section_11(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.12\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_11, params);\n\n dataObj = getGSTComputation_Purchase_Section_12(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.13\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_12, params);\n\n dataObj = getGSTComputation_Purchase_Section_11_10(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.15\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_11_10, params);\n\n dataObj = getGSTComputation_Purchase_Section_13_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_4.17\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_13_1, params);\n\n dataObj = getGSTComputation_Purchase_Section_6(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_5.1\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_6, params);\n\n dataObj = getGSTComputation_Purchase_Section_7(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_5.2\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_7, params);\n\n dataObj = getGSTComputation_Purchase_Section_7_1(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_5.3\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_7_1, params);\n\n dataObj = getGSTComputation_Purchase_Section_7_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_5.4\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_7_2, params);\n\n dataObj = getGSTComputation_Purchase_Section_2(params);\n dataJArr = dataObj.has(\"data\") ? dataObj.optJSONArray(\"data\") : new JSONArray();\n AccGSTReportServiceImpl.writeDataForGSTR3B(wb, dataJArr, \"Purchases_5.5\", GSTRConstants.GST_COMPUTATION_SECTION_PURCHASES_2, params);\n return wb;\n }", "@RequestMapping(path=\"/initPaymentGet\", method = RequestMethod.GET)//, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\n\tpublic ResponseEntity<Object> test() {\n\t\tlogger.info(\"Init payment\");\n\t\t//System.out.println(\"DTO: \" + btcDTO.getPrice_currency());\n\t\tString pom = \"\";\n\t\tRestTemplate restTemplate = new RestTemplate();\n\t\t\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.add(\"Authorization\", \"ab7fzPdN49-xBVoY_LdSifCZiVrqCbdcfjWdweJS\");\n\t\tResponseEntity<String> responseEntity = new RestTemplate().exchange(CREATE_ORDER_API, HttpMethod.GET,\n\t\t\t\tnew HttpEntity<String>(pom, headers), String.class);\n\n\t\t//restTemplate.getForEntity(\"https://google.rs\", String.class);\n\t\t//ResponseEntity<String> response = restTemplate.getForEntity(\"https://api-sandbox.coingate.com/v2/orders\", String.class);\n\t\t//ResponseEntity<String> response = restTemplate.postForEntity(\"https://api.coingate.com/v2/orders\", btcDTO, String.class);\n\t\t\n\t\treturn new ResponseEntity<Object>(responseEntity,HttpStatus.OK);\n\t}", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n if (requestCode == PayUmoneyFlowManager.REQUEST_CODE_PAYMENT && resultCode == RESULT_OK && data !=\n null) {\n TransactionResponse transactionResponse = data.getParcelableExtra(PayUmoneyFlowManager\n .INTENT_EXTRA_TRANSACTION_RESPONSE);\n\n ResultModel resultModel = data.getParcelableExtra(PayUmoneyFlowManager.ARG_RESULT);\n\n // Check which object is non-null\n if (transactionResponse != null && transactionResponse.getPayuResponse() != null) {\n if (transactionResponse.getTransactionStatus().equals(TransactionResponse.TransactionStatus.SUCCESSFUL)) {\n //Success Transaction\n AddPayment(name, ridequantity, Amount);\n } else {\n Intent intent = new Intent();\n setResult(RESULT_OK, intent);\n finish();\n\n }\n\n // Response from Payumoney\n// String payuResponse = transactionResponse.getPayuResponse();\n//\n//// Response from SURl and FURL\n// String merchantResponse = transactionResponse.getTransactionDetails();\n//\n// new AlertDialog.Builder(this)\n// .setCancelable(false)\n// .setMessage(\"Payu's Data : \" + payuResponse + \"\\n\\n\\n Merchant's Data: \" + merchantResponse)\n// .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {\n// public void onClick(DialogInterface dialog, int whichButton) {\n// dialog.dismiss();\n// }\n// }).show();\n\n } else if (resultModel != null && resultModel.getError() != null) {\n Log.d(TAG, \"Error response : \" + resultModel.getError().getTransactionResponse());\n } else {\n Log.d(TAG, \"Both objects are null!\");\n }\n }\n }", "private void parseObjectSubclass(JSONObject x) {\n //Get BalanceOperation Id\n int balanceId = Integer.parseInt((String) x.get(\"balanceId\"));\n //Get description\n String description = (String) x.get(\"description\");\n //Get money\n double money = Double.parseDouble((String) x.get(\"money\"));\n //Get date\n LocalDate date = LocalDate.parse((String) x.get(\"date\"));\n\n /*//based on the \"sub\" field, present only in JSON version of the object, instantiates different subclasses\n String sub = (String) x.get(\"sub\");*/\n if(description.equals(\"Order\")){\n\n String productCode = (String) x.get(\"productCode\");\n double pricePerUnit = Double.parseDouble((String) x.get(\"pricePerUnit\"));\n int quantity = Integer.parseInt((String) x.get(\"quantity\"));\n String status = (String) x.get(\"status\");\n\n //building order with the full constructor\n OrderImpl order = new OrderImpl(balanceId, description, money, date, productCode, quantity, pricePerUnit, status);\n //adding the loaded order back into the operationsMap checking for duplicates\n if(!this.operationsMap.containsKey(balanceId)){\n this.operationsMap.put(balanceId, order);\n if( status.equals(\"PAYED\") || status.equals(\"COMPLETED\")){this.changeBalance(money);}\n }\n }\n else if(description.equals(\"SaleTransaction\")){\n\n double discountRate = Double.parseDouble((String) x.get(\"discountRate\"));\n String status = (String) x.get(\"status\");\n //JSON array to iterate over TicketEntries \"entries\"\n JSONArray jEntries = (JSONArray) x.get(\"entries\");\n //loading TicketEntries list of the sale transaction\n List<TicketEntry> entries = new ArrayList<>();\n jEntries.forEach(e -> addEntry(entries, (JSONObject) e));\n\n //JSON array to iterate over RFIDS of sold products \"rfids\"\n JSONArray jRfids = (JSONArray) x.get(\"rfids\");\n if(jRfids==null){\n jRfids = new JSONArray();\n jRfids.clear();\n }\n //loading RIFDS list of the sale transaction\n ArrayList<ProductRfid> rfids = new ArrayList<>();\n jRfids.forEach(e -> addRfid(rfids, (JSONObject) e));\n\n //building saleTransaction with the full constructor\n SaleTransactionImplementation sale = new SaleTransactionImplementation(balanceId,description,money,date,discountRate,status,entries,rfids);\n //adding the sale transaction back into the operationsMap checking for duplicates\n if(!this.operationsMap.containsKey(balanceId)){\n this.operationsMap.put(balanceId, sale);\n if( status.equals(\"PAYED\") ){this.changeBalance(money);}\n }\n }\n else if(description.equals(\"ReturnTransaction\")){\n String status = (String) x.get(\"status\");\n Integer saleId = Integer.parseInt((String) x.get(\"saleId\"));\n //JSON array to iterate over TicketEntries \"entries\"\n double saleDiscount = Double.parseDouble((String) x.get(\"saleDiscount\"));\n JSONArray jEntries = (JSONArray) x.get(\"entries\");\n //loading TicketEntries list of the sale transaction\n List<TicketEntry> entries = new ArrayList<>();\n jEntries.forEach(e -> addEntry(entries, (JSONObject) e));\n\n //JSON array to iterate over RFIDS of sold products \"rfids\"\n JSONArray jRfids = (JSONArray) x.get(\"rfids\");\n if(jRfids==null){\n jRfids = new JSONArray();\n jRfids.clear();\n }\n //loading RIFDS list of the sale transaction\n ArrayList<ProductRfid> rfids = new ArrayList<>();\n jRfids.forEach(e -> addRfid(rfids, (JSONObject) e));\n\n //building returnTransaction with the full constructor\n ReturnTransaction retTrans = new ReturnTransaction(balanceId,description,money,date,saleId,status,entries,saleDiscount,rfids);\n //adding the Return Transaction back into the operationsMap checking for duplicates\n if(!this.operationsMap.containsKey(balanceId)){\n this.operationsMap.put(balanceId,retTrans);\n }\n }\n else if(description.equals(\"Credit\") || description.equals(\"Debit\")){\n //Simple Balance Update Operation (credit or debit)\n BalanceOperation operation = new BalanceOperationImpl(balanceId,description,money,date);\n //adding the operation (credit or debit) back into the operationsMap checking for duplicates\n if(!this.operationsMap.containsKey(balanceId)){\n this.operationsMap.put(balanceId, operation);\n this.changeBalance(money);\n }\n }\n\n\n }", "public JSONObject getGSTMisMatchReportSectionCombo() throws JSONException {\n JSONArray dataJArr = new JSONArray();\n JSONObject sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_HSNNotAvailable);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_UQCNotAvailable);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_GSTINBlank);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_GSTINnonBlank);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_GSTINInvalid);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_GSTRegistrationTypeblank);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_CustomerVendorTypeblank);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_RCMSalestoUnregisteredPerson);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_ProducttaxMismatch);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_StateMismatch);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_ManuallyenteredInvoiceNumber);\n dataJArr.put(sectionNameObj);\n sectionNameObj = new JSONObject();\n sectionNameObj.put(\"typeofinvoice\", GSTRConstants.Sec_GST_History_Not_Present);\n dataJArr.put(sectionNameObj);\n// sectionNameObj = new JSONObject();\n// sectionNameObj.put(\"typeofinvoice\", GSTRConstants.GSTMisMatch_SECTION_INVALIDCN);\n// dataJArr.put(sectionNameObj);\n return new JSONObject().put(\"data\", dataJArr);\n }", "public static void main(String[] args) {\n \n \n CuentaPatrimonioImpl cuentapatrimonio = new CuentaPatrimonioImpl();\n String CustomerNo=\"10124\";\n //11337\n //14086\n //10032\n //11337\n \n\n \n// jsonObjeto=fc01.FC01List2(CustomerNo);\n String cadena=cuentapatrimonio.ConsultaCuentasPatrimonio(CustomerNo);\n// System.out.println(str); \n \n// str2= fc01.FC01ACList(str);\n// System.out.println(str2); \n\n \n System.out.println(\"acá terminan la prueba : \" + new Date());\n System.out.println(cadena);\n \n \n \n }", "public void jsonPresentation () {\n System.out.println ( \"****** Json Data Module ******\" );\n ArrayList<Book> bookArrayList = new ArrayList<Book>();\n String jsonData = \"\";\n ObjectMapper mapper = new ObjectMapper();\n bookArrayList = new Request().postRequestBook();\n try {\n jsonData = mapper.writeValueAsString(bookArrayList);\n } catch (JsonProcessingException e) {\n System.out.println(\"Error: \"+ e);\n }\n System.out.println(jsonData);\n ClientEntry.showMenu ( );\n }", "public int processingContract(String json,List<Object[]> list);", "public JSONResponse set(HashMap<String, String> parameters) {\n\t\tString pos = parameters.get(\"pos\"); \t\t\t\t\t\t// the point of sale code.\n\t\tString reservationid = parameters.get(\"reservationid\");\t\t// the ID of the reservation.\n\t\tString arrivaltime = parameters.get(\"arrivaltime\"); \t\t// the email address of the payer.\n\t\tString departuretime = parameters.get(\"departuretime\"); \t// the departure time.\n\t\tString emailaddress = parameters.get(\"emailaddress\"); \t\t// the guest's emailaddress.\n\t\tString servicefrom = parameters.get(\"servicefrom\");\t\t\t// the preferred service time.\n\t\tString mobilephone = parameters.get(\"mobilephone\");\t\t\t// the guest's mobile phone number.\n\t\tString notes = parameters.get(\"notes\"); \t\t\t\t\t// the reservation notes.\n\t\tString termsaccepted = parameters.get(\"termsaccepted\");\t\t// reservation terms accepted\n\n\t\tif (pos == null || pos.isEmpty() || Model.decrypt(pos).length() > 10) {throw new ServiceException(Error.pos_invalid, pos);}\n\t\tif (reservationid == null || reservationid.isEmpty() || reservationid.length() > 10) {throw new ServiceException(Error.reservation_id, reservationid);}\n//\t\tif (emailaddress == null || emailaddress.isEmpty() || !Party.isEmailAddress(emailaddress)) {throw new ServiceException(Error.party_emailaddress, emailaddress);}\n\n\t\tSqlSession sqlSession = RazorServer.openSession();\n\t\tPayWidgetItem result = new PayWidgetItem();\n\t\ttry {\n\t\t\tParty agent = JSONService.getParty(sqlSession, pos);\n\t\t\tReservation reservation = sqlSession.getMapper(ReservationMapper.class).read(reservationid);\n//\t\t\tParty customer = sqlSession.getMapper(PartyMapper.class).read(reservation.getCustomerid());\n\t\t\treservation.setArrivaltime(arrivaltime);\n\t\t\treservation.setDeparturetime(departuretime);\n\t\t\treservation.setServicefrom(servicefrom);\n\t\t\treservation.setTermsaccepted(termsaccepted == null ? null : Boolean.valueOf(termsaccepted));\n\t\t\treservation.setNotes(notes);\n\t\t\tsqlSession.getMapper(ReservationMapper.class).update(reservation);\n\t\t\tMonitorService.update(sqlSession, Data.Origin.JQUERY, NameId.Type.Reservation, reservation);\n\t\t\tsqlSession.commit();\n\t\t}\n\t\tcatch (Throwable x) {\n\t\t\tsqlSession.rollback();\n\t\t\tresult.setId(null);\n\t\t\tresult.setName(null);\n\t\t\tresult.setState(RazorWidget.State.FAILURE.name());\n\t\t\tresult.setCurrency(Currency.Code.USD.name());\n\t\t\tresult.setMessage(x.getMessage());\n\t\t}\n\t\tfinally {sqlSession.close();}\n\t\treturn result;\n\t}", "private static void TestMetaQ() {\n\t\t\r\n\t\tJSONObject ployInfo = new JSONObject();\r\n//\t\tployInfo = JSONObject.fromObject(\"{'__OP_FLAG__': 'new','__TEMPLATE_ID__': 5800,'expDate': '2017-12-01 00:00:00','relOpers': [{'__OP_FLAG__': 'new','operId': '191000000004'},{'__OP_FLAG__': 'new','operId': '191000000016'}],'relRoles': {'__OP_FLAG__': 'new','roleName': '手机主角色','roleId': '181000000001'},'relRoles_roleName': '手机主角色','relFriendOffers': {'__OP_FLAG__': 'new','offerId': '0'},'relProds': [{'prodId': '390000050347','prodName': '充值送礼活动用户预存','optionType': '0','rowDataId': '0','__OP_FLAG__': 'new','relId': '0'}],'relRegions': [{'regionId': '1','regionName': 'RBOSS营业厅','saleStartTime': '','saleEndTime': '','rowDataId': '5','__OP_FLAG__': 'new','relId': '0'},{'regionId': '2','regionName': '网上营业厅','saleStartTime': '','saleEndTime': '','rowDataId': '6','__OP_FLAG__': 'new','relId': '0'},{'regionId': '18','regionName': '自助终端系统','saleStartTime': '20091231','saleEndTime': '20991231','rowDataId': '12','__OP_FLAG__': 'new','relId': '0'}], 'special': {'__OP_FLAG__': 'new','featureValue': '1001'}, 'name': '校园充值送(2017迎新篇)100元档测试','month': {'__OP_FLAG__': 'new','featureValue': '12'},'effDate': '2017-07-01 00:00:00','bootMessage': {'__OP_FLAG__': 'new','templateContent': ''},'comfirMes': {'__OP_FLAG__': 'new','templateContent': ''},'offerReport': {'__OP_FLAG__': 'new','rptType': '3','acctCode': '5505051','extendAttrB': '3520024','catalogId': '200000000021'},'ifIncludeComb': {'__OP_FLAG__': 'new','extendAttrF': '181000000001','relatProductItemIdName': '流量10元可选包(100M)','relatProductItemId': '350353001404','paramValueName': '移动数据10元档以上套餐','paramValue': '380000021335'},'relPromOfferVas': [],'BOUpOuterPloyH5': [],'': [],'outerSMSPloy': [],'relSKU': [],'BOUpOuterPloyComb': [],'prestoreDivideMoney': {'__OP_FLAG__': 'new','promoType': '1','allotAmount': '10000','allotModeValue': '3','prestoreFee': '10000','bookItemIdOut': '5505051','bookItemIdIn': '5024051','allotScaleName': '8|8|8|8|8|8|8|8|8|8|8|12|','allotScale': '800|800|800|800|800|800|800|800|800|800|800|1200|','divideMonth': '12','validDate': '2017-07-01 00:00:00','promoName': '校园充值送(2017迎新篇)100元档测试','allotBusiCode': '202014001','allotSmsType': '1','allotSmsExpr': '881 '},'deposit': {'__OP_FLAG__': 'new','feeAmount': '10000','prodName': '充值送礼活动用户预存100(元)','accCode': '5505051'},'desc': '校园充值送(2017迎新篇)100元档测试','renewOfferKind1': {'__OP_FLAG__': 'new','relKindName': '1','relKindId': '391000039503'},'renewOfferKind2': {'__OP_FLAG__': 'new','relKindId': '391000039503','relKindName': '1'},'punishFeeY': '100','catalogId': {'__OP_FLAG__': 'new','catalogName': '校园充值送(2017迎新篇)','catalogId': '200000000021','busiDesc': '活动内容:客户预存和包并承诺月最低消费及流量可选包(或为18元及以上档次4G套餐),即可获赠相应金额的和包。赠送和包一次性立即到账,预存和包分12个月返还。每个号码办理1次。','busiRuleDesc': '一、活动规则<br>(一)活动对象:<br>1、本活动仅向全球通、动感地带、神州行三大品牌客户开放(神州行易通卡和初始套装除外)。<br>2、本活动仅向上海移动1-5星客户开放,客户可发送CXXJ到10086查询客户星级。随e行品牌、和多号业务中的副号码、流量无限量套餐客户、新激活不超过6个自然月内的客户不能办理此类活动。<br>3、统付类-家庭畅享计划/和家庭副号码客户,需在主号码授权后方可参加此类活动。<br>4、客户办理此类活动时需状态有效、未停机。后付费客户需先结清所有账单,预付费客户需已激活入网。<br>5、此类活动需做好真实有效实名制登记后方可办理。个人客户凭本人有效真实身份证件原件,经办人凭机主有效身份证件原件和本人有效身份证原件办理;单位客户提供与客户名称一致的企业介绍信(加盖公章),经办人凭本人有效身份证原件,携带有效的企业单位营业执照副本原件办理。<br>6、已办理过充值送礼(含充值送话费、充值送和包电子券、充值送积分等)活动且尚未到期的客户不能办理本活动。<br>(二)办理次数:<br>同一个号码最多可参加1次本活动。<br>(三)预存话费返还与月个人最低消费规则:<br>1、活动办理成功后次月开始生效。预存话费从次月起分月返还,每月5日前到账,活动赠返话费均不能进行通信账户支付。<br>2、若客户通过话费支付方式参加活动,需在办理活动前10天内累计充值达到活动相应预存话费+5元,才可参加活动。客户只有自行预存的话费才可以作为活动预存款,赠返话费均不可作为活动预存款。<br>3、活动设定每月个人最低消费,若协议期内每月未满足当月个人最低消费,则按最低消费金额补足。账单中一级科目“代收费业务费用”不纳入月个人最低消费额度。如参加活动号码是家庭统付主号码,每月承诺的最低消费仅指主号码产生的费用,不包含统付成员费用。<br>4、如参与档次设定每月最低流量可选包档次,客户在协议期间每月使用不低于活动要求的流量可选包档次【18元及以上档次4G资费套餐无需开通】。参与活动时,若客户次月不满足最低流量可选包档次要求的,系统将自动为客户按最低流量可选包档次开通并于活动受理次月生效。协议期间,客户不可转入低档次的流量可选包。<br>5、其他承诺消费类活动的客户与本活动每月个人最低消费金额需叠加。<br>6、参加了家庭营销活动的家庭统付群组中的主、副号码若参加了个人营销活动,除个人需补足其个人营销活动的最低消费外,还需在家庭类活动的最低消费上叠加所有主副号码个人营销活动等额的最低消费对群组进行补足。<br>(四)赠送规则:<br>活动办理成功后,可立即获赠相应的和包电子券。本活动赠送的和包电子券自发放之日起90天内有效,过期不补。和包电子券不可回退、不可转赠、不可转让、不能兑现。<br>(五)其他规则:<br>1、活动成功受理后默认开通手机支付功能(免费)、和生活普通会员(免费)、移动杉德卡(优惠期内免费)。<br>2、此类活动办理后,不可回退,不可变更档次。活动预存话费不可退费,不可资金转移。协议期内,客户不可办理过户、销户、停机保号等业务。<br>3、如办理客户当前品牌具有有效期,则受理后将根据预存金额一次性延长有效期,后续返还话费不再增加有效期。<br>4、如办理客户为家庭统付活动(如畅享计划、和家庭等)的副号码,在家庭统付期间,获赠话费暂无法使用。客户如需使用,可通过“家庭统付副号码话费转赠”业务,每月开账时由系统根据副号码当月实际开账金额,将账户余额中可用于抵扣当月消费的部分结转至主号码账户。<br>5、如参加活动号码是家庭统付主号码,每月承诺的最低消费仅指主号码产生的费用,不包含统付成员费用。<br>'},'relProds4': {'__OP_FLAG__': 'new','prodName': '补足28元','extendName': '补足28元','extendId': '41000043'},'monthFee': {'__OP_FLAG__': 'new','featureValue': '2800'},'directFee': {'__OP_FLAG__': 'new','feeAmount': '10000','prodName': '承诺消费系列活动抵扣预存100(元)'},'__OBJECT_ID__': 20000,'preFeeRuleComb': {'__OP_FLAG__': 'new','paramValue': 100,'effDate': '2017-04-01','expDate': '2099-12-31'},'offerId': 111000307276,'alphaName': 'XYCZS(2017YXP)100YDCS','prestoreExtendId': 12060,'noPrepayBack': '0','type': 'OFFER_PLOY','trademark': '0','offerPlanType': '5','offerType': 'OFFER_PLOY','prodSpecId': '171000000001','isGlobal': '0','smsTamplateChoose': '1'}\");\r\n\t\tployInfo = JSONObject.fromObject(\"{'__OP_FLAG__': 'new','prodSpecId': '171000000001','prodSpecName': 'GSM产品规格','busiType': '1','relRegions': [{'regionId': '0','rowDataId': '0','__OP_FLAG__': 'new','relId': '0'}],'relPlanGroup': { '__OP_FLAG__': 'new','tagName': '后付费4G流量卡','tagId': '130006'},'name': '后付费流量至尊套餐288元档','offerType': 'OFFER_PLAN','payType': '0','tradeMark': '161000000012','offerPlanType': '1','effDate': '2018-01-01 00:00:00','expDate': '2099-12-31 00:00:00','relSameNameProd': {'__OP_FLAG__': 'new','isMain': '0','extendIdName': '后付费流量至尊套餐288元档','extendId': '82700004','upProdItemObject': {'__OP_FLAG__': 'new','type': 'SRVC_SINGLE'},'upPlanProdRel': {'__OP_FLAG__': 'new','extendF': '181000000001'},'relService': {'__OP_FLAG__': 'new','offerGroupId': '270000050001','relType': 'SRVC_SINGLE_PRICE_SERVICE'},'upItemFeature': {'__OP_FLAG__': 'new','featureId': '10000017','featureValue': '1'}},'BossType': {'__OP_FLAG__': 'new','featureValue': '1'},'preOpenLever': {'__OP_FLAG__': 'new','featureValue': '1'},'relRoles': {'__OP_FLAG__': 'new','roleName': '手机主角色','roleId': '181000000001','isMainRole': '1'},'desc': '后付费流量至尊套餐288元档介绍','pointPlan': {'__OP_FLAG__': 'new','featureValue': '1'},'__TEMPLATE_ID__': 666,'relCatalogInfo': [{'catalogId': '250000000003','catalogName': '基本套餐','rowDataId': '1','__OP_FLAG__': 'new','relId': '0'},{'catalogId': '950641000308','catalogName': '基本策划','baseCatalogFlag': '策划销售目录','rowDataId': '2','__OP_FLAG__': 'new','relId': '0'},{'catalogId': '950500000012','catalogName': '个人套餐','rowDataId': '3','__OP_FLAG__': 'new','relId': '0'},{'catalogId': '950641000110','catalogName': '4G套餐','baseCatalogFlag': '策划销售目录','rowDataId': '4','__OP_FLAG__': 'new','relId': '0'},{'catalogId': '950641000111','catalogName': '4G套餐','baseCatalogFlag': '策划销售目录','rowDataId': '5','__OP_FLAG__': 'new','relId': '0'},{'catalogId': '950641000112','catalogName': '4G套餐','baseCatalogFlag': '策划销售目录','rowDataId': '6','__OP_FLAG__': 'new','relId': '0'},{'catalogId': '950641000113','catalogName': '4G套餐','baseCatalogFlag': '策划销售目录','rowDataId': '7','__OP_FLAG__': 'new','relId': '0'}],'refOfferTemp': {'__OP_FLAG__': 'new','isRefOffer': '1','refOfferId': '390000020081','refCondition': '191000000003'},'refOfferName': '后付费4G飞享套餐58元档','entityId': 111000303477,'bootMessage': {'__OP_FLAG__': 'new','templateContent': '入'},'relProds': [{'prodId': '310014001001','prodName': '移动IP17951电话','optionType': '0','rowDataId': '0','__OP_FLAG__': 'new','relId': '0'},{'prodId': '310090106001','prodName': '呼叫等待','optionType': '2','rowDataId': '1','__OP_FLAG__': 'new','relId': '0'},{'prodId': '310090112001','prodName': '国内呼叫转移','optionType': '1','rowDataId': '2','__OP_FLAG__': 'new','relId': '0'},{'prodId': '310090113001','prodName': '国内长话','optionType': '0','rowDataId': '3','__OP_FLAG__': 'new','relId': '0'},{'prodId': '310090116001','prodName': '国内漫游','optionType': '0','rowDataId': '4','__OP_FLAG__': 'new','relId': '0'}],'relOpers': [],'relOffers': [{'offerType': '增值策划','prodSpecName': 'GSM产品规格','relOfferId': '350315001001','relOfferName': 'WLAN标准资费','relType': 'OFFER_PLAN_INCLUDE_OFFER_PLAN','includeType': '1','autoDiscountProdId': '','autoDiscountProdIdName': '','rowDataId': '0','__OP_FLAG__': 'new','relId': '0'},{'offerType': '增值策划','prodSpecName': 'GSM产品规格','relOfferId': '350350005001','relOfferName': '点对点短信息','relType': 'OFFER_PLAN_INCLUDE_OFFER_PLAN','includeType': '1','autoDiscountProdId': '','autoDiscountProdIdName': '','rowDataId': '1','__OP_FLAG__': 'new','relId': '0'},{'offerType': '增值策划','prodSpecName': 'GSM产品规格','relOfferId': '350353001001','relOfferName': '移动数据标准资费','relType': 'OFFER_PLAN_INCLUDE_OFFER_PLAN','includeType': '1','autoDiscountProdId': '','autoDiscountProdIdName': '','rowDataId': '2','__OP_FLAG__': 'new','relId': '0'},{'offerType': '增值策划','prodSpecName': 'GSM产品规格','relOfferId': '350390103001','relOfferName': '主叫显示','relType': 'OFFER_PLAN_INCLUDE_OFFER_PLAN','includeType': '1','autoDiscountProdId': '','autoDiscountProdIdName': '','rowDataId': '3','__OP_FLAG__': 'new','relId': '0'},{'offerType': '增值策划','prodSpecName': 'GSM产品规格','relOfferId': '350390208001','relOfferName': '直拨长途一费制','relType': 'OFFER_PLAN_INCLUDE_OFFER_PLAN','includeType': '0','autoDiscountProdId': '','autoDiscountProdIdName': '','rowDataId': '4','__OP_FLAG__': 'new','relId': '0'},{'offerType': '增值策划','prodSpecName': 'GSM产品规格','relOfferId': '390000000092','relOfferName': '移动数据资费(0.29元/M,满60元1G)','relType': 'OFFER_PLAN_INCLUDE_OFFER_PLAN','includeType': '0','autoDiscountProdId': '','autoDiscountProdIdName': '','rowDataId': '5','__OP_FLAG__': 'new','relId': '0'}],'preStoreLevel': [],'relSKU': [],'relChgOffers': [],'relChgOffersIn': [],'relKinds': [],'upOuterPloy': [],'relNewRpt': {'__OP_FLAG__': 'new','rptType': '6','extendAttrA': '卡类'},'privilege': {'__OP_FLAG__': 'new','privId': '90000003'},'extendName': '后付费流量至尊套餐288元档','extendId': '22000003','__OBJECT_ID__': 10000,'offerId': 111000303477,'alphaName': 'HFFLLZZTC288YD','type': 'OFFER_PLAN'}\");\r\n//\t\t\r\n\t\t\r\n\t\tString offerId = null;\r\n\t\tString buss_name = null;\r\n\t\tString main_business_id = null;\r\n\t\t//资费\r\n\t\tString saleStartTime = null; //上架时间\r\n\t\tString saleEndTime = null; //下架时间\r\n\t\tString tagName = null;\t//大类名称\r\n\t\tString tagId = null;\t//大类分组\r\n\t\tString bussdesp = null; //业务介绍\r\n\t\t\r\n\t\tofferId = ployInfo.get(\"offerId\").toString();\r\n\t\tbuss_name = ployInfo.get(\"name\").toString();\r\n\t\t\r\n\t\tbussdesp = ployInfo.get(\"desc\").toString();\r\n\t\t\r\n\t\tif(ployInfo.containsKey(\"relPlanGroup\")){ //大类分组\r\n\t\t\tJSONObject relPlanGroup = ployInfo.getJSONObject(\"relPlanGroup\");\r\n\t\t\ttagName = relPlanGroup.get(\"tagName\").toString();\r\n\t\t\ttagId = relPlanGroup.get(\"tagId\").toString();\r\n\t\t\tif(\"130001\".equals(tagId)){\t\t\t//预付费4G飞享套餐\r\n\t\t\t\tmain_business_id = \"165\";\r\n\t\t\t}else if(\"130002\".equals(tagId)){\t//后付费4G飞享套餐\r\n\t\t\t\tmain_business_id = \"166\";\r\n\t\t\t}else if(\"130003\".equals(tagId)){\t//预付费4G无线上网套餐\r\n\t\t\t\tmain_business_id = \"173\";\r\n\t\t\t}else if(\"130004\".equals(tagId)){\t//后付费4G无线上网套餐\r\n\t\t\t\tmain_business_id = \"174\";\r\n\t\t\t}else if(\"130005\".equals(tagId)){\t//预付费4G流量卡\r\n\t\t\t\tmain_business_id = \"178\";\r\n\t\t\t}else if(\"130006\".equals(tagId)){\t//后付费4G流量卡\r\n\t\t\t\tmain_business_id = \"179\";\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(ployInfo.containsKey(\"relRegions\")){ //渠道信息,上下架时间\r\n\t\t\tJSONArray relRegions = ployInfo.getJSONArray(\"relRegions\");\r\n\t\t\tfor(int i = 0; i<relRegions.size(); i++){\r\n\t\t\t\tJSONObject term = relRegions.getJSONObject(i);\r\n\t\t\t\tif(\"18\".equals(term.get(\"regionId\"))){ //18-自助终端\r\n\t\t\t\t\tsaleStartTime = term.get(\"saleStartTime\").toString();\r\n\t\t\t\t\tsaleEndTime = term.get(\"saleEndTime\").toString();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tSimpleDateFormat formatter = new SimpleDateFormat (\"yyyy-MM-dd hh:mm:ss\"); \r\n\t\tString ctime = formatter.format(new Date()); //当前时间\r\n\t\tSystem.out.println(\"当前时间 ---- \" + ctime);\r\n\t\t\r\n\t\tSystem.out.println(\"业务ID = \" + offerId);\r\n\t\tSystem.out.println(\"业务名称 = \" + buss_name);\r\n\t\tSystem.out.println(\"上架时间 = \" + saleStartTime);\r\n\t\tSystem.out.println(\"下架时间 = \" + saleEndTime);\r\n\t\tSystem.out.println(\"业务描述 = \" + bussdesp);\r\n\t\tSystem.out.println(\"大类名称 = \" + tagName);\r\n\t\tSystem.out.println(\"大类分组 = \" + tagId);\r\n\t\tSystem.out.println(\"父类ID = \" + main_business_id);\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "private String convertToJson(InputStream uploadedInputStream,\n\t\tString uploadedFileLocation){\n\t\tWorkbook workbook = null;\n\t\ttry {\n\t\t\tworkbook = WorkbookFactory.create( uploadedInputStream );\n\t\t} catch (InvalidFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t// Get the first Sheet.\n\t\tSheet sheet = workbook.getSheetAt( 0 );\n\n\t\t // Start constructing JSON.\n\t\t JSONObject json = new JSONObject();\n\n\t\t // Iterate through the rows.\n\t\t JSONArray rows = new JSONArray();\n\t\t for ( Iterator<Row> rowsIT = sheet.rowIterator(); rowsIT.hasNext(); )\n\t\t {\n\t\t Row row = rowsIT.next();\n\t\t JSONObject jRow = new JSONObject();\n\n\t\t // Iterate through the cells.\n\t\t JSONArray cells = new JSONArray();\n\t\t for ( Iterator<Cell> cellsIT = row.cellIterator(); cellsIT.hasNext(); )\n\t\t {\n\t\t Cell cell = cellsIT.next();\n\t\t cells.put( cell.getStringCellValue() );\n\t\t }\n\t\t try {\n\t\t\t\t\tjRow.put( \"cell\", cells );\n\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t rows.put( jRow );\n\t\t }\n\n\t\t // Create the JSON.\n\t\t try {\n\t\t\t\tjson.put( \"rows\", rows );\n\t\t\t} catch (JSONException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t// Get the JSON text.\n\t\treturn json.toString();\n\t}", "@PostMapping(\"/goAlipay\")\n public JsonResult goAlipay(@RequestBody PayBo payMsg){\n System.out.println(\"go into goToPayOrder \"+\"payMsg \"+payMsg);\n String form = null;\n try{\n form = AliPayUtils.generateAliPayTradePagePayRequestForm(payMsg.getOrderId(), \"沙箱支付学习\", Double.parseDouble(payMsg.getTotalAmount()));\n return JsonResult.isOk(form);\n }catch (Exception e){\n e.printStackTrace();\n throw new RuntimeException(\"系统异常,获取支付码失败!\");\n }\n }", "@Override\n\tpublic JSONObject insertFuliao(String jsonStr) throws Exception {\n\t\ttry {\n\t\t\t JSONObject allData = JSONObject.fromObject(jsonStr);\n\t\t\t String shop_name = allData.getString(\"shop_name\");\n\t\t\t String accepter = allData.getString(\"person\");\n\t\t\t String date = String.format(\"%tF\",new Date());\n\t\t\t GetSecMaterials getSecMaterials = new GetSecMaterials();\n\t\t\t getSecMaterials.setShop_name(shop_name);\n\t\t\t getSecMaterials.setApply_data(date);\n\t\t\t getSecMaterials.setApplyer(accepter);\n\t\t\t getSecMaterials.setIs_apply(0);\n\t\t\t getSecMaterials.setIs_approve(0);\n\t\t\t getSecMaterials.setIs_pushed(0);\n\t\t\t getSecMaterials.setIs_return(0);\n\t\t\t fuliaoMapper.insertFuliao(getSecMaterials);\n\t\t\t JSONArray jsonArray = allData.getJSONArray(\"detail\");\n\t\t\t List<GetSecDetail> getSecDetails = new ArrayList<>();\n\t\t\t for(int i=0;i<jsonArray.size();i++) {\n\t\t\t\t JSONObject jsonObject = jsonArray.getJSONObject(i);\n\t\t\t\t GetSecDetail getSecDetail = new GetSecDetail();\n\t\t\t\t getSecDetail.setGet_materials_id(getSecMaterials.getGet_materials_id());\n\t\t\t\t getSecDetail.setReshop_name(shop_name);\n\t\t\t\t getSecDetail.setSec_material_no(jsonObject.getString(\"fuliao_no\"));\n\t\t\t\t getSecDetail.setSec_material_name(jsonObject.getString(\"fuliao_name\"));\n\t\t\t\t getSecDetail.setType(jsonObject.getString(\"type\"));\n\t\t\t\t getSecDetail.setUnit(jsonObject.getString(\"unit\"));\n\t\t\t\t getSecDetail.setNum(jsonObject.getString(\"num\"));\n\t\t\t\t getSecDetail.setIs_return(0);\n\t\t\t\t getSecDetails.add(getSecDetail);\n\t\t\t }\n\t\t\t GetSecDetailVo getSecDetailVo = new GetSecDetailVo();\n\t\t\t getSecDetailVo.setGet_sec_details(getSecDetails);\n\t\t\t fuliaoMapper.insertFuliaoDetail(getSecDetails);\n\t\t\t JSONObject is_ok = new JSONObject();\n\t \t\t is_ok.put(\"is_ok\", \"1\");\n\t \t\t return is_ok;\n\t\t }catch(Exception e) {\n\t\t\t e.printStackTrace();\n\t\t\t TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\n\t\t\t JSONObject is_ok = new JSONObject();\n\t \t\t is_ok.put(\"is_ok\", \"0\");\n\t \t\t return is_ok;\n\t\t }\n\t}", "private void taxBalancePayment(Integer taxNo) throws UnsupportedEncodingException {\n mTaxBalancePayment.clear();\n waitingDialog = new SpotsDialog(Shared_AssessmentSearch.this);\n waitingDialog.show();\n String REQUEST_TAG = \"taxBalancePayment\";\n\n String district = URLEncoder.encode(etDistrict.getText().toString(), \"UTF-8\");\n String panchayat = URLEncoder.encode(etPanchayat.getText().toString(), \"UTF-8\");\n if (mIntent_Type.equalsIgnoreCase(\"Profession\"))\n url = API_TAXBALANCEPAYMENTDETAILS + \"Type=PRSearch&\" + \"TaxNo=\" + taxNo + \"&FinYear=\" + medt_finanicalyear.getText().toString() + \"&District=\" + district + \"&Panchayat=\" + panchayat + \"\";\n else if (mIntent_Type.equalsIgnoreCase(\"NonTax\"))\n url = API_TAXBALANCEPAYMENTDETAILS + \"Type=NSearch&\" + \"TaxNo=\" + taxNo + \"&FinYear=\" + medt_finanicalyear.getText().toString() + \"&District=\" + district + \"&Panchayat=\" + panchayat + \"\";\n\n Log.e(TAG, url);\n JsonObjectRequest api_taxBalancePayment_Request = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n try {\n Log.e(TAG, response.toString());\n\n\n String recordsetsarray = response.getString(\"recordsets\");\n if (!recordsetsarray.equals(\"[[],[]]\")) {\n\n JSONArray jsonArray = new JSONArray(recordsetsarray);\n\n for (int i = 0; i < jsonArray.length(); i++) {\n\n JSONArray insideJsonArray = jsonArray.getJSONArray(i);\n\n if (insideJsonArray.length() > 0 && i == 0) {\n JSONObject json_userdetails = insideJsonArray.getJSONObject(0);\n String Name = json_userdetails.getString(\"Name\");\n String DoorNo = json_userdetails.getString(\"DoorNo\");\n String WardNo = json_userdetails.getString(\"WardNo\");\n String StreetName = json_userdetails.getString(\"StreetName\");\n\n mtextView_User_Name.setText(Name);\n\n mtextView_UserStreetNo.setText(StreetName);\n\n mtextView_UserDoorNo.setText(DoorNo);\n\n mtextView_UserWardNo.setText(WardNo);\n\n Log.e(TAG, \"Name===>\" + Name);\n\n } else if (insideJsonArray.length() > 0) {\n\n for (int j = 0; j < insideJsonArray.length(); j++) {\n JSONObject json_taxdetails = insideJsonArray.getJSONObject(j);\n\n volley_TaxNO = json_taxdetails.getString(\"TaxNo\");\n volley_financialyear = json_taxdetails.getString(\"FinancialYear\");\n\n volley_Balance = String.valueOf(json_taxdetails.getInt(\"Balance\"));\n\n if (mIntent_Type.equalsIgnoreCase(\"NonTax\"))\n volley_HalfYear = String.valueOf(json_taxdetails.getInt(\"Month\"));\n else\n volley_HalfYear = String.valueOf(json_taxdetails.getInt(\"HalfYear\"));\n\n mTaxBalancePayment.add(new BalanceHistory(etDistrict.getText().toString(), etPanchayat.getText().toString(), volley_TaxNO, volley_financialyear, volley_HalfYear, volley_Balance, mIntent_Type));\n\n mLinear_Userdata.setVisibility(View.VISIBLE);\n }\n\n prof_assessmentAdapter = new Prof_Assessment_Search_Adapter(Shared_AssessmentSearch.this, mTaxBalancePayment);\n\n recyclerView.setAdapter(prof_assessmentAdapter);\n\n prof_assessmentAdapter.notifyDataSetChanged();\n\n } else {\n mLinear_Userdata.setVisibility(View.GONE);\n// Snackbar.make(rootlayout, \"No Data found\", Snackbar.LENGTH_SHORT).show();\n mTaxBalancePayment.clear();\n// prof_assessmentAdapter.notifyDataSetChanged();\n }\n }\n }\n else {\n mLinear_Userdata.setVisibility(View.GONE);\n Snackbar.make(rootlayout, \"No Data found\", Snackbar.LENGTH_SHORT).show();\n mTaxBalancePayment.clear();\n// prof_assessmentAdapter.notifyDataSetChanged();\n }\n waitingDialog.dismiss();\n\n } catch (JSONException e) {\n e.printStackTrace();\n\n Snackbar.make(rootlayout, \"error\" + e.getMessage(), Snackbar.LENGTH_SHORT).show();\n Log.e(TAG, e.getMessage());\n waitingDialog.dismiss();\n }\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n VolleyLog.e(TAG, \"Error: \" + error.getMessage());\n Log.e(TAG, error.toString());\n\n waitingDialog.dismiss();\n if (error instanceof TimeoutError || error instanceof NoConnectionError) {\n\n SnackShowTop(\"Time out\", rootlayout);\n\n } else if (error instanceof AuthFailureError) {\n\n SnackShowTop(\"Connection Time out\", rootlayout);\n\n } else if (error instanceof ServerError) {\n\n SnackShowTop(\"Could not connect server\", rootlayout);\n\n } else if (error instanceof NetworkError) {\n\n SnackShowTop(\"Please check the internet connection\", rootlayout);\n\n } else if (error instanceof ParseError) {\n\n SnackShowTop(\"Parse Error\", rootlayout);\n\n } else {\n\n SnackShowTop(error.getMessage(), rootlayout);\n }\n }\n }) {\n @Override\n public Map<String, String> getHeaders() {\n Map<String, String> params = new HashMap<String, String>();\n params.put(\"accesstoken\", ACCESS_TOKEN);\n return params;\n }\n };\n AppSingleton.getInstance(getApplicationContext()).addToRequestQueue(api_taxBalancePayment_Request, REQUEST_TAG);\n\n }", "public static void main(String[] args) {\n\t\ttry {\n\t\t\tInputStream in = new FileInputStream(\"D:\\\\tmp/testforjson.xlsx\");\n\t XSSFWorkbook workbook = new XSSFWorkbook(in);\n\t XSSFSheet sheet = workbook.getSheetAt(0);\n\t\t\t\n\t\t\tString json = readJsonData(\"C:\\\\Users\\\\Administrator\\\\Desktop\\\\China.json\");\n\t JSONObject jsonObject = JSONObject.parseObject(json);\n\t //获取到国家及下面所有的信息 开始循环插入,这里可以写成递归调用,但是不如这样方便查看、理解\n\t JSONArray countryAll = jsonObject.getJSONArray(\"districts\");\n\t int tag = 1;\n\t for (int i = 0; i < countryAll.size(); i++) {\n\t JSONObject countryLeve0 = countryAll.getJSONObject(i);\n\t String citycode0 = countryLeve0.getString(\"citycode\");\n\t String adcode0 = countryLeve0.getString(\"adcode\");\n\t String name0 = countryLeve0.getString(\"name\");\n\t String center0 = countryLeve0.getString(\"center\");\n\t String country = countryLeve0.getString(\"level\");\n\t int level = 0;\n\t if (country.equals(\"country\")) {\n\t level = 0;\n\t }\n\t //插入国家\n sheet.getRow(tag).createCell(0).setCellValue(name0);\n\t System.out.println(tag);\n\t JSONArray province0 = countryLeve0.getJSONArray(\"districts\");\n\n\t for (int j = 0; j < province0.size(); j++) {\n\t JSONObject province1 = province0.getJSONObject(j);\n\t String citycode1 = province1.getString(\"citycode\");\n\t String adcode1 = province1.getString(\"adcode\");\n\t String name1 = province1.getString(\"name\");\n\t String center1 = province1.getString(\"center\");\n\t String province = province1.getString(\"level\");\n\t int level1 = 0;\n\t if (province.equals(\"province\")) {\n\t level1 = 1;\n\t }\n\t int tag4city = 1;\n\t tag++;\n\t //插入省\n sheet.getRow(tag).createCell(1).setCellValue(name1);\n\t System.out.println(tag);\n\t JSONArray city0 = province1.getJSONArray(\"districts\");\n\n\t for (int z = 0; z < city0.size(); z++) {\n\t JSONObject city2 = city0.getJSONObject(z);\n\t String citycode2 = city2.getString(\"citycode\");\n\t String adcode2 = city2.getString(\"adcode\");\n\t String name2 = city2.getString(\"name\");\n\t String center2 = city2.getString(\"center\");\n\t String city = city2.getString(\"level\");\n\t int level2 = 0;\n\t if (city.equals(\"city\")) {\n\t level2 = 2;\n\t }\n\t int tag4street = 1;\n\t tag++;\n\t //插入市\n\t sheet.getRow(tag).createCell(2).setCellValue(name2);\n\t //sheet.getRow(tag).createCell(1).setCellValue(name1);\n\t //sheet.getRow(tag).createCell(4).setCellValue(tag4city);\n\t System.out.println(tag);\n\t tag4city++;\n\n\t JSONArray street0 = city2.getJSONArray(\"districts\");\n\t for (int w = 0; w < street0.size(); w++) {\n\t JSONObject street3 = street0.getJSONObject(w);\n\t String citycode3 = street3.getString(\"citycode\");\n\t String adcode3 = street3.getString(\"adcode\");\n\t String name3 = street3.getString(\"name\");\n\t String center3 = street3.getString(\"center\");\n\t String street = street3.getString(\"level\");\n\t int level3 = 0;\n\t if (street.equals(\"street\")) {\n\t level3 = 2;\n\t }\n\t tag++;\n\t //插入区县\n\t //sheet.getRow(tag).createCell(1).setCellValue(name1);\n\t //sheet.getRow(tag).createCell(2).setCellValue(name2);\n\t sheet.getRow(tag).createCell(3).setCellValue(name3);\n\t //sheet.getRow(tag).createCell(4).setCellValue(tag4street);\n\t tag4street++;\n\t System.out.println(tag);\t // JSONArray street = street3.getJSONArray(\"districts\");\n\t //有需要可以继续向下遍历\n\n\t }\n\n\t }\n\t }\n\t tag++;\n\t }\n\t OutputStream out = new FileOutputStream(\"D:\\\\tmp\\\\testforjson.xlsx\");\n\t \tworkbook.write(out);\n\t out.close();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void addProductApi() throws JSONException {\n\n JSONObject header = new JSONObject();\n JSONObject params = new JSONObject();\n params.put(\"uuid\", AppCustomPreferenceClass.readString(Sell_Buy_Practice_Activity.this, AppCustomPreferenceClass.UserId, \"\"));\n params.put(\"category_id\", \"2\");\n params.put(\"practice_category\", categoryId);\n\n\n if (Category_name.equalsIgnoreCase(\"Others\")) {\n\n params.put(\"speciality\", \"others_speciality\");\n params.put(\"others_speciality_name\", edit_others.getText().toString());\n } else {\n params.put(\"speciality\", medicalSplId);\n params.put(\"others_speciality_name\", \"\");\n }\n if (Type.equalsIgnoreCase(\"Others\")) {\n params.put(\"practice_type\", \"others_practice\");\n params.put(\"others_practice_name\", edit_others_type.getText().toString());\n } else {\n params.put(\"practice_type\", prac_Id);\n params.put(\"others_practice_name\", \"\");\n }\n //params.put(\"practice_category\", categoryId);\n params.put(\"quantity\", edit_qty.getText().toString());\n if (AddressStr.equalsIgnoreCase(\"\")) {\n params.put(\"city\", city_id);\n params.put(\"country\", country_id);\n params.put(\"state\", state_id);\n\n// params.put(\"city\", \"\");\n// params.put(\"country\", \"\");\n// params.put(\"state\", \"\");\n params.put(\"address\", edit_street.getText().toString());\n } else {\n geoLocate();\n params.put(\"address\", AddressStr);\n params.put(\"city\", city_id);\n params.put(\"country\", country_id);\n params.put(\"state\", state_id);\n }\n params.put(\"contact_phone\", edit_contact_ph.getText().toString());\n params.put(\"contact_email\", edit_cont_email.getText().toString());\n params.put(\"house_street\", edit_street.getText().toString());\n params.put(\"practice_name\", edit_name.getText().toString());\n params.put(\"rooms\", edit_rooms.getText().toString());\n params.put(\"specific_locality\", edit_loc.getText().toString());\n params.put(\"practice_city_name\", \"\");\n params.put(\"land_length\", area_length.getText().toString());\n params.put(\"land_width\", area_width.getText().toString());\n params.put(\"total_area\", edit_tot_area.getText().toString());\n params.put(\"build_up_area\", edit_built_up_area.getText().toString() + \" \" + \"square\" + FeetTyp);\n params.put(\"price\", edit_price.getText().toString());\n params.put(\"description\", ed_status.getText().toString());\n //params.put(\"product_image\", profile_image);\n\n if (multipleImagesAl.size() == 0)\n params.put(\"product_image\", \"\");\n else\n params.put(\"product_image\", multipleImagesAl.toString().substring(1, multipleImagesAl.toString().length() - 1).replace(\" \", \"\"));\n\n params.put(\"latitude\", addressLat);\n params.put(\"longitude\", addressLog);\n\n\n header.put(\"Cynapse\", params);\n\n new AddPracticeProductApi(Sell_Buy_Practice_Activity.this, header) {\n @Override\n public void responseApi(JSONObject response) {\n super.responseApi(response);\n\n try {\n JSONObject header = response.getJSONObject(\"Cynapse\");\n String res_msg = header.getString(\"res_msg\");\n String res_code = header.getString(\"res_code\");\n\n if (res_code.equals(\"1\")) {\n final Dialog dialog = new Dialog(Sell_Buy_Practice_Activity.this);\n dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);\n dialog.setContentView(R.layout.dialog_msg_alert);\n //TODO: used to make the background transparent\n Window window = dialog.getWindow();\n window.setLayout(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.MATCH_PARENT);\n dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));\n //TODO : initializing different views for the dialog\n TextView title = dialog.findViewById(R.id.title);\n TextView msg = dialog.findViewById(R.id.msg);\n ImageView close = dialog.findViewById(R.id.close);\n Button btnGotIt = dialog.findViewById(R.id.btnGotIt);\n //TODO :setting different views\n// title.setText(R.string.congrats);\n// msg.setText(R.string.publishedSuccessfully);\n title.setText(R.string.sent);\n\n if (categoryId.equalsIgnoreCase(\"1\")) {\n msg.setText(R.string.buy_req);\n } else if (categoryId.equalsIgnoreCase(\"2\")) {\n msg.setText(R.string.sell_req);\n\n } else {\n msg.setText(R.string.lease_req);\n }\n //msg.setText(R.string.request_sent);\n dialog.show();\n //TODO : dismiss the on btn click and close click\n btnGotIt.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n dialog.dismiss();\n //TODO : finishing the activity\n finish();\n }\n });\n close.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n dialog.dismiss();\n finish();\n }\n });\n// MyToast.toastLong(Sell_Buy_Practice_Activity.this, res_msg);\n// finish();\n } else {\n MyToast.toastLong(Sell_Buy_Practice_Activity.this, res_msg);\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void errorApi(VolleyError error) {\n super.errorApi(error);\n }\n };\n }", "private HashMap getTableRow(int rowNum)\r\n {\r\n HashMap hashRow = new HashMap() ;\r\n int colTotal = codeTableModel.getColumnCount()-1;\r\n for (int colCount=0; colCount <= codeTableModel.getColumnCount()-1; colCount++)\r\n { // for each column u will build a hashmap\r\n// if (colCount == 1 )\r\n// {//sponsor name is not in update sp.\r\n// continue;\r\n// }\r\n TableColumn column = codeTableColumnModel.getColumn(colCount) ;\r\n ColumnBean columnBean = (ColumnBean)column.getIdentifier() ;\r\n Object val = null ;\r\n // the whole idea of setting up the columnBean as the identifier is that u get to know\r\n // all abt the structure details of the column, so u can create appropriate type of object\r\n // and stick it in to the hashMap\r\n if (columnBean.getDataType().equals(\"NUMBER\"))\r\n {\r\n if (codeTableModel.getValueAt(sorter.getIndexForRow(rowNum),colCount) == null\r\n ||(codeTableModel.getValueAt(sorter.getIndexForRow(rowNum),colCount).equals(\"\")))\r\n {\r\n val = null ; //new Integer(0)\r\n }\r\n else\r\n {\r\n val = codeTableModel.getValueAt(sorter.getIndexForRow(rowNum),colCount);\r\n if (val instanceof ComboBoxBean)\r\n {\r\n if (((ComboBoxBean)val).getCode().equals(\"\"))// user deleted selection\r\n val = null;\r\n else\r\n val = new Integer(((ComboBoxBean)val).getCode().toString());\r\n }\r\n else\r\n {\r\n val = new Integer(val.toString()) ;\r\n }\r\n }\r\n }\r\n\r\n if (columnBean.getDataType().equals(\"VARCHAR2\"))\r\n {\r\n if (codeTableModel.getValueAt(sorter.getIndexForRow(rowNum),colCount)==null)\r\n {\r\n val = \"\";\r\n }\r\n else\r\n {\r\n val = codeTableModel.getValueAt(sorter.getIndexForRow(rowNum),colCount).toString() ;\r\n }\r\n }\r\n\r\n if (columnBean.getDataType().equals(\"DATE\"))\r\n {\r\n //coeusdev-568 start\r\n //Date today = new Date();\r\n //coeusdev-568 end\r\n if (codeTableModel.getValueAt(sorter.getIndexForRow(rowNum), codeTableModel.getColumnCount()-1).equals(\"I\")) // if itz an insert\r\n { //AV_ & AW_ will be the same for insert\r\n //coeusdev-568 start\r\n //val = new java.sql.Timestamp(today.getTime());\r\n val = CoeusUtils.getDBTimeStamp();\r\n //coeusdev-568 end\r\n }\r\n else\r\n { // for update\r\n // there will be only two dates in any table one AV_UPDATE_TIMESTAMP and the other one AW_UPDATE_TIMESTAMP\r\n if (columnBean.getQualifier().equals(\"VALUE\"))\r\n { //AV_...\r\n //coeusdev-568 start\r\n //val = new java.sql.Timestamp(today.getTime());\r\n val = CoeusUtils.getDBTimeStamp();\r\n //coeusdev-568 end\r\n }\r\n else\r\n { //AW_...\r\n val = java.sql.Timestamp.valueOf(codeTableModel.getValueAt(sorter.getIndexForRow(rowNum),colCount).toString()) ;\r\n }\r\n }\r\n }\r\n\r\n hashRow.put(columnBean.getColIdentifier(), val) ;\r\n } //end for\r\n return hashRow;\r\n }", "public QuotationDTO getQuotationInformation() throws BusinessException {\n\t\tString temp = null;\n\t\tif (null == quotationDTO)\n\t\t\tquotationDTO = new QuotationDTO();\n\n\t\t//Booking Type\n\t\tquotationDTO.setInward(isInwardType());\t\t\n\n\t\t//Minimum Freight Value\n\t\ttemp = txtMinCF.getText();\n\t\tif (temp.length() > 0) {\n\t\t\tquotationDTO.setMinFreightValue(Float.parseFloat(temp));\n\t\t}\n\n\t\t//Minimum Weight value\n\t\ttemp = txtMinCW.getText();\n\t\tif (temp.length() > 0) {\n\t\t\tquotationDTO.setMinWeightValue(Float.parseFloat(temp));\n\t\t}\n\n\t\t//LR Charge Type\n\t\tquotationDTO.setLrchargeType(getLRChargeIndex());\n\n\t\t//Service Tax\n\t\tif (chkServiceTax.getSelection()) {\n\t\t\tquotationDTO.setServiceTax(true);\n\t\t}else{\n\t\t\tquotationDTO.setServiceTax(false);\n\t\t}\n\n\t\t// GSC Type\n\t\tquotationDTO.setGscType(getGSCIndex());\n\n\t\t//Other Charges\t\t\n\t\tif (quotationDTO.getLrchargeType() == 1 || quotationDTO.getGscType() == 1){\n\t\t\t\n\t\t\totherChargesDTO = getOtherCharges();\t\t\t\n\t\t\t\n\t\t\tif(otherChargesDTO != null){\n\t\t\t\t//System.out.println(\"others on set==>\"+otherChargesDTO.length);\n\t\t\t\tif(quotationDTO.getLrchargeType() != 1){\n\t\t\t\t\totherChargesDTO = deInitializeLRC(otherChargesDTO);\n\t\t\t\t}else if(quotationDTO.getGscType() != 1){\n\t\t\t\t\totherChargesDTO = deInitializeGSC(otherChargesDTO);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tquotationDTO.setOtherCharges(otherChargesDTO);\n\t\t}\n\t\t\t\n\n\t\t//Insurance Type\t\t\n\t\tquotationDTO.setInsuranceChargeType(getInsuranceType());\n\t\t\n\n\t\t//Insurance Charges\n\t\tif (quotationDTO.getInsuranceChargeType() == 1){\n\t\t\tquotationDTO.setInsuranceCharges(insuranceDTO);\t\t\t\n\t\t}\n\t\t\t\n\t\t// DHC\n\t\tquotationDTO.setDhcChargeType(getDHCType());\n\t\t\n\t\tif(quotationDTO.getDhcChargeType() == 1){\n\t\t\tquotationDTO.setDhcDto(dhcDto);\n\t\t}\n\n\t\t//Quotation Details\n\t\tquotationDTO.setQuotationDetails(getQuotationDetails());\n\t\t\n\t\t//Basic Price Index\n\t\ttemp = txtPriceIndex.getText();\n\t\tif (temp.length() > 0) {\n\t\t\tquotationDTO.setPriceIndex(Float.parseFloat(temp));\n\t\t}\n\n\t\t//Round off digits\n\t\ttemp = txtRoundOffDigits.getText();\n\t\tif (temp.length() > 0) {\n\t\t\tquotationDTO.setRoundOffDigits(Integer.parseInt(temp));\n\t\t}\t\t\n\t\t\n\t\treturn quotationDTO;\n\t}", "private void getExcelData21ZV() throws Exception {\n\t\tlistHeader = new ArrayList<ExcelPromotionHeader>();\n\t\tlistDetail = new ArrayList<ExcelPromotionDetail>();\n\t\tlistUnit = new ArrayList<ExcelPromotionUnit>();\n\t\tmapHeader = new HashMap<String, ExcelPromotionHeader>();\n\t\tmapUnit = new HashMap<String, ExcelPromotionUnit>();\n\t\tmapErrorPromotion = new HashMap<String, String>();\n\t\tmapType = new HashMap<String, String>();\n\t\tmapPromotionMua = new HashMap<String, ListGroupMua>();\n\t\tmapPromotionKM = new HashMap<String, ListGroupKM>();\n\t\tmapMuaKM = new MapMuaKM();\n\t\tmapPromotionTypeCheck = new HashMap<String, String>();\n\t\tlstHeaderError = new ArrayList<CellBean>();\n\t\tlstDetailError = new ArrayList<CellBean>();\n\t\tlistUnitError = new ArrayList<CellBean>();\n\t\tMap<String, Integer> mapCheckHeaderDuplicate = new HashMap<String, Integer>();\n\t\tMap<String, String> mapCheckType = apParamMgr.getMapPromotionType();\n\t\tWorkbook myWorkBook = null;\n\t\tInputStream is = new FileInputStream(excelFile);\n\t\tint MAX_ARRAY = 10000;\n\t\tfinal int NUM_SHEETS = 2;\n\n\t\tif (!is.markSupported()) {\n\t\t\tis = new PushbackInputStream(is, 8);\n\t\t}\n\t\tif (POIFSFileSystem.hasPOIFSHeader(is)) {\n\t\t\tmyWorkBook = new HSSFWorkbook(is);\n\t\t} else if (POIXMLDocument.hasOOXMLHeader(is)) {\n\t\t\tmyWorkBook = new XSSFWorkbook(OPCPackage.open(is));\n\t\t}\n\t\tif (myWorkBook != null) {\n\t\t\tif (myWorkBook.getNumberOfSheets() < NUM_SHEETS) {\n\t\t\t\tthrow new Exception(ERR_NUM_SHEET);\n\t\t\t}\n\t\t\tSheet headerSheet = myWorkBook.getSheetAt(0);\n\t\t\tSheet detailSheet = myWorkBook.getSheetAt(1);\n\t\t\tSheet unitSheet = myWorkBook.getSheetAt(2);\n\t\t\tint iRun = 0;\n\t\t\ttotalItem = 0;\n\t\t\tint maxSizeSheet1 = 12;\n\t\t\tif (headerSheet != null) {\n\t\t\t\tIterator<?> rowIter = headerSheet.rowIterator();\n\t\t\t\twhile (rowIter.hasNext()) {\n\t\t\t\t\tRow myRow = (Row) rowIter.next();\n\t\t\t\t\tif (iRun == 0) {\n\t\t\t\t\t\tiRun++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tboolean isContinue = true;\n\t\t\t\t\t//Kiem tra su hop le cua Row Import\n\t\t\t\t\tfor (int i = 0; i < maxSizeSheet1; i++) {\n\t\t\t\t\t\tif (myRow.getCell(i) != null && !StringUtil.isNullOrEmpty(getCellValueToString(myRow.getCell(i)))) {\n\t\t\t\t\t\t\tisContinue = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (isContinue) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tExcelPromotionHeader header = new ExcelPromotionHeader();\n\t\t\t\t\tCellBean errRow = new CellBean();\n\t\t\t\t\tString messageError = \"\";\n\t\t\t\t\ttotalItem++;\n\t\t\t\t\t//0\tget promotionCode\n\t\t\t\t\tString promotionCode = \"\";\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellPromotionCode = myRow.getCell(0);\n\t\t\t\t\t\tif (cellPromotionCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tpromotionCode = cellPromotionCode.getStringCellValue();\n\t\t\t\t\t\t\t//\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tpromotionCode = String.valueOf(cellPromotionCode.getNumericCellValue());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpromotionCode = getCellValueToString(cellPromotionCode);\n\t\t\t\t\t\t\tpromotionCode = promotionCode != null ? promotionCode.toUpperCase().trim() : \"\";\n\t\t\t\t\t\t\theader.promotionCode = promotionCode;\n\t\t\t\t\t\t\terrRow.setContent1(promotionCode);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(promotionCode)) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Mã CTKM\");\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += ValidateUtil.validateField(promotionCode, \"catalog.promotion.import.column.progcode\", 50, ConstantManager.ERR_REQUIRE, ConstantManager.ERR_MAX_LENGTH, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_CODE);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (mapCheckHeaderDuplicate.get(promotionCode) != null) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"promotion.product.import.duplicate\", mapCheckHeaderDuplicate.get(promotionCode));\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmapCheckHeaderDuplicate.put(promotionCode, myRow.getRowNum());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tPromotionProgram existPromotion = promotionProgramMgr.getPromotionProgramByCode(promotionCode);\n\t\t\t\t\t\t\tif (existPromotion != null && !ActiveType.WAITING.equals(existPromotion.getStatus())) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.program.exists\");\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.get.promotion.error\", promotionCode);\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t//\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"ProgCode\");\n\t\t\t\t\t}\n\t\t\t\t\t//1\tget description\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellDescription = myRow.getCell(1);\n\t\t\t\t\t\tif (cellDescription != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString description = getCellValueToString(cellDescription);\n\t\t\t\t\t\t\theader.description = description;\n\t\t\t\t\t\t\terrRow.setContent2(description);\n\t\t\t\t\t\t\tmessageError += ValidateUtil.validateField(description, \"catalog.promotion.import.column.progpescr\", 100, ConstantManager.ERR_REQUIRE, ConstantManager.ERR_MAX_LENGTH, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_NAME);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"ProgDescr\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//2\tget release\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (myRow.getCell(2) != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\terrRow.setContent3(getCellValueToString(myRow.getCell(2)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Release\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//3\tget promotion type\n\t\t\t\t\tString type = null;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellPromotionType = myRow.getCell(3);\n\t\t\t\t\t\tif (cellPromotionType != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\ttype = getCellValueToString(cellPromotionType);\n\t\t\t\t\t\t\ttype = type != null ? type.toUpperCase().trim() : \"\";\n\t\t\t\t\t\t\theader.type = type;\n\t\t\t\t\t\t\terrRow.setContent4(type);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(type)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.required\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.type\"));\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (mapCheckType.get(type) == null) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.exists.before\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.type\"));\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmapType.put(header.promotionCode, type);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"ConditionTypeCode\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//4 get format\n\t\t\t\t\t//try {\n\t\t\t\t\t//\tCell cellFormat = myRow.getCell(4);\n\t\t\t\t\t//\tif (cellFormat != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t//\t\tString format = cellFormat.getStringCellValue();\n\t\t\t\t\t//\t\theader.format = format;\n\t\t\t\t\t//\t\terrRow.setContent5(format);\n\t\t\t\t\t//\t}\n\t\t\t\t\t//} catch (Exception e) {\n\t\t\t\t\t//\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"User1\");\n\t\t\t\t\t//}\n\t\t\t\t\t//4 get fromDate\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellFromDate = myRow.getCell(4);\n\t\t\t\t\t\tif (cellFromDate != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tif (cellFromDate.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDate.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellFromDate.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\tif (cellFromDate.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellFromDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\tString __fromDate = DateUtil.toDateString(cellFromDate.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\tDate fromDate = DateUtil.toDate(__fromDate, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\theader.fromDate = fromDate;\n\t\t\t\t\t\t\t\t\terrRow.setContent5(__fromDate);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.required\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (cellFromDate.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDate.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellFromDate.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\tif (cellFromDate.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellFromDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\tString __fromDate = DateUtil.toDateString(cellFromDate.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\tDate fromDate = DateUtil.toDate(__fromDate, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\theader.fromDate = fromDate;\n\t\t\t\t\t\t\t\t\terrRow.setContent5(__fromDate);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.required\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(cellFromDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tString __fromDate = cellFromDate.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(__fromDate)) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent5(__fromDate);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tDate fromDate = DateUtil.toDate(__fromDate, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\theader.fromDate = fromDate;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent5(__fromDate);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\terrRow.setContent5(cellFromDate.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.required\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"FromDate\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//5 get toDate\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellToDate = myRow.getCell(5);\n\t\t\t\t\t\tif (cellToDate != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tif (cellToDate.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDate.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellToDate.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\tif (cellToDate.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellToDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\tString __toDate = DateUtil.toDateString(cellToDate.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(__toDate, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\theader.toDate = toDate;\n\t\t\t\t\t\t\t\t\terrRow.setContent6(__toDate);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (cellToDate.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDate.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellToDate.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\tif (cellToDate.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellToDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\tString __toDate = DateUtil.toDateString(cellToDate.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(__toDate, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\theader.toDate = toDate;\n\t\t\t\t\t\t\t\t\terrRow.setContent6(__toDate);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellToDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tString __toDate = cellToDate.getStringCellValue();\n\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(__toDate)) {\n\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay\"));\n\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\terrRow.setContent6(__toDate);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(__toDate, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.toDate = toDate;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent6(__toDate);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\terrRow.setContent6(cellToDate.getStringCellValue());\n\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (header.fromDate != null && header.toDate != null) {\n\t\t\t\t\t\t\tif (DateUtil.compareDateWithoutTime(header.fromDate, header.toDate) > 0) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.greater.todate\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"ToDate\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\n\t\t\t\t\t//6 Số thông báo CTKM\n\t\t\t\t\t/*\n\t\t\t\t\t * String description =\n\t\t\t\t\t * getCellValueToString(cellDescription); header.description\n\t\t\t\t\t * = description; errRow.setContent2(description);\n\t\t\t\t\t * messageError += ValidateUtil.validateField(description,\n\t\t\t\t\t * \"catalog.promotion.import.column.progpescr\", 100,\n\t\t\t\t\t * ConstantManager.ERR_REQUIRE,\n\t\t\t\t\t * ConstantManager.ERR_MAX_LENGTH,\n\t\t\t\t\t * ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_NAME);\n\t\t\t\t\t */\n\t\t\t\t\t\n\t\t\t\t\t/*errMsg = ValidateUtil.validateField(promotionName, \"catalog.promotion.name\", 500, ConstantManager.ERR_REQUIRE, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL, ConstantManager.ERR_MAX_LENGTH);\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(errMsg)) {\n\t\t\t\t\t\terrMsg = ValidateUtil.validateField(description, \"common.description\", null, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL);\n\t\t\t\t\t}*/\n\t\t\t\t\t\n\t\t\t\t\t// 6 Số thông báo\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellNoticeCode = myRow.getCell(6);\n\t\t\t\t\t\tif (cellNoticeCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString noticeCode = getCellValueToString(cellNoticeCode);\n\t\t\t\t\t\t\tif(noticeCode != null){\n\t\t\t\t\t\t\t\tnoticeCode = noticeCode.trim();\n\t\t\t\t\t\t\t\tnoticeCode = noticeCode.toUpperCase();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmessageError = ValidateUtil.validateField(noticeCode, \"catalog.promotion.noticecode\", 100, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL);\n\t\t\t\t\t\t\t/*if(noticeCode.length() > 100){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.notice.code.over.length\")+\"\\n\";\n\t\t\t\t\t\t\t}else*/ \n\t\t\t\t\t\t\tif(StringUtil.isNullOrEmpty(noticeCode)) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.notice.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t}else if(noticeCode != null && noticeCode.trim().length() > 100){\n\t\t\t\t\t\t\t\t//messageError += R.getResource(\"catalog.promotion.import.notice.code.incorrect.format\");\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"100\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Số thông báo\");\n\t\t\t\t\t\t\t}else if(StringUtil.isNullOrEmpty(messageError)){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\theader.noticeCode = noticeCode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent7(noticeCode);\n\t\t\t\t\t\t}else if (cellNoticeCode == null) {\n\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.notice.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t} \n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.string\", iRun, \"NoticeCode\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 7 Nhóm/Tên SP hàng bán\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellDesProduct = myRow.getCell(7);\n\t\t\t\t\t\tif (cellDesProduct != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString descProduct = getCellValueToString(cellDesProduct);\n\t\t\t\t\t\t\tif(descProduct != null){\n\t\t\t\t\t\t\t\tdescProduct = descProduct.trim();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//descProduct = descProduct.trim();\n\t\t\t\t\t\t\tmessageError = ValidateUtil.validateField(descProduct, \"catalog.promotion.descriptionproduct\", 1000, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL);\n\t\t\t\t\t\t\t/*if(descProduct.length() > 1000){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.desc.product.over.length\")+\"\\n\";\n\t\t\t\t\t\t\t}else*/ \n\t\t\t\t\t\t\tif(StringUtil.isNullOrEmpty(descProduct)) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.description.product.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t}else if(descProduct.trim().length() > 1000){\n\t\t\t\t\t\t\t\t//messageError += R.getResource(\"catalog.promotion.import.description.product.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"1000\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Nhóm/Tên SP hàng bán\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if(StringUtil.isNullOrEmpty(messageError)){\n\t\t\t\t\t\t\t\tdescProduct = descProduct.trim();\n\t\t\t\t\t\t\t\theader.decriptionProduct = descProduct;\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\terrRow.setContent8(descProduct);\n\t\t\t\t\t\t}else if(cellDesProduct == null) {\n\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.description.product.obligate\") + \"\\n\";\n\t\t\t\t\t\t} \n\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.string\", iRun, \"DescProduct\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\n\t\t\t\t\t// 8 Mô tả chương trình\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellDescription = myRow.getCell(8);\n\t\t\t\t\t\tif (cellDescription != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString description = getCellValueToString(cellDescription);\n\t\t\t\t\t\t\tif(description != null){\n\t\t\t\t\t\t\t\tdescription = description.trim();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(description != null && description.trim().length() > 1000){\n\t\t\t\t\t\t\t\t//messageError += R.getResource(\"catalog.promotion.import.description.program.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t\t//messageError += R.getResource(\"\", iRun, \"Description\");\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"1000\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Mô tả chương trình\");\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tdescription = description.trim();\n\t\t\t\t\t\t\t\theader.descriptionProgram = description;\n\t\t\t\t\t\t\t\terrRow.setContent9(description);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*else if(cellDescription != null){\n\t\t\t\t\t\t\tString description = getCellValueToString(cellDescription);\n\t\t\t\t\t\t\terrRow.setContent9(description);\n\t\t\t\t\t\t}*/\n\t\t\t\t\t\t\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.string\", iRun, \"Description\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//9 Bội số\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellMultiple = myRow.getCell(9);\n\t\t\t\t\t\theader.multiple = 0; \n\t\t\t\t\t\tif (cellMultiple != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString multiple = getCellValueToString(cellMultiple);\n\t\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_PROMO_ALLOW_MULTIPLE\", ApParamType.LIST_PROMO_ALLOW_MULTIPLE);\n\t\t\t\t\t\t\tString strListPromo = apParam != null?apParam.getValue() : \"ZV02,ZV03,ZV05,ZV06,ZV08,ZV09,ZV11,ZV12,ZV13,ZV14,ZV15,ZV16,ZV17,ZV18,ZV20,ZV21,ZV23,ZV24\";\n\t\t\t\t\t\t\tif ((Constant.IS_MULTIPLE.equals(multiple) || Constant.NON_MULTIPLE.equals(multiple)) \n\t\t\t\t\t\t\t\t\t&& strListPromo != null) {\n\t\t\t\t\t\t\t\tstrListPromo = strListPromo.replace(\" \", \"\");\n\t\t\t\t\t\t\t\tstrListPromo = strListPromo.toUpperCase();\n\t\t\t\t\t\t\t\tString[] ListPromoAllow = strListPromo.split(\",\");\n\t\t\t\t\t\t\t\tif (Constant.IS_MULTIPLE.equals(multiple) \n\t\t\t\t\t\t\t\t\t &&\t!Arrays.asList(ListPromoAllow).contains(header.type.toUpperCase())) {\n\t\t\t\t\t\t\t\t\tSystem.out.println(header.type.toUpperCase());\n\t\t\t\t\t\t\t\t\tSystem.out.println(strListPromo);\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.multiple.not.use\") + \"\\n\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\theader.multiple = Integer.parseInt(multiple.trim());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.multiple.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent10(multiple);\n\t\t\t\t\t\t}/*else if(cellMultiple != null){\n\t\t\t\t\t\t\tString multiple = getCellValueToString(cellMultiple);\n\t\t\t\t\t\t\terrRow.setContent10(multiple);\n\t\t\t\t\t\t}*/\n\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Multiple\", \"['','X']\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 10 Tối ưu\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellRecursive = myRow.getCell(10);\n\t\t\t\t\t\theader.recursive = 0;\n\t\t\t\t\t\tif (cellRecursive != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString recursive = getCellValueToString(cellRecursive);\n\t\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_PROMO_ALLOW_RECURSIVE\", ApParamType.LIST_PROMO_ALLOW_RECURSIVE);\n\t\t\t\t\t\t\tString strListPromo = apParam == null? \"ZV02,ZV03,ZV05,ZV06,ZV08,ZV09,ZV11,ZV12,ZV13,ZV14,ZV15,ZV16,ZV17,ZV18,ZV20,ZV21,ZV23,ZV24\":apParam.getValue();\n\t\t\t\t\t\t\tif ((Constant.IS_RECURSIVE.equals(recursive) || Constant.NON_RECURSIVE.equals(recursive)) \n\t\t\t\t\t\t\t\t\t&& strListPromo != null) {\n\t\t\t\t\t\t\t\tstrListPromo = strListPromo.replace(\" \", \"\");\n\t\t\t\t\t\t\t\tString[] listPromoAllow = strListPromo.split(\",\");\n\t\t\t\t\t\t\t\tif (Constant.IS_RECURSIVE.equals(recursive)\t\t\t\n\t\t\t\t\t\t\t\t\t &&\t!Arrays.asList(listPromoAllow).contains(header.type.toUpperCase())) {\n\t\t\t\t\t\t\t\t/*\tSystem.out.println(header.type.toUpperCase());\n\t\t\t\t\t\t\t\t\tSystem.out.println(strListPromo);*/\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.recursive.not.use\") + \"\\n\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\theader.recursive = Integer.parseInt(recursive.trim());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.recursive.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent11(recursive);\n\t\t\t\t\t\t}/*else if(cellRecursive != null){\n\t\t\t\t\t\t\tString recursive = getCellValueToString(cellRecursive);\n\t\t\t\t\t\t\terrRow.setContent11(recursive);\n\t\t\t\t\t\t}*/\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Recursive\", \"['','X']\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 9 Loại trả thưởng\n\t\t\t\t/*\ttry {\n\t\t\t\t\t\tCell cellRewardType = myRow.getCell(9);\n\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_ALLOW_REWARD_TYPE\", ApParamType.LIST_ALLOW_REWARD_TYPE);\n\t\t\t\t\t\tString strListAllowReward = apParam.getApParamName();\n\t\t\t\t\t\tstrListAllowReward = strListAllowReward.replace(\" \", \"\");\n\t\t\t\t\t\tString[] listAllowReward = strListAllowReward.split(\",\");\n\t\t\t\t\t\tif (cellRewardType != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString strRewardType = getCellValueToString(cellRewardType);\n\t\t\t\t\t\t\tif (strRewardType != null \n\t\t\t\t\t\t\t\t\t&& (Constant.DISCOUNT_MONEY.equals(strRewardType) || Constant.VOUCHER.equals(strRewardType)) \n\t\t\t\t\t\t\t\t\t&& Arrays.asList(listAllowReward).contains(header.type)) {\n\t\t\t\t\t\t\t\theader.rewardType = Integer.parseInt(strRewardType.trim());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent10(strRewardType);\n\t\t\t\t\t\t}else if(cellRewardType != null){\n\t\t\t\t\t\t\tString strRewardType = getCellValueToString(cellRewardType);\n\t\t\t\t\t\t\terrRow.setContent10(strRewardType);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.number\", iRun, \"RewardType\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 10 Từ ngày trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellFromDateReward = myRow.getCell(10);\n\t\t\t\t\t\tif (Constant.VOUCHER.equals(header.rewardType+\"\")) {\n\t\t\t\t\t\t\tif (cellFromDateReward != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tif (cellFromDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDateReward.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellFromDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\tif (cellFromDateReward.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\tString _fromDateReward = DateUtil.toDateString(cellFromDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t\t\t\t} else if (cellFromDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDateReward.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellFromDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\t\tif (cellFromDateReward.getDateCellValue() != null || StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\t\tString _fromDateReward = DateUtil.toDateString(cellFromDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tString _fromDateReward = cellFromDateReward.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(_fromDateReward)) {\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent11(cellFromDateReward.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif(header.fromApplyDate != null && header.fromDate != null){\n\t\t\t\t\t\t\t\t\t\tint sub = DateUtil.compareDateWithoutTime(header.fromDate,header.fromApplyDate);\n\t\t\t\t\t\t\t\t\t\tif(DateUtil.compareDateWithoutTime(header.fromDate,header.fromApplyDate) > 0){\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.reward.greater.fromdate\")+\"\\n\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}else if(cellFromDateReward != null){\n\t\t\t\t\t\t\tString _fromDateReward = getCellValueToString(cellFromDateReward); \n\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"FromDateReward\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\n\t\t\t\t\t// 11 Đến ngày trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellToDateReward = myRow.getCell(11);\n\t\t\t\t\t\tif (Constant.VOUCHER.equals(header.rewardType+\"\")) {\n\t\t\t\t\t\t\tif (cellToDateReward != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tif (cellToDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDateReward.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellToDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\tif (cellToDateReward.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\tString _toDateReward = DateUtil.toDateString(cellToDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\tDate toDateReward = DateUtil.toDate(_toDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDateReward;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent12(_toDateReward);\n\t\t\t\t\t\t\t\t\t} else if (cellToDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDateReward.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellToDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\t\tif (cellToDateReward.getDateCellValue() != null || StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\t\tString _toDateReward = DateUtil.toDateString(cellToDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\tDate toDateReward = DateUtil.toDate(_toDateReward, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDateReward;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent12(_toDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tString _todateReward = cellToDateReward.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(_todateReward)) {\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay.traThuong \"));\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent12(_todateReward);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(_todateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDate;\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent12(_todateReward);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent12(cellToDateReward.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (header.fromApplyDate != null && header.toApplyDate != null) {\n\t\t\t\t\t\t\t\t\t\tif (DateUtil.compareDateWithoutTime(header.fromApplyDate, header.toApplyDate) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.greater.todate.reward\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else if(cellToDateReward != null){\n\t\t\t\t\t\t\tString _todateReward = getCellValueToString(cellToDateReward); \n\t\t\t\t\t\t\terrRow.setContent12(_todateReward);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"ToDateReward\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}*/\n\t\t\t\t\t// 11 Loại trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\t\tCell cellRewardType = myRow.getCell(11);\n\t\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_ALLOW_REWARD_TYPE\", ApParamType.LIST_ALLOW_REWARD_TYPE);\n\t\t\t\t\t\t\tString strListAllowReward = apParam.getApParamName();\n\t\t\t\t\t\t\tstrListAllowReward = strListAllowReward.replace(\" \", \"\");\n\t\t\t\t\t\t\tString[] listAllowReward = strListAllowReward.split(\",\");\n\t\t\t\t\t\t\tif (cellRewardType != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tString strRewardType = getCellValueToString(cellRewardType);\n\t\t\t\t\t\t\t\tif (strRewardType != null \n\t\t\t\t\t\t\t\t\t&& (Constant.DISCOUNT_MONEY.equals(strRewardType) || Constant.VOUCHER.equals(strRewardType)) \n\t\t\t\t\t\t\t\t\t&& Arrays.asList(listAllowReward).contains(header.type)) \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(Constant.DISCOUNT_MONEY.equals(strRewardType) || Constant.VOUCHER.equals(strRewardType)) \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\theader.rewardType = Integer.parseInt(strRewardType.trim());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terrRow.setContent12(strRewardType);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tString strRewardType = getCellValueToString(cellRewardType);\n\t\t\t\t\t\t\t\terrRow.setContent12(strRewardType);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.number\", iRun, \"RewardType\");\n\t\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// 12 Từ ngày trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellFromDateReward = myRow.getCell(12);\n\t\t\t\t\t\tif (Constant.VOUCHER.equals(header.rewardType+\"\")) {\n\t\t\t\t\t\t\tif (cellFromDateReward != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue()))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif (cellFromDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDateReward.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellFromDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\tif (cellFromDateReward.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\tString _fromDateReward = DateUtil.toDateString(cellFromDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (cellFromDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDateReward.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellFromDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\t\tif (cellFromDateReward.getDateCellValue() != null || StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\t\tString _fromDateReward = DateUtil.toDateString(cellFromDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tString _fromDateReward = cellFromDateReward.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(_fromDateReward)) {\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent13(cellFromDateReward.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif(header.fromApplyDate != null && header.fromDate != null){\n//\t\t\t\t\t\t\t\t\t\tint sub = DateUtil.compareDateWithoutTime(header.fromDate,header.fromApplyDate);\n\t\t\t\t\t\t\t\t\t\tif(DateUtil.compareDateWithoutTime(header.fromDate,header.fromApplyDate) > 0){\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.reward.greater.fromdate\")+\"\\n\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else if(cellFromDateReward != null){\n\t\t\t\t\t\t\tString _fromDateReward = getCellValueToString(cellFromDateReward); \n\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"FromDateReward\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// 11 Đến ngày trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellToDateReward = myRow.getCell(13);\n\t\t\t\t\t\tif (Constant.VOUCHER.equals(header.rewardType+\"\")) {\n\t\t\t\t\t\t\tif (cellToDateReward != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tif (cellToDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDateReward.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellToDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\tif (cellToDateReward.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\tString _toDateReward = DateUtil.toDateString(cellToDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\tDate toDateReward = DateUtil.toDate(_toDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDateReward;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent14(_toDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (cellToDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDateReward.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellToDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\t\tif (cellToDateReward.getDateCellValue() != null || StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\t\tString _toDateReward = DateUtil.toDateString(cellToDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\tDate toDateReward = DateUtil.toDate(_toDateReward, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDateReward;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent14(_toDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tString _todateReward = cellToDateReward.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(_todateReward)) {\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay.traThuong \"));\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent14(_todateReward);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(_todateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDate;\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent14(_todateReward);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent14(cellToDateReward.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (header.fromApplyDate != null && header.toApplyDate != null) {\n\t\t\t\t\t\t\t\t\t\tif (DateUtil.compareDateWithoutTime(header.fromApplyDate, header.toApplyDate) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.greater.todate.reward\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else if(cellToDateReward != null){\n\t\t\t\t\t\t\tString _todateReward = getCellValueToString(cellToDateReward); \n\t\t\t\t\t\t\terrRow.setContent14(_todateReward);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"ToDateReward\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tlistHeader.add(header);\n\t\t\t\t\t\tmapHeader.put(header.promotionCode, header);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrRow.setErrMsg(messageError);\n\t\t\t\t\t\tlstHeaderError.add(errRow);\n\t\t\t\t\t\tif (mapErrorPromotion.get(header.promotionCode) == null) {\n\t\t\t\t\t\t\tmapErrorPromotion.put(header.promotionCode, messageError);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tiRun++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Sheet Don vi tham gia\n\t\t\tif (unitSheet != null) {\n\t\t\t\tIterator<?> rowIter = unitSheet.rowIterator();\n\t\t\t\tiRun = 0;\n\t\t\t\tint maxSizeSheet3 = 5;\n\t\t\t\tList<Shop> listShopChild;\n\t\t\t\twhile (rowIter.hasNext()) {\n\t\t\t\t\tRow myRow = (Row) rowIter.next();\n\t\t\t\t\tif (iRun == 0) {\n\t\t\t\t\t\tiRun++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tboolean isContinue = true;\n\t\t\t\t\tfor (int i = 0; i < maxSizeSheet3; i++) {\n\t\t\t\t\t\tif (myRow.getCell(i) != null) {\n\t\t\t\t\t\t\tisContinue = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (isContinue) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tExcelPromotionUnit unitPromo = new ExcelPromotionUnit();\n\t\t\t\t\tCellBean errRow = new CellBean();\n\t\t\t\t\tString messageError = \"\";\n\t\t\t\t\tBoolean isHasData = false;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tString promotionCode = getCellValueToString(myRow.getCell(0));\n\t\t\t\t\t\tString shopCode = getCellValueToString(myRow.getCell(1));\n\t\t\t\t\t\tString quality = getCellValueToString(myRow.getCell(2));\n\t\t\t\t\t\tString totalAmount = getCellValueToString(myRow.getCell(3));\n\t\t\t\t\t\tString amount = getCellValueToString(myRow.getCell(4));\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(promotionCode) || !StringUtil.isNullOrEmpty(shopCode) || !StringUtil.isNullOrEmpty(quality)\n\t\t\t\t\t\t\t\t|| !StringUtil.isNullOrEmpty(totalAmount) || !StringUtil.isNullOrEmpty(amount)) {\n\t\t\t\t\t\t\tisHasData = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 1 Mã CTKM\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellPromotionCode = myRow.getCell(0);\n\t\t\t\t\t\tif (cellPromotionCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tif(isHasData){\n\t\t\t\t\t\t\t\tString promoCode = getCellValueToString(cellPromotionCode);\n\t\t\t\t\t\t\t\tPromotionProgram newPromotionProgram;\n\t\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(promoCode)) {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.promotion.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tnewPromotionProgram = promotionProgramMgr.getPromotionProgramByCode(promoCode);\n\t\t\t\t\t\t\t\t\tif(newPromotionProgram == null \n\t\t\t\t\t\t\t\t\t\t\t&& mapHeader.get(promoCode) == null){\n\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.not.init\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tunitPromo.promotionCode = promoCode;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terrRow.setContent1(promoCode);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"Mã CTKM\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 2 Mã đơn vị\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellUnitCode = myRow.getCell(1);\n\t\t\t\t\t\tif (cellUnitCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tif(isHasData){\n\t\t\t\t\t\t\t\tString unitCode = getCellValueToString(cellUnitCode);\n\t\t\t\t\t\t\t\t// Kiem tra ma don vi empty\n\t\t\t\t\t\t\t\tif(StringUtil.isNullOrEmpty(unitCode)){\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.unit.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Kiem tra don vi ton tai trong he thong\n\t\t\t\t\t\t\t\t\tif(shopMgr.getShopByCode(unitCode) == null){\n\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.unit.code.not.permission\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t} else if (currentUser != null && currentUser.getShopRoot() != null){ // kiem tra don vi co thuoc quyen quan ly cua user\n\t\t\t\t\t\t\t\t\t\tlistShopChild = promotionProgramMgr.getListChildByShopId(currentUser.getShopRoot().getShopId());\n\t\t\t\t\t\t\t\t\t\t// Kiem tra shop co thuoc quen quan ly cua user dang nhap\n\t\t\t\t\t\t\t\t\t\tboolean isShopMapWithUser = false;\n\t\t\t\t\t\t\t\t\t\tfor(Shop shop: listShopChild){\n\t\t\t\t\t\t\t\t\t\t\t if(unitCode.toLowerCase().equals(shop.getShopCode().toLowerCase())){\n\t\t\t\t\t\t\t\t\t\t\t\t isShopMapWithUser = true;\n\t\t\t\t\t\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif(!isShopMapWithUser){\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.unit.code.not.permission.by.current.user\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tunitPromo.unitCode = unitCode;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terrRow.setContent2(unitCode);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"Mã CTKM\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 3 Số suất \n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellQuantityMax = myRow.getCell(2);\n\t\t\t\t\t\tif (cellQuantityMax != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString quantityMax = getCellValueToString(cellQuantityMax);\n\t\t\t\t\t\t\tif(quantityMax != null){\n\t\t\t\t\t\t\t\tquantityMax = quantityMax.trim().replace(\",\", \"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (quantityMax != null && quantityMax.trim().length() <= 9 \n\t\t\t\t\t\t\t\t\t&& StringUtil.isFloat(quantityMax) && Double.parseDouble(quantityMax.trim()) > 0\n\t\t\t\t\t\t\t\t\t&& quantityMax.contains(\".\") == false) {\n\t\t\t\t\t\t\t\tunitPromo.quantityMax = Integer.parseInt(quantityMax.trim().replace(\",\", \"\"));\n\t\t\t\t\t\t\t} else if(quantityMax != null && quantityMax.length() > 9 ){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"9\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Số suất\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (StringUtil.isNullOrEmpty(quantityMax) == false) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.quantity.max.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent3(quantityMax);\n\t\t\t\t\t\t}else if(cellQuantityMax != null){\n\t\t\t\t\t\t\t// String quantityMax = getCellValueToString(cellQuantityMax);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"Số suất\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 4 Số tiền amountMax\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellAmountMax = myRow.getCell(3);\n\t\t\t\t\t\tif (cellAmountMax != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString amountMax = getCellValueToString(cellAmountMax);\n\t\t\t\t\t\t\tif(amountMax != null){\n\t\t\t\t\t\t\t\tamountMax = amountMax.trim().replace(\",\", \"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (amountMax != null && amountMax.length() <= 9 && StringUtil.isFloat(amountMax) \n\t\t\t\t\t\t\t\t\t&& Double.parseDouble(amountMax.trim()) > 0 && amountMax.contains(\".\") == false) {\n\t\t\t\t\t\t\t\tunitPromo.amountMax = new BigDecimal(amountMax.trim().replace(\",\", \"\"));\n\t\t\t\t\t\t\t} else if(amountMax != null && amountMax.length() > 9){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"9\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Số tiền\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (StringUtil.isNullOrEmpty(amountMax) == false) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.amount.max.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent4(amountMax);\n\t\t\t\t\t\t}else if(cellAmountMax != null){\n\t\t\t\t\t\t\tString amountMax = getCellValueToString(cellAmountMax);\n\t\t\t\t\t\t\terrRow.setContent4(amountMax);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"Số tiền\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 5 Số lượng numMax\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellNumMax = myRow.getCell(4);\n\t\t\t\t\t\tif (cellNumMax != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString numMax = getCellValueToString(cellNumMax);\n\t\t\t\t\t\t\tnumMax = numMax.trim().replace(\",\", \"\");\n\t\t\t\t\t\t\tif (numMax != null && numMax.length() <= 9 \n\t\t\t\t\t\t\t\t\t&& StringUtil.isFloat(numMax) \n\t\t\t\t\t\t\t\t\t&& Double.parseDouble(numMax.trim()) > 0\n\t\t\t\t\t\t\t\t\t&& numMax.contains(\".\") == false) {\n\t\t\t\t\t\t\t\tunitPromo.numMax = new BigDecimal(numMax.trim().replace(\",\", \"\"));\n\t\t\t\t\t\t\t} else if(numMax != null && numMax.length() > 9){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"9\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Số lượng\");\n\t\t\t\t\t\t\t}else if (StringUtil.isNullOrEmpty(numMax) == false) {\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.num.max.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent5(numMax);\n\t\t\t\t\t\t}else if(cellNumMax != null){\n\t\t\t\t\t\t\tString numMax = getCellValueToString(cellNumMax);\n\t\t\t\t\t\t\terrRow.setContent5(numMax);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\",\n\t\t\t\t\t\t\t\tConfiguration.getResourceString(ConstantManager.VI_LANGUAGE, \"Số lượng\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tlistUnit.add(unitPromo);\n\t\t\t\t\t\tmapUnit.put(unitPromo.promotionCode, unitPromo);\n\t\t\t\t\t}else{\n\t\t\t\t\t\terrRow.setContent6(messageError);\n\t\t\t\t\t\tlistUnitError.add(errRow);\n//\t\t\t\t\t\tif(mapErrorUnit.get(unitPromo.promotionCode) == null){\n//\t\t\t\t\t\t\tmapErrorUnit.put(unitPromo.promotionCode, messageError);\n//\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t/*if (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tlistHeader.add(header);\n\t\t\t\t\t\tmapHeader.put(header.promotionCode, header);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrRow.setContent13(messageError);\n\t\t\t\t\t\tlstHeaderError.add(errRow);\n\t\t\t\t\t\tif (mapErrorPromotion.get(header.promotionCode) == null) {\n\t\t\t\t\t\t\tmapErrorPromotion.put(header.promotionCode, messageError);\n\t\t\t\t\t\t}\n\t\t\t\t\t}*/\n\n\t\t\t\t\tiRun++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//Sheet Co cau KM\n\t\t\t/////\n\t\t\tif (detailSheet != null) {\t\n\t\t\t\tIterator<?> rowIter = detailSheet.rowIterator();\n\t\t\t\tString previousPromotionCode = null;\n\t\t\t\tint typeKM;\n\t\t\t\tMap<String, Integer> mapPromotionType = new HashMap<String, Integer>();\n\t\t\t\tiRun = 0;\n\t\t\t\tMap<String, String[]> mapArrayProduct = new HashMap<String, String[]>();\n\t\t\t\tMap<String, BigDecimal[]> mapArraySaleQuantity = new HashMap<String, BigDecimal[]>();\n\t\t\t\tMap<String, BigDecimal[]> mapArraySaleAmount = new HashMap<String, BigDecimal[]>();\n\t\t\t\tMap<String, BigDecimal[]> mapArrayDiscountAmount = new HashMap<String, BigDecimal[]>();\n\t\t\t\tMap<String, Float[]> mapArrayDiscountPercent = new HashMap<String, Float[]>();\n\t\t\t\tMap<String, Integer[]> mapArrayQuantityUnit = new HashMap<String, Integer[]>();\n\t\t\t\tMap<String, String[]> mapArrayFreeProduct = new HashMap<String, String[]>();\n\t\t\t\tMap<String, BigDecimal[]> mapArrayFreeQuantity = new HashMap<String, BigDecimal[]>();\n\t\t\t\tMap<String, Integer[]> mapArrayFreeQuantityUnit = new HashMap<String, Integer[]>();\n\t\t\t\tMap<String, Boolean[]> mapArrayAndOr = new HashMap<String, Boolean[]>();\n\t\t\t\tMap<String, String[]> mapPromoGroupCode = new HashMap<String, String[]>();\n\t\t\t\tMap<String, String[]> mapPromoGroupName = new HashMap<String, String[]>();\n\t\t\t\tMap<String, String[]> mapPromoLevelCode = new HashMap<String, String[]>();\n//\t\t\t\tMap<String, Integer[]> mapMultiple = new HashMap<String, Integer[]>();\n//\t\t\t\tMap<String, Integer[]> mapRecursive = new HashMap<String, Integer[]>();\n//\t\t\t\tMap<String, Integer[]> mapDkgh = new HashMap<String,Integer[]>();\n\t\t\t\t\n\t\t\t\tLinkedHashMap<String, Integer> lstProductPromo = new LinkedHashMap<String, Integer>();\n\t\t\t\tMap<String, List<Row>> lstRow = new HashMap<String, List<Row>>();\n\t\t\t\tint indexProductPromo = 0;\n\t\t\t\tint maxSizeSheet2 = 12;\n\t\t\t\tPromotionProgram existPromotion = null;\n\t\t\t\twhile (rowIter.hasNext()) {\n\t\t\t\t\tRow myRow = (Row) rowIter.next();\n\t\t\t\t\tif (iRun == 0) {\n\t\t\t\t\t\tiRun++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tboolean isContinue = true;\n\t\t\t\t\t//Kiem tra su hop le cua Row Import\n\t\t\t\t\tfor (int i = 0; i < maxSizeSheet2; i++) {\n\t\t\t\t\t\tif (myRow.getCell(i) != null) {\n\t\t\t\t\t\t\tisContinue = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (isContinue) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tExcelPromotionDetail detail = new ExcelPromotionDetail();\n\t\t\t\t\tCellBean errRow = new CellBean();\n\t\t\t\t\tString messageError = \"\";\n\t\t\t\t\t//0 get promotionCode\n\t\t\t\t\tString promotionCode = null;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellPromotionCode = myRow.getCell(0);\n\t\t\t\t\t\tif (cellPromotionCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tpromotionCode = cellPromotionCode.getStringCellValue();\n\t\t\t\t\t\t\t//\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tpromotionCode = String.valueOf(cellPromotionCode.getNumericCellValue());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpromotionCode = getCellValueToString(cellPromotionCode);\n\t\t\t\t\t\t\tpromotionCode = promotionCode != null ? promotionCode.trim().toUpperCase().trim() : \"\";\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(promotionCode)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += ValidateUtil.validateField(promotionCode, \"catalog.promotion.import.column.progcode\", 50, ConstantManager.ERR_REQUIRE, ConstantManager.ERR_MAX_LENGTH, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_CODE);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texistPromotion = promotionProgramMgr.getPromotionProgramByCode(promotionCode);\n\t\t\t\t\t\t\tif (existPromotion == null && mapHeader.get(promotionCode) == null) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.not.init\") + \"\\n\";\n\t\t\t\t\t\t\t\t//messageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.program.not.exists\");\n\t\t\t\t\t\t\t\t//messageError += \"\\n\";\n\t\t\t\t\t\t\t\t//else if(existPromotion != null && mapHeader.get(promotionCode) == null){\n\t\t\t\t\t\t\t} else if(existPromotion != null && ActiveType.RUNNING.equals(existPromotion.getStatus())){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.program.exists\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdetail.promotionCode = promotionCode;\n\t\t\t\t\t\t\terrRow.setContent1(promotionCode);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(promotionCode)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.required\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.code\"));\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Mã CTKM\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//1 get type\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (myRow.getCell(1) != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tdetail.type = myRow.getCell(1).getStringCellValue();\n\t\t\t\t\t\t\t//\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tdetail.type = String.valueOf(myRow.getCell(1).getNumericCellValue());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdetail.type = getCellValueToString(myRow.getCell(1));\n\t\t\t\t\t\t\tdetail.type = detail.type != null ? detail.type.trim().toUpperCase().trim() : \"\";\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(detail.type)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (mapCheckType.get(detail.type) == null) {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.exists.before\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.type\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t} else if (mapType.get(promotionCode) == null) {\n\t\t\t\t\t\t\t\t\tif (null != existPromotion && existPromotion.getType().equalsIgnoreCase(detail.type)) {\n\t\t\t\t\t\t\t\t\t\tmapType.put(detail.promotionCode, detail.type);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.type.is.not.same2\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (!mapType.get(promotionCode).equals(detail.type)) {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.type.is.not.same2\") + \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent2(getCellValueToString(myRow.getCell(1)));\n\t\t\t\t\t\t}else if(myRow.getCell(1) != null){\n\t\t\t\t\t\t\terrRow.setContent2(getCellValueToString(myRow.getCell(1)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Loại CTKM\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//2 Mã nhóm\n\t\t\t\t\t/*try {\n\t\t\t\t\t\tCell cellGroupCode = myRow.getCell(2);\n\t\t\t\t\t\tString groupCode = null;\n\t\t\t\t\t\tif (cellGroupCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tgroupCode = getCellValueToString(cellGroupCode);\n\t\t\t\t\t\t\tmessageError = ValidateUtil.validateField(noticeCode, \"catalog.promotion.noticecode\", 100, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(groupCode)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.group.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.promoGroupCode = groupCode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent3(groupCode);\n\t\t\t\t\t\t}else if (cellGroupCode != null) {\n\t\t\t\t\t\t\tgroupCode = getCellValueToString(cellGroupCode);\n\t\t\t\t\t\t\terrRow.setContent3(groupCode);\n\t\t\t\t\t\t}else if (cellGroupCode == null) {\n\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.group.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Mã nhóm\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 3 Tên nhóm\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellGroupName = myRow.getCell(3);\n\t\t\t\t\t\tString groupName = null;\n\t\t\t\t\t\tif (cellGroupName != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tgroupName = getCellValueToString(cellGroupName);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(groupName)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.group.name.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.promoGroupName = groupName;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent4(groupName);\n\t\t\t\t\t\t}else if (cellGroupName != null) {\n\t\t\t\t\t\t\tgroupName = getCellValueToString(cellGroupName);\n\t\t\t\t\t\t\terrRow.setContent4(groupName);\n\t\t\t\t\t\t}else if (cellGroupName == null) {\n\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.group.name.obligate\") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Tên nhóm\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 4 Mã mức\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellLevelCode = myRow.getCell(4);\n\t\t\t\t\t\tString levelCode = null;\n\t\t\t\t\t\tif (cellLevelCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tlevelCode = getCellValueToString(cellLevelCode);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(levelCode)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.level.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.promoLevelCode = levelCode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent5(levelCode);\n\t\t\t\t\t\t} else if (cellLevelCode != null) {\n\t\t\t\t\t\t\tlevelCode = getCellValueToString(cellLevelCode);\n\t\t\t\t\t\t\terrRow.setContent5(levelCode);\n\t\t\t\t\t\t}else if (cellLevelCode == null) {\n\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.level.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Tên nhóm\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}*/\n\t\t\t\t\t//5 Tên mức\n\t\t\t\t\t/*try {\n\t\t\t\t\t\tCell cellLevelName = myRow.getCell(5);\n\t\t\t\t\t\tString levelName = null;\n\t\t\t\t\t\tif (cellLevelName != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tlevelName = getCellValueToString(cellLevelName);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(levelName)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.level.name.obligate \") + \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.promoLevelName = levelName;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent6(levelName);\n\t\t\t\t\t\t} else if (cellLevelName == null) {\n\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.level.name.obligate \") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Tên nhóm\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}*/\n\t\t\t\t\t//2 get productCode\n\t\t\t\t\tString productCode = \"\";\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 2) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellProductCode = myRow.getCell(2);\n\t\t\t\t\t\t\tif (cellProductCode != null) {\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\tproductCode = cellProductCode.getStringCellValue();\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t} catch (Exception ex) {\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\tproductCode = String.valueOf(cellProductCode.getNumericCellValue());\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\tLogUtility.logError(ex, ex.getMessage());\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tproductCode = getCellValueToString(cellProductCode);\n\t\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(productCode)) {\n\t\t\t\t\t\t\t\t\tProduct product = productMgr.getProductByCode(productCode.trim());\n\t\t\t\t\t\t\t\t\tif (product == null) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.exist.in.db\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.buyproduct.code\"));\n\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.productCode = productCode.toUpperCase().trim();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Mã Sản Phẩm Mua\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Mã Sản Phẩm Mua\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(2) != null) {\n\t\t\t\t\t\t\terrRow.setContent3(getCellValueToString(myRow.getCell(2)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.get.product.error\", productCode);\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//3 getQuantity\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 3) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellQuantity = myRow.getCell(3);\n\t\t\t\t\t\t\tif (cellQuantity != null && cellQuantity.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellQuantity.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tBigDecimal quantity = new BigDecimal(cellQuantity.getNumericCellValue());\n\t\t\t\t\t\t\t\t\tif (quantity == null || quantity.compareTo(BigDecimal.ZERO) <= 0) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"SL Sản Phẩm Mua\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.saleQuantity = quantity;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"SL Sản Phẩm Mua\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"SL Sản Phẩm Mua\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(3) != null) {\n\t\t\t\t\t\t\terrRow.setContent4(getCellValueToString(myRow.getCell(3)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"SL Sản Phẩm Mua\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//4 get UOM\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 4) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellProductUnit = myRow.getCell(4);\n\t\t\t\t\t\t\tif (cellProductUnit != null && cellProductUnit.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellProductUnit.getCellType() == Cell.CELL_TYPE_STRING) {\n\t\t\t\t\t\t\t\t\tString unit = cellProductUnit.getStringCellValue();\n\t\t\t\t\t\t\t\t\tif (unit == null || StringUtil.isNullOrEmpty(unit)) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Đơn Vị Tính Cho SP Mua\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (unit.trim().toLowerCase().equals(\"LẺ\".toLowerCase())) {\n\t\t\t\t\t\t\t\t\t\tdetail.productUnit = 1;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdetail.productUnit = 2;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Đơn Vị Tính Cho SP Mua\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Đơn Vị Tính Cho SP Mua\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(4) != null) {\n\t\t\t\t\t\t\terrRow.setContent5(getCellValueToString(myRow.getCell(4)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Đơn Vị Tính Cho SP Mua\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//5 getAmount\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 5) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellAmount = myRow.getCell(5);\n\t\t\t\t\t\t\tif (cellAmount != null && cellAmount.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellAmount.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tBigDecimal amount = BigDecimal.valueOf(cellAmount.getNumericCellValue());\n\t\t\t\t\t\t\t\t\tif (amount == null || amount.compareTo(BigDecimal.ZERO) < 0) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Số Tiền SP Mua\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.saleAmount = amount;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Số Tiền SP Mua\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Số Tiền SP Mua\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(5) != null) {\n\t\t\t\t\t\t\terrRow.setContent6(getCellValueToString(myRow.getCell(5)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Số Tiền SP Mua\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//6 getDiscount Amount\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 6) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellDiscountAmount = myRow.getCell(6);\n\t\t\t\t\t\t\tif (cellDiscountAmount != null && cellDiscountAmount.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellDiscountAmount.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tBigDecimal discountAmount = BigDecimal.valueOf(cellDiscountAmount.getNumericCellValue());\n\t\t\t\t\t\t\t\t\tif (discountAmount == null || discountAmount.compareTo(BigDecimal.ZERO) < 0) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Số Tiền SP KM\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.discountAmount = discountAmount;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Số Tiền SP KM\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Số Tiền SP KM\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(6) != null) {\n\t\t\t\t\t\t\terrRow.setContent7(getCellValueToString(myRow.getCell(6)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Số Tiền SP KM\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//7 get discount percent\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 7) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellDiscountPercent = myRow.getCell(7);\n\t\t\t\t\t\t\tif (cellDiscountPercent != null && cellDiscountPercent.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellDiscountPercent.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tFloat discountPercent = (float) cellDiscountPercent.getNumericCellValue();\n\t\t\t\t\t\t\t\t\tif (discountPercent == null || discountPercent < 0 || discountPercent > 100) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"% KM\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.discountPercent = discountPercent;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.column.invalid.format.float\", \"% KM\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"% KM\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(7) != null) {\n\t\t\t\t\t\t\terrRow.setContent8(getCellValueToString(myRow.getCell(7)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"DiscPer\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//8 get Free product code\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 8) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellFreeProductCode = myRow.getCell(8);\n\t\t\t\t\t\t\tif (cellFreeProductCode != null) {\n\t\t\t\t\t\t\t\tString freeProductCode = getCellValueToString(cellFreeProductCode);\n\t\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(freeProductCode)) {\n\t\t\t\t\t\t\t\t\tProduct freeProduct = productMgr.getProductByCode(freeProductCode.trim());\n\t\t\t\t\t\t\t\t\tif (freeProduct == null) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.exist.in.db\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.disproduct.code\"));\n\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.freeProductCode = freeProductCode.toUpperCase().trim();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Mã SP KM\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(8) != null) {\n\t\t\t\t\t\t\terrRow.setContent9(getCellValueToString(myRow.getCell(8)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Mã SP KM\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//9 get free Quantity\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 9) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellFreeQuantity = myRow.getCell(9);\n\t\t\t\t\t\t\tif (cellFreeQuantity != null && cellFreeQuantity.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellFreeQuantity.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tBigDecimal freeQuantity = new BigDecimal(cellFreeQuantity.getNumericCellValue());\n\t\t\t\t\t\t\t\t\tif (freeQuantity == null || freeQuantity.compareTo(BigDecimal.ZERO) < 0) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Số Lượng KM\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.freeQuantity = freeQuantity;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Số Lượng KM\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Số Lượng KM\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(9) != null) {\n\t\t\t\t\t\t\terrRow.setContent10(getCellValueToString(myRow.getCell(9)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Số Lượng KM\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//10 get Free UOM\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 10) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellProductUnit = myRow.getCell(10);\n\t\t\t\t\t\t\tif (cellProductUnit != null && cellProductUnit.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellProductUnit.getCellType() == Cell.CELL_TYPE_STRING) {\n\t\t\t\t\t\t\t\t\tString unit = cellProductUnit.getStringCellValue();\n\t\t\t\t\t\t\t\t\tif (unit == null || StringUtil.isNullOrEmpty(unit)) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Đơn Vị Tính cho SP KM\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (unit.trim().toLowerCase().equals(\"LẺ\".toLowerCase())) {\n\t\t\t\t\t\t\t\t\t\tdetail.freeProductUnit = 1;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdetail.freeProductUnit = 2;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Đơn Vị Tính cho SP KM\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(10) != null) {\n\t\t\t\t\t\t\terrRow.setContent11(getCellValueToString(myRow.getCell(10)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Đơn Vị Tính cho SP KM\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//11 get And Or\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 11) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellAndOrCell = myRow.getCell(11);\n\t\t\t\t\t\t\tif (cellAndOrCell != null) {\n\t\t\t\t\t\t\t\tString value;\n\t\t\t\t\t\t\t\tif (cellAndOrCell.getCellType() != Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tvalue = cellAndOrCell.getStringCellValue();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tvalue = String.valueOf((float) cellAndOrCell.getNumericCellValue());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (\"X\".equals(value.trim().toUpperCase())) {\n\t\t\t\t\t\t\t\t\tdetail.andOr = true;\n\t\t\t\t\t\t\t\t\terrRow.setContent12(value);\n\t\t\t\t\t\t\t\t} else if (\"\".equals(value.trim().toUpperCase())) {\n\t\t\t\t\t\t\t\t\tdetail.andOr = false;\n\t\t\t\t\t\t\t\t\terrRow.setContent12(value);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\terrRow.setContent13(value);\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.read.cell.format.invalid\", iRun, \"AllFreeItemcode\", \"['','X']\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.andOr = false;\n\t\t\t\t\t\t\t\terrRow.setContent12(\"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.read.cell.format.invalid\", iRun, \"AllFreeItemcode\", \"['','X']\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// 12 ĐKGH\n\t\t\t\t\t/*try{\n\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_ALLOW_DKGH\", ApParamType.LIST_ALLOW_DKGH);\n\t\t\t\t\t\tString strListPromo = apParam.getApParamName();\n\t\t\t\t\t\tCell cellDKGH = myRow.getCell(17);\n\t\t\t\t\t\tString[] ListAllow = strListPromo.split(\",\");\n\t\t\t\t\t\tif(Arrays.asList(ListAllow).contains(detail.type)){\n\t\t\t\t\t\t\tif(cellDKGH != null && StringUtil.isNullOrEmpty(messageError)){\n\t\t\t\t\t\t\t\tString dkgh = getCellValueToString(cellDKGH);\n\t\t\t\t\t\t\t\tif(dkgh != null \n\t\t\t\t\t\t\t\t\t\t&& (Constant.HAVE_CONDITION.equals(dkgh) || (Constant.NON_CONDITION.equals(dkgh)))){\n\t\t\t\t\t\t\t\t\tdetail.dkgh = Integer.parseInt(dkgh.trim());\n\t\t\t\t\t\t\t\t}else if(dkgh != null){\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.dkgh.incorrect.format\")+\"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terrRow.setContent18(dkgh);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else if(cellDKGH != null){\n\t\t\t\t\t\t\tString dkgh = getCellValueToString(cellDKGH);\n\t\t\t\t\t\t\terrRow.setContent18(dkgh);\n\t\t\t\t\t\t}\n\t\t\t\t\t}catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"DKGH\", \"['','X']\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}*/\n\t\t\t\t\tif (mapPromotionTypeCheck.get(detail.promotionCode) == null) {\n\t\t\t\t\t\tmapPromotionTypeCheck.put(detail.promotionCode, detail.type);\n\t\t\t\t\t}\n\t\t\t\t\tif (!promotionCode.equals(previousPromotionCode)) {\n\t\t\t\t\t\tif (mapPromotionType.get(detail.promotionCode) != null) {//da ton tai ctkm nay truoc do roi\n\t\t\t\t\t\t\t//typeKM = mapPromotionType.get(detail.promotionCode);//=> lay ra loai cua no thoi\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && !StringUtil.isNullOrEmpty(detail.freeProductCode) && detail.freeQuantity != null\n\t\t\t\t\t\t\t\t\t&& detail.freeQuantity.compareTo(BigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 1;//ZV03\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && detail.discountAmount != null && detail.discountAmount.compareTo(\n\t\t\t\t\t\t\t\t\tBigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 2;//ZV02\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && detail.discountPercent != null && detail.discountPercent > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 3;//ZV01\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && !StringUtil.isNullOrEmpty(detail.freeProductCode) && detail.freeQuantity != null\n\t\t\t\t\t\t\t\t\t&& detail.freeQuantity.compareTo(BigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 4;\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && detail.discountAmount != null && detail.discountAmount.compareTo(\n\t\t\t\t\t\t\t\t\tBigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 5;\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && detail.discountPercent != null && detail.discountPercent > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 6;\n\t\t\t\t\t\t\t} else if (detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && !StringUtil.isNullOrEmpty(detail.freeProductCode) && detail.freeQuantity != null && detail.freeQuantity.compareTo(\n\t\t\t\t\t\t\t\t\tBigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 7;\n\t\t\t\t\t\t\t} else if (detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && detail.discountAmount != null && detail.discountAmount.compareTo(BigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 8;\n\t\t\t\t\t\t\t} else if (detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && detail.discountPercent != null && detail.discountPercent > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 9;\n\t\t\t\t\t\t\t} else if (detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && !StringUtil.isNullOrEmpty(detail.freeProductCode) && detail.freeQuantity != null && detail.freeQuantity.compareTo(\n\t\t\t\t\t\t\t\t\tBigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 10;//ZV24\n\t\t\t\t\t\t\t} else if (detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && detail.discountAmount != null && detail.discountAmount.compareTo(BigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 11;//ZV23\n\t\t\t\t\t\t\t} else if (detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && detail.discountPercent != null && detail.discountPercent > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 12;//ZV22\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttypeKM = -1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmapPromotionType.put(detail.promotionCode, typeKM);\n\t\t\t\t\t\t\tpreviousPromotionCode = detail.promotionCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//typeKM = mapPromotionType.get(detail.promotionCode);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tList<Row> lstR = lstRow.get(detail.promotionCode);\n\t\t\t\t\t\tif (lstR == null) {\n\t\t\t\t\t\t\tlstR = new ArrayList<Row>();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmessageError = checkDuplicate(mapType.get(detail.promotionCode), lstR, myRow);\n\t\t\t\t\t\tif(StringUtil.isNullOrEmpty(messageError)){\n\t\t\t\t\t\t\tlistDetail.add(detail);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlstR.add(myRow);\n\t\t\t\t\t\tlstRow.put(detail.promotionCode, lstR);\n\t\t\t\t\t}\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tif (mapArrayProduct.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tString[] arrProduct = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrProduct[iRun] = detail.productCode;\n\t\t\t\t\t\t\tmapArrayProduct.put(detail.promotionCode, arrProduct);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrProduct[iRun] = detail.productCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArraySaleQuantity.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = new BigDecimal[MAX_ARRAY];\n\t\t\t\t\t\t\tarrSaleQuantity[iRun] = detail.saleQuantity;\n\t\t\t\t\t\t\tmapArraySaleQuantity.put(detail.promotionCode, arrSaleQuantity);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrSaleQuantity[iRun] = detail.saleQuantity;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayQuantityUnit.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tInteger[] arrUnit = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrUnit[iRun] = detail.productUnit;\n\t\t\t\t\t\t\tmapArrayQuantityUnit.put(detail.promotionCode, arrUnit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tInteger[] arrUnit = mapArrayQuantityUnit.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrUnit[iRun] = detail.productUnit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArraySaleAmount.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBigDecimal[] arrSaleAmount = new BigDecimal[MAX_ARRAY];\n\t\t\t\t\t\t\tarrSaleAmount[iRun] = detail.saleAmount;\n\t\t\t\t\t\t\tmapArraySaleAmount.put(detail.promotionCode, arrSaleAmount);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrSaleAmount[iRun] = detail.saleAmount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayFreeProduct.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tString[] arrFreeProduct = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrFreeProduct[iRun] = detail.freeProductCode;\n\t\t\t\t\t\t\tmapArrayFreeProduct.put(detail.promotionCode, arrFreeProduct);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrFreeProduct[iRun] = detail.freeProductCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayFreeQuantityUnit.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tInteger[] arrUnit = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrUnit[iRun] = detail.freeProductUnit;\n\t\t\t\t\t\t\tmapArrayFreeQuantityUnit.put(detail.promotionCode, arrUnit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tInteger[] arrUnit = mapArrayFreeQuantityUnit.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrUnit[iRun] = detail.freeProductUnit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayFreeQuantity.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = new BigDecimal[MAX_ARRAY];\n\t\t\t\t\t\t\tarrFreeQuantity[iRun] = detail.freeQuantity;\n\t\t\t\t\t\t\tmapArrayFreeQuantity.put(detail.promotionCode, arrFreeQuantity);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBigDecimal[] arrFreeProduct = mapArrayFreeQuantity.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrFreeProduct[iRun] = detail.freeQuantity;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayDiscountAmount.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBigDecimal[] arrDiscountAmount = new BigDecimal[MAX_ARRAY];\n\t\t\t\t\t\t\tarrDiscountAmount[iRun] = detail.discountAmount;\n\t\t\t\t\t\t\tmapArrayDiscountAmount.put(detail.promotionCode, arrDiscountAmount);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBigDecimal[] arrDiscountAmount = mapArrayDiscountAmount.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrDiscountAmount[iRun] = detail.discountAmount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayDiscountPercent.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tFloat[] arrDiscountPercent = new Float[MAX_ARRAY];\n\t\t\t\t\t\t\tarrDiscountPercent[iRun] = detail.discountPercent;\n\t\t\t\t\t\t\tmapArrayDiscountPercent.put(detail.promotionCode, arrDiscountPercent);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tFloat[] arrDiscountPercent = mapArrayDiscountPercent.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrDiscountPercent[iRun] = detail.discountPercent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayAndOr.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBoolean[] arrAndOr = new Boolean[MAX_ARRAY];\n\t\t\t\t\t\t\tarrAndOr[iRun] = detail.andOr;\n\t\t\t\t\t\t\tmapArrayAndOr.put(detail.promotionCode, arrAndOr);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrAndOr[iRun] = detail.andOr;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Ma nhom\n\t\t\t\t\t\tif(mapPromoGroupCode.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tString[] arrPromoGroupCode = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrPromoGroupCode[iRun] = detail.promoGroupCode;\n\t\t\t\t\t\t\tmapPromoGroupCode.put(detail.promotionCode, arrPromoGroupCode);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tString[] arrPromoGroupCode = mapPromoGroupCode.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrPromoGroupCode[iRun] = detail.promoGroupCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Ten nhom\n\t\t\t\t\t\tif(mapPromoGroupName.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tString[] arrPromoGroupName = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrPromoGroupName[iRun] = detail.promoGroupName;\n\t\t\t\t\t\t\tmapPromoGroupName.put(detail.promotionCode, arrPromoGroupName);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tString[] arrPromoGroupName = mapPromoGroupName.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrPromoGroupName[iRun] = detail.promoGroupName;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Ma muc\n\t\t\t\t\t\tif(mapPromoLevelCode.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tString[] arrayPromoLevelCode = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrayPromoLevelCode[iRun] = detail.promoLevelCode;\n\t\t\t\t\t\t\tmapPromoLevelCode.put(detail.promotionCode, arrayPromoLevelCode);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tString[] arrayPromoLevelCode = mapPromoLevelCode.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrayPromoLevelCode[iRun] = detail.promoLevelCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Bội số\n\t\t\t\t\t\t/*if(mapMultiple.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tInteger[] arrMultiple = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrMultiple[iRun] = detail.multiple;\n\t\t\t\t\t\t\tmapMultiple.put(detail.promotionCode, arrMultiple);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tInteger[] arrMultiple = mapMultiple.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrMultiple[iRun] = detail.multiple;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Tối ưu\n\t\t\t\t\t\tif(mapRecursive.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tInteger[] arrRecursive = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrRecursive[iRun] = detail.recursive;\n\t\t\t\t\t\t\tmapRecursive.put(detail.promotionCode, arrRecursive);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tInteger[] arrRecursive = mapRecursive.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrRecursive[iRun] = detail.recursive;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map ĐKGH\n\t\t\t\t\t\tif(mapDkgh.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tInteger[] arrDkgh = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrDkgh[iRun] = detail.dkgh;\n\t\t\t\t\t\t\tmapDkgh.put(detail.promotionCode, arrDkgh);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tInteger[] arrDkgh = mapDkgh.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrDkgh[iRun] = detail.dkgh;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(detail.productCode) && lstProductPromo.get(detail.promotionCode + \"-\" + detail.productCode) == null) {\n\t\t\t\t\t\t\tlstProductPromo.put(detail.promotionCode + \"-\" + detail.productCode, indexProductPromo++);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//error\n\t\t\t\t\t\terrRow.setContent13(messageError);\n\t\t\t\t\t\tlstDetailError.add(errRow);\n\t\t\t\t\t\tif (mapErrorPromotion.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tmapErrorPromotion.put(detail.promotionCode, messageError);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// totalItem++;\n\t\t\t\t\tiRun++;\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * put vao group level\n\t\t\t\t */\n\t\t\t\tString messageError = \"\";\n\t\t\t\tCellBean errRow = new CellBean();\n\t\t\t\t\n\t\t\t\tfor (String promotionProgramCode : mapPromotionType.keySet()) {\n\t\t\t\t\tInteger unit = -1;\n\t\t\t\t\tString[] arrPromoGroupCode = mapPromoGroupCode.get(promotionProgramCode);\n\t\t\t\t\tString[] arrPromoGroupName = mapPromoGroupName.get(promotionProgramCode);\n\t\t\t\t/*\tString[] arrPromoLevelCode = mapPromoLevelCode.get(promotionProgramCode);\n\t\t\t\t\tInteger[] arrMultiple = mapMultiple.get(promotionProgramCode);\n\t\t\t\t\tInteger[] arrRecursive = mapRecursive.get(promotionProgramCode);\t\t*/\t\t\t\n//\t\t\t\t\tInteger[] arrDkgh = mapDkgh.get(promotionProgramCode);\n\t\t\t\t\t\n\t\t\t\t\tif (mapPromotionType.get(promotionProgramCode) == 1) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(1), B(1) dc km ... C(1), D(1)\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrFreeProductUnit = mapArrayFreeQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = mapArrayFreeQuantity.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortQuantityProduct(arrProduct, arrProductUnit, arrSaleQuantity, arrAndOr, arrFreeProduct, arrFreeProductUnit, arrFreeQuantity, null, null);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleQuantity[i] != null && !StringUtil.isNullOrEmpty(arrFreeProduct[i]) && arrFreeQuantity[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupKM.qttUnit = arrFreeProductUnit[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 2) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(1), B(1) dc km ... 10.000\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeAmount = mapArrayDiscountAmount.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortQuantityProduct(arrProduct, arrProductUnit, arrSaleQuantity, arrAndOr, null, null, null, arrFreeAmount, null);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleQuantity[i] != null && arrFreeAmount[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 3) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(1), B(1) dc km ... 10%\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tFloat[] arrPercent = mapArrayDiscountPercent.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortQuantityProduct(arrProduct, arrProductUnit, arrSaleQuantity, arrAndOr, null, null, null, null, arrPercent);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleQuantity[i] != null && arrPercent[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n//\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 4) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(10.000), B(10.000) dc km ... C(1), D(1)\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrFreeProductUnit = mapArrayFreeQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = mapArrayFreeQuantity.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortAmountProduct(arrProduct, arrProductUnit, arrSaleAmount, arrAndOr, arrFreeProduct, arrFreeProductUnit, arrFreeQuantity, null, null);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleAmount[i] != null && !StringUtil.isNullOrEmpty(arrFreeProduct[i]) && arrFreeQuantity[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = arrFreeProductUnit[i];\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 5) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(10.000), B(10.000) dc km ... 10.000\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeAmount = mapArrayDiscountAmount.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortAmountProduct(arrProduct, arrProductUnit, arrSaleAmount, arrAndOr, null, null, null, arrFreeAmount, null);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleAmount[i] != null && arrFreeAmount[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 6) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(10.000), B(10.000) dc km ... 10%\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tFloat[] arrPercent = mapArrayDiscountPercent.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortAmountProduct(arrProduct, arrProductUnit, arrSaleAmount, arrAndOr, null, null, null, null, arrPercent);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleAmount[i] != null && arrPercent[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 7) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua 10000 dc km ... C(1), D(1)\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrFreeProductUnit = mapArrayFreeQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = mapArrayFreeQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tsortAmount(arrSaleAmount, arrAndOr, arrFreeProduct, arrFreeProductUnit, arrFreeQuantity, null, null);\n\t\t\t\t\t\tfor (int i = 0; arrSaleAmount != null && i < arrSaleAmount.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleAmount[i] != null && !StringUtil.isNullOrEmpty(arrFreeProduct[i]) && arrFreeQuantity[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM.qttUnit = arrFreeProductUnit[i];\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 8) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua 10000 dc km ... 10.000\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeAmount = mapArrayDiscountAmount.get(promotionProgramCode);\n\t\t\t\t\t\tsortAmount(arrSaleAmount, null, null, null, null, arrFreeAmount, null);\n\t\t\t\t\t\tfor (int i = 0; arrSaleAmount != null && i < arrSaleAmount.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleAmount[i] != null && arrFreeAmount[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 9) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua 10000 dc km ... 10%\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tFloat[] arrPercent = mapArrayDiscountPercent.get(promotionProgramCode);\n\t\t\t\t\t\tsortAmount(arrSaleAmount, null, null, null, null, null, arrPercent);\n\t\t\t\t\t\tfor (int i = 0; arrSaleAmount != null && i < arrSaleAmount.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleAmount[i] != null && arrPercent[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t\t/*groupMua.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t/*\tgroupKM.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 10) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * ZV24\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = mapArrayFreeQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrFreeProductUnit = mapArrayFreeQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tsortQuantity(arrSaleQuantity, arrAndOr, arrFreeProduct, arrFreeProductUnit, arrFreeQuantity, null, null);\n\n\t\t\t\t\t\tfor (int i = 0; arrSaleQuantity != null && i < arrSaleQuantity.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleQuantity[i] != null && !StringUtil.isNullOrEmpty(arrFreeProduct[i]) && arrFreeQuantity[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t\t/*groupMua.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t/*\t\t\tgroupKM.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM.qttUnit = arrFreeProductUnit[i];\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], null, indexMua++, i, arrSaleQuantity, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 11) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * ZV23\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeAmount = mapArrayDiscountAmount.get(promotionProgramCode);\n\t\t\t\t\t\tsortQuantity(arrSaleQuantity, null, null, null, null, arrFreeAmount, null);\n\t\t\t\t\t\tfor (int i = 0; arrSaleQuantity != null && i < arrSaleQuantity.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleQuantity[i] != null && arrFreeAmount[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t/*\tgroupMua.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t/*\t\tgroupKM.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 12) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * \n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tFloat[] arrPercent = mapArrayDiscountPercent.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortQuantity(arrSaleQuantity, null, null, null, null, null, arrPercent);\n\t\t\t\t\t\tfor (int i = 0; arrSaleQuantity != null && i < arrSaleQuantity.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleQuantity[i] != null && arrPercent[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t\t/*groupMua.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t\t/*groupKM.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\terrRow.setContent14(messageError);\n\t\t\t\t\tlstDetailError.add(errRow);\n\t\t\t\t}\n\t\t\t\tfor (String promotionProgramCode : mapPromotionType.keySet()) {\n\t\t\t\t\tsplitGroup(mapPromotionMua.get(promotionProgramCode), mapPromotionKM.get(promotionProgramCode), mapMuaKM, promotionProgramCode, lstProductPromo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static int create(EcoSystem system){\n \n \n XSSFWorkbook workbook = new XSSFWorkbook();\n XSSFSheet sheet = workbook.createSheet(\"Customer Details\");\n\n //Custom font style for header\n CellStyle cellStyle = sheet.getWorkbook().createCellStyle();\n Font font = sheet.getWorkbook().createFont();\n font.setBold(true);\n cellStyle.setFont(font);\n \n int rowCount = 0;\n int columnCount1 = 0;\n \n //Creating header row\n \n String s[] = {\"CUSTOMER ID\",\"CUSTOMER NAME\",\"CONTACT NO.\",\"EMAIL ID\",\"USAGE(Gallons)\",\"BILLING DATE\",\"TOTAL BILL($)\"};\n Row row1 = sheet.createRow(++rowCount);\n for(String s1 : s){\n Cell header = row1.createCell(++columnCount1);\n header.setCellValue(s1);\n header.setCellStyle(cellStyle);\n }\n \n \n \n for(Network network : system.getNetworkList()){\n for(Enterprise enterprise : network.getEnterpriseDirectory().getEnterpriseList()){\n if(enterprise instanceof WaterEnterprise){\n for(Organization organization : enterprise.getOrganizationDirectory().getOrganizationList()){\n if(organization instanceof CustomerOrganization){\n for(Employee employee : organization.getEmployeeDirectory().getEmployeeList()){\n Customer customer = (Customer) employee;\n Row row = sheet.createRow(++rowCount);\n int columnCount = 0;\n for(int i = 0 ; i<7 ; i++ ){\n Cell cell = row.createCell(++columnCount);\n if(i==0){\n cell.setCellValue(customer.getId());\n }\n else if(i == 1){\n cell.setCellValue(customer.getName());\n }\n else if(i == 2){\n cell.setCellValue(customer.getContactNo());\n }\n else if(i == 3){\n cell.setCellValue(customer.getEmailId());\n }\n else if(i == 4){\n cell.setCellValue(customer.getTotalUsageVolume());\n }\n else if(i == 5){\n if(customer.getBillingDate() != null)\n cell.setCellValue(String.valueOf(customer.getBillingDate()));\n else\n cell.setCellValue(\"Bill Not yet available\");\n }\n else if(i == 6){\n if(customer.getTotalBill() != 0)\n cell.setCellValue(customer.getTotalBill());\n else\n cell.setCellValue(\"Bill Not yet available\");\n }\n }\n }\n }\n }\n }\n }\n }\n \n \n try (FileOutputStream outputStream = new FileOutputStream(\"Customer_details.xlsx\")) {\n workbook.write(outputStream);\n } catch (FileNotFoundException ex) {\n JOptionPane.showMessageDialog(null, \"File not found\");\n return 0;\n } catch (IOException ex) {\n JOptionPane.showMessageDialog(null, \"IOException\");\n return 0;\n }\n return 1;\n }", "void importNewExpenditure(Transaction expenditure, String type) throws BankException {\n logger.warning(\"This account does not support this feature\");\n throw new BankException(\"This account does not support this feature\");\n }", "public JsonObject covertToJson() {\n JsonObject transObj = new JsonObject(); //kasutaja portf. positsiooni tehing\n transObj.addProperty(\"symbol\", symbol);\n transObj.addProperty(\"type\", type);\n transObj.addProperty(\"price\", price);\n transObj.addProperty(\"volume\", volume);\n transObj.addProperty(\"date\", date);\n transObj.addProperty(\"time\", time);\n transObj.addProperty(\"profitFromSell\", profitFromSell);\n transObj.addProperty(\"averagePurchasePrice\", averagePurchasePrice);\n return transObj;\n }", "public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException {\n InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(\"riddles.xls\");\n\t\t\n InputStream is = new FileInputStream(new File(\"C:\\\\Users\\\\sean\\\\workspace\\\\mlymoon\\\\src\\\\main\\\\resources\\\\riddles.xls\"));\n\t\tExcelUtil eu = new ExcelUtil();\n List<Object> ls = eu.importDataFromExcel(new Item(), in, \"riddles.xls\");\n for(Object item : ls){\n \t Item i = (Item) item;\n \t System.out.println(i.getAnswer()+\"##\"+i.getConundrum());\n }\n String[] excelHeader = { \"所属区域(地市)\", \"机房\", \"机架资源情况\", \n \t \"\", \"端口资源情况\", \"机位资源情况\", \"\", \"\", \"设备资源情况\", \n \t \"\", \"\", \"IP资源情况\", \"\", \"\", \"\", \"\", \"网络设备数\" };\n /*ApplicationContext context = \n\t new ClassPathXmlApplicationContext(\"appContext.xml\");\n\t CustomerService customerService = context.getBean(\"customerService\",CustomerService.class);\n List<Customer> customers=customerService.findAll(null, null);\n FileOutputStream fout = new FileOutputStream(\"I:/students.xls\"); \n\t\tExcelUtil eu = new ExcelUtil();\n\t\teu.exportDataToExcel(customers, excelHeader, \"dddddd\", fout);*/\n\t}", "private JSONObject getGSTR3B_Section_5_3_Data(JSONObject params, String companyId, JSONArray dataJArr) throws JSONException, ServiceException {\n JSONObject reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.put(\"itctype\", Constants.GST_ITCTYPE_DEFAULT+\",\"+Constants.GST_ITCTYPE_REVERSED);\n reqParams.put(\"typeofjoinisleft\", true);\n JSONObject jSONObject = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_INVOICE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n jSONObject = getGoodsReceiptForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = jSONObject.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n }\n /**\n * Vendor DN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.remove(\"cnentityValue\");\n JSONObject temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n\n }\n\n /**\n * Vendor CN\n */\n reqParams = new JSONObject(params, JSONObject.getNames(params));\n reqParams.put(\"GST3B\", !params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false));\n reqParams.put(\"isRCMApplicable\", false);\n reqParams.put(\"taxClassType\", FieldComboData.TaxClass_ZeroPercenatge);\n reqParams.put(\"registrationType\", Constants.GSTRegType_Regular + \",\" + Constants.GSTRegType_Unregistered);\n reqParams.put(\"CustomerType\", Constants.CUSTVENTYPE_NA + \",\" + Constants.CUSTVENTYPE_SEZ + \",\" + Constants.CUSTVENTYPE_SEZWOPAY + \",\" + Constants.CUSTVENTYPE_Import);\n reqParams.put(\"typeofjoinisleft\", true);\n reqParams.put(\"onlycnagainstvendor\", true);\n temp = new JSONObject();\n if ((reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) || (!StringUtil.isNullOrEmpty(params.optString(\"transactionType\", null)) && (params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_NOTE || params.optInt(\"transactionType\", 0) == GSTRConstants.GSTR3B_TRANSACTION_TYPE_ALL))) {\n /**\n * For GSTR3B-Detail View.\n */\n temp = getDNForGSTR3BTaxable(reqParams);\n }\n if (!(reqParams.has(\"reportid\") && reqParams.optInt(\"reportid\", 0) == Constants.GSTR3B_Summary_Report) && params.optBoolean(GSTR3BConstants.DETAILED_VIEW_REPORT, false)) {\n JSONArray tempArr = temp.optJSONArray(\"data\");\n if (tempArr != null && tempArr.length() > 0) {\n dataJArr = StringUtil.concatJSONArray(dataJArr, tempArr);\n }\n } else {\n jSONObject.put(\"taxableamt\", authHandler.formattedAmount((jSONObject.optDouble(\"taxableamt\", 0.0) + temp.optDouble(\"taxableamt\", 0.0)), companyId));\n jSONObject.put(\"igst\", authHandler.formattedAmount((jSONObject.optDouble(\"igst\", 0.0) + temp.optDouble(\"igst\", 0.0)), companyId));\n jSONObject.put(\"cgst\", authHandler.formattedAmount((jSONObject.optDouble(\"cgst\", 0.0) + temp.optDouble(\"cgst\", 0.0)), companyId));\n jSONObject.put(\"sgst\", authHandler.formattedAmount((jSONObject.optDouble(\"sgst\", 0.0) + temp.optDouble(\"sgst\", 0.0)), companyId));\n jSONObject.put(\"csgst\", authHandler.formattedAmount((jSONObject.optDouble(\"csgst\", 0.0) + temp.optDouble(\"csgst\", 0.0)), companyId));\n jSONObject.put(\"totaltax\", authHandler.formattedAmount((jSONObject.optDouble(\"totaltax\", 0.0) + temp.optDouble(\"totaltax\", 0.0)), companyId));\n jSONObject.put(\"totalamount\", authHandler.formattedAmount((jSONObject.optDouble(\"totalamount\", 0.0) + temp.optDouble(\"totalamount\", 0.0)), companyId));\n jSONObject.put(\"tableno\", \"\");\n jSONObject.put(\"particulars\", GSTRConstants.GSTR3B_SECTION_5_3);\n jSONObject.put(\"fmt\", \"B\");\n jSONObject.put(\"enableViewDetail\", true);\n dataJArr.put(jSONObject);\n }\n return jSONObject;\n }", "private String importExcelPromotionNew() {\n\t\ttry{\n\t\t\tList<List<String>> infoPromotion = new ArrayList<>();\n\t\t\tList<List<String>> infoPromotionDetail = new ArrayList<>();\n\t\t\tList<List<String>> infoPromotionShop = new ArrayList<>();\n\t\t\t\n\t\t\tList<CellBean> infoPromotionError = new ArrayList<>();\n\t\t\tList<CellBean> infoPromotionDetailError = new ArrayList<>();\n\t\t\tList<CellBean> infoPromotionShopError = new ArrayList<>();\n\t\t\tList<PromotionImportNewVO> promotionImportNewErrorVOs = null;\n\t\t\t\n\t\t\tgetDataImportExcelPromotion(infoPromotion, infoPromotionDetail, infoPromotionShop, infoPromotionError, infoPromotionDetailError, infoPromotionShopError);\n\t\t\t// xu ly xuất lỗi\n\t\t\tif (infoPromotionError.size() > 0 || infoPromotionDetailError.size() > 0 || infoPromotionShopError.size() > 0) {\n\t\t\t\treturn WriteFileError(infoPromotionError, infoPromotionDetailError, infoPromotionShopError);\n\t\t\t}\n\t\t\t\n\t\t\tpromotionImportNewErrorVOs = new ArrayList<>();\n\t\t\tList<PromotionImportNewVO> promotionImportNewVOs = convertDataImportExcelPromotion(infoPromotion, infoPromotionDetail, infoPromotionShop, infoPromotionError, infoPromotionDetailError, infoPromotionShopError);\n\t\t\tif(promotionImportNewVOs != null && promotionImportNewVOs.size() > 0) {\n\t\t\t\t// bỏ những CT k hợp le và những CT nằm ngoài các ZV cần xử lý\n\t\t\t\tpromotionImportNewVOs = validatePromotionImport(promotionImportNewVOs, promotionImportNewErrorVOs);\n\t\t\t}\n\t\t\t// sap xep lại cac mức cho CTKM\n\t\t\tpromotionImportNewVOs = sortPromotionImport(promotionImportNewVOs);\n\t\t\t//save\n\t\t\ttotalItem = promotionImportNewErrorVOs.size() + promotionImportNewVOs.size();\n\t\t\tnumFail = promotionImportNewErrorVOs.size();\n\t\t\tif(promotionImportNewVOs != null && promotionImportNewVOs.size() > 0) {\n\t\t\t\tpromotionImportNewErrorVOs = promotionProgramMgr.saveImportPromotionNew(promotionImportNewVOs, promotionImportNewErrorVOs, getLogInfoVO());\n\t\t\t\t// thông tin tra ve\n\t\t\t\tnumFail = promotionImportNewErrorVOs.size();\n\t\t\t\tfor (PromotionImportNewVO promotion : promotionImportNewVOs) {\n\t\t\t\t\tPromotionProgram pp = promotionProgramMgr.getPromotionProgramByCode(promotion.getPromotionCode());\n\t\t\t\t\tif (pp != null) {\n\t\t\t\t\t\tpromotionProgramMgr.updateMD5ValidCode(pp, getLogInfoVO());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// xu ly nêu có loi\n\t\t\tif (promotionImportNewErrorVOs.size() > 0) {\n\t\t\t\tconvertObjectPromotionToCellBean(promotionImportNewErrorVOs, infoPromotionError, infoPromotionDetailError, infoPromotionShopError);\n\t\t\t\tif (infoPromotionError.size() > 0 || infoPromotionDetailError.size() > 0 || infoPromotionShopError.size() > 0) {\n\t\t\t\t\treturn WriteFileError(infoPromotionError, infoPromotionDetailError, infoPromotionShopError);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch(Exception ex) {\n\t\t\terrMsg = Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"system.error\");\n\t\t\tLogUtility.logErrorStandard(ex, R.getResource(\"web.log.message.error\", \"vnm.web.action.program.PromotionCatalogAction.importExcelPromotionNew\"), createLogErrorStandard(actionStartTime));\n\t\t}\t\t\n\t\treturn SUCCESS;\n\t}", "private void saveAndNext(TaxChallan taxChallan, ArrayList challanList, String chalCode) {\r\n\t\t\r\n\t\tObject[][] addObjHdr=new Object[1][17];\r\n\t\taddObjHdr[0][0] = chalCode;\r\n\t\taddObjHdr[0][1] = taxChallan.getDivId();\r\n\t\taddObjHdr[0][2] = taxChallan.getMonth();\r\n\t\taddObjHdr[0][3] = taxChallan.getYear();\r\n\t\taddObjHdr[0][4] = taxChallan.getTax();\r\n\t\taddObjHdr[0][5] = taxChallan.getSurcharge();\r\n\t\taddObjHdr[0][6] = taxChallan.getEduCess();\r\n\t\taddObjHdr[0][7] = taxChallan.getTotalTax();\r\n\t\taddObjHdr[0][8] = 0;//taxChallan.getIntAmt();\r\n\t\taddObjHdr[0][9] = 0;//taxChallan.getOthrAmt();\r\n\t\taddObjHdr[0][10] = taxChallan.getOnHold();\r\n\t\tlogger.info(\"taxChallan.getOnHold()==\"+taxChallan.getOnHold());\r\n\t\tif(taxChallan.getOnHold().equals(\"All\")){\r\n\t\t\taddObjHdr[0][10] = \"A\";\r\n\t\t} //end of if\r\n\t\telse if(taxChallan.getOnHold().equals(\"Yes\")){\r\n\t\t\taddObjHdr[0][10]=\"Y\";\r\n\t\t} //end of else if\r\n\t\telse if(taxChallan.getOnHold().equals(\"No\")){\r\n\t\t\taddObjHdr[0][10]=\"N\";\r\n\t\t} //end of else if\r\n\t\t\r\n\t\tif(taxChallan.getIncludeSalary().equals(\"true\"))\r\n\t\t\taddObjHdr[0][11] = \"Y\";\r\n\t\telse\r\n\t\t\taddObjHdr[0][11] = \"N\";\r\n\t\t\r\n\t\tif(taxChallan.getIncludeSettlement().equals(\"true\"))\r\n\t\t\taddObjHdr[0][12] = \"Y\";\r\n\t\telse\r\n\t\t\taddObjHdr[0][12] = \"N\";\r\n\t\t\r\n\t\t/*if(taxChallan.getIncludeAllowance().equals(\"true\"))\r\n\t\t\taddObjHdr[0][13] = \"Y\";\r\n\t\telse\r\n\t\t\taddObjHdr[0][13] = \"N\";*/\r\n\t\r\n\t\tif(taxChallan.getIncludeArrears().equals(\"true\"))\r\n\t\t\taddObjHdr[0][13] = \"Y\";\r\n\t\telse\r\n\t\t\taddObjHdr[0][13] = \"N\";\r\n\t\t\r\n\t\tif(taxChallan.getIncludeBonus().equals(\"true\")) {\r\n\t\t\taddObjHdr[0][14] = \"Y\";\r\n\t\t} else {\r\n\t\t\taddObjHdr[0][14] = \"N\";\r\n\t\t}\r\n\t\tif(taxChallan.getIncludeLeaveEncashment().equals(\"true\")) {\r\n\t\t\taddObjHdr[0][15] = \"Y\";\r\n\t\t} else {\r\n\t\t\taddObjHdr[0][15] = \"N\";\r\n\t\t}\r\n\t\tif(taxChallan.getIncludeOverTime().equals(\"true\")) {\r\n\t\t\taddObjHdr[0][16] = \"Y\";\r\n\t\t} else {\r\n\t\t\taddObjHdr[0][16] = \"N\";\r\n\t\t}\r\n\t\t\r\n\t\r\n\t\tString insertHdrQuery = \"INSERT INTO HRMS_TAX_CHALLAN(CHALLAN_CODE,CHALLAN_DIVISION_ID,CHALLAN_MONTH,CHALLAN_YEAR,CHALLAN_TAX,CHALLAN_SURCHARGE, \"\r\n\t\t\t+\" CHALLAN_EDUCESS,CHALLAN_TOTALTAX,CHALLAN_INT_AMT,CHALLAN_OTHR_AMT,CHALLAN_TAX_ONHOLD,\" +\r\n\t\t\t \" CHALLAN_SALARY_FLAG,CHALLAN_SETTLE_FLAG,CHALLAN_ARREARS_FLAG, CHALLAN_BONUS_FLAG, CHALLAN_LEAVE_FLAG, CHALLAN_OT_FLAG) \"\r\n\t\t\t+\" VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) \";\r\n\t\t\r\n\t\tif(taxChallan.getChallanID()==null || taxChallan.getChallanID().equals(\"\") || \r\n\t\t\t\ttaxChallan.getChallanID().equals(\"null\") || taxChallan.getChallanID().equals(null)){\r\n\t\t\t\r\n\t\t\tObject[][]dtlData = new Object[challanList.size()][5];\r\n\t\t\t\r\n\t\t\r\n\t\t\t for (int i = 0; i < challanList.size(); i++) {\r\n\t\t\t\t dtlData[i]=((Object[][])challanList.get(i))[0];\r\n\t\t\t} //end of loop\r\n\t\t\t \r\n\t\t\t/* for (int i = 0; i < dtlData.length; i++) {\r\n\t\t\t\t logger.info(\"======================================\");\r\n\t\t\t\tfor (int j = 0; j < dtlData[0].length; j++) {\r\n\t\t\t\t\tlogger.info(\"finalObject=====\"+dtlData[i][j]);\r\n\t\t\t\t}\r\n\t\t\t}*/\r\n\t\t\t boolean hdrFlag = false;\r\n\t\t\t try {\r\n\t\t\t\thdrFlag =getSqlModel().singleExecute(insertHdrQuery, addObjHdr);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\tlogger.info(\"exception in insertHdrQuery\",e);\r\n\t\t\t} //end of catch \r\n\t\t\t\r\n\t\t\tString addChallan = \"INSERT INTO HRMS_TAX_CHALLAN_DTL(CHALLAN_CODE,EMP_ID,\" +\r\n\t\t\t \t\t\"CHALLAN_TDS,CHALLAN_SURCHARGE,CHALLAN_EDU_CESS,CHALLAN_TOTAL_TAX)\"\r\n\t\t\t\t\t+ \" VALUES(?,?,?,?,?,?)\";\r\n\t\t\tif(hdrFlag){\r\n\t\t\t\tgetSqlModel().singleExecute(addChallan, dtlData);\r\n\t\t\t} //end of if\r\n\t\t\t\r\n\t\t\ttaxChallan.setChallanID(chalCode);\r\n\t\t\t\r\n\t\t} //end of insert if\r\n\t\tfetchIncludeCheckSelections(taxChallan, chalCode);\r\n\t}" ]
[ "0.5739242", "0.5717288", "0.56112105", "0.55676866", "0.5549923", "0.5526244", "0.5514031", "0.5453504", "0.54523796", "0.5444532", "0.5402348", "0.5391303", "0.5360443", "0.5326479", "0.53076434", "0.5292345", "0.5283625", "0.5283221", "0.5280558", "0.52717364", "0.5258925", "0.5253193", "0.5231768", "0.52293605", "0.5223077", "0.52201474", "0.52192956", "0.52137125", "0.52125704", "0.52041507", "0.520301", "0.51973116", "0.51919794", "0.518599", "0.51726586", "0.51713085", "0.51710415", "0.51685894", "0.5167394", "0.5159821", "0.5159272", "0.51514196", "0.51414776", "0.5134236", "0.5130183", "0.51294965", "0.5118876", "0.5111326", "0.50987726", "0.50948566", "0.5087526", "0.5066128", "0.50470144", "0.5042641", "0.5039096", "0.50302756", "0.5027913", "0.5015868", "0.50090045", "0.49992743", "0.49856514", "0.49820212", "0.49750584", "0.49728662", "0.49713814", "0.49699274", "0.49677962", "0.4966558", "0.4964855", "0.4960482", "0.49584427", "0.49570474", "0.49519297", "0.4950919", "0.49415964", "0.49393824", "0.49271736", "0.4925816", "0.49199736", "0.49175566", "0.4910534", "0.49085873", "0.49051857", "0.49028587", "0.48949227", "0.48910636", "0.48906714", "0.48864016", "0.48858625", "0.48835415", "0.4880441", "0.48588812", "0.48558873", "0.4844871", "0.48441646", "0.48421475", "0.48373118", "0.48364654", "0.48330468", "0.4831058", "0.4830901" ]
0.0
-1
method added to find saved card element
public WebElement selectSavedCardPaymentMode() { return wait.until(ExpectedConditions.elementToBeClickable(findElement( repositoryParser, PAGE_NAME, "savedCard"))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void addCard(){\n WebDriverHelper.clickElement(addCard);\n }", "public void saveCard(card cardToBeSaved)\n {\n dbObj=new dbFlashCards(uid);\n dbObj.saveCard(packId, cardToBeSaved.getCardId(), cardToBeSaved.getFront(),cardToBeSaved.getBack());\n \n \n }", "public void clickadd_card() \n\t{\n\t\n\t\tdriver.findElement(add_card).click();\n\n }", "@Override\r\n\tpublic void findElement() {\n\t\t\r\n\t}", "public void victoryCardFind();", "public WebElement selectSavedCardDropDown() {\n\t\treturn findElement(repositoryParser, PAGE_NAME, \"dropDownOption\");\n\t}", "public void addPartnerCard(Card card);", "Symbol getActiveCard();", "private void addCard() {\n Intent intent = new Intent(this, NewCard.class);\n intent.putExtra(\"cardSetId\", cardSetId);\n startActivity(intent);\n }", "void setCard(Card card) {\n this.card = card;\n }", "private void save() {\n prefs.saveCardBackground(selectedBackground);\n prefs.saveCardBackgroundColor(selectedBackgroundColor);\n\n updateSummary();\n }", "public void addCard(PlayingCard aCard);", "@Override\n\tpublic void save(CardRule bean) {\n\n\t}", "public Card getCard() {\n return this.card;\n }", "public abstract void addCard();", "private void editUserCard() {\n getUserCard();\n }", "public Card getCard() {\n return this.card;\n }", "public Card getPresentCard() {\n return storageCards.peek();\n }", "public ChosenItemPage rememberElementAndFindIt(){\n showxButton.click(); //делает выпадющее меню количества выбора показываемых товаров\n waitVisibilityOf(showx12Button); \n showx12Button.click(); //выбираем показывать по 12\n WebElement firstItem=results.get(0);\n waitVisibilityOf(firstItem);\n String name=firstItem.getText(); //name of the product in the first item\n\n Assert.assertEquals(\"Показывать по 12 не установлено\",\n \"Показывать по 12\", showx.getText());\n\n Stash.put(Stash.firstItemName, name); //remeber first item\n fillField(name,headerSearch);\n headerSearch.sendKeys(Keys.ENTER);\n return new ChosenItemPage();\n }", "private void setCard(@NonNull Card card) {\n Debug.trace(\"CardDetails\", card.toString());\n etCardNumber.setText(card.getCardNumber());\n etCardHolderName.setText(card.getCardHolderName());\n// etCardExpiryDate.removeTextListener();\n etCardExpiryDate.setText(DateFormatUtils.stringToStringConversion(card.getExpirationDate(), \"MM/yy\", \"MM/yyyy\"));\n// etCardExpiryDate.addDateSlash(etCardExpiryDate.getEditableText());\n// etCardExpiryDate.addTextListener();\n }", "public Card(){\n this.name = \"\";\n this.description = \"\";\n this.element = null;\n this.img = \"\";\n }", "public void getCard(Card card, Board board){\n card.action(this, board);\n }", "public void takeACard(Card card){\n hand.add(card);\n }", "public void updateComputerCard()\n {\n this.computerCard = highCardGame.getHand(0).inspectCard(computerCardCounter);\n }", "public abstract void save(IElement element);", "Card getCard(UUID cardId);", "void AddCardToBuild(Card_Model passedCard) {\n buildOfCards.add(passedCard);\n }", "public de.uni_koblenz.jgralabtest.schemas.gretl.pddsl.Card createCard();", "public Card getModelCard()\n {\n return modelCard;\n }", "public void addCard(Card card) {\r\n SQLiteDatabase db = this.getWritableDatabase();\r\n \r\n ContentValues values = new ContentValues();\r\n values.put(COL_ACCOUNT, card.getAccount()); \r\n values.put(COL_USERNAME, card.getUsername()); \r\n values.put(COL_PASSWORD, card.getPassword()); \r\n values.put(COL_URL, card.getUrl()); \r\n values.put(COL_DELETED, card.getDeleted()); \r\n values.put(COL_HIDE_PWD, card.getHidePwd()); \r\n values.put(COL_REMIND_ME, card.getRemindMe()); \r\n values.put(COL_UPDATED_ON, card.getUpdatedOn()); \r\n values.put(COL_COLOR, String.valueOf(card.getColor()));\r\n values.put(COL_REMIND_ME_DAYS, card.getRemindMeDays());\r\n \r\n db.insert(TABLE_CARDS, null, values);\r\n db.close(); \r\n }", "private void addCardToDeck(Card card) {\n\t\tdeck.add(card);\n\t}", "public void catchCard(){\r\n changePlace(deck);\r\n changePlace(hand);\r\n }", "public String getIdCard() {\r\n return idCard;\r\n }", "void pushCard(ICard card);", "public void editBtnOnclick()\r\n\t{\r\n\t\tif(cardSet.getCards().size() != 0)\r\n\t\t\tMainRunner.getSceneSelector().switchToCardEditor();\r\n\t}", "public int chooseCard(){\n if(playable.size() == 1)//checks the size\n return searchCard(0);//returns the only playable card\n else{\n int temp = (int) Math.random()*playable.size();//chooses a random one\n return searchCard(temp);//returns that cards position\n }\n }", "public UnoCard getCardByName(String cardName){\n Drawable color_change_plus4 = this.appContext.getResources().getDrawable(R.drawable.color_change_plus4);\n Drawable card_back = this.appContext.getResources().getDrawable(R.drawable.card_back);\n UnoCard card = new UnoCard(this.appContext, deckPos, new Point(20, 20), color_change_plus4, card_back, \"Color Change Plus 4\", \"\", \"COLOR CHANGE PLUS 4\", \"COLOR CHANGE PLUS 4\");\n for (UnoCard c : this.cards){\n if (c.getName().equals(cardName)){\n card = c;\n break;\n }\n }\n return card;\n }", "@Override\r\n\tpublic void buyCard() {\n\t\t\r\n\t}", "private void cards() {\n newUserCard();\n editTypeCard();\n changePasswordCard();\n }", "public Card drawCard() {\n Card c = cards.get(0);//get a card\n cards.remove(0);//remove the card form the deck that's given out\n discard.add(c);//so the card given out is added to the discard list\n return c;//return a card object\n\n }", "void SetCaptureCardOfBuild(Card_Model card) {\n\n // If the card is an actual card being passed in, then set the value\n for(int i = 0; i < uniqueCards.size(); i++) {\n if(uniqueCards.get(i).GetCard().equals(card.GetCard())) {\n captureCardOfBuild = card;\n return;\n }\n }\n\n Log.d(\"MyError\", \"Error in setting the capture card of a build in build class.\");\n }", "public Card getCard(){\n return cards.get(0);\n }", "public void updateCard(Card card) {\n this.card.setValue(card);\n }", "public String getIdCard() {\n return idCard;\n }", "@Override\n\tpublic void createCard(Card card) {\n\t\t/* begin transaction */ \n\t\tSession session = getCurrentSession(); \n\t\tsession.beginTransaction(); \n\n\t\t/* persist */ \n\t\tsession.save(card); \n\n\t\t/* commit */ \n\t\tsession.getTransaction().commit();\n\t}", "@Override\n\tpublic void find() {\n\n\t}", "public Card giveCard(){\n return this.cardDeck.get(lastIndex++);\n }", "void update(Card card) throws PersistenceCoreException;", "Card selectByPrimaryKey(String card);", "public void saveInformation(){\n market.saveInformationOfMarket();\n deckProductionCardOneBlu.saveInformationOfProductionDeck();\n deckProductionCardOneGreen.saveInformationOfProductionDeck();\n deckProductionCardOneViolet.saveInformationOfProductionDeck();\n deckProductionCardOneYellow.saveInformationOfProductionDeck();\n deckProductionCardThreeBlu.saveInformationOfProductionDeck();\n deckProductionCardThreeGreen.saveInformationOfProductionDeck();\n deckProductionCardThreeYellow.saveInformationOfProductionDeck();\n deckProductionCardThreeViolet.saveInformationOfProductionDeck();\n deckProductionCardTwoBlu.saveInformationOfProductionDeck();\n deckProductionCardTwoGreen.saveInformationOfProductionDeck();\n deckProductionCardTwoViolet.saveInformationOfProductionDeck();\n deckProductionCardTwoYellow.saveInformationOfProductionDeck();\n\n\n }", "@Override\n public void onCardClick(String p) {\n }", "private Card drawCard() {\n return cardStack.pop();\n }", "@Override\npublic void findElement(String by) {\n\t\n}", "public void insert(Card card) {\n\t\tthis.insert(card);\n\t}", "@Override\n\tpublic boolean addCard(UnoCard card){\n\t\treturn this.cardList.add(card);\n\t}", "@Override\n\tpublic List<Card> findAllCard() {\n\t\treturn cb.findAllCard();\n\t}", "private void myNewCard( String name, String image, String desc, float price, int pid,String bulkdescription ) {\n\n firebaseImgAddresses = model.getProductimages();\n\n FirebaseAuth mAuth = FirebaseAuth.getInstance();\n\n SubCardsmodel movie = new SubCardsmodel(pid,name,image,desc,price,bulkdescription, mAuth.getCurrentUser().getEmail(),shopname,shopmobile,firebaseImgAddresses);\n //referring to movies node and setting the values from movie object to that location\n System.out.println(\"card and model \" + card + movie.getCardname());\n mDatabaseReference.child(\"Products\").child(card).push().setValue(movie);\n progressDialog.dismiss();\n\n// editAt(model.getCardname());\n\n\n Intent intent = new Intent(EditSubCard.this, DeleteSubCardView.class);\n intent.putExtra(\"cardname\",card);\n\n startActivity(intent);\n\n\n\n\n }", "private Image getCardImage(Card card) {\n return getImage(\"playing-cards/\" + card + \".png\");\n }", "void addCard(Card card) {\n\t\t_hand.addCard(card);\n\t}", "public void ActonCard() {\n\t}", "public void drawCard();", "public void addCard(Card card){\r\n\t\tplayerHand.add(card);\r\n\t\tSystem.out.print(\"You draw \");\r\n\t\tSystem.out.println(getCardIndex(playerHand.size()-1));\r\n\t}", "com.hps.july.persistence.StorageCard getAgregate() throws java.rmi.RemoteException, javax.ejb.FinderException;", "@Override\r\n\tpublic void save(T elemento) {\n\r\n\t}", "public String getIdCard() {\n\t\treturn idCard;\n\t}", "public void addCard(Card card) {\n personHand.add(card);\n }", "private void writeCardWidgetsFirstTime() {\n \t\tsetInSlot(SLOT_Card, null);\n \t\tallCards.clear();\n \t\tfor (int i = 0; i < Storage_access.getNumberOfCard(); i++) {\n \t\t\tfinal int myI = i;\n \t\t\tcardFactory.get(new AsyncCallback<SingleCardPresenter>() {\n \n \t\t\t\t@Override\n \t\t\t\tpublic void onSuccess (SingleCardPresenter result) {\n \t\t\t\t\taddToSlot(SLOT_Card, result);\n \t\t\t\t\tresult.init(myI);\n \t\t\t\t\tcardDragController.makeDraggable(result.getWidget(), result.getView().getCourse());\n \t\t\t\t\tcardDragController.makeDraggable(result.getWidget(), result.getView().getTeacher());\n \t\t\t\t\tallCards.add(result);\n \n \t\t\t\t}\n \n \t\t\t\t@Override\n \t\t\t\tpublic void onFailure(Throwable caught) {\n \t\t\t\t\t// TODO Auto-generated method stub\n \n \t\t\t\t}\n \t\t\t});\n \t\t}\n \n \t}", "public void currentPlayerDrawCard() {\n Player currentPlayer = turnManager.currentPlayer();\n UnoCard newCard = getNextCard();\n currentPlayer.obtainCard(newCard);\n\n for (GameListener gameListener : gameListeners) {\n gameListener.cardDrawn();\n }\n\t}", "public void push(Card card){\n\t\t//Make sure the stack is not the deck or draw pile\n\t\tif(StackID > 1){\n\t\t\t//If it's one of the foundations...\n\t\t\tif(StackID < 6){\n\t\t\t\t//If the foundation wasn't empty, unhighlight the top card before putting the new card on it\n\t\t\t\tif(!Solitaire.foundations[StackID-2].isEmpty())\n\t\t\t\t\tSolitaire.foundations[StackID-2].peek().highlightOff();\n\t\t\t\t//Put the card on the right foundation\n\t\t\t\tSolitaire.foundations[StackID-2].place(card);\n\t\t\t//If it's one of the piles...\n\t\t\t} else if(StackID <= 12){\n\t\t\t\t//If the pile wasn't empty, unhighlight the top card before putting the new card on it\n\t\t\t\tif(!Solitaire.piles[StackID-6].isEmpty())\n\t\t\t\t\tSolitaire.piles[StackID-6].peek().highlightOff();\n\t\t\t\t//Put the card on the right pile\n\t\t\t\tSolitaire.piles[StackID-6].place(card);\n\t\t\t}\n\t\t}\n\t}", "public int getCardID() {\n return cardID;\n }", "public void drawCard(Card card) {\n hand.addCard(card);\n }", "public void addCard(Card card) {\n this.deck.push(card);\n }", "public boolean takeCard(Card card)\r\n {\r\n if (card != null && numCards < MAX_CARDS)\r\n {\r\n myCards[numCards++] = new Card(card.getValue(), card.getSuit());\r\n return true;\r\n }\r\n return false;\r\n }", "ICard getCard(int cardIndex) throws IllegalArgumentException;", "public void addStorageCard(com.hps.july.persistence.StorageCard arg0) throws java.rmi.RemoteException, javax.ejb.FinderException, javax.naming.NamingException {\n\n instantiateEJB();\n ejbRef().addStorageCard(arg0);\n }", "public ErgebnisLOSCard drawECard() {\n\t\tErgebnisLOSCard result=eCards.get(0);\n\t\teCards.remove(result);\n\t\tcurrent.addeCard(result);\n\t\treturn result;\n\t}", "public void addCard(Card card, GamePlayer GP){\n for(int i=0; i<4; i++){\n if(cardsPlayed[i] == null){\n cardsPlayed[i]=card;\n if(i == 0){\n suit = card.getSuit();\n }\n break;\n }\n }\n }", "public void addCard(Card cardToAdd) {\n storageCards.add(cardToAdd);\n }", "private void putCurrentCard() {\n int temp = 0;\n while (true) {\n if(!(cards.get(temp) instanceof WildCard) ) {\n currentCard = cards.get(temp);\n cards.remove(temp);\n break;\n }\n temp++;\n }\n if (!(currentCard instanceof NumberCard)) {\n show();\n }\n //Reverse\n if (currentCard instanceof ReverseCard) {\n ((ReverseCard) currentCard).changeState(state);\n }\n //Skip\n if (currentCard instanceof SkipCard) {\n ((SkipCard) currentCard).changeState(state);\n }\n //Draw2\n if (currentCard instanceof Draw2Card) {\n System.out.println(\"The player was fined.\");\n for (int i = 0; i < ((Draw2Card) currentCard).getForcedCards(); i++) {\n players.get(state.getTurn()).addCard(cards.get(0));\n cards.remove(0);\n }\n state.nextTurn();\n }\n }", "public void executeInsertCard() {\n\t\tcurrentState.edgeInsertCard();\n\t}", "@SuppressWarnings(\"unused\")\r\n\tprivate static List<String> getCardLayersIdFromCard(PElement card, List<PLink> links){\r\n\t\treturn getCardLayersIdFromCard(card.getId(), links);\r\n\t}", "private void addCard() { \n\t\tint sic_idHolder; // declares sic_idHolder\n\t\tString titleHolder; // declares titleHolder\n\t\tString authorHolder; // declares authorHolder\n\t\tdouble priceHolder; // declares priceHolder\n\t\tint quantityHolder; // declares quantityHolder\n\t\t\n\t\t\n\t\tSystem.out.println(\"Making a new card:\\nPlease enter the new SIC-ID: \");\n\t\tsic_idHolder = scan.nextInt(); // prompts user to input the ID\n\t\tscan.nextLine();\n\t\t\n\t\tif(inventoryObject.cardExists(sic_idHolder) != true) {\n\t\t\tSystem.out.println(\"Please enter the title of the book: \");\n\t\t\ttitleHolder = scan.next(); // prompts user to input the title\n\t\t\tscan.nextLine();\n\t\t\tSystem.out.println(\"Please enter the author of the book\");\n\t\t\tauthorHolder = scan.next(); // prompts user to input the author\n\t\t\tscan.nextLine();\n\t\t\tSystem.out.println(\"Please enter the price of the book\");\n\t\t\tpriceHolder = scan.nextDouble(); // prompts user to input the price\n\t\t\tscan.nextLine();\n\t\t\n\t\t\tif(priceHolder < 0) { // checks to make sure priceHolder is positive\n\t\t\t\tSystem.out.println(\"ERROR! Price must be greater than or equal to 0:\");\n\t\t\t\tgetUserInfo();\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Please enter the number of books in invetory\");\n\t\tquantityHolder = scan.nextInt(); // prompts user to input the quantity\n\t\tscan.nextLine();\n\t\t\n\t\tif(quantityHolder <= 0) { // checks to make sure quantity isn't less than 1\n\t\t\tSystem.out.println(\"Error! Quantity must be greater than 0\\n\"); \n\t\t\tgetUserInfo();\n\t\t}\n\t\tinventoryObject.addStockIndexCard(sic_idHolder, titleHolder, authorHolder, priceHolder, quantityHolder); // calls addStockIndexCard from InventoryManagement\n\t\tgetUserInfo();\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"ERROR: The ID you entered is already in the system\\n\");\n\t\t\tgetUserInfo();\n\t\t}\n\t}", "public Card() {\n this.set('A', Suit.spades);\n }", "public void setIdCard(String idCard) {\n\t\tthis.idCard = idCard;\n\t}", "@Override\n\tpublic void saveOrUpdate(CardRule bean) {\n\n\t}", "int insert(Card record);", "public void addCard(Card card) {\n myCards.add(card);\n cardNumber = myCards.size();// reset the number of cards\n }", "public TrainCard draw(){\n TrainCard card = cardDeck.get(0);\n cardDeck.remove(0);\n return card;\n }", "public Card pullCard(){\n if(this.deckOfCards.isEmpty()){\n return null;\n }\n Card cardPulled = this.deckOfCards.get(0);\n this.deckOfCards.remove(0);\n return cardPulled;\n }", "public void returnCard(Card card) {\n\t\t// Update counters in the deck.\n\t\tdealtCards.getAndDecrement();\n\t\tAtomicInteger cardsBySuit = dealtCardsBySuit.get(card.getSuit());\n\t\tcardsBySuit.getAndDecrement();\n\t}", "private void peek() {\n\t\tfor (int card = 0; card < CARDS_SUM; card++) {\n\t\t\t// cheat by finding card face without turning card over\n\t\t\tPlayingCard thisCard = ((PlayingCard) getActivity().findViewById(solo.getImage(card).getId()));\n\t\t\tif (!thisCard.isLocked() && ! thisCard.getVisible()) {\n\t\t\t\tsolo.clickOnImage(card);\n\t\t\t\tsolo.clickOnImage(card);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}", "int insertSelective(Card record);", "@Test\n public void testAddCard() {\n d_gameData.getD_playerList().get(1).addCard(GameCard.BLOCKADE);\n assertEquals(true, d_gameData.getD_playerList().get(1).getD_cards().contains(GameCard.BLOCKADE));\n }", "public void saveExisting() {\r\n Part modifiedPart = null;\r\n for (Part part : Inventory.getAllParts()) {\r\n if (Integer.parseInt(iDfield.getText()) == part.getId()) {\r\n modifiedPart = part;\r\n }\r\n }\r\n if (modifiedPart instanceof Outsourced && inHouseSelected) {\r\n replacePart(modifiedPart);\r\n\r\n } else if (modifiedPart instanceof InHouse && !inHouseSelected) {\r\n replacePart(modifiedPart);\r\n } else {\r\n modifiedPart.setName(nameField.getText());\r\n modifiedPart.setStock(Integer.parseInt(invField.getText()));\r\n modifiedPart.setPrice(Double.parseDouble(priceField.getText()));\r\n modifiedPart.setMax(Integer.parseInt(maxField.getText()));\r\n modifiedPart.setMin(Integer.parseInt(minField.getText()));\r\n if (inHouseSelected) {\r\n ((InHouse) modifiedPart).setMachineId(Integer.parseInt(machineOrCompanyField.getText()));\r\n } else {\r\n ((Outsourced) modifiedPart).setCompanyName(machineOrCompanyField.getText());\r\n }\r\n\r\n Inventory.updatePart(Inventory.getAllParts().indexOf(modifiedPart), modifiedPart);\r\n }\r\n\r\n }", "public DevCard giveDevCard(){\n \n return null;\n }", "@Override\n public void onClick(View view) {\n mRepo.setIsEditingCard(Boolean.TRUE);\n mRepo.setCurrentCardTitle(model.getTitle());\n\n Navigation.findNavController(requireView()).navigate(R.id.action_editDeckFragment_to_submitCardFragment);\n }", "public Card giveMeACardForPlayer() {\n Card cardToGive = new Card(storageCards.peek().getCardMode(), storageCards.peek().getColor(), storageCards.peek().getScore());\n storageCards.remove();\n return cardToGive;\n }", "@Override\n\tpublic void insertCard(PlayingCard card, int position) {\n\t\t\n\t\t\n\t\tif(card != null && card instanceof SkatCard) {\n\t\t\tif(card.getSuit().equals(SkatCard.suitHerz)\n\t\t\t\t|| card.getSuit().equals(SkatCard.suitKaro) \n\t\t\t\t|| card.getSuit().equals(SkatCard.suitPik)\n\t\t\t\t|| card.getSuit().equals(SkatCard.suitKreuz)){\n\t\t\t\t\n\t\t\t\tif(card.getRank() == SkatCard.rank7\n\t\t\t\t\t|| card.getRank() == SkatCard.rank8\n\t\t\t\t\t|| card.getRank() == SkatCard.rank9\n\t\t\t\t\t|| card.getRank() == SkatCard.rank10\n\t\t\t\t\t|| card.getRank() == SkatCard.rankBube\n\t\t\t\t\t|| card.getRank() == SkatCard.rankDame\n\t\t\t\t\t|| card.getRank() == SkatCard.rankKoenig\n\t\t\t\t\t|| card.getRank() == SkatCard.rankAss) {\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tfor(int i = 0; i < getCount(); i++) {\n\t\t\t\t\t\tif(card.compareTo(aktuellesDeck[i]) == 0){\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\tif(position - 1 < kartenAnzahl && position > 0 && getCount() < kartenAnzahl) {\n\t\t\t\t\t\t\tfor(int i = getCount() - 1; i >= position - 1; i--) {\n\t\t\t\t\t\t\t\taktuellesDeck[i+1] = new SkatCard(aktuellesDeck[i].getSuit(), aktuellesDeck[i].getRank());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taktuellesDeck[position - 1] = new SkatCard(card.getSuit(), card.getRank());\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t}else System.out.println(\"Bitte Position überprüfen\");\n\t\t\t\t}else {System.out.println(\"falscher Wert\");}\t\n\t\t\t}else {System.out.println(\"falsche Farbe\");}\n\t\t}else {System.out.println(\"Karte null oder keine SkatKarte\");}\n}", "private void push( Card card ) {\r\n undoStack.add( card );\r\n }", "public abstract void selfCardDrawn(Card card);" ]
[ "0.6581161", "0.64106244", "0.62861955", "0.605585", "0.6023139", "0.59312445", "0.5803906", "0.57441133", "0.5713303", "0.5707555", "0.5696499", "0.5679864", "0.5648381", "0.5641501", "0.5636685", "0.56078887", "0.5597064", "0.55683905", "0.55455995", "0.5535755", "0.5516132", "0.5508778", "0.5505782", "0.5504653", "0.5490605", "0.54807174", "0.54595953", "0.54483986", "0.54103464", "0.5403549", "0.5399848", "0.5391163", "0.5381515", "0.5380605", "0.53764504", "0.5372525", "0.53650016", "0.5354296", "0.5339052", "0.5334127", "0.53294396", "0.5313978", "0.5310463", "0.53000754", "0.5291781", "0.52887934", "0.5284659", "0.528412", "0.52777934", "0.52674127", "0.5259717", "0.5253864", "0.525209", "0.5250072", "0.5249471", "0.5244187", "0.52359027", "0.5230256", "0.5225413", "0.52056277", "0.5189278", "0.5187339", "0.5184418", "0.5181825", "0.516983", "0.51682556", "0.516455", "0.5160054", "0.515416", "0.5153762", "0.5148332", "0.51429766", "0.51371706", "0.5135347", "0.5135222", "0.51227576", "0.5121476", "0.5110364", "0.51075923", "0.5107015", "0.5101272", "0.51001006", "0.5099131", "0.5097589", "0.50795996", "0.50758344", "0.50734997", "0.5073488", "0.5069186", "0.5065014", "0.50636053", "0.5062538", "0.5061771", "0.50614417", "0.5061114", "0.505759", "0.5055909", "0.5054424", "0.50520575", "0.50502914" ]
0.59593093
5
Method added to find 123Banking payment typeKishor
public WebElement select123BankingPaymentType(String banks123) { return findElement(modifyPageElement(repositoryParser, PAGE_NAME, "123Banking", banks123)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getJP_BankAccountType();", "public String getBankAccountType();", "@Query(value = \"from BankAccount where dtype = 'BankAccount' and user_id = :id\")\n Optional<BankAccount> findBankAccountByUserAndType(Long id);", "public abstract List<CustomerType> findCustomerTypebyCustomerTypeNumber(String searchString);", "public PaymentTypeObject getPaymentType(int payment_type_id) throws AppException;", "public String getJP_BankDataCustomerCode2();", "public void queryByPaymentType(String payType) {\n\t\tPAYMENT_TYPE = payType;\n\t}", "public String getJP_BankDataCustomerCode1();", "public boolean findType(BikeType type){ //Checks if the same name and rental price is registered - true if it's found\n try(Connection con = DatabaseConnector.getConnection();\n PreparedStatement ps = con.prepareStatement(FIND_TYPE)){\n \n ps.setString(1, type.getTypeName());\n ps.setDouble(2, type.getRentalPrice());\n ResultSet rs = ps.executeQuery();\n if(rs.isBeforeFirst()){\n return true;\n }\n }catch(Exception e){\n System.out.println(\"Exception: \" + e);\n }\n return false;\n }", "java.lang.String getBankNo();", "public ArrayList<PaymentTypeObject> getPaymentTypes(PaymentTypeObject paymenttype_obj) throws AppException;", "IBank getBank(int rekeningNr) throws RemoteException;", "Optional<BankBranch> getByCode(String code) throws ObjectNotFoundException;", "Databank getBank();", "public void setBankAccountType (String BankAccountType);", "public List<HCLFieldTransaction> getTransactionbyType(String transactionType)\r\n\t\t\tthrows JsonProcessingException, IOException {\r\n\r\n\t\tlogger.info(\"Logger Name: getTransactionbyType() :: \" + logger.getName());\r\n\t\tlogger.debug(\"Transaction Type : getTransactionbyType() :: \" + transactionType);\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\r\n\t\tlogger.info(\"Open Bank API URL :: getTotalAmountbyTransactionType() :: \"\r\n\t\t\t\t+ TransactionConstant.THIRD_PARTY_REST_API);\r\n\t\tJsonNode root = mapper.readTree(new URL(TransactionConstant.THIRD_PARTY_REST_API));\r\n\r\n\t\tList<HCLFieldTransaction> transactionList = new ArrayList<HCLFieldTransaction>();\r\n\r\n\t\t/* Traversing Nested JSON node to publish the relevant data */\r\n\t\ttry {\r\n\t\t\tJsonNode transactionsNodes = root.path(\"transactions\");\r\n\r\n\t\t\tfor (JsonNode transactionsNode : transactionsNodes) {\r\n\r\n\t\t\t\tHCLFieldTransaction hclFieldTransaction = new HCLFieldTransaction();\r\n\t\t\t\tJsonNode details = transactionsNode.path(\"details\");\r\n\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\r\n\t\t\t\t/* When transactionType is null or empty */\r\n\t\t\t\tif (transactionType == null && details.path(\"type\").isNull() == true) {\r\n\t\t\t\t\thclFieldTransaction.setId(transactionsNode.path(\"id\").asText());\r\n\r\n\t\t\t\t\tJsonNode thisAccount_Node = transactionsNode.path(\"this_account\");\r\n\t\t\t\t\thclFieldTransaction.setAccountId(thisAccount_Node.path(\"id\").asText());\r\n\r\n\t\t\t\t\tJsonNode otherAccount_Node = transactionsNode.path(\"other_account\");\r\n\t\t\t\t\thclFieldTransaction.setCounterpartyAccount(otherAccount_Node.path(\"number\").asText());\r\n\r\n\t\t\t\t\tJsonNode otherAccount_holder_Node = otherAccount_Node.path(\"holder\");\r\n\t\t\t\t\thclFieldTransaction.setCounterpartyName(otherAccount_holder_Node.path(\"name\").asText());\r\n\t\t\t\t\tJsonNode metadata = otherAccount_Node.path(\"metadata\");\r\n\t\t\t\t\thclFieldTransaction.setCounterPartyLogoPath(metadata.path(\"open_corporates_URL\").asText());\r\n\r\n\t\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\t\t\t\t\thclFieldTransaction.setDescription(details.path(\"description\").asText());\r\n\r\n\t\t\t\t\tJsonNode value = details.path(\"value\");\r\n\t\t\t\t\thclFieldTransaction.setInstructedAmount(value.path(\"amount\").asDouble());\r\n\r\n\t\t\t\t\thclFieldTransaction.setInstructedCurrency(value.path(\"currency\").asText());\r\n\r\n\t\t\t\t\thclFieldTransaction.setTransactionAmount(value.path(\"amount\").asDouble());\r\n\t\t\t\t\thclFieldTransaction.setTransactionCurrency(value.path(\"currency\").asText());\r\n\t\t\t\t\tlogger.debug(\"Transaction Field Row Value:: \" + hclFieldTransaction.toString());\r\n\r\n\t\t\t\t\t/* Adding specific type of transaction list into one ArrayList */\r\n\t\t\t\t\ttransactionList.add(hclFieldTransaction);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/* When transactionType is not null or empty */\r\n\t\t\t\telse if (transactionType != null) {\r\n\r\n\t\t\t\t\tif (hclFieldTransaction.getTransactionType().equalsIgnoreCase(transactionType.trim())) {\r\n\r\n\t\t\t\t\t\tlogger.debug(\"Transaction Type :: \" + transactionType);\r\n\t\t\t\t\t\thclFieldTransaction.setId(transactionsNode.path(\"id\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode thisAccount_Node = transactionsNode.path(\"this_account\");\r\n\t\t\t\t\t\thclFieldTransaction.setAccountId(thisAccount_Node.path(\"id\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode otherAccount_Node = transactionsNode.path(\"other_account\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterpartyAccount(otherAccount_Node.path(\"number\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode otherAccount_holder_Node = otherAccount_Node.path(\"holder\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterpartyName(otherAccount_holder_Node.path(\"name\").asText());\r\n\t\t\t\t\t\tJsonNode metadata = otherAccount_Node.path(\"metadata\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterPartyLogoPath(metadata.path(\"open_corporates_URL\").asText());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\t\t\t\t\t\thclFieldTransaction.setDescription(details.path(\"description\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode value = details.path(\"value\");\r\n\t\t\t\t\t\thclFieldTransaction.setInstructedAmount(value.path(\"amount\").asDouble());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setInstructedCurrency(value.path(\"currency\").asText());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionAmount(value.path(\"amount\").asDouble());\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionCurrency(value.path(\"currency\").asText());\r\n\t\t\t\t\t\tlogger.debug(\"Transaction Field Row Value:: \" + hclFieldTransaction.toString());\r\n\r\n\t\t\t\t\t\t/* Adding specific type of transaction list into one ArrayList */\r\n\t\t\t\t\t\ttransactionList.add(hclFieldTransaction);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.error(\"Exception : getTransactionbyType() :: \", e);\r\n\t\t}\r\n\t\tlogger.info(\"Return value from service layer:: getTransactionbyType() :: \" + transactionList.toString());\r\n\t\treturn transactionList;\r\n\r\n\t}", "public abstract PaymentType getPaymentType();", "List selectByExample(CusBankAccountExample example);", "@Override\n public List<Bank> find(String name) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }", "public Currency findCurrencyByCode(String currency);", "List getKeyBy(PaymentTradeExample example);", "@Test\n void testFindBySymbol() {\n String symbol = service.findAll().stream().findAny().get().getSymbol();\n Currency currency = service.findBySymbol(symbol);\n assertNotNull(currency);\n assertEquals(symbol, currency.getSymbol());\n }", "public BikeType getType(int typeId){\n try(Connection con = DatabaseConnector.getConnection();\n PreparedStatement ps = con.prepareStatement(TYPE_BY_ID + typeId);\n ResultSet rs = ps.executeQuery()){\n \n if(rs.next()){\n BikeType type = new BikeType(rs.getString(cTypeName),rs.getDouble(cRentalPrice));\n type.setTypeId(rs.getInt(cTypeId));\n return type;\n }\n\n }catch(Exception e){\n System.out.println(\"Exception: \" + e);\n }\n return null;\n }", "public void setJP_BankAccountType (String JP_BankAccountType);", "public abstract java.util.Set getPaymentTypes();", "Payment find(int paymentID);", "public int getRequestableBank() \n {\n return -1; \n }", "@Override\n\tpublic String queryWaybillTypeByOrderNo(String orderNo) {\n\t\treturn null;\n\t}", "@Test\n public void testFindByCardType(){\n \tCardType rentType = new CardType();\n \trentType.setId(\"RENT_HOUSE\");\n \trentType.persist();\n \t\n \tCardType saleType = new CardType();\n \tsaleType.setId(\"SALE_HOUSE\");\n \tsaleType.persist();\n \t\n \t//Se crean varias tarjetas, asociadas a estos dos tipos\n \t//De tipo alquiler se crean dos tarjetas\n \t//De tipo venta se crea una tarjeta\n \tCardDataOnDemand data = new CardDataOnDemand();\n \tCard card = data.getNewTransientCard(0);\n \tcard.setCardType(rentType);\n \tcard.persist();\n \t\n \tcard = data.getNewTransientCard(1);\n \tcard.setCardType(rentType);\n \tcard.persist();\n \t\n \tcard = data.getNewTransientCard(2);\n \tcard.setCardType(saleType);\n \tcard.persist();\n \t\n \tcard.flush();\n \tcard.clear();\n \t\n \tassertEquals(2, Card.findCardsByCardType(rentType).getResultList().size());\n \tassertEquals(1, Card.findCardsByCardType(saleType).getResultList().size());\n }", "List getKeyBy(PaymentTradeExampleExtended example);", "List<BankWallet> findByUser(User user);", "@Override\r\n\tpublic XftPayment selectByNo(String payNo, String payType) {\n\t\treturn xftPaymentMapper.selectByNo(payNo, payType);\r\n\t}", "io.opencannabis.schema.commerce.Payments.PaymentMethod getMethod();", "BusinessRepayment selectByPrimaryKey(String id);", "public abstract String getCurrencyType();", "List<CardTypeDTO> lookupCardTypes();", "Account findByAccountType(String accountType);", "BankAccountDTO getCustomerBankAccountDetails(Long slNo);", "public int getJP_BankData_ID();", "public PaymentTypeObject[] getAllPaymentTypes() throws AppException;", "public int findGameTypeBySerialNo(String serialNo) throws ApplicationException;", "public TransactionType findTxnTypeById(int parseLong);", "List<AccountTypeDTO> lookupAccountTypes();", "CabinClassModel findCabinClass(String cabinCode);", "public int getBank(byte[] bankSysex) \n {\n return -1; \n }", "@Override\r\n protected String getPrymaryType(Integer key) {\r\n return NodeTypes.SECTOR.getId();\r\n }", "public String getJP_BankAccount_Value();", "SellType selectByPrimaryKey(Integer sell_type_id);", "public Kind findByType(String type) {\n\t\tString hql=\"from Kind k where k.type=:type\";\n\t\tKind kind = sessionFactory.getCurrentSession().createQuery(hql,Kind.class).setParameter(\"type\", type).uniqueResult();\t\t\n\t\treturn kind;\n\t}", "List selectByExample(PaymentTradeExample example);", "IBank getBankFromName(String bankName) throws RemoteException;", "ResultSet searchType(String type) {\n \ttry {\n \t\tStatement search = this.conn.createStatement();\n \tString query = \"SELECT * \"\n \t\t\t+ \"FROM Pokemon AS P, Types AS T \"\n \t\t\t+ \"WHERE (P.Type1=T.TypeID OR P.Type2 = T.TypeID) AND \"\n \t\t\t+ \"T.name = \" + \"'\" + type + \"'\";\n \t\n \treturn search.executeQuery(query);\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n }", "public interface CardRepository extends JpaRepository<HouseAccountCreditCardAccount,String> {\r\n HouseAccountCreditCardAccount findByBuyerIdAndServiceAccountNumberAndSourceSystem(String buyerId, Long serviceAccountNumber, String sourceSystem);\r\n}", "public int getC_BankAccount_ID();", "List<BankUserInfo> selectByExample(BankUserInfoExample example);", "public IBankTransfert payment();", "@Override\r\n\tpublic ArrayList<BankAccountVO> getBankAccountVOListByKey(String key) {\n\t\tif(key.equals(\"ss\")){\r\n\t\t\tArrayList<BankAccountVO> BAVOList = new ArrayList<>();\r\n\t\t\tBAVOList.add(new BankAccountVO(\"ss141250110\",20000));\r\n\t\t\treturn BAVOList;\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "@Override\n public byte getType() {\n return TYPE_PAYMENT;\n }", "Basicinfo selectByPrimaryKey(String taxregcode);", "Optional<BankBranch> getByName(String name) throws ObjectNotFoundException;", "OrderDetailBean getSearchOrderById(long orderIdi,String userLogin,int paymenttype) throws SQLException, Exception, RemoteException;", "@Override\r\n\tpublic List<AsxDataVO> findByType(int type) {\n\t\treturn mongoTemplate.find(new Query(Criteria.where(\"type\").is(type)), AsxDataVO.class);\r\n\t}", "private PaymentType(String payment) {\n this.payment = payment;\n }", "java.lang.String getBankName();", "List<Lbm83ChohyokanriPkey> selectByExample(Lbm83ChohyokanriPkeyExample example);", "private TreeObject find(String name, int type) {\n\t return widgetRoots[type - 1].find(name);\n\t}", "public void searchByAccount() {\n\t\t\n\t\tlog.log(Level.INFO, \"Please Enter the account number you want to search: \");\n\t\tint searchAccountNumber = scan.nextInt();\n\t\tbankop.search(searchAccountNumber);\n\n\t}", "BuildingBlock findBuildingBlockByTypeAndCode(BuildingBlockConstant buildingBlockType, String code) throws BusinessException;", "List<ErpOaLicKey> selectByExample(ErpOaLicKeyExample example);", "@org.jetbrains.annotations.NotNull()\n public abstract java.util.List<java.lang.String> getPaymentMethodTypes();", "@Override\n\tpublic WaybillExpressEntity queryWaybillByWaybillNo(String waybillNo,\n\t\t\tString returnType) {\n\t\treturn null;\n\t}", "SyncRecord findObject(String name, int type) throws NotFoundException\r\n\t{\r\n\t\tfor (int i=0; i<syncTable.size(); i++)\r\n\t\t{\r\n\t\t\tSyncRecord myrec = (SyncRecord)syncTable.elementAt(i);\r\n\t\t\tif ((myrec.name).equals(name) && (myrec.type)==type)\r\n\t\t\t\treturn myrec;\r\n\t\t}\r\n\t\tthrow new NotFoundException();\r\n\t}", "public String getJP_BankName_Kana_Line();", "@NotNull(message = \"{NotNull.gov.nih.nci.calims2.domain.administration.customerservice.BillingInformation.type}\")\n \n @ManyToOne(fetch = FetchType.LAZY)\n@JoinColumn(name = \"TYPE_FK\")\[email protected](name = \"BILLINTYPE_FK\")\n\n public gov.nih.nci.calims2.domain.common.Type getType() {\n return type;\n }", "@org.jetbrains.annotations.Nullable()\n @kotlin.jvm.JvmStatic()\n public final com.stripe.android.view.NetbankingBank get(@org.jetbrains.annotations.Nullable()\n java.lang.String bankCode) {\n return null;\n }", "public interface MemberBankcardService {\n /**\n * 根据MemberId来获取用户银行卡List信息集\n * @param memberId\n * */\n List<MemberBankcard> selectByMemberId(Long memberId);\n /**\n * 检测银行卡信息是否正确\n * */\n String checkBankcard(MemberBankcard memberBankcard);\n /**\n * 添加新的银行卡\n * */\n int addBankcard(MemberBankcard memberBankcard);\n\n /**\n * 清除绑定卡 设置还款卡或放款卡\n * */\n int bindBankCard(Long memberId,Long cardId,Long bindType);\n /**\n * 检查账户是否拥有到账卡 返回卡id\n * */\n Long checkMemberBankcard(Long memberId);\n int updateBankCard(MemberBankcard memberBankcard);\n\n List<MemberBankcard> queryBankcard(MemberBankcard memberBankcard);\n\n Boolean valid(Long memberId);\n\n MemberBankcard selectByPrimaryKey(Long id);\n\n MemberBankcard selectByMemberIdAndBindType(Long memberId,Long bindType);\n\n MemberBankcard selectWithhold(Long memberId);\n\n MemberBankcard selectByUidBankNumber(Long memberId,String bankcardNumber);\n\n}", "@Override\n\tpublic List<PageData> getbanji_type(PageData pd) throws Exception {\n\t\treturn (List<PageData>) dao.findForList(\n\t\t\t\t\"SummaryStatMapper.getbanji_type\", pd);\n\t}", "TokenlyCurrency getCurrencyType();", "List<RepaymentPlanInfoUn> selectByExample(RepaymentPlanInfoUnExample example);", "public TypeBatterieAES rechercheTypeBatterieaes(String Num) {\n\t\tint Numero = Integer.parseInt(Num);\n\t\tTypeBatterieAES T = em.find(TypeBatterieAES.class, Numero);\n\t\treturn T;\n\t}", "cb.Careerbuilder.Company.PhoneType getType();", "public static final TransactionType findTransactionType(byte type, byte subtype) {\n TransactionType txType = null;\n switch (type) {\n case TYPE_PAYMENT:\n switch (subtype) {\n case SUBTYPE_PAYMENT_ORDINARY_PAYMENT:\n txType = Payment.ORDINARY;\n break;\n }\n break;\n case TYPE_MESSAGING:\n switch (subtype) {\n case SUBTYPE_MESSAGING_ARBITRARY_MESSAGE:\n txType = Messaging.ARBITRARY_MESSAGE;\n break;\n case SUBTYPE_MESSAGING_ALIAS_ASSIGNMENT:\n txType = Messaging.ALIAS_ASSIGNMENT;\n break;\n case SUBTYPE_MESSAGING_POLL_CREATION:\n txType = Messaging.POLL_CREATION;\n break;\n case SUBTYPE_MESSAGING_VOTE_CASTING:\n txType = Messaging.VOTE_CASTING;\n break;\n case SUBTYPE_MESSAGING_HUB_ANNOUNCEMENT:\n txType = Messaging.HUB_ANNOUNCEMENT;\n break;\n case SUBTYPE_MESSAGING_ACCOUNT_INFO:\n txType = Messaging.ACCOUNT_INFO;\n break;\n case SUBTYPE_MESSAGING_ALIAS_SELL:\n txType = Messaging.ALIAS_SELL;\n break;\n case SUBTYPE_MESSAGING_ALIAS_BUY:\n txType = Messaging.ALIAS_BUY;\n break;\n case SUBTYPE_MESSAGING_ALIAS_DELETE:\n txType = Messaging.ALIAS_DELETE;\n break;\n case SUBTYPE_MESSAGING_PHASING_VOTE_CASTING:\n txType = Messaging.PHASING_VOTE_CASTING;\n break;\n }\n break;\n case TYPE_COLORED_COINS:\n switch (subtype) {\n case SUBTYPE_COLORED_COINS_ASSET_ISSUANCE:\n txType = ColoredCoins.ASSET_ISSUANCE;\n break;\n case SUBTYPE_COLORED_COINS_ASSET_TRANSFER:\n txType = ColoredCoins.ASSET_TRANSFER;\n break;\n case SUBTYPE_COLORED_COINS_ASK_ORDER_PLACEMENT:\n txType = ColoredCoins.ASK_ORDER_PLACEMENT;\n break;\n case SUBTYPE_COLORED_COINS_BID_ORDER_PLACEMENT:\n txType = ColoredCoins.BID_ORDER_PLACEMENT;\n break;\n case SUBTYPE_COLORED_COINS_ASK_ORDER_CANCELLATION:\n txType = ColoredCoins.ASK_ORDER_CANCELLATION;\n break;\n case SUBTYPE_COLORED_COINS_BID_ORDER_CANCELLATION:\n txType = ColoredCoins.BID_ORDER_CANCELLATION;\n break;\n case SUBTYPE_COLORED_COINS_DIVIDEND_PAYMENT:\n txType = ColoredCoins.DIVIDEND_PAYMENT;\n break;\n }\n break;\n case TYPE_DIGITAL_GOODS:\n switch (subtype) {\n case SUBTYPE_DIGITAL_GOODS_LISTING:\n txType = DigitalGoods.LISTING;\n break;\n case SUBTYPE_DIGITAL_GOODS_DELISTING:\n txType = DigitalGoods.DELISTING;\n break;\n case SUBTYPE_DIGITAL_GOODS_PRICE_CHANGE:\n txType = DigitalGoods.PRICE_CHANGE;\n break;\n case SUBTYPE_DIGITAL_GOODS_QUANTITY_CHANGE:\n txType = DigitalGoods.QUANTITY_CHANGE;\n break;\n case SUBTYPE_DIGITAL_GOODS_PURCHASE:\n txType = DigitalGoods.PURCHASE;\n break;\n case SUBTYPE_DIGITAL_GOODS_DELIVERY:\n txType = DigitalGoods.DELIVERY;\n break;\n case SUBTYPE_DIGITAL_GOODS_REFUND:\n txType = DigitalGoods.REFUND;\n break;\n case SUBTYPE_DIGITAL_GOODS_FEEDBACK:\n txType = DigitalGoods.FEEDBACK;\n break;\n }\n break;\n case TYPE_ACCOUNT_CONTROL:\n switch (subtype) {\n case SUBTYPE_ACCOUNT_CONTROL_EFFECTIVE_BALANCE_LEASING:\n txType = AccountControl.EFFECTIVE_BALANCE_LEASING;\n break;\n }\n break;\n case TYPE_MONETARY_SYSTEM:\n switch (subtype) {\n case SUBTYPE_MONETARY_SYSTEM_CURRENCY_ISSUANCE:\n txType = MonetarySystem.CURRENCY_ISSUANCE;\n break;\n case SUBTYPE_MONETARY_SYSTEM_RESERVE_INCREASE:\n txType = MonetarySystem.RESERVE_INCREASE;\n break;\n case SUBTYPE_MONETARY_SYSTEM_RESERVE_CLAIM:\n txType = MonetarySystem.RESERVE_CLAIM;\n break;\n case SUBTYPE_MONETARY_SYSTEM_CURRENCY_TRANSFER:\n txType = MonetarySystem.CURRENCY_TRANSFER;\n break;\n case SUBTYPE_MONETARY_SYSTEM_PUBLISH_EXCHANGE_OFFER:\n txType = MonetarySystem.PUBLISH_EXCHANGE_OFFER;\n break;\n case SUBTYPE_MONETARY_SYSTEM_EXCHANGE_BUY:\n txType = MonetarySystem.EXCHANGE_BUY;\n break;\n case SUBTYPE_MONETARY_SYSTEM_EXCHANGE_SELL:\n txType = MonetarySystem.EXCHANGE_SELL;\n break;\n case SUBTYPE_MONETARY_SYSTEM_CURRENCY_MINTING:\n txType = MonetarySystem.CURRENCY_MINTING;\n break;\n case SUBTYPE_MONETARY_SYSTEM_CURRENCY_DELETION:\n txType = MonetarySystem.CURRENCY_DELETION;\n break;\n }\n case TYPE_DATA:\n switch (subtype) {\n case SUBTYPE_DATA_TAGGED_DATA_UPLOAD:\n txType = Data.TAGGED_DATA_UPLOAD;\n break;\n case SUBTYPE_DATA_TAGGED_DATA_EXTEND:\n txType = Data.TAGGED_DATA_EXTEND;\n break;\n }\n }\n return txType;\n }", "public String getJP_BankData_ReferenceNo();", "public <T extends BusinessObject> T findByPrimaryKeyUsingKeyObject(Class<T> clazz, Object pkObject) {\r\n\t\tthrow new UnsupportedOperationException(\"OJB does not support this option\");\r\n\t}", "public SubpType // (##6)\nfindSubpType();", "List<Kaiwa> selectByExample(KaiwaExample example);", "public PaymentType(String paymentType) {\n\t\tsuper();\n\t\tthis.paymentType = paymentType;\n\t}", "public Integer addPaymentType(PaymentTypeObject paymentTypeObject) throws AppException;", "@Query(\"SELECT b FROM UtilisateurOperateurKamtar b WHERE b.email = :email AND b.codePays = :pays\")\n\tUtilisateurOperateurKamtar findByEmail(@Param(\"email\") String email, @Param(\"pays\") String pays);", "BankUserInfo selectByPrimaryKey(String bankUserId);", "public interface BankCardService {\n /**\n * 根据主账号id,查询微店的银行卡信息\n *\n * @api {dubbo} com.pzj.core.customer.bankcard.BankCardService#queryMicroshopBankCardByOwnerid 查询主账号的银行卡信息\n * @apiGroup 银行卡服务\n * @apiVersion 1.3.0\n * @apiDescription\n * <p>\n * 根据主账号id,查询微店的银行卡信息。\n * </p>\n *\n * @apiParam {Long} ownerId 主账号id\n *\n * @apiParamExample {json} 参数示例\n *\n * {\n * \"id\" : 48381023784545\n * }\n *\n * @apiSuccess (响应数据) {int} errorCode 错误码\n * @apiSuccess (响应数据) {String} errorMsg 错误说明\n * @apiSuccess (响应数据) {BankCardDetailResponse} data 银行卡信息。\n *\n * @apiSuccessExample {json} 响应数据示例\n *\n * {\n * \"errorCode\" : 10000,\n * \"errorMsg\" : null,\n * \"data\" : {\n * \"id\" : 123,\n * \"ownerId\" : 48381023784545,\n * \"accountHolder\" : \"张三\",\n * \"idNum\" : \"14010919999999\",\n * \"bank\" : \"农行\",\n * \"cardNum\" : “596432034334”,\n * }\n * }\n *\n * @apiError (错误码说明) 1 1。\n *\n * @param ownerId\n * @return\n */\n Result<BankCardDetailResponse> queryMicroshopBankCardByOwnerid(Long ownerId);\n\n /**\n * 创建微店的银行卡信息\n *\n * @api {dubbo} com.pzj.core.customer.bankcard.BankCardService#createMicroshopBankCard 创建微店的银行卡信息\n * @apiGroup 银行卡服务\n * @apiVersion 1.3.0\n * @apiDescription\n * <p>\n * 创建微店的银行卡信息,目前只能创建一份。\n * </p>\n *\n * @apiParam {String} accountHolder 开户人\n * @apiParam {String} idNum 身份证号\n * @apiParam {String} bank 银行名称\n * @apiParam {String} cardNum 银行卡号\n * @apiParam {Integer} dataSource 创建系统\n * @apiParam {Long} operator 创建人id\n *\n * @apiParamExample {json} 参数示例\n *\n * {\n * \"accountHolder\" : \"张三\",\n * \"idNum\" : \"14010919999999\",\n * \"bank\" : \"农行\",\n * \"cardNum\" : \"596432034334\",\n * \"dataSource\" : 1,\n * \"id\" : 48381023784545\n * }\n *\n * @apiSuccess (响应数据) {int} errorCode 错误码\n * @apiSuccess (响应数据) {String} errorMsg 错误说明\n * @apiSuccess (响应数据) {Long} data 银行卡id。\n *\n * @apiSuccessExample {json} 响应数据示例\n *\n * {\n * \"errorCode\" : 10000,\n * \"errorMsg\" : null,\n * \"data\" : 123\n * }\n *\n * @apiError (错误码说明) 1 1。\n *\n * @param request\n * @return\n */\n Result<Long> createMicroshopBankCard(CreateBankCardRequest request);\n\n /**\n * 修改微店的银行卡信息\n *\n * @api {dubbo} com.pzj.core.customer.bankcard.BankCardService#modifyMicroshopBankCard 修改微店的银行卡信息\n * @apiGroup 银行卡服务\n * @apiVersion 1.3.0\n * @apiDescription\n * <p>\n * 修改微店的银行卡信息。\n * </p>\n *\n * @apiParam {Long} dataSource 银行卡id\n * @apiParam {String} accountHolder 开户人\n * @apiParam {String} idNum 身份证号\n * @apiParam {String} bank 银行名称\n * @apiParam {String} cardNum 银行卡号\n * @apiParam {Long} operator 创建人id\n *\n * @apiParamExample {json} 参数示例\n *\n * {\n * \"id\" : 123,\n * \"accountHolder\" : \"张三\",\n * \"idNum\" : \"14010919999999\",\n * \"bank\" : \"农行\",\n * \"cardNum\" : \"596432034334\",\n * \"id\" : 48381023784545\n * }\n *\n * @apiSuccess (响应数据) {int} errorCode 错误码\n * @apiSuccess (响应数据) {String} errorMsg 错误说明\n * @apiSuccess (响应数据) {Boolean=true:成功,false:失败} data 是否修改成功。\n *\n * @apiSuccessExample {json} 响应数据示例\n *\n * {\n * \"errorCode\" : 10000,\n * \"errorMsg\" : null,\n * \"data\" : true\n * }\n *\n * @apiError (错误码说明) 1 1。\n *\n * @param request\n * @return\n */\n Result<Boolean> modifyMicroshopBankCard(ModifyBankCardRequest request);\n}", "List<CustomerDDPay> selectCustomerDDPay(CustomerDDPay cddp);", "public interface DlContTypeSetRepository extends JpaRepository<DlContTypeSet,Long> {\n\n @Query(\"select dlContTypeSet from DlContTypeSet dlContTypeSet where dlContTypeSet.name = :name\")\n Optional<DlContTypeSet> findOneByName(@Param(\"name\") String name);\n\n @Query(\"select dlContTypeSet from DlContTypeSet dlContTypeSet where dlContTypeSet.code = :code\")\n Optional<DlContTypeSet> findOneByCode(@Param(\"code\") String code);\n\n @Query(\"select dlContTypeSet from DlContTypeSet dlContTypeSet where dlContTypeSet.pStatus = 1 \")\n Page<DlContTypeSet> activecontenttypes(org.springframework.data.domain.Pageable pageable);\n\n\n}", "@org.jetbrains.annotations.Nullable()\n @kotlin.jvm.JvmStatic()\n public static final com.stripe.android.view.NetbankingBank get(@org.jetbrains.annotations.Nullable()\n java.lang.String bankCode) {\n return null;\n }", "shared.data.Bank getBank();", "Collection<Transaction> findAllByTransactiontype(int type, Sort sort);", "io.opencannabis.schema.commerce.CommercialOrder.OrderType getType();", "public interface OrderPaymentTypeService {\n\n List<OrderPaymentType> getAllOrderPaymentTypes();\n\n OrderPaymentType getOrderTypeByName(String name);\n\n\n}", "protected String createFindBy(String nume) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(\"SELECT \");\n\t\tsb.append(\" * \");\n\t\tsb.append(\" FROM \");\n\t\tsb.append(type.getSimpleName());\n\t\tsb.append(\" WHERE \");\n\t\treturn sb.toString();\n\t}", "public Integer updatePaymentType(PaymentTypeObject paymentTypeObject) throws AppException;" ]
[ "0.63523895", "0.63179463", "0.6026707", "0.59641117", "0.5916973", "0.58872694", "0.58485734", "0.58483547", "0.58290863", "0.574936", "0.57185453", "0.5711788", "0.56769526", "0.56745446", "0.5564812", "0.5562833", "0.55610406", "0.55431664", "0.5513235", "0.5493611", "0.5473824", "0.5460611", "0.54591346", "0.541171", "0.54065573", "0.5396427", "0.53881913", "0.5377768", "0.5369897", "0.5363708", "0.53592193", "0.53269786", "0.5324693", "0.5320113", "0.53026897", "0.529647", "0.52668667", "0.525705", "0.52555597", "0.5249299", "0.52399874", "0.52368987", "0.5228463", "0.521006", "0.52027726", "0.52014965", "0.5187692", "0.5162987", "0.51550364", "0.5139094", "0.5130662", "0.5128807", "0.51269543", "0.51190376", "0.5112444", "0.5099214", "0.5098712", "0.50969464", "0.5094629", "0.5092124", "0.50913703", "0.508517", "0.5081871", "0.5080008", "0.50799567", "0.5066877", "0.505457", "0.50477654", "0.50430995", "0.5039913", "0.5039749", "0.5033183", "0.5031496", "0.5026554", "0.5024815", "0.50154", "0.50010985", "0.49922392", "0.49902186", "0.49872562", "0.49830154", "0.49825904", "0.49763972", "0.49511623", "0.49504843", "0.4950428", "0.49474785", "0.49414036", "0.49412075", "0.49385554", "0.49372464", "0.49366105", "0.49353158", "0.49319926", "0.49315158", "0.4919756", "0.49193594", "0.49176458", "0.4917352", "0.4914322" ]
0.57497215
9
Selecting bank transfer paymodeKishor
public WebElement bankTransferPaymentMode() { return findElement(repositoryParser, PAGE_NAME, "bankTransfer"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void changeBanksForPayment(){\n\t\t\tgetLocalBankListforIndicator();\n\t\t\tsetPaymentmodeId(null);\n\t\t\tif(getPaymentCode()!=null && getPaymentCode().equalsIgnoreCase(\"B\"))\n\t\t\t{\n\t\t\t\t\n\t\t\t\tsetBooChequePanel(true);\n\t\t\t\tsetBooCardPanel(false);\n\t\t\t\tsetRemitamount(null);\n\t\t\t\tBigDecimal PaymentId=placeOrderPendingTransctionService.toFetchPaymentId(getPaymentCode());\n\t\t\t\tsetPaymentmodeId(PaymentId);\n\t\t\t\t//clearKnetDetails();\n\t\t\t}else\n\t\t\t{\n\t\t\t\tsetBooChequePanel(false);\n\t\t\t\tsetBooCardPanel(true);\n\t\t\t\tsetRemitamount(null);\n\t\t\t\tBigDecimal PaymentId=placeOrderPendingTransctionService.toFetchPaymentId(getPaymentCode());\n\t\t\t\tsetPaymentmodeId(PaymentId);\n\t\t\t}\n\t\t\tsetBooRenderSaveOrExit(true);\n\t\t}", "public void setPaymentMethodCode_BankTransfer() {\n setPaymentMethodCodeAsPaymentMethod(AppCDef.PaymentMethod.BankTransfer);\n }", "public boolean selectBankAccount(String bankAccount, String user, int choose);", "public IBankTransfert payment();", "public boolean selectExisitingAccount(int choice, String bankAccount);", "public WebElement selectSavedCardPaymentMode() {\n\t\treturn wait.until(ExpectedConditions.elementToBeClickable(findElement(\n\t\t\t\trepositoryParser, PAGE_NAME, \"savedCard\")));\n\t}", "@When(\"user selects on AndhraBank\")\r\n\tpublic void usert_selects_on_Andhrabank() throws InterruptedException {\n\t\tdriver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);\r\n\t\t//driver.findElement(By.xpath(\"//div[@id='swit']/div[1]/label/i\")).click();\r\n\t\tdriver.findElement(By.xpath(\"//label[contains(text(),'Andhra Bank')]\")).click();\r\n\t}", "public void setTransactionType(int transactionChoice);", "@FXML\n void selectMoneyMarket(ActionEvent event) {\n \tdirectDep.setSelected(false);\n \tisLoyal.setSelected(false);\n \tdirectDep.setDisable(true);\n \tisLoyal.setDisable(true);\n }", "public void selectPaymentMethod(String payment) {\n\t\tif (payment == \"Cashless\")\n\t\t\tdriver.findElement(By.id(\"payBtn1\")).click();\n\t\tif (payment == \"Cash\")\n\t\t\tdriver.findElement(By.id(\"payBtn2\")).click();\n\t\tif (payment == \"Special\")\n\t\t\tdriver.findElement(By.id(\"payBtn3\")).click();\n\t}", "Databank getBank();", "public boolean isPaymentMethodCodeBankTransfer() {\n AppCDef.PaymentMethod cdef = getPaymentMethodCodeAsPaymentMethod();\n return cdef != null ? cdef.equals(AppCDef.PaymentMethod.BankTransfer) : false;\n }", "public void teste() {\n\t\tSelect billingMasterPolicy = new Select(comboBillingMasterPolicy);\n\t\tWebElement WebL = billingMasterPolicy.getFirstSelectedOption();\n\t\tString planoRisco = WebL.getAttribute(\"text\");\n\t\tSystem.out.println(\"Teste: \"+ planoRisco);\n\t}", "private void doBankRequest(final String amount) {\n ParseObject bankRequest = new ParseObject(Constants.CLASS_TRANSACTIONS);\n bankRequest.put(Constants.CLASS_TRANSACTIONS_FROM, mCurrentUser);\n bankRequest.put(Constants.CLASS_TRANSACTIONS_TYPE, Constants.CLASS_TRANSACTIONS_TYPE_FUNDS_REQUEST_BANK);\n bankRequest.put(Constants.CLASS_TRANSACTIONS_AMOUNT, Integer.parseInt(amount));\n bankRequest.put(Constants.CLASS_TRANSACTIONS_RESOLUTION, false);\n bankRequest.saveInBackground(new SaveCallback() {\n @Override\n public void done(ParseException e) {\n mProgressBar.setVisibility(View.INVISIBLE);\n if (e == null) {\n\n bankRequestObject = new JSONObject();\n try {\n bankRequestObject.put(Constants.CLASS_TRANSACTIONS_FROM, mUserId);\n bankRequestObject.put(Constants.CLASS_TRANSACTIONS_TYPE, Constants.CLASS_TRANSACTIONS_TYPE_FUNDS_REQUEST_BANK);\n bankRequestObject.put(Constants.CLASS_TRANSACTIONS_AMOUNT, Integer.parseInt(amount));\n } catch (JSONException el) {\n el.printStackTrace();\n }\n\n saveTransaction(amount, Constants.CLASS_TRANSACTIONS_TYPE_FUNDS_REQUEST_BANK);\n\n Logger.s(getApplicationContext(), getString(R.string.request_sent_message_txt));\n IntentUtils.startActivity(RequestFundsActivity.this, HomeActivity.class);\n finish();\n } else if (e.getCode() == ParseException.CONNECTION_FAILED || e.getCode() == ParseException.TIMEOUT) {\n mButton.setEnabled(true);\n Logger.s(getApplicationContext(), getString(R.string.network_timeout_message_txt));\n } else {\n mButton.setEnabled(true);\n Logger.s(getApplicationContext(), getString(R.string.general_error_message_txt));\n }\n }\n });\n }", "public void chosePaymentMethod(String paymentMode) {\n\t\tswitch (paymentMode) {\n\t\tcase \"COD\":\n\t\t\tPayMethod = new cashOnDelivery();\n\t\n\t\t\tbreak;\n\t\t\t\n\t\tcase \"creditCard\":\n\t\t\tPayMethod = new creditCard();\n\t\t\t\n\t\t\tbreak;\n\t\t\t\n\t\tcase \"debitCard\":\n\t\t\tPayMethod = new debitCard();\n\t\n\t\t\tbreak;\n\t\t\t\n\t\tcase \"netBanking\":\n\t\t\tPayMethod =new netBanking();\n\t\t\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tPayMethod =null;\n\t\t\tbreak;\n\t\t}\n\n\t}", "public WebElement selectingBank(String bank) {\n\t\treturn findElement(modifyPageElement(repositoryParser, PAGE_NAME,\n\t\t\t\t\"selectingBank\", bank));\n\t}", "public Account transactionMenu(boolean transferOut){\r\n String typeOfAccount = null;\r\n int accountNum = 0;\r\n int numAccounts = -1;\r\n\r\n boolean selectionNotMade = true;\r\n while (selectionNotMade) {\r\n System.out.println(\"Select account type:\");\r\n if (!transferOut) {\r\n System.out.println(\" 1. Credit Card\");\r\n }\r\n System.out.println(\" 2. Line Of Credit\");\r\n System.out.println(\" 3. Chequing\");\r\n System.out.println(\" 4. Savings\");\r\n typeOfAccount = BankMachine.getInput();\r\n switch (typeOfAccount){\r\n case \"1\":\r\n if (!transferOut) {\r\n numAccounts = creditCounter;\r\n break;\r\n }\r\n case \"2\":\r\n numAccounts = lineOfCreditCounter;\r\n break;\r\n case \"3\":\r\n numAccounts = chequingCounter;\r\n break;\r\n case \"4\":\r\n numAccounts = savingCounter;\r\n break;\r\n default:\r\n System.out.println(\"INVALID ENTRY\");\r\n numAccounts = -1;\r\n break;\r\n }\r\n if (numAccounts == 0){\r\n System.out.println(\"You have no accounts of this type\\n\");\r\n } else if (numAccounts != -1){\r\n selectionNotMade = false;\r\n }\r\n }\r\n boolean accountLoop = true;\r\n System.out.println(\"Currently there are \" + numAccounts + \" of these accounts.\");\r\n while (accountLoop){\r\n System.out.println(\"Enter the number of the account you wish to access:\");\r\n String withdrawAccount = BankMachine.getInput();\r\n if (withdrawAccount.matches(\"-?\\\\d+\")){\r\n accountNum = Integer.parseInt(withdrawAccount);\r\n if (accountNum > 0 && accountNum <= numAccounts){\r\n accountLoop = false;\r\n }else{\r\n System.out.println(\"INVALID ENTRY\");\r\n }\r\n }\r\n else{\r\n System.out.println(\"INVALID ENTRY\");\r\n }\r\n }\r\n return getSpecifiedAccount(typeOfAccount, accountNum);\r\n }", "public double selectCurrentBalance(int choice, String getUser);", "public WebElement atmPaymode() {\n\t\treturn findElement(repositoryParser, PAGE_NAME, \"atmPay\");\n\t}", "public void setBank(Bank bank) {\r\n this.bank = bank;\r\n }", "public int getRequestableBank() \n {\n return -1; \n }", "public void selectDeal() {\n\t}", "private boolean allocatePaySelection() {\n /**\n *\n * \t\tModificación para diferenciar\n *\tcobros/pagos en Consulta de Asignación\n *\n */\n MAllocationHdr alloc;\n\n if (isReceipt()) {\n alloc = new MAllocationHdr(getCtx(), false, getDateTrx(), getC_Currency_ID(),\n Msg.translate(getCtx(), \"IsReceipt\") + \": \" + getDocumentNo() + \" [n]\", get_TrxName());\n } else {\n alloc = new MAllocationHdr(getCtx(), false, getDateTrx(), getC_Currency_ID(),\n Msg.translate(getCtx(), \"C_Payment_ID\") + \": \" + getDocumentNo() + \" [n]\", get_TrxName());\n }\n alloc.setAD_Org_ID(getAD_Org_ID());\n\n String sql = \"SELECT psc.C_BPartner_ID, psl.C_Invoice_ID, psl.IsSOTrx, \" //\t1..3\n + \" psl.PayAmt, psl.DiscountAmt, psl.DifferenceAmt, psl.OpenAmt \"\n + \"FROM C_PaySelectionLine psl\"\n + \" INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID) \"\n + \"WHERE psc.C_Payment_ID=?\";\n PreparedStatement pstmt = null;\n try {\n pstmt = DB.prepareStatement(sql, get_TrxName());\n pstmt.setInt(1, getC_Payment_ID());\n ResultSet rs = pstmt.executeQuery();\n while (rs.next()) {\n int C_BPartner_ID = rs.getInt(1);\n int C_Invoice_ID = rs.getInt(2);\n if (C_BPartner_ID == 0 && C_Invoice_ID == 0) {\n continue;\n }\n boolean isSOTrx = \"Y\".equals(rs.getString(3));\n BigDecimal PayAmt = rs.getBigDecimal(4);\n BigDecimal DiscountAmt = rs.getBigDecimal(5);\n BigDecimal WriteOffAmt = rs.getBigDecimal(6);\n BigDecimal OpenAmt = rs.getBigDecimal(7);\n BigDecimal OverUnderAmt = OpenAmt.subtract(PayAmt).subtract(DiscountAmt).subtract(WriteOffAmt);\n //\n if (alloc.get_ID() == 0 && !alloc.save(get_TrxName())) {\n log.log(Level.SEVERE, \"Could not create Allocation Hdr\");\n rs.close();\n pstmt.close();\n return false;\n }\n MAllocationLine aLine = null;\n if (isSOTrx) {\n aLine = new MAllocationLine(alloc, PayAmt,\n DiscountAmt, WriteOffAmt, OverUnderAmt);\n } else {\n aLine = new MAllocationLine(alloc, PayAmt.negate(),\n DiscountAmt.negate(), WriteOffAmt.negate(), OverUnderAmt.negate());\n }\n aLine.setDocInfo(C_BPartner_ID, 0, C_Invoice_ID);\n aLine.setC_Payment_ID(getC_Payment_ID());\n if (!aLine.save(get_TrxName())) {\n log.log(Level.SEVERE, \"Could not create Allocation Line\");\n }\n }\n rs.close();\n pstmt.close();\n pstmt = null;\n } catch (Exception e) {\n log.log(Level.SEVERE, \"allocatePaySelection\", e);\n }\n try {\n if (pstmt != null) {\n pstmt.close();\n }\n pstmt = null;\n } catch (Exception e) {\n pstmt = null;\n }\n\n //\tShould start WF\n boolean ok = true;\n if (alloc.get_ID() == 0) {\n log.fine(\"No Allocation created - C_Payment_ID=\"\n + getC_Payment_ID());\n ok = false;\n } else {\n alloc.processIt(DocAction.ACTION_Complete);\n ok = alloc.save(get_TrxName());\n m_processMsg = \"@C_AllocationHdr_ID@: \" + alloc.getDocumentNo();\n }\n return ok;\n }", "void setBank(shared.data.Bank bank);", "private void getTradeParam(int select){\n String buysell;if (select==1){buysell = \"buy\";}else{buysell = \"sell\";}\n out.println(\"\\r\\nEnter stock and number of shares you wish to \" + buysell + \" (e.g. E5). Enter 'X' to exit.\" +\n \"\\r\\n£3 transaction charge for purchases\");\n String tradeInput = in.nextLine();\n if(player.getTradesLeft() == 0){out.println(\"No more trade actions left\\r\\n\");command();}\n if(tradeInput.toUpperCase().equals(\"X\")){tradeCommand();}\n int numShares = Integer.parseInt(tradeInput.trim().substring(1));\n switch(tradeInput.toUpperCase().charAt(0)){\n case 'A': if(select==1){commitBuy(game.apple, numShares);}\n else{commitSell(game.apple, numShares);}\n break;\n case 'B': if(select==1){commitBuy(game.bp, numShares);}\n else{commitSell(game.bp, numShares);}\n break;\n case 'C': if(select==1){commitBuy(game.cisco, numShares);}\n else{commitSell(game.cisco, numShares);}\n break;\n case 'D': if(select==1){commitBuy(game.dell, numShares);}\n else{commitSell(game.dell, numShares);}\n break;\n case 'E': if(select==1){commitBuy(game.ericsson, numShares);}\n else{commitSell(game.ericsson, numShares);}\n break;\n default:\n out.println(\"Invalid input\");\n command();\n break;\n }\n }", "private void payByBalance(final View v) {\n if (!SanyiSDK.getCurrentStaffPermissionById(ConstantsUtil.PERMISSION_CASHIER)) {\n\n\n Toast.makeText(activity, getString(R.string.str_common_no_privilege), Toast.LENGTH_LONG).show();\n\n return;\n }\n final CashierPayment paymentMode = new CashierPayment();\n paymentMode.paymentType = ConstantsUtil.PAYMENT_STORE_VALUE;\n paymentMode.paymentName = getString(R.string.rechargeable_card);\n if (SanyiSDK.rest.config.isMemberUsePassword) {\n MemberPwdPopWindow memberPwdPopWindow = new MemberPwdPopWindow(v, activity, new MemberPwdPopWindow.OnSureListener() {\n\n @Override\n public void onSureClick(final String pwd) {\n // TODO Auto-generated method stub\n final NumPadPopWindow numPadPopWindow = new NumPadPopWindow(v, getActivity(), cashierResult, paymentMode, new NumPadPopWindow.OnSureListener() {\n\n @Override\n public void onSureClick(Double value, Double change) {\n // TODO Auto-generated method stub\n checkPresenterImpl.addMemberPayment(value, pwd);\n }\n });\n numPadPopWindow.show();\n\n\n }\n });\n memberPwdPopWindow.show();\n return;\n }\n final NumPadPopWindow numPadPopWindow = new NumPadPopWindow(v, getActivity(), cashierResult, paymentMode, new NumPadPopWindow.OnSureListener() {\n\n @Override\n public void onSureClick(Double value, Double change) {\n // TODO Auto-generated method stub\n checkPresenterImpl.addMemberPayment(value, null);\n }\n });\n numPadPopWindow.show();\n }", "public void setBankAccountType (String BankAccountType);", "private void menuOptionOne(){\n SimulatorFacade.printTransactions();\n pressAnyKey();\n }", "public char select_deposit() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tchar type;\n\t\tdo {\n\t\t\tSystem.out.println(\"Would you like to deposit to (c)hecking balance or (s)aving balance?\");\n\t\t\ttype = scan.next().charAt(0);\n\t\t\ttype = Character.toLowerCase(type);\n\t\t} while(!(type != 'c' || type != 's'));\n\t\t\n\t\treturn type;\n\t}", "public char select_withdraw() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tchar type;\n\t\tdo {\n\t\t\tSystem.out.println(\"Would you like to withdraw from (c)hecking balance or (s)aving balance?\");\n\t\t\ttype = scan.next().charAt(0);\n\t\t\ttype = Character.toLowerCase(type);\n\t\t} while(!(type != 'c' || type != 's'));\n\t\t\n\t\treturn type;\n\t}", "public String getBuy_mode() {\r\n\t\treturn buy_mode;\r\n\t}", "int payInTurbo(String turboCardNo, float turboAmount, String destinationTurboOfCourse, String installmentsButInTurbo);", "public String getBankAccountType();", "public void depositMenu(){\n\t\tstate = ATM_State.DEPOSIT;\n\t\tgui.setDisplay(\"Amount to deposit: \\n$\");\t\n\t}", "public void setSaldoBank(double saldoBank) {\n this.saldoBank = saldoBank;\n }", "public String getBank() {\r\n return bank;\r\n }", "public String getBank() {\r\n return bank;\r\n }", "public void setPayType(Short payType) {\n this.payType = payType;\n }", "@FXML\n void selectSavings(ActionEvent event) {\n \tdirectDep.setSelected(false);\n \tisLoyal.setSelected(false);\n \tdirectDep.setDisable(true);\n \tisLoyal.setDisable(false);\n }", "public WebElement select123BankingPaymentType(String banks123) {\n\t\treturn findElement(modifyPageElement(repositoryParser, PAGE_NAME,\n\t\t\t\t\"123Banking\", banks123));\n\t}", "public transaksi() {\n initComponents();\n judul();\n tampildata();\n judulbarang();\n tampilbarang();\n reset();\n autokode();\n total();\n lkembali.setText(\"Rp. 0\");\n bcek.requestFocus();\n ltgl.setText(hari); \n bhapus.setVisible(false);\n bedit.setVisible(false);\n bbeli.setVisible(true);\n breset.setVisible(true);\n }", "public void transactionMenu(){\n\t\tstate = ATM_State.TRANSACTION;\n\t\tgui.setDisplay(\"Transaction menu\\n\"\n\t\t\t\t+ \"1. Balance\\n\"\n\t\t\t\t+ \"2. Deposit\\n\"\n\t\t\t\t+ \"3. Withdraw\\n\"\n\t\t\t\t+ \"4. Log out\\n\"\n\t\t\t\t+ \"Enter choice: \");\n\t}", "@Override\r\n\tpublic void solicitarTipoTransaccion() {\n\t\tSystem.out.println(\"Escoger tipo de transaccion\");\r\n\t\t\r\n\t}", "public byte[] requestBankDump(int bank) \n {\n return null; \n }", "CashSettlementMethodEnum getCashSettlementMethod();", "private void depositBank() throws InterruptedException{\n\n log(\"banking!\");\n if(!getBank().isOpen()){\n getBank().open();\n Timing.waitCondition(() -> getBank().isOpen(), 5000);\n }else{\n getBank().depositAllExcept(item -> item.getName().endsWith(\" axe\"));\n\n }\n\n }", "public Short getPayType() {\n return payType;\n }", "@Override\n protected void setBankNum(int bankNum) {\n }", "public ControlBank(Bank bank) {\r\n\t\tthis.bank = bank;\r\n\t}", "public void choosePayToObtainCards(Map<String, HashMap<Integer, String>> payToObtainCards) {\n\n payToObtainController.chooseCards(payToObtainCards);\n\n }", "protected void setBankNum(int bankNum) {\n try {\n ShortMessage msg = new ShortMessage();\n msg.setMessage(ShortMessage.CONTROL_CHANGE, getChannel() - 1,\n 0x00, // Bank Select (MSB)\n bankNum / 128); // Bank Number (MSB)\n send(msg);\n msg.setMessage(ShortMessage.CONTROL_CHANGE, getChannel() - 1,\n 0x20, // Bank Select (LSB)\n bankNum % 128); // Bank Number (MSB)\n send(msg);\n } catch (InvalidMidiDataException e) {\n ErrorMsg.reportStatus(e);\n }\n }", "public String getBank() {\n return bank;\n }", "public static void main(String[] args) {\n\t\t Scanner input=new Scanner(System.in);//Input through Scanner Class\n\t\t System.out.println(\"You have Rs 500 in account\"); \n\t\t System.out.println(\"Enter the amount to be withdrawed\");\n\t\t int amount = input.nextInt();\n\t\t //Enter the amount \n\t\t CurrentAccount deposit=new CurrentAccount();\n\t\t payment(deposit, amount);\n\t\t //Withdraw the amount from bank\n\t\t System.out.println(\"Enter the amount to be deposited\");\n\t\t amount = input.nextInt();\n\t deposit(new SavingsAccount(), amount);\n //Deposit the amount bank\n }", "java.lang.String getBankNo();", "public String changeSelectPaid() {\n\t\tproductService.changeSelectStatus(ids, \"paid\", valid);\n\t\tresult = \"修改成功\";\n\t\treturn SUCCESS;\n\t}", "public WebElement bankSelection(String bankName) {\n\t\treturn findElement(modifyPageElement(repositoryParser, PAGE_NAME,\n\t\t\t\t\"internetBankingBank\", bankName));\n\t}", "public void setAmountBank(double amountBank) {\n this.amountBank = amountBank;\n }", "public void chooseRetailAccountType() {\n click(By.id(\"LoginAsRetail\"));\n }", "public String getPayType() {\n return payType;\n }", "public String getPayType() {\n return payType;\n }", "public PUKEHandlerCallBanker_ABZ_FOUR(){\r\n\t}", "public void SpecialRateplan_selection(String Rateplan) throws InterruptedException\r\n\t{\r\n\t\tif(SeleniumRepo.driver.findElement(By.xpath(\"//label[text()='\"+Rateplan+\"']\")).isDisplayed())\r\n\t\t{\r\n\t\t\tSeleniumRepo.driver.findElement(By.xpath(\"//label[text()='\"+Rateplan+\"']\")).click();\r\n\t\t\t//System.out.println(\"Rateplan selected successfully\");\r\n\t\t\ttest.log(Status.INFO, \"Rateplan selected successfully\");\r\n\r\n\t\t\tThread.sleep(2000);\t\r\n\t\t\tif (Specialdone.isDisplayed()) \r\n\t\t\t{\r\n\t\t\t\tSpecialdone.click();\r\n\t\t\t\tSeleniumRepo.waitForPageLoaded();\r\n\t\t\t\t//System.out.println(\"Clicked on done\");\r\n\t\t\t\tlogger.info(\"Clicked on done\");\r\n\t\t\t\ttest.log(Status.INFO, \"Clicked on done\");\r\n\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t//System.out.println(\"not Clicked on done\");\r\n\t\t\t\tlogger.error(\"not Clicked on done\");\r\n\t\t\t\ttest.log(Status.FAIL, \"not Clicked on done\");\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ttest.log(Status.FAIL, \"Element is not present\");\r\n\r\n\t\t}\t\r\n\t}", "@Test(priority = 4)\n\tpublic void testPayment() {\n\t\tlogger = extent.startTest(\"passed\");\n\t\tWebDriverWait wait = new WebDriverWait(driver, 100);\n\t\twait.until(ExpectedConditions.presenceOfElementLocated(By.className(\"payment-info\")));\n\n\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"swit\\\"]/div[1]\")).click();\n\t\tdriver.findElement(By.id(\"btn\")).click();\n\t\tAssert.assertEquals(driver.getTitle(), \"Payment Gateway\");\n\n\t\t// For netbanking login\n\t\tdriver.findElement(By.name(\"username\")).sendKeys(\"123456\");\n\t\tdriver.findElement(By.name(\"password\")).sendKeys(\"Pass@456\");\n\t\tdriver.findElement(By.xpath(\"//input[@type='submit' and @value='LOGIN']\")).click();\n\t\tAssert.assertEquals(driver.getTitle(), \"Payment Gateway\");\n\n\t\t//\n\t\tdriver.findElement(By.name(\"transpwd\")).sendKeys(\"Trans@456\");\n\t\tdriver.findElement(By.xpath(\"//input[@type='submit' and @value='PayNow']\")).click();\n\t\tAssert.assertEquals(driver.getTitle(), \"Order Details\");\n\t\tlogger.log(LogStatus.PASS, \"testPayment Testcase is passed\");\n\t}", "ApiSubCtgrVO selectApiSubCtgr(ApiSubCtgrRequest.ApiSubCtgrDetilRequest apiSubCtgrDetilRequest);", "public void mutualFund(){\r\n\t\tSystem.out.println(\"HSBC ---mutualFund method called from Interface BrazilBank\");\r\n\t}", "void askBuyDevCards();", "public Object getPaymentMode() {\n\t\treturn null;\n\t}", "public String getPaytype() {\n return paytype;\n }", "public void SelectEMIbankDuration()\t{\n\t\tclickEMIselectBanKDrpDwn();\n\t\tclickEMIbankSelect();\n\t\tclickSelectEMIdurationDrpDwn();\n\t\tclickSelectEMIduration();\n\t}", "public void withdrawalMenu(){\n\t\tstate = ATM_State.WITHDRAW;\n\t\tgui.setDisplay(\"Amount to withdraw: \\n$\");\n\t}", "@Override\r\n\tpublic XftPayment selectByNo(String payNo, String payType) {\n\t\treturn xftPaymentMapper.selectByNo(payNo, payType);\r\n\t}", "public void transact() {\n\t\truPay.transact();\n\n\t}", "public depositMoneyInBank() {\n\n commands = new Command[2];\n Command noCommand = new NoCommand();\n for (int i = 0; i < 2; i++) {\n commands[i] = noCommand;\n }\n\n storage = new Stack<Command>();\n }", "public void setTransmitMode(String transmitMode)\r\n\t{\r\n\t\tthis.transmitMode = transmitMode;\r\n\t}", "public void setPayMethod(String value) {\n this.payMethod = value;\n }", "private void selecionarOpcoesDeBackup() {\n try {\n if (dao.opcaoDeBackupAtual().equals(\"Não fazer Backup Automático\")) {\n rbNãofazerBackup.setSelected(true);\n }\n if (dao.opcaoDeBackupAtual().equals(\"Fazer Backup na Entrada\")) {\n rbFazerBackupnaEntrada.setSelected(true);\n }\n if (dao.opcaoDeBackupAtual().equals(\"Fazer Backup na Saída\")) {\n rbFazerBackupnaSaída.setSelected(true);\n }\n if (dao.opcaoDeBackupAtual().equals(\"Fazer Backup na Entrada e na Saída\")) {\n rbFazerBackupnaEntradaenaSaida.setSelected(true);\n }\n } catch (SQLException ex) {\n Logger.getLogger(Backup.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public static void transfer() {\n\t\ttry {\n\t\t\tif (!LoginMgr.isLoggedIn()) {\n\t\t\t\tthrow new NotLoggedInException();\n\t\t\t}\n\n\t\t\t// Scanner s = new Scanner(System.in);\n\t\t\tSystem.out.println(\"Enter account number to transfer to: \");\n\t\t\tString accNum = \"\";\n\t\t\tif (Quinterac.s.hasNextLine())\n\t\t\t\taccNum = Quinterac.s.nextLine();\n\n\t\t\tif (!ValidAccListMgr.checkAccNumExist(accNum)) {\n\t\t\t\tSystem.out.println(\"Please enter a valid account number\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tSystem.out.println(\"Enter account number to transfer from: \");\n\t\t\tString accNumB = \"\";\n\t\t\tif (Quinterac.s.hasNextLine())\n\t\t\t\taccNumB = Quinterac.s.nextLine();\n\n\t\t\tif (!ValidAccListMgr.checkAccNumExist(accNumB)) {\n\t\t\t\tSystem.out.println(\"Please enter a valid account number\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tSystem.out.println(\"Enter the amount of money to transfer in cents: \");\n\t\t\tint amount = 0;\n\t\t\tif (Quinterac.s.hasNextInt())\n\t\t\t\tamount = Integer.parseInt(Quinterac.s.nextLine());\n\n\t\t\tString modeName = LoginMgr.checkMode();\n\t\t\tif (modeName.equals(\"machine\")) {\n\t\t\t\tatmCheckTransferValid(accNum, amount, accNumB);\n\t\t\t} else if (modeName.equals(\"agent\")) {\n\t\t\t\tagentCheckTransferValid(accNum, amount, accNumB);\n\t\t\t}\n\n\t\t} catch (NotLoggedInException e) {\n\t\t\tSystem.out.println(e.getMessage());\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\n\t}", "public int getBank(byte[] bankSysex) \n {\n return -1; \n }", "public void selectAccountNo ()\r\n\t{\r\n\t\tWebDriverWait wait = new WebDriverWait (driver, GlobalWaitTime.getIntWaitTime ());\r\n\t\twait.until (ExpectedConditions.elementToBeClickable (orClaimLogPaymentClaimPayment.ddlAccountNoBACS));\r\n\r\n\t\tSelect oAccountNo = new Select (orClaimLogPaymentClaimPayment.ddlAccountNoBACS);\r\n\r\n\t\tList<WebElement> selections = oAccountNo.getOptions ();\r\n\t\tint intIndex = RandomNumbers.randomNumberGenerator (1, selections.size () - 1);\r\n\t\toAccountNo.selectByIndex (intIndex);\r\n\r\n\t\twait.until (ExpectedConditions.invisibilityOf (orControlPanel.barProgress));\r\n\r\n\t}", "@Override\n public String getDescription() {\n return \"Transfer currency\";\n }", "public void saveFiBcoinPayconfig(FiBcoinPayconfig fiBcoinPayconfig);", "public void srediFormuPremaSK(){\n int aktivanSK = Komunikacija.getInstance().getAktivan_sk();\n \n if(aktivanSK == Konstante.SK_DODAVANJE){\n srediFormu();\n this.setTitle(\"Unos nove vezbe\");\n }\n if(aktivanSK == Konstante.SK_IZMENA){\n srediFormu();\n prikaziPodatkeVezbi(Komunikacija.getInstance().getVezbe());\n this.setTitle(\"Izmena vezbe\");\n } \n \n if(aktivanSK == Konstante.SK_PRIKAZ){\n jTextFieldNaziv.setEnabled(false);\n jTextFieldFokus.setEnabled(false);\n jTextFieldVremeTrajanja.setEnabled(false);\n prikaziPodatkeVezbi(Komunikacija.getInstance().getVezbe());\n this.setTitle(\"Detalji vezbe\");\n }\n}", "public void autoPay() {}", "public void setModePfPayment (java.lang.String modePfPayment) {\n\t\tthis.modePfPayment = modePfPayment;\n\t}", "public void setBankID(String value) {\n this.bankID = value;\n }", "public void set_transaction_mode(TransactionType mode){\n\t\ttransaction_type = mode;\n\t}", "public String getBankCode() {\r\n return bankCode;\r\n }", "@RequestMapping(\r\n value = \"/buyapi\",\r\n method = RequestMethod.GET)\r\n public String buyPlan(@RequestParam(value = \"plan\", defaultValue = \"1\") String plan,\r\n @RequestParam(value = \"appk\", defaultValue = \"\") String appk)\r\n {\r\n if(!(con.checkLogin(appk))){\r\n System.out.println(\"needlogin\");\r\n }\r\n \r\n String un = con.getUname(appk);\r\n if(\"notfound\".equals(un))\r\n return \"errorinun\";\r\n \r\n return con.buyPlan(appk, un, plan);\r\n \r\n \r\n }", "public beli_kredit() {\n initComponents();\n koneksitoko();\n }", "private boolean checkout() {\n if (OrderMenuUI.incompleteOrders == null || OrderMenuUI.incompleteOrders.size() == 0) {\n System.out.println(\"No orders ready for checkout. Cancelling Operation\");\n return false;\n }\n HashMap<Integer, Order> tOrders = new HashMap<>();\n OrderMenuUI.incompleteOrders.forEach((s) -> {\n Table c = s.getTable();\n if (c == null) return;\n tOrders.put(c.getTableNum(), s);\n });\n tOrders.put(-1, null);\n OrderMenuUI.printOrderList(OrderMenuUI.incompleteOrders, \"Ready for Checkout\", true);\n int tableNo = ScannerHelper.getIntegerInput(\"Select Table to checkout (-1 to cancel): \", new ArrayList<>(tOrders.keySet()), \"Invalid Table Number. Please select a valid table number or enter -1 to cancel\");\n if (tableNo == -1) {\n System.out.println(\"Checkout Operation Cancelled\");\n return false;\n }\n Order o = tOrders.get(tableNo);\n double total = printOrderDetails(o);\n System.out.println();\n System.out.println(\"Payment Mode\");\n System.out.println(\"1) Cash\");\n System.out.println(\"2) NETS\");\n System.out.println(\"3) Debit/Credit Card\");\n System.out.println(\"4) EZ-Link\");\n System.out.println(\"0) Cancel\");\n int choice = ScannerHelper.getIntegerInput(\"Select Payment Mode (0 to cancel): \", -1, 5);\n double paid;\n Invoice.PaymentType paymentType;\n switch (choice) {\n case 1:\n paid = requestCashPayment(total);\n paymentType = Invoice.PaymentType.PAYMENT_CASH;\n break;\n case 2:\n paymentType = Invoice.PaymentType.PAYMENT_NETS;\n paid = total; // All card payments are presumed paid fully\n break;\n case 3:\n paymentType = Invoice.PaymentType.PAYMENT_CARD;\n paid = total; // All card payments are presumed paid fully\n break;\n case 4:\n paymentType = Invoice.PaymentType.PAYMENT_EZLINK;\n paid = total; // All card payments are presumed paid fully\n break;\n case 0:\n System.out.println(\"Operation Cancelled\");\n return false;\n default:\n throw new MenuChoiceInvalidException(\"Checkout Payment\");\n }\n System.out.println(\"Payment Complete! Payment Mode: \" + paymentType.toString());\n if (paymentType == Invoice.PaymentType.PAYMENT_CASH) {\n System.out.println(\"Change: $\" + String.format(\"%.2f\", (paid - total)));\n }\n\n System.out.println(\"Generating Receipt...\");\n o.markPaid();\n OrderMenuUI.incompleteOrders.remove(o);\n ArrayList<String> receipt = generateReceipt(o, total, paid, paymentType);\n System.out.println();\n receipt.forEach(System.out::println);\n String receiptName = \"-\";\n if (writeReceipt(receipt, o.getOrderID())) {\n receiptName = o.getOrderID() + \".txt\";\n }\n Invoice i = new Invoice(o, receiptName, paymentType, total, paid);\n MainApp.invoices.add(i);\n System.out.println(\"\\n\");\n System.out.println(\"Returning to Main Menu...\");\n return true;\n }", "void transfer(BankAccount x,double amt)\n\t{\n\t\tSystem.out.println(\"transferring the amount\");\n\t\twithdraw(amt);\n\t\tx.deposit(amt);\n\t\tSystem.out.println(\"transfer done successfully! \");\n\t}", "public void setBank(String bank) {\n\t\tif (bank == null)\n\t\t\tbank = \"\";\n\t\tthis.bank = bank;\n\t}", "boolean CanBuySettlement();", "void buyDevCard();", "@Override\n public void actionPerformed(ActionEvent e) {\n sender.setIso(SelectIso());\n try {\n // Sender sender = new Sender(ValidAction.START_TRANSACTION);\n // sender.startTransaction(SelectNode());\n log.getDocument().insertString(0,\"Set Isolation Level to: \" +SelectIso().toString() +\"\\n\" , null);\n } catch (BadLocationException ex) {\n Logger.getLogger(MainView.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public String getPayMethod() {\n return payMethod;\n }", "void askDevCardProduction();", "@Override\n public String pay(int amount) {\n return (amount +\" paid with credit/debit card.\");\n }", "public static void selecting_opt_out_mode() throws Exception{\n\t Thread.sleep(8000);\n\t\tSwipe_Conter(10);\n\t\t Thread.sleep(10000);\n\t\t TouchAction ta=new TouchAction(Ad);\n\t\t ta.tap(480, 1369).perform();\n\t\t//Selecting Opt out mode option in privacy card\n\t\tSystem.out.println(\"Selecting Opt out mode option in privacy card\");\n\t\tlogStep(\"Selecting Opt out mode option in privacy card\");\n\t\t Thread.sleep(3000);\t\t\n\t}", "ErpOaLicKey selectByPrimaryKey(String licFlow);" ]
[ "0.6443464", "0.63438886", "0.6102815", "0.5995986", "0.5978999", "0.5947189", "0.5938954", "0.5877667", "0.5832984", "0.5747133", "0.57311505", "0.57058376", "0.5606623", "0.5581177", "0.5569355", "0.55531496", "0.5525877", "0.5520953", "0.5518652", "0.5509473", "0.55026245", "0.548606", "0.542481", "0.5422269", "0.53907895", "0.5387026", "0.536432", "0.5360915", "0.5357726", "0.53172755", "0.53026193", "0.52751833", "0.52585846", "0.5252111", "0.5235523", "0.5188022", "0.5188022", "0.51857847", "0.5176237", "0.5174312", "0.51617515", "0.51532644", "0.5142078", "0.5131437", "0.5117181", "0.5109158", "0.510478", "0.50945765", "0.50879735", "0.50853276", "0.50841403", "0.5076573", "0.50751686", "0.50725114", "0.50713575", "0.50604236", "0.50566787", "0.505293", "0.5052661", "0.5052661", "0.50471777", "0.50442094", "0.5043229", "0.503477", "0.5020822", "0.5017434", "0.5012763", "0.5000448", "0.49885964", "0.49883035", "0.49875924", "0.49683234", "0.49675903", "0.49604002", "0.49561954", "0.49546674", "0.49516895", "0.49495763", "0.49434298", "0.49427325", "0.49317953", "0.49278864", "0.4922023", "0.49168646", "0.4915999", "0.4913607", "0.49057633", "0.4897958", "0.48929152", "0.48848253", "0.48794347", "0.48748842", "0.48740846", "0.48734123", "0.4868267", "0.4864132", "0.4863945", "0.4863507", "0.4853886", "0.48511803" ]
0.68242776
0
selecting bank transfer payment typeKishor
public WebElement selectingBank(String bank) { return findElement(modifyPageElement(repositoryParser, PAGE_NAME, "selectingBank", bank)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public WebElement bankTransferPaymentMode() {\n\t\treturn findElement(repositoryParser, PAGE_NAME, \"bankTransfer\");\n\t}", "public void setPaymentMethodCode_BankTransfer() {\n setPaymentMethodCodeAsPaymentMethod(AppCDef.PaymentMethod.BankTransfer);\n }", "public String getBankAccountType();", "public void selectPaymentMethod(String payment) {\n\t\tif (payment == \"Cashless\")\n\t\t\tdriver.findElement(By.id(\"payBtn1\")).click();\n\t\tif (payment == \"Cash\")\n\t\t\tdriver.findElement(By.id(\"payBtn2\")).click();\n\t\tif (payment == \"Special\")\n\t\t\tdriver.findElement(By.id(\"payBtn3\")).click();\n\t}", "public IBankTransfert payment();", "public void setTransactionType(int transactionChoice);", "public abstract PaymentType getPaymentType();", "public void setBankAccountType (String BankAccountType);", "public String getJP_BankAccountType();", "private PaymentType(String payment) {\n this.payment = payment;\n }", "public void changeBanksForPayment(){\n\t\t\tgetLocalBankListforIndicator();\n\t\t\tsetPaymentmodeId(null);\n\t\t\tif(getPaymentCode()!=null && getPaymentCode().equalsIgnoreCase(\"B\"))\n\t\t\t{\n\t\t\t\t\n\t\t\t\tsetBooChequePanel(true);\n\t\t\t\tsetBooCardPanel(false);\n\t\t\t\tsetRemitamount(null);\n\t\t\t\tBigDecimal PaymentId=placeOrderPendingTransctionService.toFetchPaymentId(getPaymentCode());\n\t\t\t\tsetPaymentmodeId(PaymentId);\n\t\t\t\t//clearKnetDetails();\n\t\t\t}else\n\t\t\t{\n\t\t\t\tsetBooChequePanel(false);\n\t\t\t\tsetBooCardPanel(true);\n\t\t\t\tsetRemitamount(null);\n\t\t\t\tBigDecimal PaymentId=placeOrderPendingTransctionService.toFetchPaymentId(getPaymentCode());\n\t\t\t\tsetPaymentmodeId(PaymentId);\n\t\t\t}\n\t\t\tsetBooRenderSaveOrExit(true);\n\t\t}", "public WebElement select123BankingPaymentType(String banks123) {\n\t\treturn findElement(modifyPageElement(repositoryParser, PAGE_NAME,\n\t\t\t\t\"123Banking\", banks123));\n\t}", "public String getPaymentType() {\r\n return paymentType;\r\n }", "public PaymentType getPaymentType()\n {\n return PAYMENT_TYPE;\n }", "@Override\n public byte getType() {\n return TYPE_PAYMENT;\n }", "public PaymentTypeObject getPaymentType(int payment_type_id) throws AppException;", "public boolean selectBankAccount(String bankAccount, String user, int choose);", "public boolean isPaymentMethodCodeBankTransfer() {\n AppCDef.PaymentMethod cdef = getPaymentMethodCodeAsPaymentMethod();\n return cdef != null ? cdef.equals(AppCDef.PaymentMethod.BankTransfer) : false;\n }", "public char select_deposit() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tchar type;\n\t\tdo {\n\t\t\tSystem.out.println(\"Would you like to deposit to (c)hecking balance or (s)aving balance?\");\n\t\t\ttype = scan.next().charAt(0);\n\t\t\ttype = Character.toLowerCase(type);\n\t\t} while(!(type != 'c' || type != 's'));\n\t\t\n\t\treturn type;\n\t}", "public String getPaytype() {\n return paytype;\n }", "public void queryByPaymentType(String payType) {\n\t\tPAYMENT_TYPE = payType;\n\t}", "@Override\r\n\tpublic void setPaymentType() {\n\t\tthis.paymentType = PaymentType.YINLIAN;\r\n\t}", "public void setJP_BankAccountType (String JP_BankAccountType);", "public PaymentType(String paymentType) {\n\t\tsuper();\n\t\tthis.paymentType = paymentType;\n\t}", "public String getPayType() {\n return payType;\n }", "public String getPayType() {\n return payType;\n }", "Databank getBank();", "public java.lang.String getPaymenttype () {\r\n\t\treturn paymenttype;\r\n\t}", "public long getPaymentType() {\n return paymentType;\n }", "public void setPaymentType(long paymentType) {\n this.paymentType = paymentType;\n }", "@When(\"user selects on AndhraBank\")\r\n\tpublic void usert_selects_on_Andhrabank() throws InterruptedException {\n\t\tdriver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);\r\n\t\t//driver.findElement(By.xpath(\"//div[@id='swit']/div[1]/label/i\")).click();\r\n\t\tdriver.findElement(By.xpath(\"//label[contains(text(),'Andhra Bank')]\")).click();\r\n\t}", "public void setPayType(Short payType) {\n this.payType = payType;\n }", "public boolean selectExisitingAccount(int choice, String bankAccount);", "@NotNull\n public PaymentType getPaymentType(){\n if(payment.size() == 1){\n return payment.get(0).getPaymentType();\n }else if(payment.size() > 1){\n return PaymentType.SPLIT;\n }\n return PaymentType.UNPAID;\n }", "public char select_withdraw() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tchar type;\n\t\tdo {\n\t\t\tSystem.out.println(\"Would you like to withdraw from (c)hecking balance or (s)aving balance?\");\n\t\t\ttype = scan.next().charAt(0);\n\t\t\ttype = Character.toLowerCase(type);\n\t\t} while(!(type != 'c' || type != 's'));\n\t\t\n\t\treturn type;\n\t}", "public Integer getPaymentType() {\n\t\treturn paymentType;\n\t}", "public List<SelectItem> loadComboPaymentType() {\n\t\tlistPaymentType = new ArrayList<SelectItem>();\n\t\tlistPaymentType.add(new SelectItem(ContantsUtil.PaymentType.PAYMENT_TYPE_PREPAID,\n\t\t\t\tContantsUtil.PaymentType.PAYMENT_TYPE_PREPAID_NAME));\n\t\tlistPaymentType.add(new SelectItem(ContantsUtil.PaymentType.PAYMENT_TYPE_POSTPAID,\n\t\t\t\tContantsUtil.PaymentType.PAYMENT_TYPE_POSTPAID_NAME));\n\t\treturn listPaymentType;\n\t}", "public void setPaymentType(PaymentType paymentType) {\n\n this.paymentType = paymentType;\n }", "public String getPaymentAmountType() {\r\n return paymentAmountType;\r\n }", "public Short getPayType() {\n return payType;\n }", "public abstract String getCurrencyType();", "public String getPAYMENT_TYPE() {\r\n return PAYMENT_TYPE;\r\n }", "public void setPaymentType(Integer paymentType) {\n\t\tthis.paymentType = paymentType;\n\t}", "@Override\r\n\tpublic XftPayment selectByNo(String payNo, String payType) {\n\t\treturn xftPaymentMapper.selectByNo(payNo, payType);\r\n\t}", "public void setPaymenttype (java.lang.String paymenttype) {\r\n\t\tthis.paymenttype = paymenttype;\r\n\t}", "private String getFundingTypeLabel(String type, Locale locale) {\n String paymentMethodLabel = \"\";\n if (type.equalsIgnoreCase(PdfConstants.CREDIT)) {\n paymentMethodLabel = \"\";\n } else if (type.equalsIgnoreCase(PdfConstants.BLACKHAWK) || type.equalsIgnoreCase(PdfConstants.PRECASH) ||\n type.equalsIgnoreCase(PdfConstants.INCOMM)) {\n paymentMethodLabel = getMessage(locale, \"pdf.receipt.cashFundingSource\");\n } else if (type.equalsIgnoreCase(PdfConstants.PROMO_CREDIT)) {\n paymentMethodLabel = getMessage(locale, \"pdf.receipt.promoFundingSource\");\n }\n return paymentMethodLabel;\n }", "public List<HCLFieldTransaction> getTransactionbyType(String transactionType)\r\n\t\t\tthrows JsonProcessingException, IOException {\r\n\r\n\t\tlogger.info(\"Logger Name: getTransactionbyType() :: \" + logger.getName());\r\n\t\tlogger.debug(\"Transaction Type : getTransactionbyType() :: \" + transactionType);\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\r\n\t\tlogger.info(\"Open Bank API URL :: getTotalAmountbyTransactionType() :: \"\r\n\t\t\t\t+ TransactionConstant.THIRD_PARTY_REST_API);\r\n\t\tJsonNode root = mapper.readTree(new URL(TransactionConstant.THIRD_PARTY_REST_API));\r\n\r\n\t\tList<HCLFieldTransaction> transactionList = new ArrayList<HCLFieldTransaction>();\r\n\r\n\t\t/* Traversing Nested JSON node to publish the relevant data */\r\n\t\ttry {\r\n\t\t\tJsonNode transactionsNodes = root.path(\"transactions\");\r\n\r\n\t\t\tfor (JsonNode transactionsNode : transactionsNodes) {\r\n\r\n\t\t\t\tHCLFieldTransaction hclFieldTransaction = new HCLFieldTransaction();\r\n\t\t\t\tJsonNode details = transactionsNode.path(\"details\");\r\n\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\r\n\t\t\t\t/* When transactionType is null or empty */\r\n\t\t\t\tif (transactionType == null && details.path(\"type\").isNull() == true) {\r\n\t\t\t\t\thclFieldTransaction.setId(transactionsNode.path(\"id\").asText());\r\n\r\n\t\t\t\t\tJsonNode thisAccount_Node = transactionsNode.path(\"this_account\");\r\n\t\t\t\t\thclFieldTransaction.setAccountId(thisAccount_Node.path(\"id\").asText());\r\n\r\n\t\t\t\t\tJsonNode otherAccount_Node = transactionsNode.path(\"other_account\");\r\n\t\t\t\t\thclFieldTransaction.setCounterpartyAccount(otherAccount_Node.path(\"number\").asText());\r\n\r\n\t\t\t\t\tJsonNode otherAccount_holder_Node = otherAccount_Node.path(\"holder\");\r\n\t\t\t\t\thclFieldTransaction.setCounterpartyName(otherAccount_holder_Node.path(\"name\").asText());\r\n\t\t\t\t\tJsonNode metadata = otherAccount_Node.path(\"metadata\");\r\n\t\t\t\t\thclFieldTransaction.setCounterPartyLogoPath(metadata.path(\"open_corporates_URL\").asText());\r\n\r\n\t\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\t\t\t\t\thclFieldTransaction.setDescription(details.path(\"description\").asText());\r\n\r\n\t\t\t\t\tJsonNode value = details.path(\"value\");\r\n\t\t\t\t\thclFieldTransaction.setInstructedAmount(value.path(\"amount\").asDouble());\r\n\r\n\t\t\t\t\thclFieldTransaction.setInstructedCurrency(value.path(\"currency\").asText());\r\n\r\n\t\t\t\t\thclFieldTransaction.setTransactionAmount(value.path(\"amount\").asDouble());\r\n\t\t\t\t\thclFieldTransaction.setTransactionCurrency(value.path(\"currency\").asText());\r\n\t\t\t\t\tlogger.debug(\"Transaction Field Row Value:: \" + hclFieldTransaction.toString());\r\n\r\n\t\t\t\t\t/* Adding specific type of transaction list into one ArrayList */\r\n\t\t\t\t\ttransactionList.add(hclFieldTransaction);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/* When transactionType is not null or empty */\r\n\t\t\t\telse if (transactionType != null) {\r\n\r\n\t\t\t\t\tif (hclFieldTransaction.getTransactionType().equalsIgnoreCase(transactionType.trim())) {\r\n\r\n\t\t\t\t\t\tlogger.debug(\"Transaction Type :: \" + transactionType);\r\n\t\t\t\t\t\thclFieldTransaction.setId(transactionsNode.path(\"id\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode thisAccount_Node = transactionsNode.path(\"this_account\");\r\n\t\t\t\t\t\thclFieldTransaction.setAccountId(thisAccount_Node.path(\"id\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode otherAccount_Node = transactionsNode.path(\"other_account\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterpartyAccount(otherAccount_Node.path(\"number\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode otherAccount_holder_Node = otherAccount_Node.path(\"holder\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterpartyName(otherAccount_holder_Node.path(\"name\").asText());\r\n\t\t\t\t\t\tJsonNode metadata = otherAccount_Node.path(\"metadata\");\r\n\t\t\t\t\t\thclFieldTransaction.setCounterPartyLogoPath(metadata.path(\"open_corporates_URL\").asText());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionType(details.path(\"type\").asText());\r\n\t\t\t\t\t\thclFieldTransaction.setDescription(details.path(\"description\").asText());\r\n\r\n\t\t\t\t\t\tJsonNode value = details.path(\"value\");\r\n\t\t\t\t\t\thclFieldTransaction.setInstructedAmount(value.path(\"amount\").asDouble());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setInstructedCurrency(value.path(\"currency\").asText());\r\n\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionAmount(value.path(\"amount\").asDouble());\r\n\t\t\t\t\t\thclFieldTransaction.setTransactionCurrency(value.path(\"currency\").asText());\r\n\t\t\t\t\t\tlogger.debug(\"Transaction Field Row Value:: \" + hclFieldTransaction.toString());\r\n\r\n\t\t\t\t\t\t/* Adding specific type of transaction list into one ArrayList */\r\n\t\t\t\t\t\ttransactionList.add(hclFieldTransaction);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.error(\"Exception : getTransactionbyType() :: \", e);\r\n\t\t}\r\n\t\tlogger.info(\"Return value from service layer:: getTransactionbyType() :: \" + transactionList.toString());\r\n\t\treturn transactionList;\r\n\r\n\t}", "public void chosePaymentMethod(String paymentMode) {\n\t\tswitch (paymentMode) {\n\t\tcase \"COD\":\n\t\t\tPayMethod = new cashOnDelivery();\n\t\n\t\t\tbreak;\n\t\t\t\n\t\tcase \"creditCard\":\n\t\t\tPayMethod = new creditCard();\n\t\t\t\n\t\t\tbreak;\n\t\t\t\n\t\tcase \"debitCard\":\n\t\t\tPayMethod = new debitCard();\n\t\n\t\t\tbreak;\n\t\t\t\n\t\tcase \"netBanking\":\n\t\t\tPayMethod =new netBanking();\n\t\t\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tPayMethod =null;\n\t\t\tbreak;\n\t\t}\n\n\t}", "public PaymentType getPaymentType() {\n\t\treturn paymentType;\n\t}", "@Override\r\n\tpublic void solicitarTipoTransaccion() {\n\t\tSystem.out.println(\"Escoger tipo de transaccion\");\r\n\t\t\r\n\t}", "public String getOrderType(@XPath(value = \"/order:order/order:type\",\n namespaces = @NamespacePrefix(prefix = \"order\", uri = \"http://vpsdemo.no/order/v1\")) String type) {\n \tif (buy.equals(\"buy\")) {\n return buy;\n }\t else if (sell.equals(\"sell\")) {\n return sell;\n } else {\n return unknown;\n }\n }", "public void setPaymentType(PaymentType paymentType) {\n\t\tthis.paymentType = paymentType;\n\t}", "@Override\n\tpublic String showTypeCard() {\n\t\treturn \"It's payment by Visa\";\n\t}", "java.lang.String getBankNo();", "public abstract java.util.Set getPaymentTypes();", "public void payment(double total_sales_of_transaction) {\n String payment_typ = \"\";\n Scanner scan = new Scanner(System.in);\n\n System.out.printf(\"Which payment type do you wish to use?\\n\");\n System.out.printf(\"1. Cash\\n\");\n System.out.printf(\"2. Card\\n\");\n \n\n do {\n System.out.printf(\"Please enter your choice :\");\n try {\n choice = scan.nextInt();\n } catch (InputMismatchException e) {\n scan.next();\n System.out.println(\"Something went wrong.\\n\");\n }\n } while (choice<1 || choice >2);\n\n \n\n\n if (choice == 2) {\n boolean valid_ccN = false;\n cerdit_card_ID = scan.nextLine();\n while (valid_ccN == false) {\n valid_ccN = verifiying_payment(cerdit_card_ID);\n if(valid_ccN == true){break;}\n scan.next();\n System.out.println(\"Please enter a valid CC number :\");\n cerdit_card_ID = scan.nextLine();\n }\n\n System.out.println(\"Your payment has been accpeted.\\n\");\n payment_typ = \"CC\";\n payment_used = \"CARD\";\n\n } else {\n verifiying_payment();\n payment_typ = \"C\";\n payment_used = \"CASH\";\n\n }\n\n payment_id = generate_payment_ID(payment_typ);\n printPaymentSummary();\n }", "public void setCreditCardType (String CreditCardType);", "private void doBankRequest(final String amount) {\n ParseObject bankRequest = new ParseObject(Constants.CLASS_TRANSACTIONS);\n bankRequest.put(Constants.CLASS_TRANSACTIONS_FROM, mCurrentUser);\n bankRequest.put(Constants.CLASS_TRANSACTIONS_TYPE, Constants.CLASS_TRANSACTIONS_TYPE_FUNDS_REQUEST_BANK);\n bankRequest.put(Constants.CLASS_TRANSACTIONS_AMOUNT, Integer.parseInt(amount));\n bankRequest.put(Constants.CLASS_TRANSACTIONS_RESOLUTION, false);\n bankRequest.saveInBackground(new SaveCallback() {\n @Override\n public void done(ParseException e) {\n mProgressBar.setVisibility(View.INVISIBLE);\n if (e == null) {\n\n bankRequestObject = new JSONObject();\n try {\n bankRequestObject.put(Constants.CLASS_TRANSACTIONS_FROM, mUserId);\n bankRequestObject.put(Constants.CLASS_TRANSACTIONS_TYPE, Constants.CLASS_TRANSACTIONS_TYPE_FUNDS_REQUEST_BANK);\n bankRequestObject.put(Constants.CLASS_TRANSACTIONS_AMOUNT, Integer.parseInt(amount));\n } catch (JSONException el) {\n el.printStackTrace();\n }\n\n saveTransaction(amount, Constants.CLASS_TRANSACTIONS_TYPE_FUNDS_REQUEST_BANK);\n\n Logger.s(getApplicationContext(), getString(R.string.request_sent_message_txt));\n IntentUtils.startActivity(RequestFundsActivity.this, HomeActivity.class);\n finish();\n } else if (e.getCode() == ParseException.CONNECTION_FAILED || e.getCode() == ParseException.TIMEOUT) {\n mButton.setEnabled(true);\n Logger.s(getApplicationContext(), getString(R.string.network_timeout_message_txt));\n } else {\n mButton.setEnabled(true);\n Logger.s(getApplicationContext(), getString(R.string.general_error_message_txt));\n }\n }\n });\n }", "public Account transactionMenu(boolean transferOut){\r\n String typeOfAccount = null;\r\n int accountNum = 0;\r\n int numAccounts = -1;\r\n\r\n boolean selectionNotMade = true;\r\n while (selectionNotMade) {\r\n System.out.println(\"Select account type:\");\r\n if (!transferOut) {\r\n System.out.println(\" 1. Credit Card\");\r\n }\r\n System.out.println(\" 2. Line Of Credit\");\r\n System.out.println(\" 3. Chequing\");\r\n System.out.println(\" 4. Savings\");\r\n typeOfAccount = BankMachine.getInput();\r\n switch (typeOfAccount){\r\n case \"1\":\r\n if (!transferOut) {\r\n numAccounts = creditCounter;\r\n break;\r\n }\r\n case \"2\":\r\n numAccounts = lineOfCreditCounter;\r\n break;\r\n case \"3\":\r\n numAccounts = chequingCounter;\r\n break;\r\n case \"4\":\r\n numAccounts = savingCounter;\r\n break;\r\n default:\r\n System.out.println(\"INVALID ENTRY\");\r\n numAccounts = -1;\r\n break;\r\n }\r\n if (numAccounts == 0){\r\n System.out.println(\"You have no accounts of this type\\n\");\r\n } else if (numAccounts != -1){\r\n selectionNotMade = false;\r\n }\r\n }\r\n boolean accountLoop = true;\r\n System.out.println(\"Currently there are \" + numAccounts + \" of these accounts.\");\r\n while (accountLoop){\r\n System.out.println(\"Enter the number of the account you wish to access:\");\r\n String withdrawAccount = BankMachine.getInput();\r\n if (withdrawAccount.matches(\"-?\\\\d+\")){\r\n accountNum = Integer.parseInt(withdrawAccount);\r\n if (accountNum > 0 && accountNum <= numAccounts){\r\n accountLoop = false;\r\n }else{\r\n System.out.println(\"INVALID ENTRY\");\r\n }\r\n }\r\n else{\r\n System.out.println(\"INVALID ENTRY\");\r\n }\r\n }\r\n return getSpecifiedAccount(typeOfAccount, accountNum);\r\n }", "@Override\n public byte getSubtype() {\n return SUBTYPE_PAYMENT_ORDINARY_PAYMENT;\n }", "TokenlyCurrency getCurrencyType();", "private String getFundingLabel(String type, Locale locale) {\n String paymentMethodLabel = \"\";\n if (type.equalsIgnoreCase(PdfConstants.PROMO_CREDIT)) {\n paymentMethodLabel = getMessage(locale, \"pdf.receipt.promoCredit\");\n } else if (type.equalsIgnoreCase(PdfConstants.BLACKHAWK)) {\n paymentMethodLabel = getMessage(locale, \"pdf.receipt.reloaditPack\");\n } else if (type.equalsIgnoreCase(PdfConstants.PRECASH)) {\n paymentMethodLabel = getMessage(locale, \"pdf.receipt.evolvePayBucks\");\n } else if (type.equalsIgnoreCase(PdfConstants.INCOMM)) {\n paymentMethodLabel = getMessage(locale, \"pdf.receipt.vanillaReload\");\n }\n return paymentMethodLabel;\n }", "@Override\r\n\t\t\tpublic void onClick(View v) {\n\r\n\t\t\t\tpayment_type = \"2\";\r\n\r\n\t\t\t}", "io.opencannabis.schema.commerce.Payments.PaymentMethod getMethod();", "public void setPaymentAmountType(String paymentAmountType) {\r\n this.paymentAmountType = paymentAmountType;\r\n }", "public String getJP_BankDataCustomerCode2();", "public PaymentType typeOfPayment() {\n\t\treturn category.Comision;\n\t}", "public int getRequestableBank() \n {\n return -1; \n }", "@Override\r\n\t\t\tpublic void onClick(View v) {\n\r\n\t\t\t\tpayment_type = \"1\";\r\n\r\n\t\t\t}", "public String getJP_BankDataCustomerCode1();", "public String getCreditCardType();", "public WebElement selectSavedCardPaymentMode() {\n\t\treturn wait.until(ExpectedConditions.elementToBeClickable(findElement(\n\t\t\t\trepositoryParser, PAGE_NAME, \"savedCard\")));\n\t}", "public void teste() {\n\t\tSelect billingMasterPolicy = new Select(comboBillingMasterPolicy);\n\t\tWebElement WebL = billingMasterPolicy.getFirstSelectedOption();\n\t\tString planoRisco = WebL.getAttribute(\"text\");\n\t\tSystem.out.println(\"Teste: \"+ planoRisco);\n\t}", "public void selectDeal() {\n\t}", "CashSettlementMethodEnum getCashSettlementMethod();", "public static final TransactionType findTransactionType(byte type, byte subtype) {\n TransactionType txType = null;\n switch (type) {\n case TYPE_PAYMENT:\n switch (subtype) {\n case SUBTYPE_PAYMENT_ORDINARY_PAYMENT:\n txType = Payment.ORDINARY;\n break;\n }\n break;\n case TYPE_MESSAGING:\n switch (subtype) {\n case SUBTYPE_MESSAGING_ARBITRARY_MESSAGE:\n txType = Messaging.ARBITRARY_MESSAGE;\n break;\n case SUBTYPE_MESSAGING_ALIAS_ASSIGNMENT:\n txType = Messaging.ALIAS_ASSIGNMENT;\n break;\n case SUBTYPE_MESSAGING_POLL_CREATION:\n txType = Messaging.POLL_CREATION;\n break;\n case SUBTYPE_MESSAGING_VOTE_CASTING:\n txType = Messaging.VOTE_CASTING;\n break;\n case SUBTYPE_MESSAGING_HUB_ANNOUNCEMENT:\n txType = Messaging.HUB_ANNOUNCEMENT;\n break;\n case SUBTYPE_MESSAGING_ACCOUNT_INFO:\n txType = Messaging.ACCOUNT_INFO;\n break;\n case SUBTYPE_MESSAGING_ALIAS_SELL:\n txType = Messaging.ALIAS_SELL;\n break;\n case SUBTYPE_MESSAGING_ALIAS_BUY:\n txType = Messaging.ALIAS_BUY;\n break;\n case SUBTYPE_MESSAGING_ALIAS_DELETE:\n txType = Messaging.ALIAS_DELETE;\n break;\n case SUBTYPE_MESSAGING_PHASING_VOTE_CASTING:\n txType = Messaging.PHASING_VOTE_CASTING;\n break;\n }\n break;\n case TYPE_COLORED_COINS:\n switch (subtype) {\n case SUBTYPE_COLORED_COINS_ASSET_ISSUANCE:\n txType = ColoredCoins.ASSET_ISSUANCE;\n break;\n case SUBTYPE_COLORED_COINS_ASSET_TRANSFER:\n txType = ColoredCoins.ASSET_TRANSFER;\n break;\n case SUBTYPE_COLORED_COINS_ASK_ORDER_PLACEMENT:\n txType = ColoredCoins.ASK_ORDER_PLACEMENT;\n break;\n case SUBTYPE_COLORED_COINS_BID_ORDER_PLACEMENT:\n txType = ColoredCoins.BID_ORDER_PLACEMENT;\n break;\n case SUBTYPE_COLORED_COINS_ASK_ORDER_CANCELLATION:\n txType = ColoredCoins.ASK_ORDER_CANCELLATION;\n break;\n case SUBTYPE_COLORED_COINS_BID_ORDER_CANCELLATION:\n txType = ColoredCoins.BID_ORDER_CANCELLATION;\n break;\n case SUBTYPE_COLORED_COINS_DIVIDEND_PAYMENT:\n txType = ColoredCoins.DIVIDEND_PAYMENT;\n break;\n }\n break;\n case TYPE_DIGITAL_GOODS:\n switch (subtype) {\n case SUBTYPE_DIGITAL_GOODS_LISTING:\n txType = DigitalGoods.LISTING;\n break;\n case SUBTYPE_DIGITAL_GOODS_DELISTING:\n txType = DigitalGoods.DELISTING;\n break;\n case SUBTYPE_DIGITAL_GOODS_PRICE_CHANGE:\n txType = DigitalGoods.PRICE_CHANGE;\n break;\n case SUBTYPE_DIGITAL_GOODS_QUANTITY_CHANGE:\n txType = DigitalGoods.QUANTITY_CHANGE;\n break;\n case SUBTYPE_DIGITAL_GOODS_PURCHASE:\n txType = DigitalGoods.PURCHASE;\n break;\n case SUBTYPE_DIGITAL_GOODS_DELIVERY:\n txType = DigitalGoods.DELIVERY;\n break;\n case SUBTYPE_DIGITAL_GOODS_REFUND:\n txType = DigitalGoods.REFUND;\n break;\n case SUBTYPE_DIGITAL_GOODS_FEEDBACK:\n txType = DigitalGoods.FEEDBACK;\n break;\n }\n break;\n case TYPE_ACCOUNT_CONTROL:\n switch (subtype) {\n case SUBTYPE_ACCOUNT_CONTROL_EFFECTIVE_BALANCE_LEASING:\n txType = AccountControl.EFFECTIVE_BALANCE_LEASING;\n break;\n }\n break;\n case TYPE_MONETARY_SYSTEM:\n switch (subtype) {\n case SUBTYPE_MONETARY_SYSTEM_CURRENCY_ISSUANCE:\n txType = MonetarySystem.CURRENCY_ISSUANCE;\n break;\n case SUBTYPE_MONETARY_SYSTEM_RESERVE_INCREASE:\n txType = MonetarySystem.RESERVE_INCREASE;\n break;\n case SUBTYPE_MONETARY_SYSTEM_RESERVE_CLAIM:\n txType = MonetarySystem.RESERVE_CLAIM;\n break;\n case SUBTYPE_MONETARY_SYSTEM_CURRENCY_TRANSFER:\n txType = MonetarySystem.CURRENCY_TRANSFER;\n break;\n case SUBTYPE_MONETARY_SYSTEM_PUBLISH_EXCHANGE_OFFER:\n txType = MonetarySystem.PUBLISH_EXCHANGE_OFFER;\n break;\n case SUBTYPE_MONETARY_SYSTEM_EXCHANGE_BUY:\n txType = MonetarySystem.EXCHANGE_BUY;\n break;\n case SUBTYPE_MONETARY_SYSTEM_EXCHANGE_SELL:\n txType = MonetarySystem.EXCHANGE_SELL;\n break;\n case SUBTYPE_MONETARY_SYSTEM_CURRENCY_MINTING:\n txType = MonetarySystem.CURRENCY_MINTING;\n break;\n case SUBTYPE_MONETARY_SYSTEM_CURRENCY_DELETION:\n txType = MonetarySystem.CURRENCY_DELETION;\n break;\n }\n case TYPE_DATA:\n switch (subtype) {\n case SUBTYPE_DATA_TAGGED_DATA_UPLOAD:\n txType = Data.TAGGED_DATA_UPLOAD;\n break;\n case SUBTYPE_DATA_TAGGED_DATA_EXTEND:\n txType = Data.TAGGED_DATA_EXTEND;\n break;\n }\n }\n return txType;\n }", "public PURCHASE_TYPE getType(){\n return type;\n }", "@Override\n public byte getSubtype() {\n return SUBTYPE_MONETARY_SYSTEM_CURRENCY_TRANSFER;\n }", "public String getPredefinedType() {\n return \"purchase\";\n }", "PaymentMethod getPaymentMethod();", "List selectByExample(PaymentTradeExample example);", "@Override\n public String getDescription() {\n return \"Transfer currency\";\n }", "abstract void addDepositTransaction(Transaction deposit, Ui ui, String bankType) throws BankException;", "public LookupAccountTransactions sigType(Enums.SigType sigType) {\n addQuery(\"sig-type\", String.valueOf(sigType));\n return this;\n }", "public Integer getPayType() {\n\t\treturn payType;\n\t}", "public String getBank() {\r\n return bank;\r\n }", "public String getBank() {\r\n return bank;\r\n }", "public void setPayType(Boolean payType) {\n this.payType = payType;\n }", "public Builder copy (PaymentType paymentType)\n {\n this.cashPayment = paymentType.cashPayment;\n this.eftPayment = paymentType.eftPayment;\n return this;\n }", "private void returnDeposit(String paymentInfo) {\n }", "ApiSubCtgrVO selectApiSubCtgr(ApiSubCtgrRequest.ApiSubCtgrDetilRequest apiSubCtgrDetilRequest);", "public void chooseRetailAccountType() {\n click(By.id(\"LoginAsRetail\"));\n }", "@Override\r\n\t\t\tpublic void onClick(View v) {\n\r\n\t\t\t\tpayment_type = \"0\";\r\n\r\n\t\t\t}", "public void donutTypeChosen()\n {\n changeSubtotalTextField();\n }", "public ArrayList<PaymentTypeObject> getPaymentTypes(PaymentTypeObject paymenttype_obj) throws AppException;", "public void setPaymentType(String paymentType) {\r\n this.paymentType = paymentType == null ? null : paymentType.trim();\r\n }", "public PaymentGatewayType getType() {\n return this.paymentGatewayType;\n }", "public String getPaymentTypeName() {\n return paymentTypeName;\n }", "public void mutualFund(){\r\n\t\tSystem.out.println(\"HSBC ---mutualFund method called from Interface BrazilBank\");\r\n\t}", "@Override\r\n\tpublic List<Sigdet> sigpaydet(int prpaycode) {\n\t\treturn this.session.selectList(\"com.icss.dao.PayRecordMapper.sigpaydet\",prpaycode);\r\n\t}" ]
[ "0.6394701", "0.6285461", "0.62180436", "0.6162519", "0.6132328", "0.607082", "0.60644245", "0.6061648", "0.5966865", "0.5881628", "0.5866391", "0.58588475", "0.5829583", "0.58094007", "0.5762918", "0.57485026", "0.5738911", "0.57150614", "0.56884104", "0.5683842", "0.5660498", "0.5636721", "0.56295377", "0.5584529", "0.5579621", "0.5579621", "0.55721754", "0.5517115", "0.54933876", "0.54842705", "0.5481353", "0.54798806", "0.54770905", "0.5472299", "0.5450139", "0.5446497", "0.54420084", "0.5438706", "0.54372114", "0.54183257", "0.5411117", "0.539723", "0.5388396", "0.5353544", "0.53257626", "0.5325612", "0.53141683", "0.5313398", "0.5291653", "0.52693665", "0.5269325", "0.52377176", "0.523423", "0.523029", "0.5229329", "0.5219711", "0.5211532", "0.5209704", "0.520909", "0.5205918", "0.52053195", "0.5203738", "0.5203426", "0.5199147", "0.5198174", "0.5191809", "0.51837945", "0.5176277", "0.51708317", "0.51450694", "0.5119292", "0.51157445", "0.51116806", "0.5110336", "0.5085991", "0.50835246", "0.50831634", "0.5082508", "0.5068675", "0.50686234", "0.5064294", "0.50595903", "0.5050839", "0.5047626", "0.50474644", "0.50464207", "0.50464207", "0.5043233", "0.5042672", "0.50369984", "0.5035607", "0.5032824", "0.5027821", "0.50238186", "0.50132376", "0.50059146", "0.49990964", "0.49955904", "0.49841982", "0.49831992" ]
0.53260684
44