method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
052cb543-91c2-41fa-9762-37fdece1423f | 4 | private void awaitAsyncExecution(Future<?> async) throws ProcessExecutionException {
try {
async.get();
} catch (ExecutionException ex) {
// thread returned an exception
if (ex.getCause() instanceof ProcessExecutionException) {
throw (ProcessExecutionException) ex.getCause();
}
} catch (Exception... |
3272edc9-17d3-4746-a222-ac15c684e8bc | 5 | @Override
public void mouseDown(EventMouse eventMouse) {
if (eventMouse.getPosition().getY() > getPosition().getY() + getScale().getY() - topBarHeight){
drag = true;
pressPosition = eventMouse.getPosition().sub(getPosition().getXY());
}
if (active){
event... |
106425fa-f49f-43d5-88be-52a5c20bdf80 | 9 | @Override
public boolean preprocessCommand(JissModel jissModel, String orig, StringBuffer cmd) {
final String c = cmd.toString();
if(c.equals("::langs")) {
cmd.setLength(0);
printLangs(jissModel, cmd);
} else if (c.equals("::lang")) {
cmd.setLength(0);
printCurrentLang(jissModel, cmd);
} else if(c.... |
e7b7f843-c190-4a9c-8ab2-c1acb9cab505 | 4 | private boolean nodesConnectedHelper(Node parent, Node from, Node to) {
if (from == to)
return true;
for (Node n : from.adjNodes()) {
if (n != parent && nodesConnectedHelper(from, n, to))
return true;
}
return false;
} |
b362ffd4-1f38-4153-8887-0bb672aa883c | 7 | public static StaffRank getNextBest(StaffRank sr) throws NoNextRankException {
switch(sr) {
case NONE:
return HELPER;
case HELPER:
return CHATMOD;
case CHATMOD:
return MOD;
case MOD:
return SRMOD;
case SRMOD:
return ADMIN;
case ADMIN:
return OWNER;
case OWNER:
throw new NoNextRankEx... |
2190a85c-95b6-4742-b40c-b04867fa3689 | 0 | @Override
public void execute(DebuggerVirtualMachine dvm) {
} |
c699d508-539d-41ad-8223-f5651e0744a8 | 3 | public void startGame() throws InterruptedException {
canvas.createBufferStrategy(2);
Graphics2D g = (Graphics2D)canvas.getBufferStrategy().getDrawGraphics();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
long start = 0L;
long sleepDuration = 0L;
while(true... |
fe8a711f-e928-4e35-824b-ede41bf3a860 | 8 | final public void Function_body() throws ParseException {
/*@bgen(jjtree) Function_body */
SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_BODY);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Function_variable_declarations();
... |
d8c9bbbf-555a-4ff0-ba91-daec1214110f | 0 | public void setModel(TreeModel model) {
tree = model;
invalidate();
} |
032a716e-b781-4ed0-839e-e9694a9379a0 | 3 | public void setCinema(Cinema cinema) {
if (cinema == null) {
throw new IllegalArgumentException("Cinema object should not be set NULL.");
}
if (this.cinema != null) {
this.cinema.removeCashOffice(this);
}
if ( !cinema.existCashOffice(this)) {
cinema.addCashOffice(this);
}
t... |
7f6e0214-152e-44f2-b455-047b5e7346d3 | 7 | @Override public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Card other = (Card) obj;
if (face == null) {
if (other.face != null)
return false;
} else if (!face.equals(other.face))
return false;
... |
9667f0d8-1a2a-4e5e-b68f-37a9a8eb9ac9 | 2 | public static double min(double[] flag) {
double min = flag[0];
for(int i = 1; i < flag.length; i++) {
if(flag[i] < min)
min = flag[i];
}
return min;
} |
403ecb73-b319-4384-a9d6-0ad86e185609 | 9 | public void agregarNavesRandom(){
Hashtable<TipoNave, Integer> navesDefault = (Hashtable<TipoNave, Integer>) Config.getObject("navesDefault");
Enumeration<TipoNave> e = navesDefault.keys();
while(e.hasMoreElements()){
TipoNave tipo = e.nextElement();
int number = navesDefault.get(tipo);
while((number--)... |
78418fb2-eca0-4df0-bd9d-072248092cd3 | 6 | public void ejecutar() {
try {
// Creamos un servidor de Socket
ServerSocket server = new ServerSocket(port);
System.out.println("Servidor iniciado...");
while (true) {
Socket cliente = server.accept();
// Crear los canales de lectu... |
a202dfc9-26fd-4dc7-be1c-606cb233314c | 8 | public String addTitleEps(String eps) throws IOException {
if (text == null || text.size() == 0) {
return eps;
}
final int idx = eps.indexOf("%%BoundingBox:");
if (idx == -1) {
throw new IllegalArgumentException();
}
final StringTokenizer st = new StringTokenizer(eps.substring(idx + "%%BoundingBox:".... |
38c540fd-8a04-4dd1-97bc-9bbb97dd536b | 1 | public void hit() {
health--;
if (health <= 0) {
dead = true;
}
} |
00193e4b-3060-421b-a7c0-84e69a7fa91d | 3 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
for(ListIterator<PExpLogica> i = this._expLogica_.listIterator(); i.hasNext();)
{
if(i.next() == oldChild)
{
if(new... |
a6c3af76-01df-4edb-b453-8f0544210978 | 6 | public void playSound(Matching type) {
if (type == Matching.Reveal && RevealSound != null) {
RevealSound.play();
}
else if (type == Matching.Match && MatchSound != null) {
MatchSound.play();
}
else if (type == Matching.MisMatch && MisMatchSound != null) {
MisMatchSound.play();
}
} |
6e0ab972-80ed-485a-bafa-61a02f64e763 | 1 | public void stop() throws InterruptedException {
es.shutdown();
while (loadingNow() > 0) {
Thread.sleep(500);
}
} |
bb68ef6d-b1a4-48ae-a458-8bb06d43e50b | 5 | public static void browse (String url) {
try {
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().browse(new URI(url));
} else if (getCurrentOS() == OS.UNIX && (new File("/usr/bin/xdg-open").exists() || new File("/usr/local/bin/xdg-open").exists())) {
... |
6f49956b-d824-4cce-8b46-923fe5b6fa1c | 1 | public Enumeration<String> elements() {
Iterator<String> iter;
Vector<String> list;
iter = m_Words.iterator();
list = new Vector<String>();
while (iter.hasNext())
list.add(iter.next());
// sort list
Collections.sort(list);
return list.elements();
} |
60def17e-19b0-4d00-895f-b735c3c7b4dd | 5 | private Statement arrayStatment(String varName, Vector<Expression> expressions,
Vector<Integer> lengths, OperationExpression rhs) {
int[] indexes = new int[lengths.size()];
for (int i = 0; i < lengths.size(); i++)
indexes[i] = 0;
BlockStatement statement = new BlockStatement(... |
c6060d73-ce98-454d-bc26-9232b8fce530 | 6 | public static int longestConsecutive(int[] num) {
if (num.length == 0)
return 0;
// LongestConsecutiveSequence instance = new
// LongestConsecutiveSequence();
// Queue<Integer> queue = new
// PriorityQueue<Integer>(num.length+1,instance.new MyComparator());
Queue<Integer> queue = new PriorityQueue<Intege... |
12aa2792-8704-4e5e-a9e8-82e9fc7e0dd2 | 8 | public void putAll( Map<? extends Short, ? extends Double> map ) {
Iterator<? extends Entry<? extends Short,? extends Double>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Short,? extends Double> e = it.next();
this.put( e.get... |
8e4c5fd8-db18-44ae-8f43-60e3a8f9cff4 | 1 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int arr[] = new int[n];
for(int arr_i=0; arr_i < n; arr_i++){
arr[arr_i] = in.nextInt();
}
double[] fractions=findPercentageNumbers(arr);
... |
3b057776-9826-4492-b654-5ecc85021196 | 9 | public static List<Pledge> readAllFrequencyunit(Connection connection, Enum_version version, Pledge.Enum_frequency_unit frequency_unit) {
PreparedStatement statement;
ResultSet resultset;
List<Pledge> pledgelist = new ArrayList();
Calendar calendar = Calendar.getInstance();
Strin... |
7aae588a-8b03-4995-808d-ca79526b598a | 0 | public void setProtocoleJdbc(String protocoleJdbc) {
this.protocoleJdbc = protocoleJdbc;
} |
9ad41946-feae-4208-8642-2e8caab460dc | 0 | private About() {
// JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
putValue(NAME, "Acerca de...");
putValue(SHORT_DESCRIPTION, "Acerca de...");
putValue(LONG_DESCRIPTION, "Acerca de...");
putValue(SMALL_ICON, new ImageIcon(g... |
aaed1a5c-891a-411c-9004-03119757b8b3 | 2 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
try {
TilastointiService service = new TilastointiService();
ArrayList<Toppizzat> pizzatop = service.haeToppizzat();
// lisätään requestiin
r... |
38497eaa-6f3c-4214-8d3d-80d27fe82677 | 6 | protected static double dpow_default(double a, double b) {
if (b < 0)
return 1 / dpow_default(a, -b);
double p = 1;
int whole = (int) b;
for (double v = a; whole > 0; whole >>= 1, v *= v)
if ((whole & 1) != 0)
p *= v;
if ((b -= whole) > 0) {
int frac = (int) (0x10000 * b);
for (; (frac & 0xfff... |
9568d337-69ac-4d5a-8f10-d66b6e8b41b5 | 0 | public int count() {
javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
javax.persistence.criteria.Root<T> rt = cq.from(entityClass);
cq.select(getEntityManager().getCriteriaBuilder().count(rt));
javax.persistence.Query q = getEntityManag... |
3104a30a-d11c-47ee-ad22-c7015258e9bd | 7 | public void draw(Graphics g) {
if (InputHandler.MouseX > x
&& InputHandler.MouseX < x + imageOff.getWidth()
&& InputHandler.MouseY > y
&& InputHandler.MouseY < y + imageOff.getHeight()) {
g.drawImage(imageOn, x, y, null);
if (!isClicked || selectedButton == this) {
g.drawImage(sword_sele... |
cca3e70f-ca58-4158-8f44-792262301903 | 5 | public Graphics drawGridGraphics(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(new Color(99, 209, 62, 255));
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//Draws the rhombuses on the screen in a grid like fashion
int rhombus_width = 40;
int rhombu... |
1058f99f-8155-4898-a1e3-0d2b835f49cd | 1 | public int patientsLengthRecursively() {
if (nextPatient == null) {
return 1;
} else {
return 1 + nextPatient.patientsLengthRecursively();
}
} |
52a33fd7-582c-486b-9a93-d579233031c7 | 4 | private boolean setGame(Game game) {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: setGame() BEGIN");
}
m_gameControl = game;
if (test || m_test) {
System.out.println("GameWindow :: setGame() END");
}
return true;
} |
ed902516-a43f-4bed-afa6-a3c376eb52ea | 7 | private void readPossibleCharData(/*Element element*/
) throws ParseException, IOException {
int i = 0;
while (!isChar('<') && !isChar('&') && !isSymbol(END_CDATA)) {
tmpBuf_[i] = readChar();
//convert DOS line endings to UNIX
if (tmpBuf_[i] == '\r' && peekChar() == '\n') tmpBuf_[i] = read... |
be7ebd11-23dd-4861-8ede-3d63f2023a4b | 3 | public Poly reshape() {
double[] t;
int index = p.length - 1;
for (int i = 0; i < p.length; i++) {
if (Math.abs(p[i]) > epsilon) {
index = i;
break;
}
}
t = new double[p.length - index];
for (int i = 0; i < t.length; i++)
t[i] = p[i + index];
Poly tt = new Poly(t);
return tt;
} |
4c7d965a-936c-44e6-bc9c-e32e45fcb421 | 8 | private boolean r_perfective_gerund() {
int among_var;
int v_1;
// (, line 71
// [, line 72
ket = cursor;
// substring, line 72
among_var = find_among_b(a_0, 9);
if (among_var == 0) {
return false;
}
// ], line 72
bra = cursor;
switch (among_var) {
case 0:
return false;
case 1:
// (... |
088c45f2-68ef-41c5-a668-a57f5a759fb2 | 9 | public static void ApplyGaussianFilter(ComparableGrid2D<Double> grid, int kernel_size)
{
int kernel_rows = kernel_size;
int kernel_cols = kernel_size;
// define kernel here (double loop), these are the 1/16, 2/16, etc...
// values that you're multiplying the image pixels by
double[][] kernel = new double[ke... |
29879f57-5339-4e71-93ff-bcaa33251ccb | 5 | public synchronized InputStream getInputStream(final short fid) {
try {
InputStream in = null;
byte[] file = filesBytes.get(fid);
if (file != null) {
/* Already completely read this file. */
in = new ByteArrayInputStream(file);
in.mark(file.length + 1);
} else {
/* Maybe partially read? Us... |
58cd5ce9-8b92-4e0e-a102-671e91aa8e62 | 5 | public void setSourceText(String sourceText) {
if( !sourceText.equals(AlchemyAPI_ConceptParams.CLEANED) && !sourceText.equals(AlchemyAPI_ConceptParams.CLEANED_OR_RAW)
&& !sourceText.equals(AlchemyAPI_ConceptParams.RAW) && !sourceText.equals(AlchemyAPI_ConceptParams.CQUERY)
&& !sourceText.equals(AlchemyAPI... |
3fb7401a-0398-4182-83dd-c2eb23bee48c | 6 | public QueryResult search(ArrayList<BusStop> locations, ArrayList<Line> lines, Location departure, Location destination)
{
/** YOUR SEARCH ALGORITHM WILL GO HERE */
//Iterate through lines - find smallest distance
double minDistance = Double.MAX_VALUE;
Line minLineFromDep = lines.get(0);
... |
567472bf-73ee-49c3-809c-91afa8372d83 | 7 | public void handleMove(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource) throws ServletException, IOException
{
if (!resource.exists() || !passConditionalHeaders(request, response, resource))
return;
String newPath = URI.canonicalPath(req... |
eff6fd27-58e1-4564-bbed-235e6d7d33d0 | 7 | private void generateAlchemicalItem(){
int test = rollDie(1, 100);
if (test <= 12){
room.append("Alchemist's fire (" + rollDie(1, 4) + " flasks, 20gp each)\n");
} else if (test <= 24){
room.append("Acid (" + rollDie(2, 4) + " flasks, 10gp each)\n");
} else if (test <= 36){
room.append("Smokesticks (... |
3cb6c849-1ccc-4301-b546-ecec311ab960 | 5 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Environment.InitPacket(451, Main.ClientMessage);
Environment.Append(0, Main.ClientMessage);
Environment.Append(Integer.toString(5), Main.ClientMessage);
Room[] Rooms = new Room[Main.Data.OwnRooms.size()];
... |
98f3c327-df12-4bd4-9bc4-acaed97d252a | 7 | public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "who", true)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
if (args.length == 1) {
UserTable ut = plugin.getDatabas... |
5298f217-02d4-45a6-aa6f-798dd120a830 | 2 | public static Map getInstance(int size) {
if (Map.instance == null||!(Map.instance instanceof HazardousMap)) {
instance = new HazardousMap(size);
}
return Map.instance;
} |
bcc91808-cc77-4b61-b40d-dc00c2a35b4c | 1 | public static void main(String[] args)
{
Generic1<Integer> a = new Generic1<Integer>();
Integer[] integerA = {10,1,20};
Integer[] integerB = null;
a.setFooArray(integerA);
integerB = a.getFooArray();
for(int i = 0; i < a.getFooArray().length; i++)
{
System.out.println(integerB[i]);
}
} |
32989c72-994d-4b68-b763-761d0d8ee5f3 | 5 | public void doTransformations() {
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
GlobalOptions.err.println("before Transformation: " + this);
while (lastModified instanceof SequentialBlock) {
if (lastModified.getSubBlocks()[0].doTransformations())
continue;
lastModified = lastModi... |
9a17eb43-1c21-4cb5-ab85-47f2110f144f | 9 | public void close()
{
try
{
if(myStatement!=null)
myStatement.close();
}
catch (final SQLException e)
{
if(CMSecurity.isDebugging(CMSecurity.DbgFlag.SQLERRORS))
Log.errOut("DBConnection",e);
}
try
{
if(myPreparedStatement!=null)
myPreparedStatement.close();
}
catch (final SQLEx... |
61f39b10-4327-4105-ab21-f0f3aaea0f83 | 9 | private String getNewIntervalString(Interval<?> interval, String name, boolean empty, boolean entire) {
String declaration = "";
String inputType = currentTypeTranslation_.get(interval.getTypeClass())[0];
if (empty) {
if (currentEmptyIntervalTranslation_.length == 2) {
declaration += currentEmptyInterval... |
f999803e-4c1a-42f2-88c1-0205ee9f1f50 | 3 | public void run(String args[]) {
LOG.info("SaveTVDownloadManager Version: " + VERSION + " is starting");
try {
Parameter.initialize(args);
if(Parameter.parameterOk()){
DownloadManager dl;
if(Parameter.isProxySet())
dl = new DownloadManager(Parameter.getProxyH... |
b08af7dc-173a-4596-a217-5c947617c1a1 | 1 | public void removeOldImagesIfDatabaseIsFull() {
if (isMaxAllowedSpaceInUse()) {
mongoImageTemplate.findAndRemove(new Query().limit(MAX_DELETE_LIMIT), Image.class);
}
} |
51154740-3bbf-45ec-9de3-e65b48728c3c | 2 | public String toString() {
StringBuffer sbuf = new StringBuffer();
sbuf.append("(<Pair> ");
sbuf.append(left == null ? "<null>" : left.toString());
sbuf.append(" . ");
sbuf.append(right == null ? "<null>" : right.toString());
sbuf.append(')');
return sbuf.toString... |
e1e40bf2-6d04-41bb-9539-28216cda5e2d | 2 | private void Remover_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Remover_ButtonActionPerformed
try {
if (NomeJogador_TextField.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Selecione um jogador para remover!", "Alerta!", JOptionPane.WARNING... |
f6dec148-d54a-4f92-b660-9ce6fb34ba26 | 4 | public String getRandomGeslacht() {
Random rn = new Random();
switch (rn.nextInt(4)) {
case 0:
return "man";
case 1:
return "vrouw";
case 2:
return "onbepaald";
case 3:
return "onbekend";
default:
return "onbekend";
}
} |
47b3a55e-8058-47ef-980c-8a69d695a3e8 | 9 | public static Number[][] largestTriangleThreeBuckets(Number[][] data, Integer threshold) {
Number[][] sampled = new Number[threshold][];
if (data == null) {
throw new NullPointerException("Cannot cope with a null data input array.");
}
if (threshold <= 2) {
throw new RuntimeException("What am I supposed t... |
2f1030b5-0dfb-4061-b14e-65604bf9509c | 4 | @Override
public GameState choose(Player player, GameState[] states, Card card) {
for(GameState s : states)
{
s = findSetToTrue(s,card);
}
//If there's only one choice, we have no choice but to do it
if(states.length == 1)
{
return states[0];
}
int alpha = Integer.MIN_VALUE;
int beta =... |
9884c94a-9a30-4b94-9706-51b98f8ef507 | 9 | public byte[] loadBytecode(StructMethod mt, int codeFullLength) {
String className = mt.getClassStruct().qualifiedName;
try (DataInputFullStream in = getClassStream(className)) {
if (in != null) {
in.discard(8);
ConstantPool pool = mt.getClassStruct().getPool();
if (pool == null)... |
f145e690-4e93-4bce-bc43-2cb4f9fa67a0 | 1 | public void use() {
if (!valid())
throw new IllegalStateException("trying to enable a program that is not valid");
GL20.glUseProgram(program);
} |
63fb4125-02d7-409e-9636-51d357829827 | 1 | public Battlefield loadMonster(ArrayList<Monster> monsters){
for(int i = 0 ; i < monsters.size();i++){
monsterSlots.add(new MonsterSlots(monsters.get(i)));
monsterTurn.add(monsterSlots.get(i));
}
return battleField;
} |
dd6efb1d-1221-4041-ace0-a2f34600add5 | 2 | private void addToMap(Type t, Set<Unit> value) {
// TODO Auto-generated method stub
if(newExpr_cmplt == null){
newExpr_cmplt = new HashMap<Type, Set<Unit>>();
}
if(!newExpr_cmplt.containsKey(t)){
Set<Unit> set = new HashSet<Unit>();
newExpr_cmplt.put(t, set);
}
newExpr_cmplt.get(t).addAll(value)... |
8836821f-35c0-4651-8efe-ccf9acddaf57 | 1 | @Override
public void paintComponent(Graphics g) {
if (image == null)
initialise();
g.drawImage(image, 0, 0, null);
} |
6b1bb976-f268-4f10-81a7-b026277f5b5b | 8 | public void show(Component invoker, int x, int y) {
if (atom == null)
return;
if (!atom.isNucleotide())
return;
if (!((MolecularModel) atom.getHostModel()).changeApprovedByRecorder())
return;
String s = atom.getName();
if (s.equals("A"))
miA.setSelected(true);
else if (s.equals("C"))
miC.setS... |
64310bbf-bfff-41d7-894c-c4f9148e0453 | 0 | public void setSelected(boolean selected)
{
this.selected = selected;
repaint();
} |
a6242492-f6cb-4048-9adc-d0eebd34cf72 | 4 | public void update(boolean performed_action, double ap_from_action) {
//TODO Fix/Create actor turn system
if (performed_action) {
if (run_turn) {
for (int c = 0; c < active_actors.size(); c++) {
Actor a = active_actors.get(c);
if (a.act... |
2bda19b5-449e-406c-a5b9-fdfb1b1ae8ac | 5 | private JPanel createSettings()
{
JPanel panel = new JPanel(new BorderLayout());
setIconImage(new ImageIcon("res/icon.png").getImage());
// Create the options panel
JPanel optionsPanel = new JPanel(new GridLayout(4, 1));
// Trim panel
JPanel trimPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLab... |
f6e3f968-5014-4bae-9ee5-24b4c01f8399 | 0 | public void setName(String name) {
Name = name;
} |
b617d973-403a-4842-b6ae-4303ac5c4ce7 | 8 | public int getWordPoints(String word) {
int pointValue = 0;
int wordLength = word.length();
switch (wordLength) {
case 1:
case 2:
pointValue = 0;
break;
case 3:
pointValue = 1;
break;
case 4:
pointValue = 2;
break;
case 5:
pointValue = 3;
break;
case 6:
pointValue = 4;
... |
45c7becc-0697-48df-912d-b8531a78c629 | 6 | @EventHandler
public void SlimeNightVision(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSlimeConfig().getDouble("Slime.NightV... |
02798818-fff6-488e-98fb-9fae907b21c5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final DeviceObjectReference other = (DeviceObjectReference) obj;
if (deviceIdentifier... |
3104cb5e-95ce-4d94-927f-4fc0eae15cd3 | 6 | public void driver(String ... args) {
// get instance of MilliTimer() for benchmarking
MilliTimer timer = new MilliTimer();
this.validateArgs(args);
ApplicationWindow.clearData();
// Open Database Connection
try {
Database.getInstance()... |
4a436087-1e4a-4a96-bcdb-96311b0a35ca | 8 | @Override
public ByteBuffer getData() {
int cols = (int) colorsUsed;
if (cols == 0) {
cols = 1 << bitsPerPixel;
}
int rowsize = (int) width / 8;
if ((rowsize % 4) > 0) {
rowsize += 4 - (rowsize % 4);
}
ByteBuffer buf = ByteBuffer.allo... |
6766e519-3a3b-4f16-805a-be3f044b98a5 | 3 | private Collection<URL> buildAritfactDependencies(ExpressionEvaluator expressionEvaluator) throws ComponentConfigurationException {
MavenProject project;
try {
project = (MavenProject) expressionEvaluator.evaluate("${project}");
} catch (ExpressionEvaluationException ... |
09c07e77-0a9a-4247-96f4-81004d05603e | 9 | private boolean indiceValido(int ren, int col) {
if ((ren >= 0) && (ren < renglones) && (col >= 0)
&& (col < columnas)) {
switch (tipocod) {
case 1:
return (ren <= col); // sd
case 2:
return (ren < col); // sn
case 3:
return (re... |
6ab9f367-1d40-431d-9695-e2e6f0c62030 | 1 | public static SaveResults getSaveResults() {
if (miSaveResults == null)
miSaveResults = new SaveResults();
return miSaveResults;
} |
7aa6f313-a27e-448e-af30-f4c53ea92178 | 7 | public static int encodingNum(String name) {
if (name.equalsIgnoreCase("Raw")) return encodingRaw;
if (name.equalsIgnoreCase("CopyRect")) return encodingCopyRect;
if (name.equalsIgnoreCase("RRE")) return encodingRRE;
if (name.equalsIgnoreCase("CoRRE")) return encodingCoRRE;
if (name.equ... |
9c22338e-b14c-47eb-a232-b28849cb28f1 | 6 | void checkNotFrozen(String classname) throws RuntimeException {
CtClass clazz = getCached(classname);
if (clazz == null) {
if (!childFirstLookup && parent != null) {
try {
clazz = parent.get0(classname, true);
}
catch (NotFo... |
07229b5f-a617-4722-8ad4-eed99052e6ff | 1 | @Override
protected void logBindInfo(Method method) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功");
}
} |
173b1872-0bdb-4e93-8dc5-421f7ece0bed | 3 | public void testNoLineBreaks() {
// loop down all delimiter qualifier pairs to test
for (final char[] element : DELIM_QUAL_PAIR) {
final char d = element[0];
final char q = element[1];
final String txtToParse = UnitTestUtils.buildDelimString(DELIMITED_DATA_NO_BREAKS,... |
2caab8e7-a665-40c3-94fd-818785d173c5 | 5 | public PlayerPanel() {
super(new User());
setName("Player_Panel");
setLayout(new BorderLayout(5, 5));
// ////////////////////////////
// Top Panel:
// ////////////////////////////
labelName = new JLabel("Name:");
tfFirstName = new JTextField();
tfLastName = new JTextField();
labelID = new JLab... |
a4f2cf45-6e5a-496e-91d3-be6399335125 | 0 | @SuppressWarnings("unchecked")
public List<Order> getAllOrders() {
return (List<Order>)this.em.createNamedQuery("findAllOrders").getResultList();
} |
00a9f007-9f25-4224-bc1c-391aad32e2fc | 8 | public static void main(String[] args) {
RandomSearchInitialisation starter = new RandomSearchInitialisation();
starter.initLanguage(new char[] { '0', '1' }, 20, "(0|101|11(01)*(1|00)1|(100|11(01)*(1|00)0)(1|0(01)*(1|00)0)*0(01)*(1|00)1)*");
int solutionFoundCounter = 0;
int noSolutionFound = 0;
List<Long> c... |
7234809a-73c1-43b2-9f0f-31cf3d784ff2 | 7 | public static void writeResults( File outFile, HashMap<String, HashMap<String, Integer>> outerMap ) throws Exception
{
HashSet<String> samples = new HashSet<String>();
List<Holder> nodes = new ArrayList<Holder>();
for( String s : outerMap.keySet() )
{
Holder h= new Holder();
h.nodeName = s;
samples... |
d5e30435-142a-4df5-a27d-e3d68bf81493 | 3 | public void setUniqueWords() {
for (String x : totalWords) {
if (!uniqueWords.contains(x.toLowerCase())) {
uniqueWords.add(x.toLowerCase());
}
}
while (uniqueWords.contains("-")) {
uniqueWords.remove("-");
}
} |
86b182fc-85eb-405c-9e91-4bf646f07a19 | 5 | @Override
public TLValue evaluate() {
TLValue a = lhs.evaluate();
TLValue b = rhs.evaluate();
// number + number
if(a.isNumber() && b.isNumber()) {
return new TLValue(a.asDouble() + b.asDouble());
}
// list + any
if(a.isList()) {
List<TLValue> list = a.asList();
list.a... |
d111d25e-23f1-42f8-a0a5-508b955407a0 | 2 | public IntegerAggregationPanel(IntegerColorLibrary converter)
{
this.colorPicker = converter;
converter.addListener(this);
addMouseMotionListener(new MouseMotionListener()
{
@Override
public void mouseDragged(MouseEvent e)
{
// do nothing
}
@Override
public... |
4e59d30a-eb03-4fed-866e-4e3f0f5130df | 7 | @Override
public ResultMessage addGoodsClass(GoodsClassPO goodsClassPO) {
if(goodsClassPO.goodsClassName.equals("")) return ResultMessage.add_failure;
boolean hasFather = false;
gcIter = goodsClassList.iterator();
GoodsClassPO gcp;
System.out.println(goodsClassPO.fatherGoodsClassNum);
if(goodsClassPO.fathe... |
6cb4edcb-f569-445a-82c1-ca2fa173d1f7 | 2 | public static Game instantiante(String briscaGameFactory,
Object[] parameters) {
if (briscaGameFactory.contains(VANILLA_BRISCA_GAME)) {
return new BriscaGame();
} else if (briscaGameFactory.contains(TOURNAMENT_GAME)) {
return new TournamentBrisca((BriscaGame) parameters[0]);
} // else
return null;
} |
21e21d22-981b-4af8-a730-335f4240d01e | 0 | public Piece(boolean isWhite, ImageIcon img) {
this.isWhite = isWhite;
this.imgIcon = img;
} |
81b8e9d6-fce5-4dd2-93d3-7dff7451f7fe | 0 | @XmlElementDecl(namespace = "http://www.rsasecurity.com/rsalabs/pkcs/schemas/pkcs-5v2-0#", name = "PBMAC1-params")
public JAXBElement<PBMAC1ParameterType> createPBMAC1Params(PBMAC1ParameterType value) {
return new JAXBElement<PBMAC1ParameterType>(_PBMAC1Params_QNAME, PBMAC1ParameterType.class, null, value);... |
e921c337-7153-4942-bc47-7b12822f6d74 | 0 | public static void main(String[] args)
{
BigComplex one = new BigComplex(BigDecimal.valueOf(-3),BigDecimal.valueOf(-4));
BigComplex two = new BigComplex(BigDecimal.valueOf(-3),BigDecimal.valueOf(4));
BigComplex three = new BigComplex(BigDecimal.valueOf(2.003),BigDecimal.valueOf(0));
... |
347994a6-2255-420d-95ef-cf42a2ffd0d3 | 2 | @Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
this.setVisible(false);
if (fc != null) {
fc.setVisible(true);
}else
if (fp != null) {
fp.setVisible(true);
}
} |
7220f908-8cfb-46f2-ab92-6bf435b1a1de | 8 | static void scoreAll(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase, Bits acceptDocs) throws IOException {
if (twoPhase == null) {
for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
if (acceptDocs == null || acceptD... |
30ad4fff-1430-460d-9ade-7a6305bc4ac4 | 1 | private boolean jj_2_55(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_55(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(54, xla); }
} |
2c54df08-1716-41e9-aa4d-d786f5b21f83 | 9 | protected void writeExtendedFeatures (DependencyInstance instance, ObjectOutputStream out)
throws IOException {
final int instanceLength = instance.length();
for(int w1 = 0; w1 < instanceLength; w1++) {
for(int w2 = w1; w2 < instanceLength; w2++) {
for(int w3 = w2+1; w3 < instanceLength; w3++) {
Feat... |
159a0f19-6f37-4a76-b3be-140b88ba94be | 7 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._var_ == oldChild)
{
setVar((PVar) newChild);
return;
}
if(this._aDe_ == oldChild)
{
s... |
9e3190d9-14d1-44c8-93aa-ac1f57826ad8 | 8 | public int[] merge(int[] leftSortedArray, int[] rightSortedArray) {
if (leftSortedArray == null)
return rightSortedArray;
else if (rightSortedArray == null)
return leftSortedArray;
int p = 0;
int q = 0;
int r = 0;
int combinedSize = leftSortedArray... |
5a4cbd67-bb5d-465b-a9dd-b8a13e05c266 | 4 | public static HashSet<Player> getTeamFriends(Teams team) {
if (team == Teams.BLUE) {
return blueFriends;
} else if (team == Teams.GREEN) {
return greenFriends;
} else if (team == Teams.ORANGE) {
return orangeFriends;
} else if (team == Teams.RED) {
return redFriends;
} else {
return null;
}
... |
d65631ce-7e29-4c77-b826-309b25a5e83f | 2 | private Integer valid(float[] weeksPrices) {
int v = 0;
for (float f : weeksPrices) {
if (f == f)
v++;
}
return v;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.