text
stringlengths
14
410k
label
int32
0
9
public static int search(int[] A, int target) { int len = A.length; int low = 0; int high = len - 1; while (low <= high) { int mid = (high + low) / 2; int val = A[mid]; if (val == target) { return mid; } if (A[mid] >= A[low]) { ...
7
public boolean isEspecial() { return especial; }
0
public ObjectProperty getObjectProperty(OntModel model) { return model.createObjectProperty(getUri()); }
0
private Server(User user, Socket s, String name){ this.user = user; this.s = s; try { addUser(s, name); oin = new ObjectInputStream(s.getInputStream()); } catch (Exception e){ e.printStackTrace(); } setDaemon(true); setPriorit...
1
public static void initLayout(){ /*Math and Layout below this line, pass at your own risk ----------------------------------------------------------*/ { int rows[] = new int[34]; for(int x = 0; x < rows.length; x++){ rows[x] = (Height/rows.length)/2; } int columns[] = new int[60]; for(int x = 0...
2
@Override public int compareTo(Object arg0) { if (!(arg0 instanceof TargetTransition)) throw new ClassCastException(); TargetTransition t0 = (TargetTransition) arg0; int compareActions = this.action.compareTo(t0.action); if (compareActions != 0) return compareActions; else return this.invoke.compar...
2
public CostReadings readReadings(JsonReader reader) throws IOException { Number period = null; Number cost = null; Number energy = null; String ts = null; reader.beginObject(); while (reader.hasNext()) { String key = reader.nextName(); if (key.equals("period")) { pe...
5
static void initialization() { if (initialized == false) { for (int i = 0; i <= sizeOfMemInt; i++) { if ((i < rootSize) || ((i >= (rootSize + FATSize)) && i < sizeOfMemInt)) { setMem(i, 0); } if (i >= rootSiz...
8
public int filterRGB(int fx, int fy, int argb) { fx -= x; fy -= y; if( fx < 0 || fy < 0 || fx >= w || fy >= h) return argb; int d = data[fx + w*fy]; return (d < 0) // first bit set -> opaque ? d : argb; }
5
@Override public int compareTo(TLValue that) { if(this.isNumber() && that.isNumber()) { if(this.equals(that)) { return 0; } else { return this.asDouble().compareTo(that.asDouble()); } } else if(this.isString() && that.isString()) { return this.asString().compa...
5
public Hand getActiveHand() { for (Hand hand : hands) { if (hand.isActive()) { return hand; } } return null; }
2
public void addAgent(){ Random rand = new Random(); int x; int y; for(Integer i = 0;i < ((EnvironnementParticule)environment).nb_agent;i++){ //on les place dans un coin au hazard (attention boucle infini si + d'Agent que de case) do{ x = rand.nextInt(environment.taille_envi); y = rand.nextInt(enviro...
4
public static void select(JoeTree tree, OutlineLayoutManager layout, int type) { Node node = null; Node youngestNode = null; Node oldestNode = null; switch(type) { case UP: youngestNode = tree.getYoungestInSelection(); node = youngestNode.prevSibling(); if (node == youngestNode) {return;} ...
8
public static void addTiles(Tile[][] tiles, int startX, int startY, String path, List<Tile> spawnPoints) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { InputStream is = classLoader.getResourceAsStream(path); BufferedReader reader; if(is == null) { reader = new Buff...
7
private static double[] discreteAverage (double[] values, PricingVector pricing, double awareness, double sensitivity) { // Initialize the auxiliary variables. double temp = 0; double sum = 0; double overDiff = 0, overDiffTemp = 0; int start, end; double newPrice; int durationCheapest = 0; // Find...
7
public List<CreditProgram> getActivePrograms() { //Создаем результирующий список List<CreditProgram> resultList = new ArrayList<CreditProgram>(); try { //Создаем запрос к БД Statement statement = getConnection().createStatement(); ResultSet result = statement....
2
private void triangulate(int[] sides) { boolean[] discard = new boolean[sides.length]; int index = 0; for (int i = 0; i < sides.length - 2; i++) { int[] tri = new int[3]; for (int j = 0; j < 3; j++) { if (index < sides.length) { if (!discard[index]) { tri[j] = sides[index]; } else { ...
6
public void readDirectory(File currentDir){ if(currentDir == null || currentDir.isHidden()){ return; } if(fileExtension == null){ fileExtension = ""; } if (currentDir.isFile() && (currentDir.getName().endsWith(fileExtension))) { readFile(currentDir); } if (currentDir.isDirectory()) { File[...
7
private void drawData() { worker.setAntiAliasing(gdef.antiAliasing); worker.clip(im.xorigin, im.yorigin - gdef.height - 1, gdef.width, gdef.height + 2); double[] x = xtr(dproc.getTimestamps()); double[] lastY = null; double[] bottomY = null; for (Map.Entry<PlotElement, I...
9
public void getList(int rep) { String tempQuery = ""; if(rep == 0) { tempQuery = DEFAULT_QUERY; } else if(rep == 1) { tempQuery = ""; } Statement stmt = null; this.connect(); conn = this.getConnection(); try { ...
6
protected void setPieceDims() { int wmax = -1; int hmax = -1; for (int i = 0; i < body.length; i++) { if (body[i].x > wmax) wmax = body[i].x; if (body[i].y > hmax) hmax = body[i].y; } width = wm...
3
public boolean transferOwnership(String regionName, String newOwner, World world) { // World world = Bukkit.getServer().getWorld("world"); ProtectedRegion target = _plugin.WORLDGUARD.getGlobalRegionManager().get(world).getRegion(regionName); String currentOwner = getOwnerName(regionName, world); boolean ret; i...
6
@Override public UserVo getUser(String email, String password) { Connection con = null; PreparedStatement stmt = null; ResultSet rs = null; try{ con = dataSource.getConnection(); stmt = con.prepareStatement( "select UNO, EMAIL, PWD, NAME, TEL" + " from SE_USERS" + " where EMAIL=? and PWD...
5
public boolean isInitialized() { return this.initialized; }
0
@Test public void findsShortestPath3() { Tree<Vertex> vertices = new Tree<>(new VertexComparator()); Vertex v1 = new Vertex(0,0); Vertex v2 = new Vertex(1,0); Vertex v3 = new Vertex(1,1); Vertex v4 = new Vertex(2,1); Vertex v5 = new Vertex(2,2); Vertex v6 ...
3
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
9
@Override public void paintComponent(Graphics g){ //de paintComponent die alle Blokken in de blokken-HashMap op de juiste plaats zal painten super.paintComponent(g); int breedte = Constanten.BLOKGROOTTE; int hoogte = Constanten.BLOKGROOTTE; for(Positie pos : blokken.keySet()){ ...
6
protected Color parseRGBColor(String str) { if (RGB_COLOR.matcher(str).find()) return parseRGBA(str); if (RGBA_COLOR.matcher(str).find()) return parseRGBA(str); if (str.startsWith("0x")) { try { return new Color(Integer.valueOf(str.substring(2), 16)); } catch (NumberFormatException e) { out...
7
public void executionFinished() { executionFinished = true; }
0
public String[] getImageLinks(String Make, String Model) { String searchText = Make + " " + Model; searchText = searchText.replaceAll(" ", "+"); String[] links = new String[1]; String key="AIzaSyDUmEpoEHSYB-pBKrM_slE2KmTyX_LJGwk"; String cx = "004334298273927197431:bennqbfbvec"; URL url; try { url = ne...
5
public String getNewVariableWithLambdaProduction(Grammar grammar, Set lambdaSet) { String[] variables = grammar.getVariables(); for (int k = 0; k < variables.length; k++) { if (!lambdaSet.contains(variables[k]) && isVariableWithLambdaProduction(variables[k], grammar)) { return variables[k]; } } ...
3
@Override public Object getValueAt(int rowIndex, int columnIndex) { switch(columnIndex){ case 0: return list.get(rowIndex).getOutputSpEmployeeTargetPK().getSzYear(); case 1: return list.get(rowIndex).getOutputSpEmployeeTargetPK().getSzMonth(); ...
4
public ArrayList<String> cbProjetos() throws SQLException { ArrayList<String> Projeto = new ArrayList<>(); Connection conexao = null; PreparedStatement comando = null; ResultSet resultado = null; try { conexao = BancoDadosUtil.getConnection(); comando =...
7
@Override public void build() { if (eastLonBound <= westLonBound) { throw new ExceptionInvalidParam("East bound <= West bound"); } if (northLatBound <= southLatBound) { throw new ExceptionInvalidParam("North bound <= South bound"); } if (destWidth <= 0...
9
public void printOut(){ File file=new File(name); PrintWriter myout; try{ myout=new PrintWriter(new FileOutputStream(file)); myout.println("<mapfile bitmap=\""+mygraph.getImageName()+"\" scale-feet-per-pixel=\""+mygraph.getScale()+"\">"); for(int i=0;i<mygraph.getCurr();i++){ myout...
6
protected TreeNode<K, D> predecessor(TreeNode<K, D> node) { if (!isNil(node.getLeftChild())) { return getMaxNode(node.getLeftChild()); } TreeNode<K, D> parent = node.getParent(); while (!isNil(parent) && node == parent.getLeftChild()) { node = parent; ...
3
public void addGraph(final Graph graph) { if (graph == null) { throw new IllegalArgumentException("Graph cannot be null"); } graphs.add(graph); }
1
private BandCholesky decompose(AbstractBandMatrix A) { if (n != A.numRows()) throw new IllegalArgumentException("n != A.numRows()"); if (upper && A.ku != kd) throw new IllegalArgumentException("A.ku != kd"); if (!upper && A.kl != kd) throw new IllegalArgumentE...
9
public static double swap(TailContainer<Plane> sol, double temperature) { for (Plane pi : sol.getRecords()) { for (Plane pj : sol.getRecords()) { if (pi != pj){ for (int i = 0; i < pi.getSchedule().size(); i++) { for (int j = 1; j < pj.getSchedule().size(); j++) { // Are these two swapable at...
9
public void update(double percent) { if (percent > 1) { dispose(); return; } message.setText(loadingMessage + Math.round(percent * 100) + " %"); Stage st = (Stage) scene.getWindow(); st.setTitle("Loading..." + Math.floor(percent * 100)); }
1
public ChatMessage(String authorId, String message) { this.authorId = authorId; this.message = message; time = new Date(); }
0
public void stopAllRunningModels() { if (map.isEmpty()) return; synchronized (map) { for (ModelCanvas mc : map.values()) { if (mc.getMdContainer() instanceof AtomContainer) { if (((AtomContainer) mc.getMdContainer()).hasDNAScroller()) ((AtomContainer) mc.getMdContainer()).stopDNAAnimation(); ...
7
public double getDouble(String key) throws JSONException { Object o = get(key); try { return o instanceof Number ? ((Number)o).doubleValue() : Double.valueOf((String)o).doubleValue(); } catch (Exception e) { throw new JSONException("JSONObj...
2
public void find(int mode, String searchby, Object keyfield, String keyword, int sort) { String searchstring = searchby + "Search=" + convert(keyword) + "&mode=" + MODES[mode] + "&type=lite" + ((sort == -1) ? "" : ("&sort=" + getSort(MODES[mode])[sort])); // add the new keyword to the list boolean cache...
8
public void debugDisplay(String val) { if (isVisible()) { __debug = true; parentRepaint(); getFather().hideToolTip(__tooltip); if (val != null && val.length() > 0) { if (val.length() > 10) { val = val.substring(0, 7) + "..."; } OVNode n = getOutNode(); if (n != null && n.visible()) { ...
8
public boolean accept(File f) { if (f.isDirectory()) return true; String fname = f.getName(); int lastSlash = fname.lastIndexOf("."); if (lastSlash < 0) return false; String extension = fname.substring(lastSlash + 1); if (extension != null) { if (extension.equalsIgnoreCase("json")) { ...
4
@SuppressWarnings("unchecked") private void tuesdayCheckActionPerformed(java.awt.event.ActionEvent evt) { if(this.dayChecks[2].isSelected()) { this.numSelected++; if(this.firstSelection) { stretch(); } ...
4
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed this.setVisible(false); }//GEN-LAST:event_jButton1ActionPerformed
0
private double[] refactorDistApart(double[] distApart, double threshold) { for (int i = 0; i < window; i++) { distApart[i] = threshold; } for (int i = distApart.length - window; i < distApart.length; i++) { distApart[i] = threshold; } for (int i = 0; i <...
9
public static void openUserProfile(User user) { if(user == null) return; final Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if(desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) try { if(user.getUsername().equalsIgnoreCase("")) return; desktop.br...
6
TupleNode parseTuple(SeekableStringReader sr) { //tuple = tuple_empty | tuple_one | tuple_more //tuple_empty = '()' . //tuple_one = '(' expr ',' <whitespace> ')' . //tuple_more = '(' expr_list trailing_comma ')' . // trailing_comma = '' | ',' . sr.read(); // ( sr.skipWhitespace...
8
public int compareTo(Piece other) { if (this == other) { return 0; } if (this.seen < other.seen) { return -1; } else { return 1; } }
2
@Override public int uniqueWordsCount() { int count = 0; for(Map.Entry<String, Integer> entry : storage.entrySet()) { if(entry.getValue() == 1) { count ++; } } return count; }
2
public void aimEnemy() { int x = Math.abs(me.getX() - nearestEnemy.getX()); int y = Math.abs(me.getY() - nearestEnemy.getY()); double result = Math.toDegrees(Math.atan((double)y / (double)x)); if(nearestEnemy.getX() <= me.getX() && nearestEnemy.getY() <= me.getY()) { result =...
6
public void sendChat(String message) { try { byte[] sendBuffer = ("type:chat\nmsg:" + message + "\n").getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendBuffer, sendBuffer.length, ip, port); sock.send(sendPacket); } catch (Exception e) { } }
1
@Override public ByteBuffer getData() { int dataOffset = 0; // TODO ByteBuffer buffer = ByteBuffer.allocate(100); // TODO if (name != null) { buffer.putInt(dataOffset | 0x80000000); int stringoffset = dataOffset; ByteBuffer strbuf = ByteBuffer.allocate(na...
5
public void draw(Vector2f camera, Vector2f pos, PlayerState ps){ float tempX = pos.getX(); float tempY = pos.getY(); tempX = TileUtil.toIsoX(pos.getX(), pos.getY()) + camera.getX() - 32; tempY = TileUtil.toIsoY(pos.getX(), pos.getY()) + camera.getY() - 57; switch (ps){ case WALK_DOWN: case WALK_LEFT...
4
public void doSearch() { for (int i = 0; i < mThreadNum; i++) { new Thread(new Runnable() { @Override public void run() { while (true){ mListener.parseH5(); } } }).start(); ...
2
@Override public Map<TKey<?, ?>, List<Class<? extends Enum<?>>>> getRelationTargets(TKey<?, ?> key) { return validRelations.get(key); }
6
public int[] bubbleSort(int[] pZahlen) { for (int i = 0; i < pZahlen.length; i++) { for (int j = 0; j < pZahlen.length - 1; j++) { if (pZahlen[j] > pZahlen[j + 1]) { int lBuffer = pZahlen[j]; pZahlen[j] = pZahlen[j + 1]; pZa...
3
@Override public void setLoggerName(String loggerName) { this.loggerName = loggerName; }
0
public void lineDetection() { ArrayList<Integer> numbLigne = new ArrayList<Integer>(); int count = 0; for(int i=0; i < tab.length; i++) { count = 0; for(int j=0; j < tab[0].length; j++) { if(tab[i][j].getValue() != 0) { count++; } if(count == 10) { numbLigne.add(i); } } } i...
9
public static SelectItem[] getSelectItems(List<?> entities, boolean selectOne) { int size = selectOne ? entities.size() + 1 : entities.size(); SelectItem[] items = new SelectItem[size]; int i = 0; if (selectOne) { items[0] = new SelectItem("", "---"); i++; ...
4
public void searchLogradouro() { facesContext = FacesContext.getCurrentInstance(); requestContext = RequestContext.getCurrentInstance(); if (selectBtnSearchBairro == true && this.bairro.getCidade() != null) { List<Logradouro> listLogradouro; try { lograd...
5
public int getAttackDamageBonus(Entity e) { if (type == ToolType.axe) { return (level + 1) * 2 + random.nextInt(4); } if (type == ToolType.sword) { return (level + 1) * 3 + random.nextInt(2 + level * level * 2); } return 1; }
2
public static Moves getFightingMovesRound1(BotState state, int armiesForFighting) { Moves out = new Moves(); List<Region> southAmericaBorderRegions = new ArrayList<>(); List<Region> australiaBorderRegions = new ArrayList<>(); SuperRegion australia = state.getVisibleMap().getSuperRegion(6); SuperRegion southAm...
5
@Override public String toString() { if(ouder1 != null && ouder2 != null) return this.ouder1.toString() + " & " + this.ouder2.toString(); else if(ouder1 != null) return this.ouder1.toString(); else if (ouder2 != null) return this.ouder2.toStrin...
4
public UndoQueueEvent(Document doc, int type) { setDocument(doc); setType(type); }
0
public static void main(String[] args) throws InterruptedException { ArrayList<Integer> list = new ArrayList<>(); ExecutorService executor = Executors.newCachedThreadPool(); Future<Integer> future; for (int i = 1; i < 10; i++) { future = executor.submit(new MyCallable(i)); ...
3
public static boolean checkDataIntegrity(int gameVersion, byte[] data, int offset, int expectedNewOffset) { offset = 0; try { offset += BLANK_MAX_LENGTH; offset += DEFAULT_ODM_MAX_LENGTH; if ((GameVersion.MM6 == gameVersion) || (GameVersion.MM7 ==...
8
public static void main(String[] args) { int total = 0; for (int i : primeSieve(1000000)) { if (i < 10) { continue; } if (isPrime(i)) { boolean flag = true; for (int j = 1; j < Integer.toString(i).length(); j++) { ...
9
public void executeQuery(String supplierName) { CachedRowSet coffees = null; CachedRowSet suppliers = null; JoinRowSet jrs = null; try { coffees = new CachedRowSetImpl(); coffees.setCommand("SELECT * FROM COFFEES"); coffees.execute(connection); ...
7
private void setDiceArray(FieldCircularList[] map) { int index; FieldCircularList[] diceArray; for(int i = 0; i < map.length; i++) { diceArray = new FieldCircularList[11]; for(int j = 0; j < diceArray.length; j++) { index = i + 2 + j; if(index >= map.length) { index -= map.length; } d...
3
public String longestPalindrome(String s) { // Start typing your Java solution below // DO NOT write main() function int maxi = 0; int max = 0; StringBuilder sb = new StringBuilder(); sb.append('\001'); for (int i = 0; i < s.length(); i++) { sb.append(s.charAt(i)); sb.append('\001'); } String ss...
9
public int getDeathYear() { return (death == null || death.getDate() == null) ? 0 : death.getDate().getYear(); }
2
public void update(DeltaState deltaState) { if (!this.getScene().getSystemPause() && this.getScene().getPlayState()) { if (this.cantidadDeVidas <= 0) { this.morir(); } else { if (this.cantidadDeVidas < 7) { intervaloDeAccion = 80; } this.getScene().bossMataBrosEnElCamino(this); if (th...
9
public static int gcd(int a, int b) { if(b == 0) { return a; } return gcd(b, a % b); }
1
public static double[][] computeDistance(Artist[] artists,DatabaseConnector db){ int na=artists.length; double[][] dist=new double[na][na]; double[][] var=new double[na][na]; String stringArtists=""; int p=0; HashMap<String,Integer> artistMap=new HashMap<String,Integer>(); for(Artist a:artists){ if(p>0...
9
public String build(List<Integer> list) { for(Integer i : list) { if (i > 0 && i <= 3) { firstRow = buildRow(i, firstRow); } else if (i > 3 && i <= 6) { secondRow = buildRow(i-3, secondRow); } else if (i > 6 && i <= 9) { thirdR...
7
public ShopElement[] getShopListInfo(){ ShopElement[] finalList = new ShopElement[shopListArr.length]; //Since a SAX XML parser reads a file from the beginning to end, //we need to sort the current shopList array in ascending order to read the XML file //from the beginning. if(isSorted)...
4
public Job createJob(Element eElement) { Job job = new Job(eElement.getAttribute("name"),eElement.getAttribute("description")); if(eElement.hasChildNodes()){ NodeList list = eElement.getChildNodes(); for(int i = 0; i < list.getLength(); i++){ Nod...
8
public UncheckedBinding outbound(UncheckedBinding outBinding) { UncheckedBinding inBinding = outBinding; if (outBinding == null) return null; if (outBinding.getObj() == null) { inBinding = new Binding<Timestamp>(Timestamp.class, null); } if (Time.class == ...
5
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { this.inputCounter -= delta; Input input = gc.getInput(); mouse.x = input.getMouseX(); mouse.y = input.getMouseY(); boolean click = input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON); if (inputC...
8
public void start() { conversation.start(); while (true) { Message msg = conversation.getMessage(); ui.addMessage(msg); if (playSound()) { GoogleVoice v = voices.get(msg.bot); v.read(msg.msg); } ...
2
public double getMean(){ return mean; }
0
@Override public void print() throws AnimalException { System.out.println("\tInformatii animal:"); if (this.getNumeAnimal() == null) throw new AnimalException("Animal's name is invalid!"); if (this.getOrigine() == null) throw new AnimalException("Country's name is invalid!"); if (numeRezervatie == nul...
5
@Override public void setMode(EditorMode mode) { if (mode == EditorMode.DEBUG) { interpreter_.setDebug(true); } else { interpreter_.setDebug(false); } this.mode_ = mode; for (String s : settings_.keySet()) { for (Setting stg : settings_.get(s)) { stg.setMode(getMode()); } } if (mode_ != ...
5
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || !(obj instanceof Person)) return false; Person other = (Person)obj; if(other.getId() != getId() || !Helper.compareObjects(this.getVorname(), other.getVorname()) || !Helper.compareObjects(this.getNachname(),...
7
public String concatenate(String one, String two){ return one + two; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Utilisateur other = (Utilisateur) obj; if (nom == null) { if (other.nom != null) return false; } else if (!nom.equals(other.nom)) { r...
6
public static void save(String filename, double[] input) { // assumes 44,100 samples per second // use 16-bit audio, mono, signed PCM, little Endian AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false); byte[] data = new byte[2 * input.length]; for (int i = 0; i...
6
@Override public Datagram onReceive(Datagram datagram) { RemoteObjectReference remoteObjectReference; RegistryMessage registryMessage; if (datagram.type.equals(Datagram.DatagramType.DATAGRAM_BIND)) { registryMessage = (RegistryMessage) datagram.body; String name = (S...
8
private void constraint_31B() throws IOException { for (int k = 1; k <= NUM_VARS; k++) { for (int m = 1; m <= SQUARE_SIZE; m += 3) { for (int n = 1; n <= SQUARE_SIZE; n += 3) { int p = 0; // place box row by row into a an array to create one...
7
public void ordenarListaRequerimientos(GrafoTabla Grafico){ ArrayList <Requerimiento> ListaAuxiliar = new ArrayList(); ArrayList <Double> ListaAuxiliarDouble = new ArrayList(); int nodo_aux = 0; double distancia_ref; double distancia; ...
6
@Override public Tile getTile(Tile source, Direction dir) { int x = source.getX(); int y = source.getY(); switch(dir) { case NORTH: y--; break; case SOUTH: y++; break; case EAST: x++; break; case WEST: x--; break; } return tiles[x][y]; }
4
public static void assertEquals(String message, Object expected, Object actual) { if (!assertionsEnabled) { return; } // If one but not both of the objects are null, fail. String failureMessagePostfix = ": Expected <"+expected+"> but had <"+actual+">."; if ((expected == null && actual != null) || (expec...
8
public void setProperty(String key, Object value) { if (properties == null) { properties = new HashMap<String, Object>(); } properties.put(key, value); }
1
@Override public void delete(Key key) { int i = hash(key); if (st[i].contains(key)) // Note: More efficient using than // contains(key) as // duplicate calculation of hash(key) not // involved N--; st[i].delete(key); if (M > INIT_CAPACITY && N <= 2 * M) resize(M / 2); }
3
public static NaturalSetCollection intersect(NaturalSetCollection a, NaturalSetCollection b) throws NaturalSetException{ NaturalSetCollection intersect = null; if(b.domain.equals(a.domain)){ intersect = new NaturalSetCollection(b.domain); ArrayList<NaturalSet> first = b.elements, second = a.elements; in...
9
public void body() { initializeResultsFile(); // create new files for statistics createGridlet(NUM_GRIDLETS); // create gridlets // send a reminder to itself at time init_time, with a message to // submit Gridlets. super.send(super.get_id(), GridSimTags.SCHEDULE_NO...
5