text
stringlengths
14
410k
label
int32
0
9
private void move() { if (x < 0) { x = Board.M_WIDTH - 1; direction = LEFT; moveLeft(); } else if (x > Board.M_WIDTH - 1) { x = 0; direction = RIGHT; moveRight(); } else { if (board.getLabyrinth().isIntersection(x, y)) { direction = newDir(); } if (blue) { direction = getPacmanO...
8
public void ModifyItem() { System.out.println(this.itemID); Items itemlist = new Items(); itemlist.init(); for (Item item : itemlist.getItemList()) { if (item.itemID.equals(this.itemID)) { System.out.println("itemFound"); this.itemName = item.itemName; this.itemDescription = item.itemDescription...
2
public void testConstructor_int_int_int() throws Throwable { DateMidnight test = new DateMidnight(2002, 6, 9); assertEquals(ISOChronology.getInstance(), test.getChronology()); assertEquals(LONDON, test.getZone()); assertEquals(TEST_TIME_NOW_LONDON, test.getMillis()); assertEquals...
7
private static void bubbleSort(int[] arr) { if(arr.length < 2) return; int right;//每次冒泡那个最大元素落在这个索引位置上 for(int i=0; i<arr.length-1; i++){//需要进行n-1次冒泡 right = arr.length - 1 - i; for(int j=0; j<right; j++){ if(arr[j] > arr[j+1]){ //swap arr[j] and arr[j+1] int temp = arr[j]; arr[j] = ar...
4
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
public static void main(String[] args) { for (int i = 1; i <= 20; ++i) System.out.println(new Count_and_Say().countAndSay(i)); // System.out.println(new Count_and_Say().countAndSay(10)); }
1
public static String setRankString(int x) { if(x!=1&&x!=11&&x!=12&&x!=13) { return Integer.toString(x); } if(x==11) { return JACK; } if(x==12) { return QUEEN; } if(x==13) { return KING; } return ACE; }
7
public ModelCRLV getModelCrlv(ModelCRLV crlv, String action){ ModelIPVA ipva = new ModelIPVA(); if(action.equals("editar")) ipva.setIdIpva(crlv.getIpva().getIdIpva()); crlv.setVia(Integer.parseInt(txtVia.getText())); crlv.setCodRenavam(txtCodRenavam.getText()); ...
1
protected void skipAttributes(DataInputStream input) throws IOException { int count = input.readUnsignedShort(); for (int i = 0; i < count; i++) { input.readUnsignedShort(); // the name index long length = input.readInt(); while (length > 0) { long skipped = input.skip(length); if (skipped == 0) ...
3
public String[] getSets0(){ String[] sets =null; try{ sets = textField.getText().split(","); if(textField_1.getText().length()<1) return null; int x = Integer.valueOf(nbrVarComboBox.getSelectedItem().toString()); x = (int) Math.pow(2, x); for(String s : sets){ int set = Integer.valueOf(s); if (!(set...
4
public void run(){ gameStart=0; new Tile(); windowrunning = true; running = true; level = new Level(); image = createVolatileImage(width,height); //Run the application until the user tells it to close while(windowrunning){ if(gameStart==1){ startTime = System.currentTimeMillis(); gameStart+...
8
public SubCategory(String naam, int datatype, float weight) { this.naam = naam; this.datatype = datatype; this.weight = weight; this.periods = new ArrayList<Period>(); }
0
public double removeMin() { if ( _heap.size() == 0 ) return -1.0; else _size--; //store root value for return at end of fxn double retVal = peekMin(); //store val about to be swapped into root double foo = _heap.get( _heap.size() - 1); //swap last (rightmost, deepest) leaf with root swap( 0, _hea...
4
@Override public Account getObject(int row, int col) { if(col == 0 || col == 1) { return (Account)getValueAt(row, 0); }else { return (Account)getValueAt(row, 3); } }
2
public static String stripBlanks(final String string) { //// Preconditons if (string == null) throw new InvalidParameterException("string cannot be null"); return stripTrailing(stripLeading(string, ' '), ' '); }
1
private void cftbsub(int n, float[] a, int offa, int[] ip, int nw, float[] w) { if (n > 8) { if (n > 32) { cftb1st(n, a, offa, w, nw - (n >> 2)); if ((ConcurrencyUtils.getNumberOfThreads() > 1) && (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_2Threads())) { ...
9
public DFA(Collection<State> states, Collection<Transition> transitions, Collection<State> acceptables, State start) { Set<State> statesSet = new HashSet<State>(states); Set<Transition> transitionsSet = new HashSet<Transition>(transitions); this.acceptables = new HashSet<State>(acceptables); for (State st...
6
private void readLuminance() { int type = sourceImage.getType(); if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) { int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null); for (int i = 0; i < picsize; i++) { ...
9
private static Point[][] get8PlayersPositions() { int maxPlayers = 8; Point[][] pos = new Point[8][128]; for(int i = 0; i < maxPlayers;i++ ){ pos [0][i] = new Point(0,2*i); } for(int i = 0; i < maxPlayers/2;i++ ){ pos [1][i] = new Point(2 ,1+4*i); } for(int i = 0; i < maxPlayers/4;i++ ){ pos [2]...
4
public void withdraw(int value) { if(value < 0) { IllegalArgumentException ex = new IllegalArgumentException( "You can't withdraw a negative number of dollars!"); log.throwing(getClass().getSimpleName(), "withdraw(int)", ex); throw ex; } else if(value > money) { IllegalArgumentException ex = new Il...
2
public void method() { try { BufferedWriter w = new BufferedWriter(new PrintWriter("texto.txt")); BufferedReader r = new BufferedReader(new FileReader("text.txt")); } catch (IOException e) { } }
1
@SuppressWarnings("rawtypes") @Override public void onEvent(Event e) { // TODO Auto-generated method stub String[] args = {""}; if(e instanceof PrivateMessageEvent) { PrivateMessageEvent event = (PrivateMessageEvent) e; args = Colors.removeFormattingAndColors(event.getMessage()).split(" "); String pref...
9
private static Object[] processValues(Field field, Selection selection) { FieldType type = TypeUtil.getFieldType(field.getType()); switch (type) { case INTEGER: return processIntegerValues(selection); case DOUBLE: return processDoubleValues(selection); case LONG: return...
8
@Override public int hashCode() { int result = popProveedorId != null ? popProveedorId.hashCode() : 0; result = 31 * result + (popNitProveedor != null ? popNitProveedor.hashCode() : 0); result = 31 * result + (popNombreProveedor != null ? popNombreProveedor.hashCode() : 0); result = ...
6
public void create(Engine engine, String name, String mapLocation) { //engine.addWorld(this); if(cubes == null) cubes = new ArrayList<Cube>(); try { BufferedImage image = ImageIO.read(new File(mapLocation)); height = new float[image.getWidth()][image.getHeight()]; width = image.getWidth()*0.25f;...
4
void without(Gizmo g) { g = new Gizmo(); // OK -- g not final g.spin(); }
0
@Override public double percentile(double percentile) { if (N == 0) return Double.NaN; // Number of values in the quartile double indexing = N * percentile; // If indexing has digits the index array contains only the number // indexing + 1. On the other hand, if indexing is an even number (it // has no...
3
public static void main(String... args) { /* * Loads the file client.properties from the classpath. * It is located within the directory src/main/resources. */ Config config = new Config("client"); /* * Retrieve the String value associated with the 'download.dir' key * and print the absolute path ...
2
@Test public void testEndUserApi() throws JFKException{ // create the dummy object DummyClass dummy = new DummyClass(); // now get the function IFunctionBuilder builder = JFK.getFunctionBuilder(); IFunction function = builder.bindFunction( dummy, "hello" ); // execute the function String result = (String...
9
public int dropHeight(Piece piece, int x) { int high = 10000; int result = 0; int temp; int i; int[] skirt = piece.getSkirt(); for (i = x; i < x + piece.getWidth(); i++) { temp = skirt[i - x] - getColumnHeight(i); if (temp < high) { high = temp; result = i; } } return getColumnHeight(re...
2
public void run() { try { boolean done = false; while (!done) { File file = queue.take(); if (file == FileEnumerationTask.DUMMY) { queue.put(file); done = true; } else search(file); ...
4
public int[] getCurrentLayout() { String[] face = {"F", "R", "B", "L", "U", "D"}; Color[] colors = {color_red, color_green, color_orange, color_blue, color_yellow, color_white}; int[] layout = new int[6]; //Gets layout of grids on screen for(int i=0;i<6;i++) { //Loop for each face for(int n=0;n...
3
final public void run() { connectionEstablished(); // The message from the server Object msg; // Loop waiting for data try { while (!readyToStop) { // Get data from Server and send it to the handler // The thread waits indefinitely at the following // statement until something is received fr...
4
public void accept(final ClassVisitor cv) { FieldVisitor fv = cv.visitField(access, name, desc, signature, value); if (fv == null) { return; } int i, n; n = visibleAnnotations == null ? 0 : visibleAnnotations.size(); for (i = 0; i < n; ++i) { Annot...
7
@Test public void runTestRegisterGlobal1() throws IOException { InfoflowResults res = analyzeAPKFile("Callbacks_RegisterGlobal1.apk"); Assert.assertNotNull(res); Assert.assertEquals(1, res.size()); }
0
public static WeaponType getWeaponType(String name) { if (weaponTypes.containsKey(name)) { return (WeaponType) weaponTypes.get(name); } return null; }
1
public static void main(String[] args){ while ( jogo.SearchPacdot(jogo.pacmaze) == true && !(jogo.SamePosition())) { jogo.DisplayPacworld(); Scanner in = new Scanner(System.in); System.out.println("Faz jogada: "); char tecla = in.nextLine().charAt(0); int x = 0; int y = 0; switch...
7
private Types.ACTIONS microbial(StateObservation stateObs, int maxdepth, StateHeuristic heuristic, int iterations) { double[] maxScores = new double[stateObs.getAvailableActions().size()]; for (int i = 0; i < maxScores.length; i++) { maxScores[i] = Double.NEGATIVE_INFINITY; } ...
6
public void retractWeapon(int lastKeyPressed) { try { int dir = 1; Point charLoc = new Point(this.getCharacterLocation()); if (!(grid.get(charLoc).returnCharacter().getWeapon() instanceof RangedWeapon)) { if (lastKeyPressed == KeyEvent.VK_A || lastKeyPressed == KeyEvent.VK_LEFT) { dir = -1; } el...
6
@Override public String getName() { return NAME; }
0
public PickUpAction(Grid grid, Item item) { if (grid == null) throw new IllegalArgumentException("The given grid is invalid!"); if (item == null) throw new IllegalArgumentException("The given item is invalid!"); this.grid = grid; this.item = item; }
2
public void setVisited(boolean b) { this.visited = b; }
0
public void keyReleased(KeyEvent ev) { if(ev.getKeyCode() == KeyEvent.VK_LEFT) { if(index != 1) index--; } if(ev.getKeyCode() == KeyEvent.VK_RIGHT) { index++; index = index % 1325; if(index == 0) index++; } comic = getComic(index); frame.setTitle("XKCD - " + Integer.toStrin...
4
private void subledger2(ArrayList<ArrayList> arrayL) { String query3; System.out.println("sub2size"+arrayL.size()); for(int i=0; i<arrayL.size(); i++){ arrayTemp=arrayL.get(i); if(arrayTemp.get(0).matches("reg")){ /*query3 = "insert into suble...
5
public static String toFancyTime(int minutes) { if (minutes <= 0) { return "0 minutes"; } StringBuilder time = new StringBuilder(); int days = minutes / 60 / 24; if (days > 0) { time.append(days).append(" day").append(days > 1 ? "s" : ""); } ...
9
public int maxArea(int[] heights) { int maxArea = 0; int start = 0, end = heights.length - 1; while (start < end) { int startHeight = heights[start], endHeight = heights[end]; int area = Math.min(startHeight, endHeight) * (end - start); if (area > maxArea) {...
7
static final boolean method3137(boolean bool, byte i) { anInt9426++; boolean bool_0_ = Class348_Sub8.currentToolkit.isBloomSupported(); if (i != -24) return true; if (!bool_0_ == !bool) return true; if (!bool) Class348_Sub8.currentToolkit.method3710(); else if (!Class348_Sub8.currentToolkit.method3...
6
public static int[] maxProductIncreasingSubsequence(int[] input, int length){ int[] response = new int[length]; /** * product[n][l] is responsible for keeping max products of * product[i][3] means from i = 0 ..i in input[] , maximum product of a subsequence of 3 length * till...
9
public void save(JavaPlugin plugin) { File file = new File(plugin.getDataFolder(), FILE); if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } FileOutputStream fileStream = null; ObjectOutputStream objectStream = null; try { fileStream =...
7
public static Object getNewObject(FileTypes type, String name){ //TODO add name to construct? if(type.equals(FileTypes.CODEX)){ return new Codex(); } else if(type.equals(FileTypes.CODEXITEM)){ return new CodexItem(); } else if(type.equals(FileTypes.FRAMES)){ return new Frames(); } else if(type.eq...
5
public void loadSettings(ComponentManager componentManager) { // get all our loaded classes Vector<Class<?>> classes = null; try { classes = getLoadedClasses(); } catch(Exception e) { Logger.error("Unhandled exception (%s): %s!", e.getClass().getName(), e.getMessage()); e.printStackTrace(); } ...
8
public static void main(String[] args) { Connection conn = null; Statement stat= null; ResultSet resultSet= null; try{ /* 1.注册数据库驱动, 不同的数据库要导入不同的驱动jar包。Driver就是这个包中的类。*/ /*---这种方式有两个不好的地方: * 1)查看Driver的源码,我们会发现在 new Driver()的时候,其实已经注册了一次驱动了。这样就造成注册了两次驱动。 * 2)这样写,让程序导入了com.mysql.jdbc.Driv...
8
public String toString(){ return bins.toString(); }
0
public void merge(int[] arr, int p, int q, int r) { int length = arr.length; int[] tempArray = new int[length]; for (int i = 0; i < length; i++) { tempArray[i] = arr[i]; } int temp = p; int i = p, j = q + 1; for (; i <= q && j <= r;) { if (tempArray[i] < tempArray[j]) { arr[temp++] = tempArra...
6
static String toXml (String s) { int m=s.length(); H.clear(); for (int i=0; i<m; i++) { char c=s.charAt(i); switch(c) { case '<' : toH("&lt;"); break; case '>' : toH("&gt;"); break; case '&' : toH("&amp;"); break; case '\'' : toH("&apos;"); break; case '\"' : toH("&quot;"); break; defau...
6
@Override public int compare(String s1, String s2) { assert s1 != null && s2 != null; return String.CASE_INSENSITIVE_ORDER.compare(s1, s2); }
1
public void testConstructor_ObjectStringEx6() throws Throwable { try { new LocalTime("10:20:30.040+04:00"); fail(); } catch (IllegalArgumentException ex) {} }
1
public void addNeighbour(Agent a) { neighbours.add(a); }
0
public void drawRolloverTooltip(Graphics g){ g.setColor(Color.WHITE); g.setFont(new Font("Arial", Font.BOLD, 20)); g.drawString("Racial Turret", 605, 305); g.setFont(new Font("Arial", Font.PLAIN, 18)); g.drawString("Cost: "+totalCost +" Gold", 605, 330); g.drawString("Range: Moderate", 605, 355); g.drawS...
3
public Update createUpdate(com.hp.hpl.jena.update.Update arq, String uri) { if(arq instanceof UpdateModify) { return createModify((UpdateModify)arq, uri); } else if(arq instanceof UpdateClear) { return createClear((UpdateClear)arq, uri); } else if(arq instanceof UpdateCreate) { return createCreate((U...
8
private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0, 0L); return 7; } switch(curChar) { ca...
4
public static Collection<Class<?>> internalComponents(Class<?> model) { Collection<Class<?>> comps = new ArrayList<Class<?>>(); comps.add(model); internalComponents0(comps, model); return comps; }
4
public static QuestionPower decode(String str) throws DecodeException { QuestionPower res = null; if (str.substring(0,14).compareTo("#QuestionPower") == 0) { res = new QuestionPower(); int i = 14; if (str.charAt(i) == '<') { while (str.charAt(i) != '>') { ...
9
public double interQuartileMean_as_double() { double mean = 0.0D; switch (type) { case 1: double[] dd = this.getArray_as_double(); mean = Stat.interQuartileMean(dd); break; case 12: BigDecimal[] bd = this.getArray_as_BigDecimal(); mean = (Stat.interQuartileMean(bd)).doubleValue(); bd = null; ...
3
private void GLRender() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glRotatef(xRot,1 , 0, 0); glRotatef(-yRot, 0, 1, 0); glTranslatef(-camX, -camY, -camZ); RenderFrame(); // Axis glBegin(GL_LINES); glColor3d(1, 0, 0); glVertex3f(axis[0], ...
8
public int findCombinationsCount(int sum, int vals[]) { if (sum < 0) { return 0; } if (vals == null || vals.length == 0) { return 0; } int dp[] = new int[sum + 1]; dp[0] = 1; for (int i = 0; i < vals.length; ++i) { for (int j =...
5
@Override public void update(Observable o, Object arg) { if (arg != null && arg instanceof String && ((String) arg).contains("VS")) // View settings updates { if (activeGroup != null) m_container.remove(activeGroup); if (ViewPreferences.getInstance().getCenterView() == CenterView.TASK) { activeGroup ...
5
public void changeMark() { if (this.markState == MarkState.unmarked) { this.markState = MarkState.flagged; try { Image icon = ImageIO.read(getClass().getResource("flagged.gif")); this.setIcon(new ImageIcon(icon)); } catch (IOException ex) { } } else if (this.markState == MarkState.flagged...
6
public boolean canBuyDevCard(int playerIndex) { Player player = serverModel.getPlayers().get(playerIndex); if (playingCommandsPreconditions(playerIndex) && player.getOre() > 0 && player.getWheat() > 0 && player.getSheep() > 0 && serverModel.getDeck().getTotalDevCardCount() > 0) { return true; } else { ...
5
public void startPoint(String name) { if (this.goalMap.containsKey(name)) { Calculator cal = (Calculator) this.goalMap.get(name); cal.setStartTime(Calendar.getInstance().getTimeInMillis()); } else { this.goalMap.put(name, new Calculator(name)); } }
1
public static void main(String[] args) { new ViewHandler(); }
0
public void incRegister() { this.speicherzelle++; if(this.speicherzelle == 256) { this.speicherzelle = 0; // Überlauf } }
1
public void rewindNbytes(int N) { int bits = (N << 3); totbit -= bits; buf_byte_idx -= bits; if (buf_byte_idx<0) buf_byte_idx += BUFSIZE; }
1
public void terminateSimulation () { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("terminateSimulation", false); $in = _invoke ($out); return; } catch (org.omg.CORBA.portabl...
2
private void loadFileNumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadFileNumActionPerformed try { String newLine = "\\n"; String sourceContents; /*/Code to read from file File inputFile = new File(inputFileName); FileInputStre...
4
public boolean add(Item input) { if (isFull()) return false; if (input == null) return false; for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { if (inventory[h][w] == null) { inventory[h][w] = input; return true; } } } return false; }
5
public void run() { try { CookieManager.setDefault(Client.cookieManager); //boolean authbool = messenger.authenticate("Lukew4lker", pwInput); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //System.out.print("Enter String"); ...
6
private static long sumOfPred(int i, int j){ long sum = 0; if (i>0){ sum+=routes[i-1][j]; } if (j>0){ sum+=routes[i][j-1]; } return sum; }
2
public void handleClick(int x, int y) { for(int i = 0; i < Sidebar.MAX_ELEMS; i++) { if((elements[i] != null) && (y >= (elementPos[i]))) { elements[i].handleClick((int)(x - Sidebar.xPos_), (int)(y - elementPos[i])); return; } } }
3
@Override public String getNationality() { return super.getNationality(); }
0
public static void checkloginstatus(String num, String downloadpath){ try{ HWND targetwindow=User32.FindWindow("ZocMainWindow", "COM"+num+" [evaluation mode]");//find the ZOC window with specific port number by its class and name HWND edit=User32.FindWindowEx(targetwindow, new HWND(0),"ZocTerminalArea", null);/...
8
private Object getValue(Object item) { Object value = null; if(item != null) { if(item instanceof JTextField) { value = ((JTextField) item).getText(); } else if(item instanceof JSpinner) { value = ((JSpinner) ite...
7
public void printXProportion(String xProportionFile, ArrayList<_Doc> docList) { System.out.println("x proportion for parent doc"); try { PrintWriter pw = new PrintWriter(new File(xProportionFile)); for (_Doc d : docList) { if (d instanceof _ParentDoc) { for (_ChildDoc doc : ((_ParentDoc) d).m_childDo...
4
public void actionPerformed(ActionEvent ae) { if ("pump".equals(ae.getActionCommand())){ chart.pump = ((JCheckBox)ae.getSource()).isSelected(); if (chart.pump){ optInc.setEnabled(true); optDec.setEnabled(true); } else{ optInc.setEnabled(false); optDec.setEnabled(false); } ...
6
public boolean checkConnection(TagSet tagSet, int tag1, int tag2, int len1, int len2, int typeOfTag2) { String tag1Name = tagSet.getTagName(tag1); String tag2Name = tagSet.getTagName(tag2); if ((tag1Name.startsWith("nc") || tag1Name.charAt(0) == 'f') && tag2Name.charAt(0) == 'n') { if (tag2Name.startsWi...
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; if((mob.location()!=null) &&(mob.location().domainType()!=Room.DOMAIN_OUTDOORS_JUNGLE) &&(mob.location().domainType()!=Room.DOMAIN_OUTDOORS_SWAMP) &&(mob...
9
public void drawString(int column, int row, String string, ScreenCharacterStyle... styles) { if(column >= areaSize.getColumns() || row >= areaSize.getRows() || string == null) return; string = TabBehaviour.ALIGN_TO_COLUMN_4.replaceTabs(string, column + topLeft.getColumn()); ...
7
@Override Integer redactEntity(Criteria criteria, AbstractDao dao) throws DaoException { Integer idOrder = (Integer) criteria.getParam(DAO_ID_ORDER); if (idOrder != null) { return updateOrder(criteria, dao); } else { return createOrder(criteria, dao); } }
1
public synchronized void reset() { for(int i = 0; i < receivedPackets.length; i++) receivedPackets[i] = null; receivedPacketHistoryInt = 0; lastReceivedPacketIndex = -1; lastReceivedPacketSequenceNumber = Packet.SEQUENCE_NUMBER_NOT_APPLICABLE; for(int i = 0; i < sentPackets.length; i++) sentPackets[i] ...
2
public CheckResultMessage check34(int day) { return checkReport.check34(day); }
0
public void commandAction(Command c, Displayable d) { if (d == remotedeviceui && c.getLabel().equals("Search")) { startInquiry(discoveryMode, serviceUUIDs); } else if (d == remotedeviceui && c.getLabel().equals("Back")) { callback.commandAction(BACK, remotedeviceui); } else if (d == remotedeviceui && c.ge...
7
public static void startupStellaIn() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); if (...
6
public void getBalances( SimpleDate asOfWhen, boolean force ) { // if we're up to date, there is nothing to do if (upToDate && !force) return; // reset all summary amounts to zero initBal = 0; totCredits = 0; totBudget = 0; totDebits = 0; finalBal = 0; // if we have no ledger entries, nothing...
9
@Override public void execute() { if (this.from.distanceBetweenFile(this.to) == 2) { // King moves right (file difference is positive) this.rookFrom = board.getField('h', this.from.rank); this.rookTo = board.getField('e', this.from.rank); // Rook moves left } else { this.rookFrom = board.getField('a', thi...
1
private String toString(double number) { String result=""; if (Double.toString(number).equals("NaN")||Double.toString(number).equals("Infinity")) { result="Error"; }else{ result=Double.toString(number); //if it's an integer, remove ".0" if (result.subst...
4
public int _createKey(int key, String subkey) throws RegistryErrorException { try { int result[] = (int[])createKey.invoke(null, new Object[] {new Integer(key), getString(subkey)}); if(result[ERROR_CODE] == ERROR_SUCCESS) return result[NATIVE_HANDLE]; else return -1; } ...
4
@Override public void paintComponent(Graphics g) { super.paintComponent(g); int bx = (camera.getX() < 0) ? 0 : (int) camera.getX(); int by = (camera.getY() < 0) ? 0 : (int) camera.getY(); int ox = -1 * (bx - (int) camera.getX()); int oy = -1 * (by - (int) camera.getY()); ...
4
public List<GeneratedImage> buildCreatedFiles() throws IOException, InterruptedException { boolean error = false; final List<GeneratedImage> result = new ArrayList<GeneratedImage>(); for (File f : dir.listFiles()) { if (error) { continue; } if (f.isFile() == false) { continue; } if (fileToP...
9
public Status getStatus() { return status; }
0
public static void createPDFExcel(String path, String[] content, int row, Boolean rotate) { if (content == null) { return; } try { File myFile = new File(path); if (!myFile.exists()) { myFile.createNewFile(); } Document document = new Document(rotate == true ? PageSize.A4 : PageSize.A4.rotate()...
5