text
stringlengths
14
410k
label
int32
0
9
public Double calculateCost(Order order){ if(order == null){ System.out.println("Order is empty"); } double totalCost = 0; for(Pizza pizza : order.getPizzas()){ totalCost += pizza.getCost(); for(String topping : pizza.getToppings()){ Double toppingPrice = toppingsMenu.get(topping); if(toppingPr...
4
public void setUserSavedGame() { File file = new File("Users.txt"); String line = ""; FileWriter writer; ArrayList<String> userData= new ArrayList<String>(); ListIterator<String> iterator; try { Scanner s = new Scanner(file); while(s.hasNextLine()) { userData.add(s.nextLine()); } s...
9
@Override public void rightMultiply(IMatrix other) { // TODO Auto-generated method stub for(int i=0;i<4;i++) for(int j=0;j<4;j++) copy[i][j]=0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k); ...
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; @SuppressWarnings("unchecked") Entry<K,V> other = (Entry<K,V>) obj; if (k == null) { if (other.k != null) return false; } else if (!k....
6
public ArrayList<Reservation> ReservationsByCustomerForFranchise( int FranID, int CustID) throws UnauthorizedUserException, BadConnectionException, DoubleEntryException { /* Variable Section Start */ /* Database and Query Preperation */ PreparedStatement statment = null...
8
public boolean isValidPassword(String userName, String password) { try { LoginDao ds = new LoginDao(); String pwdFromDB = ds.getUserPassword(userName); if (null != pwdFromDB) { if (pwdFromDB.equals(password)) { return true; } } } catch (Exception ex) { if (!(ex instanceof DaoException))...
4
public void ensureConnection() throws AuthenticationException { BugLog.getInstance().assertNotNull(getConnection()); if (getConnection().isOpen()) { return; } // #69689 detect silent servers, possibly caused by proxy errors final Throwable ex[] = new Throwable[1]; ...
9
private MailUtil(){ };
0
@Override public void discoverChildren() { //super.discoverChildren(); Map<Date, VirtualFolder> datums = new HashMap<Date, VirtualFolder>(); Map<String, VirtualFolder> series = new HashMap<String, VirtualFolder>(); String xml = HTTPWrapper.Request("http://iptv.rtl.nl/xl/VideoItem/I...
7
public static void toggleCommentAndClear(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { toggleComment...
3
public void sendWertBerechnenX(int inputX, int inputY){ if(inputX >= 0){ //Positiv if(inputX <= 256){ posX1 = setPosWert(inputX); posX2 = 0; }else{ posX1 = 256; posX2 = setPosWert(inputX - 256); } } if(inputX < 0){ //Negativ if(inputX > -255){ negX1 = setNegWert(inputX); negX2 ...
8
@Override public double fun(double[] w) { double f = 0; double[] y = prob.y; int l = prob.l; int w_size = get_nr_variable(); double d; Xv(w, z); for (int i = 0; i < w_size; i++) f += w[i] * w[i]; f /= 2; for (int i = 0; i < l; i++...
4
public String getTooltipExtraText(final Province curr) { final int id = curr.getId(); if (!editor.Main.map.isLand(id)) return ""; String owner = mapPanel.getModel().getHistString(id, "owner"); String controller = mapPanel.getModel().getHistString(id, "controller"); ...
8
public static Map<Integer, Double> getResourcesFromUserWithBLL(List<Bookmark> trainData, List<Bookmark> testData, int userID, List<Map<Integer, Double>> bllValues) { Map<Integer, Double> resourceMap = new LinkedHashMap<Integer, Double>(); Map<Integer, Double> values = null; if (bllValues != null && userID < bllVa...
7
protected String removeHttpProtocol(String html) { //remove http protocol from tag attributes if(removeHttpProtocol) { Matcher matcher = httpProtocolPattern.matcher(html); StringBuffer sb = new StringBuffer(); while(matcher.find()) { //if rel!=external if(!relExternalPattern.matcher(matcher.group(0...
3
@Override public boolean login(String userID, String password) { // TODO Auto-generated method stub if(validate(userID)){ String[] userIds= (rb.getString("userIds")).split(" "); String[] passwords= (rb.getString("passwords")).split(" "); String[] status= (rb.getString("status")).split(" "); for (int i = 0;...
5
@Override public void destroy(VirtualMachine virtualMachine) throws Exception { if (status(virtualMachine).equals(VirtualMachineStatus.RUNNING)) { stop(virtualMachine); } IMachine machine = this.vbox.findMachine(virtualMachine.getName()); ISession session = getSession(virtualMachine); machine.lockMach...
5
public void crossReferenceMetaAnnotations() throws CrossReferenceException { Set<String> unresolved = new HashSet<String>(); Set<String> index = new HashSet<String>(); index.addAll(annotationIndex.keySet()); for (String annotation : index) { if (ignoreScan(annotation)) ...
8
@Override public Book readBook(String isbn) { if (doc == null) return null; Element currRoot = doc.getRootElement(); Element parrentBook = currRoot.getChild("books"); List<Element> listBooks = parrentBook.getChildren(); for (Element book : listBooks) { String bookIsbn = book.getChild("isbn").getText(...
3
private void printEnclosedStackTrace(PrintStreamOrWriter s, StackTraceElement[] enclosingTrace, String caption, String prefix, Set<Throwable> dejaVu) { assert Thread.holdsLock(s.lock()); if (dejaVu.contains(this)) { s.println("\t[CIRCULAR REFERENCE:" + this + "]"); } else { dejaVu.add(this); // Com...
8
public static EnumColumn getEnumColumn(int value) { for (EnumColumn column : EnumColumn.values()) { if (column.getPosition() == value) { return column; } } return null; }
2
protected void selectImageFilter(){ FileNameExtensionFilter imageFilter; imageFilter= new FileNameExtensionFilter("All files (*.*)","*.*"); switch(this.selectedExtensionImage){ case all: imageFilter = new FileNameExtensionFilter("All files (*.*)","*.*"); ...
6
public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1);...
1
public int checkLine(int[] line) { int i; boolean test = (line[0] == 0); for (i = 0; i < line.length; i++) { if ((line[i] == 0) != test) { break; } } if (i >= line.length) { return 0; // Ligne incomplète } else if (test)...
4
@Override public List<Object> filter(Status status) { URLEntity urls[] = status.getURLEntities(); if (urls == null) { return null; } URL finalUrl = null; List<Object> marketUrls = new LinkedList<Object>(); for (URLEntity url : urls) { try { ...
9
public void recursiveBFS(String label) { Vertex v = getVertex(label); if (v.wasVisited() == false) { v.setVisited(true); this.queueOfNodes.add(v); System.out.println("Visited vertex : " + v); } int r = getVertexIndex(label); for (int i = 0; i < this.COLS; i++) { if (graph[r][i] == 1) { Vert...
5
public Hashtable SibXMLMessageParser(String xml, String id[]) { if(xml==null) { System.out.println("ERROR:SSAP_XMLTools:SibXMLMessageParser: XML message is null") ;return null; } if(id==null) { System.out.println("ERROR:SSAP_XMLTools:SibXMLMessageParser:id is null"); return null; } Docu...
5
private void tarjanAlgorithm(Node n) { n.setIndex(index); n.setLowlink(index); index++; s.add(n); for(Node c: n.getToNode()) { if(c.getIndex() == -1) { tarjanAlgorithm(c); n.setLowlink(Math.min(n.getLowlink(), c.getLowlink())); } else if(s.contains(c)) { n.setLowlink(Math.min(n.g...
6
public Object[][] getMultipleRows(String testcase) { String testSheetName = getTestSheetName(testcase); if(testSheetName.equalsIgnoreCase("TestSheet Not Found")){ return null; } HSSFSheet testSheet = workBook.getSheet(testSheetName); String cellData; int totalRows = testSheet.getPhysicalNumberOfRows(); ...
9
public int getCurrentSectionNo(){ if (isEmpty()) return -1; int position = size()-1; Enumeration en = positionMap.keys(); Integer nextKey = null; Integer nextValue = null; while(en.hasMoreElements()){ nextKey = (Integer)en.nextElement(); nextValue = positionMap.get(nextKey); int v = nextValue.intValue(); ...
3
public Cloud(int id, Channel leftIn, Channel leftOut, Channel rightIn, Channel rightOut) { this.id_ = id; this.leftIn_ = leftIn; this.leftOut_ = leftOut; this.rightIn_ = rightIn; this.rightOut_ = rightOut; name = this.getId(); currentState = Status.PRE_AUTHED; /* Swing parts */ cloudLbl = new JL...
9
@Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); }
0
@RequestMapping(value = "/login", method = RequestMethod.GET, produces = "application/json") private @ResponseBody User checkLoginAvailability(@RequestParam String login) { User user = appContext.getUserService().readUserByLogin(login); if (user != null) { return user; } ...
1
public void setField(String field) { this.field = field; }
0
@Override public boolean getOutput() { for (int j = 0; j < getNumInputs(); j++) if (getInput(j)) return true; return false; }
2
public BasicStructure2 parse(BasicStructure1 structure1) { ArrayList<Integer> types = structure1.getTypes(); ArrayList<String> tokens = structure1.getTokens(); ArrayList<Integer> types1 = new ArrayList<Integer>(); ArrayList<String> tokens1 = new ArrayList<String>(); int type; String token; boolea...
9
private int search(int[]A,int b,int e,int target) { if (b >= e) return b; if (b + 1 == e) { if (A[b] >= target) return b; return e; } int mid = (b + e) /2; if (A[mid] == target) return mid; if (A[mid] > target) return search(A,b,mid,target); return search(A,mid+1,e,target); }
5
public void update(){ up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W]; down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S]; left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A]; right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D]; }
4
@Override public Group findGroupByGroupIdAndUserId(int groupId, int userId) { Group group = null; Connection cn = null; PreparedStatement ps = null; ResultSet rs = null; try { cn = ConnectionHelper.getConnection(); ps = cn.prepareStatement(QTPL_SELEC...
5
public static double[] getPageMargins(PrintService service, PrintRequestAttributeSet set, LengthUnits units) { PageOrientation orientation = getPageOrientation(service, set); double[] margins = getPaperMargins(service, set, units); if (orientation == PageOrientation.LANDSCAPE) { return new double[] { margins[...
3
public String getName() { return delegate.getName(); }
0
private static void insertSongs(int count) { int processors = Runtime.getRuntime().availableProcessors(); Thread[] threads = new Thread[processors]; int size = count / 2; for(int i = 0; i < processors; i++) { threads[i] = new InsertThread(size, size * i); threads[i].start(); } ...
3
public double obtenerPorcMateria() { double porcentajeMateria = 0; switch (getTamannoEnvase()) { case 'P': if (getGrosorEnvase() == 1) { porcentajeMateria = Constantes.PORCENTAJE_ENVASE_P_1; } break; case 'M': if (getGrosorEnvase() == 1) { porcentajeMateria = Constantes.PORCENTAJE...
8
public SaveAsAction(Environment environment) { super("Save As...", null); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, MAIN_MENU_MASK + InputEvent.SHIFT_MASK)); this.environment = environment; this.fileChooser = Universe.CHOOSER; }
0
public synchronized void drop() { taken = false; notifyAll(); }
0
public void generateParticles(){ if (ParticleSystem.enabled) for(int i = 0; i < 4 * intensity; ++i) try { ParticleSystem.addParticle(newParticle()); } catch (IllegalArgumentException e) { e.printStackTrace(); } ...
3
private static boolean isUnsafe(char ch) { if (ch > 128 || ch < 0) return true; return " []$&+,;=?@<>#%".indexOf(ch) >= 0; }
2
public static String getName(Subcategorias subcat){ String sql="SELECT * FROM subcategorias WHERE idsubcategorias = '"+subcat.getId()+"'"; if(!BD.getInstance().sqlSelect(sql)){ return null; } if(!BD.getInstance().sqlFetch()){ return null; } return ...
2
private void dfs(Graph G, int v) { marked[v] = true; id[v] = count; for (int w : G.adj(v)) if (!marked[w]) dfs(G, w); }
2
@EventHandler(ignoreCancelled = true) public void weatherevent(WeatherChangeEvent event) { if(!Config.enabledWorlds.contains(event.getWorld().getName())) {return;} if(event.toWeatherState() == true) { if(Config.rainWarning) { World world = event.getWorld(); if(rand.nextInt(100) < Config.acidRainChance) ...
7
private byte[] loadJarData(String path, String fileName) { ZipFile zipFile= null; InputStream stream= null; File archive= new File(path); if (!archive.exists()) return null; try { zipFile= new ZipFile(archive); } catch(IOException io) { return null; } ZipEntry entry= zipFile.getEntry(fileName);...
7
final public String assignexpr() throws ParseException { /*@bgen(jjtree) ASSIGN */ SimpleNode jjtn000 = new SimpleNode(JJTASSIGN); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token t; String s; String assign = ""; try { t = jj_consume_token(ASSIGN); assign += t.image.toString(...
9
public void setAnswers(ArrayList<String> answers) { textAnswer=answers; }
0
private void processResponse(int userInput) { switch (userInput) { case 0: //switch person to view System.out.println("Switching Person..."); currentPerson = null; break; case 1: //Add Relationship addRelationship(); break; case 2://Delete Relationship deleteRelationship(); break; case ...
9
public boolean win() { for (int i = 0; i < plateau.length; i++) { if (plateau[0][i] != null && plateau[0][i].getHaveBall() && plateau[0][i].getColor().equals("Noir") || plateau[6][i] != null && plateau[6][i].getHaveBall() && plateau[6][i].getColor().equals("Blanc")) { return true; } } ret...
7
public static String oneScan(String s){ if(s==null) return null; StringBuilder result = new StringBuilder(); int end = s.length(); for(int i=s.length()-1;i>=0;i--){ if(s.charAt(i)==' '){ end = i; continue; } if(i==0||s.charAt(i-1)==' '){ if(result.length()!=0){ ...
6
private MethodIdentifier findMethod(String name, String typeSig) { for (Iterator i = methodIdents.iterator(); i.hasNext();) { MethodIdentifier ident = (MethodIdentifier) i.next(); if (ident.getName().equals(name) && ident.getType().equals(typeSig)) return ident; } return null; }
3
@Transactional public void doSomeThing() { TestBean bean1 = new TestBean(3,"piyoxs"); dao.update(bean1); List<TestBean> list = dao.findAll(); for (TestBean bean : list) { SimpleLogger.debug("..." +bean.toString()); } TestBean bean3 = dao.find(3); SimpleLogger.debug(bean3.toString()); ...
1
@Override public Move getMove() { int thinkingTime = 0; if (playerColour == Definitions.WHITE) { thinkingTime = 750; } else { thinkingTime = 750; } System.out.println("AI Thinking (" + thinkingTime / 1000.0 + " seconds)"); long startTime = System.currentTimeMillis(); long finishTime = System.curren...
8
@Override public int hashCode() { boolean test = false; if (test || m_test) { System.out.println("Coordinate :: hashCode() BEGIN"); } if (test || m_test) { System.out.println("Coordinate :: hashCode() END"); } return m_X + m_Y; }
4
@Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof IProject) { IProject project = (IProject) parentElement; IFile gruntFile = project.getFile(GRUNT_FILE); if (gruntFile.exists()) { return new Object[] { new TaskContainer(gruntFile, getTasks(gruntFile), false...
5
public int search(CharSequence text, String pattern) { int M = text.length(); int N = pattern.length(); for (int i = 0; i < M - N; i++) { int j; for (j = 0; j < N; i++) if (text.charAt(i + j) != pattern.charAt(j)) break; if...
4
public StockItem getProductByName(String productName) { for (StockItem stockItem : stockList) { if (stockItem.getProduct().getProductName().equals(productName)) { return stockItem; } } return null; }
2
public boolean isLibrary() { if (libVisit) return false; if (library == 0 && nextCourse == Course.HUMANITIES) return true; else if (library == 1 && nextCourse == Course.MATH) return true; else if (library == 2 && nextCourse == Course.SCIENCE) return true; else return false; }
7
public <T> T unmap(Map<String, ?> genericised, Class<T> type) { ReMapperMeta meta = extractMeta(genericised); if (meta == null) { //assume this is a hash map System.err.println("__ null meta: umm... what now?"); } if (meta != null) { //note: its possible for the type to change (specialisation - to a su...
9
public EarningsTest() { // TODO: use/display company descriptions // TODO: add dates to price/volume graph // TODO: merge idential files / double gae output File resources = new File(REPORTS_ROOT); if (!resources.exists()) resources.mkdir(); singleton = this; programSettings = MemoryManager.restoreSett...
2
private void registerShiftListener(){ KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() { @Override public boolean dispatchKeyEvent(KeyEvent e) { synchronized (KeyChecker.class){ switch (e.getID()){ ...
4
public static void writePhones(ConcurrentHashSet<Long> set, String file) throws IOException { if (file == null || file.equals("")) return; FileWriter fw = new FileWriter(new File(file)); BufferedWriter bw = new BufferedWriter(fw); try { if (set.size() == 0) { bw.append("no phone numbers."); return...
4
public void updateView() { setLocationManually(myAutoPoint); }
0
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { if (!isInitializer) { writer.print("new "); writer.printType(type.getHint()); writer.breakOp(); writer.print(" "); } writer.print("{ "); writer.startOp(writer.EXPL_PAREN, 0); for (int i = 0; i < subExpressions.len...
4
public SetGUI(Client c) { client = c; setResizable(false); //cannot expand game to keep background image looking spiffy /* * Standard setup for contentPane, notice that it is a layered pane * so we are able to have a good-looking background */ getContentPane().setLayout(null); setDefaultCloseOper...
8
public String simplifyPath(String path){ if (path == null || path.length() == 0) return "/"; Stack<String> stack = new Stack<String>(); for (String s : path.split("/")){ if (s.length() == 0 || s.equals(".")) continue; else if (s.equals("..")){ if (!stack....
9
private boolean tryFindPath() { for (Node neighbour : neighbours) { if (neighbour.x == n || neighbour.y == 0) { return true; } if (!neighbour.isReachable()) { neighbour.setReachable(); if (neighbour.tryFindPath()) { return true; } } } return false; }
5
public Object getValueAt(int row, int col) { if(row>-1 && col>-1 && data!=null) return data[row][col]; else return null; }
3
public static void main(String[] args) throws ClassNotFoundException, IOException, InterruptedException { // TODO Auto-generated method stub // // Testing try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { ...
6
private void finishFileReceiverThread() { if (this.fileReceiverThread != null) while (this.fileReceiverThread.isAlive()) { this.fileReceiverThread.interrupt(); this.log.fine("FileReceiver thread is interupt"); stopFileReceiver(); } }
2
public void run() { while (pause) { Thread.yield(); } paused = true; while (running) { if (DO_VALIDATION) { boolean done = false; while (pause) { if (!done) { System.out.println("Thread " + Thread.currentThread().getId() + ": Stope...
8
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (qName.equals("rowset")) { String name = getString(attrs, "name"); factions = name.equals("factions"); factionWars = name.equals("factionWars"); } else if (qName.equals("row")) { if...
4
@Override public void execute(double t) { try { if (input.getDic() != null && input.getDic().getSource() != null) output.setOutput(input.getDic().getInput()); } catch (OrderException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
3
public void createMap(int size) { if (!edit) { gui.console("Click \"Edit Graph\" button"); return; } clearGraph(); boolean directed = graph.isDirected(); graph.setDirected(false); int center_x = rel(getWidth() / 2); int center_y = rel(ge...
4
public boolean mouseDown (Event event, int x, int y) { dragStart = new Point (x, y); dragged = false; if (selectionAllowed && wave != null) { if ((event.modifiers & Event.META_MASK) != 0 || (event.modifiers & Event.ALT_MASK) != 0 || (event.modifiers & Event.CTRL_MASK) != 0) { sele...
7
public byte[] getTiledImageData() { byte[] palettedImage = new byte[width * height]; int tileCount = width * height / 64; int tileWidth = width / 8; for (int t = 0; t < tileCount; t++) for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) ...
3
public void fillObject(CreditProgram crProg, ResultSet result) { //Заполняем кредитную программу try { crProg.setId(result.getInt("ID")); crProg.setName(result.getString("CREDITNAME")); crProg.setMinAmount(result.getLong("CREDITMINAMOUNT")); crProg.setMaxA...
1
@SuppressWarnings("unchecked") public void configFromJSONFile(String fileName) throws IOException, JSONException, ClassNotFoundException{ File file=new File(fileName); FileInputStream fileStream=new FileInputStream(file); BufferedReader reader=new BufferedReader(new InputStreamReader(fileStream)); ...
9
private void changeMapInternal(final MapleMap to, final Point pos, MaplePacket warpPacket) { if (NPCScriptManager.getInstance().getCM(client) != null) { NPCScriptManager.getInstance().dispose(client); } if (eventInstance != null) { eventInstance.changedMap(this, to.getId(...
7
public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource() == btAddCopy) { this.dispose(); new AddCopy(user); } else if(e.getSource() == btAddDoc) { this.dispose(); new AddDocTypeChooseFrame(user); } if(e.getSource() == btDltCopy){ this.dispose(); ...
9
private int processOrderList(ArrayList<Trade> trades, OrderList orders, int qtyRemaining, Order quote, boolean verbose) { String side = quote.getSide(); int buyer, seller; int takerId = quote.gettId(); int time = quote.getTimestamp(); while ((orders.getLength()>0) && (qtyRemaining>0)) { int...
7
public TypeConvert() { }
0
public static int readVarInt(ByteBuf byteBuf) { int out = 0; int bytes = 0; byte in; while (true) { in = byteBuf.readByte(); out |= (in & 0x7F) << (bytes++ * 7); if (bytes > 5) { throw new IllegalStateException("Integer is bigger than m...
3
public void run() { try { //Obtenemos datos como el NICKNAME entrada=new ObjectInputStream(conexion.getInputStream()); this.nickname=(String)entrada.readObject(); //Actualizamos usuarios usuarios.add(nickname); ...
7
public CreatePDFRaport() { }
0
public static SpMat getAddReqEdges(GraphModel gILU, SpMat m, SpMat mR, SpMat mP,Vector<Integer> order) { SpMat addM = new SpMat(m.rows(),m.cols()); //for (int i = 0; i < m.getRowDimension(); i++) { // for (int j = 0; j < m.getColumnDimension(); j++) { for(int i : order) { ...
9
public void generate_test() { boolean lowerTail = true; for (int i = 0; i < numTests;) { int N = rand.nextInt(MAX) + 1; int D = rand.nextInt(N) + 1; int n = rand.nextInt(N) + 1; int k = Math.max(rand.nextInt(Math.min(n, D)), 1); if (Hypergeometric.get().checkHypergeometricParams(k, N, D, n)) { d...
3
public boolean checkWord(String word) { word = word.toLowerCase(); // This is very inefficient for (int i = 0; i < m_dictionary.length; i++) { if (m_dictionary[i].equals(word)) { return true; } } return false; }
2
private void batchEstimateDataAndMemory(boolean useRuntimeMaxJvmHeap, String outputDir) throws IOException { //File mDataOutputFile = new File(outputDir, "eDataMappers.txt"); //File rDataOutputFile = new File(outputDir, "eDataReducers.txt"); File mJvmOutputFile = new File(outputDir, "eJvmMappers.txt"); File ...
7
public static Boolean isTypeAllowed(Class<?> clazz) { // Logger.getAnonymousLogger().info("checking type : " + clazz.getName()); if (clazz.isPrimitive() || getAllowedTypes().contains(clazz)) { return true; } Set<Class<?>> allowedTypes = getAllowedTypes(); for (Class<?> allowedType : allowedTypes) { ...
7
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://...
6
public synchronized int SelctUrls(String url) { int id = 0; try { ResultSet re = tags_ste.executeQuery("SELECT * from zhangyu_sca.article_urls WHERE (list_url = '" + url + "');"); re.next(); id = re.getInt("article_id"); } catch (SQLException e) { ...
1
public Player play() { Output out1 = _player1.draw(); Output out2 = _player2.draw(); int outcome = determineWin(out1, out2); if(outcome == 0) { return null; } else if(outcome == 1) { return _player1; } ...
2
public View create(Element elem) { String kind = elem.getName(); if (kind != null) { if (kind.equals(AbstractDocument.ContentElementName)) { return new WrapLabelView(elem); } else if (kind.equals(AbstractDocument.ParagraphElementName)) { return new ParagraphView(elem); } else if (kind.equals...
6