method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5fd5ede9-890b-40fa-8fb1-9860cf8a718f | 4 | public void run() {
if(seconds == 0){
ArenaSetupEvent event = new ArenaSetupEvent(a);
Bukkit.getServer().getPluginManager().callEvent(event);
new ArenaSetupRunnable(plugin, 40, a);
for(String s : a.getPlayers()){
Bukkit.getPlayerExact(s).teleport(a.getSpawn());
}
Bukkit.getScheduler().cancelTask... |
535a2ad6-bb9b-405e-9643-bd61f3465364 | 4 | public void visitTypeInsn(final int opcode, final String type) {
Type t = Type.getObjectType(type);
switch (opcode) {
case Opcodes.NEW:
anew(t);
break;
case Opcodes.ANEWARRAY:
newarray(t);
break;
case Opcodes.CHECKCAST:
checkcast(t);
break;
case Opcodes.INSTANCEOF:
instanceOf(t);
bre... |
3e8e7c2b-170d-4290-974f-8771fc01f21b | 5 | @Override
public void receive(Object message) {
if (!(message instanceof String)) {
log.severe("Unknown message format. Can't receive information");
return;
}
MACKInformation info = MACKProtocolFactory
.parseMessage((String) message);
if (info == null) {
log.severe("Message was invalid");
retur... |
fd44000d-9a56-4348-9871-f0429d9fe3cf | 2 | public void sendMessage(String message, String playerName)
{
for (Player p : server.players)
if(p.username == playerName)
p.sendMessage(message);
} |
9825ce86-e5ce-44c2-a30e-942f18383740 | 1 | public void addAccount(BankAccount account) throws IllegalArgumentException {
if (! canHaveAsAccount(account))
throw new IllegalArgumentException();
accounts.add(account);
} |
7185e364-6b7f-4f66-8bce-b04b6043e306 | 9 | @Override
public void keyPressed(KeyEvent e) {
dir = e.getKeyCode();
if (previousKey == dir && doubleCount == 1 && (dir == KeyEvent.VK_LEFT || dir == KeyEvent.VK_RIGHT)) {
incr = STDINCR * 2;
endTime = System.currentTimeMillis();
if (endTime - startTime < 200) {
... |
45321d70-0610-4f15-9a6c-7377b6f08337 | 8 | public void writeProperties() {
List<Display> displays = defaultDisplayPane.getOpenDisplays();
//First see if we the location of the user properties file is in
//the props file itself
String propsPath = props.getProperty("this.path");
String fileSep = System.getProperty("file.separa... |
522f6700-f6d4-45c7-85a8-c9a0e7231d8f | 9 | public void reverseNotes() {
final ArrayDeque<String> headReversed = new ArrayDeque<>();
final ArrayDeque<AbcEvent> notesReversed = new ArrayDeque<>();
int lineIdx = 0;
boolean head = true;
while (lineIdx < lines.size()) {
final String line = lines.get(lineIdx++);
if (notesRaw.get(0) == line) {
brea... |
d86c4ee1-5a67-477f-a9df-23e1aa926e3d | 9 | private void init(AppAction a, final String iconKey, boolean showText) {
enablePlasticWorkaround = UIManager.getLookAndFeel().getClass().getName().startsWith("com.jgoodies.looks.plastic.");
setAction(a);
addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent e) {
... |
89a3bf86-42ee-4511-b45a-5ba46285e69c | 9 | @Override
public void initializeClass()
{
super.initializeClass();
for(final Enumeration<Ability> a=CMClass.abilities();a.hasMoreElements();)
{
final Ability A=a.nextElement();
if(A!=null)
{
final int level=CMLib.ableMapper().getQualifyingLevel(ID(),true,A.ID());
if((!CMLib.ableMapper().getDefa... |
f01fe88d-1871-421d-a0a9-9ced53c5802a | 0 | public LocalDate getDate() {
return this._date;
} |
3324f498-e4be-47e9-91c0-8c6f36647e16 | 5 | public static boolean isPrime(int x) {
if (x == 2) {
return true;
}
if (x % 2 == 0 || x == 1) {
return false;
}
for (int i = 3; i * i <= x; i += 2) {
if (x % i == 0) {
return false;
}
}
return true;
} |
dcf2e875-bc1f-4ef4-935e-bdcceac943c8 | 6 | private double calculateTheta(Ball b1, Ball b2) {
// TODO Auto-generated method stub
double theta = 0;
double xComp = b1.x - b2.x;
double yComp = b1.y - b2.y;
if(xComp > 0) {
theta = Math.atan(yComp/xComp);
return theta;
}else if(xComp < 0){
theta = Math.atan(yComp/xComp) + Math.PI;
return thet... |
594862ba-0825-4853-87db-ac3834f1701f | 3 | private static int getNumberOfColumns(Alignment layoutMap) {
List<Integer> keys = new ArrayList<Integer>(layoutMap.keySet());
Collections.sort(keys);
int columnsNum = 0;
for(int key : keys) {
Read current = layoutMap.get(key);
int minusOffset = columnsNum;
if (current.getOffset() <= columnsNum) {
m... |
ebe70ef3-e14e-486d-a65b-dee6461fc135 | 7 | private LocationProfile parseToLatestReview(Document document,
String contextPath) throws CitysearchException {
LocationProfile response = null;
if (document != null && document.hasRootElement()) {
Element locationElm = document.getRootElement().getChild(LOCATION);
if (locationElm != null) {
response =... |
53b5e6ea-7a80-4f04-b543-ac7c559a3b85 | 1 | public void testSetPeriod_RP2() {
MutablePeriod test = new MutablePeriod(100L, PeriodType.millis());
try {
test.setPeriod(new MutablePeriod(11, 12, 13, 14, 15, 16, 17, 18));
fail();
} catch (IllegalArgumentException ex) {}
assertEquals(0, test.getYears());
... |
0267b330-d8fa-475f-b703-309007e6d8c6 | 8 | @Override
public int compareTo(Edge<V, E> e2) {
if(e2 == null)
return -1;
int labelComparision = getLabel().compareTo(e2.getLabel());
if(labelComparision!=0)
return labelComparision;
Vertex<V,E> destination1 = getDestination();
Vertex<V,E> destination2 = e2.getDestination();
if(destination1 == null &... |
d6434140-448c-4dc6-91be-5127eab55e14 | 5 | protected static boolean implementsAllIfaces(ClassInfo clazz,
ClassInfo[] ifaces, ClassInfo[] otherIfaces) {
big: for (int i = 0; i < otherIfaces.length; i++) {
ClassInfo iface = otherIfaces[i];
if (clazz != null && iface.implementedBy(clazz))
continue big;
for (int j = 0; j < ifaces.length; j++) {
... |
ed6c0990-0d62-45f2-acc3-93e547e6f12f | 5 | public String syncRequest(String url, String httpMethod, OauthKey key,
List<QParameter> listParam, List<QParameter> listFile)
throws Exception {
if (url == null || url.equals("")) {
return null;
}
OAuth oauth = new OAuth();
StringBuffer sbQueryString = new StringBuffer();
String oauthUrl = oauth.get... |
0f5a39c0-c78e-4d7c-946c-861c0be76f22 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
b6d7b6de-4e3a-4eb0-baf7-9c18daefe838 | 1 | public void addFrameElementWithIDRef(String frameElementName, String idref) {
//TODO: check
FrameElement frameElement = frameElements.get(frameElementName);
if(frameElement==null){
frameElement = new FrameElement(frameElementName);
}
frameElement.addIdRef(idref);
frameElements.put(frameElementName, frame... |
86759418-67eb-4dbd-90a7-29f3884f94da | 8 | private int getEquipment(int fish) {
if (fish == 317) //shrimp
return 303;
if (fish == 335) //trout + salmon
return 309;
if (fish == 337) //lobs
return 301;
if (fish == 361)//tuna
return 311;
if (fish == 7944)//monks
return 303;
if (fish == 383)//sharks
return 311;
if (fish == 389)//mant... |
74cac65e-8412-45a1-8e1d-e42aa2938cdb | 8 | public Server() {
//Creating window
addWindowListener(this);
JTextArea serverLog = new JTextArea();
JScrollPane scrollPane = new JScrollPane(serverLog);
add(scrollPane, BorderLayout.CENTER);
setSize(300,300);
setTitle("Battleships Server");
setVisible(true);
try {
//Server Socket on por... |
b45e6750-21da-4623-9bcd-bb03b9e0bd26 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
GenericTreeNode<?> other = (GenericTreeNode<?>) obj;
... |
41f15bc2-2455-4f19-9036-ec40ed53587f | 8 | public void rotate_all(Draw panel, int angulo, Color bg_color){
Ponto ref = new Ponto(panel.getWidth()/2,panel.getHeight()/2);
circulos_desenhados_aux = new LinkedList<Circulo>();
circulos_desenhados_aux.addAll(ctrCirculo.circulos_desenhados);
for (Circulo c : circulos_desenhados_aux) {
figura_selecion... |
ed688f86-5551-44f5-b68a-46a91d268090 | 8 | private void parseArray(String[] nodesList) {
if (nodesList == null || nodesList.length < 1) {
throw new IllegalArgumentException("nodesList is null or empty");
}
if (node0 == null) {
node0 = parseNodeString(nodesList[0]);
}
nodesMap = new LinkedHashMap<... |
d8810e79-836b-4e7b-bdbb-751b657068c7 | 7 | private ByteBuffer generateStandardHeaderResponse(HTTPRequest request, HTTPStatus status, Map<HTTPHeader,String> headers, DataBuffers response) throws HTTPException
{
final StringBuilder str=new StringBuilder("");
final String overrideStatus = headers.get(HTTPHeader.Common.STATUS);
if(overrideStatus != null)
... |
37bbbfbe-e693-4af5-81b6-d133c1364d02 | 7 | private String getValidityResult(final String s) {
String res = "";
boolean isValid = true;
if ((s.length()<5) || (s.length()>10)) {
return MSG_FAIL;
}
if (s.contains(" ")) {
return MSG_FAIL;
}
if (!s.matches(".*[0-9].*")) {
return MSG_FAIL;
}
if (!s.matches(".*[A-Z].*")) {
re... |
e9a522c7-46fa-4a01-ad95-6a8d7b360fd0 | 7 | public void loadFile(String name)
{
try
{
/** create the file object */
File file = new File(name);
/** if the object is a directory */
if (file != null && file.isDirectory())
{
/** get the list of files in the directory */
... |
ce49699b-2980-468f-9ff9-0f66f58047d5 | 6 | @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Block clickedBlock = event.getClickedBlock();
if (protectableBlock(clickedBlock)) {
if (event.getPlayer().getI... |
39ef86a3-3ab0-461d-9f15-b7c00472ee0a | 0 | public RenderingEngine getRenderingEngine() {
return renderingEngine;
} |
11329fb6-1236-4de5-86cc-a7a71f94df80 | 7 | private void donneDirection (){
Coord dir = this.curent.coord.sous(this.forum.coord);
this.pointCercle = this.cible;
final int D = 0, B = 1, G = 2, H = 3;
if(dir.y > 0){ //BAS
rotation = this.cercle % 2 == 0 ? D : G;
}
else if(dir.y < 0){ //HAUT
rotation = this.cercle % 2 == 0 ? G : D;
}
else if(d... |
8c190ccd-2aaa-4faf-be91-8d8a04312d67 | 8 | public static boolean sendFiles(ArrayList<File> alFilesToSend, String FTP_Address, int FTP_Port, PrintWriter pwOut, String FTP_SERVER_TYPE)
{
try
{
if ((alFilesToSend == null) || (alFilesToSend.size() < 1))
{
return false;
}
File fle = null;
double steps = 0.0D;
t... |
91dc5ad6-9f10-41ec-a1a2-e95f7f6061e0 | 9 | public void randomlyInitializeParams()
{
//initializes the initial state parameters
double dsum = 0;
probinit = new double[numstates];
for (int ni = 0; ni < probinit.length; ni++)
{
probinit[ni] = theRandom.nextDouble();
dsum += probinit[ni];
}
for (int ni = 0; ni < probinit.length; ni++)
{
... |
fd0df646-3830-4b2b-8bd0-550d9aa96811 | 8 | String readLineWithNewline() {
// mth 2004 10 17
// for now, I am going to put in a hack here
// we have some CIF files with many lines of '#' comments
// I believe that for all formats we can flush if the first
// char of the line is a #
// if this becomes a problem then we will need to adjust
while (ich... |
c59a6bd8-753c-4ff3-92f1-0f285f6eae8f | 8 | public int sqrtBetter(int x) {
if (x < 0) {
return -1;
}
if (x == 0) {
return 0;
}
int i = 0;
int j = x;
while (i < j) {
int m = (j - i) / 2 + i;
int m1 = x / (m + 1);
int m2 = x / (m + 1 + 1);
if (m + 1 == m1) {
return m + 1;
}
if (m + 1 + 1 == m2) {
r... |
3f26cc16-d321-4dc0-81d5-054071c10a9d | 3 | @Override
public void update(SondageReponse obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("update SondageReponse set id_sondage=?, choix=?, nombreChoix=? where id=? ;");
pst.setInt(1, obj.getId_sondage());
pst.setInt(2, obj.getCh... |
c3703f58-6cd5-430f-a58d-69283e63ee27 | 6 | public static INIFile parseFile(ArrayList<String> contents){
INIFile file = new INIFile();
INISection section = null;
for(String line : contents){
//String line = data.replaceAll("\\s", "");
if(isLine(line) == false){
continue;
}
... |
b15f0c8c-98e6-4c1b-a862-620abc6551c8 | 6 | public static Node circularNode(Node head) {
Node slow = head;
Node fast = head;
while(fast != null && fast.next != null) {
slow = slow.next;
fast = fast.next.next;
if(slow == fast)
break;
}
if(fast == null || fast.next == null) {
System.out.println("No loop exists in the Linked List!");
re... |
00306826-693a-4a97-8b05-eb00d5c40409 | 3 | @Override
public void execute(ArrayList signature) {
String variableName = (String) signature.get(1);
String value = (String) signature.get(2);
if (variableName.equals(COMMAND_ENCODING)) {
Preferences.ENCODINGS.add(value);
if (VERBOSE) {
System.out.println(new StringBuffer().append(" Adding encodin... |
9f78c74f-e7fb-462d-a159-8122f68e755b | 1 | public ShaderResource()
{
this.program = glCreateProgram();
this.refCount = 1;
if ( program == 0 )
{
System.err.println( "Shader creation failed: Could not find valid memory location in constructor" );
System.exit( 1 );
}
uniforms = new HashMap<String, Integer>();
uniformNames = new ArrayList<Str... |
95dd23d5-4f03-4b8a-a5fd-375dfc050afa | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Set<MOB> h=properTargets(mob,givenTarget,false);
if(h==null)
{
mob.tell(L("There doesn't appear to be anyone here worth making invisible."));
return false;
}
if(!super.invoke(mob,c... |
c3fdbb50-7e14-435a-9e2c-13e6b54efb9b | 9 | public String TypeTamGiac(){
if(IsTamGiac()==1){
if((a==b)&&(b==c)){
return"TG_DEU";
}
else{
if((a==c)||(a==b)||(b==c)){
return "TG_CAN";
}
if((a*a+b*b==c*c)||(a*a+c*c==b*b)||(b*b+c*c==a*a))
return "TG_VUONG";
}
}
return "NULL";
} |
9484df9f-7640-44f7-96c1-5c862c373987 | 9 | public void randomWalkBioData(String[] seedNames, int nArtists, int nRelated,
String delimiter) throws EchoNestException, FileNotFoundException {
PrintWriter pw_names = new PrintWriter("data/artistNames.txt");
for(String seedName : seedNames) {
appearedArtists = new HashSet<String>(nArtists);
List<A... |
edb83ebe-1e9f-4d2a-84ad-6be9ed229b86 | 7 | private boolean canHaveAsWall(Wall newW) {
if (newW == null) return false;
if(!grid.getElementsOnPosition(newW.getPosition()).isEmpty())
return false;
for(Wall wall: getAllWallsOnGrid()){
for (Position newWp : newW.getPositions()) {
for (Position wp : wall.getPositions()) {
if (Math.abs(newWp.xC... |
ab47595a-1d36-4e12-b557-c309c1d9e332 | 4 | void handleRead() throws IOException, NoSuchAlgorithmException {
this.buffer.rewind();
int bytesRead = -1;
try {
bytesRead = this.socketChannel.read(this.buffer);
} catch(Exception ex) {}
if (bytesRead == -1) {
close();
} else if (bytesRead > 0) {
this.buffer.rewind();
if (!this.handshakeComp... |
f599e83c-8d58-4749-9ec1-5c94085c9187 | 7 | public Estimator getEstimator() {
switch (this) {
case CHEN:
return new Chen();
case EOM_LEE:
return null; // TODO: Eom-Lee incomplete!!!
case LOWER_BOUND:
return new LowerBound();
case SCHOUTE:
return new Schoute();
case VAHEDI:
return new Vahedi();
case VOGT:
return new Vogt();
case ... |
5c4454fa-1ab3-4dbe-a0f9-b23b4d28466f | 4 | boolean selfTest()
{
int k,j,i;
// loop for all the prefixes of the tree source string
for ( k=1; k<length; k++ )
{
// loop for each suffix of each prefix
for ( j=1; j<=k; j++ )
{
// search for the current suffix in the tree
int len = k-j+1;
char[] test = n... |
144f7b77-a9c3-4936-9c57-87388d6e9d4f | 1 | IdentServer(PircBot bot, String login) {
_bot = bot;
_login = login;
try {
_ss = new ServerSocket(113);
_ss.setSoTimeout(60000);
}
catch (Exception e) {
_bot.log("*** Could not start the ident server on port 113.");
return;
... |
f76409f2-df16-49bb-9e94-2ce2f4643a34 | 1 | public void addByte(final int i) {
if (ClassEditor.DEBUG) {
System.out.println(" " + codeLength + ": " + "byte " + i);
}
// The bytecode array is represented as a linked list of
// ByteCells. This method creates a new ByteCell and appends it
// to the linked list.
final ByteCell p = new ByteCell();
... |
b50f8223-d7bb-4227-878b-fa9fac994d48 | 9 | public ImageFrameEssence getDensity(ImageFrame if1) {
// 2-D boolean array
pixChecked = new boolean[if1.getWidth()][if1.getHeight()];
for(int i=0; i<if1.getWidth(); i++) {
for(int j=0; j<if1.getHeight(); j++) {
pixChecked[i][j] = false;
}
}
//int area = pixAreaItr(5, 5, if1.getRar());
//System.ou... |
2e153a3d-b2fe-4263-a99a-d462ab787289 | 3 | public void loadComponents() {
// initialize all non-disabled components
for(String component: registeredComponents.keySet()) {
if(!registeredComponents.get(component).disabled) {
try {
registeredComponents.get(component).instance = registeredComponents.get(component).clazz.newInstance();
}
catc... |
01456b10-28a3-4fdf-9586-a7daa5f74854 | 2 | public void preloadImage(String name) {
BufferedImage img = null;
if (window.imgs.containsKey(name)) {
img = window.imgs.get(name);
} else {
try {
img = ImageIO.read(window.getClass().getResource(name));
window.imgs.put(name, img);
} catch (final IOException e) {
throw new RuntimeException("R... |
598a7053-26a5-48b1-88ab-140df400ae54 | 7 | private void tableClicked(MouseEvent e) {
boolean isSelected = false;
JTable table = (JTable) source;
if (SwingUtilities.isRightMouseButton(e) || e.isPopupTrigger()) {
int row = table.rowAtPoint(e.getPoint());
int[] rows = table.getSelectedRows();
for(int i = 0; i < rows.length; i++) ... |
a5e153d6-fcb5-422c-8934-8f9fec44a515 | 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... |
b66ec345-9c47-44c9-82d8-e90bbc5b3199 | 1 | public static void initLocale(ResourceBundle localebundle) {
if (localebundle == null) {
throw new IllegalArgumentException();
}
GUIStrings.locale = localebundle;
} |
e184cf17-d348-4d3c-9cce-3273bde17da5 | 3 | private int getUserId(String name) {
for (int i = 0; i < users.size(); i++) {
User user = users.get(i);
String nameTest = " " + user.getName() + " ";
if (nameTest.contains(name) && name.contains(nameTest)) {
return i;
}
}
return -... |
b34c78b5-2d41-40d5-b9d3-850fbc3dc400 | 3 | protected void createMoreParticles(ParticleEmitter emitterDetails, float x, float y) {
int particlesToCreate = Helpers.randomBetween(emitterDetails.minimumParticles, emitterDetails.maximumParticles);
for (int i = 0; i < particlesToCreate && emitterDetails.currentParticles.size() < emitterDetails.maximumTotalParticl... |
c54342dc-d611-4e31-acd2-4921fe5a8b88 | 2 | @Override
public void run()
{
byte[] receiveData = new byte[1024];
while(true)
{
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
try {
serverSocket.receive(receivePacket);
} c... |
e9dcf193-b318-4d85-b9b9-21b8d5dbf293 | 6 | public ArrayList<Category> getAllCategory() {
ArrayList<Category> ret = new ArrayList<Category>();
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456");
st=conn.createStatement();
... |
e3289345-053f-4239-bb43-0914a2423f37 | 6 | public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... |
5c922a62-09f3-4b5e-9e82-d0eaf1cca796 | 2 | private void createActionPanel() {
JPanel panel = new JPanel();
cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
Main main = (Main) GameSettingsPanel.this.getTopLevelAncestor();
main.displayMatch();
}
}... |
e651537e-8a1b-4d81-a978-85cdb0f8ee0b | 0 | public ReferenceType createReferenceType() {
return new ReferenceType();
} |
e6178019-2253-4072-8bf2-1b07520225c5 | 3 | private ItemStack getItemStackBackwards(Item item) {
int ID = item.getID();
ItemStack stack;
for (int i = items.size() - 1; i >= 0; i--) {
stack = items.get(i);
if (stack.getItemInStackID() == ID && stack.getAmount() <= stack.getMaxStackSize())
return sta... |
852df30d-d884-4ffb-8499-5a5792dfa9da | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 70
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 70
... |
ad8c8f7d-d026-4d58-b5c0-5f82353dae35 | 9 | private boolean move(PaletteEntry entry, boolean up) {
int index = getChildren().indexOf(entry);
if (index < 0) {
// This container does not contain the given palette entry
return false;
}
index = up ? index - 1 : index + 1;
if (index < 0 || index >= getChildren().size()) {
// Performing the move ope... |
83bf9ca7-4139-4bcb-85b0-115eb8ea0a8b | 8 | public static Object conversion_t( Object source, Class<?> targetClass ) throws InstantiationException, IllegalAccessException {
Class<?> sourceClass = source.getClass();
Field[] sFields = sourceClass.getDeclaredFields();
Object oOut = targetClass.newInstance();
/* On parcourt chaque attribut */
for ( ... |
f0b46c6f-db3a-4ab1-ba00-95c421d9c211 | 8 | @Override
protected void paintEvent(QPaintEvent e)
{
Set<core.Point> visible = mission.getActivePlayer().getVisible();
QPainter painter = new QPainter(this);
QImage image = new QImage(tmap.length, tmap[0].length, Format.Format_RGB32);
int rgb;
Set<core.Point> ommit = new HashSet<core.Point>();
for (... |
01751cdd-e826-4b8c-bc3e-ca6da4e244d9 | 1 | public void highlightTargets() {
int index;
for (BoardCell target : targets) {
index = calcIndex(target.getRow(), target.getCol());
cells.get(index).setColor(Color.RED);
}
repaint();
} |
4cd32938-6e7a-47db-bf93-aa517463cb33 | 3 | public static void load() {
// extract a default config
if(!fileConfig.exists()) {
MCNSAEssentials.getInstance().saveResource("items.yml", false);
}
// load items from a config file
try {
yamlConfig.load(fileConfig);
}
catch (Exception e) {
e.printStackTrace();
}
// get our items config... |
68cd25a0-2d80-4822-8c7d-5bd7cd7703b8 | 0 | public int getFirstID(){
return first_city.getID();
} |
10ab07e3-2be1-4999-924d-1d1f001d4594 | 9 | public void GenerateSTM(UOIGUI gui){
Random rndm = new Random();
String[] columns = {"StaticMesh","Tag","Layer","bOverrideLightMapRes","OverriddenLightMapRes","bUsePrecomputedShadows",
"LightingChannels","Location","Rotation","Scale"};
Object[][] data = new Object[Integer.parseInt(gui.getStmCountField().ge... |
08c2cd7a-dc79-42c1-9178-e7f86d49a383 | 4 | public static byte[] decrypt(byte[] in,byte[] key){
int i;
byte[] tmp = new byte[in.length];
byte[] bloc = new byte[16];
Nb = 4;
Nk = key.length/4;
Nr = Nk + 6;
w = generateSubkeys(key);
for (i = 0; i < in.length; i++) {
if (i > 0 && i % 16 == 0) {
bloc = decryptBloc(bloc);
System.arr... |
4d4be649-908c-4103-a0ad-c615343cfe75 | 8 | public World(int w, int h, float scale) {
screen = new Screen(this, w, h, scale);
new Tile();
tiles = new Tile[worldSize * worldSize][layers];
for (int i = 0; i < tiles.length; i++) {
tiles[i][0] = Tile.grassTile;
tiles[i][1] = Tile.airTile;
}
for (int i = 0; i < tiles.length; i++) {
if (rand... |
559c4ac8-3909-425a-ab61-dc136e742d22 | 0 | public LocStack() {
init();
} |
b342f6ba-bf85-4353-8375-6ecd8a30c85b | 3 | public CycList<CycList<E>> combinationsOf(int n) {
if (!isProperList) {
throw new RuntimeException(this + " is not a proper list");
}
if (this.size() == 0 || n == 0) {
return new CycList<CycList<E>>();
}
return combinationsOfInternal(new CycList<E>(this.subList(0, n)),
new Cy... |
a6b9058d-6e46-479c-975e-1e1ba6aabf38 | 5 | public ArrayList<String> getFileNames(){
System.out.println("Getting all files with reads per transcripts counts. Files names finish with " + fnamePattern);
ArrayList<String> fileNames = new ArrayList<String>();
File dir = new File(dirName);
for (File ch : dir.listFiles()) {
if ... |
3f6a1298-d64e-454f-b827-f433f2e52189 | 8 | Point3f getMin() {
if (min == null)
min = new Point3f();
if (list.isEmpty()) {
min.set(0, 0, 0);
return min;
}
Object3D c = list.get(0);
if (c != null) {
min.x = c.getMinX();
min.y = c.getMinY();
min.z = c.getMinZ();
}
synchronized (list) {
int n = count();
if (n > 1) {
for (in... |
fb9c64db-57f1-4568-9801-c876048374c3 | 0 | public int hashCode(){
return mKey.hashCode();
} |
10c0eb1a-d526-405b-8ff2-9713e662de6d | 4 | public static boolean isJarURL(URL url) {
String protocol = url.getProtocol();
return (URL_PROTOCOL_JAR.equals(protocol) ||
URL_PROTOCOL_ZIP.equals(protocol) ||
URL_PROTOCOL_WSJAR.equals(protocol) ||
(URL_PROTOCOL_CODE_SOURCE.equals(protocol) && url.getPath().contains(JAR_URL_SEPARATOR)));
} |
fa93f1ce-fa4f-4601-b01d-323be868daff | 3 | public boolean hasCard(int value, int suite) {
for (Card card : hand) {
if (card.value == value && card.suite == suite) {
return true;
}
}
return false;
} |
2fd8b26d-3b3a-4f36-a38b-f21892c23890 | 2 | public void release(int num)
{
if(num >= 0 && num < seat.length)
{
seat[num] = false;
System.out.printf("%d seat is now available.",num);
}
else
{
System.out.println("invalid seat number.");
}
} |
1e7129c7-7bfb-4cd4-8e7e-1bc43adb9be1 | 3 | private void startGameLoad(int delay){
SchedulerManager.registerSingle(delay, new Runnable(){
public void run(){
if(MapData.areNewMapsToLoad()){
if(MapData.loadMapsFromConfig()) BetweenMapsRuntime.start();
else{
if(MapData.loadMapsFromConfig()) BetweenMapsRuntime.start();
else SchedulerM... |
df324d8b-c453-4fd0-ad95-440e6be50395 | 2 | @Override
protected void updateShareRates (){
for (int i = 0; i < availableShare.size(); i++){
if (availableShare.get(i) != null){
updateShareRate(availableShare.get(i));
}
}
flag++;
} |
45d3f640-2cc7-4777-b905-0a644d73d399 | 7 | private void nextYear(Team team, PlayerPtrVector allPlayers, Positions posi) {
int nofPlayers = 0;
Player player = getNextSeasFirst(allPlayers, team);
while (player != null) {
nofPlayers++;
if (player.getNation() != team.getNation()) {
posi.nofForeigners++;
}
if (player.getPosition().getPosID() ==... |
c61fbd50-2425-4674-a250-c4e0b38e7708 | 3 | public ServiceMethod getMethod(String name) {
ServiceMethod method = this.methods.get(name);
if(method == null) {
for(Map.Entry<String, ServiceMethod> entry : this.methods.entrySet()) {
String n = entry.getKey();
if(name.endsWith(n)) {
method = entry.getValue();
break;
}
}
}
re... |
51b30e1a-1e31-4862-a816-0a7e7cc48bf8 | 1 | public MAdministrador(Administrador admin) {
setModal(true);
initComponents();
if(!(admin == null)){
edtUserName.setEnabled(false);
edtUserName.setText(admin.getNombre());
jtxtPass.setText(admin.getPassword());
jlbPass.setText("Nueva Contraseña");
... |
bcaac704-b068-458d-ba2d-41eb35e2158e | 7 | public Set<Pair<T,T>> getAllPairs(Set<T> that)
{ Set<Pair<T,T>> allPairs;
if(that!=null)
{ if(this.next==null && that.next==null)
{ allPairs=new Set(new Pair(this.a,that.a),null);
}
else if(this.next!=null && that.next==null)
{ allPairs=new Set(new Pair(this.a,that.a),this.next.getA... |
e9018233-d18a-47bf-b03a-e640c4330bdb | 9 | private Layer redraw(final int z) {
final ArrayList<Sprite.Part> parts = new ArrayList<Sprite.Part>();
Sprite.Drawer drw = new Sprite.Drawer() {
public void addpart(Sprite.Part p) {
if (p.z == z)
parts.add(p);
}
};
for (Sprite s... |
63b16dc9-767a-4b80-95a6-c71b2d64b1da | 2 | @Override
public double distance(ItemBoundable a, ItemBoundable b) {
Geometry g1 = (Geometry) a.getItem();
Geometry g2 = (Geometry) b.getItem();
//and a lot of faster this way with envelope dist instead of geometry dist
double distance = g1.getEnvelopeInternal().centre().distance(g2.getEnvelopeInter... |
57847fd5-942f-4151-b7bf-f18d34f3f1c1 | 8 | void draw(Graphics g) {
int hs = 8;
setBbox(point1, point2, hs);
boolean selected = (needsHighlight() || sim.plotYElm == this);
double len = (selected || sim.dragElm == this) ? 16 : dn-32;
calcLeads((int) len);
setVoltageColor(g, volts[0]);
if (selected)
g.setColor(selectColor);
drawThickLine(g, point1, le... |
87f64d85-5271-46ce-8d83-8c15e4fe76ac | 3 | @Override
public void updateLong() {
super.updateLong();
if(generationTimerEnd == 0) {
resetGenerationTimer();
}
if(generationTimerEnd <= System.currentTimeMillis() && this.isActivated()) {
placeableManager.playerAddItem("Iron", 1);
... |
bdf181f3-f83f-4ac6-9c85-b1b6e002e79c | 0 | public static long nextMonth(long month) {
return month + countDayInMonth(month) * DAY_LENGTH;
} |
a83053b5-ff03-41a5-8229-06ad0a8230eb | 3 | public void itemExpanded(TreeItem item){
super.itemExpanded(item);
if(item instanceof DatabaseTreeItem){
DatabaseTreeItem dataItem = (DatabaseTreeItem) item;
DataEditorTreeItem data = (DataEditorTreeItem) dataItem.editorData;
data.expanded = true;
}
... |
d704a4fc-7240-4cfc-bde0-024fb3f3a87e | 0 | public void f() {
System.out.println("public f()");
} |
080ce235-37c1-40f1-83c6-421924d893f7 | 7 | private String assemblePath(List list) {
if (list == null) {
return null;
}
StringBuffer buf = new StringBuffer();
if (this.is_absolute_path && (path != null && path.length() > 0)) {
buf.append(PATH_DELIM);
}
for (int i = 0; i < list.size(); i++) {
String segment = (String) list.get(i);
... |
906163af-cdaf-40a3-b718-d132335b41a6 | 8 | @Override
public void actionPerformed(ActionEvent e) {
try {
if (e.getSource() == this.view.getJbErrorLift()) {
Shared.getInstance().getLock().lock();
Shared.getInstance().setFlagliftAndNotify(Flag.RED);
} else if (e.getSource() == this.view.getJbError... |
41bae4f9-a533-4e36-a57b-cb39a0b0f8ae | 9 | public static String makeTesnseEomi(String preword, String endword) {
if(preword==null||preword.length()==0) return endword;
if(endword==null||endword.length()==0) return preword;
if(endword.charAt(0)=='ㅆ') {
return preword.substring(0,preword.length()-1)+
MorphUtil.makeChar(preword.charAt... |
ef4aca20-a58c-4e9b-acbc-8aef42fe0dde | 1 | public void create(Openchatroom entity) {
EntityManager em = PersistenceManager.createEntityManager();
try {
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
} finally {
if (em.getTransaction().isActive())
em.getTransaction().rollback();
em.close();
}
} |
b68894aa-a24c-4ebc-8421-ec5cb484536f | 9 | @Override
public void doGet(SimpleServletRequest request, SimpleServletResponse response)
{
try
{
response.setMimeType(MIMEType.All.html.getType());
final File pageFile=new File("web.log");
if((!pageFile.exists()) || (!pageFile.canRead()) || (pageFile.length() > Integer.MAX_VALUE))
throw HTTPExceptio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.