public static boolean checkAuxVerb2(byte[] Verb) /****new*****/ { byte ththu[]={20,20,5},nththu[]={21,20,5},nthth[]={21,20},thu[]={20,5},aamal[]={2,23,1,26}; byte e[]={3},y[]={24},yy[]={24,24},va[]={27,1},th[]={20},pp[]={22,22},kk[]={14,14},k[]={14},r[]={25}; if((Verb.length > kond.length)&&ByteMeth.endsWith(Verb,kond)) { System.out.println("Auxverb2"); byte auxVerb[]=ByteMeth.subArray(Verb,Verb.length-kond.length,Verb.length); auxVerb = ByteMeth.addArray(auxVerb,u); byte mainVerb[]=ByteMeth.subArray(Verb,0,(Verb.length-kond.length)); s.push("\n"+tabconvert2.revert(auxVerb)+" (�������)"); if(ByteMeth.endsWith(mainVerb,k)) mainVerb = ByteMeth.subArray(mainVerb,0,mainVerb.length-1); checkVbp(mainVerb); return true; } else return false; }
public static boolean checkVidu(byte[] byteVerb) /****new*****/ { if((byteVerb.length > vidu.length)&&ByteMeth.endsWith(byteVerb,vidu)) { System.out.println("checkVidu"); byte auxVerb[]=ByteMeth.subArray(byteVerb,byteVerb.length-vidu.length,byteVerb.length); byte mainVerb[]=ByteMeth.subArray(byteVerb,0,(byteVerb.length-vidu.length)); s.push("\n"+tabconvert2.revert(auxVerb)+" (�������)"); checkVbp(mainVerb); checkAuxTheer(); checkAuxKattu(); return true; } else return false; }
public static boolean checkTheer(byte[] str) /****new*****/ { byte th[]={20}; if((str.length > theer.length)&&ByteMeth.endsWith(str,theer)) { System.out.println("checkTheer"); byte auxVerb[]=ByteMeth.subArray(str,str.length-theer.length,str.length); byte mainVerb[]=ByteMeth.subArray(str,0,(str.length-theer.length)); s.push("\n"+tabconvert2.revert(auxVerb)+" (�������)"); if(ByteMeth.endsWith(mainVerb,th)) mainVerb = ByteMeth.subArray(mainVerb,0,mainVerb.length-1); checkVbp(mainVerb); return true; } else return false; }
public static boolean checkKattu(byte[] str) /****new*****/ { byte k[]={14}; if((str.length > kattu.length)&&ByteMeth.endsWith(str,kattu)) { System.out.println("checkKattu"); byte auxVerb[]=ByteMeth.subArray(str,str.length-kattu.length,str.length); byte mainVerb[]=ByteMeth.subArray(str,0,(str.length-kattu.length)); s.push("\n"+tabconvert2.revert(auxVerb)+" (�������)"); if(ByteMeth.endsWith(mainVerb,k)) mainVerb = ByteMeth.subArray(mainVerb,0,mainVerb.length-1); checkVbp(mainVerb); return true; } else return false; }
public static boolean check_akku(byte h1[]) { String spchk; if(h1.length < akku.length) return false; if(ByteMeth.endsWith(h1,akku)) { System.out.println("akku_ok"); byte r[]=ByteMeth.subArray(h1,h1.length-akku.length,h1.length); byte a[]=ByteMeth.subArray(h1,0,(h1.length-akku.length)); s.push("\n"+tabconvert2.revert(r)+"<case>"); s.push("\n"+tabconvert2.revert(a)+"(noun)"); return(true); } else return(false); }
public static boolean check_odu1(byte h1[]) { String spchk; if(h1.length < odu1.length) return false; if(ByteMeth.endsWith(h1,odu1)) { System.out.println("odu1_ok"); byte r[]=ByteMeth.subArray(h1,h1.length-3,h1.length); byte a[]=ByteMeth.subArray(h1,0,(h1.length-odu1.length)); s.push("\n"+tabconvert2.revert(r)+"<case>"); plural(a); if(!splitCompletedInPlural) checkdata(a,odu1); /*if(ByteMeth.endsWith(a,thth)||ByteMeth.endsWith(a,tt)||ByteMeth.endsWith(a,in)||ByteMeth.endsWith(a,iv)||ByteMeth.endsWith(a,y)) System.out.println("sorry"); else s.push("\n"+" "+tabconvert2.revert(a)+" <noun>");*/ return(true); } else return(false); }
public static void main(String[] args) throws Exception { boolean endResult = true; if (!arePaddedPairwise(R1.class, "int1", "int2")) { System.err.println("R1 failed"); endResult &= false; } if (!arePaddedPairwise(R2.class, "int1", "int2")) { System.err.println("R2 failed"); endResult &= false; } if (!arePaddedPairwise(R3.class, "int1", "int2")) { System.err.println("R3 failed"); endResult &= false; } System.out.println(endResult ? "Test PASSES" : "Test FAILS"); if (!endResult) { throw new Error("Test failed"); } }
private void wrapperPublicPriviteKeyTest(Provider p, String[] algorithms) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException { for (String algo : algorithms) { // Key pair generated System.out.println("Generate key pair (algorithm: " + algo + ", provider: " + p.getName() + ")"); KeyPairGenerator kpg = KeyPairGenerator.getInstance(algo); kpg.initialize(512); KeyPair kp = kpg.genKeyPair(); // key generated String algoWrap = "DES"; KeyGenerator kg = KeyGenerator.getInstance(algoWrap, p); Key key = kg.generateKey(); wrapTest(algo, algoWrap, key, kp.getPrivate(), Cipher.PRIVATE_KEY, false); wrapTest(algo, algoWrap, key, kp.getPublic(), Cipher.PUBLIC_KEY, false); } }
@Test public void testStreamZip() throws IOException { try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) { zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry)); zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java")); Object elements[] = zf.stream().toArray(); assertEquals(1, elements.length); assertEquals(elements[0].toString(), "ReadZip.java"); } }
/** * Check whether we can connect, according to our policies. * Currently, checks that we've waited TIME_BETWEEN_EXCHANGES_MILLIS * milliseconds since the last exchange and that we're not already connecting. * * @return Whether or not we're ready to connect to a peer. * @see TIME_BETWEEN_EXCHANGES_MILLIS * @see getConnecting */ private boolean readyToConnect() { long now = System.currentTimeMillis(); long lastExchangeMillis = mStore.getLong(LAST_EXCHANGE_TIME_KEY, -1); boolean timeSinceLastOK; if (lastExchangeMillis == -1) { timeSinceLastOK = true; } else if (now - lastExchangeMillis < TIME_BETWEEN_EXCHANGES_MILLIS) { timeSinceLastOK = false; } else { timeSinceLastOK = true; } Log.v(TAG, "Ready to connect? " + (timeSinceLastOK && !getConnecting())); Log.v(TAG, "Connecting: " + getConnecting()); Log.v(TAG, "timeSinceLastOK: " + timeSinceLastOK); return timeSinceLastOK && !getConnecting(); }
@Override public void success(Exchange exchange) { // Latency of communication: Stop timer here. long exchangeStopTimeMillis = System.currentTimeMillis(); // Latency of communication: Calculate RTT from # of round trips in exchange. // In this case, we're using a NonceEchoExchange, which includes one round-trip, // so the RTT time is just the time between the start and end of the exchange. long rttMillis = exchangeStopTimeMillis - exchangeStartTimeMillis; // Latency of communication: Record RTT and any other parameters. // TODO(lerner): Record time. String init = exchange.asInitiator ? "initiator" : "listener"; Log.i(TAG, String.format("Exchange complete as %s, took %d milliseconds", init, rttMillis)); BluetoothSocket activeSocket = (mSocket != null) ? mSocket : mBluetoothSpeaker.mSocket; RangzenService.this.logEventToCSV(new String[] { activeSocket.getRemoteDevice().getAddress(), init, Long.toString(System.currentTimeMillis()), Long.toString(rttMillis) }); RangzenService.this.cleanupAfterExchange(); }
/*************************************************************** function: print_set **************************************************************/ void print_set ( Vector nfa_set ) { int size; int elem; CNfa nfa; size = nfa_set.size(); if (0 == size) { System.out.print("empty "); } for (elem = 0; elem < size; ++elem) { nfa = (CNfa) nfa_set.elementAt(elem); /*System.out.print(m_spec.m_nfa_states.indexOf(nfa) + " ");*/ System.out.print(nfa.m_label + " "); } }
@Ignore("addStaticImport doesn't support members with $L") @Test public void importStaticDynamic() { JavaFile source = JavaFile.builder("com.squareup.tacos", TypeSpec.classBuilder("Taco") .addMethod(MethodSpec.methodBuilder("main") .addStatement("$T.$L.println($S)", System.class, "out", "hello") .build()) .build()) .addStaticImport(System.class, "out") .build(); assertThat(source.toString()).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "import static java.lang.System.out;\n" + "\n" + "class Taco {\n" + " void main() {\n" + " out.println(\"hello\");\n" + " }\n" + "}\n"); }
@Test public void importStaticUsingWildcards() { assertThat(JavaFile.builder("readme", importStaticTypeSpec("Util")) .addStaticImport(TimeUnit.class, "*") .addStaticImport(System.class, "*") .build().toString()).isEqualTo("" + "package readme;\n" + "\n" + "import static java.lang.System.*;\n" + "import static java.util.concurrent.TimeUnit.*;\n" + "\n" + "class Util {\n" + " public static long minutesToSeconds(long minutes) {\n" + " gc();\n" + " return SECONDS.convert(minutes, MINUTES);\n" + " }\n" + "}\n"); }
@Test public void defaultPackage() throws Exception { String source = JavaFile.builder("", TypeSpec.classBuilder("HelloWorld") .addMethod(MethodSpec.methodBuilder("main") .addModifiers(Modifier.PUBLIC, Modifier.STATIC) .addParameter(String[].class, "args") .addCode("$T.out.println($S);\n", System.class, "Hello World!") .build()) .build()) .build() .toString(); assertThat(source).isEqualTo("" + "import java.lang.String;\n" + "import java.lang.System;\n" + "\n" + "class HelloWorld {\n" + " public static void main(String[] args) {\n" + " System.out.println(\"Hello World!\");\n" + " }\n" + "}\n"); }
@Test public void doWhile() throws Exception { TypeSpec taco = TypeSpec.classBuilder("Taco") .addMethod(MethodSpec.methodBuilder("loopForever") .beginControlFlow("do") .addStatement("$T.out.println($S)", System.class, "hello") .endControlFlow("while (5 < 6)") .build()) .build(); assertThat(toString(taco)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "import java.lang.System;\n" + "\n" + "class Taco {\n" + " void loopForever() {\n" + " do {\n" + " System.out.println(\"hello\");\n" + " } while (5 < 6);\n" + " }\n" + "}\n"); }
@Test public void inlineIndent() throws Exception { TypeSpec taco = TypeSpec.classBuilder("Taco") .addMethod(MethodSpec.methodBuilder("inlineIndent") .addCode("if (3 < 4) {\n$>$T.out.println($S);\n$<}\n", System.class, "hello") .build()) .build(); assertThat(toString(taco)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "import java.lang.System;\n" + "\n" + "class Taco {\n" + " void inlineIndent() {\n" + " if (3 < 4) {\n" + " System.out.println(\"hello\");\n" + " }\n" + " }\n" + "}\n"); }
/*************************************************************** Function: trunc_col Description: Truncates each column to the 'correct' length. **************************************************************/ private void trunc_col ( ) { int n; int i; CDTrans dtrans; n = m_spec.m_dtrans_vector.size(); for (i = 0; i < n; ++i) { int[] ndtrans = new int[m_spec.m_dtrans_ncols]; dtrans = (CDTrans) m_spec.m_dtrans_vector.elementAt(i); System.arraycopy(dtrans.m_dtrans, 0, ndtrans, 0, ndtrans.length); dtrans.m_dtrans = ndtrans; } }
/*************************************************************** Function: pset **************************************************************/ private void pset ( Vector dtrans_group ) { int i; int size; CDTrans dtrans; size = dtrans_group.size(); for (i = 0; i < size; ++i) { dtrans = (CDTrans) dtrans_group.elementAt(i); System.out.print(dtrans.m_label + " "); } }
/*************************************************************** Function: make_dfa Description: High-level access function to module. **************************************************************/ void make_dfa ( CLexGen lexGen, CSpec spec ) { int i; reset(); set(lexGen,spec); make_dtrans(); free_nfa_states(); if (m_spec.m_verbose && true == CUtility.OLD_DUMP_DEBUG) { System.out.println(m_spec.m_dfa_states.size() + " DFA states in original machine."); } free_dfa_states(); }
/*************************************************************** Function: printccl Description: Debugging routine that outputs readable form of character class. **************************************************************/ private void printccl ( CSet set ) { int i; System.out.print(" ["); for (i = 0; i < m_spec.m_dtrans_ncols; ++i) { if (set.contains(i)) { System.out.print(interp_int(i)); } } System.out.print(']'); }
public static void main(String[] args) { // Configure the connector and create the connection GradleConnector connector = GradleConnector.newConnector(); if (args.length > 0) { connector.useInstallation(new File(args[0])); if (args.length > 1) { connector.useGradleUserHomeDir(new File(args[1])); } } connector.forProjectDirectory(new File("../sampleBuild")); ProjectConnection connection = connector.connect(); try { // Load the custom model for the project CustomModel model = connection.getModel(CustomModel.class); System.out.println("Project: " + model.getName()); System.out.println("Tasks: "); for (String task : model.getTasks()) { System.out.println(" " + task); } } finally { // Clean up connection.close(); } }
public static void main(String[] args) { // Configure the connector and create the connection GradleConnector connector = GradleConnector.newConnector(); if (args.length > 0) { connector.useInstallation(new File(args[0])); if (args.length > 1) { connector.useGradleUserHomeDir(new File(args[1])); } } connector.forProjectDirectory(new File(".")); ProjectConnection connection = connector.connect(); try { // Load the Eclipse model for the project EclipseProject project = connection.getModel(EclipseProject.class); System.out.println("Project: " + project.getName()); System.out.println("Project directory: " + project.getProjectDirectory()); System.out.println("Source directories:"); for (EclipseSourceDirectory srcDir : project.getSourceDirectories()) { System.out.println(srcDir.getPath()); } System.out.println("Project classpath:"); for (ExternalDependency externalDependency : project.getClasspath()) { System.out.println(externalDependency.getFile().getName()); } System.out.println("Associated gradle project:"); System.out.println(project.getGradleProject()); } finally { // Clean up connection.close(); } }
@SuppressWarnings({"unchecked"}) public ArrayListCursor(String[] columnNames, ArrayList<ArrayList> rows) { int colCount = columnNames.length; boolean foundID = false; // Add an _id column if not in columnNames for (int i = 0; i < colCount; ++i) { if (columnNames[i].compareToIgnoreCase("_id") == 0) { mColumnNames = columnNames; foundID = true; break; } } if (!foundID) { mColumnNames = new String[colCount + 1]; System.arraycopy(columnNames, 0, mColumnNames, 0, columnNames.length); mColumnNames[colCount] = "_id"; } int rowCount = rows.size(); mRows = new ArrayList[rowCount]; for (int i = 0; i < rowCount; ++i) { mRows[i] = rows.get(i); if (!foundID) { mRows[i].add(i); } } }
public void actionPerformed(ActionEvent ae) { if(ae.getSource()==but1) System.exit(1); if(ae.getSource()==but) { tf2.setText(""); String str1=((String)tf1.getSelectedItem()).trim(); /*String str1=tstr; tf1.removeAllItems(); tf1.addItem(str1);*/ checkverb(str1); String temp1=""; while (!s.empty()) temp1=temp1+(s.pop().toString())+"\n"; tf2.append(temp1); //int len4=temp1.length(); //String temp2=temp1.substring(0,len4); //Spchkverb.text2.setText(" "+temp2); //tf2.append(temp2); //tf2.append(" "+temp2); //System.out.println("stack content :" + temp2); } }
public static boolean checkAuxVidu() /****new*****/ { byte ththu[]={20,20,5},nththu[]={21,20,5},nthth[]={21,20},thu[]={20,5},aamal[]={2,23,1,26}; byte ae[]={8},e[]={3},y[]={24},yy[]={24,24},va[]={27,1},th[]={20},pp[]={22,22},kk[]={14,14},r[]={25}; String temp1=s.pop().toString(); int verbindex = temp1.indexOf("(����"); if(verbindex!= -1) { String Verb = temp1.substring(1,verbindex-1).trim(); System.out.println("verb :"+ Verb); byte byteVerb[] = tabconvert2.convert(Verb); String verb1 = tabconvert2.revert(byteVerb); if(checkVidu(byteVerb)) return true; else { s.push(temp1); return false; } } else { s.push(temp1); return true; } }
public static boolean checkAuxKattu() /****new*****/ { byte ththu[]={20,20,5},nththu[]={21,20,5},nthth[]={21,20},thu[]={20,5},aamal[]={2,23,1,26}; byte ae[]={8},e[]={3},y[]={24},yy[]={24,24},va[]={27,1},th[]={20},pp[]={22,22},kk[]={14,14},r[]={25}; String temp1=s.pop().toString(); int verbindex = temp1.indexOf("(����"); if(verbindex!= -1) { System.out.println("checkAuxKattu"); String Verb = temp1.substring(1,verbindex-1).trim(); byte byteVerb[] = tabconvert2.convert(Verb); String verb1 = tabconvert2.revert(byteVerb); if(checkKattu(byteVerb)) return true; else { s.push(temp1); return false; } } else { s.push(temp1); return true; } }
public noun5_temp() { super("MAnalyser - Noun"); tf1.setFont(f); tf2.setFont(f); p1.add(tf1); p3.add(but); p3.add(but1); setSize(600,400); setIconImage(img); setLocation(((int)d1-400)/2,((int)d2-600)/2); /*tf1.addItem(""); tf1.addItem("�����"); tf1.addItem("ܬ������"); tf1.addItem("����������"); tf1.addItem("���������"); tf1.addItem("������"); tf1.addItem("�������"); tf1.addItem("����������"); tf1.addItem("���������"); tf1.addItem("������������"); tf1.addItem(" ������������ ");*/ but.addActionListener(this); but1.addActionListener(this); getContentPane().add(p1,"North"); getContentPane().add(scrollpane,"Center"); getContentPane().add(p3,"South"); show(); addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){System.exit(1);}}); }
public static boolean check_athu(byte h1[]) { boolean flag1,flag2; String spchk; if(h1.length < athu.length) return false; if(ByteMeth.endsWith(h1,athu)) { byte r[]=ByteMeth.subArray(h1,h1.length-3,h1.length); byte a[]=ByteMeth.subArray(h1,0,h1.length-athu.length); s.push("\n"+tabconvert2.revert(r)+"<case>"); //String spchk = SpchkNoun.checker(tabconvert2.revert(a)); flag1=plural(a); flag2=checkdata(a,athu); try { if(!flag1 && !flag2) { System.out.println("i am inside if"); spchk = SpchkNoun.checker(tabconvert2.revert(a)); checkagain(spchk); } } catch(Exception e) { System.out.println("exception"); e.printStackTrace(); } return(true); } else return(false); }
public static boolean check_udaya(byte h1[]) { String spchk; boolean issplit1 = false,issplit2 = false; if(h1.length < udaya.length) return false; if(ByteMeth.endsWith(h1,udaya)) { System.out.println("udaya"); byte r[]=ByteMeth.subArray(h1,h1.length-5,h1.length); byte a[]=ByteMeth.subArray(h1,0,(h1.length-udaya.length)); s.push("\n"+" "+tabconvert2.revert(r)+"<case>"); issplit1 = plural(a); if(issplit1 == false) issplit2 = checkdata(a,udaya); if(issplit1 || issplit2) return true; else { try { /*if(!plural(a)) {*/ spchk = SpchkNoun.checker(tabconvert2.revert(a)); checkagain(spchk); //} } catch(Exception e) { System.out.println("exception"); e.printStackTrace(); } checkdata(a,udaya); return(true); } } else return(false); }
public static boolean check_ai(byte h1[]) { String spchk; if(h1.length < ai.length) return false; if(ByteMeth.endsWith(h1,ai)) { System.out.println("ai_ok"); byte r[]=ByteMeth.subArray(h1,h1.length-1,h1.length); byte a[]=ByteMeth.subArray(h1,0,(h1.length-ai.length)); s.push("\n"+tabconvert2.revert(r)+"<case>"); System.out.println("r value :" + tabconvert2.revert(r)); plural(a); if(!splitCompletedInPlural) { if(checkdata(a,ai)) { splitCompletedInAi = true; System.out.println("splitCompletedInAi value :" + splitCompletedInAi); } else { splitCompletedInAi = false; System.out.println("splitCompletedInAi value :" + splitCompletedInAi); } } return(true); } else return(false); }
public static boolean check_aal(byte h1[]) { boolean flag1,flag2; String spchk; if(h1.length < aal.length) return false; if(ByteMeth.endsWith(h1,aal)) { System.out.println("aal_ok"); byte r[]=ByteMeth.subArray(h1,h1.length-2,h1.length); byte a[]=ByteMeth.subArray(h1,0,(h1.length-aal.length)); s.push("\n"+tabconvert2.revert(r)+"<case>"); if(!plural(a)) { if(!checkdata(a,il)) { try { spchk = SpchkNoun.checker(tabconvert2.revert(a)); //System.out.println(" string in check_aaga after call tp spchk : " + spchk); checkagain(spchk); } catch(Exception e) { System.out.println("exception"); e.printStackTrace(); } } } return(true); } else return(false); }