Create 2 sets for test (this real life anology is wacked now)
329061
function createSets() {
        self.indoorSet = new self.StoogeSet();
        self.indoorSet.set('name', 'indoor');
        self.desertSet = new self.StoogeSet();
        self.desertSet.set('name', 'desert');
        spec.integrationStore.putModel(self.indoorSet, function (model, error) {
          if (typeof error != 'undefined') {
            callback(error);
          } else {
            spec.integrationStore.putModel(self.desertSet, function (model, error) {
              if (typeof error != 'undefined') {
                callback(error);
              } else {
                createLines();
              }
            });
          }
        });
      }
432170
def make_data_splits(self, max_samples, valid_story=None, test_story=None):
        """"""
        # TODO Make this also work with wordlists.
        if valid_story or test_story:
            if not (valid_story and test_story):
                raise PersephoneException(
                    "We need a valid story if we specify a test story "
                    "and vice versa. This shouldn't be required but for "
                    "now it is.")

            train, valid, test = make_story_splits(valid_story, test_story,
                                                   max_samples,
                                                   self.label_type,
                                                   tgt_dir=str(self.tgt_dir))
        else:
            train, valid, test = make_data_splits(self.label_type,
                                                  train_rec_type=self.train_rec_type,
                                                  max_samples=max_samples,
                                                  tgt_dir=str(self.tgt_dir))
        self.train_prefixes = train
        self.valid_prefixes = valid
        self.test_prefixes = test
586632
public void buildNewReferenceSet2() {
    for (int i = 0; i < getPopulation().size(); i++) {
      DoubleSolution individual = getPopulation().get(i);
      double distanceAux = SolutionUtils
          .distanceToSolutionListInSolutionSpace(individual, referenceSet1);
      distanceToSolutionListAttribute.setAttribute(individual, distanceAux);
    }

    int size = referenceSet2Size;
    if (getPopulation().size() < referenceSet2Size) {
      size = getPopulation().size();
    }

    for (int i = 0; i < size; i++) {
      // Find the maximumMinimumDistanceToPopulation
      double maxMinimum = 0.0;
      int index = 0;
      for (int j = 0; j < getPopulation().size(); j++) {

        DoubleSolution auxSolution = getPopulation().get(j);
        if (distanceToSolutionListAttribute.getAttribute(auxSolution) > maxMinimum) {
          maxMinimum = distanceToSolutionListAttribute.getAttribute(auxSolution);
          index = j;
        }
      }
      DoubleSolution individual = getPopulation().get(index);
      getPopulation().remove(index);

      // Update distances to REFSET in population
      for (int j = 0; j < getPopulation().size(); j++) {
        double aux = SolutionUtils.distanceBetweenSolutionsInObjectiveSpace(getPopulation().get(j), individual);

        if (aux < distanceToSolutionListAttribute.getAttribute(individual)) {
          DoubleSolution auxSolution = getPopulation().get(j);
          distanceToSolutionListAttribute.setAttribute(auxSolution, aux);
        }
      }

      // Insert the individual into REFSET2
      marked.setAttribute(individual, false);
      referenceSet2.add(individual);

      // Update distances in REFSET2
      for (int j = 0; j < referenceSet2.size(); j++) {
        for (int k = 0; k < referenceSet2.size(); k++) {
          if (i != j) {
            double aux = SolutionUtils.distanceBetweenSolutionsInObjectiveSpace(referenceSet2.get(j), referenceSet2.get(k));
            DoubleSolution auxSolution = referenceSet2.get(j);
            if (aux < distanceToSolutionListAttribute.getAttribute(auxSolution)) {
              distanceToSolutionListAttribute.setAttribute(auxSolution, aux);
            }
          }
        }
      }
    }
  }
1229462
function makeOrWithInAndRange(inSet, rangeSet) {
	if(rangeSet instanceof is.Or) {
		var firstResult = makeOrWithInAndRange(inSet, rangeSet.values[0]);
		if( !(firstResult instanceof is.Or) ) {
			return set.union(firstResult, rangeSet.values[1]);
		}
		var secondResult = makeOrWithInAndRange(inSet, rangeSet.values[1]);
		if( !(secondResult instanceof is.Or) ) {
			return set.union(secondResult, rangeSet.values[0]);
		}
		return makeOr([inSet, rangeSet]);
	} else {
		if(rangeSet instanceof is.GreaterThan) {
			return combineValueWithRangeCheck(inSet, rangeSet, is.GreaterThanEqual);
		}
		if(rangeSet instanceof is.LessThan) {
			return combineValueWithRangeCheck(inSet, rangeSet, is.LessThanEqual);
		}
		return makeOr([inSet, rangeSet]);
	}
}
55371
public static <E> Set<E> unionView(final Set<? extends E> set1, final Set<? extends E> set2) {
		return Sets.union(set1, set2);
	}
