method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
96f98de8-6e53-4fb3-8750-5c1dffebac1b
3
private static void init() { if (factory != null) { return; } /* *使用log4j, *如果没有则用基于|Java.util.logging.Logger|实现的|JdkLogger| 和|JdkLoggerFactory| */ try { Class.forName("org.apache.log4j.Logger"); Class<?> log4jLoggerFactory = Class.forName("com.jfinal.log.Log4jLoggerFactory"); factory = ...
c1809fd1-2745-4d25-b416-472d5e16c6f7
8
private Expression times( List<Expression> args, String caller ) { boolean ints = true; boolean intsOrDecimals = true; if ( args.size() < 2 ) { System.err.println("* expected at least two arguments and got " + args.size() ); return new Void(); } for( ...
30a00895-9d5b-4e70-b009-26088ee77b8c
4
public GameWindow getWindow() { boolean test = false; if (test || m_test) { System.out.println("Game :: getWindow() BEGIN"); } if (test || m_test) { System.out.println("Game :: getWindow() END"); } return m_gameWindow; }
48857e08-bf58-44f3-a652-2c8a22276448
6
public boolean firemaking() { if (playerLevel[playerFiremaking] >= firemaking[1]) { if (actionTimer == 0 && IsMakingFire == false) { actionAmount++; sendMessage("You attempt to light a fire..."); OriginalWeapon = playerEquipment[playerWeapon]; OriginalShield = playerEquipment[playerShield]; pla...
c01e92ff-bca4-4dcb-a250-01db1ffa22bc
6
private static int add(boolean b, ChemistryUnit inX, ArrayList<ChemistryUnit> uniqueUnitTypes, int[][] originalMatrix, int counterInitialValue){ int originalMatrixCounter = counterInitialValue; for(Map.Entry<ChemistryUnit, Integer> map : inX.getUnitEntrySet()){ for(Map.Entry<ChemistryUnit, Integer> entry : map.g...
9a76686e-6af2-40ca-96c1-27ca04c078f6
2
@Override public String toString() { String name = getName(); String append = ""; if(name != null && !name.equals("")) { append = "(\"" + this.getName() + "\")"; } return "TAG_Int" + append + ": " + value; }
f7ab6c15-f681-4dff-866b-f42b594fc9fd
8
public void setOutputOperation(){ if(_intputAluOp1 && !_intputAluOp0 || _intputAluOp1 && _intputAluOp0){ _outputOperation = _inputFunctionCode; }else if(!_intputAluOp1 && !_intputAluOp0){ _outputOperation = AddInstruction.FUNC_CODE; }else if(!_intputAluOp1 && _intputAluOp0){ _outputOperation = SubInstruc...
e0c93918-713b-4ad7-bcc5-7dd109d3c71c
1
public boolean more() throws JSONException { this.next(); if (this.end()) { return false; } this.back(); return true; }
4b95050d-e29b-4bc8-99c9-9ded23d78b0c
2
protected void terminate () { // If termination is already underway, there's no point // in starting it anew. if (terminating) return; // As for the root of the ownership tree, there's noone to terminate it, // so it has to terminate itself. if (owner...
e17e88b3-2575-4afe-b6f6-7e6c25a27542
4
public List<ServerFile> getFiles() { List<ServerFile> files = new ArrayList<>(); Connection conn = null; PreparedStatement st = null; ResultSet res = null; try { conn = getController().getDb().getConnection(); st = conn.prepareStatement(SELECT_FILES); st.setInt(1, getId()); res = st.executeQuery...
5ce03289-5126-4c91-aa3b-f708243ce705
9
public Board createCopy() { Board copy = new Board(); int countW = 0; int countB = 0; for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[i].length; j++) { if (countW == 9 && countB == 9) return copy; if (board[i][j] != null) { if(countW < 9 && board[i][j].getColor() == Ston...
7082755a-9134-4614-8320-ace60088664d
2
protected void showCase(int i) { try { Case c = myLemma.getCase(i); if(c.getI() != -1) { myPane.setDecomposition(c.getInput(), c.getI()); myPane.displayIEnd(); myPane.setVisibilityStages(4, true); ...
89738b4b-fff0-4954-a0e5-e0d77cfa92ac
1
public static boolean loadLocal(File file) { try { Scanner scan = new Scanner(file); userName = scan.nextLine(); coins = scan.nextInt(); playtime = scan.nextLong(); lck_lvl = scan.nextBigInteger().toByteArray(); lck_bg = scan.nextBigInteger().toByteArray(); lck_chr = scan.nextBigInteger().toByteA...
ca0ea12e-eff8-4222-9bbf-e77d3e5879fc
9
protected void execute() { if (oi.getGB1()) // elevator down, then it goes up again elVader.elCycle(); else if (oi.getGB6()) //elevator up elVader.elRise(); else if (oi.getGB4()) //elevator down elVader.elLower(); if (oi.getGB7()) elVader.set(-1); else if (oi.getGB8(...
37f9300c-f816-4824-9e70-bda8b38f85b3
8
private static String addTobbesSzamRag(Szo szo) { String szoto = szo.getSzo(); Rend rend = Hangok.getHangrend(szo); Maganhangzo utolso = getUtolsoMaganhangzoFajtaja(szo); if (utolso != null) { if (utolso.equals(HOSSZU)) { return szoto + "k"; } else...
def5cb9e-67d0-4254-9942-e5f315be816f
8
public MowerCoordinate action(char cmd) { cmd=Character.toUpperCase(cmd); switch(cmd) { case 'L': this.facing-=90; break; case 'R': this.facing+=90; break; case 'M': int dir=(facing/90)%4; switch (dir) { case 0: this.y += 1; break; case 2: this.y-=1...
06f32bbb-0eba-42d2-af0d-b5bcf54b1566
3
private void copyPALtoABGR(ByteBuffer buffer, byte[] curLine) { if(paletteA != null) { for(int i=1,n=curLine.length ; i<n ; i+=1) { int idx = curLine[i] & 255; byte r = palette[idx*3 + 0]; byte g = palette[idx*3 + 1]; byte b = palette[i...
9d39f496-49e0-448f-98bb-34f203dd77a8
8
public int compare(Task task1, Task task2) { if (task1.getDeadline() == null && task2.getDeadline() == null) { return 0; } else if (task1.getDeadline() != null && task2.getDeadline() == null) { return 1; } else if (task1.getDeadline() == null && task2.getDeadline() != null) { return -1; ...
d450c16d-1e74-4f00-88c1-5477ba48dc1a
1
public boolean allowWorldGlobal(World world) { if(mWorldsBlacklist) return !mWorlds.contains(world.getName().toLowerCase()); else return mWorlds.contains(world.getName().toLowerCase()); }
c58559eb-046a-4e12-bcee-fd8634f638cc
7
private static void logoffUser(String username, String lobbyGame, String inProgressGameName, ServerCatanGame inProgressGame) { // Check if the user is in a lobby game. If so, remove the user from // that game. if (lobbyGame !=...
e3458a8f-66bd-405c-a84a-5bcd59f03718
7
public void service() throws IOException, ClassNotFoundException { //Le serveur est en écoute d'une connexion cliente clt = srv.accept(); System.out.println("Accepted connection : " + clt); //On ouvre les flux en entrée et sortie ObjectOutputStream output = new ObjectOutputStrea...
0ba94991-2d8a-4ac9-a6c5-5fc6f18ac2d3
3
public static boolean leapYear(int year){ boolean test = false; if(year%4 != 0){ test = false; } else{ if(year%400 == 0){ test=true; } else{ if(year%100 == 0){ ...
c773e830-b45d-4a64-8610-87d5293a16b0
2
private String buildCommand(String[] files, String output) { String result = "./gifsicle"; result += " --delay=" + delay; if (loop) result += " --loop"; for (String f : files) { result += " " + f; } result += " > " + output; System.out.println("executing: \n" + result); return result; }
85da68a7-e49b-4f52-8e3e-d2cd55e684f8
2
public double[] subarray_as_real_part_of_Complex(int start, int end){ if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1)); Complex[] cc = this.getArray_as_Complex(); double[] real = new double[end-start+1]; for...
0b3ccf9a-42a1-4719-b166-253a200ee62d
0
public String getInclude(String page) throws ServletException, IOException { WebContext wctx = WebContextFactory.get(); String url = format("/%s.jsp", page); return wctx.forwardToString(url); }
509c9fe4-2386-4cff-8dbd-e8a23a5788cc
1
public Instruction(String instruction, String status, boolean stall, int executeCycle) { this.instruction = instruction; this.status = status; // will be sent from simulator // as status[0] which is init stall = false; this.executeCycle = executeCycle; this.inst = instruction.split(" "); if(inst[...
121cc272-8f93-4615-b258-ea5885beb7ed
7
public void mainLine(String[] args, Atdl4jConfiguration config) throws Exception { // -- Setup SWT-specific Display and Shell -- Display display = new Display(); shell = new Shell( display ); GridLayout shellLayout = new GridLayout( 1, true ); shell.setLayout( shellLayout ); // shell.setText( // "atdl4j(...
c1c599b6-d4b0-4633-82b5-34969cb21b9c
4
public void startStage(){ if (players[PLAYER_ID_P1]!=null && players[PLAYER_ID_P1].getTank()!=null){ curStage.addTank(players[PLAYER_ID_P1].getTank(), Stage.START_POINT_PLAYER_1); } if (players[PLAYER_ID_P2]!=null && players[PLAYER_ID_P2].getTank()!=null){ curStage.addTank(players[PLAYER_ID_P2].getTank(), S...
b6f30f1e-3541-4e1a-ad88-55e91b0ac092
9
public Expression simplify() { if (subExpressions[0] instanceof CompareToIntOperator) { CompareToIntOperator cmpOp = (CompareToIntOperator) subExpressions[0]; boolean negated = false; int opIndex = getOperatorIndex(); if (cmpOp.allowsNaN && getOperatorIndex() > NOTEQUALS_OP) { if (cmpOp.greaterOnNaN...
d7b9a188-dcd1-47c2-8713-69abbf987c43
5
public ArrayList<Object> plotColeCole(){ String[] dAndT= this.dateAndTime(); String graphTitle1 = "ImpedSpecRegression program: Cole - Cole plot [" + dAndT[0] + " " + dAndT[1] + "]"; String graphTitle2 = this.regressionTitle; if(!this.regressionDone)this.regression(); thi...
7f3b46d6-76c1-4c10-8602-5c2c5acec702
9
public static void addUtilisateur( String nom, String prenom, String mail, String mdp, String mdpValide )throws ErreurParamNonValide { if(nom.length() > 0 && prenom.length()>0 && mail.length()>0 && mdp.length()>0){ if(mdp.equals(mdpValide)){ Utilisateur user = new Utilis...
2f7242c3-b1dc-40c8-804c-f40f6d3bdb1a
8
public Body createBody(World world, MapObject mapObject) { MapProperties properties = mapObject.getProperties(); String type = properties.get("type", String.class); if(!type.equals(aliases.body) && !type.equals(aliases.object)) throw new IllegalArgumentException("type of " + mapObject + " is \"" + type + "\"...
f72a88b3-6777-4c82-adcb-127f31dc5b06
3
@EventHandler public void OnPlayerInteract(PlayerInteractEvent e){ Player p = e.getPlayer(); PlayerDat pd = DBmanager.PlayerData.get(p.getName()); if(pd.pclass.equalsIgnoreCase("miner")){//&&p.getItemInHand().equals(Material.GOLD_PICKAXE) // p.sendMessage("enter 1"); ...
e1a4eef9-79c1-428a-ad11-5ce29558a209
1
private void loop(){ while (scene.run()) { scene.bufferReset(false); } scene.close(); }
ef86932a-f662-4811-9a89-689be96f89f8
5
@Override public void setLooping( boolean lp ) { super.setLooping( lp ); // make sure we are assigned to a channel: if( channel != null && channel.attachedSource == this && channelOpenAL != null && channelOpenAL.ALSource != null ) { if( lp ) ...
7dbb0251-033a-44b5-aab6-b1aea621ac1a
6
private boolean onkoVierusPiste(int[] piste1, int[] piste2) { if (piste1[0] == piste2[0]) { if (piste1[1] == piste2[1] + 1 || piste1[1] == piste2[1] - 1) { return true; } } else if (piste1[1] == piste2[1]) { if (piste1[0] == piste2[0] + 1 || piste1[0] ...
1ff15f2c-b9d4-40d0-bee7-bf117ca66c5b
0
public void set(int i){ datamap[i>>5] |= (1<<(i & 0x1F)); }
37e1fbd6-6a40-4770-a620-768275297d9d
5
private static void indexOfSortedList() { // indexOf is a bit naive, so let's see if a sorted list can be made to behave better with binarySearch ArrayList<Integer> sorted = new ArrayList<>(5000000); // Pre-loading randoms Random random = new Random(); random.setSeed(1337L); ...
c71be1dc-696f-4781-9506-ff7bbba25c8e
4
public String fileUp(MultipartFile upfile ,HttpServletRequest request) { String pathName = "/resources/up"; String path = "C:\\spring\\sts\\spring_mvc_06\\src\\main\\webapp"+pathName; String fileName = upfile.getOriginalFilename(); File file = new File(path+"\\"+fileName); ...
aaf26a9b-cc3f-4720-8cbf-d805dfbc3105
3
@Override public void doJob() { int libA = 0 ; int libB = 1; //GET Resource from Publisher try{ WebResource webResource = client.resource("http://54.215.210.214:9000/orders/75829"); Shipped_Books sb = webResource.accept(MediaType.APPLICATION_JSON).get(Shipped_Books.class); String data = ""...
1e9051ff-0db0-420a-bd9b-c54f96a67a06
2
public void setStatustextZoomedFontcolor(int[] fontcolor) { if ((fontcolor == null) || (fontcolor.length != 4)) { this.statustextZoomedFontColor = UIFontInits.STATUSZOOMED.getColor(); } else { this.statustextZoomedFontColor = fontcolor; } somethingChanged(); ...
31805e90-036e-42c7-a541-f0604b1f1c0f
6
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...
5a3459eb-5a75-44e2-8096-be9ddb0da6b3
7
static final void method466(boolean bool, String string, int i, byte i_0_, boolean bool_1_, int i_2_, int i_3_, boolean bool_4_, int i_5_, long l, String string_6_, long l_7_, int i_8_) { try { anInt5238++; if (!Class5_Sub1.aBoolean8335 && FileArchiveTracker.anInt4776 < 500) { i_8_ = (i_8_ ^ 0x...
bd229336-f3d6-4ca4-8016-ae7a5d204977
6
private void castEffect(EntityPlayer p, PlayField f) { switch (type) { case SLOMO: f.setSlomo(3, 1200); break; case MISSLE: p.setWeapon(EntityPlayer.Weapon.MISSLE); break; case LASER: p.setWeapon(EntityPlayer.Weapon.LASER); break; case NUKE: p.setWeapon(EntityPlayer.Weapon.NUKE); break...
ef4d3356-1d7b-47e0-9d6d-3b12c70b70ee
7
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Country)) return false; Country country = (Country) o; if (id != country.id) return false; if (code != null ? !code.equals(country.code) : country.code != null) return false; ...
e14f7c86-7ebf-4cfe-a429-7a52dc6ceeb0
3
public void loadProfile( Profile p ) { try { log.trace("Loading profile data into UI"); shipUnlockPanel.setProfile(p); generalAchievementsPanel.setProfile(p); statsPanel.setProfile(p); profile = p; } catch (IOException e) { log.error( "Error while loading profile", e ); if ( profile != nul...
7444f873-3016-49fe-8250-c84ddaf6c218
6
private static String createTable(Class<?> bean) { String tableName = getTableName(bean); List<NameAndType> columns = getColumns(bean); if (tableName != null && !tableName.equals("") && !columns.isEmpty()) { StringBuilder createTableSql = new StringBuilder("create table "); //加表名 ...
7d90487a-9677-406a-b590-d94b2e714b32
5
private void showPopup() { int chosen = -1; // keep redisplaying dialog until cancelled or valid option chosen do { // dialog chosen = JOptionPane.showOptionDialog(ui, this, "Enter Setup Information", JOptionPane.OK_CANCEL_OPTION, JOptionPane.DEFAULT_OPTION, null, null, null); } while (!setupCom...
7373cda6-95e0-4aa6-8109-62d427475a4f
3
public final static void cut(String srcImageFile, String result, int x, int y, int width, int height) { try { // 读取源图像 BufferedImage bi = ImageIO.read(new File(srcImageFile)); int srcWidth = bi.getHeight(); // 源图宽度 int srcHeight = bi.getWidth(); // 源图高...
5ea43c06-519b-43ab-8827-2fd130af0ab8
6
private boolean colCheck(Table t, Table t2) { for (int i = 0; i < t.columns(); i++) { for (int j = 0; j < t2.columns(); j++) { if (t.getTitle(i).equals(t2.getTitle(j))) { tmp = new int[match.length + 1]; tmp[tmp.length - 1] = i; ...
527fde1d-efb8-4d23-92e2-9c79c466bf76
9
public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { final ArrayList<Player> cSmoke = CrazyFeet.CrazySmoke; final ChatColor yellow = ChatColor.YELLOW; final ChatColor red = ChatColor.RED; if(args.length < 1) { if (sender instanceof Player) { Player playe...
6685a45a-dac9-4f4c-bbed-970055d06307
2
public static void main(String args[]) { double gallons, litres; int counter; counter = 0; for(gallons = 1; gallons <= 100; gallons++) { litres = gallons * 3.7854; System.out.println(gallons + " gallons is " + litres + " litres."); counter++; if (counter == 10) { System.out.println(); count...
5fef27f2-dbc2-44c8-a688-d9c90058716b
0
@Override public void initialize(URL arg0, ResourceBundle arg1) { colCode.setCellValueFactory( new PropertyValueFactory<SuppliersModel, String>("suppliercode")); colName.setCellValueFactory( new PropertyValueFactory<SuppliersModel, String>("name")); updateTable();...
6f85e189-515f-4716-b245-998e065dae0f
3
@Override public ArrayList<IMazeCell> getListOfIntactNeighbours() { ArrayList<IMazeCell> result = new ArrayList<IMazeCell>(); for (IMazeCell cell : this.connectedCells) { if (cell != null) { if (cell.getNumberOfIntactWalls() == cell.getNumberOfWal...
a99d8d03-0e4a-4ff5-87bd-5bb8593d1fe3
6
public static HashMap<String, TerrainType> loadTerrains(){ HashMap<String, TerrainType> terrainMap = new HashMap(); try{ // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream("resources/configfiles/terraintypes.txt"...
c1ddc15a-17c8-46c4-8781-c0ba6cbc04d6
6
public static boolean validChoice(int row, int column) { boolean isValid = true; if (row < 0 || row > 2 || column < 0 || column > 2) { isValid = false; } else if (board[row][column] == 'X' || board[row][column] == 'O') { isValid = false; } return isValid; }
02e0a4e5-8dc3-4b9c-8675-99a7c85ab418
6
private byte fromOpcode( Opcode opcode ) { if( opcode == Opcode.CONTINUOUS ) return 0; else if( opcode == Opcode.TEXT ) return 1; else if( opcode == Opcode.BINARY ) return 2; else if( opcode == Opcode.CLOSING ) return 8; else if( opcode == Opcode.PING ) return 9; else if( opcode == Opcode.PON...
d9092adf-8c19-4afc-bebc-837deae67870
7
public synchronized void arcTo(float rx, float ry, float angle, boolean largeArcFlag, boolean sweepFlag, float x, float y) { // Ensure radii are valid if (rx == 0 || ry == 0) { lineTo(x, y); return; } checkMoveTo(); // check if prev command was moveto // Get the current (x, y) coordinates of th...
4077769b-f6df-4053-bb5d-660835a65d35
0
public float getCompletion() { return (float)this.completedPieces.cardinality() / (float)this.pieces.length * 100.0f; }
d8c577e8-a185-4a6f-b7b2-30a20e9c69a9
3
@Override public double[] get3DData(int px, int py, int pz, int sx, int sy, int sz) { double[] res = base.get3DData(px, py, pz, sx, sy, sz); int s = sz*sz; int i = 0; for(int y = 0; y < sy; y++) { double sub = (y-maxY+margin)/margin; if(sub < 0) sub = 0; ...
37b36703-c7c1-4e24-ba1a-19d41ac5d1cc
8
public String getAsDuration() { if (lowerBound.longValue() == higherBound.longValue()) { return "0s"; } long duration = getLength().longValue(); long remaining = duration; long seconds = remaining % 60; remaining /= 60; long minutes = remaining % 60; ...
04d37511-995e-49dc-9f41-c160a23f6266
0
@AfterClass public static void afterClass() { System.out.println("Testing WordReader Ended."); }
a0253285-290b-4f10-8357-b2f11e232432
5
public void BajaInscripcion(Inscripcion inscripcionBaja, Inscripcion inscripcionAlta){ if(this.getEquiposConfirmados()) throw new EquiposConfirmadosException("No se puede desinscribir porque los equipos ya fueron confirmados"); inscripciones.remove(inscripcionBaja); if(cantidadInscriptosEstandar()==9){ for ...
3767f00a-86b8-4302-8d2f-1b3e68810d76
8
@Override public void run(){ try { mouse = null; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = (int) screenSize.getWidth(); int height = (int) screenSize.getHeight(); ...
de2ba3b9-25d7-49e3-8d1e-4ea0f77a7e24
0
public void setName(final String name) { this.name = name; }
c311c1d4-c703-4d32-96d3-f679821932bd
2
public int size(String cod_competicao) { try { int i = 0; Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("SELECT Cod_Equipa FROM EquipaTorneio where cod_competicao='"+cod_competicao+"'"); for (; rs.next(); i++); re...
c67ca78e-224d-4df2-8336-bd00022d9905
2
public List<NaturalSatellite> getNaturalSatellites() { List<NaturalSatellite> returnedSatellites = new ArrayList<NaturalSatellite>(); for (Satellite satellite : satellites) { if (satellite.getClass() == NaturalSatellite.class) { returnedSatellites.add((NaturalSatellite) sate...
b2632cd3-df8a-41d3-b651-54f9fbc64115
5
public static Map<String,String> parseEntityDescriptor(String string) throws DetectRightException { if (string == null) return new LinkedHashMap<String,String>(); LinkedHashMap<String,String> retArray = new LinkedHashMap<String,String>(); ArrayList<String> tmpPad=Functions.explode(":",string); while (tmpPad.siz...
113c9c5e-70d3-4cb8-a70d-04d92692eb53
9
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Subject)) { return false; } Subject other = (Subject) object; if ((this.idSubject == null && other.idSubject !=...
eba20ac3-eb37-4653-a29f-abece8967c40
5
public static String toUpperCamel(String name) { StringBuilder sb = new StringBuilder(name.length()); boolean toUpperCase = true; for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); if (c == ' ' || c == '_' || c == '-') { toUpperCase = true; } else if (toUpperCase) { sb.append(Char...
59e2a4dd-d268-4105-9a75-df8d1fed359b
5
protected void clearGame(MouseEvent e, int cx, int cw, int cy, int ch, TicTacToeBoard tb, TicTacToePlayer tp, Main m, LinkedList<Square> SquareStore) { // clear game button if (e.getX() > cx && e.getX() < cx + cw) { if (e.getY() > cy && e.getY() < cy + ch) { this.clearPlayerS...
7ddd76fe-e021-4bb4-8a40-3d662c076014
5
static Connection getConnection() { if (_conn == null) { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (Exception e) { e.printStackTrace(); } try { _conn = DriverManager.getConnecti...
da0af605-923c-4d97-8f71-fffea1f820c0
6
private void createPaperTypeCombo(PrintRequestAttributeSet set) { Media[] possible = (Media[]) mService.getSupportedAttributeValues(Media.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); if (possible != null && possible.length > 0) { Media current = (Media) PrintUtilities.getSetting(mService, set, Media.clas...
45cce143-ee2c-4519-b973-0e5ae159b49f
2
public static ArrayList<Stock> getStocks() { ArrayList<Stock> stocks = new ArrayList<Stock>(); File f = new File("stocks.txt"); try { FileReader fr = new FileReader(f); BufferedReader br = new BufferedReader(fr); String s = ""; while ((s = br.readLine()) != null) { String[] comp = splitLine(s, ...
cd507c2e-dead-4837-b70b-f7cb7b8749a9
8
public void modelUpdate(final ModelEvent e) { EventQueue.invokeLater(new Runnable() { public void run() { switch (e.getID()) { case ModelEvent.SCRIPT_START: if (disabledAtScript) enableRadioButton(false, e.getSource()); break; case ModelEvent.SCRIPT_END: if (disabledAtScript) ...
401d9255-b871-4390-a8a9-86d04ee2308f
1
@Override public List<Integer> save(List<User> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException { try { return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (User bean) -> { Object[] obj = new Object[8]; obj[0] = bean.get...
86618db4-ed11-4631-ba38-3c64b4a8f04d
1
public static boolean isServerRunning(){ return server != null && server.isRunning; }
c9f830c9-a892-4097-b493-f53ac18e1005
6
@Override public BinaryNodePS<T> addLeftSubtree(Node<T> parent, BinaryTree<T> st) { if (!(parent instanceof BinaryNodePS) || !(st instanceof BinaryTreePS)) { throw new DifferentNodeTypesException(); } else if (isSafe() && !contains(parent)) { throw new NodeNotFoundException(); } BinaryNodePS<T> bn = (Bin...
c3fd6eb6-688f-4e3d-836c-80e1068af1f4
1
public void tick(EnemyWave allEnemies) { for (GameAction currentAction : getGameActions()) { currentAction.tick(this); } updateAllObjects(); recalcLevel(); rangeHandler.updateObjectsWithinRange(allPlaceables, this); }
603ba437-fe7b-4ab2-aefb-44df5282bebd
2
public int getIndex(User user) { for (int i = 0; i < userList.size(); i++) { User user1 = userList.get(i); if (user1.getUserID().equals(user.getUserID())) return i; } return -1; }
6c5dab7a-0cd0-49de-9029-d17024bef1b1
0
public void setDuty(boolean duty) { Duty = duty; }
2cebcd0c-f4b8-4d59-acbf-29b21e3a5a23
1
public static JSONObject showParamError() { JSONObject jo = new JSONObject(); try { jo.put("rtnCode", "400 param error"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return jo; }
71b30f15-1aae-4d8a-aec4-3dd0f3ff2b35
4
public AxisInfoXmlDriver(String xmlStr) throws DocumentException, XmlTypeErrorException { super(); if (!isAxisInfoXml(xmlStr)) { throw new XmlTypeErrorException("not a valid axisInfo Xml"); } document = DocumentHelper.parseText(xmlStr); cubeIdentifier = do...
673bc14b-3ff4-451d-b52b-cb9817488c49
0
private UDPTools() { }
1d0f05ec-93ff-4f50-843a-20b0cac48c64
9
public short asShort() { try { if (isNull()) { return 0; } else if (isShort()) { return ((Short) value).shortValue(); } else if (isString()) { String s = (String) value; s=s.replaceAll(",",""); return Short.valueOf(s).shortValue(); } else if (isInt()) { ret...
eea89ef2-d439-4778-96cb-c887b57703fa
8
private void createDragTypes(Composite parent) { parent.setLayout(new GridLayout()); Button textButton = new Button(parent, SWT.CHECK); textButton.setText("Text Transfer"); textButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Button b = (Button)e.widget; if...
5dba95e6-9c4a-4e42-b2d5-42da1aad0d77
5
private void updatePassword() { lblError.setVisible(false); switch (lblEditPassword.getText()) { case "Klar/uppdatera": if (!Validate.tfEmpty(tfPassword) && Validate.notOverSize(tfPassword)) { try { String query = "Update administra...
0acca840-de36-463b-8efd-3ec624544038
7
@Override public void deleteElement(Element element){ if(element instanceof Block){ //check element is directive or block type for(int i=0;i<myBlocks.size();i++){ if(myBlocks.get(i) == element){ myBlocks.remove(i); } } }else{ for(int i=0;i<myDirectives.size();i++){ if(myDirectives.get(...
9ea86bd1-f537-4596-b7a8-ec4e26f0f406
5
public void run() { try { server = ServerSocketChannel.open(); server.configureBlocking(false); server.socket().bind(new java.net.InetSocketAddress(port)); Selector selector = Selector.open(); server.register(selector, server.validOps()); ...
061970ad-1bf3-4273-abc6-f9456aa2a12d
7
static private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 3; i++) { try { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: j...
69be6cd3-278f-48b1-98f5-29e5e7ed9016
5
public void addEntry(String caReference, List<CVCertificate> terminalCertificates, PrivateKey terminalKey) { if (caReference == null || certificateListsMap.containsKey(caReference)) { // For now we disallow this. throw new IllegalArgumentException( "Bad key (already present or null)."); } if (termin...
f207c9e7-2b08-4afb-bec7-54a4d0e23cdd
3
public void reloadSubWidth() { subWidth = width; for(int i=0;i<values.length;i++) { int thisWidth = Fonts.get("Arial").getStringDim(values[i], 20)[0]; if(keyCombos[i] != null) { int keyWidth = Fonts.get("Arial").getStringDim(keyCombos[i].toString(), 20)[0]; thisWidth += keyWidth+20; } if(t...
aa49f69a-25d1-4006-8235-5bd09c8a1fc9
5
public int read(int numBits) throws IOException { int res = 0; while (numBits > 0 && !eof) { if (remaining == 0) { tmp = input.read(); if (tmp == -1) { eof = true; return -1; } remaining =...
9a834dcb-acea-4c5a-9069-6086c0176c31
8
@Override public boolean okMessage(Environmental host, CMMsg msg) { if(affected instanceof MOB) { for(final Pair<Clan,Integer> p : ((MOB)affected).clans()) oldClans.add(p); ((MOB)affected).setClan("",Integer.MIN_VALUE); // deletes all clans } if((msg.source()==affected) &&(msg.tool() instanceof A...
e8361bbd-878d-4ef0-8b41-9436ae872dce
5
private static void unzip(String strZipFile) throws IOException { try { LauncherFrame.notificationLabel.setText("Estraggo i file scaricati ..."); System.out.println(strZipFile); File fSourceZip = new File(strZipFile); zipFile = new ZipFile(fSourceZip); Enumeration<?> e = zipFile.entries(); String z...
f5391ad1-a2f5-4e56-9e0b-4e30c808ba9b
4
public CellValue getCell(int x, int y) throws Exception{ if((x < 0) || (y < 0) || (x > TaTeTi.MAX_CELLS - 1) || (y > TaTeTi.MAX_CELLS - 1)) { throw new Exception("Posición elegida fuera de rango: x=" + x + ", y=" + y + ", MAX_CELLS=" + TaTeTi.MAX_CELLS); } return this.state[x][y]; ...
c2125317-6d62-41c6-ba94-3fc23f3bd96d
2
public void visitStoreExpr(final StoreExpr expr) { print("("); if (expr.target() != null) { expr.target().visit(this); } print(" := "); if (expr.expr() != null) { expr.expr().visit(this); } print(")"); }
71c5464b-44db-4ad3-b960-01e0ad697361
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
7a2cff73-5ef0-46e7-b5ad-d0031668f1aa
4
public int minimumTotalWithDP(List<List<Integer>> triangle) { if (triangle == null || triangle.size() == 0) { return 0; } Integer[] min = triangle.get(triangle.size() - 1).toArray(new Integer[triangle.size()]); for (int i = triangle.size() - 2; i >= 0; i--) { for (int j = 0; j < triangle.get(i).size()...
a30e6e3e-719c-420c-a24d-64f208a50077
0
private void initDrools() { readFromFile(); Collection<KnowledgePackage> knowledgePackages = knowledgeBuilder.getKnowledgePackages(); KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); config.setOption(EventProcessingOption.STREAM); Knowled...