text
stringlengths
14
410k
label
int32
0
9
private void genTerrainFromNoise(ChunkTerrainControl ctc) { Perlin noise = new Perlin(); noise.setFrequency(0.01); noise.setLacunarity(2.0); noise.setNoiseQuality(NoiseQuality.BEST); noise.setOctaveCount(8); noise.setPersistence(0.5); noise.setSeed(DEFAULT_SEED); ...
7
public double scoreRackDE(Distribution target, Distribution err_weight){ double sum = 0; for (int i=0; i<cards.length; i++){ double err = Math.abs(target.eval(i) - cards[i]); if (err_weight != null) err *= err_weight.eval(i); sum += err; } //Min err = 0, Max err = rack_size(max_card-rack_size) //...
3
public int[][] quant(double array[][]) { int result[][] = new int[SIZE][SIZE]; for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { result[i][j] = ceil(array[i][j] / tableQuant[i][j]); } } return result; }
2
private void readConfig(String genomeVersion, String configFileName) { //--- // Read properties file //--- configFileName = readProperties(configFileName); // Get config file directory String cfgDir = ""; try { File configDir = new File(configFileName).getAbsoluteFile().getParentFile(); cfgDir = co...
8
public static void main(String... args) throws Exception { File file = new File("/Users/babyduncan/github/javanio/files/sourceFile.txt"); File disFile = new File("/Users/babyduncan/github/javanio/files/disFile.txt"); FileInputStream fileInputStream = new FileInputStream(file); FileChann...
2
public List<String> findFilesWithTime(long startTime,long endTime) { try { List<String> results = new ArrayList<>(); findFileWithTime.setTimestamp(1, new Timestamp(startTime)); findFileWithTime.setTimestamp(2, new Timestamp(endTime)); findFileWithTime.setTimestamp(3, new Timestamp(startTime)); fin...
2
public ResultSet PreparedQuery(String query, String[] params) { PreparedStatement ps; if (!IsConnected) { return null; } try { ps = Conn.prepareStatement(query); // Construct PreparedStatement by adding all supplied params to the query plugin.Debug("SQL Query: " + query); for (int x=0; x < param...
3
public void load(File file){ if ( !file.exists() ){ System.out.println(file + " not found"); return; } BufferedReader data; System.out.println("Loading...."); try{ data = new BufferedReader(new FileReader(file)); while (true){ String line = data.readLine(); if (line==null) {break;} String...
4
protected void expandChildren(SearchState oldState, int oldDist) { HashMap<Integer, HashMap<Board, ListStateBuffer>> cache = new HashMap<>(); TetrisStateBuffer buf = stateBufferMap.get(oldState); for (Entry<Short, StateBuffer> stateEntry : buf.getMap().entrySet()) { int pieceIndex = stateEntry.getKe...
6
public JTextField getPsiTextField() { return psiTextField; }
0
public void run() { try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } // This thread simulate the network. It allows the program to send or // receive messages from another site. System.out.println("-- Starting Network's thread --- \n "); System.out.println(" ...
8
private Matrix augNorm(Matrix mat) { Matrix localMat = new Matrix(new double[mat.numRows()][mat.numColumns()]); for(int doc = 0; doc < mat.numRows(); doc++) { double maxTf = 0; for(int term = 0; term < mat.numColumns(); term++) { double tf = mat.m[doc][term]; maxTf = Math.max(maxTf, ...
4
public void strikeByHammer() { if (dead) { return; } strike(ConstantValues.HAMMER); setMessage(MessagePool.getMessage(this, MessagePool.Action.Scream)); reduceComplacencyTimer += 400; shockTimer += 150; suppressionTimer += 140; if (getPartner() !=null) { getPartner().reduceComplacencyTimer+=200; ...
6
public static void main (String[] args) { final int ROLLS = 1000; // number of rolls //Declare six integer variables, one for each side int zero = 0; int one = 0; int two = 0; int three = 0; int four = 0; int five = 0; int six = 0; // Declare a Die class type variable called die and create...
8
static public boolean borrar (Cuenta actual){ return cuentas.remove(actual); }
0
private void kill() { for(int i = 0;i < slag.size();i++) { if(!slag.get(i).getLife()) { slag.remove(i); } } for(int i = 0;i < fiender.size();i++) { if(fiender.get(i).getCondition(Consts.DEAD) && fiender.get(i).ge...
5
@Override public void whatToDo(Character character) { Game currentGame = Game.getInstance(); int rollResult = currentGame.rollDice(3); if (rollResult == 5) { character.incrementMight(2); character.incrementSpeed(2); } if (rollResult == 4) { character.incrementKnowledge(2); character.incrementKn...
6
public boolean isVisible() { if(frame == null) buildGUI(); return frame.isVisible(); }
1
private void sendAsChunked(OutputStream outputStream, PrintWriter pw) throws IOException { pw.print("Transfer-Encoding: chunked\r\n"); pw.print("\r\n"); pw.flush(); int BUFFER_SIZE = 16 * 1024; byte[] CRLF = "\r\n".getBytes(); byte[] buff = new byt...
1
public int getCosto(){ switch(type_t){ case 1: return 10000; //Como infinito case 2: return 10000; //como infinito case 3: return 10; case 4: return 20; case 5: return 1; //En la casilla inicial hay hierba case 6: return 1; //En la casilla final hay hierba case 7: return 1; case ...
8
public void formTransModeList(SessionRequestContent request) throws ServletLogicException { Criteria criteria = new Criteria(); User user = (User) request.getSessionAttribute(JSP_USER); if (user != null) { criteria.addParam(DAO_USER_LOGIN, user.getLogin()); ClientType typ...
2
@Override protected Value evaluate(ExecutionContext context) throws InterpretationException { Value val = ((AbsValueNode) this.getChildAt(0)).evaluate(context); if (val.getType() == VariableType.ARRAYLIST) { ArrayList<Value> list = (ArrayList<Value>) val.getValue(); list.rem...
3
private static void initialize() { Path logDir = FileSystems.getDefault().getPath("./log"); try { if ( !Files.isDirectory(logDir) ) Files.createDirectory(logDir); logger = Logger.getLogger("Client"); handler = new FileHandler("log/error.log", true); ...
2
private static void copySimpleFile(File inputFile, File outputFile, boolean isOverWrite) throws IOException { // 目标文件已经存在 if (outputFile.exists()) { if (isOverWrite) { if (!outputFile.delete()) { throw new RuntimeException(outputFile.getPath() + "无法覆盖!"); } } else { // 不允许覆盖 r...
4
public void update(int delta) { if (getY() > Window.HEIGHT - getHeight()) { setY(Window.HEIGHT - getHeight()); speed = -speed; } else if (getY() < 0) { setY(0); speed = -speed; } if (getX() > Window.WIDTH - getWidth()) { setX(Window.WIDTH - getWidth()); speed = -speed...
4
private static Type lookupType(String name) { try { return new Type(ClassPool.getDefault().get(name)); } catch (NotFoundException e) { throw new RuntimeException(e); } }
1
public void setContentType(String contentType) { if (isCommitted()) return; if (contentType==null) { _mimeType=null; _header.remove(HttpFields.__ContentType); } else { // Look for encoding in contentType ...
7
private void updateStateIngred(List<Keyword> keywords, List<String> terms) { RecipeLearningState nextState; List<Keyword> ingredients = keywordsFromType(KeywordType.INGREDIENT, keywords); if (userSaidEnd(keywords)) { nextState = new RecipeLearningState(RecipeLearning.RL_ASK_FIRST_TOOL); setCurrentDialogState(...
4
public static Sentence[] extractSentence(String weibo) { String newStr = ""; for (int i = 0; i < weibo.length(); ++i) { newStr += weibo.charAt(i); if (isSplitPunctuation(weibo.charAt(i)) && (i + 1 >= weibo.length() || !isSplitPunctuation(weibo.charAt(i + 1)))) newStr += "\t"; } String[] strList ...
8
public void collideCheck() { if (dead) return; float xMarioD = world.mario.x - x; float yMarioD = world.mario.y - y; float w = 16; if (xMarioD > -16 && xMarioD < 16) { if (yMarioD > -height && yMarioD < world.mario.height) { if...
9
@Override public void encode(final ByteBuffer buf, final StringBuilder log) { final int start = buf.position(); final short count = (short) services.length; // Encode service count buf.putShort(count); if (log != null) log.append("UINT count ...
6
protected void setLocalType(final int local, final Type type) { int index = local - firstLocal; while (localTypes.size() < index + 1) { localTypes.add(null); } localTypes.set(index, type); }
1
public void setType(int type) { this.type = type; }
0
public void fermer(){ try{ if(tamponSocket != null) tamponSocket.close(); if(writerSocket != null) writerSocket.close(); if(socket != null) socket.close(); } catch(IOException io){ io.printStac...
4
private void removeStep(double startPrice, double endPrice) { if (billingServerSecure == null) { System.out.println("ERROR: You are currently not logged in"); } else { try { billingServerSecure.deletePriceStep(startPrice, endPrice); System.out.println("Step [" + startPrice + " " + (endPrice == 0 ? "IN...
7
public void actionPerformed(ActionEvent evt) { /** increased elapsed time */ elapsedSec += 1; /** if elapsed 4 seconds */ if (elapsedSec >= 4) { /** if Java 2 available */ if (Main.J2) { /** stop background music */ BomberBGM....
8
protected int findFloorNumber(Room room, Set<Room> done, int floor) { LandTitle title = CMLib.law().getLandTitle(room); if(title == null) return floor; for(int d=0;d<Directions.NUM_DIRECTIONS();d++) { Room R=room.getRoomInDir(d); if((R!=null)&&(!done.contains(R))) { done.add(R); if(d==Direc...
9
public static String streamToString(InputStream instream, String charset) { StringWriter writer = new StringWriter(); BufferedReader br = null; try { if (charset != null) { br = new BufferedReader(new InputStreamReader(instream,charset)); } else { br = new BufferedReader(new InputStreamReader(...
6
public void checkChars(String msg, String str, MutableString mut) { if (str.length() != mut.length()) { fail(msg + " (strings have different lengths): " + str.length() + " vs. " + mut.length()); } // if the lengths differ for (int i = 0; i < str.length(); i++) { ...
3
public void draw() { System.out.println("Draw Shape"); }
0
private void initializeOutputs() throws IOException, CustomOutputException { if (this.configuration.getLogToConsole()) { this.logger.addOutput(new ConsoleOutput()); } String[] fileOutputs = this.configuration.getLogToFiles(); if (fileOutputs != null) { for (String fileOutput: fileOutputs) { if (!fileO...
6
public MarketSign getMarketSign(Block block) { for (MarketSign sign : sellsigns) { if (sign.getBlock().equals(block)) { return sign; } } for (MarketSign sign : rentsigns) { if (sign.getBlock().equals(block)) { return sign; } } return null; }
4
public void init() { try { Level.loadBehaviors(new DataInputStream(ResourcesManager.class.getResourceAsStream("res/tiles.dat"))); } catch (IOException e) { e.printStackTrace(); System.exit(0); } if(level==nu...
9
public static List<String> getAllRatingDescriptions() { Collection<String> skis = ratingsMap.values(); if (ratings == null) ratings = new ArrayList<String>(skis); return ratings; }
1
private boolean hitOne(String S, int index, HashMap<String, Integer> left, int step) { String s = S.substring(index, index + step); if (left.containsKey(s)) { int count = left.get(s); if (count == 1) { left.remove(s); } else { left.put...
2
private static HashMap parseAttributes(String s) { StringTokenizer tok = new StringTokenizer(s); HashMap map = new HashMap(); String key = null; String value = null; String garbage = null; while (tok.hasMoreElements()) { key = tok.nextToken("="); garbage = tok.nextToken("\""); value = tok.nex...
2
public static String ErrorToString(int error){ switch(error) { case OK: return "OK"; case UNKNOWN_HOST: return "UNKNOWN_HOST"; case INTERNAL_ERROR: return "INTERNAL_ERROR"; case SERVER_ERROR: return "SERVER_ERROR"; case NET_ERROR: return "NET_ERROR"; case ALREADY_EXISTS: return "ALREADY_EXISTS"; case DO...
9
public boolean readColorModel(InputStream in) throws java.io.IOException { int len=readInt(in); //System.out.println("len="+len); if(!_isConnected) return false; readBytes(colormap,in,len*3); if(!_isConnected) return false; //we'll do this stupid thing because we can't change an existing color model, and we...
9
private static List<Point> readCoordinates(String filename) throws IOException{ BufferedReader br = new BufferedReader(new FileReader(filename)); String line; //Line numbering starts from 1 (not 0) int lineNr = 1; List<Point> points = new ArrayList<Point>(); int coordCount = 0; DecimalFormat format = n...
9
public static void main(String[] args) { if (args.length < 1) usage(); int rv = 0; if (args[0].equals("order")) { rv = runorder(args); } else if (args[0].equals("wicked")) { rv = runwicked(args); } else if (args[0].equals("misc")) { rv = runmisc(args); } else if (args[0].equals...
5
protected void updatePersonalBest(int row) { for(int k = 0; k < position[row].length; k++){ personalBest[row][k] = position[row][k]; } }
1
private void initField(Field[][] fields) { for (int i = 0; i < sizeX; i++) { for (int j = 0; j < sizeY; j++) { fields[i][j] = new Field(this, i + j * sizeX); } } for (int i = 0; i < sizeX; i++) { fields[i][0] = new BorderField(fields[i][0]); ...
6
public void setOperand(String var, String op){ if(!Arrays.asList(inLables).contains(var)){ return; } Operand pos = null; for( AbstractUnit unit : units){ if(unit instanceof InputPin){ if(((InputPin)unit).name.equals(var)){ IIns...
4
public void body() { // register oneself to the system GIS super.sim_schedule(GridSim.getGridInfoServiceEntityId(), GridSimTags.SCHEDULE_NOW, GridSimTags.REGISTER_LINK, new Integer(super.get_id()) ); Sim_event ev = new Sim_event(); ...
3
public List getRecommandHot() throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; String sql = ""; List recommandList = null; DataBean bean = null; int k=0; try{ sql="select ROWNUM, b.* from (select * from (select * from board union all select * from food un...
9
public void tick() { if(health <= 0) alive = false; }
1
public static String identifyWordFromFrequencyMatrix(double[][] currentCorrelationMatrix) throws Exception { int rowIndex = 0; int columnIndex = 0; double maxCorrelation = PearsonCorrelationCoefficientClass.getMaximumElement(currentCorrelationMatrix); // Get the row and column index o...
8
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://down...
6
@Test public void testGetEdge() { System.out.println("getEdge"); assertEquals(2.0, new Tetrahedron(1.5,2,3.5,12).getEdge(), 0.00001); }
0
public void runQuery() { // gets search parameters from searchpanel ArrayList<String> ingred = new ArrayList(); String str = searchpanel.getIngredients().getText(); String[] ingreds = str.split(" "); for (int i = 0; i < ingreds.length; i++) { ingred....
8
public StackLocalInfo dup(int count, int depth) { ConstValue[] newStack = new ConstValue[stack.length + count]; ConstValue[] newLocals = (ConstValue[]) locals.clone(); if (depth == 0) System.arraycopy(stack, 0, newStack, 0, stack.length); else { int pos = stack.length - count - depth; System.arr...
4
public void configure(JoeTree tree) { // Lazy Instantiation if (!initialized) { initialize(); initialized = true; } this.tree = tree; attPanel.update(this); }
1
public static Component newInstanceWithEntity(Class<?> componentClass, Entity entity) { Constructor<?> ctor; try { ctor = componentClass.getConstructor(); Object instance = ctor.newInstance(); if(instance instanceof Component) { Component ret = (Component)instance; ret.setEntity(ent...
4
private void prepareWheel() { double effMin = 0; double range = 0; if (!flag(OPT_MINIMIZE)) { effMin = meanValue - stdDeviation * 2; range = maxValue - effMin; wheelBaseValue = effMin; if (range < 0.001) wheelBaseValue = effMin - 20.0; } else { effMin = (meanVa...
9
private boolean allowSelfReference( ConnectionFlavor flavor ) { if( flavor.equals( AssoziationConnection.ASSOZIATION ) ) { return true; } if( flavor.equals( CompositionConnection.COMPOSITION ) ) { return true; } if( flavor.equals( AggregationConnection.AGGREGATION ) ) { return true; } return f...
3
public void uploadArray(String vname,float defaultValue) throws IOException, WrongArgumentException, InterruptedException { creater = new ArrayCreater(conf, zone, this.shapes.get(this.shapes.size() - 1),vname,this.thread_num,defaultValue); int i ; int []srcShape = new int [chunk.getChunkStep().length]; long tm...
4
public void lock(String mode) { if (this.state == CellState.MARKED) { this.state = CellState.LOCKED; if (!hasMine()) notifyObservers("errorMarked"); } if (this.state != CellState.CLOSED) return; this.state = CellState.LOCKED; if (hasMine() && mode.equalsIg...
5
@Override public ArrayList<Edge> getEdgeList() { if (edges.isEmpty()) { initDataStructure(); } return edges; }
1
public void updateRecomendations() { eventList.clear(); recomendationType.clear(); view.getResults().clear(); Database db = Database.getInstance(); LinkedHashSet<String>eventListNamesForSameArtist = new LinkedHashSet<String>(); LinkedHashSet<String>eventListNamesForSimilarArtist = new LinkedHashSet<String>(...
4
public void putAll( Map<? extends Float, ? extends Short> map ) { Iterator<? extends Entry<? extends Float,? extends Short>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Float,? extends Short> e = it.next(); this.put( e.getKey...
8
public void setY(float y) { // check if falling if (Math.round(y) > Math.round(getY())) { onGround = false; } super.setY(y); }
1
public void run() { show(0); State board = new State(); Player[] players = {new AlphaBetaPlayer(7), new MctsPlayer(500)}; while (!board.gameOver()) { int move; if (board.getColorToPlay() == 'X') { draw(board, "Black to play. Click here if no legal move.", 0); move = players[0].move(board); } el...
5
public FontRenderer(GameSettings var1, String var2, TextureManager var3) { this.settings = var1; BufferedImage var14; try { var14 = ImageIO.read(TextureManager.class.getResourceAsStream(var2)); } catch (IOException var13) { throw new RuntimeException(var13); } int...
8
public static void main(String[] args) { List<Integer> numList = new ArrayList(); numList.add(5); int x = numList.get(0); List<String> myList = new ArrayList<>(); myList.add("Guitar"); myList.add("Drums"); myList.add("Singer"); // for(int i = 0;...
4
public void normalize() { ListIterator<List<List<Double>>> acItr = dataMatrix.listIterator(); while (acItr.hasNext()) { ListIterator<List<Double>> mItr = acItr.next().listIterator(); while (mItr.hasNext()) { double sum = 0.0; boolean allMissing = true; List<Double> all...
8
@EventHandler(priority = EventPriority.NORMAL) public void onBlockBreak(BlockBreakEvent event){ if(!event.isCancelled()) { String test = plugin.findArea(event.getBlock().getX(), event.getBlock().getZ(), event.getBlock().getWorld().getName()); String userTeam = plugin.getTeamPlayer(event.getPlayer()...
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, Exception { //retardo debug // try { // Thread.sleep(80); // } catch (InterruptedException ex) { // Thread.currentThread().interrupt(); //...
3
@Override public void messageReceived(MessageEvent e) { String svrmsg = e.getMessage(); if (svrmsg.contains("You get some logs.")) { normalsChopped++; System.out.println("Paint: Normal trees chopped: " + normalsChopped); } else if (svrmsg.contains("You get some oak logs.")) { oaksChopped++; System....
5
public void addComponent(Entity entity, IComponent component, boolean notifyObservers) { HashMap<Entity, IComponent> entityComponentMap = registeredComponents.get(component.getClass()); if (entityComponentMap == null) { logger.info("No previous occurence of this component existed before.", "Creating new set...
3
public void setStock(Stock stock) { if (stock == this.stock) return; if (this.stock != null) { this.stock.removeStorageUnit(this); } this.stock = stock; if (this.stock != null) { this.stock.addStorageUnit(this); } }
3
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //processRequest(request, response); try { if("true".equals(request.getParameter("doFeedback"))){ Transaction _transaction ...
7
private boolean gameWon() { for(int i = 0; i < PLAYER_AMOUNT;i++) // This for-loop controls if someone has won the game by reaching 3000 { if(playerControl.lastManStanding() > -1) // call lastManStanding to see if the player is the last man standing. The reason for -1, is because 0 is a playerindex { cout.prin...
5
public String layer_string() { switch (h_layer) { case 1: return "I"; case 2: return "II"; case 3: return "III"; } return null; }
3
public static void main( String[] args ) { JFrame cardsJPanel = new CardsTesterJFrame("CARD CLASS TESTER", 10, 10, 500, 400); }
0
public void atAssignExpr(AssignExpr expr) throws CompileError { // =, %=, &=, *=, /=, +=, -=, ^=, |=, <<=, >>=, >>>= int op = expr.getOperator(); ASTree left = expr.oprand1(); ASTree right = expr.oprand2(); if (left instanceof Variable) atVariableAssign(expr, op, (Var...
3
private static void dfsRec(mxAnalysisGraph aGraph, Object cell, Object edge, Set<Object> seen, mxICellVisitor visitor) { if (cell != null) { if (!seen.contains(cell)) { visitor.visit(cell, edge); seen.add(cell); final Object[] edges = aGraph.getEdges(cell, null, false, true); final Object[] ...
3
@Override public void keyPressed(KeyEvent e) { Keys key = Keys.getKey(e.getKeyCode()); keyStates.put(key, true); if(keyListeners.containsKey(key)) { if(exclusiveKeyListener != null) { fireExclusiveKeyListener(key, e.getKeyChar()); } else { fireKeyEvents(key, key, e.getKeyChar()); ...
4
void moveDown(int i, boolean min) { int size = heap.size(); while (i < size) { int p = highDescendant(i, min); if (p < 0) { return; } int cmp = compare(heap.get(p), heap.get(i)); if (i == grandParent(p)) { if (min ? cmp < 0 : cmp > 0) { swap(i, p); ...
9
public static void incorporateIncludesModules(Module module, Stella_Object includees) { { Surrogate testValue000 = Stella_Object.safePrimaryType(includees); if (testValue000 == Stella.SGT_STELLA_CONS) { { Cons includees000 = ((Cons)(includees)); { Stella_Object name = null; Con...
9
public static String gunzip(String compressedStr) { if (compressedStr == null) { return null; } ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream in = null; GZIPInputStream ginzip = null; byte[] compressed = null; String decompressed = null; try { compressed = new...
9
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { GuiTestingXML frame = new GuiTestingXML(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
1
public String justify(String[] w, int x, int y, int cnt, int L) { int n = w.length; String res = ""; if (x == y || y == n - 1) { // left justify銆備袱涓潯浠讹細鍙湁涓�釜鍗曡瘝锛屾垨鑰呮渶鍚庝竴琛屻� res = w[x]; for (int i = x + 1; i <= y; i++) { res += " " + w[i]; } while (res.length() < L) res += " "; return res;...
6
private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateButtonActionPerformed // Error handling to ensure that arrival is before departure, and one of the fields aren't empty. if ("".equals(jXDatePickerChangeArrival.getEditor().getText()) || "".equals(jXDatePick...
8
public Expr evaluate(IEvaluationContext context, Expr[] args) throws ExprException { assertMinArgCount(args, 2); int len = 0; Expr[] ea = new Expr[args.length]; for (int i = 0; i < args.length; i++) { ea[i] = evalArg(context, args[i]); if (i == 0) { ...
7
public BinomioEntidadeFake(int k, int n, int coefiente) { super(); this.k = k; this.n = n; this.coefiente = coefiente; }
0
public static void main(String[] args) { Target target = new Adapter(new Adaptee()); target.method1(); }
0
@Override public boolean execute(MessageContext context) { // Validating arguments String rawArguments = getArguments(context); if(rawArguments == "") { sendUsageBack(context); return false; } String[] arguments = rawArguments.split(" "); if(arguments.length != 2) { sendUsageBack(context); r...
5
public static int findAnchors(Component base, Container ancestorContainer) { int contact = AnchorConstraints.ANCHOR_TOP | AnchorConstraints.ANCHOR_LEFT | AnchorConstraints.ANCHOR_BOTTOM | AnchorConstraints.ANCHOR_RIGHT; Component comp = base.getParent(); Component child = base; while(comp != null && comp != an...
7
public void validate() throws IOException { update0(); for (int i = 0; i < files.length; i++) { if (createIfNotExist && files[i].exists()) { files[i].createNewFile(); } if (head != -1 && i == head) { //verify header } ...
5
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://down...
6