1065653
Set<E> union(final SmallSet<E> s) {
        if ((s.e1 == e1 && s.e2 == e2) || (s.e1 == e2 && s.e2 == e1)) {
            return this; // if the two sets are equal, return this
        }
        if (s.e1 == null) {
            return this; // if s is empty, return this
        }
        if (e1 == null) {
            return s; // if this is empty, return s
        }
        if (s.e2 == null) { // s contains exactly one element
            if (e2 == null) {
                return new SmallSet<E>(e1, s.e1); // necessarily e1 != s.e1
            } else if (s.e1 == e1 || s.e1 == e2) { // s is included in this
                return this;
            }
        }
        if (e2 == null) { // this contains exactly one element
            // if (s.e2 == null) { // cannot happen
            // return new SmallSet(e1, s.e1); // necessarily e1 != s.e1
            // } else
            if (e1 == s.e1 || e1 == s.e2) { // this in included in s
                return s;
            }
        }
        // here we know that there are at least 3 distinct elements
        HashSet<E> r = new HashSet<E>(4);
        r.add(e1);
        if (e2 != null) {
            r.add(e2);
        }
        r.add(s.e1);
        if (s.e2 != null) {
            r.add(s.e2);
        }
        return r;
    }
871825
def frombools(cls, bools):
        """"""
        return cls.frombitsets(map(cls.BitSet.frombools, bools))
1295107
function() {
  var num_classes = net.layers[net.layers.length-1].out_depth;

  document.getElementById('testset_acc').innerHTML = '';
  var num_total = 0;
  var num_correct = 0;

  // grab a random test image
  for(num=0;num<4;num++) {
    var sample = sample_test_instance();
    var y = sample.label;  // ground truth label

    // forward prop it through the network
    var aavg = new convnetjs.Vol(1,1,num_classes,0.0);
    // ensures we always have a list, regardless if above returns single item or list
    var xs = [].concat(sample.x);
    var n = xs.length;
    for(var i=0;i<n;i++) {
      var a = net.forward(xs[i]);
      aavg.addFrom(a);
    }
    var preds = [];
    for(var k=0;k<aavg.w.length;k++) { preds.push({k:k,p:aavg.w[k]}); }
    preds.sort(function(a,b){return a.p<b.p ? 1:-1;});
    
    var correct = preds[0].k===y;
    if(correct) num_correct++;
    num_total++;

    var div = document.createElement('div');
    div.className = 'testdiv';

    // draw the image into a canvas
    draw_activations_COLOR(div, xs[0], 2); // draw Vol into canv

    // add predictions
    var probsdiv = document.createElement('div');
    
    var t = '';
    for(var k=0;k<3;k++) {
      var col = preds[k].k===y ? 'rgb(85,187,85)' : 'rgb(187,85,85)';
      t += '<div class=\"pp\" style=\"width:' + Math.floor(preds[k].p/n*100) + 'px; background-color:' + col + ';\">' + classes_txt[preds[k].k] + '</div>'
    }
    probsdiv.innerHTML = t;
    probsdiv.className = 'probsdiv';
    div.appendChild(probsdiv);

    // add it into DOM
    $(div).prependTo($("#testset_vis")).hide().fadeIn('slow').slideDown('slow');
    if($(".probsdiv").length>200) {
      $("#testset_vis > .probsdiv").last().remove(); // pop to keep upper bound of shown items
    }
  }
  testAccWindow.add(num_correct/num_total);
  $("#testset_acc").text('test accuracy based on last 200 test images: ' + testAccWindow.get_average());  
}
1209248
void create(Insets defInsets) {

        setLayout(new BorderLayout());
        addKeyListener(this);

        Panel p = new Panel(new GridLayout(6, 2, 10, 10));

        p.addKeyListener(this);
        p.setBackground(SystemColor.control);
        p.add(createLabel("Type:"));

        Choice types = new Choice();

        types.addItemListener(this);
        types.addKeyListener(this);

        for (int i = 0; i < sJDBCTypes.length; i++) {
            types.add(sJDBCTypes[i][0]);
        }

        p.add(types);
        p.add(createLabel("Driver:"));

        mDriver = new TextField("org.hsqldb_voltpatches.jdbcDriver");

        mDriver.addKeyListener(this);
        p.add(mDriver);
        p.add(createLabel("URL:"));

        mURL = new TextField("jdbc:hsqldb:mem:.");

        mURL.addKeyListener(this);
        p.add(mURL);
        p.add(createLabel("User:"));

        mUser = new TextField("SA");

        mUser.addKeyListener(this);
        p.add(mUser);
        p.add(createLabel("Password:"));

        mPassword = new TextField("");

        mPassword.addKeyListener(this);
        mPassword.setEchoChar('*');
        p.add(mPassword);

        Button b;

        b = new Button("Cancel");

        b.setActionCommand("ConnectCancel");
        b.addActionListener(this);
        b.addKeyListener(this);
        p.add(b);

        b = new Button("Ok");

        b.setActionCommand("ConnectOk");
        b.addActionListener(this);
        b.addKeyListener(this);
        p.add(b);
        setLayout(new BorderLayout());
        add("East", createLabel(" "));
        add("West", createLabel(" "));

        mError = new Label("");

        Panel pMessage = createBorderPanel(mError);

        pMessage.addKeyListener(this);
        add("South", pMessage);
        add("North", createLabel(""));
        add("Center", p);
        doLayout();
        pack();

        Dimension d    = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension size = getSize();

        if (d.width > 640) {
            setLocation((d.width - size.width) / 2,
                        (d.height - size.height) / 2);
        } else if (defInsets.top > 0 && defInsets.left > 0) {
            setLocation(defInsets.bottom, defInsets.right);
            setSize(defInsets.top, defInsets.left);

            // full size on screen with less than 640 width
        } else {
            setLocation(0, 0);
            setSize(d);
        }

        show();
    }
