method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b2f42bf6-23e1-42b7-811e-5dc17ed075c5 | 2 | public FunctionalList rest() {
FunctionalLinkedList output = new FunctionalLinkedList();
if (size() == 0) {
return null;
}
for (int i = 0; i < size(); i++) {
output.add(get(i).getReturnValue());
}
output.remove(0);
return output;
} |
ce2af9ba-44da-4cc8-8832-7f8ef50d08a2 | 0 | public void setStato(String stato) {
this.stato = stato;
} |
8ec4c435-eb72-417f-8f0a-a6290bb64804 | 3 | public void postComment( final String username, final long swarmID, final String comment, final long replyTo, final String ip ) throws IOException {
if( comment.length() == 0 ) {
return;
}
if( comment.length() > 4*1024 ) {
throw new IOException("Too long");
}
Boolean good = (new SQLStatementP... |
56ee38d8-f015-4f7f-b0d8-cefd93fc3db6 | 9 | public double getPower(long tick, String type) {
try {
ConsumptionModel cm = null;
if(type == "p") {
cm = pcm;
} else {
cm = qcm;
}
double power = 0;
if(isInUse()) {
long relativeTick = Math.abs(tick - onTick);
// If the device has a limited operational duration
long divTick = ... |
b675fc18-f8d1-4763-82cc-f6cbd9a88737 | 1 | @Test
public void testUniqueIdValues() {
List<Short> retrievedIdValues = new ArrayList<Short>();
for (Application application : Application.values()) {
assertTrue(!retrievedIdValues.contains(application.getId()));
retrievedIdValues.add(application.getId());
}
} |
115dfbbc-85f1-4ef4-9649-3e1804598839 | 2 | static public void printAUrl(URL theUrl)
{
if (theUrl.getPort() > 0)
System.out.println(theUrl.getProtocol() + "://" +
theUrl.getHost() + ":" +
theUrl.getPort() +
theUrl.getFile());
else if (theUrl.getProtocol().compareToIgnoreCase("mailto") == 0)
System.out.println(theUrl... |
efd5ec3a-9344-4446-921d-0265014a05f9 | 9 | private void countEarliest() {
for (Statement s: expectedIn.keySet()) {
earliest.put(s, new LinkedList<Statement>());
if(availibleIn.get(s) == null) {
for (Statement e : expectedIn.get(s))
earliest.get(s).add(e);
} else if(availibleIn.get(s... |
4e0532c1-a942-4a50-bf5e-718885c84543 | 8 | private void string(String value) throws IOException {
String[] replacements = htmlSafe ? HTML_SAFE_REPLACEMENT_CHARS : REPLACEMENT_CHARS;
out.write("\"");
int last =0;
int length = value.length();
for (int i=0; i<length; i++){
char c = value.charAt(i);
String replacement;
if (c<128){
replacement... |
913b51e5-467b-4c17-9abd-d4d02421685f | 2 | public Product getOnderdeelFromID(int pId){
int id = 0;
String naam = null;
int type = 0;
int minVoorraad = 0;
int voorraad = 0;
int inBestelling = 0;
try {
this.leesDatabase();
statement = con.createStatement();
rs = statement.executeQuery("SELECT * FROM voorraad where id='"+ pId +"'");
... |
87db7b47-7f16-4b11-844a-9317cb77af8b | 7 | public static int fillTable(int rows, int cols,int colStart,int colEnd){
int cri=1;//current row index. begin calc at table [1][1]
int cci=1;//current col. index
int up,left,caddy,bestChoice=0,val=0;//the ones to look at and the one to choose.
char let1,let2;//left and top seq letters. gene left genome top
in... |
ea1abefd-8315-4997-bd21-2db334b30607 | 3 | public String getNumber() {
String re = "";
int x = this.getBegin();
while (this.getBegin() < this.getCad().length() && (this.getCad().charAt(x) + "").matches(this.getMatchNum())) {
re = re + this.getCad().charAt(x++);
this.setBegin(x);
}
return re.equals(... |
2866f37b-f0ea-44d3-9038-b262f6f248e8 | 6 | private void printChildren(SimpleNode currentSimpleNode, Graphics2D g2d, int nextLeft, int numberIncrementLeft) {
if (currentSimpleNode != null && currentSimpleNode.getNext() != null) {
SimpleNode item = currentSimpleNode.getNext();
int numberNextLeft = getNumberNextLeft(item != null ? i... |
da2d5d49-b3db-4129-90f7-e734c38c9742 | 0 | public IronSword(){
this.name = Constants.IRON_SWORD;
this.attackScore = 7;
this.attackSpeed = 9;
this.money = 75;
} |
fc375bf9-63e9-46d0-9037-f0ff29691f65 | 1 | public static String getRequestMethod(String request) {
int end = request.indexOf(" ");
return ((end != 0) ? (request.substring(0, end)) : null);
} |
1fa3fc05-8c53-4f7c-95ca-8a7fc4f94f9c | 3 | public static String eraseAtSpecialPosition(String s, int position, int n) {
if(s.length() <= n) {
return "";
} else if(position <= 0) {
return s;
} else {
StringBuilder sb = new StringBuilder();
sb.append(eraseLastChars(s.substring(0,position), n)... |
4f38a17b-eae2-4065-9f5d-ce97802dffbe | 1 | private void checkToNode()
{
Edge edgeFrom = addressFinder.searchForEdge(to.getText());
if (edgeFrom != null)
{
toNode = edgeFrom.getFromNode();
to.setText(edgeFrom.getRoadName());
mapComponent.setTo(true);
mapComponent.setToNode(toNode);
mapComponent.repaint();
reset.setEnabled(true);
runRo... |
4a3fbe0a-d636-4a22-944d-5e5fb440b650 | 4 | private float blink(float alpha){
this.alpha += this.velocity;
if(this.alpha == 1){
this.osc.getEnvelope().addSegment((float) 0.4, PApplet.map(this.alpha, 0, 255, 1.f, 2.f));
}
if(this.alpha >= 255 ){
this.osc.getEnvelope().addSegment((float) 0.0, PApplet.map(this.alpha, 0, 255, 0, 0.5f));
}
if(... |
9a84dc26-ee92-4660-a0e3-96b75a65bf3f | 4 | private static double calcUpper( final double y )
{
double result;
double ySq;
double xNum;
double xDen;
if( y <= 4.0 )
{
xNum = ERF_C[8] * y;
xDen = y;
for( int i = 0; i < 7; i++ )
{
xNum = (xNum + ERF_C[i]) * y;
xDen = (xDen + ERF_D[i]) * y;
}
result = (xNum + ERF_C[7]) / (xDen ... |
1fe4d462-6daa-47e0-a73c-614561c6eba1 | 4 | private void calculateFitness(){
for(int i = 0; i < numberOfParticles; i++){
double currentfitness = objectiveFunction.CalculateFitness(position[i]);
if(maximum){
if(currentfitness > fitness.get(i)){
fitness.put(i, currentfitness);
updatePersonalBest(i);
}
}else{
if(currentfitness < fit... |
235847dd-a6b6-450a-b880-c98878275e9c | 1 | @Override
public void actionPerformed(ActionEvent evt) {
if (evt.getSource()==type){
calcStats();
refresh();
}
} |
1f02a9cb-63b9-4b2a-a214-632c4e306d55 | 4 | @Override
public void run() {
try {
while (true) {
Message message = chatModel.receiveMessage();
MessageHandler messageHandler = MessageHandlerFactory.getMessageHandler(message, chatView, chatModel);
messageHandler.handleMessage();
}
... |
350862ae-1d4d-494c-a76a-0349081ff8a0 | 8 | private int findMaxVal(IntervalNode left, IntervalNode right, int end) {
int maxVal = 0;
int leftVal = 0;
int rightVal = 0;
if (null == left) {
leftVal = Integer.MIN_VALUE;
} else {
leftVal = left.val.getMax();
}
if (null == right) {
rightVal = Integer.MIN_VALUE;
} else {
rightVal = right.va... |
5dc5dbd6-3573-476e-9f92-ad978da06b0f | 3 | @Override
public void neighborhoodChange() {
next = null;
for(Edge e : this.outgoingConnections) {
if(next == null) {
next = (S1Node) e.endNode;
} else {
if(e.endNode.ID < next.ID) {
next = (S1Node) e.endNode;
}
}
}
} |
aabac26c-27d7-4fa4-a9f3-eaa30bda8929 | 2 | @Override
public void grabbed(EventMouse eventMouse) {
if (drag && active){
Vector2f posDifference = eventMouse.getPosition().sub(pressPosition);
movePosChildren(posDifference);
setPosition(posDifference);
this.topTransform.setPos(getPosition().add(new Vector3... |
f53c8b08-2f1b-487d-8330-bea8e890f3da | 0 | public Queue() {
} |
5efdc6e4-619f-49f2-8820-b6cff3a804f3 | 4 | public void startGame(){
if(this.state != MAINMENU){
return;
}
try {
String[] mapName = MapData.getMapNames();
territories = TerritoryFactory.getTerritories(mapName[selectedMap]);
} catch (IOException e) {
e.printStackTrace();
}
Random rand = new Random();
int sum = 0;
int player = 0;
... |
0485a765-8f4a-41f3-8f67-47689916eacc | 3 | private int getIdxProchainePlageHoraireNonVide(int idxCourant){
if(idxCourant < -1) return -1;
for(int idx = idxCourant+1; idx < this.plagesHoraire.size(); idx++){
if(!this.plagesHoraire.get(idx).estVide()){
return idx;
}
}
return -1;
} |
8c13b879-e22b-4dc9-b381-e5d6fa47ea40 | 2 | public void updatePlatAst(int k, Character plat) {
// manages astroids, continues the animation by changing images
Platform astroid = (Platform) plat;
if (astroid.getBrownAnimation() == true) {
offScreenBuffer.drawImage(myImages.get(astroid.getId()),
astroid.getX(), astroid.getY(), this);
// astroid.... |
6bc4da6e-70d2-413d-bd94-44cbed78e79e | 2 | public static String truncate(String str, int max, boolean trimBack) {
if (str.length() < max) {
return str;
} else {
if (trimBack)
return str.substring(0, max - 3) + "...";
else
// trim from front
return "..." + str.substring(str.length() - (max - 3), str.length());
}
} |
0e864794-5188-4c20-9bbb-18ec7d66345a | 4 | public void move(int dx, int dy){
dy = dy * -1;
if (ScreenX + dx > 0 && ScreenX + Width + dx < 800){
ScreenX += dx;
}
if (ScreenY + dy > 0 && ScreenY + dy + getTotalHeight() < Standards.W_HEIGHT){
ScreenY += dy;
}
} |
d2e67370-83fa-4c56-8200-8188b359c0d9 | 8 | public static void shuffleOperations() {
int i, n = 7;
boolean z[] = new boolean[7];
//GainOperation - 1
for (int j = 0; j < 1; j++) {
i = Random.getInstance().randomInt(n--);
while (z[i]) {
i = (i + 1) % 7;
}
z[i] = true;... |
4a215ca2-0857-4b0b-ac24-8207e805921b | 6 | public void draw(Graphics g) {
int i;
for (i = 0; i != 4; i++) {
setVoltageColor(g, volts[i]);
drawThickLine(g, ptEnds[i], ptCoil[i]);
}
for (i = 0; i != 2; i++) {
setPowerColor(g, current[i] * (volts[i] - volts[i + 2]));
drawCoil(g, dsign ... |
83b17053-a47f-4dba-8d02-9827e0fe68f7 | 2 | public Object get(int index) {
if (index < 0 || index >= instructionCount)
throw new IllegalArgumentException();
return get0(index);
} |
50cb7982-f5c3-45cb-b08a-87aba334e678 | 1 | @Override
public double bonusDefense(Territoire t, Peuple attaquant){
if( t.has(SalleInfo.class) )
return 1.0;
return 0.0;
} |
ac93fa77-803b-4e42-b185-23151857d1ec | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... |
0a1a8529-1e34-4001-8237-1403651d272c | 9 | public FeederControlPanel( FactoryControlManager fcm ) {
this.fcm = fcm;
//Dimensions
feederNumberLabelSize = new Dimension( 20, 20 );
//Timers
updatePartLowAndCount = new Timer( 1000, this );
updatePartLowAndCount.start();
//JPanels
feederTitleLabelPanel = new JPanel();
feederPan... |
5bde1f35-4192-491c-8803-964799144aca | 8 | public static double[] inverseGammaFunction(double gamma) {
double gammaMinimum = 0.8856031944108839;
double iGammaMinimum = 1.4616321399961483;
if (gamma < gammaMinimum) throw new IllegalArgumentException("Entered argument (gamma) value, " + gamma + ", must be equal to or greater than 0.8856031944108839 - this m... |
f81f0ad9-b4bd-40cd-95c2-8707a17f7995 | 2 | private boolean checkTouch(Player player1, Player player2)
{
boolean collision = false;
Integer widthPlayer1 = player1.getX() + player1.getWidth();
Integer heightPlayer1 = player1.getY() + player1.getHeight();
Integer widthPlayer2 = player2.getX() + player2.getWidth();
Integ... |
9dfc6b43-15ce-4b0d-8d7f-e602086a6276 | 1 | public void setPlace(Place place) {
if (place == null) {
throw new IllegalArgumentException("Place shouldn't be NULL.");
}
this.place = place;
} |
88979778-7c50-4725-833e-5652f65d55ee | 0 | @Override
public Boolean getIsSoldOut() throws Exception {
return this._isSoldOut;
} |
50afab63-6d48-448c-83b5-b73dbe23c8f3 | 8 | private boolean r_tidy_up() {
int among_var;
// (, line 183
// [, line 184
ket = cursor;
// substring, line 184
among_var = find_among_b(a_7, 4);
if (among_var == 0) {
return false;
}
// ], line 184
bra = cursor;
switch (among_var) {
case 0:
return false;
case 1:
// (, line 188
// ... |
e3aa353c-108f-49be-8adb-0e987388d01b | 0 | @Override
public void componentShown(ComponentEvent e) {
// TODO Auto-generated method stub
} |
7c8d00b2-ce10-4967-b413-42662247a9f4 | 5 | public final void update(Level level, int x, int y, int z, Random rand) {
int var6 = level.getTile(x, y - 1, z);
if(level.isLit(x, y, z) && (var6 == Block.DIRT.id || var6 == Block.GRASS.id)) {
if(rand.nextInt(5) == 0) {
level.setTileNoUpdate(x, y, z, 0);
if(!level.maybeGrowT... |
60981273-9a78-4ef3-9734-d0d556de0e07 | 8 | void bfs(String start, String end, HashSet<String> dict) {
Queue queue = new LinkedList<String>();
queue.add(start);
path.put(start,0);
String current;
while(!queue.isEmpty()) {
current = (String)queue.poll();
if(current==end) {
continue;
... |
e2557fc6-dbd8-4fc2-9290-6dc76a18bb47 | 1 | @Test
public void testRoot() {
tree = new BinarySearchTree<String, String>();
String root = null;
String result = null;
tree.add("Ram GC","DW-210");
tree.add("Hari Shrestha","DW-211");
tree.add("Shyam Karki","DW-2100");
previousli = tree.inOrder(tree.returnRoot());
for(int i=previousli.size()-... |
853c0600-1d56-4023-9e50-52ed750946c7 | 4 | public SubMenu(Skin skin) {
this.skin = skin;
super.addActor(table = new Table(skin));
table.top().left();
table.defaults().left().pad(5);
addListener(new InputListener() {
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (event.getTarget().isDesc... |
4be5bcc9-6fc2-44d3-8671-ab1b7b98a0a4 | 5 | public static void build(){
pics = new JLabel[Ocean.getInstance().getOceanObjects().size()+1];
for(int i =0; i<Ocean.getInstance().getOceanObjects().size();i++){
if(Ocean.getInstance().getOceanObjects().get(i).getObject().equals("Fish")){
pics[i] = new JLabel(icon1);
oceanP.ad... |
28c89fe4-cd1d-4a61-bbd9-3e9d9386cf7a | 7 | public void blockCheckQuest(Player player, Block block, String type, int incressBy){
if(plugin.isEnabled() == true){
//get our quester
Quester quester = plugin.getQuestInteraction().getQuester(player);
//get the players current quest as well if they have one
if(quester.getQuestID() != -1){... |
9bf7d9da-62b2-4630-9548-58e27a67c79a | 1 | private double[][] luoValietapit(double[] ax1y1x2y2, double[] bx1y1x2y2, int n) {
double ax1 = ax1y1x2y2[0];
double ay1 = ax1y1x2y2[1];
double ax2 = ax1y1x2y2[2];
double ay2 = ax1y1x2y2[3];
double bx1 = bx1y1x2y2[0];
double by1 = bx1y1x2y2[1];
do... |
c300cfb5-b68b-4020-872d-ebc938d74945 | 2 | @Override
public void show() {
System.out.println(name + ", here are your search results:");
Auction[] auctionResults = as.search(input);
for(Auction auc : auctionResults){
try{
System.out.println(auc.toString());
}
catch(Exception e){
System.out.println("No results match");
}
}
System... |
94933e05-84ee-4283-be0b-9ffc3575c10c | 6 | void verify( char[] str )
{
int start=-1;
for ( int i=0;i<str.length;i++ )
{
if ( str[i] != 0 && start == -1 )
start = i;
else if ( str[i] == 0 && start != -1 )
{
reportWord( str, start, i );
start = -1;
}
}
if ( start != -1 )
reportWord( str, start, str.length );
} |
32ba0a12-48a8-4c32-91d1-e810744b1188 | 6 | @Override
public void render()
{
// if(BlockyMain.instance.getLevel() != null || BlockyMain.instance.clientHandler != null)
{
int max = list.size();
for(int index = max;10 > max-index && index >= 0;index--)
{
if(index < 0 || index >= list.size()... |
c61b998b-b2f6-4007-8fbe-d39f034b57d5 | 4 | private static void rotate(int dd) {
ImageData imageData = original.getImageData();
int[][] matrix = new int[imageData.height][imageData.width];
for (int i = 0; i < imageData.height; i++) {
for (int j = 0; j < imageData.width; j++) {
matrix[i][j] = imageData.getPixel(j, i);
}
}
int[] pixels = Imag... |
33f15105-8bf9-4925-8af3-e8cf10432078 | 8 | public static void printCons(Cons tree, PrintableStringWriter stream, String lparen, String rparen) {
if (((Boolean)(Stella.$PRINTREADABLYp$.get())).booleanValue()) {
lparen = "(";
rparen = ")";
}
if (((Boolean)(Stella.$PRINTPRETTYp$.get())).booleanValue()) {
Cons.pprintCons(tree, stream, ... |
cd518bfc-65c1-4156-a047-e56e2b64e8ef | 9 | @Override
public void itemStateChanged(ItemEvent event) {
boolean isSelected = event.getStateChange() == ItemEvent.SELECTED;
//System.out.println(event);
if(event.getSource() instanceof JComboBox && isSelected)
{
// portList = Arduino.list();
JComboBox box = (JComboBox)event.getSource();
... |
184b9df8-c8ed-49a2-8938-233f1b20e609 | 2 | @Override
public ListCell<NoteEntity> call(ListView<NoteEntity> p) {
return new TextFieldListCell(new StringConverter<NoteEntity>() {
@Override
public String toString(NoteEntity n) {
if(n==null || n.getTitle()==null)
return... |
35360dfe-8e93-4ba5-b217-ec357decfd79 | 6 | @Override
public void keyPressed(int k) {
if(player.getMovable()){
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
}
... |
89deac80-1296-4df7-8e35-0f441da85855 | 0 | private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed
setVisible(false);
}//GEN-LAST:event_btnCerrarActionPerformed |
2b628982-afc9-4c86-8737-4736e5729b3f | 6 | @SuppressWarnings("unchecked")
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
try {
this.commandsManager.execute(cmd.getName(), args, sender, sender);
return true;
} catch (CommandPermissionsException e) {
... |
9da7829b-8002-4330-91a5-9e3711585f70 | 9 | private boolean compareStudentRecords(StudentRecord sr1, StudentRecord sr2) {
if(!sr1.getStudent().sameStudents(sr2.getStudent())) { // Student
return false; }
else if(sr1.getDepartment() != sr2.getDepartment()) { // Department
return false; }
else if(sr1.getDegreeSought(... |
e4032518-2e7a-4dd0-9856-fa84146e346f | 3 | public static void main(String[] args) {
Class<?> demo = null;
try {
System.out.println(new Instance().new Person().getClass().getName()); //内部类的实例化
demo = Class.forName("Reflect.Instance$Person"); //内部类的类路径
} catch (Exception e) {
e.printStackTrace();
}
// 取得全部的构造函数
Constructor<?>... |
321bcc74-8808-4941-b3d8-7c50b075b9d1 | 3 | private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
if(txtBuscar.getText().equals("")){
cargarDatos();
}else{
if (rbCodigo.isSelected()) {
buscarPorCodigo(txtBuscar.getText());
} else if ... |
ecffecb3-8269-47f5-80a5-4c98d3dc25bd | 9 | private void flipY(WritableRaster raster) {
int minX = raster.getMinX();
int minY = raster.getMinY();
int height = raster.getHeight();
int width = raster.getWidth();
int maxY = minY + height - 1; // Inclusive
int numBands = raster.getNumBands();
switch (raster.ge... |
0c0ee92c-c654-4594-a8ec-c88e289865ec | 4 | public void storePlayersList(Player[] players){
Writer writer = null;
// хочу сделать проверку "если файл не пустой, то можно звписывать, в противном случае удалить все данные и записывать" - как это реализовать?
/* проверку, что файл не пустой можно сделать так */
File file = new File(playersListFile);
if(fi... |
e33e140a-761f-4316-8e14-daa66c90c04c | 9 | private boolean hasSameNameAndNamespace(MarkupItem node1, MarkupItem node2) {
String n1 = node1.hasGeneralIdentifier();
String n2 = node2.hasGeneralIdentifier();
URI u1 = node1.hasNamespace();
URI u2 = node2.hasNamespace();
return ((n1 == null && n2 == null) || (n1 != null && n2 != null && n1.equals(n2))) ... |
90af7079-afdf-4735-829a-7aa0c1a87e3b | 7 | * @param val the value
* @throws NullPointerException if <tt>key</tt> is <tt>null</tt>
*/
public void put(Key key, Value val) {
if (key == null) throw new NullPointerException("called put() with null key");
//if (val == null) return delete(key); // restore this once delete is implemented.
Node a... |
d27a8a21-33a0-4497-ad9e-71e62290d30d | 1 | private void createSaveData(){
try{
File file = new File(saveDataPath, fileName);
FileWriter output = new FileWriter(file);
BufferedWriter writer = new BufferedWriter(output);
writer.write(""+ 0);
writer.close();
}
catch(Exception e){
e.printStackTrace();
}
} |
bf8ed8e2-c49d-4e41-a4d9-735f4e259992 | 2 | public void equiposConfirmados(){
equiposConfirmados= true;
for(Inscripcion inscripcion: equipo1){
inscripcion.getJugador().aumentarCantidadPartidosJugados();
}
for(Inscripcion inscripcion: equipo2){
inscripcion.getJugador().aumentarCantidadPartidosJugados();
}
} |
f6be2a36-c750-4792-b996-c246afd92e43 | 6 | public void gameRender(ScreenManager screenmanager, ClientStreamReader reciever, ObjectOutputStream sendStream) {
sm = screenmanager;
recieveDataHandler = reciever;
sender = sendStream;
init();
while(running){
Graphics2D g = sm.getGraphics();
try{
networkTransmit();
}catch(Exception e){
S... |
e767ae74-03fe-4173-8242-52cc764e97d3 | 0 | public static void check(Logic logic) {
long pre = System.nanoTime();
logic.doIt();
long post = System.nanoTime();
NumberFormat nf = NumberFormat.getNumberInstance();
System.out.println("[" + nf.format((post - pre)/1000) + "] μ sec" );
} |
c0431de9-2831-41bc-b6ec-8085c34b72e4 | 2 | public void testPropertyCompareToMonthOfYear() {
DateTime test1 = new DateTime(TEST_TIME1);
DateTime test2 = new DateTime(TEST_TIME2);
assertEquals(true, test1.monthOfYear().compareTo(test2) < 0);
assertEquals(true, test2.monthOfYear().compareTo(test1) > 0);
assertEquals(true, te... |
77bdeab8-19b1-4a1e-8b34-850c76235d26 | 0 | public void setPcaPosId(Integer pcaPosId) {
this.pcaPosId = pcaPosId;
} |
70515b3b-a93e-480a-aed2-6b0899133241 | 1 | public MonitorAction enableForce(Boolean value) throws Exception {
init();
db.updateForce(value ? 1 : 0);
return this;
} |
b61a5eab-5cf2-4bf2-9181-3cb00db36fde | 1 | public void test_appendFixedSignedDecimal() {
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder();
bld.appendFixedSignedDecimal(DateTimeFieldType.year(), 4);
DateTimeFormatter f = bld.toFormatter();
assertEquals("2007", f.print(new DateTime("2007-01-01")));
assertEqual... |
17e151dd-c5ef-448e-b6fa-16ac7eeb5fb1 | 7 | public static void main(String[] args){
for(int a = 0; a < 997; a++){
for(int b = 0; b < 998; b++){
for(int c = 0; c < 998; c++){
if((a+b+c) == 1000 && a<b && b < c && ((a*a)+(b*b)==(c*c))){
System.out.println(a*b*c);
}
}
}
}
} |
322d3404-7663-4ab7-91c6-e4cec19d2672 | 4 | public FieldNode field(MemberRef ref) {
for (ClassNode c : classes()) {
if (ref.declaringClass().equals(Type.getType("L" + c.name() + ";"))) {
for (FieldNode f : c.fields()) {
if (ref.nameAndType().equals(f.editor.nameAndType())) {
return f;
}
}
}
}
return null;
} |
85798d80-8ea7-4b53-bf40-14f06076d99a | 2 | public void addPlayer(Player player) {
for(int i = 0; i < this.players.size(); i++) {
Player p = this.players.get(i);
if(p == null) {
player.setPlayerIndex(i);
players.set(i, player);
break;
}
}
} |
3014e258-7d58-4cfd-aee3-e0612769b468 | 5 | private void check_aauth(WebauthRequest request, WebauthResponse response)
throws WebauthException {
Collection<String> aauth = request.getColl("aauth");
if (aauth == null || aauth.isEmpty())
return;
String auth = response.get("auth");
Collection<String> sso = response.getColl("sso");
for (String nex... |
efcbe97f-8213-4f6a-aa8c-f27278f0b819 | 5 | public void mouseDragged(MouseEvent me)
{
Point newMouse = me.getPoint();
// compute the angle of rotation in relation with the size of the canvas
float thetaX = (float) ((newMouse.getX() - prevMouse.getX())*(Math.PI/this.getSize().width));
float thetaY = (float) ((newMouse.... |
60cda10e-7241-4c65-95b6-b0c7400d9d5b | 9 | private static void preHandle(String source){
Map<String, Integer> define = new HashMap<String, Integer>();
BufferedReader in;
BufferedWriter out;
ArrayList<String> list = new ArrayList<String>(10);
try{
in = new BufferedReader(new FileReader(new File(source)));
out = new BufferedWriter(new FileWr... |
35144746-9783-4534-8af7-268ccaf86e28 | 8 | @Override
public void actionPerformed(ActionEvent e)
{
int returnVal = fFileChooser.showOpenDialog((Component) e.getSource());
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = fFileChooser.getSelectedFile();
if (file != null)
{
MapLoader mapLoader = new MapLoader();
ConfigLoader co... |
a3dd43b8-354c-448c-b61b-b70c59e01505 | 3 | @Override
protected Void doInBackground() throws Exception {
try {
String str = ArchiveClassLoader.getText(Configuration.composeres() + Configuration.vesrionfile);
String[] strargs = str.split(",");
Configuration.remote_major = Integer.parseInt(strargs[0]);
Configuration.remote_minor = Integer.pars... |
0b3882a3-cbf0-4a75-a29d-1eeb936accef | 2 | private static Punto corrector(double epsilon, Punto pkMasUno, Punto pk, Punto pkUno, Punto pkDos, Punto pKTres,
double h, Funcion fun) {
int cantIter = 11;
//recalcula el punto utilizando adams moulton
Punto moulton = adamsMoulton(h, pkMasUno.getX(), pkMasUno.getY(),... |
3d15cba3-9653-4eb1-8895-ccd205fc3d72 | 4 | private void populateFromList(List<String> letters) {
if ( letters.size() != GRID_SIZE * GRID_SIZE ){
throw new IllegalArgumentException("");
}
for (int i = 0; i < GRID_SIZE; i++ )
{
for ( int j = 0; j < GRID_SIZE; j++)
{
String character = letters.get((i * GRID_SIZE ) + j ).toLowerCase();
grid... |
dd35c5d6-cde4-423a-9380-9b0e7effa82a | 0 | public Mc_PlayerCommands(AprilonIrc plugin){ Parent = plugin; } |
14c75068-5919-426b-a9a0-6787e5eff1d0 | 3 | public static void togglePlayersFactionsChannel( String player, Boolean inFaction ) throws SQLException {
BSPlayer p = PlayerManager.getPlayer( player );
String channel = p.getChannel();
String newchannel;
if ( !inFaction ) {
p.sendMessage( Messages.FACTION_NONE );
... |
24d75fea-be87-458f-959b-03a163f44f63 | 3 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFlavor.stri... |
cd8967bf-80d5-4bd1-965c-95adf689e912 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-... |
b4ad465c-0ecd-47a5-b4a7-3b9cd743dfe9 | 5 | protected Boardable location(Target t) {
if (t instanceof Boardable && t != mobile) return (Boardable) t ;
if (t instanceof Mobile) {
final Mobile a = (Mobile) t ;
if (a.aboard() != null) return a.aboard() ;
return a.origin() ;
}
if (t instanceof Element) {
return Spacing.nearest... |
7ac9cb6a-81de-47cf-81cc-40ff7b64d526 | 3 | public static BufferedImage combine2Images(BufferedImage imageLeft, BufferedImage imageRight) {
Logger.getLogger(ImageReader.class.getName()).entering(ImageReader.class.getName(), "combine2Images", new Object[] {imageLeft, imageRight});
if (imageLeft == null || imageRight == null) {
Logger.g... |
031d29d1-75ff-48e3-921d-4e3f7e3c0724 | 4 | @Override
public void click(int mouseX, int mouseY, int dX, int dY) {
if (mouseX >= dX && mouseX < dX + 150 &&
mouseY >= dY && mouseY < dY + 150) {
_linesGame.newGame();
}
} |
9d20ac31-0f23-4732-868d-0a6b9aaaa2aa | 3 | public boolean collided(Pinball pinball)
{
for (int i = Constants.toInt(pinball.position.getX() - pinball.getRadius());
i < pinball.position.getX() + pinball.getRadius();
i++)
{
for (int j = Constants.toInt(pinball.position.getY() - pinball.getRadius());
... |
799f5553-3ced-4ca7-bd17-f00b25405293 | 9 | public static String toPinYinStr(String str) {
String pystr = "";
String[] t = new String[str.length()];
char[] hanzi = new char[str.length()];
for (int i = 0; i < str.length(); i++) {
hanzi[i] = str.charAt(i);
}
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
format.setCaseType(Hanyu... |
87ce1ea5-a3ef-4ef1-95b7-c877efcccdfc | 4 | private int search(TreeNode root, String query, int d, int length){
if(root == null)
return length;
if(root.value != null)
length = d;
if(d == query.length())
return length;
char c = query.charAt(d);
if(root.children.containsKey(c)){
return search(root.children.get(c), query, d + 1, length);
... |
bb93331b-eb4a-400a-b314-8ed99fc15720 | 4 | public void runSend(){
DataOutputStream outputStream;
try {
outputStream = new DataOutputStream(socket.getOutputStream());
} catch (IOException e) {
LOG.severe("Could not get outputStream! " + e.getMessage());
return;
}
while(!Thread.interrupte... |
980f6d83-b732-43cf-a6e8-67d210df3faa | 3 | public void unbind(boolean force) {
if (!force) {
// Cancel all outgoing requests, and send a NOT_INTERESTED message to
// the peer.
this.cancelPendingRequests();
this.send(Message.NotInterestedMessage.craft());
}
synchronized (this.exchangeLock) {
if (this.exchange != null) {
if (force) {
... |
49de87b7-e8ec-43a2-a744-f9c8f415d6a6 | 3 | private void listPlans(Player player) {
if (!player.hasPermission("buildingplanner.list")) {
player.sendMessage("You do not have permission to list plan areas");
return;
}
List<PlanArea> planList = BuildingPlanner.plugin.areaManager.getPlanList();
if (planList.size() == 0) {
player.sendMessage("The... |
814ffc61-3e66-478e-a625-0b9cd050a8d6 | 1 | public String Apagar() {
String r = "";
if (dao.Apagar(entidade)) {
r = "listagemPessoa.xhtml";
return r;
} else {
return r;
}
} |
05793ab3-8200-4566-b3b8-b645116a6930 | 5 | public static EnumCollisionSide testCollisionBetweenQuads(Vector2D objPos, Vector2D obj1Pos, Quad objCollideMesh, Quad obj1CollideMesh){
float x = (float) (objPos.getX() + objCollideMesh.quadX);
float y = (float) (objPos.getY() + objCollideMesh.quadY);
float x1 = (float) (obj1Pos.getX() + obj1C... |
085699a1-2559-4194-90c8-f7269c26519d | 4 | public boolean CheckLigneId(Position pos, int n,int id)
{
int x=pos.x;
int y=pos.y;
int y_end=y + n;
while(y <= largeur && y< y_end && etatPlateau[x-1][y-1] == id)
{
y++;
}
if(y == y_end )
{
return true;
}
else... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.