Ejemplo n.º 1
0
 @Override
 public StandardExpander reverse() {
   Map<String, Exclusion> newExclusion = new HashMap<String, Exclusion>();
   for (Map.Entry<String, Exclusion> entry : exclusion.entrySet()) {
     newExclusion.put(entry.getKey(), entry.getValue().reversed());
   }
   return new ExcludingExpander(defaultExclusion.reversed(), newExclusion);
 }
Ejemplo n.º 2
0
 private void addExclusion(String line, Section actualSection) {
   if (actualSection != null) {
     List<String> split = reworkLine(line);
     if (split.size() >= 2) {
       List<Exclusion> exclusions = actualSection.getExclusions();
       Exclusion e = new Exclusion();
       e.setAtomIdx(Integer.parseInt(split.get(0)));
       List<Integer> bonds = e.getBonds();
       for (int i = 1; i < split.size(); i++) {
         bonds.add(Integer.parseInt(split.get(i)));
       }
       exclusions.add(e);
     } else {
       ch.printErrorln(String.format("some EXCLUSIONS values are lost! --> %s", line));
     }
   }
 }
Ejemplo n.º 3
0
 @Override
 public StandardExpander add(RelationshipType type, Direction direction) {
   Exclusion excluded = exclusion.get(type.name());
   final Map<String, Exclusion> newExclusion;
   if (((excluded == null) ? defaultExclusion : excluded).includes(direction)) {
     return this;
   } else {
     excluded = Exclusion.include(direction);
     if (excluded == defaultExclusion) {
       if (exclusion.size() == 1) {
         return new AllExpander(defaultExclusion.direction);
       } else {
         newExclusion = new HashMap<String, Exclusion>(exclusion);
         newExclusion.remove(type.name());
       }
     } else {
       newExclusion = new HashMap<String, Exclusion>(exclusion);
       newExclusion.put(type.name(), excluded);
     }
   }
   return new ExcludingExpander(defaultExclusion, newExclusion);
 }
Ejemplo n.º 4
0
  private void removeObsoleteContactsAndLists() {
    // remove all contacts for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    Exclusion exclusion = new Exclusion(Imps.Contacts.USERNAME, mValidatedContacts);
    mResolver.delete(mContactUrl, exclusion.getSelection(), exclusion.getSelectionArgs());

    // remove all blocked contacts for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    exclusion = new Exclusion(Imps.BlockedList.USERNAME, mValidatedBlockedContacts);
    Uri.Builder builder = Imps.BlockedList.CONTENT_URI.buildUpon();
    ContentUris.appendId(builder, mProviderId);
    ContentUris.appendId(builder, mAccountId);
    Uri uri = builder.build();
    mResolver.delete(uri, exclusion.getSelection(), exclusion.getSelectionArgs());

    // remove all contact lists for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    exclusion = new Exclusion(Imps.ContactList.NAME, mValidatedContactLists);
    builder = Imps.ContactList.CONTENT_URI.buildUpon();
    ContentUris.appendId(builder, mProviderId);
    ContentUris.appendId(builder, mAccountId);
    uri = builder.build();
    mResolver.delete(uri, exclusion.getSelection(), exclusion.getSelectionArgs());
  }
Ejemplo n.º 5
0
 @Override
 public StandardExpander remove(RelationshipType type) {
   Map<String, Exclusion> exclude = new HashMap<String, Exclusion>();
   exclude.put(type.name(), Exclusion.ALL);
   return new ExcludingExpander(Exclusion.include(direction), exclude);
 }
Ejemplo n.º 6
0
 @Override
 public Boolean visit(Exclusion<T> pExclusion, MemoryLocation pParameter) {
   return pExclusion.getExcluded().accept(this, pParameter);
 }