method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6e763fc1-702d-4270-9bb6-10f31c6d9ac4 | 7 | public void moveCell(int aFromIndex, int aToIndex)
{
if (aFromIndex < aToIndex)
aToIndex --;
if ( aFromIndex >= 0 && aFromIndex < cellList.size()
&& aToIndex >= 0 && aToIndex < cellList.size() )
{
// swap
AnimationCell cell = cellL... |
dc081b35-bd94-4360-a227-449fb6c09fd2 | 8 | public void fillIndexes(String... indexes) {
if (indexes == null || indexes.length > MAX_IDX) {
throw new IllegalArgumentException("Indexes are incorrect");
}
for (int i = 0; i < indexes.length; i++) {
switch (i) {
case IDX_1:
index1 = ... |
f5913868-6f44-4968-a831-948d53688483 | 7 | @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerCommand(PlayerCommandPreprocessEvent e){
Player player = e.getPlayer();
String[] args = e.getMessage().split(" ");
if(e.getMessage().equalsIgnoreCase("/oitc")) return;
if(e.getMessage().equalsIgnoreCase("/oitc help")) return;
if(e.getMessage(... |
637fc79e-0b73-49fd-9fcf-c40596ae811d | 1 | public FlowNetwork(int V) {
this.V = V;
adj = (Bag<FlowEdge>[]) new Bag[V];
for (int v = 0; v < V; v++)
adj[v] = new Bag<FlowEdge>();
} |
7d708a9d-b155-42d0-90d7-b3ff25fd2863 | 4 | public void sendGamestate(int turnNumber, int dimension, String mapData[][],
AIConnection playerlist[]){
JSONObject root = new JSONObject();
try {
root.put("message", "gamestate");
root.put("turn", turnNumber);
JSONArray players = new JSONArray();
for(AIConnection ai: playerlist){
... |
9040c9a7-1446-40cd-962b-493fd3cbe728 | 0 | public DragonBaneSword(){
this.name = Constants.DRAGONBANE_SWORD;
this.attackScore = 15;
this.attackSpeed = 10;
this.money = 789;
} |
0d99b223-cafd-4f1f-86d0-a6095c696f41 | 1 | public boolean attack(Unit enemy)
{
//this != enemy: this cannot be enemy if different teams, should be redundant check
if(canAttack(enemy))
{
int expGain = Calculator.expGain(lv, enemy.getLV());
int tDmg = Calculator.dmgAmt(atk + wepATK(), enemy.getDEF()) * 0;
... |
8636daea-b8b0-410e-b0c1-b9a4729b6364 | 7 | public double[][] rankedAttributes ()
throws Exception {
int i, j;
if (m_attributeList == null || m_attributeMerit == null) {
throw new Exception("Search must be performed before a ranked "
+ "attribute list can be obtained");
}
int[] ranked = Utils.sort(m_attrib... |
ca517373-248c-49e5-8986-897060aac554 | 2 | public void parseAndExecute(String[] args) {
initOptions(options);
// create the parser
CommandLineParser parser = new GnuParser();
try {
// parse the command line arguments
CommandLine line = parser.parse(options, args);
parse(line);
}
... |
1b8a0ca1-3e23-4f73-9aa7-065f7e2716cb | 9 | public void paint1(Graphics g) {
// g.drawImage(fondo.getImage(), 0, 0,1300,700, this);
g.setFont(new Font("default", Font.BOLD, 16));
g.setColor(Color.white);
if (vidas > 0) {
if (bola != null) {
g.drawImage(fondo, 0, 0, 1024, 640, this)... |
9ff5ff59-d60e-4d35-b946-0bd782a947bd | 7 | public static void main(String[] args) {
boolean l = false; //left right disabled by default. If enabled, even => right handed | odd => left handed
int numPhilosophers = 4; // also the number of forks
int numCycles = 10; //num think/eat cycles
long thinkTime = 0; // milliseconds
... |
eb394337-e592-480d-a679-877a7c26e28b | 2 | private double getExchangeRateFromDB(Currency toCurrency, Currency fromCurrency, Connection connection, Date date) {
try {
String query = "select cambio from historico_cambios "
+ "where divisa_desde='" + fromCurrency.getCode() + "' and divisa_a='" + toCurrency.getCode() + "'";
... |
8d2d8fa1-c724-4ef8-85f6-523fa9da969c | 0 | public Rectangular(int length, int width) {
this.length = length;
this.width = width;
} |
f15e0ef1-32d3-4fea-baab-830fae6c59dc | 6 | public boolean deleteElementField(ElementField element) {
if (element instanceof Ball) {
return _balls.remove((Ball) element);
} else if (element instanceof DestructibleBrick) {
return _dBricks.remove((DestructibleBrick) element);
} else if (element instanceof BoundaryFie... |
4e62ce71-41db-4f0f-9c01-eab388d5c620 | 1 | private void initSearch()
{
for (Map.Entry<String, String> entry: conditions.entrySet())
{
ArrayList<Long> conditionIds = generateIdsForCondition(entry.getKey(), entry.getValue());
intersect(conditionIds);
}
} |
953d0b46-5e0d-45af-835a-13b617b8efca | 9 | void rehash() {
int oldCapacity = table.length;
Entry oldMap[] = table;
int i;
for (i = oldCapacity; --i >= 0;) {
Entry e, next, prev;
for (prev = null, e = oldMap[i]; e != null; e = next) {
next = e.next;
Object obj = e.ref.get();... |
5245e1cb-7cf2-4cee-af1e-ff0c241e9fdc | 5 | public Object[][] readExcel(String fileName, String sheetNumber) throws IOException {
Object[][] data = null;
FileInputStream file = new FileInputStream(new File(fileName));
HSSFWorkbook workbook = new HSSFWorkbook(file);
HSSFSheet sheet = workbook.getSheet(sheetNumber);
HSSFRow row = sheet.getRow(0);
... |
3bba8329-5c40-44db-953a-80a654625db4 | 0 | public Rectangle( int h, int w, int t, int l) {
height = h;
width = w;
top = t;
left = l;
} |
51c43a77-8abf-4b05-b3de-31bbf5032ce4 | 0 | public File getImage() {
return image;
} |
0f9ffa12-037c-4f5a-8830-678f7ef45bd0 | 0 | public final int getPort() {
return _port;
} |
4563cbf0-0bda-40c3-ba4c-e2fd4e60d1b8 | 0 | @Override
public ArrayList<Excel> getColoredExes() {
return coloredEx;
} |
cce2b711-48a9-4a0b-9142-49b9d719e62a | 0 | public static Set<String> getDomainSet()
{
return config.keySet();
} |
0ea81b9e-4ea7-48ad-9e83-e28067a538aa | 9 | public Value newValue(final Type type) {
if (type == null) {
return BasicValue.UNINITIALIZED_VALUE;
}
boolean isArray = type.getSort() == Type.ARRAY;
if (isArray) {
switch (type.getElementType().getSort()) {
case Type.BOOLEAN:
case... |
f5a8697d-dc6d-4397-9be5-36b68ebeb7e5 | 6 | public static boolean isdni(String dni){
boolean aux=false;
if(dni.length()!=9){//tiene que tener 9 caracteres
aux=false;
}else if((dni.charAt(dni.length()-1))>90 ||(dni.charAt(dni.length()-1))<65){//mirar si el ultimo es letra
aux=false;
}else{//mirar que los 8 primeros sean numeros
int i=0;
do... |
6da04c8f-9f79-46ca-8e1a-feed2256416b | 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... |
890219f9-a522-439a-92bb-c45786e33db4 | 0 | public WordReader(String dictPath) {
super();
loadDict(dictPath);
} |
d3e6f09b-f429-4db5-a6b4-92cd56c4a9b5 | 7 | private Faction buildFactionFromXML(StringBuffer buf, String factionID)
{
final Faction F=(Faction)CMClass.getCommon("DefaultFaction");
F.initializeFaction(buf,factionID);
for(final Enumeration<FRange> e=F.ranges();e.hasMoreElements();)
{
final Faction.FRange FR=e.nextElement();
final String CodeName=(FR... |
450144ab-9dad-4947-b14f-bf088cd4d4bf | 7 | public static ArrayList<ItemSet<String>> readFile(String filename) throws IOException
{
BufferedReader reader=new BufferedReader(new FileReader(new File(filename)));
ArrayList<String> attributeNames=new ArrayList<String>();
ArrayList<ItemSet<String>> itemSets=new ArrayList<ItemSet<String>>();
String line=reade... |
a140231b-e564-4707-ab0c-6d2024aa4def | 9 | @Override
public Element generateDataElement(LauncherAction action) {
JavaAppDesc desc = (JavaAppDesc)action.getLaunchDesc();
org.w3c.dom.Element e = createInitialElement(desc);
//check to see if we used an AppDescURL
if(desc.getAppDescURL() != null) {
e.se... |
aae5dfe3-7d6d-4bc5-a3fe-1389b3630383 | 1 | public Image loadImage (String file) // this method reads and loads the image
{
try
{
InputStream m = this.getClass().getResourceAsStream(file);
return (ImageIO.read (m));
}
catch (IOException e)
{
System.out.println ("Error: File " + f... |
a9dbe733-e59d-4433-a75f-ea7cc2cd26fe | 7 | private boolean open() {
boolean result = false;
if (!isValid()) {
try {
Class.forName("com.mysql.jdbc.Driver");
this.connection = DriverManager.getConnection(this.url, this.user, this.password);
if (isValid())
if (isDBExisted() || createDB())
if (isTableExisted() || createTable())
... |
599ea877-badb-4c9b-b525-b6bbb2bd1dc9 | 0 | public ControlPanel(ConfigurationController controller) {
this.controller = controller;
initView();
} |
5add996f-9dc7-427d-b134-c3b920d5bda1 | 3 | @Override
public Usuario ListById(int id_usuario) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Usuario u = new Usuario();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID);
... |
585bb357-3d80-4e16-8985-477e4528aa0a | 0 | public static Test suite() {
return new TestSuite(AppTest.class);
} |
1ddf6f3f-da37-4d4e-8ca8-c9994577005a | 6 | void processFile(File file){
if(file.exists() == false){
return ;
}
if(file.isDirectory()){
for(String path : file.list()){
processFile(new File(path));
}
}
else{
try {
FileInputStream fis = new FileI... |
9296d8a1-c84a-4791-992f-258ec55399f9 | 9 | public List<IceCream> produceAllKnownIceCream(){
List<IceCream> list = new ArrayList<IceCream>();
for(Class<? extends IceCream> ice: getAllIceCreamTypes()){
for(Taste taste: getSomeTaste()){
//IceCream ice = new IceCream(taste, type);
try {
list.add(ice.getDeclaredConstructor(Taste.class).newIns... |
f8036c6f-7d1b-406c-928d-f2d19275a1c1 | 8 | @Override
public boolean equals(Object o) {
if (this.getClass() != o.getClass()){
return false;
}
PlayedNoteToken oPlayed = (PlayedNoteToken) o;
if (this.getType().equals(oPlayed.getType()) &&
this.getNumerator().equals(oPlayed.getNumerator()) &&
... |
65f39d11-a314-4323-9d78-a98517f9aef9 | 6 | @Override
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("Start the Match Scouting Server"))
{
//Check for Valid Data
if(wG.validData())
{
//Start the MainGUI
wG.pullThePlug();
JPanel p = new JPanel(null);
MainGUI mG = new MainGUI(p);
mG.setVisible(true);... |
88f154fa-19a6-4d0d-935a-0e645fc9aa1d | 1 | public static void main(String[] args)
{
JFrame frame = new JFrame("Realms of Caelum");
Canvas canvas = new Canvas();
Dimension size = new Dimension(1280, 720); //TODO add size to settings later
canvas.setMinimumSize(size);
canvas.setMaximumSize(size);
canvas.setPreferredSize(size);
canvas.setSize(siz... |
49521267-b006-4436-ae2c-5878e76bee24 | 8 | void Statement() {
printer.startProduction("Statement");
if (la.kind == 8) {
Get();
this.generator.startIf();
Expect(9);
this.enterParenthesis(BOOLEAN);
Expr();
Expect(10);
if (this.currentType != BOOLEAN) {
// ERROR, non-boolean expression in conditional
printer.print("Error in ... |
8730fa98-39d7-4868-8a7e-6f10b49a8e3e | 5 | private void btOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOkActionPerformed
String nome = txPesqNome.getText();
ConsultaController pc
= new ConsultaController();
modelo.setNumRows(0);
for (Consulta p : pc.listByNome(nome)) {
String ... |
368e5963-184e-41ef-bf59-54484b612f68 | 8 | public void handle(Input input, Robot robot) {
// jumpForce applique pour faire sauter le personnage
float jumpForce = 50000;
if (robot.auSol()) {
if ((input.isKeyPressed(get_key()) && robot.getEnergie() > 0 && !robot
.getPlusEnergie()) || (input.isKeyPressed(get_key()))) {
if (robot.getDirectionDroi... |
fe18d92b-f031-4f2c-9070-926fcd111c8b | 3 | private String getSelectedText(){
String text = "";
if(activField.equals("textArea"))
text = textArea.getSelectedText();
if(activField.equals("fieldNameFile"))
text = fieldNameFile.getSelectedText();
if(activField.equals("fieldCommandLine"))
text = fie... |
0bb23dee-7d34-482f-9ade-fce3e0e71bef | 4 | public static void addJarsInDir(String dirPath) {
File dir = new File(dirPath);
if (!dir.exists()) {
return;
}
File[] files = dir.listFiles();
if (files == null) {
return;
}
for (int i = 0; i < files.length; i++) {
if (files[i].... |
50cd1a94-e44c-4db3-836d-c740b437d763 | 4 | public static BufferedImage readImage(String remoteurl) {
BufferedImage image = null;
boolean flag = false;
long startTime = System.currentTimeMillis();
do {
try {
URLConnection connection = getURLConnection(remoteurl);
image = ImageIO.read(connection.getInputStream());
if (flag)
System.out.... |
6b2f2fab-3ad1-441e-972c-5f90801ed93f | 2 | public void printGraph(Writer w) throws Exception {
for(Entry<Value, HashSet<Value>> v : adjacencyList.entrySet()) {
Value node = v.getKey();
HashSet<Value> edges = v.getValue();
// first write the node so that nodes that have no edges
// connecting them will be ... |
45db472b-e75b-4848-8248-c911cf7e6956 | 9 | public boolean esPotAfegir(CjtRestAssignatura cjtResAssig,CjtRestGrupSessio cjtResGS) {
ArrayList<Restriccio> llista = new ArrayList();
llista = cjtResAssig.getCjtRes();
int size = llista.size();
for(int i = 0; i < size; ++i){
Restriccio res = llista.get(i);
... |
abf68db8-bb18-4121-81d6-7da3518e6093 | 7 | public void run()
{
ServerMessage m;
try {
m = (ServerMessage) input.readObject();
String message = m.getCommand();
if(message.equals("JOIN"))
{
//Add to the list of users
this.dataAccess.join(m.getUser());
System.out.println("got join request");
}else if(message.equals("LEAVE")... |
cddddc5f-c916-4fa3-aeee-13c99099a49d | 3 | public static String encodeFromFile(String filename)
throws java.io.IOException {
String encodedData = null;
Base64.InputStream bis = null;
try {
// Set up some useful variables
java.io.File file = new java.io.File(filename);
byte[] buffer = new byte[Math.max((int) (file.length() * 1.4 + 1),
40)... |
b65bd453-78ae-47b8-9467-d02edcba7d7e | 4 | public boolean floorAdjacent(int x, int y) {
//this doesn't check diagonals cause it would look ugly
if (getTile(x + 1, y).isPassable()) {
return true;
}
if (getTile(x - 1, y).isPassable()) {
return true;
}
if (getTile(x, y + 1).isPassable()) {
... |
b92b047e-6966-47e2-bbcf-3732e04498a8 | 0 | public boolean getSeenFossil() {
return this.seenFossil;
} |
c7e4594d-9a70-45f9-a95d-790f430f2703 | 3 | public void fusionWithAdd(CPLayer fusion, CPRect rc) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(rc);
for (int j = rect.top; j < rect.bottom; j++) {
int off = rect.left + j * width;
for (int i = rect.left; i < rect.right; i++, off++) {
int color1 = data[off];
int alpha = (color1 >>> ... |
ab3a5dbd-44ee-4312-baee-cdfbd100729a | 3 | private void addCharacter(char c) {
switch(style) {
case PLAIN_TEXT:
text = text + c;
break;
case INTEGERS:
try {
Integer.parseInt(text + c);
text = text + c;
} catch (NumberFormatException e) {}
break;
default:
break;
}
} |
35ac9fb8-0b8a-4c4b-b875-f87d57006bc3 | 8 | private void buildAntTask(String AntDirectory, ArrayList<TDeployLine> DeployLines, Integer orgindex) {
TStringList packagexml = new TStringList();
packagexml.add("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
packagexml.add("<Package xmlns=\"http://soap.sforce.com/2006/04/metadata\">");
TStringList classesxml ... |
47390e5b-7a32-456d-88dd-17d7e6066d18 | 8 | Destination getDefaultDestination() {
final Unit carrier = getUnit();
PathNode path = null;
// If in Europe, stay in Europe
if (carrier.getLocation() instanceof Europe) {
return new Destination();
}
// Otherwise should be on the map
if (carrier.getTi... |
6df8fd2e-16b0-4cf2-bf21-6b91cbac6318 | 3 | public void paint(Graphics g)
{
if (bounds != null)
{
if (connectIcon != null)
{
g.drawImage(connectIcon.getImage(), bounds.x, bounds.y,
bounds.width, bounds.height, null);
}
else if (handleEnabled)
{
g.setColor(Color.BLACK);
g.draw3DRect(bounds.x, bounds.y, bounds.width - 1,
... |
2eb59369-5363-4970-b592-242456cb8a8a | 9 | @Override
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_W:
System.out.println("Move up!");
break;
case KeyEvent.VK_S:
currentSprite = characterDown;
if (robot.isJumped() == false) {
robot.setDucked(true);
robot.setSpeedX(0);
}
break;
case KeyEvent.V... |
3b679a8e-ce57-4dd5-af47-8dee808fe945 | 0 | public Graphics2D clearOffscreenAndReturn() {
Dimension d = getSize();
Graphics offG = getOffScreenGraphics();
offG.setColor(getBackground());
offG.fillRect(0, 0, d.width, d.height);
return (Graphics2D)offG;
} |
47f4706e-8d6a-479a-b18f-1ebdf415e69e | 0 | protected final void setCurrentFailure(Failure currentFailure) {
this.currentFailure.set(currentFailure);
} |
882b1fdf-9ef6-4383-9ef8-0d89dec20736 | 3 | @Override
public Color colorReprisentation(int value) {
// if(colorMap.containsKey(value)){
// return colorMap.get(value);
// }
if(value == 6){
return Color.red;
}
if(value == 5){
return Color.yellow;
}
if (isTileTypeSolid(value)) {
return Color.black;
}
return Color.white;
} |
f9105f3b-995b-4cdb-a829-4fa8f8355759 | 8 | @RequestMapping(value = {"/posts"}, method = RequestMethod.GET)
public String posts(Model model, @RequestParam(required = false) String isPostCreated,
@RequestParam(required = false) String isPostUpdated,
@RequestParam(required = false) String isError) {
User... |
58896344-6df6-4941-99c6-48d3502a563a | 1 | public static void uploadJMX() {
Thread jmxUploader = new Thread(new JMXUploader());
jmxUploader.start();
try {
jmxUploader.join();
} catch (InterruptedException ie) {
BmLog.debug("JMX Uploader was interrupted");
}
} |
9957b870-6d53-43fd-ae45-365fb8a37034 | 4 | public int numberOfStudents(String name) {
try{
openDatabase();
}catch(Exception e){}
String query = "SELECT COUNT(*) FROM t8005t2 .takes WHERE ID IN (SELECT ID FROM t8005t2 .modules WHERE name= '"
+ name + "')";
int count = 0;
try {
stmt = conn.createStatement();
ResultSet rs = stmt... |
e60a5844-1d39-4bf5-b79c-8dbae54fcae0 | 1 | public int getProperty(Ability.Property property) {
if (properties.containsKey(property)) {
return properties.get(property);
} else {
return property.getDefaultValue();
}
} |
9824fa46-ddc2-443c-b036-ce9c2062b12f | 4 | public void run() {
while (true) {
// Bob needs his rest.
try {
Thread.sleep(sleepTime);
} catch (Exception e) {
e.printStackTrace();
}
// Bob needs info on his paddle.
int paddlePosition = paddle.getPosition()[0];
int mySize = Paddle.getSize()[0];
// Bob needs info on the ball's location.... |
b9c0eff1-535f-4e28-8ca0-8f91a50e12ba | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final OutputSpEmployeeTargetPK other = (OutputSpEmployeeTargetPK) obj;
if (!Objects.equals(this.szMonth, other.... |
7bf0e968-b787-4c1f-a5d6-83129c018861 | 5 | public QueueSysResult calculate(int m) {
double p0 = 0.0;
double rho = lambda / mu;
double[] rho_pow = new double[N + 1];
rho_pow[0] = 1.0;
for (int i = 1; i < rho_pow.length; ++i) {
rho_pow[i] = rho_pow[i - 1] * rho;
}
double[] m_pow = new double[N ... |
cd0b44ba-a854-4500-9bc6-72f1e988b904 | 3 | private Boolean evalBracketClose(CalculatorReader expressionReader) throws BinaryOperatorException, CalculatorException {
String el = expressionReader.getSymbol();
if (el.equals(")")) {
//System.out.println("--evalBracketClose = " + el);
if (0 == expressionStack.bracketStack.size... |
eb6a8d79-3cf5-41cc-ae8c-6751b9cd071c | 0 | public void setPrpValorTotal(Integer prpValorTotal) {
this.prpValorTotal = prpValorTotal;
} |
04501fcb-457a-4b70-93cd-a86427166fcb | 8 | public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
pm = Common.getPM();
//getBuses();
try {
User googler = Common.getGoogleUser();
if (googler == null)
resp.sendRedirect(Common.getGoogleLoginUrl());
else {
resp.setContentType("text/html");
PrintWriter... |
0c35ae72-777e-4e4d-b8bf-64f879517ae0 | 9 | @Override
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == controls.get(MappableAction.PLAYER1_UP)) {
g.firstPlayerShip.setAccelerating(false);
} else if (keyCode == controls.get(MappableAction.PLAYER1_LEFT)) {
g.firstPlayerShip.setTurningLeft(false);
} else if (keyCo... |
c25cf3fd-2287-4af5-bae6-1bb993e99dbb | 9 | public static boolean delID(String c_id) {
String sql = "delete from member where id=?";
boolean flag=false;
Connection conn = null;
PreparedStatement psmt = null;
FileOutputStream fos = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://" + Server... |
ce939756-752d-4c41-a77b-ebc629144966 | 5 | public static boolean removeContactNym(String contactID,int index){
boolean status = false;
AddressBook addressBook = Helpers.getAddressBook();
if (addressBook == null) {
System.out.println("removeContactNym - addressBook returns null");
return false;
}
fo... |
e1046e0f-2f1d-403b-9f83-f81f8585cf5e | 5 | private List<DBObject> ConstructFinvizObj(List<String> finvizReturn) {
LinkedList<DBObject> MongoObjList = new LinkedList<DBObject>();
int headerFlag = 0;
String[] headers = new String[]{""};
for (String finvizValues : finvizReturn){
finvizValues = finvizValues.replaceAll... |
564950d7-ed74-4a9f-9596-b9436b9848dd | 6 | public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... |
94b642c2-6c48-4f09-944c-b364e55dbaf1 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IndexRange that = (IndexRange) o;
if (empty != that.empty) return false;
if (fromIndex != that.fromIndex) return false;
... |
17c01897-0ed8-4d49-9a35-94c4097e74ea | 1 | public void viderListeJoueur(){
int indice=list.size();
list.clear();
fireTableRowsDeleted(0,indice-1);
//l'�criture dans le fichier
PrintWriter out=null;
try{
out=new PrintWriter(new FileWriter("Ressources/Data/score.dat"));
out.print("");
out.close();
}catch(Exception e){
JOptionPane.showMe... |
2cf9ec35-5076-497e-949a-3c9dfeb69e19 | 8 | @Override
public boolean visitObject(Map<?, ?> map) {
print('{');
boolean first = true;
for (Map.Entry<?, ?> entry : map.entrySet()) {
if (ignoreNull && entry.getValue() == null) {
continue;
}
if (!first) {
print(',');
... |
baaba256-4e3e-473d-8b82-cde962a7c56d | 4 | @Override
public void run()
{
try
{
while(true)
{
HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
connection.setHostnameVerifier( DO_NOT_VERIFY );
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, null, new java.security.SecureRandom()... |
e81734bf-81f9-4430-b6fc-b34ef2f38729 | 9 | public String selectSingleParameter(String objectName,String parameter)
{
StringBuilder sb = new StringBuilder();
Object o= list.get(objectName);
if(o!=null){
if(o.getName()[0]==parameter){
sb.append("Name- "+o.getObjectName()+" ");
if(o.getType()[... |
560d6da8-cccf-4aec-bc35-075d0040fa0c | 7 | public void updatePotentialSolutionsBar(final List<String> answers) {
final int a = answers.size();
final String[] answersToPrint = new String[5];
for(int i = 0; i < a && i < 5; i++){
final double z = Math.random();
answersToPrint[i] = answers.get((int)(answers.size()*z));
answers.remove((int)(answer... |
36acb02f-9bcc-44f4-a044-34859a89c696 | 5 | public ArrayList<WorkloadJob> generateWorkload() {
if(jobs == null) {
jobs = new ArrayList<WorkloadJob>();
// create a temp array
fieldArray = new String[MAX_FIELD];
try {
if (fileName.endsWith(".gz")) {
readGZIPFile(fileName);
}
... |
f358f020-3bb1-45ce-baa9-45af2784a42e | 5 | @Override
public List<DataRow> select(DataRow parameters)
{
List<DataRow> wynik = new ArrayList<>();
try
{
con = DriverManager.getConnection(url, login, password);
String stm;
String tabelName = parameters.getTableName();
L... |
d0a15239-b2b1-4b90-abbc-007526979e07 | 8 | public void buildConnectionCSV(String outputFilename)
throws UnsupportedEncodingException, FileNotFoundException, IOException
{
String regexp =
"^\\(" +
"\\(" +
"(?:\\(\\(\\(([^ )]+)?(?: ([^ )]+))?(?: ([^ )]+))?(?: ([^ )]+))?\\)(?: ?([^ )]+)?(?: ([^ )]+))?(?: ([^ )]+))?)\\)\\) )?" +
"\\(\\(\\(([... |
a7fa50eb-ce02-4ace-b22c-8b201e98492b | 3 | public static RemoteResourcesServer newInstance(String[] args, boolean local) {
// Disable chimpchat log
java.util.logging.Logger.getLogger("com.android.chimpchat").setLevel( //$NON-NLS-1$
java.util.logging.Level.OFF);
// load configuration file
loadConfigurationFile();
// process command line arguments -... |
a9c1b908-39fa-4056-a3be-8817184ef701 | 2 | @Override
public void remove_child(Sentence_tree child){
Sentence_tree[] new_children = new Sentence_tree[this.children.length - 1];
int j = 0;
for(int i = 0; i < this.children.length; i++){
if(this.children[i] != child){
new_children[j] = this.children[i];
j++;
}
}
this.children = new_childre... |
b8066dea-fdd3-40cd-9d7d-12029584c01f | 2 | private void cleanUpTable() {
for (int i = 0; i < commands.size(); ++i) {
commands.get(i).name = commands.get(i).name.toLowerCase();
if ( commands.get(i).name.isEmpty() ) {
commands.remove(i);
tableModel.removeRow(i);
--i;
}
... |
bb8e9a68-e7d1-4c67-8b3b-b0ffc36337db | 5 | private static void clinit() {
_disabled = true;
final ArrayList<Package> list = new ArrayList<Package>();
for (final Package p : Package.getPackages())
if (p.getName().startsWith("net.minecraft.server"))
list.add(p);
if (list.size() == 1) {
_minecraft = list.get(0).getName();
... |
9e7e8b5a-0502-42dc-92fc-1384491d65fe | 1 | @After
public void dbRestore(){
Main.clearTable();
int c=0;
for (Item i : originalItemList){
i.setQuantity(quantityList.get(c));
Main.modifyItem(i);
c++;
}
} |
6e91b790-d633-4e10-b884-e8065c07eca0 | 9 | public static long getLongBE(final byte[] array, final int index, final int size) {
switch (size) {
case 0:
return 0;
case 1:
return Bytes.getInt1(array, index);
case 2:
return Bytes.getInt2BE(array, index);
case 3:
return Bytes.getInt3BE(array, index);
case 4:
return Bytes.getInt4B... |
57e12f1f-96aa-4f25-8ee9-e31a0db75003 | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((comment == null) ? 0 : comment.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
} |
a4d8bd5e-ee30-4827-8cc3-e824dee58a74 | 4 | private void loadRoads() {
File file = null;
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].getName().equals("roadID-roadInfo.tab")) {
file = listOfFiles[i];
break;
}
}
try {
Scanner sc = new Scanner(file);
sc.nextLine();
while (sc.hasNextLine()) {
String line = sc... |
7dae14e4-fdac-484c-8000-e41085c66299 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TMasterSalesman other = (TMasterSalesman) obj;
if (!Objects.equals(this.salesIdScy, other.salesIdScy)) {
... |
d8dfc1b4-9989-4344-960c-ad5447f089bd | 7 | private String getToolTipText(Component component,
ComponentAdapter adapter) {
if ((stringValues == null) || stringValues.isEmpty()) {
return null;
}
String text = "";
for (int i = 0; i < stringValues.size(); i++) {
int mode... |
92f10ab9-fa03-499d-a29d-b1fe4dadf3a0 | 5 | @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 Question)) {
return false;
}
Question other = (Question) object;
if ((this.idQuestion == null && other.idQuesti... |
96a0dfde-6e31-461b-8761-021be41d281c | 4 | public void checkTripleBuffer()
{
mxRectangle bounds = graph.getGraphBounds();
int width = (int) Math.ceil(bounds.getX() + bounds.getWidth() + 2);
int height = (int) Math.ceil(bounds.getY() + bounds.getHeight() + 2);
if (tripleBuffer != null)
{
if (tripleBuffer.getWidth() != width
|| tripleBuffer.ge... |
981eca84-8dfa-4bbc-80d1-ab5dff4247fa | 8 | double getIntegralValue(Range boundaries) {
List<Range> valueRanges = new ArrayList<Range>();
for (Range range : ranges) {
if (range.includes(boundaries.getLeft())
|| range.includes(boundaries.getRight())
|| boundaries.includes(range.getLeft())
|| boundaries.includes(range.getRight()))
{
... |
106094d0-0c4d-4cb3-a0e5-cb3f81d8c843 | 0 | public FooObject(String name, int id, long age, FooObject friend) {
this.name = name;
this.id = id;
this.age = age;
this.friend = friend;
} |
f3f22715-e31e-48a9-b878-4318ebcb887a | 5 | public int getBlackjackValue() {
int val; // The value computed for the hand.
boolean ace; // This will be set to true if the
// hand contains an ace.
int cards; // Number of cards in the hand.
val = 0;
ace = false;
cards = getCardCount();... |
d3402b4c-539b-4130-a687-6e1ecd71ab12 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.