Exemple #1
0
 VirtualTypeRelNode(int snumber, int dnumber, int rnumber) {
   super(VirtualTypeRel.getVirtualTypeRel(TypeRel.this));
   setValue("snumber", snumber);
   setValue("dnumber", dnumber);
   setValue("rnumber", rnumber);
   values = Collections.unmodifiableMap(values); // make sure it is not changed any more!
 }
Exemple #2
0
    SortedSet<MMObjectNode> getBySourceDestinationRole(int source, int destination, int role) {
      // determine minimum value - corrects in case '-1' (common MMBase value for N.A.) is passed
      int roleMin = role <= 0 ? 0 : role;
      int destinationMin = destination <= 0 ? 0 : destination;
      int sourceMin = source <= 0 ? 0 : source;

      // determine maximum value
      int roleMax = role <= 0 ? 0 : role + 1; // i.e. source, destination, role
      int destinationMax =
          role <= 0 ? destinationMin + 1 : destinationMin; // i.e. source, destination, 0
      int sourceMax =
          (destination <= 0 && role <= 0)
              ? (sourceMin <= 0 ? 0 : sourceMin + 1)
              : sourceMin; // i.e. source, 0, 0

      VirtualTypeRelNode fromTypeRelNode =
          new VirtualTypeRelNode(sourceMin, destinationMin, roleMin);
      VirtualTypeRelNode toTypeRelNode = new VirtualTypeRelNode(sourceMax, destinationMax, roleMax);

      if (log.isDebugEnabled()) {
        log.debug(" " + fromTypeRelNode + " " + toTypeRelNode);
      }
      SortedSet<MMObjectNode> allowed = subSet(fromTypeRelNode, toTypeRelNode);
      return Collections.unmodifiableSortedSet(allowed);
    }
Exemple #3
0
    SortedSet<MMObjectNode> getByDestinationSourceRole(int source, int destination, int role) {
      // determine minimum value - corrects in case '-1' (common MMBase value for N.A.) is passed
      int roleMin = role <= 0 ? 0 : role;
      int sourceMin = source <= 0 ? 0 : source;
      int destinationMin = destination <= 0 ? 0 : destination;

      // determine maximum value
      int roleMax = role <= 0 ? 0 : role + 1; // i.e. source, destination, role
      int sourceMax =
          role <= 0 ? (source <= 0 ? 0 : source + 1) : source; // i.e. source, destination, 0
      int destinationMax =
          (source <= 0 && role <= 0) ? destination + 1 : destination; // i.e. 0, destination, 0

      final VirtualTypeRelNode fromTypeRelNode =
          new VirtualTypeRelNode(sourceMin, destinationMin, roleMin);
      final VirtualTypeRelNode toTypeRelNode =
          new VirtualTypeRelNode(sourceMax, destinationMax, roleMax);

      final SortedSet allowed = subSet(fromTypeRelNode, toTypeRelNode);
      return Collections.unmodifiableSortedSet(allowed);
    }
Exemple #4
0
 /**
  * An enumeration of all allowed relations between two builders. No distinction is made between
  * source and destination.
  */
 public Enumeration<MMObjectNode> getAllowedRelations(int builder1, int builder2) {
   Set<MMObjectNode> res =
       getAllowedRelations(builder1, builder2, 0, RelationStep.DIRECTIONS_BOTH);
   return Collections.enumeration(res);
 }
Exemple #5
0
 public Enumeration<MMObjectNode> getAllowedRelations(int otype) {
   Set<MMObjectNode> res = getAllowedRelations(otype, 0, 0, RelationStep.DIRECTIONS_BOTH);
   return Collections.enumeration(res);
 }