method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cc79e0c6-4b44-430b-a104-02ddfc5f0cf4 | 4 | public static void main(String[] args) {
int a, b, holding;
Scanner input = new Scanner(System.in);
for(;;) {
System.out.print("Please enter two integer parameters (0 to exit): ");
a = input.nextInt();
b = input.nextInt();
if (a < b) {
//rearranging the values such that a is alway... |
7bd5650d-26ba-4f95-9ae1-2dd67257d1df | 7 | public static Object from(Object value, Class<?> clazz) {
if (value == null) {
return value;
}
if(value.getClass().getSuperclass().equals(Number.class)) {
Number number = (Number)value;
if(clazz.equals(Integer.class)) {
value = number.intValue();
} else if(clazz.equals(Long.class)) {
value = n... |
396a21d1-4d5b-4287-be9f-aadf0e455cb3 | 1 | public double calculateExpectedScore() {
double score = 0;
double[] fruitProbabilities = predictDistribution();
for (int i = 0; i < typesOfFruit; i++) {
score += fruitProbabilities[i] * bowlSize * pref[i];
}
return score;
} |
e7cefca5-7489-4c35-bf77-3411d5fdacba | 8 | public static void main(String[] args) {
try{
MongoClient mongoClient = new MongoClient("localhost", 27017);
// MongoClient mongoClient = new MongoClient(Arrays.asList(new ServerAddress("localhost", 27017), new ServerAddress("localhost", 27018)));
DB db = mongoClient.getDB("POS");
DBCollection pos = db... |
75a2a1b1-ae49-404c-9232-180907fae03f | 5 | public Record<String, String> readNextRecord() throws IOException {
if(!isInit) {
initialize();
}
if(currentOffset >= filePartition.getEnd()) {
raf.close();
return null;
}
String line = raf.readLine();
if(line == null) {
return null;
}
Record<String, String> record;
if(keyDelim... |
ec8ce5fd-13cb-40b8-af74-f9421836f632 | 9 | public boolean canEncounter(int tile)
{
if (tileSet == OUTDOORS)
{
switch(tile)
{
case 19:
if(!surfing)
return false;
case 90:
case 187:
return true;
default:
return false;
}
}
else if (tileSet == INDOORS)
{
switch(tile)
{
case 244:
if(!surfing)
... |
02f95f67-c17c-4e18-bb5d-0e1c2a3515da | 6 | public String analizadorSintactico(TablaTrans tabla) {
int estado_actual = 0;
for (int i = 0; i < listaToken.size(); i++) {
estado_actual = Math.abs(estado_actual); // estado anterior
// System.out.println(listaToken.get(i).getLexema());
estado_actual = tabla.getEstad... |
55ed49b0-a16a-45d3-b848-3d4b7d2ed5d6 | 8 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g); // paint parent's background
// dessin du cadre
g.drawLine(0, 0, xMax, 0);
g.drawLine(xMax, 0, xMax, yMax);
g.drawLine(xMax, yMax, 0, yMax);
g.drawLine(0, yMax, 0, 0);
// DEBUT dessin de la grille ------------------------------... |
a18c2e29-6098-41b9-b153-df01a3d66c73 | 7 | void drawLabel(char symbol, boolean opposite, int gridId, double scaledstep, int x, int y, Font font, Paint fontColor, String labfmt) {
String graph_label;
int labelOffset = (int) (worker.getFontAscent(font) / 2);
double label_value = scaledstep * gridId;
if (gridId == 0 || symbol == ' ... |
7238ce08-c346-4f23-86cb-debe94a808b1 | 1 | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
if(isTokenValid(request))
{
System.out.println("Valid form submission");
resetToken(request);
return mapping.findForward("success");
}
else
{
System.out.println("Duplic... |
7715d7fb-e79c-4649-99b6-32460512a649 | 0 | public void pickpocket()
{
} |
767550e1-39ca-4c1d-acc5-23265edfcba1 | 3 | public void draw(Graphics2D g2) {
AffineTransform tx = new AffineTransform();
tx.translate(-(xMovement / maxXMovement * GamePanel.WIDTH), 0);
g2.setTransform(tx);
g2.drawImage(background, 0, 0, GamePanel.WIDTH, GamePanel.HEIGHT, null);
g2.drawImage(background, GamePanel.WIDTH * 2, 0, -GamePanel.WIDTH, GamePan... |
1d8343ef-9062-4a2f-85e3-47a9a7ae80c6 | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
int startIndex = this.index;
int startCharacter = this.character;
int startLine = this.line;
reader.mark(Integer.MAX_VALUE);
do {
c = next();
if (c... |
514479c1-f1e3-4e90-9dc0-4a44bcf9f415 | 7 | private Color convertColor(int x){
Color BlockColor = Color.BLACK;
switch(x){
case 1: BlockColor = Color.BLACK;
break;
case 2: BlockColor = Color.GREEN;
break;
case 3: BlockColor = Color.BLUE;
break;
... |
d112c762-632c-4c84-9ca8-a07cf7842521 | 4 | private void processReturnedOfficers() {
for (Policeman p : mWalkingOfficers) {
if (!getEntryPoints().contains(p.getPosition())) { continue; }
if (!p.isGoingHome()) { break; }
mDrinkersToBeCaught.remove(p.getCatchedBadGuy());
//remove policeman and dr... |
1ef2e590-3feb-4beb-a0a3-748994b58c8c | 7 | public static Rule_smaliClassRef parse(ParserContext context)
{
context.push("smaliClassRef");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>... |
076ebb2c-f4f5-40ba-af5f-49986cf8d1a0 | 1 | public static double perceivedBrightness(Color color) {
double red = color.getRed() / 255.0;
if (!isMonochrome(color)) {
double green = color.getGreen() / 255.0;
double blue = color.getBlue() / 255.0;
return Math.sqrt(red * red * 0.241 + green * green * 0.691 + blue * blue * 0.068);
}
return red;
} |
0081f32d-e27b-43fe-a026-bcb356113eef | 5 | public Boolean[] getWillFlip(int x, int y){
List<Boolean> willFlip = new ArrayList<>();
try {
willFlip.add(new Boolean(puzzle[y][x]));
} catch (ArrayIndexOutOfBoundsException ex) {
throw new RectangularPuzzleIndexOutOfBoundsException();
}
try {
willFlip.add(new Boolean(puzzle[y][x + 1]));
} catch ... |
c3dc4193-7f65-4ab7-a6df-c92549d42589 | 5 | private long removeRefBidData(long lIndex) {
//
// loop through the elements in the actual container, in order to find the one
// at lIndex. Once it is found, then loop through the reference list and remove
// the corresponding reference for that element.
//
BidData refActualElement = GetBidData(lIndex);
if (r... |
34054a74-3012-4dfd-84bf-903d5892d313 | 3 | public void update(GameContainer gc, StateBasedGame sbg, int delta)throws SlickException
{
Input input = gc.getInput();
if(!isGameOver)
{
if(!isPause)
{
if(input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON))
{
System.o... |
ee1a1dbe-69f8-45b0-ae2b-b433e2b0795d | 4 | private void inicializar() {
index = 0;
boolean cargado = true;
JDIniciar jdi = new JDIniciar(this, true);
jdi.setVisible(true);
if (jdi.getOpcion() == 0) {
this.proyectos = new ArrayList<>();
JDNuevoProyecto jdnp = new JDNuevoProyecto(this, true);
... |
227df78f-149c-43ca-a5ff-68d6e1ed76e0 | 6 | protected @Override Char getNewToken() throws ScannerException {
try {
Char c = new Char(reader.read());
if (c.getCharClass() == Char.Class.HASHMARK) // ignore comment
do {
c = new Char(reader.read());
} while (c.getCharClass() != Char.Class.NEWLINE
&& c.getCharClass() != Char.Class.EOF);
... |
91a01677-ed84-48be-b334-f2b61edf5007 | 4 | private void Outlier(Double n) {
//if (n.IsNumeric())
{
if (_minValue == null) {
_minValue = Double.MAX_VALUE;
}
if (_maxValue == null) {
_maxValue = Double.MIN_VALUE;
}
_minValue = (n < _minValue) ? n : _minVa... |
bcb93e8c-a9a0-420f-9893-08f186006032 | 5 | public static int[] getTriplets(int number) {
// TODO Auto-generated method stub
int[] triplets = new int[3];
for(int c = number;c>0;c--){
for(int b = c-1;b>0;b--){
for(int a = b-1;a>0;a--)
{
if(((a+b+c)==number) && (a*a)+(b*b)-(c*c)==0){
triplets[0]=a;
triplets[1]=b;
triplets[2]... |
1655bb9e-c4c8-45ba-b180-dc524a7449b7 | 8 | @Override
public void act() {
if((steps<sideLength)&&(canMove())){
move();
steps++;
}else if((steps==sideLength)&&(canMove())){
setDirection(locObj.SOUTHWEST);
move();
steps++;
}else if((steps==(sideLength*2)&&(canMove()))){
setDirection(locObj.EAST);
move();
steps++;
}else if((steps... |
734aeaa3-ea34-4916-8354-258e7e56daf2 | 4 | @Override
public boolean update(Reservation x)
{
Statement stm = null;
try
{
String req = "UPDATE reservation SET \n" +
"datedebut=\""+x.getDateDebut()+"\",\n" +
"datefin=\""+x.getDateFin()+"\",\n" +
"particulierid="+x.getP... |
a56961be-a81c-40f1-a23f-ee1b0a269824 | 1 | @Override
public void setVaakaNopeus(double vaakaNopeus){
for (KentallaOlija osa : osat){
osa.setVaakaNopeus(vaakaNopeus);
}
} |
71f18653-89c4-4b85-99ad-afccb03869a2 | 4 | public void populateForTransfer()
{
getSheetHash();
BiffRec[] recs = getCells();
for( BiffRec rec : recs )
{
if( rec.getOpcode() == LABELSST )
{
Labelsst mylabel = (Labelsst) rec;
mylabel.initUnsharedString();
}
}
transferXfs = getWorkBook().getXfrecs();
for( Object transferXf : transfer... |
b85f9fbb-848e-4032-8378-46063d71344a | 0 | public String getSmartDashboardType() {
return "Analog Input";
} |
3a9b3bc5-2406-455b-808a-7c0bd83532e3 | 1 | @Override
public double calculate(double x) {
return -Math.pow(Math.pow(x, 2), 1 / 3.) -
((1 - Math.pow(x, 2) < 0) ? -Math.pow(Math.pow(x, 2) - 1, 1 / 3.) : Math.pow(1 - Math.pow(x, 2), 1 / 3.));
} |
807255f9-f99d-43a1-9622-25e48c087784 | 2 | public String getCategoryObjectDescr (Integer ID) {
String data = "";
for (int i = 0; i < this.arr_data.size(); i++) {
if (ID == this.arr_data.get(i).getID()) {
data = this.arr_data.get(i).getDescr();
}
}
r... |
b440fd81-8997-46f7-91bf-2a380fa570b9 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof Style)) {
return false;
}
if (obj == this) {
return true;
}
Style _object = (Style) obj;
return _object.bold == bold && _object.color.equals(color) && _object.background.equals(background)
... |
970878bf-fe40-4b0f-aaee-23cd64f3a644 | 1 | private List<Tile> getTiles(List<Component> cmps, Map<Component, Tile> cmpsMap) {
List<Tile> tiles = new ArrayList<Tile>();
for (Component c : cmps) tiles.add(cmpsMap.get(c));
return tiles;
} |
b4077703-2b6e-4a21-81fe-0ebf33fb3e77 | 2 | public void rotate(double leftright, double updown) {
if (leftright != 0) {
screencanvas.rotate(Player.p.getEyepos(), leftright);
}
if (updown != 0) {
// screencanvas.getNormalVector().set(
// VectorUtils.mulitply(Matrix3D.getRotationMatrix(
// Math.toRadians(updown), Matrix3D.AXIS_X),
// screenca... |
7d0290b5-21d1-49c6-9ae3-685c07c1bfe8 | 3 | public int read1(){
int ret;
if(endbyte>=storage){
ret=-1;
endbit++;
if(endbit>7){
endbit=0;
ptr++;
endbyte++;
}
return (ret);
}
ret=(buffer[ptr]>>endbit)&1;
endbit++;
if(endbit>7){
endbit=0;
ptr++;
endbyte++;
}
re... |
fce1dff0-1530-4540-81f4-5f54ad807f67 | 6 | public void set(String seqStr) {
if (seqStr == null) {
length = 0;
codes = null;
} else {
length = seqStr.length();
int ilen = length / BASES_PER_BYTE + (length % BASES_PER_BYTE != 0 ? 1 : 0);
codes = new byte[ilen];
char seqChar[] = seqStr.toCharArray();
// Create binary sequence
int j = 0... |
4d995ee1-a441-4efa-847f-cc974a4e7b47 | 7 | private List<List<String>> importData(){
List<List<String>> artistData = new ArrayList<List<String>>();
// Find all .artistcleaned.
StringBuilder sb = new StringBuilder();
List<String> dataFiles = new ArrayList<String>();
File[] files = new File("data").listFiles();
for (File file : files) {
if (fi... |
324305c2-16cf-419b-8f4d-a5b2392d53b4 | 2 | @Override
public Component deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
JsonObject jsonObject = jsonElement.getAsJsonObject();
for(Component component : components) {
if(component.isComponent(jsonObjec... |
6cf1f340-6f68-4231-87f5-136dccb056c7 | 2 | public boolean sethor(int hora)
{
if(hora>0&&hora<24)
{
_hor=hora;
return true;
}
else
return false;
} |
636dc2b1-a418-41f4-be03-3cfceb14ed94 | 3 | private boolean whiteCanEnPassantRight( int position ) {
return ( this.previousMove != null && pieceTypeAt( position + 1 ) == PAWN && this.previousMove.from() == ( position + 33 ) ) && this.previousMove.to() == ( position + 1 );
} |
04bed50e-9698-4a22-85c4-5d9adcb7876f | 2 | private void checkHighCard() {
int highCard = 0;
for (int i = 0; i < 5; i++) {
Card card = hand[i];
if (card.getValue() > highCard) {
highCard = card.getValue();
}
}
myEvaluation[3] = highCard;
} |
63751781-6bee-4828-9410-21a15316a259 | 4 | public static void main(String[] args)
{
Loan loan = null;
try {
Prompt prompt = new Prompt();
loan = prompt.promptForLoanInformation();
} catch (LoanEntryException ex) {
System.out.println(ex.getMessage());
System.exit(1);
}
... |
c0a62f5d-79ec-480c-b390-11ebb4992396 | 8 | @Override
public void keyPressed(KeyEvent event) {
int keyCode = event.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT) {
lastInput = Operation.MOVE_LEFT; //attempting to buffer..
} else if (keyCode == KeyEvent.VK_RIGHT) {
lastInput = ... |
087e0855-c145-48f5-a057-4cfb1244a042 | 6 | private void initializeTable() {
ImageIcon plusIcon = new ImageIcon(getClass().getResource("/images/btnPlus.png"));
ImageIcon minusIcon = new ImageIcon(getClass().getResource("/images/btnMinus.png"));
plusIcon = new ImageIcon(plusIcon.getImage().getScaledInstance(28, 28, java.awt.Image.SCALE_SMO... |
f67af5c3-f45f-4f04-a4fa-1231ec21fe61 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
52ff8a02-8c5f-4570-8240-352e69cf8023 | 4 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == record)
{
selectedInstance = new RecorderPanel(this, new GridLayout(4,2));
System.out.println("buttonClicked!");
}
else if(e.getSource() == play)
{
selectedInstance = new PlayPanel(this, new FlowLayout());
}
else if(e.get... |
8eccb177-4950-4500-9285-9e515600d0b3 | 1 | public synchronized void mouseMoved(MouseEvent e) {
if (isRelative()) {
Point p = e.getPoint();
dx += p.x - center.x;
dy += p.y - center.y;
centerMouse();
} else {
currentPos = e.getPoint();
}
} |
32def00a-2f1f-4ef6-bd24-007a1cb08207 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[54];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 16; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... |
3967c873-cb00-4475-a4d0-ac586631b6fc | 0 | @Basic
@Column(name = "item_number")
public String getItemNumber() {
return itemNumber;
} |
afd90461-f369-454a-9d90-162bdcc6ebec | 7 | @Override
public boolean equals(Object obj) {
Vec3<?> vec = (obj instanceof Vec3<?> ? (Vec3<?>) obj : null);
return (vec == null ? null : (X == vec.X && Y == vec.Y && Z == vec.Z));
} |
7721f399-59ff-4cf8-bbb5-4064dea9dea6 | 3 | public List<LoginEntry> readLoginsSince(String since) {
List<LoginEntry> retList = new ArrayList<LoginEntry>();
try {
ResultSet rs = _sqLite.query("SELECT login.*, player.playername as playername FROM player, login "
+ "WHERE player.id = login.id_player "
+ "AND login.time_login > '" + si... |
9a161a2e-8e48-4e16-8e8d-aaee8ec600a0 | 7 | public void processShortcuts() {
Collection<Node> branches = new HashSet<Node>();
for (Node node : getNodes()) {
if (node.isBranch()) branches.add(node);
}
L: while (true) {
Iterator<Node> iter = branches.iterator();
while (iter.hasNex... |
18071a5f-300f-40cc-931e-7e08cb370fb3 | 3 | public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
System.out.println("Error en " + e.toString());
... |
0f08b863-a419-48d0-a88c-496fad47ba4b | 9 | private void put(ArrayList<String[]> res, int level) {
if (level == n) {
String[] sol = new String[n];
for (int i = 0; i < n; i++) {
char[] line = new char[n];
for (int j = 0; j < n; j++) {
if (j == selection[i])
line[j] = 'Q';
else
line[j] = '.';
}
sol[i] = String.copyValu... |
b9a46fdf-4181-4981-a55f-646940183d19 | 8 | protected void processRuleBlock(String block, Engine engine) throws Exception {
BufferedReader reader = new BufferedReader(new StringReader(block));
String line = reader.readLine();
String name = "";
int index = line.indexOf(' ');
if (index >= 0) {
name = line.substri... |
4131f61e-064a-42b8-9246-9a2f75e8efa3 | 8 | @Override
public void run() {
init();
final double GAME_HERTZ = 30.0;
final double TIME_BETWEEN_UPDATES = 1000000000 / GAME_HERTZ;
final int MAX_UPDATES_BEFORE_RENDER = 5;
double lastUpdateTime = System.nanoTime();
double lastRenderTime = System.nanoTime();
f... |
2c8a517b-b5b8-450b-b0c9-02ab86b74e31 | 4 | @Override
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getID() == KeyEvent.KEY_RELEASED) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
//user pressed enter: try to submit response
if (responseField.getText().length() > 0) {
/... |
fa3eb917-37f7-4ab7-882e-e79f0ffc71c5 | 9 | public static Vector<String> MyHighligthOfUnremitting(String id){
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(id + "_problems.txt")));
String s,parts[];
Vector<String> probID = new Vector<>();
while(... |
bb344e57-f16c-456c-a1bd-1299e55c054a | 4 | private boolean HandleMoveCommand(String s) {
if (s.equals("n")) {
EnterRoom(currentRoom.GetRoomInDirection("N"));
return true;
} else if (s.equals("s")) {
EnterRoom(currentRoom.GetRoomInDirection("S"));
return true;
} else if (s.equals("e")) {
EnterRoom(currentRoom.GetRoomInDirection("E"));
ret... |
23b1b168-6f1f-486a-9c75-064f9fc9de2f | 4 | public void attachHost(GridSimCore entity, PacketScheduler sched)
{
String msg = super.get_name() + ".attachHost(): Error - ";
if (entity == null)
{
System.out.println(msg + "the entity is null.");
return;
}
if (sched == null)
{
Sy... |
a96292ff-6e65-44dc-9241-e86d6f85d682 | 7 | private void forkAndMutate(int network){
NeuralNetwork tempNet=null;
if(speciesMode){
tempNet=currentSpecies.getIndividuals().get(network);
}
if(networkMode){
if(network==0)
tempNet=net;
else
tempNet=net2;
}
... |
2710a0ad-c141-4446-8277-e06bce8e3336 | 4 | private void rotate()
{
//orient++;
if (orient%4==0)
{
litPositions=new int[][]
{{0,1,0},
{0,1,1},
{0,0,1}};
}
if (orient%4==1)
{
litPositions=new int[][]
{{0,0,0},
{0,1,1},
{1,1,0}};
}
if (orient%4==2)
{
litPositions=new int[][]
... |
27618b6d-39a4-44e4-a4e2-0ddf42093d24 | 6 | public void analizadorSintactico() {
int estado_actual = 0;
TablaTrans tabla = new TablaTrans();
for (int i = 0; i < listaToken.size(); i++) {
estado_actual = Math.abs(estado_actual);
estado_actual = tabla.getEstadoSiguiente(estado_actual, listaToken.get(i).getValor_token... |
e5e61360-eb22-4a5a-8ee4-9cf3feb761fb | 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... |
33ec01af-3e42-49e4-be70-6abc1559e01b | 4 | public static void dbClose1(Statement st,Connection con){
if(st!=null){
try {
st.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(con!=null){
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.... |
f9a44a34-5b17-4e86-ad5f-37774f5cb9f8 | 1 | public void visit_sastore(final Instruction inst) {
stackHeight -= 3;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
b8c2c663-4ee6-47d8-b8d1-fa19613209dd | 7 | public static void main(String [] args) {
try {
boolean readExp = Utils.getFlag('l', args);
final boolean writeExp = Utils.getFlag('s', args);
final String expFile = Utils.getOption('f', args);
if ((readExp || writeExp) && (expFile.length() == 0)) {
throw new Exception("A filename must be ... |
89c88942-35e5-4e65-9d79-3022b2fbaabd | 2 | public void keyReleased(int key) {
if(key == Input.KEY_LEFT ||
key == Input.KEY_RIGHT) {
inMoveStack.remove((Integer)key);
}
inputStack.remove((Integer)key);
} |
936f57e1-36fa-460e-9f0e-b45b079d2770 | 7 | @Override
public boolean onCommand(CommandSender sender, Command command, String label,
String[] args)
{
// Only players can share chests
if (!(sender instanceof Player))
{
sender.sendMessage("This command may only be executed in-game.");
return true;
}
// Safe to cast since we know it's a Player
... |
7a548677-b418-4d66-ae6c-64370a3c00a2 | 2 | private void emitChanges() {
for (SettingsChangesListener listener : listeners) {
listener.chatLoggingChanged( isEventEnabled("log-chat") );
listener.topicVisibilityChanged( isViewEnabled("display-topic") );
String format = isViewEnabled("timestamp-enabled") ? getViewTimestam... |
fd3ce189-9d60-452f-b09d-8e05ea3f33f2 | 9 | public PoemPhoneticScore(String body, int poemId){
BufferedReader reader = new BufferedReader(new StringReader(body));
// System.out.println(body);
try {
String line = reader.readLine();
String nextLine = reader.readLine();
// System.out.println("readline: "+line);
while(nextLine != null) {
w... |
314a14b7-a8d9-4a2d-891b-71f25a31b028 | 8 | @Override
protected Entity getEntity(int row, int id) {
final String name = nameTextField.getText();
if (StringUtils.isNullOrEmpty(name)) {
GUIUtils.showErrorMessage(new EmptyFieldException("Название"));
return null;
}
short year = (short) yearSpinner... |
e8c729b7-7292-413b-8c27-083c974e83d6 | 1 | private boolean paikkaSisaltyySyotteeseen() {
return (paikka >= 0 && paikka < syote.length()) ;
} |
b7ef0197-ac09-4419-beac-73b9883298d7 | 1 | @Override
protected void onMessage(String channel, String sender, String login, String hostname, String message) {
ChannelEventsListener listener = getChannelEventsListener(channel);
if (listener != null)
listener.messageReceived(sender, message);
} |
f4de78f4-88cc-4d46-b0e7-2a64d0907b0f | 9 | public static void main(String args[]) throws Throwable{
Escaner sc=new Escaner();
StringBuilder sb=new StringBuilder();
int posTeam[]=new int[999999+1];
boolean enColaGeneral[]=new boolean[posTeam.length];
LinkedList<Integer> colaGeneral=new LinkedList<Integer>();
LinkedList<Integer> colas[]=new LinkedList... |
ac1ab43a-7620-43c9-8f07-11dc42fddae5 | 6 | public static void main(String[] args)
{
/*
System.out.println(args.length);
if (args.length == 3)
System.out.println(args[1] + " " + args[2]);
*/
int startinstancecount = 6000;
int maxiterations = 10;
int extraruns = 4;
// Updates the values with the arguments given with the
// method call ... |
52e18165-b9b4-4f78-96a8-4dc206a5f5d9 | 0 | public void setKills(int kills) {
this.kills = kills;
getPlayer().sendPluginMessage(The5zigMod.getInstance(), "5ZIG", ("/s/kills=" + kills).getBytes());
} |
52a30884-4d91-448f-90eb-54f15c59e78d | 6 | public static void main(String[] args) throws SQLException
{
// TODO Auto-generated method stub
Login user=new Login();
// The default port number.
int portNumber = 12324;
/*
* Open a server socket on the portNumber (default 2222). Note that we can
* not choose a port less than 1023 if we are not pri... |
7197e991-f6e9-4204-b195-7b59e922f670 | 6 | public boolean declareVariable(String variableName, Object value){
for(String p : localVars.keySet())
if (p.equals(variableName)){
// System.out.println("Variable \""+variableName +"\" already exists locally; Line: "+(index+1)+"\tScript: "+ID);
return false;
}
if (!(value instanceof String) && !(value ... |
f42927b2-59f5-46a3-b395-6b44e6371ec7 | 7 | protected static int writeLines(MapActionMenu menu, MapCanvas canvas, int x, int y, MapFont font, String text) {
int xPos = x;
int yPos = y;
int xLimit = menu.getWidth() - x;
int yLimit = menu.getHeight() - y;
int spaceWidth = font.getWidth(" ") + CHAR_SPACE;
String[] wor... |
e719375f-d83f-4636-8d3d-937464e03b2e | 8 | private synchronized void processQ() {
synchronized (toDownload) {
for (Download d : toDownload) {
if (d.state == State.QUEUED) {
File t = new File(d.getTempPath());
if (t.exists()) {
d.due.start(t.length());
d.due.len(d.totalLen - t.length());
if (d.due.os() instanceof OutputEntityStream)
... |
6517edec-c336-49e2-beae-c97bef34dc1b | 8 | @SuppressWarnings("unchecked")
private void getResponseBipolarList() {
titleDLM.removeAllElements();
bipolarQuestionList = bipolarQuestion.getBipolars(fileName, RESPONSETOBIPOLAR, teamType);
if (bipolarQuestionList.size() != 0) {
for (int i = 0; i < bipolarQuestionList.size(); i++) {
titleDLM.addElement(b... |
712a0770-846d-4cf2-ad94-ee22928c21f9 | 0 | @Override
public void setClassName(String className) {
this.className = className;
} |
9baf79b3-45a8-43dc-9e35-2b709236f80e | 6 | private boolean filter(byte a, byte b) {
boolean x = a >= 0;
boolean y = b >= 0;
if(x && y) {
return a < b;
}
if(!x && y) {
return a > b;
}
if(x && !y) {
return a + b < 0;
}
... |
3a57cbb2-d2de-4f31-b0fe-9a2356bdab1c | 9 | private static <T> void printNodeInternal(List<Node<T>> nodes, int level, int maxLevel) {
if (nodes.isEmpty() || BTreePrinter.isAllElementsNull(nodes))
return;
int floor = maxLevel - level;
int endgeLines = (int) Math.pow(2, (Math.max(floor - 1, 0)));
int firstSpaces = (int) Math.pow(2, (floor)) - 1;
int ... |
b273ba5f-cb1f-418b-81bb-c890330d8ecb | 3 | public static void sort(int[] array)
{
for (int i = 0; i < array.length; i++)
{
for (int j = 0; j < array.length-1; j++) {
if (array[j] > array[j+1]) {
int temp = array[j];
array[j] = array[j+1];
array[j+1] = tem... |
55a84583-02c6-4f13-8457-f1a8a2fa8171 | 9 | public static ValueCreator<?> forType(String type) {
ValueCreator<?> result = STRING_VC;
if ("Version".equals(type)) {
result = VERSION_VC;
} else if ("Long".equals(type)) {
result = LONG_VC;
} else if ("Double".equals(type)) {
result = DOUBLE_VC;
... |
bec2e850-0b09-429d-86fe-4108a3bd8af8 | 4 | public ButtonModel1() {
setTitle("ButtonModel1");
JPanel panel = new JPanel();
panel.setLayout(null);
ok = new JButton("ok");
JCheckBox cb = new JCheckBox("Enabled", true);
ok.setBounds(40, 30, 80, 25);
ok.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
Defau... |
6ef13b2c-f673-45bc-a784-3e0dffdc8853 | 0 | @Override
public String toString() {
return "(" + x + ", " + y + ")";
} |
3593ee87-22dd-4e53-a914-8893e1ad5627 | 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... |
a05e98a9-d720-465c-92de-c8dfba540f61 | 5 | public void clearAllWatchers() {
if (registeredWatchers.size() > 0) {
boolean isRemoved = false;
LOG.info("About to unregister all watchers.");
for (WatchKey watchKey : registeredWatchers.keySet()) {
try {
isRemoved = notifier.removeWatcher(watchKey);
if (isRemoved) {
registeredWatchers.r... |
9994425c-c929-4b52-8bf3-d9ff387000e3 | 5 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
97f902b4-eddf-4333-bc40-00ff523c9302 | 6 | @Override
public int hashCode() {
int result = item != null ? item.hashCode() : 0;
result = 31 * result + (item2 != null ? item2.hashCode() : 0);
result = 31 * result + (item3 != null ? item3.hashCode() : 0);
result = 31 * result + (item4 != null ? item4.hashCode() : 0);
resu... |
90e339a1-ad37-4193-abe6-8f02dc9f75b5 | 8 | public GamePanel(final Client client) {
this.client = client;
addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent event) {
requestFocusInWindow();
}
});
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent event) {
Syst... |
315cdcde-6cbc-451e-8f8e-6b28a9eab4f7 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj == this)
return true;
if (!(obj instanceof ProcessComponent))
return false;
ProcessComponent<?> other = (ProcessComponent<?>) obj;
return id.equals(other.getID());
} |
c0e6f6d0-b11a-49da-9476-a9a1d9234ff3 | 1 | public void nodeDisplay(Node node){
Node currNode = node;
while(currNode!=null){
System.out.println(currNode.getData());
currNode = currNode.getNextNode();
}
} |
12b2a1fa-7dd1-42a1-be68-e27e7c05d7d7 | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);
MediaLibAccessor srcMA =
new MediaLibAccessor(sources[0], destRect, format... |
c7b32b9d-70f0-4613-a884-ec759513d3a7 | 3 | public void actionPerformed (ActionEvent ae)
{
// Quand on clique sur Accepter on enregistre dans le repertoire par defaut
if (ae.getActionCommand().equals("Accepter"))
{
action = 1;
}
// Quand on clique sur Enregistrer Sous on recupere le chemin
else if (ae.getActionCommand().equals("Enregistrer sou... |
a8557da4-9a4e-44a1-b1e9-323847e229fe | 6 | public void redirectToOption(int option)
{
switch (option) {
case 1:
addPlayer();
break;
case 2:
showPlayer();
break;
case 3:
updatePlayer();
break;
case 4:
deletePlayerInfo();
break;
case 5:
showPlayerList();
break;
case 6:
save();
break;
default:... |
c279d0f8-89af-4367-b6fa-1aebc42efcda | 3 | public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException
{
if (str != null && maxLength != 0)
{
int currentLength = getLength();
if (maxLength <= str.length() + currentLength)
{
str = str.substring(0, maxLength - currentLength);
}
}
super.insertString(offs,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.