245177
function Set() {
            var set = this;
            set = emulateES6construct(set);
            if (!set._es6set) {
              throw new TypeError('bad set');
            }

            defineProperties(set, {
              '[[SetData]]': null,
              '_storage': emptyObject()
            });

            // Optionally initialize map from iterable
            var iterable = arguments[0];
            if (iterable !== undefined && iterable !== null) {
              var it = ES.GetIterator(iterable);
              var adder = set.add;
              if (!ES.IsCallable(adder)) { throw new TypeError('bad set'); }
              while (true) {
                var next = ES.IteratorNext(it);
                if (next.done) { break; }
                var nextItem = next.value;
                adder.call(set, nextItem);
              }
            }
            return set;
          }
690334
private static int compareSets(Object[] snapshot, Set<?> set) {
        // Uses O(n^2) algorithm, that is only appropriate for small
        // sets, which CopyOnWriteArraySets should be.
        //
        // Optimize up to O(n) if the two sets share a long common prefix,
        // as might happen if one set was created as a copy of the other set.

        final int len = snapshot.length;
        // Mark matched elements to avoid re-checking
        final boolean[] matched = new boolean[len];

        // j is the largest int with matched[i] true for { i | 0 <= i < j }
        int j = 0;
        outer: for (Object x : set) {
            for (int i = j; i < len; i++) {
                if (!matched[i] && Objects.equals(x, snapshot[i])) {
                    matched[i] = true;
                    if (i == j)
                        do { j++; } while (j < len && matched[j]);
                    continue outer;
                }
            }
            return -1;
        }
        return (j == len) ? 0 : 1;
    }
124955
def union_update(self, other):
        
        if not isinstance(other, Set):
            raise ValueError('other must be a Set instance')
        if self is other:
            return
        for item in other.items:
            self.add(item)
1026104
private void createNonPersistentSubsets()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "createNonPersistentSubsets");
    
    for(int i=0; i<subsets.length; i++)
    {
      createNonPersistentSubset(getReliability(i));
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createNonPersistentSubsets");
  }
96324
def issuperset(self, other):
        """"""
        self._binary_sanity_check(other)
        return set.issuperset(self, other)
912634
def mock_add_spec(self, spec, spec_set=False):
        """"""
        self._mock_add_spec(spec, spec_set)
        self._mock_set_magics()
703662
function(and1, and2) {
			var union1 = set.union(and1, and2.values[0]);
			var union2 = set.union(and1, and2.values[1]);

			if (isAndOrOr(union1) || isAndOrOr(union2)) {
				// try the other direction
				union1 = set.union(and2, and1.values[0]);
				union2 = set.union(and2, and1.values[1]);
			}
			if (isAndOrOr(union1) || isAndOrOr(union2)) {
				return new is.Or([and1, and2]);
			} else {
				return set.intersection(union1, union2);
			}

			/*
			var combo1 = [
					set.union(and1.values[0], and2.values[0]),
					set.union(and1.values[1], and2.values[1])
				],
				combo2 = [
					set.union(and1.values[0], and2.values[1]),
					set.union(and1.values[1], and2.values[0])
				];
			if(combo1.every(isUniversal)) {
				return set.intersection.apply(set, combo2);
			}
			if(combo2.every(isUniversal)) {
				return set.intersection.apply(set, combo1);
			}
			return new is.Or([and1, and2]);*/
		}
1317474
function _fixSet( set ){
  return (set |
      (( set & ~~BLEND_FUNC_A_SET   ) >>> 2 ) |
      (( set & ~~BLEND_EQ_A_SET     ) >>> 2 ) |
      (( set & ~~STENCIL_B_FUNC_SET ) >>> 3 ) |
      (( set & ~~STENCIL_B_OP_SET   ) >>> 3 ) |
      (( set & ~~STENCIL_B_MASK_SET ) >>> 3 )
    );
}