method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
721e0872-017b-40d6-bd91-6377f38dde4c | 2 | public Menu_seleccion(ArrayList<Guerrero> array,int desp,Juego juego) {
initComponents();
ImageIcon iconLogo = new ImageIcon(IMG.getImage("menu_soldados.png"));
jLabel1.setIcon(iconLogo);
ImageIcon iconLogo2 = new ImageIcon(IMG.getImage("Label_nombre.png"));
int x=60;
int... |
fcae4b1b-9ed3-41b9-9bc7-5550612a5a6f | 0 | public static void main(String[] args) {
final int A = 1234;
final int B = 9876;
System.out.println("A = " + Integer.toBinaryString(A));
System.out.println("B = " + Integer.toBinaryString(B));
System.out.println("A & B = " + Integer.toBinaryString(A & B));
System.out.prin... |
681dce28-56ff-4526-91f0-c564554a2a47 | 1 | @Override
public String toString() {
StringBuilder builder = new StringBuilder();
try {
XIO.write( this, builder );
}
catch( IOException e ) {
throw new XException( e );
}
return builder.toString();
} |
f58061ae-449c-4c27-bf9b-e45cc5104612 | 0 | public Board(City_Graph city_graph){
this.city_graph = city_graph;
// set Variables
boardOffset = 200;
citySquareSize = 40;
neutralColor = new Color(190,190,190);
romColor = new Color(210, 20, 20);
cathargoColor = new Color(20, 20, 210);
// init jframe
jframe = new JFrame("test");
jf... |
4ab23c04-6105-472a-8788-07fefc5fa185 | 1 | public Builder id(int receivedId) {
if (receivedId < 0) {
log.warn("Wrong ID. receivedId ={}", id);
throw new IllegalArgumentException("Id must be integer value more than 0. Received value =" + receivedId);
}
this.id = receivedId;
return th... |
1834a8ff-4e37-48e6-b05d-96aadd71c53d | 7 | public boolean containsFieldAliasDirectly(String fieldName, String typeSig,
IdentifierMatcher matcher) {
for (Iterator i = fieldIdents.iterator(); i.hasNext();) {
Identifier ident = (Identifier) i.next();
if (((Main.stripping & Main.STRIP_UNREACH) == 0 || ident
.isReachable())
&& ident.wasAliased()... |
43c72e60-156c-408c-81b1-f91d16845cdb | 4 | public void mouseClicked(MouseEvent e) {
if( e.getX() >= 5 && e.getX() <= 45 && e.getY() >= 5 && e.getY() <= 45){
this.mainFrame.backToMenu();
}
} |
9ab6a5f2-2ccd-4fe1-8ece-2cc90aa1dccc | 1 | public static int abs(int num, int n)
{
/**
* This method had to simple cases, either the number was negative or positive. I created a mask of the correct bit
* length to test if the number was negative. If it was positive I would just return the number given. If it was negative
* I did a simple negation, a... |
59d920d0-fb0d-4e55-90cb-270bb05135c6 | 4 | public void getVal() {
try {
//System.err.println("DBThread Runs");
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/cdr_data?user=root&password=root");
preparedStatement = connect.prepareStatement("select ID_CD... |
812b696d-2a03-4f10-acf7-c9218cb7195d | 5 | public boolean compare(String file1, String file2, String type) {
// Check if both the files are present
if(!CompareFiles.checkIfFileExists(file1) || !CompareFiles.checkIfFileExists(file2)) {
if(!CompareFiles.checkIfFileExists(file1))
System.out.println(file1+" does not exist");
if(!CompareFiles.checkIfFi... |
b58acac4-040f-4266-821f-691cf51876ae | 0 | public MyByteArrayInputStream(byte[] b) {
this.data = b;
} |
901d22ab-b8c4-4f8b-93d6-8a1c574c323e | 9 | private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed
if (lab_modo.getText().equals("Alta")){
if (camposCompletos()){
ocultar_Msj();
insertar();
menuDisponible(true);
... |
ef1c9e6b-63b7-427a-8db2-ce1c01311c16 | 0 | @Column(name = "PRP_MOA_CONSEC")
@Id
public int getPrpMoaConsec() {
return prpMoaConsec;
} |
8cc72ee0-b155-46bb-8cfa-7877ab61cae8 | 5 | public boolean matches(Dependency dependency) {
return groupRule.match(dependency.getGroupId())
&& artifactRule.match(dependency.getArtifactId())
&& typeRule.match(dependency.getType())
&& versionRule.match(dependency.getVersion())
&& scopeRule.ma... |
41d5e6be-ccc7-4674-a34e-743965082da5 | 9 | static private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpo... |
709a81b0-cd8f-4552-9ece-399821f67163 | 3 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
days = buf.readShort();
if (days < 0)
throw new RuntimeException("Forbidden value on days = " + days + ", it doesn't respect the following condition : days < 0");
hours = buf.readShort();
if (... |
59196c88-c950-460a-b259-ae3f21ea9d44 | 6 | private JPanel constructBreakpointPanel() {
JPanel mainPanel = new JPanel();
mainPanel.setBorder(new TitledBorder("Breakpoints"));
mainPanel.setLayout(new GridLayout(1,2));
try {
JPanel panel = new JPanel();
mainPanel.add(panel);
panel.setBorder(new T... |
f409742d-d0eb-40a2-ad4d-e465498942f2 | 0 | @Test
public void twentyInchesIsBetterThanOneFoot(){
ArithmeticQuantity twenty_inch = new ArithmeticQuantity(20, Distance.INCHES);
ArithmeticQuantity one_foot = new ArithmeticQuantity(1, Distance.FEET);
assertTrue(twenty_inch.isBetter(one_foot));
assertTrue(!one_foot.isBetter(twenty... |
b2231a6d-c2d1-41e0-bb29-5344675469fe | 4 | public void handleClass(String clName) {
int i = 0;
while (i < clName.length() && clName.charAt(i) == '[')
i++;
if (i < clName.length() && clName.charAt(i) == 'L') {
clName = clName.substring(i + 1, clName.length() - 1);
Main.getClassBundle().reachableClass(clName);
}
} |
56bfbf7e-3b52-464b-b9a8-17ad495c4ecb | 1 | private void insertCast(BinExpr expr, int type1, int type2)
throws CompileError
{
if (CodeGen.rightIsStrong(type1, type2))
expr.setLeft(new CastExpr(type2, 0, expr.oprand1()));
else
exprType = type1;
} |
240d9cc3-68ba-459b-b7ae-85509d0d4c63 | 2 | private boolean topRightCorner(int particle, int cubeRoot) {
for(int i = 1; i <= cubeRoot; i++){
if(particle == i * cubeRoot * cubeRoot - 1){
return true;
}
}
return false;
} |
8a69b761-9d66-4643-9bb0-c0dbd71086eb | 4 | private void init()
{
try
{
Boolean append = true; // append messages to the log file -> default yes
path = new Control_GetPath().getStreamRipStarPath() + "/output.log";
//delete here the log file first, if it has a large size
File logFile = new File(path);
//if its larger then ~0.5MB, o... |
225e332e-e8b3-4505-a81f-54b24567f1dc | 2 | public OperatoerDTO getOperatoer(int oprId) throws DALException {
ResultSet rs = Connector.doQuery("SELECT * FROM operatoer WHERE opr_id = " + oprId);
try {
if (!rs.first()) throw new DALException("Operatoeren " + oprId + " findes ikke");
return new OperatoerDTO (rs.getInt(1), rs.getString(2), rs.get... |
9827e30d-b29f-42e6-82e0-eeac0d51163a | 4 | public static Reference getReference(String className, String name,
String type) {
int hash = className.hashCode() ^ name.hashCode() ^ type.hashCode();
Iterator iter = unifier.iterateHashCode(hash);
while (iter.hasNext()) {
Reference ref = (Reference) iter.next();
if (ref.clazz.equals(className) && ref.n... |
34f37627-0293-4cad-9bf0-67b5d52d2937 | 6 | @Override
public int compareTo(final ArraySection<GArray> section) {
final GArray array1 = this.array(), array2 = section.array();
int startIndex1 = this.startIndex();
int startIndex2 = section.startIndex();
final int finalIndex1 = this.finalIndex();
final int finalIndex2 = section.finalIndex();
final int ... |
4f6130ed-024d-4aad-9e0e-cd6a4648d67b | 6 | public void doMotion() {
if( (xSpeed < 0.05) && (xSpeed > -0.05) ) { xSpeed = 0; };
if( (ySpeed < 0.05) && (ySpeed > -0.05) ) { ySpeed = 0; };
if( (zSpeed < 0.05) && (zSpeed > -0.05) ) { zSpeed = 0; };
x += xSpeed;
y += ySpeed;
z += zSpeed;
zoom += zoomSpeed;
} |
2fecdf36-9733-49be-a0fd-06a2a15adbf1 | 3 | public void updateTripList () {
if (tripListModel == null)
return;
tripListModel.removeAllElements();
for (Trip t : MainWindow.tripDB.getAllTrips (targetDay.getTime()))
tripListModel.addElement (new TripComponent (t));
tfRoster.setText(MainWindow.tripDB.getRosterCount(targetDay.getTime()) + "/" + avai... |
eb431b8b-5fff-4d5d-a80b-b78caf31a756 | 2 | private static Set<String> permutate(Set<String> digits){
if (digits.size()==1) return digits;
Set<String> set = new HashSet<String>();
Set<String> newDigits = new HashSet<String>();
newDigits.addAll(digits);
for(String n : digits){
newDigits.remove(n);
// System.out.println(newDigits.size());
addAll(... |
5843af6b-d2cc-45e4-b441-b3bc3ee84556 | 0 | public void setRegip(String regip) {
this.regip = regip;
} |
2a96fdc5-5486-4ca1-822e-ea16fafd935e | 3 | public Music() {
Debug.println("Music.Music()");
paused = false;
AudioInputStream as = null;
URL MUSIC = getClass().getClassLoader().getResource("Sounds/music.wav");
try {
as = AudioSystem.getAudioInputStream(MUSIC);
} catch (UnsupportedAudioFileException e) {
e.printStac... |
b42eadc6-9678-4822-8be3-164af89501a3 | 2 | public CustomButton(int x, int y, int width, int height)
{
//Construct the button
super();
setBounds(x, y, width, height);
//Set all the visibility to false, besides the text
this.setBorder(null);
setBorderPainted(false);
setOpaque(true);
setContentAreaFilled(false);
this.setFocusPainted(false);
//... |
62dbfafc-7382-4f65-8caf-000747285217 | 5 | public void initFilter(boolean g) {
sun = new DirectionalLight();
sun.setDirection(new Vector3f(1f, -1, 0f).normalizeLocal());
sun.setColor(new ColorRGBA(1f, 0.96f, 0.91f, 1f).mult(0.1f));
if(g) rootNode.addLight(sun);
sun1 = new DirectionalLight();
sun1.setDirectio... |
ab90f088-b0ec-4ff1-8872-aa5d9b28d746 | 3 | private void firtsFase() {
while (y < start.HEIGHT*80/100) {
time = (1000 / start.FPS) - (System.currentTimeMillis() - time);
if (time > 0) {
try {
down();
Thread.sleep(200);
} catch (Exception e) {
}
}
}
} |
9f184770-d47a-44e7-ac71-b2bdc052365a | 8 | private float readFloat()
{
switch ( type )
{
case MatDataTypes.miUINT8:
return (float)( buf.get() & 0xFF);
case MatDataTypes.miINT8:
return (float) buf.get();
case MatDataTypes.miUINT16:
return (float)( buf.getShort... |
9edd3428-8aea-40b9-beaa-6cf35ccdfb12 | 6 | public boolean dealerHit() {
if (this.hand.totalvalues()[0] < 17 && this.hand.totalvalues()[0] == this.hand.totalvalues()[1]) {
return true;
} else if (this.hand.totalvalues()[0] <= 17 && this.hand.totalvalues()[0] != this.hand.totalvalues()[1]) {
return true;
} else if (this.hand.totalvalues()[1] < 17 && t... |
f3b501d4-5622-4173-b8a2-67267edc3dac | 4 | private static void setLookAndFeel() {
try {
OUTER:
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//System.out.println(info.getName());
switch (info.getName()) {
case "Windows":
... |
7924906a-b5f7-4e89-8038-d55abd29a7a2 | 5 | public static List<GroupDetailInfo> getGroupsByUser(int userId)
throws HibernateException {
List<GroupDetailInfo> userGroupsList = null;
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
try {
// Begin unit of work
session.beginTransaction();
String hqlString = "select distinct... |
f8dec326-075d-4dc9-ad19-1c8826108b23 | 4 | public static void deleteDirectory(Path directory) throws IOException {
if (!FileUtil.controlDirectory(directory)) {
return;
}
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttrib... |
0f1f4f93-7cb7-40fa-a04a-af7ab3033c3f | 2 | public void revertAndAppend(char c) {
if (c != '0' && c != '1') {
throw new IllegalArgumentException("Argument must be '0' or '1'");
}
append(revert(c));
} |
6b4406de-ce2b-4218-b30f-a0ff91833e11 | 9 | public void refresh()
{
if(!hasBeenActivated)
return;
synchronized(mutex) {
//If any resize operations are in the queue, execute them
resizeScreenIfNeeded();
Map<TerminalPosition, ScreenCharacter> updateMap = new TreeMap<TerminalPosition, Scr... |
cfad89d9-bbee-4976-854d-b4eb0f6dd469 | 2 | public TestBoGenerator( Table table ) {
super( table );
this.daoName = "Test" + table.getDomName() + "Bo";
filePath = "src/test/java/" + packageToPath() + "/bo/" + daoName
+ ".java";
for ( Column column : table.getColumns() ) {
if ( column.isKey() ) {
... |
b097e1e8-ce03-43f8-b96d-e7322315ffa1 | 0 | public CtrlVisiteur(CtrlPrincipal ctrlPrincipal) {
super(ctrlPrincipal);
vue = new VueVisiteur(this);
actualiser();
} |
844260eb-d059-47fc-a82f-e694a83d9355 | 4 | @Override
public void removeAllWorkSheets()
{
try
{
Object ob = mybook.getTabID().getTabIDs().get( 0 );
mybook.getTabID().getTabIDs().removeAllElements();
mybook.getTabID().getTabIDs().add( ob );
mybook.getTabID().updateRecord();
}
catch( Exception ex )
{
;
}
WorkSheetHandle[] ws = getWo... |
56f6d154-9952-4436-90a4-f6e6b7705ff5 | 5 | public static String velocityUnitIndexToString(int index) {
switch (index) {
case 0:
return "kph";
case 1:
return "mph";
case 2:
return "m/s";
case 3:
return "kn";
case 4:
... |
3ac44ac7-13eb-483d-9245-f0e0359b2dae | 6 | private void updateTrend() {
if (getSkinnable().isTrendVisible()) {
switch (getSkinnable().getTrend()) {
case UP:
trendUp.setOpacity(1);
trendRising.setOpacity(0);
trendSteady.setOpacity(0);
trendFalling.... |
547e25bc-4653-4a28-90fb-85f6106d9847 | 6 | private ViterbiNode parseImpl(CharSequence text) {
final int len = text.length();
final ArrayList<ArrayList<ViterbiNode>> nodesAry = new ArrayList<ArrayList<ViterbiNode>>(len+1);
final ArrayList<ViterbiNode> perResult = new ArrayList<ViterbiNode>();
nodesAry.add(BOS_NODES);
for(int i=1; i <= len; i++)
node... |
58b9fc8a-b5e9-4356-bf22-12ffd8104427 | 8 | public void debugPrint() {
System.out.println("---------- DEBUG PRINT ----------");
System.out.println("W - Worm");
System.out.println("b - Bacteria");
System.out.println(". - Empty slot");
System.out.println();
for (int y = 0; y < size_y; ++y) {
for (int x =... |
5d56e66e-a655-4223-bc89-8491ea95b43b | 5 | public void rafraichir() {
Color[] colors = Constantes.COLORS;
int colorInc = 0;
boutonChargerLivraisons.setEnabled(false);
boutonCalculerItineraire.setEnabled(false);
HashMap<Integer, Itineraire> itineraires = manager.getItineraires();
Set<Map.Entry<Integer, Itineraire>> set = itineraires.entrySet();
f... |
a4dc3133-bb7b-4263-9d68-e96094e1acf5 | 6 | private boolean checkSideCollision(Hitbox prospective, Cell[][] tiles){
int prospectiveY = prospective.getY()/Cell.CELL_HEIGHT;
if (prospectiveY > 0 && prospectiveY < tiles.length){
for(int i = 0; i < tiles[0].length; i++){
if(tiles[prospectiveY][i] != null && tiles[prospectiveY][i].getHitbox() != null && pr... |
aa283e10-83a9-4efc-afcc-81de2d8b760c | 4 | private void validate() throws IOException, NullPointerException {
if(IndexConfig.statLoc == null )
throw new NullPointerException();
statFolder = new File(IndexConfig.statLoc);
if( statFolder.isDirectory() ) {
System.err.println("Directory at STAT_LOC already exists, ... |
39c973c4-36f2-4427-8456-3849b59bb649 | 6 | @Override
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
switch (cmd.charAt(0)) {
case '1': // Send button
main.questionG(getInput());
chat.setCaretPosition(chat.getDocument().getLength());
... |
c722be3c-0ce1-40ab-a6b6-d8785fb46bbb | 3 | public void testCompareTo() {
MonthDay test1 = new MonthDay(6, 6);
MonthDay test1a = new MonthDay(6, 6);
assertEquals(0, test1.compareTo(test1a));
assertEquals(0, test1a.compareTo(test1));
assertEquals(0, test1.compareTo(test1));
assertEquals(0, test1a.compareTo(test1a));... |
04076fc6-9468-4c12-9394-7b1336b0cfe0 | 9 | public void undoMove(CheckersMove move, Player turn) {
int x1 = move.start.x; int x2 = move.destination.x; int y1 = move.start.y; int y2 = move.destination.y; CheckersPiece captured = move.captured;
CheckersPiece moved = array[x2][y2];
array[x2][y2] = null;
array[x1][y1] = moved;
array[x1][y1].move(new BoardS... |
90ad42c2-622e-46e2-9f9c-84e798ed0c4b | 3 | @Override
public void render(GameContainer gc, StateBasedGame sbg, Graphics g)
throws SlickException{
if(setWidth){
width=gc.getWidth();
height=gc.getHeight();
MenuManager.initClick(sbg, width, height);
setWidth=false;
}
if(MenuManager.getMenuType()==0)
MenuManager.menuSelect(gc,sbg,g);
else ... |
08f23853-b4f8-46eb-b7ab-f7a07a747d97 | 5 | private void qSortBase(int array[], int left, int right){
if(left>=right)
return;
int l = left, r = right;
int pivot = array[r];
do{
while(array[l]<pivot)
l++;
while(pivot<array[r])
r--;
if(l<=r)... |
f36917dd-de9e-4330-8baf-1ca4209045a4 | 3 | public void startApp() {
effect = new EnergyCalculation();
InputStream is = getClass().getResourceAsStream(fileName);
try {
E = effect.calcEnergy(is, 0, 3000);
is.close();
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.... |
f764c45f-65b6-413f-a5c5-c091cb25d2bc | 1 | public boolean isValid() {
int sum = 0;
for(int i = digits.length; i > 0; i--){
int coeff = digits.length - i+1;
sum += (digits[i-1]*coeff);
}
return sum%11 == 0;
} |
ddf6797c-4210-48c4-b364-ce77d6b16df9 | 4 | private DataPacket ProcessDataPacket(DataPacket dpkt) {
DataPacket retval = null;
if (dpkt.UltimateDestination == this.MeZone) {
// data found me! stop doing everything and eat the data!
this.MyColor = new Color(0.0f, 1.0f, 0.0f);// bright green
return retval;
}
int FirstZoneDex = dpkt... |
611600bb-fe36-4a0d-85a4-cadc2552373a | 3 | public static String sendHttpGet(String url, Header[] headers) {
// initializes new HTTP client and GET request
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(url);
// sets content type
httpGet.setHeaders(headers);
// sends HTTP GET request
CloseableHttpRespo... |
76fa8578-ffd8-41c1-99bc-29d4a30d602b | 2 | public static List<? extends Chewable> printSize(
List<? extends Chewable> list) { // Line 10
System.out.println(list.size());
return list;
} |
d6cf335b-ea0e-416f-8f25-e048e314da2a | 7 | private WSResponse addFSQData(WSResponse response, FSQData fsqData) {
if(fsqData!=null){
if(fsqData.getEvents()!=null && fsqData.getEvents().size()>0){
for (FSQEvent fsq : fsqData.getEvents()) {
Events event=new Events();
event.setMessage(fsq.getMessage());
event.setMood(fsq.getMood().getType())... |
341a1ebe-fb43-4c6a-8419-401faccb2852 | 7 | public void testDirectInstantiation() throws Exception {
File path = new File(System.getProperty("tempDir"));
int sz = 3;
Directory[] dirs = new Directory[sz];
dirs[0] = new SimpleFSDirectory(path, null);
dirs[1] = new NIOFSDirectory(path, null);
dirs[2] = new MMapDirectory(path, null);
f... |
2585306f-236a-4525-8d6c-dd92e5b7bac2 | 5 | public void run() // Execution
{
try {
NetObjectReader input = new NetObjectReader(socket); //try create a reader with the socket
while (true){ //constant loop
String updatemsg = (String) input.get(); // create string from the reader.get
Scanner sc = new Scanner(up... |
bfb2512d-23c7-4450-9f0f-121d3b7239e1 | 1 | private void decq(int q) {
if (q < 0) {
this.quality = q;
hq = false;
} else {
int fl = (q & 0xff000000) >> 24;
this.quality = (q & 0xffffff);
hq = ((fl & 1) != 0);
}
} |
c8416094-346d-480a-b9bf-16d9d35c18a4 | 8 | public void repair(int count,Node n,Node badLink) throws ClassNotFoundException, IOException{
Node neighborL = new Node();
Node neighborR = new Node();
if( count !=0 && n.links.get(count -1) !=null){
neighborL = save.read(n.links.get(count -1));
}
if(count+1 < n.links.size() && count+1 != n.links.size(... |
ce60bfe7-dcc2-4297-98b0-d40cab832b4a | 9 | public static int numDistinct(String S, String T) {
int slen = S.length();
int tlen = T.length();
if (slen < tlen) return 0;
int[][] num = new int[slen][tlen];
for (int i = 0; i < slen; i++) {
for (int j = 0; j < tlen; j++) {
if (i < j) num[i][j] = 0;
else if... |
315468a8-05b9-41cb-b4e2-1c9d57240706 | 5 | public void randomize() {
Random r = new Random();
Piece[][] temp = new Piece[8][8];
for (int i = 0; i < temp.length; i++) {
for (int j = 0; j < temp.length; j++) {
temp[i][j] = null;
}
}
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr.length; j++) {
int a = r.nextInt(8);
i... |
bd510647-4b1b-4082-8d77-b4556aadde0e | 3 | private boolean isClassEntry(final ZipEntry ze) {
String name = ze.getName();
return inRepresentation == SINGLE_XML && name.equals(SINGLE_XML_NAME)
|| name.endsWith(".class") || name.endsWith(".class.xml");
} |
444065d8-6c2b-4e91-ae4d-0d302d68bb8a | 4 | public int compareTo(Comp o) {
if (value != o.value) {
return value < o.value ? 1 : -1;
}
int res = Long.valueOf(count).compareTo((long) o.count);
if (res == 0) {
res = Integer.valueOf(key.getRank()).compareTo(o.key.getRank());
... |
8e27436e-9c1f-4a1d-ae9f-1522f9871310 | 5 | public static void bringPlayer(Player player, String playerName,
String teleportPlayerName) {
if (player == null) {
StefsAPI.MessageHandler.buildMessage().addSender("$")
.setMessage("error.onlyIngame", AdminEye.messages).build();
return;
}
ArrayList<Player> teleportPlayers = AdminEyeUtils
.req... |
93388245-91eb-468d-a708-d6919e1c3aba | 7 | public static void addByChance(LivingEntity entity, MobAbilityConfig ma)
{
if (entity == null || ma == null)
return;
if (isValid(entity) && ma.babyRate <= 1.0F && ma.babyRate != 0.0F)
{
// If the random number is higher than the baby chance we don't turn the mob into a baby
if (ma.babyRate == 1.0F ||... |
c8b3855a-13f8-4045-9348-736b05040fcb | 8 | public MapObject doNextDeathSpinAction(MapEngine engine, double s_elapsed) {
if (!death_spin_started) {
death_spin_started = true;
death_spin_direction = direction;
death_spin_time_left = DEATH_SPIN_TIME;
move_speed /= DEATH_SPIN_MOVE_SPEED_DIVISOR;
death_spin_delta_direction = turn_sp... |
e25da6f2-16f3-4aa5-9014-967178a05734 | 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... |
7760576b-f4ea-41bf-abab-11c63ef5885b | 3 | protected void thinkOfNewTask()
{
//System.out.println(getName() + " is thinking of a new task to do.");
String desiredTask = "reproduce";
//"wear a backpack" is not programmed yet
//if(getBackpack() == null) {desiredTask = "wear a backpack";}
if(getHealth() < 1) //CHANGE ... |
6eb403a6-08fb-419a-998b-b878c504867c | 3 | public void setFlowBlock(FlowBlock flowBlock) {
if (this.flowBlock != flowBlock) {
this.flowBlock = flowBlock;
StructuredBlock[] subs = getSubBlocks();
for (int i = 0; i < subs.length; i++) {
if (subs[i] != null)
subs[i].setFlowBlock(flowBlock);
}
}
} |
ac08057d-3e8b-42f2-9e86-c9ec51559252 | 3 | public void setRelativeMouseMode(boolean mode) {
if (mode == isRelativeMouseMode()) {
return;
}
if (mode) {
try {
robot = new Robot();
recenterMouse();
}
catch (AWTException ex) {
// couldn't create ... |
5d1f7fe1-246a-4bd1-b118-4a290128ccfc | 9 | @SuppressWarnings("unchecked")
public Map<String, Object> readDaily(String file) {
Map<String, Object> result = new LinkedHashMap<String, Object>();
try{
// Open the file
FileInputStream fstream = new FileInputStream(file);
// Get the object of DataInputStream
... |
bb213ea1-3e8b-4cd8-b1e2-0aa4cfcbab6d | 2 | static void copy(InputStream in, OutputStream out) throws IOException {
while (true) {
int c = in.read();
if (c == -1) break;
out.write((char)c);
}
} |
304d4e40-9bcd-4c5e-bc16-3fc79be007b6 | 7 | private void resetQuest(int reason)
{
if(text().length()>0)
{
Quest theQ=null;
for(int q=0;q<CMLib.quests().numQuests();q++)
{
final Quest Q=CMLib.quests().fetchQuest(q);
if((Q!=null)&&(""+Q).equals(text()))
{
theQ=Q;
break;
}
}
if((theQ==null)||(!theQ.running()))
affec... |
c78e129b-5732-4963-971b-36aa46239ecd | 3 | public boolean within(final int chunkX, final int chunkZ) {
return chunkX >= this.minChunkX && chunkX <= this.maxChunkX && chunkZ >= this.minChunkZ && chunkZ <= this.maxChunkZ;
} |
3caa207a-cd5f-4bfd-b0c0-a56dd6a35d34 | 8 | public String vypisAuto(int i, Auto auto){
String str = "Auto "+ i +"\n";
double potrebaNaloz = 0;
for(int k = 0; k < auto.getUdalost().size(); k++){
potrebaNaloz += auto.getUdalost().get(k).getDobaNakl();
}
/*System.out.println(potrebaNaloz);*/
str += "Potreba nalozit: " + (1000.0 / 30.0)*p... |
a070319f-56dc-4b9b-96e3-743336cf5c96 | 0 | public JSeparator getjSeparator1() {
return jSeparatorTitre;
} |
230f4559-3fd2-4856-88a9-623987d1deb2 | 3 | private static void getCollection() {
try {
Mongo mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("paldb");
boolean auth = db.authenticate("pal", "admin123".toCharArray());
logger.debug("authenticated: " + auth);
Set<String> collections = db.getCollectionNames();
for (String collection... |
a628b2bf-5ad3-47ff-8167-e69dd99e0028 | 5 | public BufferedImage use(BufferedImage src, Vector<SOMVector> inputVectors) {
BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
SOMVector tempVec = null;
if (closestType) {
for (int i = 0; i < getWidth(); i++) {
for (int j = 0; j < getHeight(); j++) {... |
90a12246-a32a-4806-bd15-1d6c4bad8a11 | 1 | public WidgetStack(int width, int height, int size, int layers, int r, int c)
{
super();
//setCursor(PointingHandCursor);
row = r;
col = c;
layer = new WidgetHolder[layers];
setMinimumSize(width, height);
for (int i=0; i<layers; ++i) {
layer[i] = new WidgetHolder(this, width, height, null);
l... |
79262065-0861-4898-acb2-44cab768104d | 2 | public static String readFirstLine(InputStream inputStream){
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line = bufferedReader.readLine().trim();
return line;
} catch (FileNotFoundException e) {
e.pr... |
452acf4b-5e7a-454e-a8e8-dd19f69a37fa | 1 | public List<TransformType> getTransform() {
if (transform == null) {
transform = new ArrayList<TransformType>();
}
return this.transform;
} |
323b629e-3f11-4a22-a447-3f8ec6584c82 | 1 | public static boolean intToBoolean(int bool) {
if(bool == 0)
return false;
else
return true;
} |
37cd33a0-3676-40a2-a76a-14d50c6c450e | 0 | public void setPrpMoaTipo(BigInteger prpMoaTipo) {
this.prpMoaTipo = prpMoaTipo;
} |
4d8d53a0-639d-487c-be62-9b540aeb170e | 5 | public static void main(String[] args) {
char[] message = {79,59,12,2,79,35,8,28,20,2,3,68,8,9,68,45,0,12,9,67,68,4,
7,5,23,27,1,21,79,85,78,79,85,71,38,10,71,27,12,2,79,6,2,8,13,9,1,13,9,
8,68,19,7,1,71,56,11,21,11,68,6,3,22,2,14,0,30,79,1,31,6,23,19,10,0,73,
79,44,2,79,19,6... |
3a9c9a44-2b4e-4a1f-9e8b-9bb63b14f4b6 | 0 | public void setFeatures(List<Feature> features)
{
this.features = features;
} |
28b90d0c-1c25-400d-bc26-4f080ea51ede | 8 | void chequearTecla(KeyEvent evento) {
//jugador 1
if (evento.getKeyCode() == 38) {
System.out.println("Mover Arriba");
mover_arriba();
}
if (evento.getKeyCode() == 40) {
System.out.println("Mover Abajo");
mover_abajo();
}
i... |
b88fbac1-4414-49e4-9558-902246cc4753 | 0 | private void addActionListeners()
{
addBackground1btn.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent arg0) {
getPicturesPath(background1Field);
}
});
addBackground2btn.addActionListener(new ActionListener()
{
@Override
public void actionPer... |
284ac5f5-91d1-4a07-8536-c5057eda7dd3 | 4 | public static LuaTable make(boolean weakkeys, boolean weakvalues) {
LuaString mode;
if (weakkeys && weakvalues) {
mode = LuaString.valueOf("kv");
} else if (weakkeys) {
mode = LuaString.valueOf("k");
} else if (weakvalues) {
mode = LuaString.valueOf("v");
} else {
return LuaTable.tableOf();
}
... |
95386e06-1d34-49d1-9ac2-7d55120d6f50 | 6 | public List<Room> getPath() {
List<Room> list = new ArrayList<Room>();
HousePath path = this;
while (path != null) {
list.add(path.last);
path = path.getPrevious();
}
Collections.reverse(list);
final int index = script.roomStorage.getIndex(ctx.players.local());
if (index != -1) {
// Clean up p... |
699efe31-c000-48b8-98d8-06ac7c0f9da0 | 7 | public void accept(final ClassVisitor cv) {
FieldVisitor fv = cv.visitField(access, name, desc, signature, value);
if (fv == null) {
return;
}
int i, n;
n = visibleAnnotations == null ? 0 : visibleAnnotations.size();
for (i = 0; i < n; ++i) {
AnnotationNode an = (AnnotationNode) visibleAnnotations.get... |
2842742a-f525-4e6f-805e-16bf80d10a10 | 5 | public static String generateCard() {
String temp = new String();
String newCard = new String();
int tmp;
Random rand = new Random();
int cardDigits[] = new int[16];
// For Visa, 1st digit is always 4
cardDigits[0] = 4;
newCard += cardDigits[0];
// Initialize the 2nd-15th digit to a random number
... |
635eadfa-586b-4981-845b-6a6c981b7652 | 1 | public static void downloadFile(RestS3Service ss, String bucketName, String objectName, File outputFile, byte[] bytes) throws IOException, ServiceException {
// Download an object from its name
S3Object downloadedObjectNew = TransferServer.downloadObject(ss, bucketName, objectName);
OutputStream output = ne... |
b86a13a3-c8cc-403d-aedc-9fa3d3bfc166 | 8 | private boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2) {
if (mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight())
return false;
if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI &&
mode2.getBitDepth() != DisplayMode.BIT_DEPTH_MULT... |
46239c3c-9145-4626-984b-3d2f0f85a818 | 5 | private void addItemToHrefs(String href) {
if (href.contains("https")) {
String properHref = href.replace("https://" + base_url, "");
if (!(temporaryInternalHrefs.contains(properHref)))
temporaryInternalHrefs.add((properHref));
} else if (href.contains("#")) {
String properHref = href.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.