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
java 8 + the same : or or or, even, use code of those guys who do God's work
public static <E, R> R foldLeft(Iterable<E> elems, R init, BiFunction<R, E, R> foldFun) { R acc = init; for (E elem : elems) { acc = foldFun.apply(acc, elem); } return acc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String getOr_op();", "@Test\n public void testPredicateOr() {\n Predicate<Integer> isEven = (x) -> (x % 2) == 0;\n Predicate<Integer> isDivSeven = (x) -> (x % 7) == 0;\n\n Predicate<Integer> evenOrDivSeven = isEven.or(isDivSeven);\n\n assertTrue(evenOrDivSeven.apply(14));\n ...
[ "0.63316035", "0.6288207", "0.62427825", "0.62328535", "0.61083424", "0.5953674", "0.5937035", "0.5907061", "0.58002776", "0.57688814", "0.5762468", "0.57302904", "0.57302904", "0.57231504", "0.56890595", "0.5683334", "0.56766796", "0.5671523", "0.5588098", "0.55437595", "0.5...
0.0
-1
select the next tab by index(1)
@Override public void handle(ActionEvent event) { InnerPaneCreator.getChildTabPanes()[2].getSelectionModel().select(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void switchNextTabulator() {\r\n\t\tCTabItem[] tabItems = this.displayTab.getItems();\r\n\t\tfor (int i = 0; i < tabItems.length; i++) {\r\n\t\t\tCTabItem tabItem = tabItems[i];\r\n\t\t\tif (tabItem.getControl().isVisible()) {\r\n\t\t\t\tif (i + 1 <= tabItems.length - 1)\r\n\t\t\t\t\ttabItem.getParent().set...
[ "0.7506087", "0.7183566", "0.6971282", "0.6475178", "0.6448749", "0.6233646", "0.62167925", "0.62073994", "0.6198597", "0.61924994", "0.6130105", "0.6107758", "0.6035242", "0.6032421", "0.5999061", "0.59900975", "0.5984373", "0.5968648", "0.59627014", "0.595345", "0.5925393",...
0.0
-1
TODO Autogenerated method stub
public void onNothingSelected(AdapterView<?> arg0) { }
{ "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 getExr...
[ "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.608016...
0.0
-1
Processes requests for both HTTP GET and POST methods.
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); //comienza con la autentificacion que es acto 1 if("1".equals(request.getParameter("acto"))){ //verifica que no sean nullos o sin texto antes que nada los campos y en caso contrario mostrara un mensaje para que //el usuario ingrese su inicio de sesion if(!"".equals(request.getParameter("usuario")) && request.getParameter("usuario")!=null &&!"".equals(request.getParameter("clave")) && request.getParameter("clave")!=null){ //se conecta a la bdd con la consulta correspondiente en la tabla usuariosla cual de todos los usuarios registrados los //reccore para ver si coinciden que el que se ha ingresado try{ Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/requerimiento?zeroDateTimeBehavior=convertToNull","root",""); String query="select nick,contraseña from usuarios "; Statement st=conn.createStatement(); ResultSet rs=st.executeQuery(query); while(rs.next()){ //si el usuario ingresado coincide con los usuarios registrados accedera al menu principal if(request.getParameter("usuario").equals(rs.getString("nick")) &&request.getParameter("clave").equals(rs.getString("contraseña")) ){ request.getRequestDispatcher("Menu_principal.jsp").forward(request, response); } }{ //en caso que no encuentre registros coincidentes mandara el siguiente mensaje request.setAttribute("vacio","Su nombre de usuario y contraseña no coinciden con un usuario registrado"); request.getRequestDispatcher("index.jsp").forward(request, response);} //en caso que no este conectada la bdd mandara el siguiente mensaje y cargara la pagina otra vez //evitando que se caiga }catch(ClassNotFoundException | SQLException e){ request.setAttribute("vacio","No hay conexion"); request.getRequestDispatcher("index.jsp").forward(request, response);} } //manda el siguiente mensaje si no se ingresan datos en los campos y oprimen el submit else{ request.setAttribute("vacio","Ingrese su nombre de usuario y contraseña"); request.getRequestDispatcher("index.jsp").forward(request, response); } } //acto 2 ingresar requerimientos if("2".equals(request.getParameter("acto"))){ //se valida que los campos no tengan los valores por defecto de los option y el campo //descripcion verifica que no este vacio y sea menor a 300 caracteres if(!"1".equals(request.getParameter("gerencia")) && !"1".equals(request.getParameter("departamentog")) && !"1".equals(request.getParameter("departamentosm")) && !"1".equals(request.getParameter("encargados")) && !"".equals(request.getParameter("descripcion")) && 300>=request.getParameter("descripcion").length() ){ //conecta a la bdd cada valor a insertar sera los parametros pasados a travez de los option de cada campo mas el campo de texto //descripcion del requerimiento try{ int update; Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/requerimiento?zeroDateTimeBehavior=convertToNull","root",""); String query="INSERT INTO requerimientos VALUES('"+request.getParameter("gerencia")+"','"+request.getParameter("departamentog")+"','"+ request.getParameter("departamentosm")+"','"+request.getParameter("encargados")+"','"+request.getParameter("descripcion")+"','Abierto',null)"; Statement st=conn.createStatement(); update=st.executeUpdate(query); //confirma al usuario el registro del requerimiento if(update==1){ request.setAttribute("vacio1","El requerimiento se a registrado correctamente "); } request.getRequestDispatcher("Ingresar_requerimiento.jsp").forward(request, response); } //en caso de falla mandara el siguiente mensaje catch(ClassNotFoundException | SQLException e){ request.setAttribute("vacio1","El requerimiento que ingreso ya se encuentra registrado o no hay conexion con la base de datos"); request.getRequestDispatcher("Ingresar_requerimiento.jsp").forward(request, response); } //en caso que los campo no se ubieran ingresado valores o supere los 300 caracteres descripcion enviara el siguiente mensaje }else{ request.setAttribute("vacio1","Ingrese parametros validos, recuerde que la" + " descripcion del requerimiento solo puede contener maximo 300 caracateres "); request.getRequestDispatcher("Ingresar_requerimiento.jsp").forward(request, response); } } //consulta los requerimietos acto 3 if("3".equals(request.getParameter("acto"))){ //se crea la consulta predeterminada String query1="select*from requerimientos "; String p1=""; String p2=""; String p3=""; //si se selecciona una opcion de gerencia agrega la condicion del where para que muestre segun ese gerente se agrega a p1 que se concatenara //con las demas variables if(!"1".equals(request.getParameter("gerencia"))){ p1="where gerencia='"+request.getParameter("gerencia")+"' "; } //consulta si se ingreso un dato pregunta si se eligio un gerente estonces pasa a ser el else que pone el and en vez de where en caso que //se ubiera elegido un gerente y se concatenara con las demas if(!"1".equals(request.getParameter("departamentog"))){ if("".equals(p1)){ p2="where departamento='"+request.getParameter("departamentog")+"' "; }else{ p2="and departamento='"+request.getParameter("departamentog")+"' "; } } //pregunta si selecciono un dato de los departamentos de mantencion si se selecciono una opcion si los campos anteriores no se seleccionaron // opciones se asigna la condicion where y si se seleccionaron opciones añade el and if(!"1".equals(request.getParameter("departamentosm"))){ if("".equals(p1) || "".equals(p2)){ p3="where departamentom='"+request.getParameter("departamentosm")+"' "; }else{ p3="and departamentom='"+request.getParameter("departamentosm")+"' "; } } //se concatena tod para hacer la consulta completa segun las opciones que se eligieron String query2=query1+""+p1+""+p2+""+p3; //se envia el string concatenado request.setAttribute("query1",query2); request.getRequestDispatcher("Consultar_requerimientos.jsp").forward(request, response); } //lo mismo que acto 3 consultar requerimiento este hace la consulta para buscar requerimietnos a cerrar // en cerrar requerimientos acto 4 if("4".equals(request.getParameter("acto"))){ String query1="select*from requerimientos "; String p1=""; String p2=""; String p3=""; if(!"1".equals(request.getParameter("gerencia"))){ p1="where gerencia='"+request.getParameter("gerencia")+"' "; } if(!"1".equals(request.getParameter("departamentog"))){ if("".equals(p1)){ p2="where departamento='"+request.getParameter("departamentog")+"' "; }else{ p2="and departamento='"+request.getParameter("departamentog")+"' "; } } if(!"1".equals(request.getParameter("departamentosm"))){ if("".equals(p1) && "".equals(p2)){ p3="where departamentom='"+request.getParameter("departamentosm")+"' "; }else{ p3="and departamentom='"+request.getParameter("departamentosm")+"' "; } } String query2=query1+""+p1+""+p2+""+p3; request.setAttribute("query1",query2); request.getRequestDispatcher("Cerrar_requerimientos.jsp").forward(request, response); } //aqui este es el complemento de cerrar requerimiento acto 5 se envia el parametro del requerimiento a cerra //en la base de datos se les asigno un codigo unico autoincrementable que identifica los requerimientos //el cual aqui se utilizara para darle a ese requerimiento el estado de cerrado con el update if("5".equals(request.getParameter("acto"))){ try{ int update; Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/requerimiento?zeroDateTimeBehavior=convertToNull","root",""); String query="update requerimientos set estado='Cerrado' where codigo="+request.getParameter("codigo")+""; Statement st=conn.createStatement(); update=st.executeUpdate(query); //envia el siguiente mensaje si cambio el requerimiento correctamente if(update==1){ request.setAttribute("vacio","El requerimiento se cerro correctamente"); } request.getRequestDispatcher("Cerrar_requerimientos.jsp").forward(request, response); } //en caso de error enviara el siguiente mensaje catch(ClassNotFoundException | SQLException e){ request.setAttribute("vacio","se a perdido la conexion"); request.getRequestDispatcher("Cerrar_requerimientos.jsp").forward(request, response); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@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_...
[ "0.7004024", "0.66585696", "0.66031146", "0.6510023", "0.6447109", "0.64421695", "0.64405906", "0.64321136", "0.6428049", "0.6424289", "0.6424289", "0.6419742", "0.6419742", "0.6419742", "0.6418235", "0.64143145", "0.64143145", "0.6400266", "0.63939095", "0.63939095", "0.6392...
0.0
-1
Handles the HTTP GET method.
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void doGet( )\n {\n \n }", "@Override\n\tprotected void executeGet(GetRequest request, OperationResponse response) {\n\t}", "@Override\n\tprotected Method getMethod() {\n\t\treturn Method.GET;\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) thro...
[ "0.7589609", "0.71665615", "0.71148175", "0.705623", "0.7030174", "0.70291144", "0.6995984", "0.697576", "0.68883485", "0.6873811", "0.6853569", "0.6843572", "0.6843572", "0.6835363", "0.6835363", "0.6835363", "0.68195957", "0.6817864", "0.6797789", "0.67810035", "0.6761234",...
0.0
-1
Handles the HTTP POST method.
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void doPost(Request request, Response response) {\n\n\t}", "@Override\n protected void doPost(HttpServletRequest req, HttpServletResponse resp) {\n }", "public void doPost( )\n {\n \n }", "@Override\n public String getMethod() {\n return \"POST\";\n ...
[ "0.7328622", "0.71362936", "0.71159834", "0.7105317", "0.71003336", "0.7023263", "0.7016442", "0.6963624", "0.6888417", "0.6782968", "0.6774532", "0.6746133", "0.66671413", "0.65574837", "0.65565485", "0.65244085", "0.65239", "0.65239", "0.65239", "0.6521753", "0.6519228", ...
0.0
-1
Returns a short description of the servlet.
@Override public String getServletInfo() { return "Short description"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getServletInfo()\n {\n return \"Short description\";\n }", "public String getServletInfo() {\n return \"Short description\";\n }", "public String getServletInfo() {\n return \"Short description\";\n }", "public String getServletInfo() {\n return \"Short d...
[ "0.87634975", "0.8732279", "0.8732279", "0.8732279", "0.8732279", "0.8732279", "0.8732279", "0.8732279", "0.8732279", "0.8732279", "0.8732279", "0.8699131", "0.8699131", "0.8699131", "0.8699131", "0.8699131", "0.8699131", "0.8531295", "0.8531295", "0.85282224", "0.85282224", ...
0.0
-1
FearGreed feerGreed = new FearGreed();
public static JSONObject load() throws Exception { JSONObject json; try { clbHttpClient = HttpClients.createDefault(); HttpGet httpGet = new HttpGet("https://api.alternative.me/fng/"); httpGet.setHeader(USER_AGENT, HEADER); response = clbHttpClient.execute(httpGet); StatusLine sl = response.getStatusLine(); if (sl.getStatusCode() == HttpStatus.SC_OK) { json = new JSONObject(EntityUtils.toString(response.getEntity(), "ISO8859_1")); } else { throw new Exception("Erro na captura do Fear And Greed Index"); } } finally { clbHttpClient.close(); } return json; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public FruitStand() {}", "static Football getFootBall(){\n return new Football();\n }", "public foodRecommended() {\n\n }", "private Fight() { }", "public God() {}", "public Sad() {\n }", "public GameMain()\n {\n allenBad = new AllenSucks(this);\n }", "public Gov() {\n ...
[ "0.628613", "0.6194183", "0.6119459", "0.61021733", "0.6081575", "0.6056434", "0.595632", "0.59529096", "0.59176755", "0.58517087", "0.58483064", "0.5832169", "0.5740572", "0.5662949", "0.5647712", "0.56468797", "0.56315565", "0.5621757", "0.5615774", "0.5610501", "0.5600902"...
0.0
-1
Common interface for client and server to implement to construct the Netty versions of the request objects.
public interface NettyHttpRequestBuilder { /** * Converts this object to a full http request. * * @return a full http request */ @NonNull FullHttpRequest toFullHttpRequest(); /** * Converts this object to a streamed http request. * @return The streamed request */ @NonNull StreamedHttpRequest toStreamHttpRequest(); /** * Converts this object to the most appropriate http request type. * @return The http request */ @NonNull HttpRequest toHttpRequest(); /** * @return Is the request a stream. */ boolean isStream(); /** * Convert the given request to a full http request. * @param request The request * @return The full request. */ static @NonNull HttpRequest toHttpRequest(@NonNull io.micronaut.http.HttpRequest<?> request) { Objects.requireNonNull(request, "The request cannot be null"); while (request instanceof HttpRequestWrapper) { request = ((HttpRequestWrapper<?>) request).getDelegate(); } if (request instanceof NettyHttpRequestBuilder) { return ((NettyHttpRequestBuilder) request).toHttpRequest(); } // manual conversion HttpRequest nettyRequest; ByteBuf byteBuf = request.getBody(ByteBuf.class).orElse(null); if (byteBuf != null) { nettyRequest = new DefaultFullHttpRequest( HttpVersion.HTTP_1_1, HttpMethod.valueOf(request.getMethodName()), request.getUri().toString(), byteBuf ); } else { nettyRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(request.getMethodName()), request.getUri().toString() ); } request.getHeaders() .forEach((s, strings) -> nettyRequest.headers().add(s, strings)); return nettyRequest; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "netty.framework.messages.TestMessage.TestRequest getRequest();", "public interface NettyTransportRequestProcessor {\n\n /**\n * process transport request\n *\n * @param ctx context\n * @param request request\n * @return response packet\n */\n Packet process(final ChannelHandlerC...
[ "0.63511443", "0.63472855", "0.6286391", "0.61373216", "0.60865533", "0.6062335", "0.59952146", "0.5951587", "0.5927217", "0.5903787", "0.59005415", "0.59005415", "0.5899705", "0.5892534", "0.57969755", "0.5743186", "0.56979465", "0.5693503", "0.56781685", "0.56567985", "0.56...
0.6791244
0
Converts this object to a full http request.
@NonNull FullHttpRequest toFullHttpRequest();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@NonNull\n HttpRequest toHttpRequest();", "private final static HttpRequest createRequest() {\r\n\r\n HttpRequest req = new BasicHttpRequest\r\n (\"GET\", \"/\", HttpVersion.HTTP_1_1);\r\n //(\"OPTIONS\", \"*\", HttpVersion.HTTP_1_1);\r\n\r\n return req;\r\n }", "public ...
[ "0.6687476", "0.6299719", "0.6274756", "0.6186407", "0.61804265", "0.61703086", "0.6089682", "0.6017107", "0.5875485", "0.58656555", "0.58524585", "0.57854956", "0.5749418", "0.56960315", "0.56806976", "0.56797594", "0.5619839", "0.5604239", "0.557637", "0.54847795", "0.54698...
0.6778203
0
Converts this object to a streamed http request.
@NonNull StreamedHttpRequest toStreamHttpRequest();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public interface NettyHttpRequestBuilder {\n /**\n * Converts this object to a full http request.\n *\n * @return a full http request\n */\n @NonNull\n FullHttpRequest toFullHttpRequest();\n\n /**\n * Converts this object to a streamed http request.\n * @return The streamed requ...
[ "0.58239996", "0.5439578", "0.5367305", "0.5349496", "0.52394223", "0.52272886", "0.52260137", "0.5158843", "0.51288605", "0.50900483", "0.5055913", "0.5029401", "0.50200844", "0.50134194", "0.49728763", "0.49676234", "0.49140248", "0.4901108", "0.48888585", "0.4815034", "0.4...
0.7943792
0
Converts this object to the most appropriate http request type.
@NonNull HttpRequest toHttpRequest();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public Type getType() {\n return Type.TypeRequest;\n }", "public String getRequestType() { return this.requestType; }", "public static String getRequestType(){\n return requestType;\n }", "public java.lang.String getRequestType() {\n return requestType;\n }", "public RequestT...
[ "0.63118106", "0.6218617", "0.5825573", "0.5815982", "0.5807164", "0.57620466", "0.5754156", "0.5718194", "0.56688225", "0.5617435", "0.56014365", "0.5538676", "0.5537839", "0.5500276", "0.5486624", "0.54669154", "0.5390886", "0.5388457", "0.5351325", "0.5337475", "0.5325841"...
0.50584894
40
Convert the given request to a full http request.
static @NonNull HttpRequest toHttpRequest(@NonNull io.micronaut.http.HttpRequest<?> request) { Objects.requireNonNull(request, "The request cannot be null"); while (request instanceof HttpRequestWrapper) { request = ((HttpRequestWrapper<?>) request).getDelegate(); } if (request instanceof NettyHttpRequestBuilder) { return ((NettyHttpRequestBuilder) request).toHttpRequest(); } // manual conversion HttpRequest nettyRequest; ByteBuf byteBuf = request.getBody(ByteBuf.class).orElse(null); if (byteBuf != null) { nettyRequest = new DefaultFullHttpRequest( HttpVersion.HTTP_1_1, HttpMethod.valueOf(request.getMethodName()), request.getUri().toString(), byteBuf ); } else { nettyRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(request.getMethodName()), request.getUri().toString() ); } request.getHeaders() .forEach((s, strings) -> nettyRequest.headers().add(s, strings)); return nettyRequest; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@NonNull\n HttpRequest toHttpRequest();", "void projectUriRequest(Request request);", "MovilizerRequest getRequestFromString(String requestString);", "public interface NettyHttpRequestBuilder {\n /**\n * Converts this object to a full http request.\n *\n * @return a full http request\n ...
[ "0.65624636", "0.62572193", "0.60250115", "0.59182024", "0.5896634", "0.5849623", "0.58231705", "0.58230656", "0.58219665", "0.5770996", "0.57427424", "0.56915253", "0.56262714", "0.561478", "0.5608704", "0.55987996", "0.55873895", "0.5577268", "0.5512186", "0.54953146", "0.5...
0.71011686
0
TODO put the message into db.
@Override public void onReceive(Object message) throws Exception { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Message save(Message message) {\n\n try {\n\n statement.execute(\"insert into messages (sender_id, receiver_id, transmitted_time, text)\" +\n \"values ('\" + message.getSender_id() + \"', '\" + message.getReceiver_id()\n + \"', current...
[ "0.6745767", "0.6736004", "0.66640127", "0.6662291", "0.6660139", "0.6610405", "0.65650135", "0.65232503", "0.6485447", "0.6482667", "0.64787346", "0.6395106", "0.63846785", "0.63482857", "0.63481706", "0.6297325", "0.62883687", "0.62708926", "0.62684226", "0.6261518", "0.625...
0.0
-1
Utility method that consults ParserService
public static IParser getParser(IElementType type, EObject object, String parserHint) { return ParserService.getInstance().getParser( new HintAdapter(type, object, parserHint)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "CParser getParser();", "private Parser () { }", "public interface Parser {\n\n}", "protected Parser getParser() throws TemplateException {\n try {\n return (Parser) _broker.getValue(\"parser\",\"wm\"); \n } catch (Exception e) {\n Engine.log.exception(e);\n throw new Te...
[ "0.62854147", "0.62110937", "0.61611354", "0.6061745", "0.59839976", "0.5949908", "0.57989705", "0.5777672", "0.5767841", "0.5750051", "0.57472885", "0.5714317", "0.5696972", "0.56949365", "0.56837493", "0.56254345", "0.5614715", "0.55894536", "0.5578223", "0.55448514", "0.54...
0.0
-1
returns the time taken between the last start/stop pair in milliseconds
public long stop() { long t = System.currentTimeMillis() - lastStart; if(count == 0) firstTime = t; totalTime += t; count++; updateHist(t); if(printIterval > 0 && count % printIterval == 0) System.out.println(this); return t; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getStopTime();", "public float getTime() {\n return Math.abs(endTime - startTime) / 1000000f;\n }", "public Double waitTimeCalculatior(long start) {\n\t\t\t\tdouble difference = (System.currentTimeMillis() - start);\n\t\t\t\treturn difference;\n\t\t\t}", "@Override\n\tpublic long getT...
[ "0.7359472", "0.7318707", "0.7251957", "0.715948", "0.7115583", "0.71059144", "0.70805144", "0.7065716", "0.70598775", "0.70566446", "0.7046799", "0.6981964", "0.69593346", "0.687487", "0.6865675", "0.6860775", "0.684308", "0.67524886", "0.6743099", "0.6715189", "0.67149615",...
0.6387104
51
like stop, returns the time taken between the last start/stop pair in milliseconds, but does not stop the timer.
public long sinceStart() { return System.currentTimeMillis() - lastStart; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getStopTime();", "public double getStopTime()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.apache.xmlbeans.SimpleValue target = null;\r\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_at...
[ "0.7612791", "0.71396893", "0.7093129", "0.705442", "0.6877753", "0.68204075", "0.6799701", "0.6640585", "0.6633883", "0.6614986", "0.6551813", "0.65269256", "0.6488926", "0.647796", "0.6463181", "0.6453047", "0.64108187", "0.63887626", "0.63629043", "0.6361036", "0.63583887"...
0.59559757
59
How many times start/stop has been called
public int getCount() { return count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static int getNumStarted() {\n return numStarted;\n }", "static final long getTotalStartedCount()\n {\n synchronized (threadStartLock)\n {\n return totalStartedCnt;\n }\n }", "long start();", "Long getRunningCount();", "public int getNumTimes();", "public int getCycles();", ...
[ "0.7089291", "0.6831889", "0.6732078", "0.6713753", "0.6674263", "0.6433683", "0.6390665", "0.634628", "0.6249468", "0.6225622", "0.6223643", "0.6210435", "0.61968744", "0.6170131", "0.6168576", "0.61627674", "0.61312264", "0.6129909", "0.61119586", "0.60830015", "0.6079504",...
0.0
-1
appropriate data structure as private data member appropriate method to save prime number to the data structure
public void generateSchedule(){ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void getPrime() {\n\t\tfor(int i=2;i<MAXN;i++){\n\t\t\tif(prime[i]==0){\n\t\t\t\tprime[++prime[0]]=i;\n\t\t\t}\n\t\t}\n\t}", "static void primeNumberSeries(){\n\t}", "boolean isPrime(int n) {\n //check if n is a multiple of 2\n\n if(n == 2){\n primeRecorderMap.put(n, tru...
[ "0.6541021", "0.61199164", "0.6067908", "0.59989417", "0.5863887", "0.58497477", "0.57598186", "0.5707558", "0.5664043", "0.56372243", "0.5627469", "0.56015545", "0.5539264", "0.55180854", "0.5498486", "0.5477798", "0.54656506", "0.5461593", "0.5435998", "0.5412033", "0.53775...
0.0
-1
TODO Autogenerated method stub
@Override public String intercept(ActionInvocation invocation) throws Exception { System.out.println("动作执行前..."); HttpSession session=ServletActionContext.getRequest().getSession(); Object obj=session.getAttribute("user"); if (obj==null) { return "login"; } String rtValue = invocation.invoke(); System.out.println("动作执行后..."); return rtValue; }
{ "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 getExr...
[ "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.608016...
0.0
-1
TODO Autogenerated method stub
@Override public void run() { serveurConnect.add(client.getNomClient() + " / " + client.getClientSocket().getRemoteSocketAddress() + " déconnecté"); Compte c = new Compte(client.getNomClient(), client.getPassClient()); Comptes.remove(c); clients.remove(clientThreads.indexOf(client)); System.out.println("erreur" + clientThreads.indexOf(client)); clientThreads.remove(clientThreads.indexOf(client)); }
{ "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 getExr...
[ "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.608016...
0.0
-1
Fetch checkpoint, return create a new instance if not found.
private static CheckpointBo getCheckpoint(ICheckpointDao dao, String id, Date defaultTimestamp) { CheckpointBo checkpoint = dao.getCheckpoint(id); return checkpoint != null ? checkpoint : CheckpointBo.newInstance(id, defaultTimestamp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static GeneticProgram loadCheckpoint(String arg) {\n CheckpointLoader cpl = new CheckpointLoader(arg);\n GeneticProgram gp = cpl.instantiate();\n if (gp == null) {\n System.err.println(\"Could not load checkpoint.\");\n System.exit(-1);\n }\n return ...
[ "0.58491737", "0.5698929", "0.56659937", "0.56410587", "0.5460331", "0.5423095", "0.53105587", "0.5281253", "0.5208509", "0.51360744", "0.5121835", "0.50874895", "0.5063234", "0.50030136", "0.4992792", "0.4978462", "0.495063", "0.4949841", "0.4947786", "0.49342692", "0.491327...
0.5598806
4
Set & Save a checkpoint attribute.
public static DaoResult setCheckpointAttr(ICheckpointDao dao, String checkpointId, String fieldName, Object fieldValue) { CheckpointBo cp = getCheckpoint(dao, checkpointId, new Date()); cp.setTimestamp(new Date()).setDataAttr(fieldName, fieldValue); return saveCheckpoint(dao, cp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void save(){\n checkpoint = chapter;\n }", "@Override\n\tpublic void setCheckpoint(java.util.Date checkpoint) {\n\t\t_userSync.setCheckpoint(checkpoint);\n\t}", "void checkpoint() throws IOException;", "protected void checkpoint() {\n checkpoint = internalBuffer().readerIndex();\n ...
[ "0.6376332", "0.6261165", "0.5965149", "0.57478434", "0.55262345", "0.55241066", "0.54944664", "0.541756", "0.5155461", "0.5135859", "0.5126164", "0.50960934", "0.5068369", "0.50229967", "0.5016895", "0.5002015", "0.49996883", "0.49956387", "0.4968208", "0.49415526", "0.48711...
0.5912772
3
Set & Save checkpoint attributes.
public static DaoResult setCheckpointAttrs(ICheckpointDao dao, String checkpointId, Map<String, Object> fieldNamesAndValues) { CheckpointBo cp = getCheckpoint(dao, checkpointId, new Date()); cp.setTimestamp(new Date()); for (Map.Entry<String, Object> entry : fieldNamesAndValues.entrySet()) { cp.setDataAttr(entry.getKey(), entry.getValue()); } return saveCheckpoint(dao, cp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void checkpoint() throws IOException;", "public void save(){\n checkpoint = chapter;\n }", "protected void checkpoint() {\n checkpoint = internalBuffer().readerIndex();\n }", "private void saveAttributes() {\n o_width = width;\n o_height = height;\n o_fps = fps;\n ...
[ "0.625597", "0.60619307", "0.6002395", "0.5839531", "0.57723486", "0.56540096", "0.55500174", "0.5395963", "0.53956056", "0.52957606", "0.5275556", "0.52044", "0.5170772", "0.51363003", "0.51218456", "0.5109069", "0.5100732", "0.5090121", "0.5085098", "0.50686383", "0.5061613...
0.57019645
5
Get a checkpoint attribute.
public static <T> Optional<T> getCheckpointAttr(ICheckpointDao dao, String checkpointId, String fieldName, Class<T> clazz) { return getCheckpoint(dao, checkpointId, new Date()).getDataAttrOptional(fieldName, clazz); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Attribute getAttribute();", "public synchronized long getCheckpoint() {\n return globalCheckpoint;\n }", "java.lang.String getAttribute();", "String getAttribute();", "Object getAttribute(int attribute);", "com.google.protobuf.ByteString getAttributeBytes();", "public Checkpoint lastCheckpoin...
[ "0.5782292", "0.57755405", "0.57046944", "0.563562", "0.55764633", "0.55328596", "0.54419947", "0.5397155", "0.5351826", "0.5305776", "0.5305776", "0.5305776", "0.5274622", "0.5249275", "0.52208424", "0.52167374", "0.5210022", "0.5156881", "0.51189065", "0.51189065", "0.51061...
0.6032079
0
TODO: check that number type includes integer type as described in the spec
@Test public void testNumberType() throws Exception { assertThat(0, is(0)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public Type evaluateType() throws Exception {\n return new IntegerType();\n }", "@Override\n public abstract JsonParser.NumberType numberType();", "public abstract Number getPrimitiveType();", "public void testInferNumber1a() throws Exception {\n assertType(\"10 \", 0, 2, \...
[ "0.6835378", "0.6733985", "0.6704735", "0.6599687", "0.6559749", "0.6394041", "0.6367362", "0.63434064", "0.6270825", "0.6262801", "0.62446463", "0.62384886", "0.62324363", "0.62241834", "0.6216717", "0.616922", "0.61556137", "0.6127949", "0.6124302", "0.6122745", "0.6122745"...
0.6338994
8
Coleccion de enemigos a salir en el nivel
public Horda(int q, Mapa m) { for(int i = 0; i < q; i++) { Celda c = new Celda(10, i); Enemigo e = new Enemigo1(10, i, m); c.SetObjetoActual(e); m.AgregarEnemigo(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void subirDeNivel(int n) //A cada 100 de xp, sobe de nivel\n {\n this.nivel = nivel + n;\n }", "public void subirNivelAtaque(){\n\tif(contadorNivel==5){\n\t nivelAtaque++;\n\t System.out.println(\"El ataque \"+obtenerNombreAtaque()+\" ha subido de nivel\");\n\t ...
[ "0.62749875", "0.6263814", "0.62159085", "0.59018123", "0.57797086", "0.57647103", "0.57550156", "0.57302517", "0.5675032", "0.5630366", "0.55793107", "0.55550116", "0.5549563", "0.55434585", "0.5493827", "0.5478083", "0.54707813", "0.54654896", "0.5444767", "0.54308116", "0....
0.0
-1
Return all header key.
public abstract List<String> getAllKeys();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String[] getHeader(String key);", "public Set<String> keySet()\r\n/* 421: */ {\r\n/* 422:584 */ return this.headers.keySet();\r\n/* 423: */ }", "public Header getHeaderByKey(String key);", "protected Convention.Key getConventionKeysKey()\n {\n return ConventionKeys.HEADER_KEYS;\n }...
[ "0.7370392", "0.7023346", "0.69882524", "0.6871897", "0.6831776", "0.67662925", "0.66777974", "0.6636218", "0.656651", "0.6528198", "0.6519111", "0.64958584", "0.6471914", "0.64598477", "0.6428883", "0.6417052", "0.6404935", "0.6332244", "0.632163", "0.63117117", "0.6295454",...
0.62961453
20
Get all request header holders.
public static HeaderHolder getRequestHeaderHolder() { return requestHeaderHolder; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Header[] getRequestHeaders() {\n return getRequestHeaderGroup().getAllHeaders();\n }", "public Header[] getRequestHeaders();", "List<? extends Header> getAllHeaders();", "protected HeaderGroup getRequestHeaderGroup() {\n return requestHeaders;\n }", "public List<String> getHeader...
[ "0.722085", "0.68106276", "0.6634087", "0.66214645", "0.66209584", "0.65688187", "0.6502986", "0.640865", "0.64030164", "0.6378131", "0.635068", "0.63441104", "0.6338562", "0.6329857", "0.6248952", "0.62159264", "0.61903554", "0.6190048", "0.6154052", "0.6153719", "0.6118968"...
0.6833789
1
Get all response header holders.
public static HeaderHolder getResponseHeaderHolder() { return responseHeaderHolder; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "List<? extends Header> getAllHeaders();", "public Header[] getResponseHeaders() {\n return getResponseHeaderGroup().getAllHeaders();\n }", "Map<String, List<String>> getHeaders();", "public List<String> getHeaders() {\n try {\n return load().getHeaderNames();\n } catch (IOE...
[ "0.71392924", "0.71274996", "0.69810057", "0.6949183", "0.69189525", "0.68929857", "0.6856623", "0.6795428", "0.67836887", "0.6768878", "0.6699688", "0.66913795", "0.66809887", "0.6649707", "0.66104335", "0.6606174", "0.65948665", "0.65854436", "0.6579638", "0.65574265", "0.6...
0.69571745
3
Constructor used to define the board. It instanciates a 2d array if tiles representing the games board.
public ThreeStonesBoard(int size) { this.size = size; this.board = new Tile[size][size]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Board() {\n this.board = new byte[][] { new byte[3], new byte[3], new byte[3] };\n }", "Board() {\n\t\tswitch (Board.boardType) {\n\t\tcase Tiny:\n\t\t\tthis.dimensions = TinyBoard; break;\n\t\tcase Giant:\n\t\t\tthis.dimensions = GiantBoard; break;\n\t\tdefault:\n\t\t\tthis.dimensions = Standar...
[ "0.80434483", "0.7948174", "0.78797716", "0.78210217", "0.7805433", "0.7791842", "0.777407", "0.77423465", "0.7660698", "0.76590174", "0.7645128", "0.76323396", "0.7627814", "0.7617253", "0.76087767", "0.75691706", "0.75602984", "0.7515259", "0.75126487", "0.7490688", "0.7478...
0.0
-1
alternate constructor to create a board based on a 2d array of tiles.
public ThreeStonesBoard(Tile[][] board) { this.board = board; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Board(int[][] tiles) {\n N = tiles.length; // Store dimension of passed tiles array\n this.tiles = new int[N][N]; // Instantiate instance grid of N x N size\n for (int i = 0; i < N; i++)\n ...
[ "0.8103299", "0.80744493", "0.79039633", "0.78387785", "0.7772786", "0.7481022", "0.74657637", "0.73451996", "0.7131735", "0.7130076", "0.71231836", "0.70931756", "0.70896494", "0.70717424", "0.7065005", "0.7048423", "0.70353156", "0.70321596", "0.70190954", "0.696117", "0.69...
0.6939023
21
getter to return the objects board.
public Tile[][] getBoard() { return board; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Board getBoardObject() {\n return boardObject;\n }", "public Board getBoard ();", "public Board getBoard() {\r\n return board;\r\n }", "public Board getBoard() {\n return board;\n }", "public static Board getBoard(){\n\t\treturn board;\n\t}", "public Board getBoard() {\n ...
[ "0.821404", "0.7896136", "0.77560484", "0.7756029", "0.7733277", "0.7732101", "0.7728661", "0.7728661", "0.7685777", "0.76850116", "0.7627179", "0.7605921", "0.75600183", "0.75487655", "0.7523103", "0.7516542", "0.7496647", "0.7491461", "0.74727607", "0.7458145", "0.7458145",...
0.7592828
12
getter to retrieve the size of the board
public int getSize() { return this.size; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getSize() {\n return board.getSize();\n }", "int getBoardSize() {\n return row * column;\n }", "protected int getBoardSize(){\n\t\treturn boardSize;\n\t}", "public int getBoardSize(){\r\n\t\treturn boardSize;\r\n\t}", "int getBoardSize() {\n return this.boardSize;\n ...
[ "0.87243783", "0.8593759", "0.8497435", "0.8493688", "0.8435187", "0.828439", "0.82329047", "0.816633", "0.8077144", "0.78255963", "0.7809111", "0.77919734", "0.7638273", "0.7527684", "0.7468494", "0.74504745", "0.7444772", "0.74049735", "0.7374736", "0.73176837", "0.72726697...
0.6977422
41
the placeStone method is used to update the board model with new stones
public void placeStone(Stone stone) { if(board[stone.getY()][stone.getX()].isPlayable()){ Slot slot = (Slot) board[stone.getY()][stone.getX()]; if (stone.getType()==PlayerType.COMPUTER) { if (lastStone !=null) { lastStone.setType(PlayerType.COMPUTER); } stone.setType(PlayerType.COMPUTER_LASTPLACE); lastStone=stone; } slot.placeStone(stone); board[stone.getY()][stone.getX()] = slot; // l.log(Level.INFO, "Placed at "+ stone.getY() + " " + stone.getX()); //l.log(Level.INFO, "tostring is:" + board[stone.getY()][stone.getX()].toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tprotected void placeStones(int numStones) {\n\n\t\tShape pitBounds = this.getShape();\n\t\tdouble pitW = pitBounds.getBounds().getWidth();\n\t\tdouble pitH = pitBounds.getBounds().getHeight();\n\t\t\n\n\t\tint stoneWidth = this.stoneIcon.getIconWidth();\n\t\tint stoneHeight = this.stoneIcon.getIconHei...
[ "0.68298", "0.66605866", "0.6601546", "0.6446114", "0.6428102", "0.6396203", "0.6324673", "0.63219863", "0.6302673", "0.62149", "0.6152263", "0.6141046", "0.61396474", "0.60972303", "0.6052569", "0.6042172", "0.5969621", "0.59571415", "0.59538156", "0.5884138", "0.58816046", ...
0.8117505
0
the fillBoardFromCSV method is used to fill the 2d tile array with the appropriate tiles based on a specified csv file.
public void fillBoardFromCSV(String pathToCSV){ BufferedReader br = null; String line = " "; int index = 0; try{ br = new BufferedReader(new FileReader(pathToCSV)); while ((line = br.readLine()) != null) { String[] lines = line.split(","); System.out.println(lines.length); for(int i = 0; i < 11; i++){ if(lines[i].equals("f")){ board[index][i] = new Flat(index,i); } if(lines[i].equals("s")){ board[index][i] = new Slot(index,i); } } index++; } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@SuppressWarnings(\"resource\")\n\tpublic void loadLayoutConfig() throws IOException, BadConfigFormatException {\n\t\tFileReader layoutInput = new FileReader(layoutConfigFile);\t\t\t\t\t\t\t// File reader to parse the layout file\n\t\tScanner input = new Scanner(layoutInput);\t\t\t\t\t\t\t\t\t\t\t// Scanner to use...
[ "0.6305296", "0.616648", "0.59933823", "0.59119606", "0.57479405", "0.5641074", "0.56260026", "0.5608079", "0.55428606", "0.5465058", "0.54523224", "0.5451351", "0.5344596", "0.532929", "0.5309458", "0.52967495", "0.5284891", "0.52680105", "0.52440286", "0.5235653", "0.523385...
0.81740165
0
Created by Administrator on 2017/10/21 0021.
public interface Shape { void draw(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private stendhal() {\n\t}", "@Override\n public void perish() {\n \n }", "public void mo38117a() {\n }", "public final void mo51373a() {\n }", "public Pitonyak_09_02() {\r\n }", "public void mo4359a() {\n }", "public void mo55254a() {\n }", "public void mo5...
[ "0.6115777", "0.5824288", "0.58167946", "0.58060396", "0.57246274", "0.5711049", "0.5709327", "0.5709327", "0.5709327", "0.5709327", "0.5709327", "0.5709327", "0.5709327", "0.5692206", "0.56470144", "0.56305605", "0.562322", "0.5622527", "0.5620791", "0.5618742", "0.56011224"...
0.0
-1
Scanner in = new Scanner(new BufferedReader(new FileReader("meetings.in"))); PrintWriter out = new PrintWriter(new FileWriter("meetings.out"));
public static void main(String[] args) { Map<Integer, Character> cows = new HashMap<Integer, Character>(); List<Edge> tree = new ArrayList<Edge>(); Scanner in = new Scanner(System.in); int n = in.nextInt(), m = in.nextInt(); String cowsStr = in.next(); for (int i = 1; i <= cowsStr.length(); i++) cows.put(i, cowsStr.charAt(i - 1)); for (int i = 0; i < n - 1; i++) tree.add(new Edge(in.nextInt(), in.nextInt())); Collections.sort(tree); System.out.println(cows); System.out.println(tree); for (int i = 0; i < m; i++) { int start = in.nextInt(), end = in.nextInt(); char cow = in.next().charAt(0); in.nextLine(); System.out.println(start + ", " + end + ", " + cow); boolean allGood = false; if (start == end) { allGood = cows.get(start) == cow; System.out.println(allGood); continue; } int index = indexOfEnd(tree, end); while (tree.get(index).a != start) { if (cows.get(tree.get(index).a) == cow || cows.get(tree.get(index).b) == cow) { allGood = allGood || true; break; } index = indexOfEnd(tree, tree.get(index).a); if (index == -1) break; System.out.println("current edge: " + tree.get(index)); } System.out.println(allGood); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void openFile(){\n\t\ttry{\n\t\t\t//input = new Scanner (new File(\"input.txt\")); // creates file \"input.txt\" or will rewrite existing file\n\t\t\tFile inFile = new File(\"input.txt\");\n\t\t\tinput = new Scanner(inFile);\n\t\t\t//for (int i = 0; i < 25; i ++){\n\t\t\t\t//s = input.nextLine();\n\t\t\t\t/...
[ "0.6175344", "0.58831304", "0.5881785", "0.58421355", "0.5791538", "0.569082", "0.56822956", "0.5625705", "0.55909574", "0.5576389", "0.5561208", "0.5513103", "0.55110174", "0.55051637", "0.5499632", "0.5481008", "0.5464531", "0.54461", "0.5441397", "0.54399854", "0.5428854",...
0.0
-1
String srcPath = config.getServletContext().getRealPath("/");
public static String savePicture(HttpSession session, MultipartFile file, long id) throws IOException { String path = session.getServletContext().getRealPath(destination); File savedFile = new File(path + "\\" + id + ".jpg"); FileUtils.writeByteArrayToFile(savedFile, file.getBytes()); File[] testFileSave = findFile(session, id); if (testFileSave.length == 1) { // return waarde van profilePicture-attribuut van User return destination + id + ".jpg"; } else { return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private String getPath() {\n\t\treturn context.getRealPath(\"WEB-INF/ConnectionData\");\n\t}", "private String getPath() {\n\t\treturn context.getRealPath(\"WEB-INF/ConnectionData\");\n\t}", "private String getPath() {\n\t\treturn context.getRealPath(\"WEB-INF/ConnectionData\");\n\t}", "private String getPat...
[ "0.7095695", "0.7095695", "0.7095695", "0.7095695", "0.7028336", "0.69240665", "0.6667289", "0.66648304", "0.6483652", "0.64533263", "0.63209164", "0.63209164", "0.63209164", "0.6265206", "0.625735", "0.62401724", "0.6174119", "0.6073246", "0.6046726", "0.60429573", "0.603937...
0.0
-1
Added Constructor Austin Instantiates a new cargo container. Prints a message to the system if the container was created successfully.
public CargoContainer(String ownerName, double maxWeight, double maxVolume) { this.ownerName = ownerName; this.maxWeight = maxWeight; this.maxVolume = maxVolume; this.loaded= false; //database.writeContainerDB(this); System.out.println("Container for owner "+ownerName+" created."); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Container createContainer();", "T createContainer();", "private CreateContainerTask(String containerName) {\n\t\t\tthis.containerName = containerName;\n\t\t}", "public Container newContainer();", "public AzureStorageContainer() {\n }", "public PortletContainer() {\n }", "@Test\n\tpublic void sho...
[ "0.6513108", "0.62703204", "0.6207255", "0.59405893", "0.5731972", "0.5709022", "0.5577985", "0.5544931", "0.54333025", "0.54115856", "0.54017174", "0.5396487", "0.5349261", "0.5322338", "0.5267751", "0.52171624", "0.52084076", "0.52037144", "0.5171304", "0.5156129", "0.51529...
0.5047242
28
Clears all items from the container
public void clearContainer() { cargoList.clear(); this.currentVolume=0; this.currentWeight=0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void clear(){\n this.items.clear();\n }", "public void clearItems(){\n items.clear();\n }", "public void clear() {\r\n\t\titems.clear();\r\n\t}", "public void clear() {\n items.clear();\n update();\n }", "void clear()\n\t{\n\t\tgetItems().clear();\n\t}", ...
[ "0.8319375", "0.8319061", "0.8268844", "0.81588596", "0.811391", "0.79907167", "0.79828393", "0.79566824", "0.78219616", "0.77503204", "0.7616006", "0.7615646", "0.75630796", "0.752704", "0.7509392", "0.7487951", "0.74651414", "0.7458663", "0.7410903", "0.7389304", "0.7389304...
0.80150473
5
Sets the status of the container to loaded (onto a flight)
public void loaded(){ loaded=true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setLoaded();", "public void loadStatus (){\n\t}", "public void setLoaded(boolean loaded);", "private void loadingPhase() {\n try { Thread.sleep(10000); } catch(InterruptedException e) { return; }\n ClickObserver.getInstance().setTerrainFlag(\"\");\n }", "public void loadStatus(...
[ "0.6817633", "0.6753833", "0.6621886", "0.62923276", "0.62796366", "0.6217972", "0.6198236", "0.6055454", "0.5973495", "0.5917495", "0.58824664", "0.5880535", "0.5792921", "0.5727512", "0.5725069", "0.5701805", "0.5681914", "0.56819075", "0.5649471", "0.564869", "0.5640486", ...
0.63323057
3
Sets the status of the container to unloaded (from a flight)
public void unloaded(){ loaded=false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void unload() {\n releasePressureToReturn();\n releasePressureToShooter();\n latch(false);\n// reloaded = false;\n }", "public void destroy() {\n this.alive = false;\n }", "void unsetStatus();", "public void flightDisappear();", "void setStatus(boolean destro...
[ "0.67144084", "0.62571883", "0.62565523", "0.61394113", "0.61018074", "0.6015201", "0.5893422", "0.5880948", "0.5861721", "0.5852582", "0.5838143", "0.58309275", "0.5820668", "0.58189285", "0.5739271", "0.57151663", "0.570524", "0.56908345", "0.5678152", "0.565787", "0.564693...
0.69965035
0
Returns whether or not the container was loaded on to a flight
public boolean getLoaded() { return loaded; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isLoaded();", "boolean isLoaded();", "public boolean isLoaded() {\n\t\treturn started;\n\t}", "protected boolean isLoaded()\n {\n return m_fLoaded;\n }", "public boolean isLoaded() {\n return _id != null;\n }", "private boolean hasTableContainerLoaded() {\n ...
[ "0.71794665", "0.71102655", "0.6985232", "0.68659234", "0.6858397", "0.6821566", "0.6813168", "0.6800389", "0.6796175", "0.6775165", "0.67301583", "0.67298037", "0.6716755", "0.6683516", "0.66812766", "0.65423006", "0.6509188", "0.6504974", "0.6495628", "0.641873", "0.6410681...
0.6161743
28
Gets the owner's name.
public String getownerName() { return this.ownerName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getOwnerName() {\r\n return this.ownerName;\r\n }", "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...
[ "0.8395708", "0.83520925", "0.83396065", "0.82957506", "0.8224735", "0.8224735", "0.81882393", "0.8148729", "0.8044268", "0.7837003", "0.7837003", "0.7805538", "0.78053993", "0.7645772", "0.7639604", "0.7588783", "0.7585034", "0.7584536", "0.75838554", "0.7570415", "0.7570415...
0.81902975
6
Sets the owner's name.
public void setownerName(String ownerName) { this.ownerName = ownerName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setOwnerName( String name ) {\n\n ownerName = name;\n }", "public void setOwnerName(String name) {\r\n this.ownerName = name;\r\n }", "public void setOwnername(java.lang.String newOwnername) {\n\townername = newOwnername;\n}", "public void setName(String name) {\n\n if (name.isEm...
[ "0.8416955", "0.8406748", "0.7979281", "0.78985506", "0.7846378", "0.7846378", "0.76539046", "0.7462399", "0.74567723", "0.74270254", "0.74270254", "0.74270254", "0.74270254", "0.7271672", "0.72647643", "0.7259224", "0.7259224", "0.72225446", "0.7213329", "0.7192607", "0.7172...
0.7753905
6
Gets the max weight.
public double getmaxWeight() { return this.maxWeight; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getMaximumWeight() { // get the max weight\n\t\treturn maximumWeight;\n\t}", "@Basic @Immutable\n\tpublic Weight getMaxWeight() {\n\t\treturn this.MAX_WEIGHT;\n\t}", "public int getWeightLimit() {\n\t\treturn this.weightLimit;\n\t}", "public final double getMax() {\r\n\t\treturn this.m_max;\r\n\t}...
[ "0.88264006", "0.87982595", "0.76412135", "0.72768116", "0.72257406", "0.71409446", "0.714034", "0.71261656", "0.71181256", "0.7115157", "0.7082306", "0.7038662", "0.7034501", "0.6987338", "0.69782287", "0.6963728", "0.6962391", "0.6934328", "0.69322944", "0.69305426", "0.691...
0.88413894
0
Sets the max weight.
public void setmaxWeight(double maxWeight) { this.maxWeight = maxWeight; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setMaxWeight(double inMaxWeight) {\n maxWeight = inMaxWeight;\n }", "public void setMaximumWeight(int maximumWeight) { // set the max weight\n\t\tthis.maximumWeight = maximumWeight;\n\t}", "public void setMaxWeight(String newValue);", "public void setWeightLimit(int weightLimit) {\n\t\t...
[ "0.8699806", "0.80826324", "0.8014895", "0.72217745", "0.69922686", "0.69826543", "0.6954777", "0.6917475", "0.6818599", "0.6811267", "0.6801716", "0.6765474", "0.6743974", "0.6714212", "0.6685707", "0.666156", "0.66491944", "0.6609114", "0.65428555", "0.654086", "0.6540644",...
0.8260293
1
Gets the max volume.
public double getmaxVolume() { return this.maxVolume; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getMaxVolume() {\n return mMaxVolume;\n }", "public int getVolumeMax() {\n return mBundle.getInt(KEY_VOLUME_MAX);\n }", "double getMaxVolume();", "public long getPropertyVolumeMax()\n {\n return iPropertyVolumeMax.getValue();\n }", "public long ...
[ "0.8930182", "0.8692162", "0.86722606", "0.8345391", "0.83286387", "0.76246595", "0.7572129", "0.75178796", "0.7415002", "0.7103989", "0.7081285", "0.70421916", "0.7040159", "0.70176643", "0.70013225", "0.6992277", "0.69909185", "0.6984808", "0.6984808", "0.6981527", "0.69595...
0.8964641
0
Sets the max volume.
public void setmaxVolume(double maxVolume) { this.maxVolume = maxVolume; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setVolumeMax(int volumeMax) {\n mBundle.putInt(KEY_VOLUME_MAX, volumeMax);\n }", "public int getMaxVolume() {\n return mMaxVolume;\n }", "public double getmaxVolume() {\n\t return this.maxVolume;\n\t}", "public static void maxVolume() {\n volume = 100;\n ...
[ "0.8746373", "0.7393824", "0.7363684", "0.7357039", "0.73566383", "0.7290181", "0.7233834", "0.7159382", "0.7103742", "0.7038708", "0.7031909", "0.69428104", "0.6929213", "0.6908161", "0.690689", "0.68763685", "0.68193954", "0.68139344", "0.68078434", "0.68074644", "0.6801531...
0.85986483
1
Gets the current weight for the container.
public double getcurrentWeight() { return this.currentWeight; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Integer getWeight() {\n return weight;\n }", "public int weight() {\n if (this.weight == null) {\n return 0;\n } else {\n return this.weight;\n } // if/else\n }", "public double getWeight() {\n\t\tif(weightConfiguration == null) {\n\t\t\treturn 1.0;\n\t\t}\n\t\treturn weigh...
[ "0.7722425", "0.77129894", "0.7650932", "0.7647197", "0.76145864", "0.76119274", "0.7576902", "0.75540686", "0.75540686", "0.755075", "0.7549882", "0.75476676", "0.7547559", "0.7542506", "0.7538443", "0.75295985", "0.7527684", "0.7518726", "0.7518726", "0.7516759", "0.751483"...
0.71911263
46
Gets the current volume for the container.
public double getcurrentVolume() { return this.currentVolume; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public long getCurrentVolume() {\n return currentVolume;\n }", "public int getCurrentVolume() {\n return mCurrentVolume;\n }", "@Override\r\n\t\tpublic int dmr_getVolume() throws RemoteException {\n\t\t\tint current = soundManager.getVolume();\r\n\t\t\tUtils.printLog(TAG, \"current ...
[ "0.76389587", "0.73692936", "0.7123769", "0.69385636", "0.6916781", "0.68610424", "0.68105346", "0.68087935", "0.6774286", "0.671498", "0.66643864", "0.6658616", "0.66567737", "0.6634489", "0.66123194", "0.6594481", "0.65941817", "0.6580727", "0.64925104", "0.64925104", "0.64...
0.6994127
3
Removes the item from the container.
public void removeItem(CargoItem item) { if (cargoList.contains(item)) { currentWeight = currentWeight-item.getWeight(); currentVolume = currentVolume-item.getVolume(); cargoList.remove(item); System.out.println("Item removed"); } else { System.out.println("Item not found"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void removeItem(){\n\t\tthis.item = null;\n\t}", "protected abstract void removeItem();", "@Override\n public void remove() {\n if (lastItem == null)\n throw new IllegalStateException();\n bag.remove(lastItem);\n lastItem = null;\n }", "pub...
[ "0.8055762", "0.7411022", "0.7059137", "0.70501953", "0.69832855", "0.69326395", "0.6907128", "0.6890816", "0.6877457", "0.6845482", "0.68437237", "0.6772967", "0.675685", "0.67338216", "0.67196363", "0.67075145", "0.66907454", "0.6640018", "0.6638639", "0.6614497", "0.657632...
0.62458867
82
The main method. Tester method
public static void main (String args[]){ CargoContainer test1 = new CargoContainer("Austin", 800, 8000); CargoContainer test2 = new CargoContainer("Swathi", 10000, 10000000); CargoItem item1 = new CargoItem("Toys", 200, 10, 20, 10); //Volume= 2000 CargoItem item2 = new CargoItem("Pens", 50, 50, 20, 5); //Volume= 5000 CargoItem item3 = new CargoItem("Trucks", 5000, 500, 500, 10); //Volume= 2500000 System.out.println(test1); test1.addItem(item1); System.out.println(test1); test1.addItem(item2); System.out.println(test1); test1.addItem(item3); test2.addItem(item3); System.out.println(test2); test1.removeItem(item1); System.out.println(test1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args){\n new Testing().runTests();\r\n \r\n }", "public static void main(String[] args) {\n // PUT YOUR TEST CODE HERE\n }", "@Test\n public void run () {\n\t \n\t System.out.println(\"---------->\");\n\t //System.out.println(md5list.getResult());\...
[ "0.7559868", "0.75421655", "0.73973095", "0.73923314", "0.7350428", "0.7307818", "0.7277629", "0.7275881", "0.72670144", "0.7235171", "0.7201694", "0.7101806", "0.7094669", "0.7080212", "0.7073424", "0.7035874", "0.70286894", "0.7014958", "0.6990661", "0.69887215", "0.6984294...
0.0
-1
Service Methods to check room's state
public boolean checkIn(){ return state.checkIn(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean hasFindGameRoomsRequest();", "boolean hasFindGameRoomsResponse();", "@Override\n public boolean isAvailable() {\n return room.isAvailable();\n }", "boolean getCurrentRoom() {\n return currentRoom;\n }", "public void changeOutofService(Room room);", "boolean hasChatRoom();",...
[ "0.6606275", "0.6468287", "0.63827413", "0.6353272", "0.6296716", "0.62963945", "0.6271363", "0.6241471", "0.61375767", "0.6051023", "0.6051023", "0.6051023", "0.6051023", "0.6051023", "0.6051023", "0.6051023", "0.6051023", "0.60278755", "0.5998954", "0.5998954", "0.5998954",...
0.6011142
18
TODO Autogenerated method stub
static int growing() { for(int i=1;i<=3;i++){ height=height+i; System.out.println(height);} return 0; }
{ "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 getExr...
[ "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.608016...
0.0
-1
on upgrade drop older tables
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_DEBITOS); // create new tables onCreate(db); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void deleteOldTables(){\n jdbcTemplate.execute(\"DROP TABLE OLDcompetence\");\n jdbcTemplate.execute(\"DROP TABLE OLDrole\");\n jdbcTemplate.execute(\"DROP TABLE OLDperson\");\n jdbcTemplate.execute(\"DROP TABLE OLDavailability\");\n jdbcTemplate.execute(\"DROP TABLE OLDc...
[ "0.8163109", "0.770959", "0.75683373", "0.7524388", "0.74309754", "0.7356155", "0.7311341", "0.72487235", "0.7237594", "0.7222855", "0.7128809", "0.70926255", "0.70651925", "0.70604795", "0.7022588", "0.69892496", "0.6922954", "0.6890829", "0.68854535", "0.6878749", "0.687810...
0.6501378
64
/ get single debito
public Debito getDebito(long todo_id) { SQLiteDatabase db = this.getReadableDatabase(); String selectQuery = "SELECT * FROM " + TABLE_DEBITOS + " WHERE " + KEY_ID + " = " + todo_id; Log.e(LOG, selectQuery); Cursor c = db.rawQuery(selectQuery, null); if (c != null) c.moveToFirst(); Debito td = new Debito(); td.setCodigo(c.getInt(c.getColumnIndex(KEY_ID))); td.setValor(c.getDouble(c.getColumnIndex(KEY_VALOR))); td.setData(c.getString(c.getColumnIndex(KEY_DATA))); td.setEstabelecimento((c.getString(c.getColumnIndex(KEY_ESTABELECIMENTO)))); return td; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Reserva Obtener();", "Optional<OrdPaymentRefDTO> findOne(Long id);", "com.dogecoin.protocols.payments.Protos.Payment getPayment();", "Debut getDebut();", "public Produit getProduit(int theId);", "@Override\n @Transactional(readOnly = true)\n public AdChoiseDTO findOne(Long id) {\n log.debug(...
[ "0.62609905", "0.60772675", "0.6029504", "0.5965298", "0.5945888", "0.58805877", "0.58440924", "0.58426815", "0.58023477", "0.57584065", "0.5757618", "0.573719", "0.5700994", "0.5699327", "0.5681509", "0.5670222", "0.5667373", "0.564971", "0.5649702", "0.5643199", "0.56338733...
0.67637044
0
/ getting all debitos
public ArrayList<Debito> getAllDebitos() { ArrayList<Debito> debitos = new ArrayList<Debito>(); String selectQuery = "SELECT * FROM " + TABLE_DEBITOS; Log.e(LOG, selectQuery); SQLiteDatabase db = this.getReadableDatabase(); Cursor c = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (c.moveToFirst()) { do { Debito td = new Debito(); td.setCodigo(c.getInt(c.getColumnIndex(KEY_ID))); td.setValor(c.getDouble(c.getColumnIndex(KEY_VALOR))); td.setData(c.getString(c.getColumnIndex(KEY_DATA))); td.setEstabelecimento((c.getString(c.getColumnIndex(KEY_ESTABELECIMENTO)))); // adding to todo list debitos.add(td); } while (c.moveToNext()); } return debitos; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<DietaBalanceada> consultar_dietaBalanceada();", "List<BookAccount> findAllDebtors();", "void listAllDeposit(Ui ui, int depositsToDisplay) throws TransactionException, BankException {\n throw new BankException(\"This account does not support this feature\");\n }", "public Collection pesq...
[ "0.63052917", "0.622684", "0.5990375", "0.5966537", "0.58765054", "0.58554673", "0.5855076", "0.58225715", "0.5797685", "0.5773685", "0.5771127", "0.5747777", "0.5747777", "0.57414746", "0.5706642", "0.5702084", "0.56990856", "0.5697664", "0.5694762", "0.5677202", "0.5640528"...
0.7050736
0
/ Deleting a Debito
public void deleteDebito(long tado_id) { SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_DEBITOS, KEY_ID + " = ?", new String[] { String.valueOf(tado_id) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void delete(BatimentoCardiaco t) {\n\t\t\n\t}", "@Override\n\tpublic void delete(int ShopLoyaltyCardId) {\n\t\t\n\t}", "int deleteByExample(CGcontractCreditExample example);", "private void deleteTransaction() {\n LogUtils.logEnterFunction(Tag);\n\n boolean isDebtValid = tru...
[ "0.68641603", "0.6578064", "0.65776986", "0.65550685", "0.6493746", "0.64823157", "0.6437506", "0.6434868", "0.6424445", "0.6392859", "0.63913333", "0.6324012", "0.6297302", "0.6297302", "0.6294384", "0.6294384", "0.6294384", "0.6294384", "0.6294384", "0.6294384", "0.6293384"...
0.68319166
1
Sets up the GUI for teh program
public Gui() { setTitle("Gui"); setSize(320, 225); setDefaultCloseOperation(EXIT_ON_CLOSE); setResizable(false); title.setText(" ~~~~~ Monty Hall Problem Simulation ~~~~~ "); inputPanel.add(title); iterationsLabel.setText("Iterations:"); inputPanel.add(iterationsLabel); inputPanel.add(inputTextIt); inputTextIt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String input = inputTextIt.getText(); iterations = Integer.parseInt(input); } }); inputPanel.add(inputButtonOne); inputButtonOne.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String input = inputTextIt.getText(); iterations = Integer.parseInt(input); } }); doorsLabel.setText("Number of Doors:"); inputPanel.add(doorsLabel); inputPanel.add(inputTextDoor); inputTextDoor.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String input = inputTextDoor.getText(); doorCount = Integer.parseInt(input); } }); inputPanel.add(inputButtonTwo); inputButtonTwo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String input = inputTextDoor.getText(); doorCount = Integer.parseInt(input); } }); stayResultLabel.setText("Staying at the door success rate:"); stayResultLabel.setBounds(100, 200, 200, 50); inputPanel.add(stayResultLabel); inputPanel.add(stayPercentLabel); switchResultLabel.setText("Switching to the other door success rate:"); switchResultLabel.setBounds(100, 260, 200, 50); inputPanel.add(switchResultLabel); inputPanel.add(switchPercentLabel); inputPanel.add(startCalcButton); startCalcButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DecimalFormat df = new DecimalFormat("#.##"); df.setRoundingMode(RoundingMode.CEILING); test = new ProcessGame(iterations, doorCount); Double stayTag = test.calculatePercent(test.countCars(test.getStayResults())); Double switchTag = test.calculatePercent(test.countCars(test.getSwitchResults())); stayPercentLabel.setText(df.format(stayTag) + "%"); switchPercentLabel.setText(df.format(switchTag) + "%"); x.addSpace(); } }); inputPanel.add(closeButton); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { x.closeFile(); System.exit(0); } }); add(inputPanel); setVisible(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setupGUI() {\r\n\t\tPaperToolkit.initializeLookAndFeel();\r\n\t\tgetMainFrame();\r\n\t}", "public GUI() {\n\t\t// sets up file choosers\n\t\tsetFileChoosers();\n\t\t// initialises JFrame\n\t\tsetContent();\n\t\t// sets default window attributes\n\t\tthis.setDefaultAttributes();\n\t\t// instantiates ...
[ "0.79224825", "0.7708217", "0.76555544", "0.762984", "0.7626841", "0.76148117", "0.7594321", "0.7587123", "0.7534302", "0.7531533", "0.75247467", "0.75181806", "0.7472798", "0.7463905", "0.7448484", "0.7448484", "0.74481267", "0.7437503", "0.74179566", "0.7416493", "0.7411672...
0.0
-1
Constructor de la clase
public StringFileManager() { // TODO Auto-generated constructor stub }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Constructor() {\r\n\t\t \r\n\t }", "public Constructor(){\n\t\t\n\t}", "public Pasien() {\r\n }", "public CyanSus() {\n\n }", "public Clade() {}", "public Carrera(){\n }", "public Classe() {\r\n }", "public Chauffeur() {\r\n\t}", "public AntrianPasien() {\r\n\r\n }", "public SlanjePoruk...
[ "0.8376671", "0.82482725", "0.7757712", "0.76491547", "0.764287", "0.75641066", "0.7557304", "0.7555219", "0.75255686", "0.7461729", "0.74616057", "0.7438721", "0.74067116", "0.7393601", "0.73794305", "0.737154", "0.73671997", "0.7337879", "0.7337316", "0.73341864", "0.731324...
0.0
-1
Constructor de la clase
public StringFileManager(String name) throws Exception { super(name); // TODO Auto-generated constructor stub }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Constructor() {\r\n\t\t \r\n\t }", "public Constructor(){\n\t\t\n\t}", "public Pasien() {\r\n }", "public CyanSus() {\n\n }", "public Clade() {}", "public Carrera(){\n }", "public Classe() {\r\n }", "public Chauffeur() {\r\n\t}", "public AntrianPasien() {\r\n\r\n }", "public SlanjePoruk...
[ "0.8376671", "0.82482725", "0.7757712", "0.76491547", "0.764287", "0.75641066", "0.7557304", "0.7555219", "0.75255686", "0.7461729", "0.74616057", "0.7438721", "0.74067116", "0.7393601", "0.73794305", "0.737154", "0.73671997", "0.7337879", "0.7337316", "0.73341864", "0.731324...
0.0
-1
TODO Autogenerated method stub
@Override public T get() { return null; }
{ "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 getExr...
[ "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.608016...
0.0
-1
TODO Autogenerated method stub
@Override public void save(T elemento) { }
{ "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 getExr...
[ "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.608016...
0.0
-1
TODO Autogenerated method stub
@Override public boolean buscar(T elemento) { return false; }
{ "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 getExr...
[ "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.608016...
0.0
-1
TODO Autogenerated method stub
@Override public boolean getElemento(T elemento) { return false; }
{ "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 getExr...
[ "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.608016...
0.0
-1
TODO Autogenerated method stub
@Override public void close() throws Exception { }
{ "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 getExr...
[ "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.608016...
0.0
-1
/ Simple counts of topic messages
@Incoming("orders_broadcast") @Counted("inventorydemo.orders.count") void ordersToSocket(Order order) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic int countTopics() {\n\t\treturn 0;\r\n\t}", "int getMessagesCount();", "int getMessagesCount();", "int getMessagesCount();", "int getMsgCount();", "int getMsgCount();", "int countByExample(UserTopicExample example);", "int countByExample(UserTopicExample example);", "int getMe...
[ "0.774565", "0.7379583", "0.7379583", "0.7379583", "0.7281022", "0.7281022", "0.72675294", "0.72675294", "0.720014", "0.720014", "0.720014", "0.720014", "0.720014", "0.70004356", "0.6822052", "0.6793419", "0.67047507", "0.66922504", "0.66574883", "0.65337414", "0.6458525", ...
0.0
-1
TipoActividadDAO classe per englobar les funcions de tipos d'actividades.
public interface TipoActividadDAO { /** * Funció que engloba les funcións que s'utilitzen per crear tipus d'activitat * @param tipoAct * @return String * @throws PersistenceException * @throws ClassNotFoundException */ public abstract String callCrear(TipoActividad tipoAct) throws PersistenceException, ClassNotFoundException; /** * Verifica que no existeixi un tipus amb el mateix nom * @param tipoAct * @return int * @throws PersistenceException * @throws ClassNotFoundException */ public abstract int getTipoByName(TipoActividad tipoAct) throws PersistenceException, ClassNotFoundException; /** * Inserta un tipus d'activitat en la base de dades * @param tipoAct * @return String * @throws PersistenceException * @throws ClassNotFoundException */ public abstract String insertarTipoActividad(TipoActividad tipoAct) throws PersistenceException, ClassNotFoundException; /** * Agafa els tipus d'activitats que esten actius * @return List de TipoActividad * @throws PersistenceException * @throws ClassNotFoundException */ public abstract List<TipoActividad> getTiposActividad() throws PersistenceException, ClassNotFoundException; /** * Agafa tots els tipus d'activitats * @return List de TipoActividad * @throws PersistenceException * @throws ClassNotFoundException */ public abstract List<TipoActividad> getTiposActividadAdm() throws PersistenceException, ClassNotFoundException; /** * Seleccionar el tipo de actividad d'una actividad * @param activity * @return String * @throws PersistenceException * @throws ClassNotFoundException */ public abstract String getTipoByAct(Actividad activity) throws PersistenceException, ClassNotFoundException; /** * Guarda la sessió del tipus d'activitat * @param tipoAct * @param pagina * @throws PersistenceException * @throws ClassNotFoundException */ public abstract void guardarSession(TipoActividad tipoAct, String pagina) throws PersistenceException, ClassNotFoundException; /** * Funció que engloba les funcións per editar un tipus d'activitat * @param tipoAct * @return String * @throws PersistenceException * @throws ClassNotFoundException */ public abstract String callEditar(TipoActividad tipoAct) throws PersistenceException, ClassNotFoundException; /** * Funció que permet editar el Tipus d'activitat * @param tipoAct * @return String * @throws PersistenceException * @throws ClassNotFoundException */ public abstract String editarTipoActividad(TipoActividad tipoAct) throws PersistenceException, ClassNotFoundException; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public ActividadDAO getActividadDAO() {\n return actividadDAO;\n }", "public interface TipoDao {\r\n\r\n /**\r\n * Inserta un nuevo registro en la tabla Tipos.\r\n */\r\n public TipoPk insert(Tipo dto) throws TipoDaoException;\r\n\r\n /**\r\n * Actualiza un unico registro en la tab...
[ "0.699596", "0.6638656", "0.6570733", "0.65668845", "0.6469174", "0.636244", "0.63609535", "0.63436913", "0.6299133", "0.6275231", "0.6248411", "0.62046176", "0.6192744", "0.6124913", "0.6091818", "0.60542274", "0.6035445", "0.6018121", "0.60092723", "0.59871244", "0.59695387...
0.7555637
0
Verifica que no existeixi un tipus amb el mateix nom
public abstract int getTipoByName(TipoActividad tipoAct) throws PersistenceException, ClassNotFoundException;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean verificaUnicidadeNome() {\n\t\tif(!EntidadesDAO.existeNome(entidades.getNome())) {\n\t\t\treturn true;\n\t\t}else {\n\t\t\treturn false;\n\t\t}\n\t}", "private boolean verificaDados() {\n if (!txtNome.getText().equals(\"\") && !txtProprietario.getText().equals(\"\")) {\n return t...
[ "0.60486907", "0.6026516", "0.5889424", "0.5740883", "0.5672301", "0.56393254", "0.56189615", "0.560846", "0.56042665", "0.56041175", "0.55753267", "0.5566427", "0.54807615", "0.54401547", "0.54120386", "0.53795594", "0.53591335", "0.5352627", "0.53272647", "0.53233755", "0.5...
0.0
-1
Inserta un tipus d'activitat en la base de dades
public abstract String insertarTipoActividad(TipoActividad tipoAct) throws PersistenceException, ClassNotFoundException;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void crearActividad (Actividad a) {\r\n String query = \"INSERT INTO actividad (identificacion_navegate, numero_matricula, fecha, hora, destino, eliminar) VALUES (\\\"\" \r\n + a.getIdentificacionNavegante()+ \"\\\", \" \r\n + a.getNumeroMatricula() + \", \\\"\" \r\n ...
[ "0.7018214", "0.67856", "0.66328424", "0.66278535", "0.64676934", "0.64231545", "0.62784195", "0.62653327", "0.62639755", "0.6193233", "0.61708516", "0.6160613", "0.6150246", "0.61411446", "0.61161584", "0.611487", "0.61120486", "0.60653806", "0.6050347", "0.60220504", "0.600...
0.6565001
4
Agafa els tipus d'activitats que esten actius
public abstract List<TipoActividad> getTiposActividad() throws PersistenceException, ClassNotFoundException;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void menuTipoActividad() {\n\t\tSystem.out.println(\"MENU TIPOS ACTIVIDAD\");\n\t\tSystem.out.println(\"1. LOW\");\n\t\tSystem.out.println(\"2. MEDIUM\");\n\t\tSystem.out.println(\"3. HIGH\");\n\t}", "private void setActiveActions() {\n\t\tnewBinaryContext.setEnabled(true);\n\t\tnewValuedContext.setEnable...
[ "0.64715034", "0.5931246", "0.58816624", "0.58816624", "0.5851466", "0.5837698", "0.5798177", "0.56474245", "0.5630221", "0.56220824", "0.5600948", "0.55868113", "0.5555778", "0.5554963", "0.55329716", "0.5528163", "0.551601", "0.550885", "0.5459777", "0.5458364", "0.5442832"...
0.0
-1
Agafa tots els tipus d'activitats
public abstract List<TipoActividad> getTiposActividadAdm() throws PersistenceException, ClassNotFoundException;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void menuTipoActividad() {\n\t\tSystem.out.println(\"MENU TIPOS ACTIVIDAD\");\n\t\tSystem.out.println(\"1. LOW\");\n\t\tSystem.out.println(\"2. MEDIUM\");\n\t\tSystem.out.println(\"3. HIGH\");\n\t}", "private void listadoTipos() {\r\n sessionProyecto.getTipos().clear();\r\n sessionProyecto.s...
[ "0.6838378", "0.63930184", "0.6122191", "0.6122191", "0.61074084", "0.5962456", "0.5825227", "0.57951295", "0.5623764", "0.56198114", "0.5614262", "0.55985606", "0.55878794", "0.55665445", "0.5535824", "0.55330783", "0.5518897", "0.55006284", "0.5462377", "0.5453196", "0.5422...
0.5179568
48
Seleccionar el tipo de actividad d'una actividad
public abstract String getTipoByAct(Actividad activity) throws PersistenceException, ClassNotFoundException;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void menuTipoActividad() {\n\t\tSystem.out.println(\"MENU TIPOS ACTIVIDAD\");\n\t\tSystem.out.println(\"1. LOW\");\n\t\tSystem.out.println(\"2. MEDIUM\");\n\t\tSystem.out.println(\"3. HIGH\");\n\t}", "public void seleccionarTipoComprobante() {\r\n if (com_tipo_comprobante.getValue() != null) {\r\n ...
[ "0.7051573", "0.6442153", "0.59104645", "0.58953464", "0.58294207", "0.58277965", "0.5826968", "0.5822851", "0.5791142", "0.57742715", "0.5768631", "0.57497406", "0.57357967", "0.57303774", "0.5724278", "0.57212454", "0.5652129", "0.5651833", "0.56365293", "0.56365293", "0.56...
0.5855777
4
Start listening on port 80. It should not throw any exceptions. If the port is in use, the test will fail.
@Test public void testServerStart() { assertDoesNotThrow(() -> { Server server = new Server(500); server.start(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void startServer(int port) throws Exception;", "public void start(int port);", "private void startListen() {\n try {\n listeningSocket = new ServerSocket(listeningPort);\n } catch (IOException e) {\n throw new RuntimeException(\"Cannot open listeningPort \" + listeningPort, ...
[ "0.67227656", "0.66908634", "0.6507352", "0.6298379", "0.62799597", "0.6223277", "0.61008924", "0.6098022", "0.59314555", "0.5925656", "0.5882275", "0.58155453", "0.5773173", "0.5767598", "0.57423127", "0.57387", "0.5729114", "0.5692014", "0.5680985", "0.5644006", "0.563718",...
0.5511082
27
It tests a few ServerHandler methods. If everything works fine, the test should pass.
@Test public void testServerHandler() throws IOException { ServerHandler handler = new ServerHandler(); // Add user String username = handler.generateUsername(); User user = new User.UserBuilder() .hasUsername(username) .build(); Socket socket = new Socket(); ClientInfo clientInfo = new ClientInfo(user, socket, handler); handler.addUser(clientInfo); // Add another user String username2 = handler.generateUsername(); User user2 = new User.UserBuilder() .hasUsername(username2) .build(); Socket socket2 = new Socket(); ClientInfo clientInfo2 = new ClientInfo(user2, socket2, handler); handler.addUser(clientInfo2); // Remove second user handler.removeUser(handler.getUserClientInfo(username2)); // Get users Vector<ClientInfo> users = handler.getUsers(); // Find user User foundUser = handler.findByUsername(username); // User existence boolean userExists = handler.usernameExists(foundUser.getUsername()); assertEquals(10, foundUser.getUsername().length()); assertEquals(true, userExists); assertEquals(1, users.size()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testServerStart() {\n assertDoesNotThrow(() -> {\n Server server = new Server(500);\n server.start();\n });\n }", "@Test\n public void serverStarts() {\n }", "@Test\n public void serverConfiguration() throws IOException {\n initJadle...
[ "0.6579374", "0.656045", "0.6482443", "0.6480549", "0.64232945", "0.63405615", "0.60850537", "0.60143936", "0.5932795", "0.5903259", "0.58989906", "0.58067214", "0.5782291", "0.57764745", "0.5770268", "0.57698303", "0.5749797", "0.57451075", "0.57042414", "0.5702283", "0.5690...
0.7317194
0
Random string generation test.
@Test public void testUtil() { String random = Util.getInstance().getRandomString(15); assertEquals(15, random.length()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testRandomStrings() throws Exception {\n checkRandomData(random(), a, 200 * RANDOM_MULTIPLIER);\n }", "private String getRandomName(){\n return rndString.nextString();\n }", "private final String getRandomString() {\n StringBuffer sbRan = new StringBuffer(11);\n String...
[ "0.8383381", "0.7732061", "0.75917435", "0.74023277", "0.73622197", "0.7331284", "0.72968405", "0.72623414", "0.72076964", "0.7167407", "0.71528214", "0.7151317", "0.714662", "0.7135636", "0.7106458", "0.7093249", "0.7091431", "0.70776623", "0.70616734", "0.6973347", "0.69561...
0.73320013
5
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testFlavourEqualsContract() { EqualsVerifier.forClass(PdfaFlavour.class).verify(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testSpecificationEqualsContract() {\n EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify();\n }", "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\...
[ "0.73466444", "0.73406184", "0.729062", "0.726788", "0.71800286", "0.7042927", "0.6993379", "0.68919605", "0.6815909", "0.6789467", "0.67293495", "0.669995", "0.66196585", "0.6619598", "0.6607875", "0.6548022", "0.6546288", "0.65354735", "0.6507837", "0.65073365", "0.6500771"...
0.70608395
5
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testLevelEqualsContract() { EqualsVerifier.forClass(PdfaFlavour.Level.class).verify(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testSpecificationEqualsContract() {\n EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify();\n }", "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\...
[ "0.73466444", "0.73406184", "0.729062", "0.726788", "0.71800286", "0.70608395", "0.7042927", "0.6993379", "0.68919605", "0.6815909", "0.67293495", "0.669995", "0.66196585", "0.6619598", "0.6607875", "0.6548022", "0.6546288", "0.65354735", "0.6507837", "0.65073365", "0.6500771...
0.6789467
10
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testStandardEqualsContract() { EqualsVerifier.forClass(PdfaFlavour.IsoStandard.class).verify(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testSpecificationEqualsContract() {\n EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify();\n }", "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\...
[ "0.73468", "0.7341382", "0.72907835", "0.7268406", "0.7179382", "0.7060953", "0.7043847", "0.6993722", "0.68918484", "0.6789825", "0.6728865", "0.6700531", "0.66191006", "0.66190445", "0.6607664", "0.6547432", "0.654594", "0.65366405", "0.65084064", "0.65076613", "0.65008724"...
0.68162966
9
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testStandardSeriesEqualsContract() { EqualsVerifier.forClass(PdfaFlavour.IsoStandardSeries.class).verify(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testSpecificationEqualsContract() {\n EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify();\n }", "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\...
[ "0.7346661", "0.7340574", "0.72916514", "0.7269818", "0.71807724", "0.70608944", "0.7043007", "0.699361", "0.6891562", "0.68169874", "0.67899483", "0.6731035", "0.6700458", "0.66214186", "0.66211647", "0.66086555", "0.65495837", "0.6547176", "0.6536473", "0.65083253", "0.6508...
0.61650354
65
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testSpecificationEqualsContract() { EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\n }", "private Equals() {}", "@Test\n\tpublic void testHashCode() {\n\t\t// Same hashcode must be returned for equal objects\n\t\tassert...
[ "0.73406184", "0.729062", "0.726788", "0.71800286", "0.70608395", "0.7042927", "0.6993379", "0.68919605", "0.6815909", "0.6789467", "0.67293495", "0.669995", "0.66196585", "0.6619598", "0.6607875", "0.6548022", "0.6546288", "0.65354735", "0.6507837", "0.65073365", "0.6500771"...
0.73466444
0
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testFlavourToString() { for (PdfaFlavour flavour : PdfaFlavour.values()) { System.out.println(flavour.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testSpecificationEqualsContract() {\n EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify();\n }", "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\...
[ "0.73466444", "0.73406184", "0.729062", "0.726788", "0.71800286", "0.70608395", "0.7042927", "0.6993379", "0.68919605", "0.6815909", "0.6789467", "0.67293495", "0.669995", "0.66196585", "0.6619598", "0.6607875", "0.6548022", "0.6546288", "0.65354735", "0.6507837", "0.65073365...
0.0
-1
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testLevelToString() { for (PdfaFlavour.Level level : PdfaFlavour.Level.values()) { System.out.println(level.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testSpecificationEqualsContract() {\n EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify();\n }", "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\...
[ "0.73468", "0.7341382", "0.72907835", "0.7268406", "0.7179382", "0.7060953", "0.7043847", "0.6993722", "0.68918484", "0.68162966", "0.6789825", "0.6728865", "0.6700531", "0.66191006", "0.66190445", "0.6607664", "0.6547432", "0.654594", "0.65366405", "0.65084064", "0.65076613"...
0.0
-1
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testStandardToString() { for (PdfaFlavour.IsoStandard standard : PdfaFlavour.IsoStandard.values()) { System.out.println(standard.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testSpecificationEqualsContract() {\n EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify();\n }", "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\...
[ "0.7346661", "0.7340574", "0.72916514", "0.7269818", "0.71807724", "0.70608944", "0.7043007", "0.699361", "0.6891562", "0.68169874", "0.67899483", "0.6731035", "0.6700458", "0.66214186", "0.66211647", "0.66086555", "0.65495837", "0.6547176", "0.6536473", "0.65083253", "0.6508...
0.0
-1
Test the hash and equals contract for the class using EqualsVerifier
@Test public void testStandardSeriesToString() { for (PdfaFlavour.IsoStandardSeries series : PdfaFlavour.IsoStandardSeries.values()) { System.out.println(series.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testSpecificationEqualsContract() {\n EqualsVerifier.forClass(PdfaSpecificationImpl.class).verify();\n }", "@Test\n\tpublic void equalsContract()\n\t{\n\t\tEqualsVerifier.forClass(ExperienceChangedReport.class).verify();\n\t}", "@Test\n public void testEqualsAndHashCode() {\...
[ "0.73466444", "0.73406184", "0.729062", "0.726788", "0.71800286", "0.70608395", "0.7042927", "0.6993379", "0.68919605", "0.6815909", "0.6789467", "0.67293495", "0.669995", "0.66196585", "0.6619598", "0.6607875", "0.6548022", "0.6546288", "0.65354735", "0.6507837", "0.65073365...
0.0
-1
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit. Note that you cannot sell a stock before you buy one. Example 1: Input: [7,1,5,3,6,4] Output: 5 Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 61 = 5. Not 71 = 6, as selling price needs to be larger than buying price. Example 2: Input: [7,6,4,3,1] Output: 0 Explanation: In this case, no transaction is done, i.e. max profit = 0.
public static int maxProfit(int[] prices) { //no stock can be sold if (prices == null) { return 0; } int buyDay = 0; int maxProfit = 0; for (int day = 1; day < prices.length; day++) { //update maxProfit int currentProfit = prices[day] - prices[buyDay]; if (currentProfit > maxProfit) { maxProfit = currentProfit; } else if (currentProfit < 0) { //update buyDay buyDay = day; } } return maxProfit; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static int findMaxProfit(int [] prices){\n int max_profit = 0;\r\n for (int i = 0;i<prices.length-1;i++){\r\n if(prices [i] < prices [i+1]){\r\n max_profit = max_profit + (prices[i+1]-prices[i]);\r\n }\r\n }\r\n return max_profit;\r\n }", ...
[ "0.8272641", "0.8215362", "0.82104623", "0.8192952", "0.8142581", "0.8086687", "0.80636317", "0.8061291", "0.8025296", "0.7977906", "0.7967717", "0.796542", "0.79432464", "0.7943229", "0.792799", "0.7920447", "0.7913432", "0.78777975", "0.78724855", "0.78681403", "0.7865859",...
0.81593084
4
no stock can be sold
public static int maxProfit2(int[] prices) { if (prices == null) { return 0; } int currentProfit = 0; int maxProfit = 0; for (int day = 1; day < prices.length; day++) { //update maxProfit int delta = prices[day] - prices[day - 1]; currentProfit = Math.max(0, currentProfit + delta); maxProfit = Math.max(currentProfit, maxProfit); } return maxProfit; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test(expected=MissingPrice.class)\n\tpublic void testNotEnoughBought() {\n\t\tpos.setPricing(\"A\", 4, 7);\n\n\t\tpos.scan(\"A\");\n\t\tpos.total();\n\t}", "@Test\n public void checkStockWithoutProduction () {\n\n player.playRole(new Trader(stockGlobal,1));\n assertEquals(true,stockGlobal.get...
[ "0.69800764", "0.69082546", "0.6901365", "0.66933167", "0.65442044", "0.64275414", "0.64046335", "0.6350914", "0.63073546", "0.6253246", "0.6227452", "0.6195858", "0.61614627", "0.61182433", "0.6090654", "0.6085126", "0.6082111", "0.6076471", "0.6073827", "0.6019636", "0.6019...
0.0
-1
panggil nama dan jabatan
private void setContent(){ nama.setText(Prefs.getString(PrefsClass.NAMA, "")); // txt_msg_nama.setText(Prefs.getString(PrefsClass.NAMA,"")); //set foto di header navbar Utils.LoadImage(MainActivity.this, pb, Prefs.getString(PrefsClass.FOTO,""),foto); addItemSpinner(); setActionBarTitle(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic String toString() {\n\t\treturn namaBulan;\n\t}", "public static void alamatPerusahaan() {\r\n System.out.println(\"Karyawan bekerja di Perusahaan \" + Employee.perusahaan + \" yang beralamat di Jalan Astangkuri Jakarta\");\r\n }", "Karyawan(String n)\n {\n this.nama = n...
[ "0.6974227", "0.6887414", "0.68542874", "0.6747913", "0.67458516", "0.6713167", "0.6682792", "0.66731346", "0.663455", "0.6633325", "0.6629656", "0.6598963", "0.659884", "0.6593148", "0.6576023", "0.65583324", "0.65515304", "0.6535686", "0.65314513", "0.6523747", "0.6474066",...
0.0
-1
KProgressHUD hud = new KProgressHUD(this); Utils.showProgressBar(hud, null, null, false);
private void showBadge(String id){ AndroidNetworking.post(Server.getURL_BadgeIndicator) .addBodyParameter("id_so", id) .build() .getAsOkHttpResponseAndObject(BadgeModel.class, new OkHttpResponseAndParsedRequestListener<BadgeModel>() { @Override public void onResponse(Response okHttpResponse, BadgeModel response) { if (okHttpResponse.isSuccessful()){ // hud.dismiss(); String b1,b2,b3,b4; b1 = response.getData().getSuratMasuk(); b2 = response.getData().getSuratDisposisi(); b3 = response.getData().getNotaDinas(); b4 = response.getData().getNotaDisposisi(); int total,i1,i2,i3,i4; i1 = Integer.parseInt(b1); i2 = Integer.parseInt(b2); i3 = Integer.parseInt(b3); i4 = Integer.parseInt(b4); total = i1+i2+i3+i4; if (i1 > 99){ b1 = "99+"; } if (i2 > 99){ b2 = "99+"; } if (i3 > 99){ b3 = "99+"; } if (i4 > 99){ b4 = "99+"; } if (!b1.equals("0")){ txtB1.setText(b1); badge_surat.setVisibility(View.VISIBLE); }else{ badge_surat.setVisibility(View.GONE); } if (!b2.equals("0")){ txtB2.setText(b2); badge_sd.setVisibility(View.VISIBLE); }else{ badge_sd.setVisibility(View.GONE); } if (!b3.equals("0")){ txtB3.setText(b3); badge_nota.setVisibility(View.VISIBLE); }else { badge_nota.setVisibility(View.GONE); } if (!b4.equals("0")){ txtB4.setText(b4); badge_nd.setVisibility(View.VISIBLE); }else { badge_nd.setVisibility(View.GONE); } // if (total > 0){ // ShortcutBadger.applyCount(MainActivity.this, total); // Intent intent = new Intent(Intent.ACTION_MAIN); // intent.addCategory(Intent.CATEGORY_HOME); // ResolveInfo resolveInfo = getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); // String currentPackage = resolveInfo.activityInfo.packageName; // } } } @Override public void onError(ANError anError) { // hud.dismiss(); badge_surat.setVisibility(View.GONE); badge_sd.setVisibility(View.GONE); badge_nota.setVisibility(View.GONE); badge_nd.setVisibility(View.GONE); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void showProgressBar() {\n MainActivity.sInstance.showProgressBar();\n }", "private void progressStuff() {\n cd = new ConnectionDetector(getActivity());\n parser = new JSONParser();\n progress = new ProgressDialog(getActivity());\n progress.setMessage(g...
[ "0.7268342", "0.7070909", "0.6995952", "0.69808227", "0.69315237", "0.6925672", "0.6881039", "0.67488503", "0.6665944", "0.66590893", "0.6651918", "0.65978426", "0.65978426", "0.65897524", "0.65714484", "0.65558094", "0.6553093", "0.6546426", "0.65144914", "0.65047914", "0.64...
0.0
-1
Menu options to set and cancel the alarm.
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // When the user clicks START ALARM, set the alarm. case R.id.start_action: alarm.setAlarm(this); return true; // When the user clicks CANCEL ALARM, cancel the alarm. case R.id.cancel_action: alarm.cancelAlarm(this); return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setAlarm (int alarm) { this.alarm = alarm; }", "public void scheduleOptions() {\n System.out.println(\"Would you like to (1) Add an Event, (2) Remove an Event, (3) Exit this menu\");\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItem...
[ "0.6534718", "0.65002936", "0.6304249", "0.62145215", "0.5936722", "0.5806598", "0.5730943", "0.57122594", "0.57016784", "0.56895036", "0.5680456", "0.56556594", "0.5648832", "0.56356144", "0.5597366", "0.55736387", "0.5567222", "0.55305314", "0.5517667", "0.55157334", "0.549...
0.62387335
3
The prime factors of 13195 are 5, 7, 13 and 29
public static void main(String[] args) { long n = new Long("13195"); System.out.println(new LargestPrimeFactor().solve(n)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) {\n int product = 1;\n int[] factors = new int[max]; //The position in the array represents the actual factor, the number at that position is the number of occurrences of that factor\n\n for (int i = 2; i < max + 1; i++) { //Checking divisibility by num...
[ "0.70558935", "0.70240706", "0.67843807", "0.671636", "0.6643987", "0.65063757", "0.6465586", "0.64267063", "0.64036095", "0.6376462", "0.63389987", "0.62393737", "0.6212035", "0.6186508", "0.616347", "0.6147016", "0.612831", "0.6098794", "0.6089193", "0.6082177", "0.60747313...
0.5897304
28
1.0 means not similar.
public byte[][] getBiArray() { return mbarrayBiValues; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double matchData() {\n\t\tArrayList<OWLDataProperty> labels1 = getDataProperties(ontology1);\n\t\tArrayList<OWLDataProperty> labels2 = getDataProperties(ontology2);\n\t\tfor (OWLDataProperty lit1 : labels1) {\n\t\t\tfor (OWLDataProperty lit2 : labels2) {\n\t\t\t\tif (LevenshteinDistance.computeLevenshteinDi...
[ "0.65339905", "0.64875305", "0.63898045", "0.63877857", "0.6362546", "0.6276948", "0.62603956", "0.6214069", "0.6165262", "0.6054141", "0.6048647", "0.6026919", "0.6009336", "0.59995866", "0.5980829", "0.59710956", "0.59281856", "0.59163636", "0.5891541", "0.5866537", "0.5844...
0.0
-1
this function is just used for change unitprototype, this ser should have been an enum type.
public void setStructExprRecog(UnitProtoType.Type unitType, String strFont, ImageChop imgChop) { mnExprRecogType = EXPRRECOGTYPE_ENUMTYPE; mType = unitType; mstrFont = strFont; mimgChop = imgChop; mlistChildren = new LinkedList<StructExprRecog>(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void changeSEREnumType(UnitProtoType.Type unitType, String strFont) {\n mnExprRecogType = EXPRRECOGTYPE_ENUMTYPE;\n mType = unitType;\n mstrFont = strFont;\n mlistChildren = new LinkedList<StructExprRecog>();\n }", "@Override\r\n public String toString() {\r\n ret...
[ "0.6306719", "0.5811091", "0.57971716", "0.5739627", "0.5687438", "0.56356037", "0.5596495", "0.5561929", "0.555737", "0.5531003", "0.5496353", "0.54754895", "0.5460361", "0.54600376", "0.5442308", "0.5440607", "0.5434645", "0.5405561", "0.53959113", "0.5390586", "0.5390199",...
0.0
-1
this interface should not be used, always assign cut mode.
public void setStructExprRecog(LinkedList<StructExprRecog> listChildren) { mnExprRecogType = EXPRRECOGTYPE_LISTCUT; mType = UnitProtoType.Type.TYPE_UNKNOWN; mstrFont = UNKNOWN_FONT_TYPE; mlistChildren = new LinkedList<StructExprRecog>(); mlistChildren.addAll(listChildren); int nLeft = Integer.MAX_VALUE, nTop = Integer.MAX_VALUE, nRightPlus1 = Integer.MIN_VALUE, nBottomPlus1 = Integer.MIN_VALUE; int nTotalArea = 0, nTotalValidChildren = 0; double dSumWeightedSim = 0; double dSumSimilarity = 0; for (StructExprRecog ser: mlistChildren) { if (ser.mnLeft == 0 && ser.mnTop == 0 && ser.mnHeight == 0 && ser.mnWidth == 0) { continue; // this can happen in some extreme case like extract2Recog input is null or empty imageChops // to avoid jeapodize the ser place, skip. } if (ser.mnLeft < nLeft) { nLeft = ser.mnLeft; } if (ser.mnLeft + ser.mnWidth > nRightPlus1) { nRightPlus1 = ser.mnLeft + ser.mnWidth; } if (ser.mnTop < nTop) { nTop = ser.mnTop; } if (ser.mnTop + ser.mnHeight > nBottomPlus1) { nBottomPlus1 = ser.mnTop + ser.mnHeight; } nTotalArea += ser.getArea(); dSumSimilarity += ser.getArea() * ser.mdSimilarity; nTotalValidChildren ++; dSumSimilarity += ser.mdSimilarity; } mnLeft = nLeft; mnTop = nTop; mnWidth = nRightPlus1 - nLeft; mnHeight = nBottomPlus1 - nTop; mimgChop = null; if (nTotalArea > 0) { mdSimilarity = dSumSimilarity / nTotalArea; } else { mdSimilarity = dSumSimilarity / nTotalValidChildren; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int invokeCutMode()\n{\n \n return(0);\n\n}", "public boolean isCut() {\n\t\treturn isCut;\n\t}", "public void performCut() {\n \t\ttext.cut();\n \t\tcheckSelection();\n \t\tcheckDeleteable();\n \t\tcheckSelectable();\n \t}", "public void cut() {\n\t\tcmd = new CutCommand(editor);\n\t\tinvoker =...
[ "0.7595876", "0.7230139", "0.66313374", "0.6594449", "0.6465474", "0.6250114", "0.61743397", "0.6087965", "0.6070986", "0.6036997", "0.6021229", "0.6008295", "0.60056305", "0.598338", "0.59220606", "0.58226746", "0.5817607", "0.57865584", "0.575757", "0.5719907", "0.57120264"...
0.0
-1
this function is just used for change unitprototype, this ser should have been an enum type.
public void changeSEREnumType(UnitProtoType.Type unitType, String strFont) { mnExprRecogType = EXPRRECOGTYPE_ENUMTYPE; mType = unitType; mstrFont = strFont; mlistChildren = new LinkedList<StructExprRecog>(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n public String toString() {\r\n return unit.getName();\r\n }", "public UnitTypes GetCurrentUnitType()\n {\n return MethodsCommon.GetTypeFromUnit(Unit);\n }", "public abstract String getUnit();", "public ServicesFormatEnum(){\n super();\n }", "public void setUnit(U...
[ "0.58121246", "0.5797544", "0.57406056", "0.5685439", "0.5634475", "0.55950797", "0.5561276", "0.55541474", "0.55280614", "0.5497328", "0.54772615", "0.5459936", "0.54585856", "0.5442126", "0.54416823", "0.54351974", "0.54044545", "0.53969115", "0.53917277", "0.53884083", "0....
0.63061476
0
if nAnalyticMode & 1 == 1, extract principle from H divided sers with cap and/or under if nAnalyticMode & 2 == 2, extract principle from sers with left top note if nAnalyticMode & 4 == 4, extract principle from sers with upper and/or lower note(s) if nAnalyticMode & 8 == 8, extract rooted value from root sers.
public StructExprRecog getPrincipleSER(int nAnalyticMode) { if (mnExprRecogType == EXPRRECOGTYPE_HCUTCAP && (nAnalyticMode & 1) == 1) { return mlistChildren.getLast(); } else if (mnExprRecogType == EXPRRECOGTYPE_HCUTUNDER && (nAnalyticMode & 1) == 1) { return mlistChildren.getFirst(); } else if (mnExprRecogType == EXPRRECOGTYPE_HCUTCAPUNDER && (nAnalyticMode & 1) == 1) { return mlistChildren.get(1); } else if (mnExprRecogType == EXPRRECOGTYPE_VCUTLEFTTOPNOTE && (nAnalyticMode & 2) == 2) { return mlistChildren.getLast(); } else if (mnExprRecogType == EXPRRECOGTYPE_VCUTUPPERNOTE && (nAnalyticMode & 4) == 4) { return mlistChildren.getFirst(); } else if (mnExprRecogType == EXPRRECOGTYPE_VCUTLOWERNOTE && (nAnalyticMode & 4) == 4) { return mlistChildren.getFirst(); } else if (mnExprRecogType == EXPRRECOGTYPE_VCUTLUNOTES && (nAnalyticMode & 4) == 4) { return mlistChildren.getFirst(); } else if (mnExprRecogType == EXPRRECOGTYPE_GETROOT && (nAnalyticMode & 8) == 8) { return mlistChildren.getLast(); } else { return this; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static Boolean getAppositivePrs(PairInstance inst) {\n if (inst.getAnaphor().getSentId()!=inst.getAntecedent().getSentId()) \n return false;\n\n// exclude pairs where anaphor is an NE -- this might be a bad idea though..\n if (inst.getAnaphor().isEnamex()) \n return false;...
[ "0.49149823", "0.48731843", "0.48441935", "0.4686829", "0.46772215", "0.4625434", "0.45637146", "0.45547312", "0.45530024", "0.4549208", "0.45422935", "0.44976908", "0.4497212", "0.44742295", "0.44552112", "0.44531345", "0.4448911", "0.44346926", "0.44177976", "0.44092068", "...
0.62023705
0
needs original image chop as parameter which will be used for matrix and m exprs.
public StructExprRecog restruct() throws InterruptedException { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } if (mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE) { return this; // basic element return this to save computing time and space } else if (mlistChildren.size() == 0) { StructExprRecog ser = new StructExprRecog(mbarrayBiValues); ser.setSERPlace(this); ser.setSimilarity(0); // type unknown, similarity is 0. return ser; } else if (mlistChildren.size() == 1 && mnExprRecogType != EXPRRECOGTYPE_VCUTMATRIX) { // if a matrix, we cannot convert [x] -> x (e.g. 2 * [2 + 3] -> 2 * 2 + 3 is wrong). StructExprRecog ser = mlistChildren.getFirst().restruct(); return ser; } else if (mnExprRecogType == EXPRRECOGTYPE_HBLANKCUT || mnExprRecogType == EXPRRECOGTYPE_HCUTCAP || mnExprRecogType == EXPRRECOGTYPE_HCUTCAPUNDER || mnExprRecogType == EXPRRECOGTYPE_HCUTUNDER || mnExprRecogType == EXPRRECOGTYPE_HLINECUT || mnExprRecogType == EXPRRECOGTYPE_MULTIEXPRS || mnExprRecogType == EXPRRECOGTYPE_GETROOT || mnExprRecogType == EXPRRECOGTYPE_VCUTMATRIX) { // assume horizontal cut is always clear before call restruct, i.e. hblank, hcap, hunder, hcapunder are not confused. // there is a special case for HBlankCut, Under and cap cut (handwriting divide may miss recognized). StructExprRecog[] serarrayNoLnDe = new StructExprRecog[3]; boolean bIsDivide = isActuallyHLnDivSER(this, serarrayNoLnDe); //need to do it here as well as in vertical restruct StructExprRecog serReturn = new StructExprRecog(mbarrayBiValues); LinkedList<StructExprRecog> listCuts = new LinkedList<StructExprRecog>(); if (bIsDivide) { listCuts.add(serarrayNoLnDe[0].restruct()); listCuts.add(serarrayNoLnDe[1].restruct()); listCuts.add(serarrayNoLnDe[2].restruct()); } else { for (StructExprRecog ser : mlistChildren) { listCuts.add(ser.restruct()); } } if (listCuts.getFirst().getExprRecogType() == StructExprRecog.EXPRRECOGTYPE_ENUMTYPE && listCuts.getFirst().isPossibleVLnChar() && listCuts.getLast().getExprRecogType() == StructExprRecog.EXPRRECOGTYPE_ENUMTYPE && listCuts.getLast().isPossibleVLnChar() && (bIsDivide || mnExprRecogType == EXPRRECOGTYPE_HLINECUT) // is actually H-line cut. && mnWidth >= ConstantsMgr.msdPlusHeightWidthRatio * mnHeight && mnWidth <= mnHeight / ConstantsMgr.msdPlusHeightWidthRatio && listCuts.getFirst().mnHeight >= ConstantsMgr.msdPlusTopVLnBtmVLnRatio * listCuts.getLast().mnHeight && listCuts.getFirst().mnHeight <= listCuts.getLast().mnHeight / ConstantsMgr.msdPlusTopVLnBtmVLnRatio && listCuts.getFirst().mnLeft < listCuts.getLast().getRight() && listCuts.getFirst().getRight() > listCuts.getLast().mnLeft && listCuts.getFirst().getBottomPlus1() >= listCuts.get(1).mnTop && listCuts.getLast().mnTop <= listCuts.get(1).getBottomPlus1()) { // the shape of this ser should match + // seems like a + instead of 1/1 double dSimilarity = (listCuts.getFirst().getArea() * listCuts.getFirst().mdSimilarity + listCuts.get(1).getArea() * listCuts.get(1).mdSimilarity + listCuts.getLast().getArea() * listCuts.getLast().mdSimilarity) / (listCuts.getFirst().getArea() + listCuts.get(1).getArea() + listCuts.getLast().getArea()); // total area should not be zero here. // now we merge the three parts into + LinkedList<ImageChop> listParts = new LinkedList<ImageChop>(); ImageChop imgChopTop = listCuts.getFirst().getImageChop(false); listParts.add(imgChopTop); ImageChop imgChopHLn = listCuts.get(1).getImageChop(false); listParts.add(imgChopHLn); ImageChop imgChopBottom = listCuts.getLast().getImageChop(false); listParts.add(imgChopBottom); ImageChop imgChop4SER = ExprSeperator.mergeImgChopsWithSameOriginal(listParts); // need not to shrink imgChop4SER because it has been min container. serReturn.setStructExprRecog(UnitProtoType.Type.TYPE_ADD, UNKNOWN_FONT_TYPE, mnLeft, mnTop, mnWidth, mnHeight, imgChop4SER, dSimilarity); } else if (bIsDivide) { // is actually an h line cut, i.e. div. serReturn.setStructExprRecog(listCuts, EXPRRECOGTYPE_HLINECUT); } else { serReturn.setStructExprRecog(listCuts, mnExprRecogType); serReturn = serReturn.identifyHSeperatedChar(); // special treatment for like =, i, ... if (serReturn.mnExprRecogType != EXPRRECOGTYPE_ENUMTYPE) { serReturn = serReturn.identifyStrokeBrokenChar(); // convert like 7 underline to 2. } } return serReturn; } else { // listcut, vblankcut, vcutlefttop, vcutlower, vcutupper, vcutlowerupper // the children are vertically cut. if cut mode is LISTCUT, also treated as vertically cut. // make the following assumptions for horizontally cut children // 1. the h-cut modes have been clear (i.e. normal horizontally cut, cap, undercore etc) // 2. the getroot, vcutmatrix and multiexprs have been clear. // 3. the v-cut modes are not clear // step 1. merge all the vertically cut children into main mlistChildren, and for all h-blank cut children, merge all of its h-blank cut // into itself. LinkedList<StructExprRecog> listMergeVCutChildren1 = new LinkedList<StructExprRecog>(); listMergeVCutChildren1.addAll(mlistChildren); LinkedList<StructExprRecog> listMergeVCutChildren = new LinkedList<StructExprRecog>(); boolean bHasVCutChild = true; while(bHasVCutChild) { bHasVCutChild = false; for (int idx = 0; idx < listMergeVCutChildren1.size(); idx ++) { if (/*listMergeVCutChildren1.get(idx).mnExprRecogType == EXPRRECOGTYPE_LISTCUT // treat list cut like vblankcut only when we print its value to string || */listMergeVCutChildren1.get(idx).isVCutNonMatrixType()) { for (int idx1 = 0; idx1 < listMergeVCutChildren1.get(idx).mlistChildren.size(); idx1 ++) { if (/*listMergeVCutChildren1.get(idx).mlistChildren.get(idx1).mnExprRecogType == EXPRRECOGTYPE_LISTCUT // treat list cut like vblankcut only when we print its value to string || */listMergeVCutChildren1.get(idx).mlistChildren.get(idx1).isVCutNonMatrixType()) { bHasVCutChild = true; } int idx2 = listMergeVCutChildren.size() - 1; StructExprRecog serToAdd = listMergeVCutChildren1.get(idx).mlistChildren.get(idx1); for (; idx2 >= 0; idx2 --) { double dListChildCentral = listMergeVCutChildren.get(idx2).mnLeft + listMergeVCutChildren.get(idx2).mnWidth / 2.0; double dToAddCentral = serToAdd.mnLeft + serToAdd.mnWidth / 2.0; if (dListChildCentral < dToAddCentral) { break; } } listMergeVCutChildren.add(idx2 + 1, serToAdd); } // do not consider hblankcut list size == 1 case because it is impossible. } else { int idx2 = listMergeVCutChildren.size() - 1; StructExprRecog serToAdd = listMergeVCutChildren1.get(idx); for (; idx2 >= 0; idx2 --) { double dListChildCentral = listMergeVCutChildren.get(idx2).mnLeft + listMergeVCutChildren.get(idx2).mnWidth / 2.0; double dToAddCentral = serToAdd.mnLeft + serToAdd.mnWidth / 2.0; if (dListChildCentral < dToAddCentral) { break; } } listMergeVCutChildren.add(idx2 + 1, serToAdd); } } if (bHasVCutChild) { listMergeVCutChildren1.clear(); listMergeVCutChildren1 = listMergeVCutChildren; listMergeVCutChildren = new LinkedList<StructExprRecog>(); } } for (int idx = 0; idx < listMergeVCutChildren.size(); idx ++) { StructExprRecog serChild = listMergeVCutChildren.get(idx); if (serChild.mnExprRecogType == EXPRRECOGTYPE_HBLANKCUT) { LinkedList<StructExprRecog> listHBlankCutChildren1 = new LinkedList<StructExprRecog>(); listHBlankCutChildren1.addAll(serChild.mlistChildren); LinkedList<StructExprRecog> listHBlankCutChildren = new LinkedList<StructExprRecog>(); boolean bHasHBlankCutChild = true; while(bHasHBlankCutChild) { bHasHBlankCutChild = false; for (int idx0 = 0; idx0 < listHBlankCutChildren1.size(); idx0 ++) { if (listHBlankCutChildren1.get(idx0).mnExprRecogType == EXPRRECOGTYPE_HBLANKCUT) { for (int idx1 = 0; idx1 < listHBlankCutChildren1.get(idx0).mlistChildren.size(); idx1 ++) { if (listHBlankCutChildren1.get(idx0).mlistChildren.get(idx1).mnExprRecogType == EXPRRECOGTYPE_HBLANKCUT) { bHasHBlankCutChild = true; } listHBlankCutChildren.add(listHBlankCutChildren1.get(idx0).mlistChildren.get(idx1)); } } else { listHBlankCutChildren.add(listHBlankCutChildren1.get(idx0)); } } if (bHasHBlankCutChild) { listHBlankCutChildren1.clear(); listHBlankCutChildren1 = listHBlankCutChildren; listHBlankCutChildren = new LinkedList<StructExprRecog>(); } } StructExprRecog serNewChild = new StructExprRecog(serChild.mbarrayBiValues); serNewChild.setStructExprRecog(listHBlankCutChildren, EXPRRECOGTYPE_HBLANKCUT); listMergeVCutChildren.set(idx, serNewChild); } } // step 2: identify upper notes or lower notes, This is raw upper lower identification procedure. h-cut // children are not analyzed. LinkedList<Integer> listCharLevel = new LinkedList<Integer>(); LinkedList<Integer> list1SideAnchorBaseIdx = new LinkedList<Integer>(); // first of all, find out the highest child which must be base int nBiggestChildHeight = 0; int nBiggestChildIdx = 0; int nHighestNonHDivChildHeight = -1; int nHighestNonHDivChildIdx = -1; for (int idx = 0; idx < listMergeVCutChildren.size(); idx ++) { if (listMergeVCutChildren.get(idx).mnHeight > nBiggestChildHeight) { nBiggestChildIdx = idx; nBiggestChildHeight = listMergeVCutChildren.get(idx).mnHeight; } if (isHDivCannotBeBaseAnchorSER(listMergeVCutChildren.get(idx)) == false && listMergeVCutChildren.get(idx).mnHeight > nHighestNonHDivChildHeight) { // non-hdiv child could be cap or under. nHighestNonHDivChildIdx = idx; nHighestNonHDivChildHeight = listMergeVCutChildren.get(idx).mnHeight; } } boolean bHasNonHDivBaseChild = false; // ok, if we have a non h-div child, biggest child is the biggest non h-div child. Otherwise, use biggest child. if (nHighestNonHDivChildIdx >= 0) { nBiggestChildHeight = nHighestNonHDivChildHeight; nBiggestChildIdx = nHighestNonHDivChildIdx; bHasNonHDivBaseChild = true; } listCharLevel.add(0); list1SideAnchorBaseIdx.add(nBiggestChildIdx); // from highest child to right StructExprRecog serBiggestChild = listMergeVCutChildren.get(nBiggestChildIdx); BLUCharIdentifier bluCIBiggest = new BLUCharIdentifier(serBiggestChild); BLUCharIdentifier bluCI = bluCIBiggest.clone(); int nLastBaseHeight = listMergeVCutChildren.get(nBiggestChildIdx).mnHeight; for (int idx = nBiggestChildIdx + 1; idx < listMergeVCutChildren.size(); idx ++) { StructExprRecog ser = listMergeVCutChildren.get(idx); if (idx > nBiggestChildIdx + 1 // if idx == nBiggestChildIdx + 1, we have already used the bluCIBiggest. && ((bHasNonHDivBaseChild && listCharLevel.size() > 0 && listCharLevel.getLast() == 0 && !isHDivCannotBeBaseAnchorSER(listMergeVCutChildren.get(idx - 1))) || (!bHasNonHDivBaseChild && listCharLevel.size() > 0 && listCharLevel.getLast() == 0))) { StructExprRecog serBase = listMergeVCutChildren.get(idx - 1); bluCI.setBLUCharIdentifier(serBase); nLastBaseHeight = listMergeVCutChildren.get(idx - 1).mnHeight; list1SideAnchorBaseIdx.add(idx - 1); } else { list1SideAnchorBaseIdx.add(list1SideAnchorBaseIdx.getLast()); } int thisCharLevel = bluCI.calcCharLevel(ser); // 0 means base char, 1 means upper note, -1 means lower note // only from left to right we do the following work. if (thisCharLevel == 0 && listCharLevel.size() > 0 && ((listCharLevel.getLast() != 0 && nLastBaseHeight * ConstantsMgr.msdLUNoteHeightRatio2Base * ConstantsMgr.msdLUNoteHeightRatio2Base >= ser.mnHeight) || (listMergeVCutChildren.get(idx - 1).mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_HBLANKCUT && listMergeVCutChildren.get(idx - 1).mlistChildren.size() > 1 && nLastBaseHeight * ConstantsMgr.msdLUNoteHeightRatio2Base / listMergeVCutChildren.get(idx - 1).mlistChildren.size() >= ser.mnHeight)) ) { // to see if it could be upper lower note or lower upper note. if (listCharLevel.getLast() == 1 && ser.getBottom() <= bluCI.mdUpperNoteLBoundThresh) { thisCharLevel = 1; } else if (listCharLevel.getLast() == -1 && ser.mnTop >= bluCI.mdLowerNoteUBoundThresh) { thisCharLevel = -1; } else if (listMergeVCutChildren.get(idx - 1).mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_HBLANKCUT && listMergeVCutChildren.get(idx - 1).mlistChildren.size() > 1) { // hblankcut type. // first of all, find out which h-blank-div child is closest to it. int nMinDistance = Integer.MAX_VALUE; int nMinDistanceIdx = 0; double dAvgChildHeight = 0; for (int idx2 = 0; idx2 < listMergeVCutChildren.get(idx - 1).mlistChildren.size(); idx2 ++) { int nDistance = Math.abs(ser.mnTop + ser.getBottomPlus1() - listMergeVCutChildren.get(idx - 1).mlistChildren.get(idx2).mnTop - listMergeVCutChildren.get(idx - 1).mlistChildren.get(idx2).getBottomPlus1()); if (nDistance <= nMinDistance) { // allow a little bit overhead nMinDistance = nDistance; nMinDistanceIdx = idx2; } dAvgChildHeight += listMergeVCutChildren.get(idx - 1).mlistChildren.get(idx2).mnHeight; } dAvgChildHeight /= listMergeVCutChildren.get(idx - 1).mlistChildren.size(); if (dAvgChildHeight * ConstantsMgr.msdLUNoteHeightRatio2Base >= ser.mnHeight) { StructExprRecog serHCutChild = listMergeVCutChildren.get(idx - 1).mlistChildren.get(nMinDistanceIdx); int thisHCutChildCharLevel = bluCI.calcCharLevel(serHCutChild); if (thisHCutChildCharLevel == 0) { // this char level is calculated from its closest last ser if it is base. BLUCharIdentifier bluCIThisHCutChild = new BLUCharIdentifier(serHCutChild); thisCharLevel = bluCIThisHCutChild.calcCharLevel(ser); } else { thisCharLevel = thisHCutChildCharLevel; // this char level is same as its closest last ser if it is not base. } } } } listCharLevel.add(thisCharLevel); } // from highest char to left bluCI = bluCIBiggest.clone(); for (int idx = nBiggestChildIdx - 1; idx >= 0; idx --) { StructExprRecog ser = listMergeVCutChildren.get(idx); if ((bHasNonHDivBaseChild && listCharLevel.size() > 0 && listCharLevel.getFirst() == 0 && !isHDivCannotBeBaseAnchorSER(listMergeVCutChildren.get(idx + 1))) || (!bHasNonHDivBaseChild && listCharLevel.size() > 0 && listCharLevel.getFirst() == 0)) { StructExprRecog serBase = listMergeVCutChildren.get(idx + 1); bluCI.setBLUCharIdentifier(serBase); list1SideAnchorBaseIdx.addFirst(idx + 1); } else { list1SideAnchorBaseIdx.addFirst(list1SideAnchorBaseIdx.getFirst()); } int thisCharLevel = bluCI.calcCharLevel(ser); // 0 means base char, 1 means upper note, -1 means lower note listCharLevel.addFirst(thisCharLevel); } // from left to highest char bluCI = bluCIBiggest.clone(); nLastBaseHeight = 0;// to avoid the first char misrecognized to note instead of base, // do not use listMergeVCutChildren.get(nBiggestChildIdx).mnHeight; // however, from right to left identification can still misrecognize it to note // so we need further check later on. for (int idx = 1; idx < nBiggestChildIdx; idx ++) { StructExprRecog ser = listMergeVCutChildren.get(idx); if ((bHasNonHDivBaseChild && listCharLevel.get(idx - 1) == 0 && !isHDivCannotBeBaseAnchorSER(listMergeVCutChildren.get(idx - 1))) || (!bHasNonHDivBaseChild && listCharLevel.get(idx - 1) == 0)) { // base char StructExprRecog serBase = listMergeVCutChildren.get(idx - 1); bluCI.setBLUCharIdentifier(serBase); nLastBaseHeight = listMergeVCutChildren.get(idx - 1).mnHeight; } int thisCharLevel = bluCI.calcCharLevel(ser); // 0 means base char, 1 means upper note, -1 means lower note // only from left to right we do the following work. if (thisCharLevel == 0 && idx > 0 && (listCharLevel.get(idx - 1) != 0 || (listMergeVCutChildren.get(idx - 1).mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_HBLANKCUT && listMergeVCutChildren.get(idx - 1).mlistChildren.size() > 1)) && nLastBaseHeight * ConstantsMgr.msdLUNoteHeightRatio2Base * ConstantsMgr.msdLUNoteHeightRatio2Base >= ser.mnHeight) { // to see if it could be upper lower note or lower upper note. if (listCharLevel.get(idx - 1) == 1 && ser.getBottom() <= bluCI.mdUpperNoteLBoundThresh) { thisCharLevel = 1; } else if (listCharLevel.get(idx - 1) == -1 && ser.mnTop >= bluCI.mdLowerNoteUBoundThresh) { thisCharLevel = -1; } else if (listMergeVCutChildren.get(idx - 1).mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_HBLANKCUT && listMergeVCutChildren.get(idx - 1).mlistChildren.size() > 1) { // hblankcut type. // first of all, find out which h-blank-div child is closest to it. int nMinDistance = Integer.MAX_VALUE; int nMinDistanceIdx = 0; for (int idx2 = 0; idx2 < listMergeVCutChildren.get(idx - 1).mlistChildren.size(); idx2 ++) { int nDistance = Math.abs(ser.mnTop + ser.getBottomPlus1() - listMergeVCutChildren.get(idx - 1).mlistChildren.get(idx2).mnTop - listMergeVCutChildren.get(idx - 1).mlistChildren.get(idx2).getBottomPlus1()); if (nDistance <= nMinDistance) { // allow a little bit overhead nMinDistance = nDistance; nMinDistanceIdx = idx2; } } StructExprRecog serHCutChild = listMergeVCutChildren.get(idx - 1).mlistChildren.get(nMinDistanceIdx); int thisHCutChildCharLevel = bluCI.calcCharLevel(serHCutChild); if (thisHCutChildCharLevel == 0) { // this char level is calculated from its closest last ser if it is base. BLUCharIdentifier bluCIThisHCutChild = new BLUCharIdentifier(serHCutChild); thisCharLevel = bluCIThisHCutChild.calcCharLevel(ser); } else { thisCharLevel = thisHCutChildCharLevel; // this char level is same as its closest last ser if it is not base. } } } int nLastSideAnchorBaseType = listMergeVCutChildren.get(list1SideAnchorBaseIdx.get(idx)).mnExprRecogType; int nThisSideAnchorBaseType = bluCI.mserBase.mnExprRecogType; if (listCharLevel.get(idx) != thisCharLevel) { if ((nLastSideAnchorBaseType == EXPRRECOGTYPE_HCUTCAP || nLastSideAnchorBaseType == EXPRRECOGTYPE_HCUTUNDER || nLastSideAnchorBaseType == EXPRRECOGTYPE_HCUTCAPUNDER) && (nThisSideAnchorBaseType != EXPRRECOGTYPE_HCUTCAP && nThisSideAnchorBaseType != EXPRRECOGTYPE_HCUTUNDER && nThisSideAnchorBaseType != EXPRRECOGTYPE_HCUTCAPUNDER)) { // h-cut is always not accurate listCharLevel.set(idx, thisCharLevel); } else if ((nThisSideAnchorBaseType == EXPRRECOGTYPE_HCUTCAP || nThisSideAnchorBaseType == EXPRRECOGTYPE_HCUTUNDER || nThisSideAnchorBaseType == EXPRRECOGTYPE_HCUTCAPUNDER) && (nLastSideAnchorBaseType != EXPRRECOGTYPE_HCUTCAP && nLastSideAnchorBaseType != EXPRRECOGTYPE_HCUTUNDER && nLastSideAnchorBaseType != EXPRRECOGTYPE_HCUTCAPUNDER)) { // do not change. } else if (listCharLevel.get(idx) == 0) { // if from one side this char is not base char, then it is not base char listCharLevel.set(idx, thisCharLevel); } else if (thisCharLevel != 0) { // if one side is 1 while the other side is - 1, then use left side value listCharLevel.set(idx, thisCharLevel); } else if (listCharLevel.get(idx) != 0 && list1SideAnchorBaseIdx.get(idx) > idx + 1) { // if see from right this ser is a note and right anchor is not next to this ser, we use left side value. listCharLevel.set(idx, thisCharLevel); } } } // from right to highest char seems not necessary. boolean bNeedReidentifyFirst = false; // now the first child may be misrecognized to be -1 or 1, correct it and reidentify char level from 0 to the original first base if (listCharLevel.getFirst() == -1 && (listMergeVCutChildren.size() < 2 // only have one child, so it has to be base || listMergeVCutChildren.getFirst().mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_ENUMTYPE // could be base of base**something || ((listMergeVCutChildren.getFirst().isLetterChar() || listMergeVCutChildren.getFirst().isNumberChar()) && listMergeVCutChildren.get(1).mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_HCUTCAPUNDER && listMergeVCutChildren.get(1).mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_HCUTUNDER))) { // could be base of base ** something listCharLevel.set(0, 0); bNeedReidentifyFirst = true; } else if (listCharLevel.getFirst() == 1) { boolean bIsRoot = true, bIsTemperature = true; int idx = 1; for (; idx < listCharLevel.size(); idx ++) { if (listCharLevel.get(idx) != 1) { break; } } if (idx == listCharLevel.size() || listCharLevel.get(idx) != 0 || listMergeVCutChildren.get(idx).mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_GETROOT) { bIsRoot = false; } if (listMergeVCutChildren.size() < 2 || listMergeVCutChildren.getFirst().mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_ENUMTYPE || (listMergeVCutChildren.getFirst().mType != UnitProtoType.Type.TYPE_SMALL_O && listMergeVCutChildren.getFirst().mType != UnitProtoType.Type.TYPE_BIG_O && listMergeVCutChildren.getFirst().mType != UnitProtoType.Type.TYPE_ZERO) || listMergeVCutChildren.get(1).mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_ENUMTYPE || (listMergeVCutChildren.get(1).mType != UnitProtoType.Type.TYPE_SMALL_C && listMergeVCutChildren.get(1).mType != UnitProtoType.Type.TYPE_BIG_C && listMergeVCutChildren.get(1).mType != UnitProtoType.Type.TYPE_BIG_F)) { bIsTemperature = false; } if (!bIsRoot && !bIsTemperature // if root or temperature, then it should be upper note && (listMergeVCutChildren.size() < 2 // only have one child, so it has to be base || (listMergeVCutChildren.getFirst().mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_ENUMTYPE && listMergeVCutChildren.getFirst().isLetterChar() && listMergeVCutChildren.get(1).mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_HCUTCAP && listMergeVCutChildren.get(1).mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_HCUTCAPUNDER) // could be base_something )) { listCharLevel.set(0, 0); bNeedReidentifyFirst = true; } } if (bNeedReidentifyFirst) { int idx = 1; while (idx < listMergeVCutChildren.size()) { if ((listCharLevel.get(idx - 1) == 0 && !isHDivCannotBeBaseAnchorSER(listMergeVCutChildren.get(idx - 1))) || ((idx - 1) == 0)) { // base char can be anchor or first ser StructExprRecog serBase = listMergeVCutChildren.get(idx - 1); bluCI.setBLUCharIdentifier(serBase); nLastBaseHeight = listMergeVCutChildren.get(idx - 1).mnHeight; } StructExprRecog ser = listMergeVCutChildren.get(idx); int thisCharLevel = bluCI.calcCharLevel(ser); // 0 means base char, 1 means upper note, -1 means lower note // only from left to right we do the following work. if (thisCharLevel == 0 && idx > 0 && (listCharLevel.get(idx - 1) != 0 || (listMergeVCutChildren.get(idx - 1).mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_HBLANKCUT && listMergeVCutChildren.get(idx - 1).mlistChildren.size() > 1)) && nLastBaseHeight * ConstantsMgr.msdLUNoteHeightRatio2Base * ConstantsMgr.msdLUNoteHeightRatio2Base >= ser.mnHeight) { // to see if it could be upper lower note or lower upper note. if (listCharLevel.get(idx - 1) == 1 && ser.getBottom() <= bluCI.mdUpperNoteLBoundThresh) { thisCharLevel = 1; } else if (listCharLevel.get(idx - 1) == -1 && ser.mnTop >= bluCI.mdLowerNoteUBoundThresh) { thisCharLevel = -1; } else if (listMergeVCutChildren.get(idx - 1).mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_HBLANKCUT && listMergeVCutChildren.get(idx - 1).mlistChildren.size() > 1) { // hblankcut type. // first of all, find out which h-blank-div child is closest to it. int nMinDistance = Integer.MAX_VALUE; int nMinDistanceIdx = 0; for (int idx2 = 0; idx2 < listMergeVCutChildren.get(idx - 1).mlistChildren.size(); idx2 ++) { int nDistance = Math.abs(ser.mnTop + ser.getBottomPlus1() - listMergeVCutChildren.get(idx - 1).mlistChildren.get(idx2).mnTop - listMergeVCutChildren.get(idx - 1).mlistChildren.get(idx2).getBottomPlus1()); if (nDistance <= nMinDistance) { // allow a little bit overhead nMinDistance = nDistance; nMinDistanceIdx = idx2; } } StructExprRecog serHCutChild = listMergeVCutChildren.get(idx - 1).mlistChildren.get(nMinDistanceIdx); int thisHCutChildCharLevel = bluCI.calcCharLevel(serHCutChild); if (thisHCutChildCharLevel == 0) { // this char level is calculated from its closest last ser if it is base. BLUCharIdentifier bluCIThisHCutChild = new BLUCharIdentifier(serHCutChild); thisCharLevel = bluCIThisHCutChild.calcCharLevel(ser); } else { thisCharLevel = thisHCutChildCharLevel; // this char level is same as its closest last ser if it is not base. } } } if (listCharLevel.get(idx) != thisCharLevel) { // do not consider the impact seen from the other side, even the other side is root or Fahranheit or celcius // this is because if the other side is root or Fahrenheit or celcius, if this level is -1, then it is -1 // anyway, if it is 0, because the left most should not be 1 seen from the other side, so doesn't matter // if it is 1, then Fahranheit and celcius and root can handle. listCharLevel.set(idx, thisCharLevel); } else if (thisCharLevel == 0) { break; // this char level is base and is the same as before adjusting, so no need to go futher. } idx ++; } // need not to go through from right to left again. } // step 3. idenitify the mode: matrix mode, multi-expr mode or normal mode LinkedList<StructExprRecog> listMergeMatrixMExprs = new LinkedList<StructExprRecog>(); LinkedList<Integer> listMergeMMLevel = new LinkedList<Integer>(); for (int idx = 0; idx < listMergeVCutChildren.size(); idx ++) { if (listCharLevel.get(idx) == 0) { //restruct hdivs first, change like hcap(cap, hblank) to hblank(hcap, ...). // otherwise, multi expressions can not be correctly identified. StructExprRecog serPreRestructedHCut = preRestructHDivSer4MatrixMExprs(listMergeVCutChildren.get(idx)); if (serPreRestructedHCut != listMergeVCutChildren.get(idx)) { listMergeVCutChildren.set(idx, serPreRestructedHCut); } } } lookForMatrixMExprs(listMergeVCutChildren, listCharLevel, listMergeMatrixMExprs, listMergeMMLevel); // step 4: identify upper notes or lower notes. LinkedList<StructExprRecog> listBaseULIdentified = new LinkedList<StructExprRecog>(); listCharLevel.clear(); int idx0 = 0; // step 1: find the first real base ser, real base means a base ser which would be better if it is not hblankcut for (; idx0 < listMergeMatrixMExprs.size(); idx0 ++) { if (listMergeMMLevel.get(idx0) == 0 && listMergeMatrixMExprs.get(idx0).mnExprRecogType != StructExprRecog.EXPRRECOGTYPE_HBLANKCUT) { break; } } if (idx0 == listMergeMatrixMExprs.size()) { // no non-hblankcut base, so find hblankcut base instead. for (idx0 = 0; idx0 < listMergeMatrixMExprs.size(); idx0 ++) { if (listMergeMMLevel.get(idx0) == 0) { break; } } } // there should be a base, so we need not to worry about idx0 == listMergeMatrixMExprs.size() int nIdxFirstBaseChar = idx0; for (idx0 = 0; idx0 <= nIdxFirstBaseChar; idx0 ++) { listBaseULIdentified.add(listMergeMatrixMExprs.get(idx0)); listCharLevel.add(listMergeMMLevel.get(idx0)); } for (; idx0 < listMergeMatrixMExprs.size(); idx0 ++) { StructExprRecog ser = listMergeMatrixMExprs.get(idx0); if (idx0 > 0 && listCharLevel.getLast() == 0) { StructExprRecog serBase = listBaseULIdentified.getLast(); bluCI.setBLUCharIdentifier(serBase); } if (ser.mnExprRecogType == EXPRRECOGTYPE_HBLANKCUT) { ser = ser.identifyHSeperatedChar(); // find out if they are special char or not. have to do it here before child restruct coz if it is =, its position may change later. } if (ser.mnExprRecogType == EXPRRECOGTYPE_HBLANKCUT) { StructExprRecog[] serarrayNoLnDe = new StructExprRecog[3]; boolean bIsDivide = isActuallyHLnDivSER(ser, serarrayNoLnDe); //need to do it here as well as in h-cut restruct because h-cut restruct may for independent h-cut ser so never come here. if (bIsDivide) { LinkedList<StructExprRecog> listCuts = new LinkedList<StructExprRecog>(); listCuts.add(serarrayNoLnDe[0].restruct()); listCuts.add(serarrayNoLnDe[1].restruct()); listCuts.add(serarrayNoLnDe[2].restruct()); ser.setStructExprRecog(listCuts, EXPRRECOGTYPE_HLINECUT); } } if (ser.mnExprRecogType == EXPRRECOGTYPE_HBLANKCUT) { // special treatment for hblankcut LinkedList<StructExprRecog> listSerTopParts = new LinkedList<StructExprRecog>(); LinkedList<StructExprRecog> listSerBaseParts = new LinkedList<StructExprRecog>(); LinkedList<StructExprRecog> listSerBottomParts = new LinkedList<StructExprRecog>(); for (int idx1 = 0; idx1 < ser.mlistChildren.size(); idx1 ++) { StructExprRecog serChild = ser.mlistChildren.get(idx1); if (bluCI.isUpperNote(serChild)) { listSerTopParts.add(serChild); } else if (bluCI.isLowerNote(serChild)) { listSerBottomParts.add(serChild); } else { listSerBaseParts.add(serChild); } } // add the parts into base-upper-lower list following the order bottom->top->base. if (listSerBottomParts.size() > 0) { StructExprRecog serChildBottomPart = new StructExprRecog(ser.getBiArray()); if (listSerBottomParts.size() == 1) { serChildBottomPart = listSerBottomParts.getFirst(); } else { serChildBottomPart.setStructExprRecog(listSerBottomParts, EXPRRECOGTYPE_HBLANKCUT); } listBaseULIdentified.add(serChildBottomPart); listCharLevel.add(-1); } if (listSerTopParts.size() > 0) { StructExprRecog serChildTopPart = new StructExprRecog(ser.getBiArray()); if (listSerTopParts.size() == 1) { serChildTopPart = listSerTopParts.getFirst(); } else { serChildTopPart.setStructExprRecog(listSerTopParts, EXPRRECOGTYPE_HBLANKCUT); } listBaseULIdentified.add(serChildTopPart); listCharLevel.add(1); } if (listSerBaseParts.size() > 0) { StructExprRecog serChildBasePart = new StructExprRecog(ser.getBiArray()); if (listSerBaseParts.size() == 1) { serChildBasePart = listSerBaseParts.getFirst(); } else { serChildBasePart.setStructExprRecog(listSerBaseParts, EXPRRECOGTYPE_HBLANKCUT); } listBaseULIdentified.add(serChildBasePart); listCharLevel.add(0); } } else { listBaseULIdentified.add(ser); listCharLevel.add(listMergeMMLevel.get(idx0)); } } // step 4.1 special treatment for upper or lower note divided characters like j, i is different coz very unlikely i's dot will be looked like a independent upper note. for (int idx = 0; idx < listBaseULIdentified.size(); idx ++) { if (listCharLevel.get(idx) != 0 || listBaseULIdentified.get(idx).mnExprRecogType != EXPRRECOGTYPE_ENUMTYPE) { continue; // need to find base and the base has to be a single char. } StructExprRecog serBase = listBaseULIdentified.get(idx); if (idx < listBaseULIdentified.size() - 2 && listCharLevel.get(idx + 1) == -1 && listCharLevel.get(idx + 2) == 0 && serBase.isPossibleNumberChar() && listBaseULIdentified.get(idx + 2).isPossibleNumberChar()) { // left and right are both number char, middle is a lower note StructExprRecog serPossibleDot = listBaseULIdentified.get(idx + 1); StructExprRecog serNextBase = listBaseULIdentified.get(idx + 2); double dWOverHThresh = ConstantsMgr.msdExtendableCharWOverHThresh / ConstantsMgr.msdCharWOverHMaxSkewRatio; if (serPossibleDot.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && serBase.mnHeight > ConstantsMgr.msdNeighborHeight2PossDotHeight * serPossibleDot.mnHeight && serNextBase.mnHeight > ConstantsMgr.msdNeighborHeight2PossDotHeight * serPossibleDot.mnHeight && serBase.mnHeight > ConstantsMgr.msdNeighborHeight2PossDotWidth * serPossibleDot.mnWidth && serNextBase.mnHeight > ConstantsMgr.msdNeighborHeight2PossDotWidth * serPossibleDot.mnWidth && serPossibleDot.mnWidth < dWOverHThresh * serPossibleDot.mnHeight && serPossibleDot.mnHeight < dWOverHThresh * serPossibleDot.mnWidth) { // serPossibleDot is a dot serPossibleDot.mType = UnitProtoType.Type.TYPE_DOT; } } if (serBase.mType == UnitProtoType.Type.TYPE_CLOSE_ROUND_BRACKET || serBase.mType == UnitProtoType.Type.TYPE_CLOSE_SQUARE_BRACKET || serBase.mType == UnitProtoType.Type.TYPE_BIG_J || serBase.mType == UnitProtoType.Type.TYPE_CLOSE_BRACE || serBase.mType == UnitProtoType.Type.TYPE_INTEGRATE || serBase.mType == UnitProtoType.Type.TYPE_SMALL_J_WITHOUT_DOT) { int idx1 = idx + 1; for (; idx1 < listBaseULIdentified.size(); idx1 ++) { if (listCharLevel.get(idx1) == 1) { break; // find the first upper note } } if (idx1 < listBaseULIdentified.size() && listBaseULIdentified.get(idx1).mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (listBaseULIdentified.get(idx1).mType == UnitProtoType.Type.TYPE_DOT // at this moment there is no dot multiply. || listBaseULIdentified.get(idx1).mType == UnitProtoType.Type.TYPE_STAR) && (listBaseULIdentified.get(idx1).mnLeft - serBase.getRightPlus1()) < serBase.mnWidth * ConstantsMgr.msdSmallJDotVPlaceThresh // the left-right gap between dot and j main body has to be very small && (serBase.mnTop - listBaseULIdentified.get(idx1).getBottomPlus1()) < serBase.mnHeight * ConstantsMgr.msdSmallJDotHPlaceThresh // the top-bottom gap between dot and j main body has to be very small && serBase.mnTop > listBaseULIdentified.get(idx1).getBottomPlus1()) { // main body must be low the dot StructExprRecog serSmallj = new StructExprRecog(serBase.mbarrayBiValues); int nLeft = Math.min(serBase.mnLeft, listBaseULIdentified.get(idx1).mnLeft); int nTop = Math.min(serBase.mnTop, listBaseULIdentified.get(idx1).mnTop); int nRightPlus1 = Math.max(serBase.getRightPlus1(), listBaseULIdentified.get(idx1).getRightPlus1()); int nBottomPlus1 = Math.max(serBase.getBottomPlus1(), listBaseULIdentified.get(idx1).getBottomPlus1()); int nTotalArea = serBase.getArea() + listBaseULIdentified.get(idx1).getArea(); double dSimilarity = (serBase.getArea() * serBase.mdSimilarity + listBaseULIdentified.get(idx1).getArea() * listBaseULIdentified.get(idx1).mdSimilarity)/nTotalArea; // total area should not be zero here. // now we merge the two into small j and replace the seperated two sers with small j LinkedList<ImageChop> listParts = new LinkedList<ImageChop>(); ImageChop imgChopTop = listBaseULIdentified.get(idx1).getImageChop(false); listParts.add(imgChopTop); ImageChop imgChopBase = serBase.getImageChop(false); listParts.add(imgChopBase); ImageChop imgChop4SER = ExprSeperator.mergeImgChopsWithSameOriginal(listParts); // need not to shrink imgChop4SER because it has been min container. serSmallj.setStructExprRecog(UnitProtoType.Type.TYPE_SMALL_J, UNKNOWN_FONT_TYPE, nLeft, nTop, nRightPlus1 - nLeft, nBottomPlus1 - nTop, imgChop4SER, dSimilarity); listBaseULIdentified.remove(idx1); // remove idx1 first because idx1 is after idx. Otherwise, will remove a wrong child. listBaseULIdentified.remove(idx); listCharLevel.remove(idx1); // remove idx1 first because idx1 is after idx. Otherwise, will remove a wrong child. listCharLevel.remove(idx); listBaseULIdentified.add(idx, serSmallj); listCharLevel.add(idx, 0); } } } // step 4.2, identify cap under // now we need to handle the cap and/or under notes for \Sigma, \Pi and \Integrate // this is for the case that \topunder{infinite, \Sigma, n = 1} is misrecognized to // \topunder{infinite, \Sigma, n^=}_1, or \topunder{1+2+3+4, \integrate, 5+6+7+8+9} // is misrecognized to 1 + 5 ++26 \topunder(+3, \integrate, +} + 7+8++4+9. LinkedList<StructExprRecog> listCUIdentifiedBLU = new LinkedList<StructExprRecog>(); LinkedList<Integer> listCUIdentifiedCharLvl = new LinkedList<Integer>(); int nLastCUBaseAreaIdx = -1; for (int idx = 0; idx < listBaseULIdentified.size(); idx ++) { StructExprRecog serBase = listBaseULIdentified.get(idx).getPrincipleSER(1); if ((listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_HCUTCAPUNDER || listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_HCUTCAP || listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_HCUTUNDER) && listCharLevel.get(idx) == 0 && serBase.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (serBase.mType == UnitProtoType.Type.TYPE_INTEGRATE || serBase.mType == UnitProtoType.Type.TYPE_BIG_SIGMA || serBase.mType == UnitProtoType.Type.TYPE_BIG_PI) && idx < listBaseULIdentified.size() - 1) { StructExprRecog serCap = (listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_HCUTUNDER)? null:listBaseULIdentified.get(idx).mlistChildren.getFirst(); int nWholeCapTop = (serCap==null)?0:serCap.mnTop; int nWholeCapBottomP1 = (serCap==null)?0:serCap.getBottomPlus1(); StructExprRecog serUnder = (listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_HCUTCAP)? null:listBaseULIdentified.get(idx).mlistChildren.getLast(); int nWholeUnderTop = (serUnder==null)?0:serUnder.mnTop; int nWholeUnderBottomP1 = (serUnder==null)?0:serUnder.getBottomPlus1(); LinkedList<StructExprRecog> listIdentifiedCap = new LinkedList<StructExprRecog>(); if (serCap != null) { listIdentifiedCap.add(serCap); } LinkedList<StructExprRecog> listIdentifiedUnder = new LinkedList<StructExprRecog>(); if (serUnder != null) { listIdentifiedUnder.add(serUnder); } int idx1 = idx - 1; // now go through its left side for (; idx1 > nLastCUBaseAreaIdx; idx1 --) { StructExprRecog serThis = listBaseULIdentified.get(idx1); if (listCharLevel.get(idx1) == 1 && listBaseULIdentified.get(idx).mnExprRecogType != EXPRRECOGTYPE_HCUTUNDER // this character is a top level char and we have cap note && (serCap.mnLeft - serThis.getRightPlus1()) <= Math.max(serCap.mnHeight, serThis.mnHeight) * ConstantsMgr.msdMaxCharGapWidthOverHeight //gap is less enough && serBase.mnTop >= serThis.getBottomPlus1() // Base is below this which means this is a cap. && (Math.max(serThis.getBottomPlus1(), nWholeCapBottomP1) - Math.min(serThis.mnTop, nWholeCapTop)) <= serBase.mnHeight * ConstantsMgr.msdCapUnderHeightRatio2Base // cap under height as a whole should not be too large /*&& serThis.getBottomPlus1() < serCap.mnTop && serThis.mnTop > serCap.getBottomPlus1()*/) { //there is not necessarily some vertical overlap, consider 2**3 - 4, 3 and - may not have overlap. listIdentifiedCap.addFirst(serThis); serCap = serThis; nWholeCapTop = Math.min(serThis.mnTop, nWholeCapTop); nWholeCapBottomP1 = Math.max(serThis.getBottomPlus1(), nWholeCapBottomP1); } else if (listCharLevel.get(idx1) == -1 && listBaseULIdentified.get(idx).mnExprRecogType != EXPRRECOGTYPE_HCUTCAP // this character is a bottom level char and we have under && (serUnder.mnLeft - serThis.getRightPlus1()) <= Math.max(serUnder.mnHeight, serThis.mnHeight) * ConstantsMgr.msdMaxCharGapWidthOverHeight //gap is less enough && serBase.getBottomPlus1() <= serThis.mnTop // Base is above this which means this is a under && (Math.max(serThis.getBottomPlus1(), nWholeUnderBottomP1) - Math.min(serThis.mnTop, nWholeUnderTop)) <= serBase.mnHeight * ConstantsMgr.msdCapUnderHeightRatio2Base // cap under height as a whole should not be too large /*&& serThis.getBottomPlus1() < serUnder.mnTop && serThis.mnTop > serUnder.getBottomPlus1()*/) { //there is not necessarily some vertical overlap, consider 2**3 - 4, 3 and - may not have overlap. listIdentifiedUnder.addFirst(serThis); serUnder = serThis; nWholeUnderTop = Math.min(serThis.mnTop, nWholeUnderTop); nWholeUnderBottomP1 = Math.max(serThis.getBottomPlus1(), nWholeUnderBottomP1); } else { break; // ok, we arrive at the left edge of this CUBase Area, exit. } } for (int idx2 = nLastCUBaseAreaIdx + 1; idx2 <= idx1; idx2 ++) { // so, now add the chars which are not belong to this cap under area. listCUIdentifiedBLU.add(listBaseULIdentified.get(idx2)); listCUIdentifiedCharLvl.add(listCharLevel.get(idx2)); } nLastCUBaseAreaIdx = idx; // now go through its right side serCap = (listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_HCUTUNDER)? null:listBaseULIdentified.get(idx).mlistChildren.getFirst(); serUnder = (listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_HCUTCAP)? null:listBaseULIdentified.get(idx).mlistChildren.getLast(); idx1 = idx + 1; for (; idx1 < listBaseULIdentified.size(); idx1 ++) { StructExprRecog serThis = listBaseULIdentified.get(idx1); if (listCharLevel.get(idx1) == 1 && listBaseULIdentified.get(idx).mnExprRecogType != EXPRRECOGTYPE_HCUTUNDER // this character is a top level char and we have cap note && (serThis.mnLeft - serCap.getRightPlus1()) <= Math.max(serCap.mnHeight, serThis.mnHeight) * ConstantsMgr.msdMaxCharGapWidthOverHeight //gap is less enough && serBase.mnTop >= serThis.getBottomPlus1() // Base is below this which means this is a cap. && (Math.max(serThis.getBottomPlus1(), nWholeCapBottomP1) - Math.min(serThis.mnTop, nWholeCapTop)) <= serBase.mnHeight * ConstantsMgr.msdCapUnderHeightRatio2Base // cap under height as a whole should not be too large /*&& serThis.getBottomPlus1() < serCap.mnTop && serThis.mnTop > serCap.getBottomPlus1()*/) { //there is not necessarily some vertical overlap, consider 2**3 - 4, 3 and - may not have overlap. nLastCUBaseAreaIdx = idx1; listIdentifiedCap.add(serThis); serCap = serThis; nWholeCapTop = Math.min(serThis.mnTop, nWholeCapTop); nWholeCapBottomP1 = Math.max(serThis.getBottomPlus1(), nWholeCapBottomP1); } else if (listCharLevel.get(idx1) == -1 && listBaseULIdentified.get(idx).mnExprRecogType != EXPRRECOGTYPE_HCUTCAP // this character is a bottom level char and we have under note && (serThis.mnLeft - serUnder.getRightPlus1()) <= Math.max(serUnder.mnHeight, serThis.mnHeight) * ConstantsMgr.msdMaxCharGapWidthOverHeight //gap is less enough && serBase.getBottomPlus1() <= serThis.mnTop // Base is above this which means this is a under && (Math.max(serThis.getBottomPlus1(), nWholeUnderBottomP1) - Math.min(serThis.mnTop, nWholeUnderTop)) <= serBase.mnHeight * ConstantsMgr.msdCapUnderHeightRatio2Base // cap under height as a whole should not be too large /*&& serThis.getBottomPlus1() < serUnder.mnTop && serThis.mnTop > serUnder.getBottomPlus1()*/) { //there is not necessarily some vertical overlap, consider 2**3 - 4, 3 and - may not have overlap. nLastCUBaseAreaIdx = idx1; listIdentifiedUnder.add(serThis); serUnder = serThis; nWholeUnderTop = Math.min(serThis.mnTop, nWholeUnderTop); nWholeUnderBottomP1 = Math.max(serThis.getBottomPlus1(), nWholeUnderBottomP1); } else { break; // ok, we arrive at the left edge of this CUBase Area, exit. } } // ok, now we have get all the cap parts and all the under parts, // it is time for us to reconstruct this SER and add it to the new BLU list. StructExprRecog serNewCap = null, serNewUnder = null, serNew; if (listIdentifiedCap.size() == 1) { serNewCap = listIdentifiedCap.getFirst(); } else if (listIdentifiedCap.size() > 1) { // size > 1 serNewCap = new StructExprRecog(serBase.mbarrayBiValues); serNewCap.setStructExprRecog(listIdentifiedCap, EXPRRECOGTYPE_VBLANKCUT); } if (listIdentifiedUnder.size() == 1) { serNewUnder = listIdentifiedUnder.getFirst(); } else if (listIdentifiedUnder.size() > 1) { // size > 1 serNewUnder = new StructExprRecog(serBase.mbarrayBiValues); serNewUnder.setStructExprRecog(listIdentifiedUnder, EXPRRECOGTYPE_VBLANKCUT); } LinkedList<StructExprRecog> listThisAllChildren = new LinkedList<StructExprRecog>(); int nExprRecogType = EXPRRECOGTYPE_HCUTCAPUNDER; if (serNewCap != null) { listThisAllChildren.add(serNewCap); } else { nExprRecogType = EXPRRECOGTYPE_HCUTUNDER; } listThisAllChildren.add(serBase); if (serNewUnder != null) { listThisAllChildren.add(serNewUnder); } else { nExprRecogType = EXPRRECOGTYPE_HCUTCAP; } serNew = new StructExprRecog(serBase.mbarrayBiValues); serNew.setStructExprRecog(listThisAllChildren, nExprRecogType); listCUIdentifiedBLU.add(serNew); listCUIdentifiedCharLvl.add(0); // done! Now go to the next SER in listBaseULIdentified. idx = nLastCUBaseAreaIdx; } } // now we have arrive at the end of listBaseULIdentified. We need to go through from nLastCUBaseAreaIdx + 1 to here // and add the remaining parts into listCUIdentifiedBLU. for (int idx = nLastCUBaseAreaIdx + 1; idx < listBaseULIdentified.size(); idx ++) { // so, now add the chars which are not belong to this cap under area. listCUIdentifiedBLU.add(listBaseULIdentified.get(idx)); listCUIdentifiedCharLvl.add(listCharLevel.get(idx)); } // reset listBaseULIdentified and listCharLevel because they will be used latter on. listBaseULIdentified = listCUIdentifiedBLU; listCharLevel = listCUIdentifiedCharLvl; // step 4.3 : at last, trying to rectify some miss-identified char levels for (int idx = 0; idx < listBaseULIdentified.size(); idx ++) { if (listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (listBaseULIdentified.get(idx).mType == UnitProtoType.Type.TYPE_EQUAL || listBaseULIdentified.get(idx).mType == UnitProtoType.Type.TYPE_EQUAL_ALWAYS) && (idx > 0 && idx < listBaseULIdentified.size() - 1) && listCharLevel.get(idx) != 0 && ((listCharLevel.get(idx - 1) == 0 && listBaseULIdentified.get(idx).mnTop >= listBaseULIdentified.get(idx - 1).mnTop && listBaseULIdentified.get(idx).getBottomPlus1() <= listBaseULIdentified.get(idx - 1).getBottomPlus1()) || (listCharLevel.get(idx + 1) == 0 && listBaseULIdentified.get(idx).mnTop >= listBaseULIdentified.get(idx + 1).mnTop && listBaseULIdentified.get(idx).getBottomPlus1() <= listBaseULIdentified.get(idx + 1).getBottomPlus1()) ) ) { // if the character is = or always=, and its left or right char is a base char but it is not base char and this char is // in right position then change its char level to base char. listCharLevel.set(idx, 0); } if (listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && listBaseULIdentified.get(idx).mType == UnitProtoType.Type.TYPE_SUBTRACT) { // need not to convert low and small subtract to dot because we have done before. if (listCharLevel.get(idx) != 0 && (idx < listBaseULIdentified.size() - 1) && (listCharLevel.get(idx + 1) == 0) && listBaseULIdentified.get(idx).mnTop >= listBaseULIdentified.get(idx + 1).mnTop + listBaseULIdentified.get(idx + 1).mnHeight * ConstantsMgr.msdSubtractVRangeAgainstNeighbourH && listBaseULIdentified.get(idx).getBottomPlus1() <= listBaseULIdentified.get(idx + 1).getBottomPlus1() - listBaseULIdentified.get(idx + 1).mnHeight * ConstantsMgr.msdSubtractVRangeAgainstNeighbourH && (listBaseULIdentified.get(idx + 1).mnExprRecogType != EXPRRECOGTYPE_ENUMTYPE || listBaseULIdentified.get(idx).mnWidth >= listBaseULIdentified.get(idx + 1).mnWidth * ConstantsMgr.msdSubtractWidthAgainstNeighbourW)) { // if the character is -, and its right char is a base char but it is an upper or lower note char and it's in right position // and its width is long enough, then change its char level to base char. do not use calculate char level because we have got // wrong information from calculate char level. listCharLevel.set(idx, 0); } } if (listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && listBaseULIdentified.get(idx).mType == UnitProtoType.Type.TYPE_DOT) { if (((idx < listBaseULIdentified.size() - 1)?(listCharLevel.get(idx + 1) == 0):true) && ((idx > 0)?(listCharLevel.get(idx - 1) == 0):true)) { if (listCharLevel.get(idx) == -1) { // if the character is \dot, and its left and right char is a base char but it is an lower note char // then change its char level to base char. listCharLevel.set(idx, 0); } else if (listCharLevel.get(idx) == 0 && idx != 0 && idx != listBaseULIdentified.size() - 1) { // if the character is \dot, and its left and right char is a base char and itself is also a base char // then it actually means multiply. listBaseULIdentified.get(idx).mType = UnitProtoType.Type.TYPE_DOT_MULTIPLY; } } else if (listCharLevel.get(idx) == 0 && idx > 0 && idx < listBaseULIdentified.size() - 1 && listCharLevel.get(idx + 1) == 1 && listCharLevel.get(idx - 1) == 1) { // if the character is \dot, and its left and right char is a upper note char and itself is a base char // then change its char level to upper note. listCharLevel.set(idx, 1); } } if (listBaseULIdentified.get(idx).mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && listBaseULIdentified.get(idx).mType == UnitProtoType.Type.TYPE_DOT && listCharLevel.get(idx) == -1 && ((idx < listBaseULIdentified.size() - 1)?(listCharLevel.get(idx + 1) == 0):true) && ((idx > 0)?(listCharLevel.get(idx - 1) == 0):true)) { // if the character is \dot, and its left and right char is a base char but it is an lower note char // then change its char level to base char. listCharLevel.set(idx, 0); } // need not to consider a case like \topunder{infinite, \Sigma, n = 1} is misrecognized to // \topunder{infinite, \Sigma, n^=}_1. This kind of situation has been processed. } // step 5, since different levels have been well-sorted, we merge them. LinkedList<StructExprRecog> listBaseTrunk = new LinkedList<StructExprRecog>(); LinkedList<LinkedList<StructExprRecog>> listLeftTopNote = new LinkedList<LinkedList<StructExprRecog>>(); LinkedList<LinkedList<StructExprRecog>> listLeftBottomNote = new LinkedList<LinkedList<StructExprRecog>>(); LinkedList<LinkedList<StructExprRecog>> listUpperNote = new LinkedList<LinkedList<StructExprRecog>>(); LinkedList<LinkedList<StructExprRecog>> listLowerNote = new LinkedList<LinkedList<StructExprRecog>>(); int nLastBaseIdx = -1; for (int idx = 0; idx < listBaseULIdentified.size(); idx ++) { if (listCharLevel.get(idx) == 0) { listBaseTrunk.add(listBaseULIdentified.get(idx)); listLeftTopNote.add(new LinkedList<StructExprRecog>()); listLeftBottomNote.add(new LinkedList<StructExprRecog>()); listUpperNote.add(new LinkedList<StructExprRecog>()); listLowerNote.add(new LinkedList<StructExprRecog>()); int nLastBaseIdxInBaseTrunk = listBaseTrunk.size() - 2; if (nLastBaseIdx < idx - 1) { // nLastBaseIdx == idx - 1 means no notes between nLastBaseIdx and this base. // Note that even if nLastBaseIdx is -1, nLastBaseIdx == idx - 1 is still a valid adjustment. int[] narrayNoteGroup = groupNotesForPrevNextBases(listBaseULIdentified, listCharLevel, nLastBaseIdx, idx); for (int idx1 = nLastBaseIdx + 1; idx1 < idx; idx1 ++) { int nGroupIdx = idx1 - nLastBaseIdx - 1; if (listCharLevel.get(idx1) == -1) { // lower note if (narrayNoteGroup[nGroupIdx] == 0) { listLowerNote.get(nLastBaseIdxInBaseTrunk).add(listBaseULIdentified.get(idx1)); } else if (narrayNoteGroup[nGroupIdx] == 1) { listLeftBottomNote.getLast().add(listBaseULIdentified.get(idx1)); } // ignore if narrayNoteGroup[nGroupIdx] == other values } else if (listCharLevel.get(idx1) == 1) { // upper note if (narrayNoteGroup[nGroupIdx] == 0) { listUpperNote.get(nLastBaseIdxInBaseTrunk).add(listBaseULIdentified.get(idx1)); } else if (narrayNoteGroup[nGroupIdx] == 1) { listLeftTopNote.getLast().add(listBaseULIdentified.get(idx1)); } // ignore if narrayNoteGroup[nGroupIdx] == other values } // ignore if listCharLevel.get(idx1) is not -1 or 1. } } if (nLastBaseIdxInBaseTrunk > 0) { convertNotes2HCut(nLastBaseIdxInBaseTrunk, listBaseTrunk, listLeftTopNote, listLeftBottomNote, listUpperNote, listLowerNote); } nLastBaseIdx = idx; } } if (nLastBaseIdx >= 0) { int nLastBaseIdxInBaseTrunk = listBaseTrunk.size() - 1; for (int idx1 = nLastBaseIdx + 1; idx1 < listBaseULIdentified.size(); idx1 ++) { if (listCharLevel.get(idx1) == -1) { listLowerNote.get(nLastBaseIdxInBaseTrunk).add(listBaseULIdentified.get(idx1)); } else { // idx1 is not nLastBaseIdx, so that it must be either 1 or -1. listUpperNote.get(nLastBaseIdxInBaseTrunk).add(listBaseULIdentified.get(idx1)); } } convertNotes2HCut(nLastBaseIdxInBaseTrunk, listBaseTrunk, listLeftTopNote, listLeftBottomNote, listUpperNote, listLowerNote); } // step 6, create a list of merged and reconstructed children. LinkedList<StructExprRecog> listProcessed = new LinkedList<StructExprRecog>(); for (int idx = 0; idx < listBaseTrunk.size(); idx ++) { StructExprRecog serThis = listBaseTrunk.get(idx); serThis = serThis.restruct(); if (listLeftTopNote.get(idx).size() > 0) { StructExprRecog serLeftTopNote = new StructExprRecog(mbarrayBiValues); if (listLeftTopNote.get(idx).size() > 1) { serLeftTopNote.setStructExprRecog(listLeftTopNote.get(idx), EXPRRECOGTYPE_VBLANKCUT); } else { serLeftTopNote = listLeftTopNote.get(idx).getFirst(); } serLeftTopNote = serLeftTopNote.restruct(); LinkedList<StructExprRecog> listWithLeftTopNote = new LinkedList<StructExprRecog>(); listWithLeftTopNote.add(serLeftTopNote); listWithLeftTopNote.add(serThis); serThis = new StructExprRecog(mbarrayBiValues); serThis.setStructExprRecog(listWithLeftTopNote, EXPRRECOGTYPE_VCUTLEFTTOPNOTE); if (serThis.mlistChildren.getLast().mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && serThis.mlistChildren.getFirst().mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_ZERO || serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_SMALL_O || serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_BIG_O) ) { if (serThis.mlistChildren.getLast().mType == UnitProtoType.Type.TYPE_SMALL_C || serThis.mlistChildren.getLast().mType == UnitProtoType.Type.TYPE_BIG_C) { // need not to reset left top width and height because they have been set. // similarly, need not to reset similarity. LinkedList<ImageChop> listParts = new LinkedList<ImageChop>(); ImageChop imgChopLeftTop = serThis.mlistChildren.getFirst().getImageChop(false); listParts.add(imgChopLeftTop); ImageChop imgChopBase = serThis.mlistChildren.getLast().getImageChop(false); listParts.add(imgChopBase); ImageChop imgChop4SER = ExprSeperator.mergeImgChopsWithSameOriginal(listParts); // need not to shrink imgChop4SER because it has been min container. serThis.setStructExprRecog(UnitProtoType.Type.TYPE_CELCIUS, UNKNOWN_FONT_TYPE, imgChop4SER); } else if (serThis.mlistChildren.getLast().mType == UnitProtoType.Type.TYPE_BIG_F) { // need not to reset left top width and height because they have been set. // similarly, need not to reset similarity. LinkedList<ImageChop> listParts = new LinkedList<ImageChop>(); ImageChop imgChopLeftTop = serThis.mlistChildren.getFirst().getImageChop(false); listParts.add(imgChopLeftTop); ImageChop imgChopBase = serThis.mlistChildren.getLast().getImageChop(false); listParts.add(imgChopBase); ImageChop imgChop4SER = ExprSeperator.mergeImgChopsWithSameOriginal(listParts); // need not to shrink imgChop4SER because it has been min container. serThis.setStructExprRecog(UnitProtoType.Type.TYPE_FAHRENHEIT, UNKNOWN_FONT_TYPE, imgChop4SER); } else if ((serThis.mlistChildren.getLast().mType == UnitProtoType.Type.TYPE_ONE || serThis.mlistChildren.getLast().mType == UnitProtoType.Type.TYPE_FORWARD_SLASH || serThis.mlistChildren.getLast().mType == UnitProtoType.Type.TYPE_SMALL_L) && listLowerNote.get(idx).size() >= 1 && listLowerNote.get(idx).getFirst().mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (listLowerNote.get(idx).getFirst().mType == UnitProtoType.Type.TYPE_ZERO || listLowerNote.get(idx).getFirst().mType == UnitProtoType.Type.TYPE_SMALL_O || listLowerNote.get(idx).getFirst().mType == UnitProtoType.Type.TYPE_BIG_O) ) { LinkedList<ImageChop> listParts = new LinkedList<ImageChop>(); ImageChop imgChopLeftTop = serThis.mlistChildren.getFirst().getImageChop(false); listParts.add(imgChopLeftTop); ImageChop imgChopBase = serThis.mlistChildren.getLast().getImageChop(false); listParts.add(imgChopBase); ImageChop imgChopLowerNote = listLowerNote.get(idx).getFirst().getImageChop(false); listParts.add(imgChopLowerNote); ImageChop imgChop4SER = ExprSeperator.mergeImgChopsWithSameOriginal(listParts); // need not to shrink imgChop4SER because it has been min container. serThis.setStructExprRecog(UnitProtoType.Type.TYPE_PERCENT, UNKNOWN_FONT_TYPE, imgChop4SER); listLowerNote.get(idx).removeFirst(); // first element of lower note list should be removed here because it has been merged into serThis. } } else if (serThis.mlistChildren.getLast().mnExprRecogType == EXPRRECOGTYPE_GETROOT) { StructExprRecog serRootLevel = serThis.mlistChildren.getLast().mlistChildren.getFirst(); StructExprRecog serRooted = serThis.mlistChildren.getLast().mlistChildren.getLast(); if (serRootLevel.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (serRootLevel.mType == UnitProtoType.Type.TYPE_SQRT_LEFT || serRootLevel.mType == UnitProtoType.Type.TYPE_SQRT_SHORT || serRootLevel.mType == UnitProtoType.Type.TYPE_SQRT_MEDIUM || serRootLevel.mType == UnitProtoType.Type.TYPE_SQRT_LONG || serRootLevel.mType == UnitProtoType.Type.TYPE_SQRT_TALL || serRootLevel.mType == UnitProtoType.Type.TYPE_SQRT_VERY_TALL)) { LinkedList<StructExprRecog> listRoot = new LinkedList<StructExprRecog>(); listRoot.add(serLeftTopNote); listRoot.add(serRootLevel); listRoot.add(serRooted); serThis.setStructExprRecog(listRoot, EXPRRECOGTYPE_GETROOT); } else { LinkedList<StructExprRecog> listNewRootLevel = new LinkedList<StructExprRecog>(); listNewRootLevel.add(serLeftTopNote); listNewRootLevel.add(serRootLevel); StructExprRecog serNewRootLevel = new StructExprRecog(mbarrayBiValues); serNewRootLevel.setStructExprRecog(listNewRootLevel, EXPRRECOGTYPE_VBLANKCUT); serNewRootLevel = serNewRootLevel.restruct(); LinkedList<StructExprRecog> listRoot = new LinkedList<StructExprRecog>(); listRoot.add(serNewRootLevel); listRoot.add(serThis.mlistChildren.getLast().mlistChildren.get(1)); listRoot.add(serRooted); serThis.setStructExprRecog(listRoot, EXPRRECOGTYPE_GETROOT); } } else { // ignore left top note serThis = serThis.mlistChildren.getLast(); } } if (listLowerNote.get(idx).size() > 0 && listUpperNote.get(idx).size() > 0) { StructExprRecog serLowerNote = new StructExprRecog(mbarrayBiValues); if (listLowerNote.get(idx).size() > 1) { serLowerNote.setStructExprRecog(listLowerNote.get(idx), EXPRRECOGTYPE_VBLANKCUT); } else { serLowerNote = listLowerNote.get(idx).getFirst(); } serLowerNote = serLowerNote.restruct(); // restruct lower note StructExprRecog serUpperNote = new StructExprRecog(mbarrayBiValues); if (listUpperNote.get(idx).size() > 1) { serUpperNote.setStructExprRecog(listUpperNote.get(idx), EXPRRECOGTYPE_VBLANKCUT); } else { serUpperNote = listUpperNote.get(idx).getFirst(); } serUpperNote = serUpperNote.restruct(); // restruct upper note LinkedList<StructExprRecog> listWithLUNote = new LinkedList<StructExprRecog>(); listWithLUNote.add(serThis); listWithLUNote.add(serLowerNote); listWithLUNote.add(serUpperNote); serThis = new StructExprRecog(mbarrayBiValues); serThis.setStructExprRecog(listWithLUNote, EXPRRECOGTYPE_VCUTLUNOTES); } else if(listLowerNote.get(idx).size() > 0) { StructExprRecog serLowerNote = new StructExprRecog(mbarrayBiValues); if (listLowerNote.get(idx).size() > 1) { serLowerNote.setStructExprRecog(listLowerNote.get(idx), EXPRRECOGTYPE_VBLANKCUT); } else { serLowerNote = listLowerNote.get(idx).getFirst(); } serLowerNote = serLowerNote.restruct(); // restruct lower note LinkedList<StructExprRecog> listWithLowerNote = new LinkedList<StructExprRecog>(); listWithLowerNote.add(serThis); listWithLowerNote.add(serLowerNote); serThis = new StructExprRecog(mbarrayBiValues); serThis.setStructExprRecog(listWithLowerNote, EXPRRECOGTYPE_VCUTLOWERNOTE); } else if (listUpperNote.get(idx).size() > 0) { StructExprRecog serUpperNote = new StructExprRecog(mbarrayBiValues); if (listUpperNote.get(idx).size() > 1) { serUpperNote.setStructExprRecog(listUpperNote.get(idx), EXPRRECOGTYPE_VBLANKCUT); } else { serUpperNote = listUpperNote.get(idx).getFirst(); } serUpperNote = serUpperNote.restruct(); // restruct upper note LinkedList<StructExprRecog> listWithUpperNote = new LinkedList<StructExprRecog>(); listWithUpperNote.add(serThis); listWithUpperNote.add(serUpperNote); serThis = new StructExprRecog(mbarrayBiValues); serThis.setStructExprRecog(listWithUpperNote, EXPRRECOGTYPE_VCUTUPPERNOTE); serThis = serThis.identifyHSeperatedChar(); // a VCUTUPPERNOTE could be misrecognized i. } // base is always not v cut. listProcessed.add(serThis); } StructExprRecog serReturn = new StructExprRecog(mbarrayBiValues); if (listProcessed.size() == 1) { serReturn = listProcessed.getFirst(); } else if (listProcessed.size() > 1) { serReturn.setStructExprRecog(listProcessed, EXPRRECOGTYPE_VBLANKCUT); } return serReturn; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public native MagickImage chopImage(Rectangle chopInfo)\n\t\t\tthrows MagickException;", "public ImageChop shrinkImgArray() {\n if (mnLeft == 0 && mnTop == 0 && getRightPlus1() == mnWidth && getBottomPlus1() == mnHeight) {\n return this;\n } else {\n byte[][] barrayImg =...
[ "0.64917815", "0.6021179", "0.5669204", "0.55582976", "0.5227094", "0.5218085", "0.5167076", "0.51401055", "0.5045407", "0.5033388", "0.5028747", "0.5007788", "0.49865103", "0.4976997", "0.49415338", "0.4933937", "0.49246794", "0.4922559", "0.49071658", "0.48695356", "0.48669...
0.0
-1
This function identify upper notes and lower notes if they belong to previous base or next base
public static int[] groupNotesForPrevNextBases(LinkedList<StructExprRecog> listBaseULIdentified, LinkedList<Integer> listCharLevel, int nLastBaseIdx, int nNextBaseIdx) { // assume nLastBaseIdx < nNextBaseIdx - 1 if (nLastBaseIdx < 0) { // nNextBaseIdx is the first base int[] narrayGrouped = new int[nNextBaseIdx]; for (int nElementIdx = 0; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { narrayGrouped[nElementIdx] = 1; } return narrayGrouped; } else if (nNextBaseIdx < 0 || nNextBaseIdx >= listBaseULIdentified.size()) { // nLastBaseIdx is the last base int[] narrayGrouped = new int[listBaseULIdentified.size() - 1 - nLastBaseIdx]; for (int nElementIdx = nLastBaseIdx + 1; nElementIdx < listBaseULIdentified.size(); nElementIdx ++) { narrayGrouped[nElementIdx] = 0; } return narrayGrouped; } else if (nLastBaseIdx >= nNextBaseIdx - 1) { return new int[0]; // no notes between last and next base. } else { int[] narrayGrouped = new int[nNextBaseIdx - 1 - nLastBaseIdx]; double[] darrayUpperNoteGaps = new double[nNextBaseIdx - nLastBaseIdx], darrayLowerNoteGaps = new double[nNextBaseIdx - nLastBaseIdx]; double dMaxUpperNoteGap = -1, dMaxLowerNoteGap = -1; int nMaxUpperNoteGapIdx = -1, nMaxLowerNoteGapIdx = -1; int nLastLeftForUpperNote = nLastBaseIdx, nLastLeftForLowerNote = nLastBaseIdx; double dUpperNoteFontAvgWidth = 0, dUpperNoteFontAvgHeight = 0; double dLowerNoteFontAvgWidth = 0, dLowerNoteFontAvgHeight = 0; int nUpperNoteCnt = 0, nLowerNoteCnt = 0; int nLastUpperNoteIdx = 0, nLastLowerNoteIdx = 0; for (int nElementIdx = nLastBaseIdx + 1; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { int nGroupIdx = nElementIdx - (nLastBaseIdx + 1); if (listCharLevel.get(nElementIdx) == -1) { // lower note StructExprRecog serLast = listBaseULIdentified.get(nLastLeftForLowerNote); StructExprRecog serThis = listBaseULIdentified.get(nElementIdx); dLowerNoteFontAvgWidth += serThis.mnWidth; dLowerNoteFontAvgHeight += serThis.mnHeight; nLowerNoteCnt ++; nLastLowerNoteIdx = nElementIdx; int nLastRightP1 = serLast.getRightPlus1(); int nThisLeft = serThis.mnLeft; if (nLastLeftForLowerNote > nLastBaseIdx) { double dLastHCentral = (serLast.mnTop + serLast.getBottomPlus1())/2.0; double dThisHCentral = (serThis.mnTop + serThis.getBottomPlus1())/2.0; double dHCentralGap = Math.abs(dThisHCentral - dLastHCentral); double dHTopGap = Math.abs(serThis.mnTop - serLast.mnTop); double dHBottomP1Gap = Math.abs(serThis.getBottomPlus1() - serLast.getBottomPlus1()); //darrayLowerNoteGaps[nGroupIdx] = Math.max(0, nThisLeft - nLastRightP1) + Math.abs(dThisHCentral - dLastHCentral); darrayLowerNoteGaps[nGroupIdx] = Math.hypot(Math.max(0, nThisLeft - nLastRightP1), Math.min(dHCentralGap, Math.min(dHTopGap, dHBottomP1Gap))); } else { // vertical distance measure from base to note is a bit different int nLastBottomP1 = serLast.getBottomPlus1(); double dThisHCentral = (serThis.mnTop + serThis.getBottomPlus1())/2.0; //darrayLowerNoteGaps[nGroupIdx] = Math.max(0, nThisLeft - nLastRightP1) + Math.max(0, dThisHCentral - nLastBottomP1); darrayLowerNoteGaps[nGroupIdx] = Math.hypot(Math.max(0, nThisLeft - nLastRightP1), Math.max(0, dThisHCentral - nLastBottomP1)); } if (darrayLowerNoteGaps[nGroupIdx] >= dMaxLowerNoteGap) { // always try to use the right most gap as max gap dMaxLowerNoteGap = darrayLowerNoteGaps[nGroupIdx]; nMaxLowerNoteGapIdx = nGroupIdx; } nLastLeftForLowerNote = nElementIdx; darrayUpperNoteGaps[nGroupIdx] = -1; } else if (listCharLevel.get(nElementIdx) == 1) { // upper note StructExprRecog serLast = listBaseULIdentified.get(nLastLeftForUpperNote); StructExprRecog serThis = listBaseULIdentified.get(nElementIdx); dUpperNoteFontAvgWidth += serThis.mnWidth; dUpperNoteFontAvgHeight += serThis.mnHeight; nUpperNoteCnt ++; nLastUpperNoteIdx = nElementIdx; int nLastRightP1 = serLast.getRightPlus1(); int nThisLeft = serThis.mnLeft; if (nLastLeftForUpperNote > nLastBaseIdx) { double dLastHCentral = (serLast.mnTop + serLast.getBottomPlus1())/2.0; double dThisHCentral = (serThis.mnTop + serThis.getBottomPlus1())/2.0; double dHCentralGap = Math.abs(dThisHCentral - dLastHCentral); double dHTopGap = Math.abs(serThis.mnTop - serLast.mnTop); double dHBottomP1Gap = Math.abs(serThis.getBottomPlus1() - serLast.getBottomPlus1()); //darrayUpperNoteGaps[nGroupIdx] = Math.max(0, nThisLeft - nLastRightP1) + Math.abs(dThisHCentral - dLastHCentral); darrayUpperNoteGaps[nGroupIdx] = Math.hypot(Math.max(0, nThisLeft - nLastRightP1), Math.min(dHCentralGap, Math.min(dHTopGap, dHBottomP1Gap))); } else { // vertical distance measure from base to note is a bit different int nLastTop = serLast.mnTop; double dThisHCentral = (serThis.mnTop + serThis.getBottomPlus1())/2.0; //darrayUpperNoteGaps[nGroupIdx] = Math.max(0, nThisLeft - nLastRightP1) + Math.max(0, nLastTop - dThisHCentral); darrayUpperNoteGaps[nGroupIdx] = Math.hypot(Math.max(0, nThisLeft - nLastRightP1), Math.max(0, nLastTop - dThisHCentral)); } if (darrayUpperNoteGaps[nGroupIdx] >= dMaxUpperNoteGap) { // always try to use the right most gap as max gap dMaxUpperNoteGap = darrayUpperNoteGaps[nGroupIdx]; nMaxUpperNoteGapIdx = nGroupIdx; } nLastLeftForUpperNote = nElementIdx; darrayLowerNoteGaps[nGroupIdx] = -1; } else { // base note? seems wrong. narrayGrouped[nGroupIdx] = -1; // invalid group darrayUpperNoteGaps[nGroupIdx] = -1; darrayLowerNoteGaps[nGroupIdx] = -1; } } if (nLastLeftForUpperNote != nLastBaseIdx) { StructExprRecog serLast = listBaseULIdentified.get(nLastLeftForUpperNote); StructExprRecog serThis = listBaseULIdentified.get(nNextBaseIdx); int nLastRightP1 = serLast.getRightPlus1(); int nThisLeft = serThis.mnLeft; double dLastHCentral = (serLast.mnTop + serLast.getBottomPlus1())/2.0; int nThisTop = serThis.mnTop; int nGroupIdx = nNextBaseIdx - 1 - nLastBaseIdx; //darrayUpperNoteGaps[nGroupIdx] = Math.max(0, nThisLeft - nLastRightP1) + Math.max(0, nThisTop - dLastHCentral); if (serThis.mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_GETROOT && (serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_SQRT_LEFT || serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_SQRT_LONG || serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_SQRT_MEDIUM || serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_SQRT_SHORT)) { // if next base is sqrt, the distance from last upper note to sqrt should be calculated in a different way // from other characters because sqrt's upper left part is empty so real distance from sqrt to its upper left // is actually longer than other base characters' distance to the upper left note. In general, the left tick // part of sqrt_left, sqrt_long, sqrt_medium and sqrt_short's w:h is from 1/3 to 4/5, so horizontal difference // is nThisLeft + serThis.mnHeight /2.0 - nLastRightP1 and vertical difference is dThisHCentral - dLastHCentral. double dThisHCentral = (serThis.mnTop + serThis.getBottomPlus1())/2.0; darrayUpperNoteGaps[nGroupIdx] = Math.hypot(Math.max(0, nThisLeft + serThis.mnHeight /2.0 - nLastRightP1), Math.max(0, dThisHCentral - dLastHCentral)); } else if (serThis.mnExprRecogType == StructExprRecog.EXPRRECOGTYPE_GETROOT && (serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_SQRT_TALL || serThis.mlistChildren.getFirst().mType == UnitProtoType.Type.TYPE_SQRT_VERY_TALL)) { // In general, the left tick part of sqrt_tall and sqrt_very_tall's w:h is from 1/6 to 1/3, so horizontal difference // is nThisLeft + serThis.mnHeight /2.0 - nLastRightP1. And vertical difference is measured from central of upper note // to top + height/4 of sqrt. double dThisHTopCentral = serThis.mnTop + serThis.mnHeight /4.0; darrayUpperNoteGaps[nGroupIdx] = Math.hypot(Math.max(0, nThisLeft + serThis.mnHeight /4.0 - nLastRightP1), Math.max(0, dThisHTopCentral - dLastHCentral)); } else { darrayUpperNoteGaps[nGroupIdx] = Math.hypot(Math.max(0, nThisLeft - nLastRightP1), Math.max(0, nThisTop - dLastHCentral)); } if (darrayUpperNoteGaps[nGroupIdx] >= dMaxUpperNoteGap) { // always try to use the right most gap as max gap dMaxUpperNoteGap = darrayUpperNoteGaps[nGroupIdx]; nMaxUpperNoteGapIdx = nGroupIdx; } } else { darrayUpperNoteGaps[nNextBaseIdx - 1 - nLastBaseIdx] = -1; // last left for upper note is last base. } if (nLastLeftForLowerNote != nLastBaseIdx) { StructExprRecog serLast = listBaseULIdentified.get(nLastLeftForLowerNote); StructExprRecog serThis = listBaseULIdentified.get(nNextBaseIdx); int nLastRightP1 = serLast.getRightPlus1(); int nThisLeft = serThis.mnLeft; double dLastHCentral = (serLast.mnTop + serLast.getBottomPlus1())/2.0; int nThisBottomP1 = serThis.getBottomPlus1(); int nGroupIdx = nNextBaseIdx - 1 - nLastBaseIdx; //darrayLowerNoteGaps[nGroupIdx] = Math.max(0, nThisLeft - nLastRightP1) + Math.max(0, dLastHCentral - nThisBottomP1); darrayLowerNoteGaps[nGroupIdx] = Math.hypot(Math.max(0, nThisLeft - nLastRightP1), Math.max(0, dLastHCentral - nThisBottomP1)); if (darrayLowerNoteGaps[nGroupIdx] >= dMaxLowerNoteGap) { // always try to use the right most gap as max gap dMaxLowerNoteGap = darrayLowerNoteGaps[nGroupIdx]; nMaxLowerNoteGapIdx = nGroupIdx; } } else { darrayLowerNoteGaps[nNextBaseIdx - 1 - nLastBaseIdx] = -1; // last left for Lower note is last base. } if (nUpperNoteCnt > 0) { StructExprRecog serLastBase = listBaseULIdentified.get(nLastBaseIdx); StructExprRecog serNextBase = listBaseULIdentified.get(nNextBaseIdx); StructExprRecog serLastUpperNote = listBaseULIdentified.get(nLastUpperNoteIdx); dUpperNoteFontAvgWidth /= nUpperNoteCnt; dUpperNoteFontAvgHeight /= nUpperNoteCnt; if (dMaxUpperNoteGap <= ConstantsMgr.msdNoteBaseMaxGap * Math.max(dUpperNoteFontAvgWidth, dUpperNoteFontAvgHeight)) { // times 2 because include vertical and horizontal // the max gap between upper notes is narrow, if (serNextBase.mnExprRecogType == EXPRRECOGTYPE_GETROOT) { // the character before sqrt should be an operator, as such the upper parts must be left note for (int nElementIdx = nLastBaseIdx + 1; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { if (listCharLevel.get(nElementIdx) == 1) { // upper note int nGroupIdx = nElementIdx - (nLastBaseIdx + 1); narrayGrouped[nGroupIdx] = 1; } } } else if (((serNextBase.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && serNextBase.mType == UnitProtoType.Type.TYPE_SMALL_C) || (serNextBase.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && serNextBase.mType == UnitProtoType.Type.TYPE_BIG_C) || (serNextBase.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && serNextBase.mType == UnitProtoType.Type.TYPE_BIG_F)) && (serLastUpperNote.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (serLastUpperNote.mType == UnitProtoType.Type.TYPE_ZERO || serLastUpperNote.mType == UnitProtoType.Type.TYPE_SMALL_O || serLastUpperNote.mType == UnitProtoType.Type.TYPE_BIG_O) && nLastUpperNoteIdx == nNextBaseIdx - 1 && (serNextBase.mnLeft - serLastUpperNote.mnLeft)<(2 * serLastUpperNote.mnWidth))) { // could be celcius or fahrenheit. for (int nElementIdx = nLastBaseIdx + 1; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { if (listCharLevel.get(nElementIdx) == 1) { // upper note int nGroupIdx = nElementIdx - (nLastBaseIdx + 1); if (nElementIdx == nLastUpperNoteIdx) { narrayGrouped[nGroupIdx] = 1; } else { narrayGrouped[nGroupIdx] = 0; } } } } else if (((serNextBase.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && serNextBase.mType == UnitProtoType.Type.TYPE_FORWARD_SLASH) || (serNextBase.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && serNextBase.mType == UnitProtoType.Type.TYPE_ONE) || (serNextBase.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && serNextBase.mType == UnitProtoType.Type.TYPE_SMALL_L)) && (serLastUpperNote.mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (serLastUpperNote.mType == UnitProtoType.Type.TYPE_ZERO || serLastUpperNote.mType == UnitProtoType.Type.TYPE_SMALL_O || serLastUpperNote.mType == UnitProtoType.Type.TYPE_BIG_O) && nLastUpperNoteIdx == nNextBaseIdx - 1 && (serNextBase.mnLeft - serLastUpperNote.mnLeft)<(2 * serLastUpperNote.mnHeight)) && (listBaseULIdentified.size() > nNextBaseIdx + 1 && listCharLevel.get(nNextBaseIdx + 1) == -1 // lower note && listBaseULIdentified.get(nNextBaseIdx + 1).mnExprRecogType == EXPRRECOGTYPE_ENUMTYPE && (listBaseULIdentified.get(nNextBaseIdx + 1).mType == UnitProtoType.Type.TYPE_ZERO || listBaseULIdentified.get(nNextBaseIdx + 1).mType == UnitProtoType.Type.TYPE_SMALL_O || listBaseULIdentified.get(nNextBaseIdx + 1).mType == UnitProtoType.Type.TYPE_BIG_O) // lower note is o. && (listBaseULIdentified.get(nNextBaseIdx + 1).mnLeft - serNextBase.getRightPlus1()) < listBaseULIdentified.get(nNextBaseIdx + 1).mnWidth)) { // could be %. for (int nElementIdx = nLastBaseIdx + 1; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { if (listCharLevel.get(nElementIdx) == 1) { // upper note int nGroupIdx = nElementIdx - (nLastBaseIdx + 1); if (nElementIdx == nLastUpperNoteIdx) { narrayGrouped[nGroupIdx] = 1; } else { narrayGrouped[nGroupIdx] = 0; } } } } else { // all upper notes belong to last base. for (int nElementIdx = nLastBaseIdx + 1; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { if (listCharLevel.get(nElementIdx) == 1) { // upper note int nGroupIdx = nElementIdx - (nLastBaseIdx + 1); narrayGrouped[nGroupIdx] = 0; } } } } else { // the max gap between upper notes is wide which means the upper notes may belong to different bases for (int nElementIdx = nLastBaseIdx + 1; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { if (listCharLevel.get(nElementIdx) == 1) { // upper note int nGroupIdx = nElementIdx - (nLastBaseIdx + 1); if (nGroupIdx >= nMaxUpperNoteGapIdx) { narrayGrouped[nGroupIdx] = 1; // max gap right should belong to next base } else { narrayGrouped[nGroupIdx] = 0; // max gap left should belong to last base } } } } } if (nLowerNoteCnt > 0) { dLowerNoteFontAvgWidth /= nLowerNoteCnt; dLowerNoteFontAvgHeight /= nLowerNoteCnt; if (dMaxLowerNoteGap <= ConstantsMgr.msdNoteBaseMaxGap * Math.max(dLowerNoteFontAvgWidth, dLowerNoteFontAvgHeight)) { // times 2 because include vertical and horizontal // the max gap between lower notes is narrow, all lower notes belong to last base. for (int nElementIdx = nLastBaseIdx + 1; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { if (listCharLevel.get(nElementIdx) == -1) { // lower note int nGroupIdx = nElementIdx - (nLastBaseIdx + 1); narrayGrouped[nGroupIdx] = 0; } } } else { // the max gap between lower notes is wide which means the lower notes may belong to different bases // here we do not worry about the second o of % because if the second o is too far away from / then // even human being cannot recognize it. for (int nElementIdx = nLastBaseIdx + 1; nElementIdx <= nNextBaseIdx - 1; nElementIdx ++) { if (listCharLevel.get(nElementIdx) == -1) { // lower note int nGroupIdx = nElementIdx - (nLastBaseIdx + 1); if (nGroupIdx >= nMaxLowerNoteGapIdx) { narrayGrouped[nGroupIdx] = 1; // max gap right should belong to next base } else { narrayGrouped[nGroupIdx] = 0; // max gap left should belong to last base } } } } } return narrayGrouped; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static PatternInterface trill(Note baseNote){\r\n \treturn trill(baseNote, EFFECT_DIRECTION_UP);\r\n }", "private void updateMatchType(MidiNote note) {\n\t\tList<Beat> beats = beatState.getBeats();\n\t\tBeat startBeat = note.getOnsetBeat(beats);\n\t\tBeat endBeat = note.getOffsetBeat(beats);\n\t\t\n...
[ "0.5191613", "0.5147517", "0.50659925", "0.50427705", "0.49654347", "0.49451932", "0.49175325", "0.48970583", "0.48672336", "0.4864159", "0.4857664", "0.48487982", "0.48482764", "0.48468867", "0.48317683", "0.48317683", "0.4791799", "0.47881985", "0.47605756", "0.47392705", "...
0.6598666
0