method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e087fea0-d8a5-4116-ac03-2141e338119f | 7 | private WriteConcern createWriteConcern(final Map<String, List<String>> optionsMap) {
Boolean safe = null;
String w = null;
int wTimeout = 0;
boolean fsync = false;
boolean journal = false;
for (String key : writeConcernKeys) {
String value = getLastValue(opt... |
9847bccf-b243-4823-be02-22096d33748e | 2 | public Collection<Format> getFormats()
{
try
{
if (formats.size() == 0)
fillAll();
}
catch (SQLException e)
{
e.printStackTrace();
}
return formats;
} |
dd8906fe-9b1e-4d58-87c9-a9b516e7c264 | 2 | public static Cashier getByNumber(final String token, final Long number) {
JSONArray fetchByNumber = null;
try {
fetchByNumber = fetchByNumber(token, object, number);
} catch (IOException e) {
e.printStackTrace();
}
List<Cashier> formatOutputs = formatOutputs(fetchByNumber);
if (formatOutputs.size() >... |
25ebc3ed-68b8-4362-8473-65efd96d1b25 | 5 | public boolean validatePreConditions() {
boolean result = true;
if(username.length() < 3 || username.length() > 7){
result = false;
}
else if(!username.matches(validCharsRegex)) {
result = false;
}
else if(!password.matches(validCharsRegex)) {
result = false;
}
else if(password.length() <... |
1b605c61-4af4-4b5c-b94e-b0b800455010 | 4 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
DefaultTableModel dft2 = (DefaultTableModel) jTable5.getModel();
try {
DB.myConnection().createStatement().executeUpdate("delete from printpublisherbooklist ");
for (i... |
709ef09c-850f-4857-9fe1-9cabe0af10be | 9 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan1 = new Scanner(System.in); //scanner constructor
int courseNumber = 0; //define initial coursenumber
do { //start do while loop
System.out.prin... |
abe94743-5a08-4ab7-92e3-8d2dcb365ac8 | 9 | private boolean r_Step_4() {
int among_var;
int v_1;
// (, line 140
// [, line 141
ket = cursor;
// substring, line 141
among_var = find_among_b(a_7, 18);
if (among_var == 0)
... |
2dfce4e3-6514-4542-ab0f-f559ab583482 | 1 | public static void main(String[] args) {
try {
throw new Exception("My Exception");
} catch (Exception e) {
System.out.println("Caught Exception");
System.out.println("getMessage():" + e.getMessage());
System.out.println("getLocalizedMessage():" + e.getLocalizedMessage());
System.out.println("toStrin... |
f3f2ddcb-d9eb-45af-b06a-61edab62e73e | 3 | private static ImageProcessor search(List<Integer> candidates, ImageProcessor strong, ImageProcessor med){
ImageProcessor result = strong.duplicate();
for(Integer pt : candidates){
int x = pt / strong.getHeight();
int y = pt % strong.getHeight();
if(result.get(x,y) != 255){
if(searchHelp(x, y, strong, ... |
97f52e67-b9dc-4f4f-85fc-44b8c2d1d1dc | 2 | public static Result[] runSegmenter(List<Utterance> goldTrainUtterances,
Lexicon goldTrainLexicon, List<Utterance> goldTestUtterances, Lexicon goldTestLexicon,
Properties props, String outPath, boolean verbose) {
boolean useTestData = goldTestUtterances != null;
Segment seg = new Segment(props, outPath);
/... |
5d20cd30-a6aa-44ba-aae9-383dc6501f85 | 7 | public void addEvents () {
addRandButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// EVENT FOR THE ADD BUTTON
int value = (int) (Math.random()*100+1);
addProceed(value);
}
});
addButton.addActionListener(new ActionListener() {
public void acti... |
6047dbc8-5a95-4901-8076-3d4ec23b454b | 9 | static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[41];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 2; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... |
e49dc0d0-0ae4-46d8-b8e5-862a11e2900e | 3 | public int eatNumber (){
Piece piece = field.getPiece(start);
Player player = new Player(piece.getColor(),field);
int result=0;
Position destination = getDestination();
if (piece instanceof King)
field.setKing(destination, player.getColor()); // metto un segnalino
else
field.setPiece(destination... |
5c0d4b35-0c0b-4440-b936-55ef29bd1af8 | 1 | public static void insertOrUpdateURLRedirect(String url){
Redirects redURL;
EntityManager manager = JPUtil.getInstance().getManager();
manager.getTransaction().begin();
try {
redURL = manager.createNamedQuery("Redirects.findByUrl", Redirects.class).setParameter("url", ur... |
e6face89-c733-43bd-8780-b72ad98331d1 | 9 | public void convolvet(ImageStack s, int center, Kernel1D kernel)
{
// depth slices centered around center.
for (int t = -depth/2; t <= depth/2; t++)
{
float[][] t1 = new float[height][width];
if (kernel instanceof Kernel)
{
/*
Around t, ... |
ced8d26a-8ed1-414e-ba2d-0f4c862fe982 | 9 | private static Object[] getAssertionExprent(Exprent exprent, String classname, String key, boolean throwInIf) {
if (exprent.type == Exprent.EXPRENT_FUNCTION) {
int desiredOperation = FunctionExprent.FUNCTION_CADD;
if (!throwInIf) {
desiredOperation = FunctionExprent.FUNCTION_COR;
}
... |
efa4b0ae-e9a2-4183-88c8-c1d4ae6678f2 | 5 | public static int countSyllables(String word)
{
int c = 0;
String[] s = word.split("[aeiouAEIOU]+");
if(word.charAt(word.length() - 1) == 'A' || word.charAt(word.length() - 1) == 'E' || word.charAt(word.length() - 1) == 'I' || word.charAt(word.length() - 1) == 'O' || word.charAt(word.length() - 1) == 'U')
... |
be7acd38-4e40-4279-946d-7923dcec3c72 | 1 | @Test
public void tanc_test() {
try{
double x = 30;
TanhCFunction tanh = new TanhCFunction(x);
double result= tanh.function(x);
double exp = 0.9999999969540041;
Assert.assertEquals(exp, result, 0.001);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemented");
... |
199b60e2-d74f-497c-94d9-969a2f41d3d2 | 1 | public void logLeaving(String message) {
if(debug) {
int i = indent.decrementAndGet();
System.out.println(indent(i) + "<" + message);
}
} |
e8f15e1e-f4c7-4550-bc81-73fb79e1d8df | 1 | public int arity() {
return children == null ? 0 : children.length;
} |
2e8c3a46-7256-406b-ba94-fd72bbc37c89 | 1 | @Override
public void mouseReleased(MouseEvent e) {
try {
setImg(ImageIO.read(new File("img/button/button.png")));
} catch (IOException ex) {
ex.printStackTrace();
}
} |
70ab1193-3171-47fc-a4ed-0bb720bc8e85 | 8 | private Object instanciarObjetoUsando(Constructor<?> constructor, Class<?> solicitante) {
List<Object> argumentos = new ArrayList<Object>();
for (Class<?> tipoDeParametro : constructor.getParameterTypes()) {
argumentos.add(this.getContexto().obtenerObjeto(tipoDeParametro, solicitante));
}
try {
Object[... |
785da58f-3a58-4eb4-8dde-24328fd54e69 | 0 | @Override
public void characters(char ch[], int start, int length) throws SAXException {
super.characters(ch, start, length);
} |
ed9ec137-08c6-4c0b-8589-af064b53aba2 | 6 | public static JSGob findMapObject(String name, int radius, int x, int y) {
Coord my = MyCoord();
my = MapView.tilify(my);
Coord offset = new Coord(x, y).mul(tileSize);
my = my.add(offset);
double min = radius;
Gob min_gob = null;
synchronized (glob.oc) {
... |
3aa99863-5a9e-4fdf-9bfa-3122d46a9ef8 | 8 | public void transfer() {
String number = currentAccountNumber();
if (number != null) {
try{
Set<String> s = new HashSet<String>(accounts.keySet());
s.remove(number);
TransferDialog trans = new TransferDialog(this, "Transfer Money", number, s);
Point loc = getLocation();
trans.setLocation... |
6ac5947a-40ba-4617-b987-fbdec5dadefc | 7 | public void loadXml(String xmlFileName){
try {
File xmlFile=new File(xmlFileName);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(xmlFile);
doc.getDocumentElement().normalize();
... |
0f470260-a7f6-465d-a09c-9fdaf1720c76 | 5 | public static String[] run(String train, String[]test2) {
int k = 3;
// read the train file
//String inputtrainf="IrisTrain.csv";
//String inputtestf="IrisTest.csv";
String inputtrainf=train;
//String inputtestf=test;
ArrayList<String> trainList = getFile(inputtra... |
7a001557-2451-40c8-a336-8e141cb57dd8 | 6 | private static void copyDirectory(
File directoryToCopy,
File directoryToCopyInto) {
try {
if (!directoryToCopyInto.mkdir()) {
directoryToCopyInto.mkdirs();
}
if (!directoryToCopy.isDirectory()) {
throw new IOException(
... |
000a63b5-c155-4ce0-8697-8248e7e2bd95 | 9 | public boolean isGoal() {
boolean isGoal = true;
isGoal = isGoal && state[0][0] == 1 && state[0][1] == 2 && state[0][2] == 3;
isGoal = isGoal && state[1][0] == 8 && state[1][1] == 0 && state[1][2] == 4;
isGoal = isGoal && state[2][0] == 7 && state[2][1] == 6 && state[2][2] == 5;
return isGoal;
} |
f0887800-8c8a-4460-81f9-ffaffa5c7d02 | 5 | private static int indexOfSlash(String frac){
int parDepth = 0;
for(int i = 0; i < frac.length(); i++){
//if it's a parentheses
if(frac.charAt(i) == '(') parDepth++;
else if (frac.charAt(i) == ')') parDepth--;
//find the / if parDepth is 0
else if (parDepth == 0 && frac.charAt(i) == '/'){
return ... |
a20443ec-759c-4de7-8471-5b11bd5bfd79 | 3 | @Override
public void init(boolean isServer) {
if(!isServer) {
PlayerEntity.loadResources();
PillarEntity.loadResources();
}
tiles = new Tile[8][6];
for(int x = 0; x < tiles.length; x++)
for(int y = 0; y < tiles[x].length; y++)
tiles[x][y] = new Tile(this, x, y);
entities = new ArrayList<Entit... |
6bf55fb8-1832-4dca-81ef-314033782837 | 0 | public long getProgress() {
return _progress;
} |
36fdb7ac-8c81-470d-8d57-6fb65877d0be | 3 | public void addLink(int i)
{
boolean exists = false;
for (Integer a : links)
{
if (a == i)
{
exists = true;
break;
}
}
if (!exists)
this.links.add(i);
} |
ca1ff469-7120-4c6a-a055-880e5e61391b | 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... |
3e925e19-ea96-44d3-9ef2-95fd3b024a2a | 0 | public Car() {
//load resources
Initialize();
LoadContent();
//will set the starting coordinate
x = (int) (Framework.frameWidth * 0.20);
} |
ffd4aa96-0a23-4a09-8fbc-36b3fbf31b01 | 2 | public void loadSuggestions() {
this.suggestions.clear();
SuggestionModel suggestionModel = new SuggestionModel();
Iterable<Entry> suggestionQuery = suggestionModel.query("{id:{$gte: 0}}");
DefaultTableModel model = (DefaultTableModel) suggestionTable.getModel();
model.setRowCou... |
15106449-f796-4bfa-9cfe-28d028af556b | 0 | public static void main(String[] args) throws Exception {
SplashScreen splash = new SplashScreen(3000);
Sound startupSound = new Sound("sounds/test.wav");
splash.showSplash();
setSimulator(new Simulator());
} |
fb8e12cf-2769-451e-ab78-a2e1e9095fe6 | 1 | public void drawCourante() {
Forme temp = courante.getForme();
int x, y;
int taille = temp.getPoints().length;
for (int i = 0; i < taille; i++) {
x = getVecteur(i).get(0).intValue();
y = getVecteur(i).get(1).intValue();
plateau[x][y] = courante.getIdCo... |
fc5ac8bd-12c1-4b6e-aa0c-74bbc6cc4316 | 6 | final int method183(int i) {
anInt4633++;
if (i <= 16)
((Class5) this).aClass369_4635 = null;
int i_8_ = ObjectDefinition.loadingHandler.method2320((byte) 106);
int i_9_ = 100 * i_8_;
if ((i_8_ ^ 0xffffffff) != (anInt4630 ^ 0xffffffff)
|| (i_8_ ^ 0xffffffff) == -1) {
anInt4630 = i_8_;
aLong4640... |
da46a346-b511-48b2-96e0-01cf8caf04f8 | 2 | public void updateActions()
{
if (moved)
{
btList.put(5, "Cancel");
btList.put(6, "Done");
}
else
{
btList.remove(5);
btList.remove(6);
}
if (!attacking) //Also check if unit has usable weapon!
{... |
600fd139-3c6f-4a65-81db-79f6dffe9f02 | 2 | private void fireClientDisconnectEvent(DisconnectEvent evt) {
connected = false;
Object[] listeners = disconnectEventListenerList.getListenerList();
for (int i=0; i<listeners.length; i+=2) {
if (listeners[i]==DisconnectListener.class) {
((DisconnectListener)listeners[i+1]).OnDisconnectEvent(ev... |
40084d1d-2307-42a9-88ab-3fd2ed90679a | 3 | private void Equipa2_RadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Equipa2_RadioButtonActionPerformed
//Atualiza Jogador_ComboBox
Jogador_ComboBox.removeAllItems();
if(!AutoGolo_CheckBox.isSelected()) {
Jogador_ComboBox.setEnabled(true);
St... |
6bfd010e-3915-4312-a164-c94712c06079 | 1 | @Override
public void addCandidate(Route route)
{
if (route.getLength().lessThan(limit))
{
routes.add(route);
}
} |
99f0234a-e035-4ed7-a8b7-372f03d868ae | 1 | @Override
public Map<String, Object> rowToObjec(ResultSet rs) throws SQLException {
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount();
NoCaseMap<Object> m = new NoCaseMap<>(columnCount);
for (int i = 1; i <= columnCount; ++i) {
String key = JdbcUtil.lookupColumnName(md, i);
... |
3e467540-22df-474e-bc36-2eb2c75bed79 | 4 | @Override
public void kill() {
// cleanup
try {
if (echoSocket != null)
echoSocket.close();
if (printWriterOutputStream != null)
printWriterOutputStream.close();
if (bufferedReaderInputStream != null)
bufferedReaderInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
... |
650c82ca-1d55-4a0e-9718-ef88da31bb3b | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
a356687a-c85f-4700-bfd5-c2c22ac024b0 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Article other = (Article) obj;
if (this.id != other.id) {
return false;
}
if ... |
61275725-6e9d-4971-aa70-2f38a858189e | 7 | public static boolean prePopulationCheck(Map popMap, MapPart temp, int locationX, int locationY){
int x = locationX;
int y = locationY;
int width = temp.partTiles.length;
int height = temp.partTiles[0].length;
int popX = 0;
int popY = 0;
int popWidth = popMap.tileMap.length;
int popHeight = popMap.tile... |
cff71905-2cc8-4745-9c09-9d72b7584bb1 | 3 | public int getBits(String string) {
byte[] bytes = string.getBytes();
StringBuilder binary = new StringBuilder();
for (byte b : bytes) {
int val = b;
for (int i = 0; i < 8; i++) {
binary.append((val & 128) == 0 ? 0 : 1);
val <<= 1;
... |
b7bf9984-3347-493b-978c-c0bf1b922878 | 3 | private void getLengths(String bed12Name) throws IOException{
geneLengths = new HashMap<String, Integer>();
TextFile bed12 = new TextFile(bed12Name, false);
String[] els = bed12.readLineElems(TextFile.tab);
String cur_gene = els[3], lengths = els[10], gene;
int gene_len;
... |
52d4f01e-2792-4a82-bcbe-24a77d7aea89 | 6 | public static int getCount (int apple, int plate, int max) {
if (plate == 1 && apple > max) {
return 0;
}
if (apple == 0 || plate == 1) {
return 1;
}
int count = 0;
for (int i=Math.min(apple, max); i>=0; i--) {
int currentCount = getCount(apple-i, plate-1, i);
if (currentCount == 0) {
bre... |
ab2550fc-6074-4d3b-b727-0c203366fe88 | 3 | @Override
public void run() {
System.out.println("WRITE SERVER-WRITER: ");
String filename = "";
int bytesWritten = 0;
buf.flip();
String encoding = System.getProperty("file.encoding");
filename = Charset.forName(encoding).decode(buf).toString();
logger.in... |
d5442b95-d42b-4ea7-bd6b-640e0ce32c31 | 0 | public boolean equals(FiniteStateAutomaton fsa1, FiniteStateAutomaton fsa2) {
// Clone for safety.
fsa1 = (FiniteStateAutomaton) fsa1.clone();
fsa2 = (FiniteStateAutomaton) fsa2.clone();
// Make sure they're DFAs.
fsa1 = nfaConverter.convertToDFA(fsa1);
fsa2 = nfaConverter.convertToDFA(fsa2);
// Minimize... |
024c804e-63dd-4daf-9dcb-cd5944078601 | 4 | public int evalMove(Move m, State s, int depth) {
if (depth == 0) { // cutting off search -> evaluate resulting state
return evalState(s.tryMove(m));
} else { // minimax-search
// update the state
State newstate = s.tryMove(m);
// get a list of possible moves from newstate
MyList moves = ne... |
a7e06de7-30ea-4e8e-a616-a89c82666b10 | 2 | public void addVertex(Object o){
if(o instanceof String){
sVertices.add((String) o);
}
if(o instanceof Integer){
nVertices.add((Integer) o);
}
} |
dbf4f4c0-9ef4-4e5b-a264-5d4150c6134f | 6 | public void next()
{
//String NickName = newVehiclePanel.txtNickName.getText();
//System.out.println("NewVehicleController - next --> nickName " + NickName );
//test nickname
if (Pattern.matches("[a-zA-Z0-9]+", newVehiclePanel.txtNickName.getText()) == false || newVehiclePanel.txtNickName.getText().length() ==... |
c66b8b7d-d830-4f03-9517-c22b08c9dfb1 | 7 | private static void merge(int[] a, int begin, int mid, int end) {
int[] b = new int[mid - begin + 1];
int[] c = new int[end - mid];
int p = begin, q = mid + 1;
for (int i = 0; i < b.length; i++) {
b[i] = a[p++];
}
for (int i = 0; i < c.length; i++) {
... |
649e2d18-02b9-44fb-a0d2-b38b9abab17f | 4 | private void checkTimeFields(Time time) {
if (time.getIdActivity() < 0) {
AlertMessages.emptyTimeField(timeDialog, AlertMessages.ACTIVITY_ID);
} else if (time.getStartTime() == null) {
AlertMessages.emptyTimeField(timeDialog, AlertMessages.START_TIME);
} else if (time.getEndTime() == null) {
AlertMessage... |
abc2ccf2-8946-467c-aeca-9dd1aadcb1da | 7 | private void computerNextTurn() {
if (!getGame().gameWon()) {
new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(ANIMATION_TIME);
} catch (Exception e) {
}
... |
982683cc-cb52-42e9-9f2f-fb553c1ff87e | 4 | public User (Properties prop) {
Enumeration e = prop.propertyNames();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String method = "set"+ toProperCase(key);
String value = prop.getProperty(key);
M... |
8471d96a-491b-43d2-9b44-b0f74b19afc0 | 2 | static long mod(long dividend, long divisor) {
if (divisor < 0) {
throw new IllegalArgumentException("divisor must be positive: " + divisor);
}
if (dividend >= 0) {
return dividend % divisor;
} else {
return (dividend + 1) % divisor - 1 + divisor;
... |
60bd821a-d047-4710-8d5e-7f75af6a37fd | 1 | public static PlayerDetailsMessage createPlayerDetailsMessage(String playerName) {
if (playerName == null) throw new IllegalArgumentException("PlayerDetail is Null");
return new PlayerDetailsMessage(playerName);
} |
1d07c357-ec8d-4236-83a2-f3e66eb9edc9 | 0 | public static boolean isApplicable(Object object) {
return object instanceof PushdownAutomaton;
} |
49a4bb9e-ffc8-47d6-9484-7eaae1391748 | 2 | public final String getFormattedNumber() {
if (number < 10) {
return "00" + number;
}
if (number < 100) {
return "0" + number;
}
return Integer.toString(number);
} |
be70623a-af78-48a1-8589-c836882bdd9f | 4 | public boolean unReserveSpawnLocation(String playerName) {
if (!spawnLocations.containsValue(playerName))
return false;
else {
for (BlockVector loc : spawnLocations.keySet()) {
BlockVector vector = null;
if (spawnLocations.get(loc) == playerName) ... |
e1310359-bd85-4cc8-9821-7f5693d71848 | 9 | private void extract() {
File psuFile = new File(openField.getText());
if (!RecordReaderFactory.isSupportedVersion(psuFile)) {
showErrorDialog(getString("E_VERSION"));
return;
}
switch (save.showSaveDialog(frame)) {
case JFileChooser.CANCEL_OPTION:
return;
case JFileChooser.ER... |
627bcfa2-aff8-480b-96d1-2dd36989ac97 | 4 | private int jjMoveStringLiteralDfa3_9(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return 3;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return 3;
}
switch (curChar) {
case 93:
if ((active0 & 0x2000000L) != 0L)
return jjStopAtPos(3, 25);
break;
... |
9185f6af-8c0d-412f-b74a-bbef49c551f4 | 0 | public News(String heading, String news) {
this.heading = heading;
this.news = news;
} |
3ff145c7-832e-4598-b712-b0dd0ac3dab4 | 7 | public static double[][] calculcateDistanceMatrix(Map imagesTags, ArrayList<String> representativeTags) {
/* Initialise matrix with amountTags * amountTags; right now only a tenth! */
int amountTags = imagesTags.size();
int poolSize = amountTags / TEST_POOL_SIZE_DIVISION;
/* Change blo... |
322cbcd0-5b44-4ce5-8a74-702e06f5fb63 | 2 | protected void emptyTile(Tile t){
t.removeAllItems();
Character c = t.removeCharacter();
if (c instanceof Player){
playerTile = null;
}
// This step to avoid concurrentmodificationException from t.getAllDirections()
Set<Direction> directions = new HashSet<Direction>(t.getAllDirections());
for (Dire... |
4f2b9878-b8de-4600-befa-610a71851478 | 5 | protected static boolean runProcess(String[] toolCommandLine) {
try {
final Process p = Runtime.getRuntime().exec(toolCommandLine);
try {
// Read and display the stdout and stderr outputs. This also
// prevents deadlock on some systems if the streams are not
// read.
StreamReader stdOutReader = ... |
f9004d87-d1d4-4616-ba65-078db5b3b5e3 | 9 | public void chargerMusiquesDeBase() {
String line;
InputStream is;
BufferedReader br = null;
Collection<Piste> pistes = new LinkedList<>();
String[] curSong = null;
Artiste curArtiste = null;
try {
is = getClass().getClassLoader().getResourceAsStream("... |
afb4f080-694b-4ec7-9468-94a8ff6ddedc | 3 | @Override
public void deserialize(Buffer buf) {
genericId = buf.readInt();
if (genericId < 0)
throw new RuntimeException("Forbidden value on genericId = " + genericId + ", it doesn't respect the following condition : genericId < 0");
quantity = buf.readInt();
if (quantity... |
9df92606-4b8c-4d3e-9a33-a5cc3035c425 | 2 | @Override
public void mouseClicked (MouseEvent e) {
if (index != -1) {
PositionBox selectedPosition = Initialiser.getMainFrame().getChampionSelect().getSelectedPosition();
Champion c = getModel().getElementAt (index);
if (selectedPosition != null) {
selectedPosition.updateChampion (c);
B... |
46bdaa4c-07d5-4002-a437-5e4bb99ee608 | 4 | public boolean dead()
{
if (P2character.equals("White"))
{
return whiteKnight.ifDead();
}
else if (P2character.equals("Bond"))
{
return jamesBond.ifDead();
}
else if (P2character.equals("Ninja"))
{
return redNinja.if... |
1acfbc28-efc0-4366-87df-738869106a04 | 9 | @Override
public void run() {
BufferedReader in = null;
try {
// set timeout to 10 seconds so the clients don't block the server for ever
connect.setSoTimeout(10000);
//get character input stream from client
in = new BufferedReader(new InputStreamRead... |
44b298de-45da-4085-9d39-a8c3a460d3ee | 4 | private void buttonSendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSendActionPerformed
//Проверка возможности оформления кредита по указанной сумме
//Получаем кредитную программу по ее названию
CreditProgram crProg = crProgDAO.get(String.valueOf(сomboBoxCreditProgram... |
a2554c7c-c4bb-402a-b225-fa9268174327 | 9 | private static void parseSplit(StreamTokenizer st, Split parent)
throws Exception {
int token;
while ((token = st.nextToken()) != StreamTokenizer.TT_EOF) {
if (token == ')') {
break;
} else if (token == StreamTokenizer.TT_WORD) {
if (st.sval.equalsIgnoreCase("WEIGHT")) {
parseAttribute(st.sval... |
3cd09589-c199-4aba-b008-cc181ddf4c69 | 9 | public static void main(String args[])
{
sc = new Scanner(System.in);
System.out.println("Enter the Total number of channels in main set!!");
int m = sc.nextInt();
arr = new int[m];
for (int i = 0; i < m; i++)
{
arr[i] = i + 1;
}
System.out.println("Channels from 1 to " + m + " are available");
... |
e012ed67-3a6d-4af9-ab05-9535ef199962 | 5 | private static String getTemp() {
/* 0 |1 | 2 | 3 | 4 |5
* Thermal 0: ok, 88.0 degrees C
* Thermal 1: ok, 88.0 degrees C
* Sample acpi -t output
*/
String usage = "";
try {
Process proc = Runtime.getRuntime().exec("acpi -t");
BufferedReader stdInput = new BufferedReader(new
Input... |
a20e3128-f210-4348-b873-cbd63e998e15 | 8 | private static void depends(ClassInfo info, HashMap<String, ClassInfo> db, HashSet<ClassInfo> set) {
set.add(info);
ClassInfo nfo = db.get(info.superName);
if(nfo != null && !set.contains(nfo)) {
set.add(nfo);
depends(nfo, db, set);
}
for(String inter : info.getInterfaceNames()) {
nfo = db.get(inter)... |
7b35c149-a1b5-42fc-93ce-682680dd1b6c | 9 | public Oscillators(String positioning, int mode, int N, int lowMassId,
String bc) {
this.state = new double[2 * (N + 2) + 1]; // includes the two ends of the
// chain
this.bc = bc;
this.lowMassId2 = lowMassId*2;
if (positioning.equals("mode")) {
... |
2ae4d8f2-ad8b-45b3-a164-22b77872d68d | 6 | public void enablePlayerTwoSpaces()
{
for (int x = 0; x < checkersSpaces.length; x++) {
for (int y = 0; y < checkersSpaces.length; y++) {
if(checkersSpaces[x][y].getIcon() != null && checkersSpaces[x][y].getIcon().equals(playerTwoCheckerPiece))
{
checkersSpaces[x][y].setEnabled(true);
}
else ... |
99c37707-78ac-4125-87d9-6adc193366cf | 4 | private int cheminPlusLongVersFeuille(Model model, Generalization parent) {
if(parent == null){
return 0;
} else {
ArrayList<Integer> nbcourant = new ArrayList();
for(String str : parent.getArrayIdent()){
Classe c = this.getClasseByModel(model, str);
Generalization enfant = null;
for(Generaliza... |
8b879728-2943-4029-af97-1a38fcd79355 | 3 | @Override
public int[] sort(int[] a) {
for(int i = 0; i < a.length; i++) {
for(int j = a.length - 1; j > i; j--) {
if(a[j] < a[j-1]) swap(a, j, j-1);
}
}
return a;
} |
a77056e2-19e7-46af-9edb-b9e3033bfb7e | 8 | @Override
public void eachEffect(final EachApplicable<Ability> applier)
{
final List<Ability> affects = this.affects;
if (affects != null)
{
try
{
for (int a = 0; a < affects.size(); a++)
applier.apply(affects.get(a));
}
catch (final java.lang.IndexOutOfBoundsException x)
{
}
}
fi... |
a94c9167-b5d8-417a-83a4-ae585deaddfb | 7 | public static Target pickWithdrawPoint(
Actor actor, float range,
Target target, float salt
) {
final int numPicks = 3 ; // TODO: Make this an argument instead of range?
Target pick = null ;
float bestRating = salt > 0 ?
Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY ;
for (int i = ... |
1b684a6a-0b72-4547-9654-f6164e803fd9 | 4 | static protected String getHtml(String suf) {
URL url;
InputStream is;
InputStreamReader isr;
BufferedReader r;
String str = "";
String nl = "";
try {
url = new URL(suf);
is = url.openStream();
isr = new InputStreamReader(is);
r = new BufferedReader(isr);
do {
nl = r.readLine();
i... |
cc2a046f-f866-4044-bb53-e58a8805213b | 1 | @Test
public void testDustBinCapacity() {
System.out.println("Test dustBinCapacity()");
floorType newFloorType = floorType.HIGH_PILE_CARPET;
BatteryAndDirtBin instance = new BatteryAndDirtBin(newFloorType);
instance.swept();
instance.swept();
instance.swept();
instance.swept... |
f2817251-4aeb-494b-9753-09f06514f39f | 4 | public void eatPellet(int column, int row) throws InterruptedException
{
if (cells[column][row].getType() == 'd') {
score += 10;
cells[column][row].type = 'o';
}
if (cells[column][row].getType() == 'p' || cells[column][row... |
e8c7ead4-d8e9-49aa-b95a-0d725ec8f0b7 | 6 | public void openConnection() throws SerialConnectionException {
// Obtain a CommPortIdentifier object for the port you want to open.
try {
portId = CommPortIdentifier.getPortIdentifier(parameters.getPortName());
} catch (NoSuchPortException e) {
throw new SerialConnectionException(e.getMessage());
... |
df482d60-0a13-4ec4-92e0-6ee309fc9e5b | 7 | @Override
public boolean step(Entity intersectingEntity) {
if(currentDir >= getDirectionList().size() - 1 && power == distance || stopNextStep) {
setCreated(true);
return false;
}
if(intersectingEntity instanceof DestructibleBlock || intersectingEntity instanceof Tower) {
stopNextStep = true; //Plac... |
f4de2e27-64bd-45f9-8b45-89bacd647b10 | 3 | public static DamageType typeConversion(AttackType type) {//TODO remove this terrible workaround
switch (type) {
case SLASH:
return DamageType.SLASHING;
case BASH:
return DamageType.BASHING;
case PIERCE:
return DamageType.PIERC... |
1e858308-b32b-4806-90b4-d08ec82bcee9 | 4 | public static final void closeResources(InputStream in, OutputStream out) {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
throw new LogicException(e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
throw new LogicException(e);
}
... |
9fea220e-5958-48e9-b3ab-c1e54c66bb58 | 0 | public void openConsole() {
this.open = true;
} |
5e8217ea-3948-48ed-87ea-aa50d298140e | 8 | @Override
public void update() {
fov.update(x,y,9);
int px = screen.getPlayerX();
int py = screen.getPlayerY();
if (!fov.isVisible(px,py))
return;
int cdx = 0;
int cdy = 0;
double currentWorth = 10000;
... |
fba912e9-5040-4a75-b11b-6970d8665c96 | 9 | public Model method209(int j, int k, boolean flag)
{
Model model;
if(flag)
model = method206(anInt255, anInt256);
else
model = method206(anInt233, mediaID);
if(model == null)
return null;
if(k == -1 && j == -1 && model.anIntArray1640 == null)
return model;
Model model_1 = new Model(true, Class3... |
3b70fb2c-30c8-4e20-b470-129e3ad156dc | 0 | public static void main(String[] args) {
launch(args);
} |
5a08bbd1-1356-4f4a-800f-3382c6a3fd93 | 0 | public void setEntradasIdEntrada(Entradas entradasIdEntrada) {
this.entradasIdEntrada = entradasIdEntrada;
} |
89f9f58e-e060-4c76-bd5b-8bfa0ba3ba55 | 5 | public XMLConfiguration post(QcRequest request)
throws QcException, Exception
{
log.debug("Requested Url :" + request.getURL());
XMLConfiguration xmlResponse = null;
//Open HTTP connection to the url
HttpURLConnection conn = (HttpURLConnection) new URL(request... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.