method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fd118891-bf99-4a21-a3b2-72d349a4643a | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (null == obj) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
DirectionStayHotel eq = (DirectionStayHotel)obj;
... |
43ef898e-81ef-4896-98bc-b5d0f54c287b | 6 | public EdgeLocation getNormalizedLocation()
{
// Return an EdgeLocation that has direction NW, N, or NE
switch (dir)
{
case NorthWest:
case North:
case NorthEast:
return this;
case SouthWest:
case South:
case SouthEast:
return new EdgeLocation(hexLoc.getNeighborLoc(dir),
... |
61ada112-3514-4eda-89ab-8416f3b593d6 | 4 | private final boolean isDisplayModeAvailable(int width, int height, int bitDepth) {
for (DisplayMode mode : getDisplayModes()) {
// Can't use mode.equals() with a new DisplayMode object
// This is because DisplayMode.equals(dm) compares refreshRate()
if (width == mode.getWidth() && height == mode.getHeight()... |
753eab46-0d60-4898-9271-273aac041ea5 | 7 | public GuiSlotStatsItem(GuiStats var1) {
super(var1);
this.field_27275_a = var1;
this.field_27273_c = new ArrayList();
Iterator var2 = StatList.field_25186_c.iterator();
while(var2.hasNext()) {
StatCrafting var3 = (StatCrafting)var2.next();
boolean var4 = false;
... |
4a441f38-4ea9-4466-9724-93f2aae536cb | 4 | public String print(int tabCount)
{
String tabs = "";
for(int i = 0; i < tabCount; i++)
tabs += "\t";
String output = "\n\t<Node>";
for(int i = 0; i < lines.size(); i++)
{
output += "\n" + tabs + lines.get(i);
}
if(children.size() > 0)
{
tabCount++;
for(BasicBlock child: children)
{
... |
53b5c304-b4f5-4d71-8e93-569560d427f8 | 2 | public ChatHW(Widget parent, String title, boolean closable) {
super((Widget) UI.instance.chat, title, closable);
in = new TextEntry(new Coord(0, sz.y - 20), new Coord(sz.x, 20), this,
"");
in.canactivate = true;
in.bgcolor = new Color(64, 64, 64, 192);
out = new Textlog(Coord.z, new Coord(sz.x, sz.y - 20... |
4c3d12ef-d307-4200-853c-ec5b2a13612d | 1 | public void uploadFile(final String localDirectory, final String filename) throws IOException {
new Thread(new Runnable() {
@Override
public void run() {
try (InputStream is = new FileInputStream(localDirectory + File.separator + filename);) {
connect(... |
7c1eb4d2-085a-4ca7-92c3-4e7443e8fe4c | 0 | public int getExpYears() {
return expYears;
} |
a89a0328-c9ee-4c3e-8635-f4ce03387328 | 3 | @Override
public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp)
throws Exception {
if (st.size() < 2)
throw new Exception("MOD: faltan operandos");
Valor op1 = st.pop();
Valor op2 = st.pop();
if (op1 instanceof Entero && op2 instanceof Entero) {
st.push(new Entero(((int) op2.getValor()) % (... |
184f5099-d1b7-4431-9cdf-ea7113cd54ba | 4 | public Point add(Point p) {
if (!(p == null || p.properties == null || properties == null)) {
for (int i = 0; i < properties.size(); i++) {
set(i, p.get(i) + get(i));
}
}
return this;
} |
9f2d6cf6-0397-4850-b0c7-5729de8824cb | 7 | protected void handlePacketReceived(PacketReceivedMessage msg) {
if (msg.source != connection) {
return;
}
if (msg.packet instanceof KeepAlivePacket) {
connection.sendPacket(new KeepAlivePacket(((KeepAlivePacket)msg.packet).... |
71a83791-c43b-4bc4-8766-e268c359f948 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)
|| (object instanceof String && ((Stri... |
4ac7ca83-e755-449e-b2ee-a03ac0420d84 | 4 | public void registerListeners(BlockBreakersController controller1,
BlockBreakersResizeController controller2,
BlockBreakersMenuController controller3,
BlockBreakersPopupController controller4,
BlockBreakersKeyBoardController controller5) {
blockBreakerPanel.addM... |
aa1c0a46-45c2-467d-8764-30dd63e92ada | 8 | private boolean isRightPass(String candidPass, DataOutputStream outToClient) {
String password = client.getPassword();
try {
logfile.update("Client: " + candidPass);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String[] request = candidPass.t... |
f8ff4b4c-7302-4079-87ab-89f3b0c2908d | 5 | public void deallocate() {
if(state == REALIZED || state == UNREALIZED) return;
if(state == CLOSED) throw new IllegalStateException();
if(state == STARTED ){
try{
stop();
}
catch(MediaException e){
}
}
deallocateImpl... |
025bec98-c18d-4dfb-bb90-44ff322888d4 | 3 | public GCPPopulation nextGeneration()
{
GCPPopulation newPop = (GCPPopulation) factory(false);
int size = conf.getInt( "population_size" );
GCPIndividual[] children = new GCPIndividual[size];
int[] selected = this.selectIndividuals();
newPop.minValidColor = this.minValidColor;
for(int i = 0 ; i < chi... |
72a4c094-3d99-49b1-8202-61068748ec1d | 4 | public void writeCashOutFile(final Long customerGroup, final Long revision) {
List<Receipt> receipts = ReceiptApiService.getUpdatesByRevision(revision);
Long maxRevision = Long.valueOf(0);
StringBuilder line = new StringBuilder();
try {
final Currency currency = CurrencyApiService.getByNumber(DbReader.getTo... |
4d4c508b-99f1-4052-84a5-08a0487bfb83 | 1 | @Override
public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException {
List paramList1 = new ArrayList<>();
List paramList2 = new ArrayList<>();
StringBuilder sb = new StringBuilder(UPDATE_QUERY);
String ... |
b46526a8-c8dc-4c68-8e1f-9dd517a568a0 | 8 | public void renderSubScreens()
{
for(SubScreen ss: subScreens)
{
ss.render();
int [] image = ss.pixels;
for(int xx=0;xx<ss.getWidth();xx++)
{
for(int yy=0;yy<ss.getHeight();yy++)
{
if(ss.getY()+yy>=0 && ss.getY()+yy<height && ss.getX()+xx>=0 && ss.getX()+xx<width)
{
if(image[xx... |
69ef5300-7ed0-48dc-8439-783d4cdf83cf | 8 | private void decode(byte[] bytes) throws VLQNegativeException, UnsupportedEncodingException
{
this.type = bytes[0];
if (getType()==VariantType.NULL) // no array copy, no more data to check
{
value = null;
return;
}
dataBytes = new byte[bytes.length-1];
for (int i = 0; i < dataBytes.length; i++)
{
... |
146c0351-ace8-4067-a719-13541ac27ed7 | 7 | byte getFace(ExtendedViewer viewer, int x, int y) {
byte i = 0;
for (byte j = FRONT; j <= LEFT; j++) {
if (intersectFace(viewer, j, x, y)) {
iOn[i++] = j;
}
}
if (i == 0) {
return -1;
}
byte face = -1;
if (i == 2) {
if (reusedP3f1 == null) {
reusedP3f1 = new Point3f();
reusedP3f2 =... |
3b19e4ef-bb6b-4f58-ac8b-5b32205ae5b1 | 0 | public void go()
{
frame = new Frame("GUI Example");
// frame.setLayout(new FlowLayout());
button1 = new Button("Press me");
button2 = new Button("Don't Press me");
frame.add(button1);
frame.add(button2);
frame.pack();
frame.setVisible(true);
} |
524456b8-ee9e-422d-b84f-46858e3b551d | 1 | public void setAccessFlags(int acc) {
if ((acc & AccessFlag.INTERFACE) == 0)
acc |= AccessFlag.SUPER;
accessFlags = acc;
} |
d9111d29-82e6-4c4b-a9fd-a73bf32d7ae7 | 3 | public static void main(String[] args)
{
boolean bool = false;
if(bool == true)
{
System.out.println("a");
}
else if(bool)
{
System.out.println("b");
}
else if(!bool)
{
System.out.println("c");
}
else
{
System.out.println("d");
}
} |
6779001c-853b-4694-b13c-e71d852b018d | 8 | public static Object loadExtension(Class extensionClass) {
Object ret = null;
try {
if (BasicExtension.class.isAssignableFrom(extensionClass)) {
Constructor[] cs = extensionClass.getConstructors();
for (Constructor c : cs) {
Class[] p = c.g... |
907151b9-1a98-46db-8812-a36708e0e53f | 3 | private double testJavaLinkedListInserts(int inserts) {
System.out.println("Testing LinkedList with " + inserts + " inserts");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
linkedList = new LinkedList();
startT... |
86fb3c35-6d8e-484b-8aea-76ec4a05c8bc | 7 | public List<File> getFiles() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setCurrentDirectory(m_dir);
fileChooser.setMultiSelectionEnabled(true);
FileFilter filter = new FileFilter() {
@Override
public boolean accept(... |
72e3d18b-487f-42fa-a986-2f1411b7edbd | 0 | @Override
public Position getDestination(){
return new Position(start.getY() + vertical ,start.getX() + horizontal);
} |
9832f1ff-7408-4766-a518-362bf120d0ac | 5 | public AudioDeviceInputPipe(String mixerName) {
for (Mixer.Info info : AudioSystem.getMixerInfo()) {
System.out.println(info.getName());
if (info.getName().matches(mixerName)) {
System.out.println("GETTING MIXER");
mixer = AudioSystem.getMixer(info);
break;
}
}
for (Line.Info info : mix... |
6aad2943-78b6-4886-bf45-14ad14146570 | 3 | public static void main (String[] xx)
{
Scores myscores, myscores2, myscores3;
myscores = new Scores(60,30,75);
myscores2 = new Scores(46,75,34);
myscores3 = new Scores();
//what is the highest score of each object
System.out.println("myscores:highest score is " + myscores.highScore());
Syst... |
048a8031-ec69-40ac-a33c-dd97efcd9183 | 6 | public void Bsort(T[] arreglo, int n){
boolean flag=true;
int tam_counter = n;
while(flag){
flag=false;
try {
for(int i=0; i<tam_counter-1;i++){
if((Integer)arreglo[i] > (Integer)arreglo[i+1]){
flag=true;
... |
945f602c-8f57-427b-a517-e136ad1aba9c | 7 | public BasicDBList readPhotosFromActivity(int start, int length, String userId) {
int end = start + length;
int iterator = 0;
Set<String> photoIdSet = new HashSet<String>();
DBCursor cursor = database.getCollection(ACTIVITY_COLLECTION).find(new BasicDBObject("_id", Pattern.compile("^" + ... |
5f03b71c-ed2b-44fe-be1c-f0b660a1596c | 8 | private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
... |
aeede9fd-3b44-4343-8722-ec95c47c3aa0 | 5 | @Override
public void paintComponents(Graphics g) {
Graphics g2 = g.create();
int x, y;
int w, h;
Rectangle bounds = this.parent.getBounds();
if (this.skin.isChanged() || (this.border == null) || (this.user == null) || (this.guest == null)) {
try {
... |
ff57c770-705a-4bf0-861c-5549df46dc9b | 2 | public final static DaoFabric getInstance() {
// Le "Double-Checked Singleton"/"Singleton doublement v�rifi�" permet
// d'�viter un appel co�teux � synchronized,
// une fois que l'instanciation est faite.
if (DaoFabric.instance == null) {
// Le mot-cl� synchronized sur ce bloc emp�che toute instanciation
... |
a2e7cc14-c09b-455b-96e7-be2492e89247 | 2 | public _Method(Representation... operations){
} |
587f4e73-9b9f-4d04-9f97-7f482670f4aa | 6 | private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
try { parameter.setName(txfName.getText()); } catch (CantSetException e) {}
try { parameter.setDescription(txfDescription.getText()); } catch (CantSetException e) {}
try { parameter.setDataM... |
a08075f8-b887-4efa-8e61-b85e1c830674 | 6 | @Override
public T add(T obj) throws IllegalArgumentException {
if (obj == null) {
throw new IllegalArgumentException("The object to add must be not null");
}
T data = null;
if (this.node == null) {
this.node = new Node<T>();
data = obj;
... |
7a4d67fe-1408-460d-ae3f-8497bbc31067 | 9 | private static boolean parseGraphLine_v2(String s, int lineNumber) {
if (lineNumber == 0) {
numOfNodes = Integer.valueOf(s);
graphMatrix = new int[numOfNodes + 1][numOfNodes + 1];
// Initialize graph matrix structures
for (int i = 0; i < numOfNodes; i++) {
... |
878124d4-1513-4709-960f-b98e4b6fae63 | 9 | public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
resetTokenList();
this.offsetShift = -text.offset + startOffset;
// Start off in the proper state.
int state = Token.NULL;
switch (initialTokenType) {
case Token.LITERAL_STRING_DOUBLE_QUOTE:
state = STRING;
start = t... |
ff7fb44a-3012-4e96-bf5d-0cdebd061ed0 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
3d22c2ce-f940-43a2-9485-d37e244e2f53 | 2 | public Object[] getRQF(File versionTarget) {
String jsonFile = "";
String jsonItem;
CompleteVersion verver;
Collection<File> reqLib = null;
try {
String verPath = versionTarget.getPath() + File.separator + "versions" + File.separator + VersionInfo.getModpackName() + ... |
34dc906c-a281-45e5-87e8-b60a97317279 | 3 | private void addPanelToTree(String name, int depth) {
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(name);
if (depth > lastNodeDepth) {
lastNode.add(newNode);
} else if (depth == lastNodeDepth) {
((DefaultMutableTreeNode) lastNode.getParent()).add(newNode);
} else {
int depthDifference... |
7e639057-c5f3-443e-b5a5-d9c6f9adc6db | 8 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><body>");
// Check for session obj, if null the... |
3713f5ee-e54e-4a44-bd97-e3c7c5488dbf | 3 | private void setVideoUrls(Document doc, HtmlProperties prop) {
// find video urls
Elements elements = doc.select(prop.getVideoClass());
videoUrls = Collections.synchronizedList(new ArrayList());
try {
for (Element e : elements) {
Elements subElements = e.select("a[href]");
String href = subElements.... |
80842d95-500e-410e-8b4d-b69416a1ba9a | 1 | public synchronized void InsertUrls(int id, String url) {
try {
article_url.executeUpdate("INSERT INTO zhangyu_sca.article_urls(article_id, list_url) values ('" + id + "' , '" + url + "');");
} catch (SQLException e) {
e.printStackTrace();
}
} |
abbf7a95-b8a6-4a9e-890f-9aee866c8b29 | 8 | public boolean contains(int fRow, int fCol, int toRow, int toCol, int [][] a) {
for (int i = 0; i < moveList.size(); i++){
if (moveList.get(i).getFromRow() == fRow && moveList.get(i).getFromCol() == fCol && moveList.get(i).getToRow() == toRow && moveList.get(i).getToCol() == toCol){
for (int p = 0; p < 8; p... |
249bdc4c-aa3e-4803-bcbb-dfa201fc1add | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Pagos)) {
return false;
}
Pagos other = (Pagos) object;
if ((this.idpagos == null && other.idpagos != null) || ... |
5205b8ab-cf51-4418-b194-5bc9dda7d1b8 | 5 | public void actionPerformed(ActionEvent arg)
{
Object ev = arg.getSource();
if(ev == submit)
{
float income, billsamt, gasamt, foodamt,entamt ;
try
{
income = Float.parseFloat(gross.getText());
billsamt = Float.parseFloat(billsex.getText());
gasamt = Float.parseFloat(gasex.getText());
... |
73708530-f29b-411c-9de4-7c75b5194f2b | 8 | public void keyPressed(KeyEvent e) {
if (!chatMode)
{
if (e.getKeyCode() == KeyEvent.VK_W)
w = true;
if (e.getKeyCode() == KeyEvent.VK_A)
a = true;
if (e.getKeyCode() == KeyEvent.VK_S)
s = true;
if (e.getKeyCode() == KeyEvent.VK_D)
d = true;
if (e.getKeyCode() == KeyEvent.VK_ENTER)
... |
5dd4c8d8-c960-4f47-a7cc-a8de8a529b09 | 0 | public void windowDeiconified(WindowEvent e) {
isIdle=false;
} |
acfbc499-76df-420b-8974-4d15dbb7a238 | 2 | @Override
public Integer get() {
lock.lock();
try {
while (isEmpty()) {
notEmpty.await();
}
// take item
Integer item = buffer[oldest];
buffer[oldest] = null;
oldest = (1 + oldest) % buffer.length;
... |
f2b7b249-8e98-43af-ba7d-ad25c7d58d68 | 9 | public boolean paretoDominates(MultiObjectiveFitness other)
{
boolean abeatsb = false;
if (maximize != other.maximize)
throw new RuntimeException(
"Attempt made to compare two multiobjective fitnesses; but one expects higher values to be better and the other expectes ... |
181d0ed7-9a26-4060-b8fc-b66010511094 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;... |
9220474a-dd7f-438f-bd46-38d2538fe1ef | 4 | public boolean isLetter()
{
return !eof && ((value >= 'a' && value <= 'z') || (value >= 'A' && value <= 'Z'));
} |
72b3b62c-3cbd-4583-accd-b2348f75f88f | 0 | public String getBlogContentLable() {
return this.blogContentLable;
} |
d3619b22-9c2b-413d-9fc0-34959187cc58 | 7 | public static int editDistance(String s1, String s2) {
if(s1 == null || s2 == null) {
return -1;
}
int[][] distance = new int[s1.length()+1][s2.length()+1];
for(int i = 0; i<= s1.length(); i++) {
distance[i][0] = i;
}
for(int i = 0; i<= s2.lengt... |
cb22a875-104b-45b9-959b-825c518056f9 | 0 | public static void main(String[] args)
{
QueueList queu = new QueueList();
queu.put("one");
queu.put("two");
queu.get();
// System.out.println(queu.get());
queu.put("three");
System.out.println(queu.get());
System.out.println(queu.get());
System.out.println(queu.isEmpth());
} |
643fce8c-0901-4e25-b53a-dc42285b22ec | 2 | public double getKiihtyvyys2Y() {
double res = 0;
if(getNappaimenTila(YLOS2)){
res -= KIIHTYVYYS;
}
if(getNappaimenTila(ALAS2)){
res += KIIHTYVYYS;
}
return res;
} |
3acb5877-6a0d-40df-a387-7ef684e49c08 | 7 | @Override
public void mousePerformed(String action, double x, double y) {
if (x < width * Cell.CELL_WIDTH && y < height * Cell.CELL_HEIGHT && x >= 0 && y >= 0) {
if (action.equals("pressed")) {
if (setChar) {
charX = (int) x - 20;
charY = (int) y - 5;
setChar = false;
}
}
if (action.e... |
6a29c4bc-f0be-4ee2-8749-9a116cd708aa | 8 | public boolean bodyCall(Node[] args, int length, RuleContext context) {
checkArgs(length, context);
BindingEnvironment env = context.getEnv();
Node n1 = getArg(0, args, context);
Node n2 = getArg(1, args, context);
if (n1.isLiteral() && n2.isLiteral()) {
Object v1 = n... |
cc7f3a3c-bf88-4561-981b-60cf9ebda983 | 1 | public MuokkaaHenkiloJDialog(ElokuvarekisteriUI parent, boolean modal, int id) {
super(parent, modal);
muokattavaId = id-1;
initComponents();
Henkilo henkilo = this.henkilomalli.getHenkiloAt(id);
EtunimiTextField.setText(henkilo.getEtunimi());
SukunimiTe... |
29cc9d8a-d84b-4f35-a63d-14488a625d1c | 3 | @Override
public boolean isReadOnly(String key) {
if (isReadOnly != null) {
if (key == null) {
key = "";
}
Boolean b = (Boolean) isReadOnly.get(key);
if (b != null) {
return b.booleanValue();
}
}
return false;
} |
47417beb-d14d-4990-b660-6e3aeb4e237c | 6 | public ArrayList shoppingCartt() {
ArrayList al = new ArrayList();
Query n = em.createQuery("SELECT t from SHSMember t");
System.out.println(username);
for (Object o : n.getResultList()) {
SHSMemberEntity s = (SHSMemberEntity) o;
System.out.println("test: " + s.g... |
fb688fc0-5fa3-4786-92ac-2f5104eb4163 | 9 | public boolean canBeMade(){
if(type2==null&&type3==null){
if(Screen.inventory.typeCount(type1)>=count1){
return true;
}
}
else if(type3==null){
if(Screen.inventory.typeCount(type1)>=count1&&Screen.inventory.typeCount(type2)>=count2){
... |
88966913-a162-4fc2-aeeb-7e407b00c70d | 0 | protected JPanel initInputPanel() {
JPanel bigger = new JPanel(new BorderLayout());
JPanel panel = new JPanel();
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
panel.setLayout(gridbag);
c.fill = GridBagConstraints.BOTH;
c.weightx = 0.0;
panel.add(new JLab... |
c8dbf752-a55c-4de9-abef-8a8071c1a07e | 7 | public void act()
{
if (Greenfoot.mouseMoved(this) || Greenfoot.mouseDragged(this))
overThis = true;
else if (Greenfoot.mouseMoved(null) || Greenfoot.mouseDragged(null))
overThis = false;
if (Greenfoot.mousePressed(this))
{
boolean f = focus;
... |
17cf136e-56df-4e56-9c41-b1b9730edcdc | 8 | void sprawdzPerki(Postac player){
boolean flag=true;
for(int i=0;i<11&&flag;i++){
for(int j=0;j<15&&flag;j++){
if(player.x<j*50+74&&player.y<i*50+74){
if(plansza[j][i]==2){
plansza[j][i]=0;
}
if(plansza[j][i]==3){
plansza[j][i]=0;
}
flag=false;
... |
4e53eba3-ec93-4941-8617-10add31b0d98 | 5 | private static void parseCommandLineArgs(String[] _args) {
//Process String[] args for passed in parameters. You can set them up however
// you wish but for this example all parameters have the prefix "--dg"
// Like this: --dgExampleInt
//First this we want to do is loop through each string...
for(String s... |
1d786745-4f94-49a8-8e7c-abeae8703c42 | 8 | @EventHandler
public void onEntityDeath1(org.bukkit.event.entity.EntityDeathEvent event) {
org.bukkit.entity.Entity ply = event.getEntity();
if(event.getEntity().getLastDamageCause() instanceof org.bukkit.event.entity.EntityDamageByEntityEvent){
org.bukkit.entity.Entity dmgr = ((org.bukkit.event.entity.EntityDa... |
4e905c1b-29c3-40bd-b837-7e2f530cec5c | 9 | public static UBytePtr palette_recalc_16_static() {
int i, color;
int did_remap = 0;
int need_refresh = 0;
//memset(just_remapped,0,Machine->drv->total_colors * sizeof(unsigned char));
for (int mem = 0; mem < Machine.drv.total_colors; mem++) {
just_remapped.write(mem... |
ee3d87b6-ffde-4515-a090-08c1fd0c3607 | 2 | private HantoPlayerColor whoseTurnIsIt() {
HantoPlayerColor color;
// determine which player is making a move
if (turnCount % 2 == 0) { // on even turns, the color movesFirst moves
color = movesFirst;
}
else { // on odd turns, the color opposite of movesFirst moves
if (movesFirst == HantoPlayerColor.BLU... |
655af68e-27d2-4b50-b93f-f76472c631c8 | 5 | private void removeDragTransfer(Transfer transfer){
if (dragTypes.length == 1) {
dragTypes = new Transfer[0];
} else {
int index = -1;
for(int i = 0; i < dragTypes.length; i++) {
if (dragTypes[i] == transfer) {
index = i;
break;
}
}
if (index == -1) return;
Transfer[] newTypes = new Transfer... |
142a171a-0fa7-4c17-b74d-43d290da49f7 | 7 | public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5)
{
StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4);
int var7;
for (var7 = par1Random.nextInt(3) + 2; var7 > 0; --var7)
... |
7bcb03d0-d5fe-4411-81b6-392df2b65712 | 0 | public EsteenTyyppi getOsuikoJohonkin() {
return osuikoJohonkin;
} |
d5653193-fa21-489b-ad2a-922cf3e47f92 | 6 | public void advanceToContig(String contig) {
if (contig.equals(currentContig)) {
return; //Already there
}
if (! contigMap.containsKey(contig)) {
throw new IllegalArgumentException("Unrecognized contig name : " + contig);
}
if (DEBUG)
System.err.println("Advancing to contig : " + contig);
... |
8f400805-0ff9-4734-bf52-dd14896e299d | 4 | public boolean isIdentity() {
if (x == 0 && y == 0 && z == 0 && w == 1)
return true;
else
return false;
} |
8726d878-c979-4899-82be-ef250eaee45c | 8 | protected EARMARKChildNode getPreviousSibling(EARMARKChildNode node) {
EARMARKChildNode result = null;
Iterator<EARMARKHierarchicalNode> ite = parentMap.get(node).iterator();
while (result == null && ite.hasNext()) {
Collection collection = childMap.get(ite.next());
if (
collection.getCollectionType... |
c5171476-9764-4088-82bd-44079ba5ef62 | 8 | private Object getAggregationQuery(final Aggregate aggregation) {
switch (aggregation.getAggregationOperation()) {
case GEO_NEAR:
return this.getGeometrySpecifiers(((GeoNearAggregate) aggregation).getGeometrySpecifier());
case MATCH:
return this.getMatchQuery(((MatchAggre... |
9a556e58-8e2e-4891-a447-ae8021dd3d61 | 4 | private long getCPtrAddRefBitcoinAcct(BitcoinAcct element) {
// Whenever adding a reference to the list, I remove it first (if already there.)
// That way we never store more than one reference per actual contained object.
//
for(int intIndex = 0; intIndex < elementList.size(); intIndex++)
{
Object theObject = e... |
7870d683-8ff3-42e6-9654-5ce4fde40655 | 1 | private JPanel createOverlay() {
return new JPanel() {
@Override
protected void paintComponent( Graphics g ) {
for( GraphPaintable paintable : paintables ) {
Graphics2D g2 = (Graphics2D) g.create();
paintable.paintOverlay( g2 );
g2.dispose();
}
}
};
} |
58313ea8-3107-4594-8e5e-f4f43db633a1 | 3 | public static void goToUpdate() {
if (NEW_VERSION_AVAILABLE && Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(UPDATE_URL));
} catch (Exception exception) {
WindowUtils.showError(null, exception.getMessage());
}
}
} |
ff6e8a7b-3aee-4898-ac3b-acd59b2161be | 8 | public LinkedList<Dimension> encontrarCamino(int[] posCasillaInicial, int[] posCasillaFinal){
if(tablero == null)
return null;
listaAbierta.clear();
listaCerrada.clear();
tablero.resetVisitada();
Nodo nodoInicial = new Nodo(null, null,posCasillaInicial,0);
Nodo nodoFinal = new Nodo(null, null,posCasillaFina... |
2b79c833-aa78-49ac-819e-5873dfd2fa69 | 0 | public void setDepth(int depth)
{
this.depth = depth;
} |
68ca2ee9-7f13-4e56-b2bd-1daf935e206a | 9 | public void sendPrivateMessage(List<Client> targets, String message,
Channel channel, boolean fromGame) {
if (!fromGame
&& channel.getGame() != null
&& !channel.getGame().parsePrivateMessage(targets, message,
this)) {
return;
}
message = KCodeParser.parse(message, !isModerator(), 5, 10, 20);
... |
e942ff19-e8bf-42db-8b48-94e9076d2c09 | 8 | public static int dfs() {
Stack<Point> pila = new Stack<Point>();
pila.add(new Point(0, 0));
while (!pila.isEmpty()) {
Point temp = pila.pop();
if (temp.x < 0) {
temp.x = temp.x * -1 + 500;
}
if (temp.y < 0) {
temp.y = temp.y * -1 + 500;
}
for (int i = 0; i < varX.length; i++) {
if (... |
8ef2d892-37f8-476f-b819-48c33f6bc0dc | 5 | private WorkerHeartbeatResponse handleHeartbeat(WorkerHeartbeat hb) {
WorkerHeartbeatResponse response;
if(hb.getTask() != null && hb.getTask().getPercentComplete() < 100) {
parentTT.updateTaskStat(hb.getTaskId(), hb.getTask());
//Indicates that this worker is not free
setCurrentTask(hb.getTask());
/... |
886e0db8-d960-42b7-a699-f20abe854e23 | 0 | public void setImie(String imie) {
this.imie = imie;
} |
d93b1f95-a254-4835-b367-d95b641028ee | 2 | private void printSTNode(STNode<Key, Value> x)
{
for (int i = 0; i <= x.h; i++)
System.out.print("\t");
if (x.color)
System.out.print("\t");
System.out.println(x.key);
} |
e7355e41-f1dc-4760-b977-69e3701d00f5 | 3 | @Test
public void testNumberOfDoorways()
{
int numDoors = 0;
int totalCells = board.getNumColumns() * board.getNumRows();
Assert.assertEquals(506, totalCells);
for (int row=0; row<board.getNumRows(); row++)
for (int col=0; col<board.getNumColumns(); col++) {
BoardCell cell = board.getBoardCell(row, co... |
5a0568a6-726f-42dc-b766-1d77672bae9b | 2 | private void push(JSONObject jo) throws JSONException {
if (this.top >= maxdepth) {
throw new JSONException("Nesting too deep.");
}
this.stack[this.top] = jo;
this.mode = jo == null ? 'a' : 'k';
this.top += 1;
} |
39f4c4bc-162c-4eae-a76f-387c7cf9eb74 | 5 | public static boolean isOurWhitespace( char c )
{
return c == ' ' ||
c == '\b' ||
c == '\f' ||
c == '\r' ||
c == '\n' ||
c == '\t';
} |
08575808-2326-417b-8ae1-68436617c532 | 6 | public static String escape(String string) {
char c;
String s = string.trim();
int length = s.length();
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' || c == '=' || ... |
52a42108-b5f5-4af2-84c4-28aa6870b7e8 | 1 | public Backend()
{
scr = new Scanner(System.in);
data = new WeightedAdjMatrixGraph();
distances = new int[17];
connections = new Pair[17];
connections[0] = new Pair<>("SEA","SFR");
distances[0] = 808;
connections[1] = new Pair<>("SEA","CHI");
distances... |
b044fc3b-3436-46eb-9233-887d45d2f4fc | 2 | public Element parseXMLFile(String xmlFileName){
try{
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(new File(xmlFileName));
return doc.getRootElement();
}catch (IOException e) {
System.err.println(e);
return null;
}catch (JDOMException e) {
System.err.println(e);
retu... |
093afedf-8a0a-4b85-abd9-fd7c627147ec | 1 | public void accept(NodeVisitor visitor) {
visitor.visitApplication(this);
for (ClassNode c : classes) {
c.accept(visitor);
}
} |
a3f9e784-3ce8-4e36-be2c-9e2ece8c5247 | 4 | private final RowData calculateRowData(String s) {
int i = -1;
int indicePos = 0;
int[] indicePositions = new int[s.length()];
int totalWidth = 0;
int maxHeight = 0;
for (char c : s.toCharArray()) {
i++;
indicePos = availableChar.indexOf(c);
// if it wasn't found within the char array
if (indice... |
81ef3853-82f8-4dc4-9515-01e95c91d3c6 | 2 | public void initListeners() {
plugin.getServer().getPluginManager().registerEvents(signs, plugin);
plugin.getServer().getPluginManager().registerEvents(death, plugin);
plugin.getServer().getPluginManager().registerEvents(guard, plugin);
plugin.getServer().getPluginManager().registerEvents(damage, plugin);
plu... |
41fe9a5d-f86e-40f4-8c12-3cc5b1223ad7 | 1 | public static S3Object uploadFile(File file, S3Bucket s3bucket, RestS3Service s3service) throws Exception{
S3Object s3objectRes = null;
try {
s3objectRes = s3service.putObject(s3bucket, new S3Object(file));
} catch (S3ServiceException e) {
e.printStackTrace();
}
return s3objectRes;
} |
789cff76-9cee-423b-99b9-5819519f1565 | 5 | public static void main(String[] args) throws IOException, InterruptedException {
System.out.println("Started pxchat server...");
if (args.length > 0) {
configFilename = args[0];
}
if (!loadConfig())
return;
System.out.println("Listening on Port " + port);
Runtime.getRuntime().addShutdownHook(ne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.