static int getMi(int ep) { int[] arr = new int[7]; Im.set7Perm(arr, ep); for (int i = 0; i < 3; i++) { if (arr[i + 1] < 4) arr[i] = arr[i + 1]; else arr[i] = 6 - arr[i + 1]; } return Im.permToIdx(arr, 3); }
private boolean isValuePartOfImList(List<Im> list, String value) { if (list != null) { for (Im actIm : list) { if (actIm.getValue().equals(value)) { return true; } } } return false; }
public void printAllContacts() throws ServiceException, IOException { // Request the feed setService(); URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/[email protected]/full"); Query myQuery = new Query(feedUrl); myQuery.setMaxResults(8); myQuery.setStringCustomParameter("group", "Business Contacts"); ContactFeed resultFeed = myService.query(myQuery, ContactFeed.class); // Print the results System.out.println(resultFeed.getTitle().getPlainText()); for (int i = 0; i < resultFeed.getEntries().size(); i++) { ContactEntry entry = resultFeed.getEntries().get(i); Name test = entry.getName(); FullName namee = test.getFullName(); People person = peopleRepo.save( new People(23, entry.getTitle().getPlainText(), entry.getTitle().getPlainText())); System.out.println(person.getNodeId().toString()); System.out.println("\t" + entry.getTitle().getPlainText()); System.out.println("Email addresses:"); for (com.google.gdata.data.extensions.Email email : entry.getEmailAddresses()) { System.out.print(" " + email.getAddress()); if (email.getRel() != null) { System.out.print(" rel:" + email.getRel()); } if (email.getLabel() != null) { System.out.print(" label:" + email.getLabel()); } if (email.getPrimary()) { System.out.print(" (primary) "); } System.out.print("\n"); } System.out.println("IM addresses:"); for (Im im : entry.getImAddresses()) { System.out.print(" " + im.getAddress()); if (im.getLabel() != null) { System.out.print(" label:" + im.getLabel()); } if (im.getRel() != null) { System.out.print(" rel:" + im.getRel()); } if (im.getProtocol() != null) { System.out.print(" protocol:" + im.getProtocol()); } if (im.getPrimary()) { System.out.print(" (primary) "); } System.out.print("\n"); } System.out.println("Groups:"); for (GroupMembershipInfo group : entry.getGroupMembershipInfos()) { String groupHref = group.getHref(); System.out.println(" Id: " + groupHref); } System.out.println("Extended Properties:"); for (ExtendedProperty property : entry.getExtendedProperties()) { if (property.getValue() != null) { System.out.println(" " + property.getName() + "(value) = " + property.getValue()); } else if (property.getXmlBlob() != null) { System.out.println( " " + property.getName() + "(xmlBlob)= " + property.getXmlBlob().getBlob()); } } String photoLink = entry.getContactPhotoLink().getHref(); System.out.println("Photo Link: " + photoLink); System.out.println("Contact's ETag: " + entry.getEtag()); } }
public static void init() { if (ini) return; Tower.init(); int[] arr = new int[8]; /* 0 1 * 3 2 * * 4 5 * - 6 */ for (int i = 0; i < 5040; i++) { for (int j = 0; j < 3; j++) { Im.set7Perm(arr, i); switch (j) { case 0: Im.cir(arr, 0, 3, 2, 1); break; // Uw case 1: Im.cir(arr, 1, 2, 5, 6); break; // R case 2: Im.cir(arr, 2, 3, 4, 5); break; // F } epm[i][j] = (short) Im.get7Perm(arr); } } for (int i = 0; i < 729; i++) { for (int j = 0; j < 3; j++) { Im.idxToZori(arr, i, 3, 7); switch (j) { case 0: Im.cir(arr, 0, 3, 2, 1); break; // Uw case 1: Im.cir(arr, 1, 2, 5, 6); arr[1] += 2; arr[2]++; arr[5] += 2; arr[6]++; break; // R case 2: Im.cir(arr, 2, 3, 4, 5); arr[2] += 2; arr[3]++; arr[4] += 2; arr[5]++; break; // F } eom[i][j] = (short) Im.zoriToIdx(arr, 3, 7); } } // n = 1; for (int i = 1; i < 5040; i++) { Im.set7Perm(arr, i); if (checkEp1(arr)) { epd[i] = 0; // n++; } else epd[i] = -1; } // System.out.println("0 "+n); epd[0] = 0; for (int d = 0; d < 4; d++) { for (int i = 0; i < 5040; i++) if (epd[i] == d) for (int k = 0; k < 3; k++) for (int y = i, m = 0; m < 3; m++) { y = epm[y][k]; if (epd[y] < 0) { epd[y] = (byte) (d + 1); // n++; } } // System.out.println(d+1+" "+n); } for (int i = 1; i < 729; i++) eod[i] = -1; eod[0] = 0; // n = 1; for (int d = 0; d < 6; d++) { // nVisited = 0; for (int i = 0; i < 729; i++) if (eod[i] == d) { for (int k = 0; k < 3; k++) for (int y = i, m = 0; m < 3; m++) { y = eom[y][k]; if (eod[y] < 0) { eod[y] = (byte) (d + 1); // n++; } } } // System.out.println(d+1+" "+n); } ini = true; }