method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e62482be-f94e-4546-9e17-0a8a90b01730 | 1 | public void testSetSecondOfDay_int2() {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8);
try {
test.setSecondOfDay(24 * 60 * 60);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals("2002-06-09T05:06:07.008+01:00", test.toString());
... |
49402eae-77fa-41ec-b17a-eb138b6994ab | 4 | private int jjMoveStringLiteralDfa32_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 31);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 31);
}
switch(curChar)
{
case 53:
return jjMoveStringLiter... |
af10c427-3622-4c78-9d52-b25552a425d3 | 2 | public boolean Salvar(Cliente obj)throws ErroValidacaoException, Exception{
try{
PessoaDAO dao = new PessoaDAO();
Pessoa tmp = new Pessoa();
tmp.setCpf(obj.getCpf());
tmp.setDataNascimento(obj.getDataNascimento());
... |
7dc5255b-e832-4b84-99a5-7cfc09d9376e | 5 | private int minChildPos( int pos ) {
int retVal;
int lc = 2*pos + 1; //index of left child
int rc = 2*pos + 2; //index of right child
//pos is not in the heap or pos is a leaf position
if ( pos < 0 || pos >= _heap.size() || lc >= _heap.size() )
retVal = -1;
//if no right child, then left child is only optio... |
baaa7861-a443-4919-b484-dcd25f916341 | 2 | private void bufferReset(){
if( imageBuffer==null ){
imageBuffer = this.createImage(SCREEN_WIDTH, SCREEN_HEIGHT);
gBuffer = imageBuffer.getGraphics();
System.out.println("ʼ");
}
gBuffer.setColor(bgColor);
gBuffer.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
// gBuffer.drawImage(BackGround, 0, 0, null)... |
f507ce34-7c27-4266-b3ef-0a99bbcb35ef | 4 | public void remove(int key) {
HashPrinter.tryRemove(key);
/** Run along the array */
int runner = 0;
int hash = (key % TABLE_INITIAL_SIZE);
int edge = (int) Math.ceil((double) TABLE_INITIAL_SIZE / 2);
while (table[hash] != null && runner < edge) {
if (table[hash].getKey() == key) {
break;
}
... |
7774c394-5609-4c73-933e-f7d18b8f7064 | 5 | private void clearBuffer() {
if (isFirstLine && document.getLength() != 0) {
buffer.insert(0, "\n");
}
isFirstLine = false;
String line = buffer.toString();
try {
if (isAppend) {
int offset = document.getLength();
document.insertString(offset, line, attributes);
textComponent.set... |
7130cdf9-6929-47d5-a122-b63d756f345a | 3 | public void killThePlayer()
{
for (int r = 0; r < getNumRows(); r++)
{
for (int c = 0; c < getNumCols(); c++)
{
Location loc = new Location(r, c);
if (get(loc) instanceof ThePlayer)
{
ThePlayer p = (ThePlayer... |
bcc14b29-b698-42e8-8635-60e8439fe043 | 6 | public GamesObject (String s)
{ S=s;
if (S.indexOf(']')==3) S=" "+S;
StringParser p=new StringParser(s);
p.upto(']'); p.skip("]");
White=p.upto('[').trim();
p.skip("[");
String h=p.parseword(']');
p.upto('.'); p.skip(".");
Black=p.upto('[').trim();
if (p.error())
{ V=-50; return;
}
p=new String... |
91ff021f-2867-465d-8c44-11e8c14885e5 | 5 | @ChattingAnnotation(feature="None", type="Method")
@Override
public void sendTemplet(String sender, String code) {
String[] result = _arch.OUT_ITempletRetriver.getTemplet(code);
if (result != null) {
if (result[0].equals("text")) {
messageSent(sender, result[1]);
} else if (result[0].equals("image")) {
... |
c3f12b52-46cf-472b-8134-7fb8bfeb1a68 | 0 | public void setAge(int age) {
Age = age;
} |
80ccd4b9-e965-4924-9003-d03c480c8f0a | 2 | public static Card getByID(int id) {
// Realistically this could probably just return Collection.get(id) so long as id < Collection.size() ...
// But ... this removes the requirement that the JSON data file be ordered perfectly, so why not? (though it is anyways...)
for (Card c : Collection) {
if (c.getID() ==... |
b2b9c593-8b9f-4ab8-ae16-76259a64961c | 8 | public String toString() {
String description = null;
if (!train.isEmpty()) {
int lastOne = train.size() - 1;
for (int i = 0; i < lastOne; i++) {
switch (train.get(i).getClass().getSimpleName()) {
case (String) LOCOMOTIVE:
description += ((Locomotive) train.get(i)).toString() + "-";
break;
... |
b7f84c91-12e7-4873-b2a2-fa4e862f7c5e | 0 | private SplitPaneFactory() {
} |
a6359af5-6b08-4f55-98d4-e8651eed2b88 | 2 | public String getConfiguration (int language)
{
try {
int value = getU8 (6);
if (value == 0)
return null;
return getDevice ().getString (value, language);
} catch (IOException e) {
return null;
}
} |
dcf8ae7f-1ddf-4257-a272-bffd3fe7dbc5 | 8 | static ArrayList<Cow> sortCows2(ArrayList<Cow> cows)
{
if (cows.size() <= 1)
return cows;
int mid = cows.size()/2;
ArrayList<Cow> cows1 = new ArrayList<Cow>();
ArrayList<Cow> cows2 = new ArrayList<Cow>();
for (int i = 0; i < mid; i++)
cows1.add(cows.get(i));
for (int i = mid; i < cows.size(); i++)
... |
0c43e858-225a-4810-9161-77e984477cd1 | 4 | @SuppressWarnings("CallToThreadDumpStack")
private double scoreBasedExpressions(ArrayList<ArrayList<FieldCandidate>> correctColumns, int idealNumColumn, String field) {
try {
String fieldExpression = null;
ArrayList<ArrayList<String>> allColumnExpressions = new ArrayList<ArrayList<S... |
6eefbf73-e115-4485-9fbe-181c3afa5b0b | 2 | public double sum(){
double sum = 0.0;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
sum += this.matrix[i][j];
}
}
return sum;
} |
c6956d47-4d61-4932-b922-aeaea6c3b49b | 7 | public void normalize() {
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
for (Map.Entry<Double, Double> entry : knotMap.entrySet()) {
double currVal = entry.getValue();
if (currVal > max) {
max = currVal;
}
if (currVa... |
2bc5c9c5-9e1c-4645-a074-a86ee44a428f | 8 | protected Connection waitAndGet(int wait) throws SQLException {
Connection conn = null;
try {
conn = this.availableConnections.poll(wait, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new SQLException("Connection pool wait interrupted before " + wait + ... |
004a6d70-c219-405c-ba5e-328dfb96f49f | 7 | private Item findMobTargetItem(MOB mobTarget)
{
final Vector<Item> goodPossibilities=new Vector<Item>();
final Vector<Item> possibilities=new Vector<Item>();
for(int i=0;i<mobTarget.numItems();i++)
{
final Item item=mobTarget.getItem(i);
if((item!=null) && (item.subjectToWearAndTear()) && (CMLib.flags().... |
2f2b45bc-d8b5-4922-a308-f56678579c4d | 2 | public static void main(String[] args){
// new Stacker().doThis(); // this will throw a StackOverFlowError
try{
new Stacker().doThis();
}catch(StackOverflowError soe){
System.out.println("Oops I'm stacked :) " + count);
}
catch(Error er){
System.out.println("An Unknown Error Occurred " + count);
}... |
f50ccf16-655f-46b1-b9f8-52df2bc7cb36 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",... |
66526149-4977-44c1-86f9-57bb3d8eb26a | 3 | private void interpolation(){
// Dimension interpolation arrasys
this.xInterp = new double[this.nInterpPoints];
this.yInterp = new double[this.nInterpPoints];
// Calculate x-axis interpolation points
double incr = (this.xPositions[this.nData-1] - this.xPositions[0])/(this.nInter... |
871d8910-a467-4c4f-9c4d-0548a896a4ba | 7 | public static void main(String args[]) {
if(args.length < 1){
System.out.println("Usage: " + System.getProperty("sun.java.command") + " zipFile");
return;
}
try {
ZipFile zf = new ZipFile(args[0]);
Enumeration<?> entries = zf.entries();
BufferedReader input = new BufferedReader(new
InputStrea... |
55ae01dc-eb2c-4187-8c83-2f6550c89359 | 7 | public void respawn() {
SpawningPosition spawningPosition = Game.getMap().getSpawnPosition();
ActorSet actors = Game.getActors();
if (shipId == null) {
ship = getShip();
} else {
Actor a = actors.findById(shipId);
if (a instanceof PlayerShip) {
... |
45928d3c-6138-462f-aa5d-45c4c6268970 | 6 | public static int getFaceNum(Face face){
if(face==NORTHERN) return 0;
else if(face==EASTERN) return 1;
else if(face==SOUTHERN) return 2;
else if(face==WESTERN) return 3;
else if(face==FLOOR) return 4;
else if(face==CEILING) return 5;
return -1;
} |
a7bee1a2-7c52-45da-b9b5-984858140b9c | 5 | private boolean verificarNumero(int random) {
int mod = 0;
for(int i = 0 ; i < 3 ; i++){
for(int j = 0 ; j < 4 ; j++){
try {
if (tabuleiro.getCartaTabuleiro(i, j).getCodigo() == random) {
mod++;
}
} catch (Exception e) {
}
}
}
if (mod <=1 ) {
return true;
} else {
retu... |
db23c450-282a-4582-b313-60450f3b9fd5 | 8 | private void readTimedElement(Hashtable ht) throws Exception {
String name = "";
String typeId = "";
String imageName = "";
String timeImageNameBase = "";
String timeImageNameSufix = "";
int level = 0;
boolean requireWall = false;
boolean scaleToWall = false;
if (ht.get("LEVEL") != null) level = Integer.parse... |
cc0734bb-e400-4a26-82cf-4061d2ea97f3 | 4 | private void LogarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LogarActionPerformed
try {
Connection con = Conectar.conn();
Cryptography cryptography;
cryptography = new CryptographySHA512();
String cript;
... |
8a249ac5-f5f2-449e-9bea-d66ceb2fecbe | 1 | @Override
public void notifyActionListeners(ActionEvent event) {
if (mOutlineToProxy != null) {
mOutlineToProxy.notifyActionListeners(event);
} else {
super.notifyActionListeners(event);
}
} |
aa2fa42d-0514-4a07-ade0-b95b1055e988 | 8 | private static void testSetup() {
int tests = 0;
int failed = 0;
printHeader("Testing Setup");
// Make sure setup actually works and uses the correct number of rows.
for (int i = 1; i < 5; i++) {
try {
ColumnPuzzle temp = new ColumnPuzzle(i);
... |
fed361ac-8c89-41f1-85d7-ddc6d7dc7dd9 | 1 | @Override
public void scoreRound(boolean won, int score){
games_played++;
//Train based on win/loss
double[] output = new double[]{won ? 1 : 0};
/*
net.compute(data_prev.inputs);
net.trainBackprop(LEARN_RATE, output);
*/
net.compute(data_cur.inputs);
net.trainBackprop(LEARN_RATE, output);
} |
b9b02322-efa2-49fa-95f8-5d6e0d994340 | 6 | protected boolean isValidLocation(Mover mover, int sx, int sy, int x, int y) {
boolean invalid = (x < 0) || (y < 0) || (x >= map.getWidthInTiles()) || (y >= map.getHeightInTiles());
if ((!invalid) && ((sx != x) || (sy != y))) {
invalid = map.isBlocked(mover, x, y);
}
return !invalid;
} |
f57b0f41-2e36-471c-9dea-e880e701807d | 0 | @Test
public void testBubbleSort(){
sortInsertion.load(array,null,null);
sortInsertion.run();
assertArrayEquals(array, arrayActuals);
} |
4d45dbc9-add6-48b0-b051-662692ebd771 | 3 | public void inAir() {
System.out.println("ja");
if(gravityAffected)
velocity.subtract(Constants.gravity);
if ( Tilemap.currentTilemap.isYBlocked((int) pos.getX(), (int) (pos.getY() + velocity.getY()), 64, 64, velocity.getY())){
int margin = (int) ( 64-pos.getY() % 64);
if (margin < 32 )
velocity.s... |
eff77dfb-5aa3-4261-8157-eda9dfc9424b | 3 | public void union(final int a, final int b) {
final Node na = findNode(a);
final Node nb = findNode(b);
if (na == nb) {
return;
}
// Link the smaller tree under the larger.
if (na.rank > nb.rank) {
// Delete nb.
nb.child.parent = na.child;
na.value = b;
} else {
// Delete na.
na.child... |
85fe4db0-df85-48f8-ba79-1eb8caabd75e | 7 | public final boolean equals(Object par1Obj)
{
if (!(par1Obj instanceof IntHashMapEntry))
{
return false;
}
IntHashMapEntry inthashmapentry = (IntHashMapEntry)par1Obj;
Integer integer = Integer.valueOf(getHash());
Integer integer1 = Integer.valueOf(inthash... |
ed11c9d8-e42a-47f2-b633-e3330d772588 | 2 | public void saveSigns() {
if (plugin.signSet != null) {
try {
FileOutputStream fos = new FileOutputStream("plugins/ClassSign/signs.dat");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(plugin.signSet);
... |
60517148-4813-48e0-b292-4ca2cc5d10d3 | 6 | private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
... |
c13e9cb3-e3f1-4b45-bcba-32837134dea1 | 1 | public boolean padding()
{
if (h_padding_bit == 0) return false;
else return true;
} |
c65c909d-a1cb-48a9-a7d2-6dae2b9d1f04 | 0 | protected void fireCheckChanged(Object source, int index) {
fireContentsChanged(source, index, index);
} |
3aaaa0d2-8a04-4d09-a330-c0eba76ff2b2 | 4 | public void insertarAntesde(T dato, T nuevo){
Nodo<T> actual = inicio;
Nodo<T> anterior = null;
boolean band = false;
while (actual!=null && !band) {
if (!actual.getInfo().equals(dato)) {
anterior = actual;
actual = actual.getLiga();
... |
c1101d26-d617-49c3-9d4d-4db1381f926f | 2 | public void moveRandomly() {
m += Math.round((random.nextFloat() * 2.0 - 1.0) * disperseStepSize);
if (m < 1) {
m = 1;
} else if (m > N) {
m = N;
}
} |
20e4b33f-331e-4860-8f4b-cb75f7be3518 | 4 | @Override
public Value evaluate(Value... operands) throws Exception {
// we want only two operands
if (operands.length != 2)
throw new EvalException(this.name()
+ " Error: wrong number of operands");
// get operands
Value l = operands[0];
Value r = operands[1];
// if types match
if (l.getType()... |
2fac0160-a5fb-4184-bdf0-52e200f6f6e9 | 8 | public TeleportLocation findTeleportLocation(DescentMap map) {
ArrayList<Room> possible_rooms = new ArrayList<Room>();
for (Room room : map.getAllRooms()) {
if (room.getHeight() > bound_object_diameter && room.getWidth() > bound_object_diameter) {
possible_rooms.add(room);
}
}
Room d... |
2841a0e1-fbfe-42c2-9d6b-785f2f5c55dd | 9 | public Integer evaluate(Board state, Player.PlayerType player)
{
HashSet<Integer[]> thisBoardBlockedPoints = new HashSet<Integer[]>();
for(int x=0;x<Board.BOARD_SIZE;x++){
for(int y=0;y<Board.BOARD_SIZE;y++){
if(state.get(x, y)==Board.BoardState.BLOCKED){
Integer[] point = {x,y};
thisBoardBlockedP... |
4ddbf150-5c5c-4c36-8dc8-c1ba395566d3 | 1 | @Test
public void zerarQuantidadeVendidoDosProdutos() throws ExceptionGerenteEstoque {
Produto p = adicionarProdutoNaFaixada("Feijão","123");
p.setQuantidedeVendido(3);
Produto p2 = adicionarProdutoNaFaixada("Arroz","321");
p2.setQuantidedeVendido(5);
faixada.zerarQuantidadeVendido();
assertTrue("Deveria t... |
259414c2-c69a-4a4d-bbb3-dbd62da0adaa | 6 | private String[] getEnabled () {
enabledMods.clear();
if (folder.exists()) {
for (String name : folder.list()) {
if (name.toLowerCase().endsWith(".zip")) {
enabledMods.add(name);
} else if (name.toLowerCase().endsWith(".jar")) {
... |
9c8b26a4-77cf-47e6-a25a-b489e1e7745c | 1 | private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
if (cmbBuscarProjeto.getSelectedItem().equals("Selecione")) {
JOptionPane.showMessageDialog(null, "Erro selecione o Projeto",
"Gestão de Atividade", JOptionPane.ERROR... |
87d96983-f540-44cb-86ec-d5d41546c952 | 6 | ActionList opponentActions(GameInfo gameInfo) {
if(this.size() == 0) return this;
ActionList opponentActions = new ActionList();
// keeps track of which actions belong to OPPONENT
boolean opponentsTurn;
// initialize playerTurn as appropriate
if(gameInfo.dealer == Dealer.OPPONENT) opponentsTurn = tr... |
7b8b7e64-6099-439e-a382-964b757ea37c | 9 | public void testStrings() {
System.out.println();
String[] testStrings =
{ "\"\"", "\"hi\"", "\"HI\"", "\"1\"", "\"\n\"", "\"\\n\"", "\"\nhi\n\"", "\"\\\"\"", "\"\t\""};
String[] testsThatShouldFail = { "", "\"", "00\"", "\"pp", "asdf", "asdf\"sdf\"" };
java.io.Reader reader = null;
try {
... |
7a9f5aab-79a7-41e2-8564-ac105b7793fe | 3 | private void updateTouch(Sense touch, Environment env){
ActionHistory history = c.getLastActionHistory();
if (history == null){
return;
}
if (history.getLastAction().equals(MovementAction.MOVE_UP) || history.getLastAction().equals(MovementAction.MOVE_DOWN)){
touch.setValue(!history.isAbleToTake());
}
} |
98bd8299-8034-433d-b6f7-64e47c52650c | 5 | protected void doHandler(AbstractElement elementParser){
if (ElementType.STARTTAG.equals(elementParser.getType())) {
handler.startElement(elementParser.getName(), elementParser.getAtts());
} else if (ElementType.ENDTAG.equals(elementParser.getType())) {
handler.endElement(element... |
f606dd88-915a-4c3f-8276-eebb2af7c685 | 4 | private void textPrecioKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textPrecioKeyTyped
// TODO add your handling code here:
if (!Character.isDigit(evt.getKeyChar()) && evt.getKeyChar() !='.' && !Character.isISOControl(evt.getKeyChar()))
{
Toolkit.getDefaultToolki... |
b610e95c-d538-406c-b1ba-ee2d5e7b1923 | 3 | @Override public void init() {
rnd = new Random();
lastTimerCall = 0l;
timer = new AnimationTimer() {
@Override public void handle(long now) {
if (now > lastTimerCall + 100_000_000l) {
for (SimpleGauge gauge : gauges) {
... |
dd87cd1c-b022-4aad-8ed0-a3cb4d7ea37c | 4 | @Override
public void call(int floor, Direction direction) {
Direction cabinDirection = cabinDirection();
Goal newGoal = new Call(floor, direction);
if (!thereIsAGoal() || goalIsOnTheRoad(newGoal)) {
nextGoals.addFirst(newGoal);
} else {
if (cabinDirection ==... |
dc7421a3-67e7-4b67-9347-0a48e591d1ba | 1 | public boolean more() throws JSONException {
this.next();
if (this.end()) {
return false;
}
this.back();
return true;
} |
36bac204-47c5-4c62-bbf2-6603cd3f8f3b | 4 | public static void testFileSystemMounted(String mountedPath) throws TestFailedException
{
try
{
File dir = new File(mountedPath, "Test directory");
if ((!dir.exists() && !dir.isDirectory()) && !dir.mkdir())
throw new TestFailedException("Creating directory " + dir.getAbsolutePath() + " failed");
F... |
ffd11c24-74b9-42b9-a742-7103bb419697 | 8 | private double getPesoLlaveEntera(int llave){
double peso = 0;
switch (llave) {
case 0:
peso = this.getPeso(EMBARAZOS);
break;
case 1:
peso = this.getPeso(CONCENTRACION_GLUCOSA);
break;
case 2:
peso = this.getPeso(PRESION_ARTERIAL);
break;
case 3:
peso = this.getPeso(GROSO... |
b64b7430-6fd9-424d-a175-7e20c4728509 | 4 | @Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
ModelUser oUser = new ModelUser();
oUser.setUser(authentication.getName());
oUser.setPassword(authentication.getCredentials().toString());
ModelUser oUserLogged = oService.l... |
2429392d-81f4-41ff-89e3-e812ad03fa99 | 3 | public static void main(String[] args) {
try {
System.out.println("---------");
System.out.println("1. ");
System.out.println("2. ");
Scanner sc = new Scanner(System.in);
byte sel;
sel = sc.nextByte();
switch (sel) {
case 1:
new Server().Start();
break;
case 2:
String serverIp... |
a5c44918-27e0-4543-a281-2b3d4f080073 | 8 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if((affected instanceof MOB)
&&(!msg.amISource((MOB)affected))
&&(msg.tool() instanceof Ability)
&&(msg.tool().ID().equals("Skill_MorseCode"))
&&(msg.sourceMinor()==CMMsg.NO_EFFECT)
&&(msg.targetMinor()==CMMsg.NO_EFFECT)
&&(... |
93119905-7bd7-4914-8753-00576317f97f | 5 | private double verifyInput(int row, int column) {
String value = model.getValueAt(row, column).toString().replace(",", ".");
Double hours = 0.0;
if (Utils.isNumeric(value)) {
hours = Double.parseDouble(value);
} else if (value.equalsIgnoreCase("v")) {
} else if (value... |
49d1ec83-896a-4526-83dc-6dab779aecf9 | 6 | private void copyRGBtoRGBA(ByteBuffer buffer, byte[] curLine) {
if(transPixel != null) {
byte tr = transPixel[1];
byte tg = transPixel[3];
byte tb = transPixel[5];
for(int i = 1, n = curLine.length; i < n; i ... |
8a4503c1-5e51-41d2-ad20-2377a060d44e | 9 | protected void accumulateStatistics(String name,
Raster source,
Object stats) {
// Get image and band count.
PlanarImage sourceImage = getSourceImage(0);
int numBands = sourceImage.getSampleModel().getNumBands();
... |
cef398c2-a4b9-4649-aefc-383efa447347 | 1 | private static void displaySchedules(ResultSet rs)throws SQLException{
StringBuilder bf = new StringBuilder();
while (rs.next()){
bf.append(rs.getDate("work_day")).append(", ");
bf.append(rs.getTime("work_from")).append(", ");
bf.append(rs.getTime("work_till")).append(", ");
bf.append(rs.getBigDecima... |
617eeab0-25e1-4e9f-9d6f-335a86586931 | 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... |
618581ce-e22f-4fd8-afe5-e5accec6ca89 | 7 | public void buildClassifier(Instances data) throws Exception {
if (!m_checksTurnedOff) {
// can classifier handle the data?
getCapabilities().testWithFail(data);
// remove instances with missing class
data = new Instances(data);
data.deleteWithMissingClass();
}
// Preproce... |
9f9bf637-639b-476c-8169-904ecf299d39 | 4 | public Chunk getChunk(int x, int z)
{
if (x < 0 || x >= xSize)
return null;
if (z < 0 || z >= zSize)
return null;
return chunks[x][z];
} |
9b58c3ed-992a-4d46-8b96-0abd7e22a21b | 0 | @Override
public String toString() {
return "Eat Action (" + eater.ID() + ")->(" + victim.ID() + ")";
} |
f113140a-89fa-4b40-b025-33e914a53bb2 | 6 | public int[] plusOne(int[] digits) {
boolean up = false;
int len = digits.length;
if(len == 0) {
return digits;
}
if(digits[len-1] == 9) {
digits[len-1] = 0;
up = true;
for(int i=len-2;i>=0;i--) {
if(up) {
up... |
52b9f626-5f9c-4c2d-8a55-56b4b1b68efd | 0 | public static void main(String[] args) {
ParcelConstructorArgument p = new ParcelConstructorArgument();
Wrapping w = p.wrapping(10);
System.out.println(w.value());
} |
46bba31b-462d-4c49-84f4-ebd00fee5b82 | 1 | public void testParseLocalTime_simple() {
assertEquals(new LocalTime(10, 20, 30), g.parseLocalTime("2004-06-09T10:20:30Z"));
assertEquals(new LocalTime(10, 20, 30), g.parseLocalTime("2004-06-09T10:20:30+18:00"));
assertEquals(new LocalTime(10, 20, 30), g.parseLocalTime("2004-06-09T10:20:30-18:00... |
b13f46f4-1d91-4317-bbef-bcea1384aa43 | 2 | public void delete(String chunk_uuid) {
Socket client = null;
try {
client = new Socket(InetAddress.getLocalHost(), port);// port˿ڷͻ
ObjectOutputStream out = new ObjectOutputStream(
client.getOutputStream());
ObjectInputStream in = new ObjectInputStream(client.getInputStream());
String[] s = ... |
627bd1e0-0577-472d-937e-17409eed0831 | 9 | public void tenpai(String[] ten)
{
finalizeriichi(null);
Player[] tenpai =new Player[ten.length];
boolean move = true;
for(int i=0;i < ten.length;i++)
{
tenpai[i]=players[position(ten[i])];
if(tenpai[i]==players[dealer])
move=false;
}
if(tenpai.length==1)
{
take(tenpai[0], players[0], 1000... |
8fd48a84-61bb-4b00-a03a-60089d6865d5 | 1 | public void gameGUI(boolean active)
{
if (active)
{
group.setVisible(true);
gamePane.setVisible(true);
autorizePane.setVisible(false);
container.setLayout(new GridLayout(2,1));
container.remove(autorizePane);
}
else
{
group.setVisible(false);
gamePane.setVisible(false);
autorizePane.... |
41004980-7f62-4bde-bf27-0f9be0bccf2d | 9 | public static Player getWinner(Player a, Player b) {
if(null == a.getCurrentChoice() || null == b.getCurrentChoice())
return null;
ChoiceCode aChoice = a.getCurrentChoice().getCode();
ChoiceCode bChoice = b.getCurrentChoice().getCode();
if(aChoice == bChoice)
return null;
Player winner = null;
if(
... |
8e066f4b-cc7b-4dda-8c0a-33ad63fe7eb4 | 4 | public boolean tryAddPoint(int x, int y) {
if (type!=TYPE_POLY) return false;
double minDist=Line2D.ptSegDist((double)poly.xpoints[poly.npoints-1], (double)poly.ypoints[poly.npoints-1],
(double)poly.xpoints[0], (double)poly.ypoints[0],
(double)x, (double)y);
... |
a2804eb6-a4a4-4073-bfbf-6aa3bfaabc16 | 3 | public void windowClosing (WindowEvent e) {
//Do nothing
if(winAction == 0) {
setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
}
//close
else if(winAction == 1) {
setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
closeAll();
}
//hide
else if(winAction == 2) {
setDefaultCloseOper... |
72245650-3a24-4b3b-8ac1-60f476492193 | 3 | private static void printVerbose(String sourceName, ImageInfo ii) {
printLine(0, null, sourceName);
printLine(1, "File format: ", ii.getFormatName());
printLine(1, "MIME type: ", ii.getMimeType());
printLine(1, "Width (pixels): ", ii.getWidth(), 1);
printLine(1, "Height (pixels): ", ii.getHeight(), 1);
prin... |
0515fd96-897b-487b-81f9-f8b0a24b54a0 | 2 | public String generate()
{
StringBuilder tmp = new StringBuilder(100);
// generate the id statement
for (RelationDescriptor rdesc : getRelationDescriptors())
{
if (tmp.length() > 0)
{
tmp.append(" AND ");
}
tmp.append(rdesc.toString());
}
return tmp.toString();
} |
b882f0bc-2d5d-4c95-9472-15bbf61d86bb | 1 | private static void withGenerics() {
GenericContainer<String,Integer> c = new GenericContainer<>();
c.setInternal("str");
String str = c.getInternal();
System.out.println(str);
// GenericContainer<String, int> c;
if (c instanceof GenericContainer) {
}
String[] arr = new String[10];
Double[... |
9c9f6ca8-2a50-4f44-b633-e67cbd77a86c | 5 | private int getPriority(String priority) {
if (priority.equals(m_settings.getLocalizedMessage("priority.vlow")))
return 1;
else if (priority.equals(m_settings.getLocalizedMessage("priority.low")))
return 2;
else if (priority.equals(m_settings.getLocalizedMessage("priority.medium")))
return 3;
else if ... |
476e5e96-7115-4801-a53d-643442478b31 | 6 | @EventHandler(priority=EventPriority.LOW)
public void fishEvent(PlayerFishEvent event) {
Player play = event.getPlayer();
if(event.getCaught() == null)
return;
EntityType fish = event.getCaught().getType();
if((MCListeners.isMultiWorld()) && (!play.hasPermission... |
64932909-09aa-4c96-b60c-51edd1928d89 | 3 | @Override
public Extension[] getExtensionsFor(String extensionPointName)
{
if(registry == null) {
scanForExtensions(directory, fileNameFilter);
}
LinkedList<Extension> extensions = registry.get(extensionPointName);
if(extensions != null) {
Extension[] res = new Extension[extensions.size()];
int i ... |
0f098b42-8c77-48ab-9113-5750fa053832 | 1 | private ConvertersForPair getMatchableConverters(ConvertiblePair convertiblePair) {
ConvertersForPair convertersForPair = this.converters.get(convertiblePair);
if (convertersForPair == null) {
convertersForPair = new ConvertersForPair();
this.converters.put(convertiblePair, convertersForPair);
}
ret... |
a5818615-6b66-486d-9346-a00def9f6d88 | 5 | static String escape(String EscapeString)
{
String ResultString = "";
for (int i=0; i<EscapeString.length(); i++)
{
switch (EscapeString.charAt(i))
{
case '\n':
ResultString = ResultString.concat("\\n");
break;
case '\\':
ResultS... |
4822b79b-80cd-4f46-b27d-6200bd9b2c65 | 8 | private Class<?> load(Class<?> clazz, Properties properties) {
if (properties != null) {
String className = properties.getProperty(clazz.getName());
if (className != null) {
ClassLoader loader;
try {
loader = Thread.currentThread().getContextClassLoader();
} catch (Exception e) {
throw new... |
e126dae8-2c2f-4eda-a437-6b7ca647d762 | 4 | public static SphericalPositionVelocity jauPv2s(double pv[][])
{
double x, y, z, xd, yd, zd, rxy2, rxy, r2, rtrue, rw, xyp;
double theta, phi, r, td, pd, rd;
/* Components of position/velocity vector. */
x = pv[0][0];
y = pv[0][1];
z = pv[0][2];
xd = pv[1][0];
... |
b70d83cd-a389-4345-8d8a-649fa08a5add | 7 | void updateGui(String fieldname) {
Object fieldval = fieldvalues.get(fieldname);
Object fieldcom = fieldcomponents.get(fieldname);
String fieldtype = (String)fieldtypes.get(fieldname);
if (fieldcom instanceof JCheckBox) {
((JCheckBox)fieldcom).setSelected(
((Boolean)fieldval).booleanValue() );
/* more ... |
d852c804-4b18-4f28-b0ba-c24871d5ad38 | 6 | private Node higherNode(T k) {
Node x = root;
while (x != null) {
if (k.compareTo(x.key) < 0) {
if (x.left != null) {
x = x.left;
} else {
return x;
}
} else {
if (x.right != null) {
x = x.right;
} else {
Node current = x;
while (current.parent != null
&& cu... |
527aaa62-d4cb-4baf-a226-aeea62c9c40c | 8 | private boolean isTwoSame(Arguments arg1, Arguments arg2) {
boolean response = false;
// if two args are null response is true
if (arg1 == null && arg2 == null) {
response = true;
} else if (arg1 == null || arg2 == null) { // if one is null
response = false;
} else {
// checking all values are same o... |
ec85ff32-e258-46c3-9380-77b313ed2a66 | 0 | protected void setMessage(String message)
{
myMessage.setText(message);
} |
8db8d920-5919-4f28-8439-019a64182a5b | 0 | public int getStudentId() {
return studentId;
} |
922ab16e-1311-4e6f-9832-3bceb96b1173 | 1 | public static int nextDay(int day)
{
if (day==6)
return 0;
else
return day+1;
} |
efe06986-a422-4516-acba-f95d104bea93 | 3 | private void restoreHighlightStyle(Annotation annotation) {
if (annotation instanceof LinkAnnotation) {
LinkAnnotation linkAnnotation = (LinkAnnotation) annotation;
Object object = linkAnnotation.getObject(
LinkAnnotation.HIGHLIGHT_MODE_KEY);
// update the... |
b2042e1b-c14c-445b-8a8e-f22a1bfe1dbf | 0 | public Beverages getBeverage() {
return beverage;
} |
9dcbbf65-571e-4a12-8acc-2ae944a4a1a1 | 5 | public List<IWeightedGraph<N, Number>> getMinimumWeightedGraphs() {
return result != null && result.size() > 0 && result.get(0) instanceof IWeightedGraph<?, ?> ? (List<IWeightedGraph<N, Number>>) result : null;
} |
3f0e03da-4980-4167-ae3d-cda59afc1ef1 | 8 | public void CollisionCheck(int x, int y, int xa, int ya, int h, int w,
Entity ee) {
int xp = x + xa;
int yp = y + ya;
move: {
java.util.List<Entity> entities = getEntities(ee);
for (int i = 0; i < entities.size(); i++) {
Entity e = entities.get(i);
if ((x + (w * xa) + xa) == (e.x - (xa * e.w)))... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.