method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5f36d438-ce0c-40e0-a33f-4417c223fe8f | 7 | public static void main(final String[] args) {
try {
final NameServerModule module = new NameServerModule();
// Parse the command line options
final Options options = new Options();
options.addOption("?", "help", false,
NameServer.BUNDLE.get... |
cdd2feae-d2db-4666-8164-f37aa05d2237 | 3 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
if (ignore || (request.getCharacterEncoding() == null)) { //如果为空先从web.xml中得到
String encoding = selectEncoding(request);
if (encoding != null){
... |
27e3bc4c-71b2-42f2-a1a3-a93c45f24e28 | 9 | protected static Ptg calcDSum( Ptg[] operands )
{
if( operands.length != 3 )
{
return new PtgErr( PtgErr.ERROR_NA );
}
DB db = getDb( operands[0] );
Criteria crit = getCriteria( operands[2] );
if( (db == null) || (crit == null) )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
int fNum = db.findCol... |
d975b416-4791-4b10-989b-19522b43d1e7 | 3 | public boolean send(String line) {
try {
out.write(line +"\r\n");
out.flush();
if (regLevel == 1) { // not registered
Message m = p.parse(new StringBuffer(line));
if (m.getCommand().equalsIgnoreCase("NICK"))
nick = m.getParams()[0].trim();
}
return true;
} catch (Exception exc) {
exc.... |
d0a9076a-b3a3-4c11-9783-50cc48774253 | 9 | private void confirmDateAMPM(String TheDate, Calendar D)
{
try
{
if(TheDate.trim().endsWith("PM"))
{
if(D.get(Calendar.AM_PM)==Calendar.AM)
D.set(Calendar.AM_PM,Calendar.PM);
if(D.get(Calendar.AM_PM)==Calendar.AM)
D.add(Calendar.HOUR,12);
if(D.get(Calendar.AM_PM)==Calendar.AM)
D.se... |
904aab45-6105-4c23-aaf0-528b859e18a1 | 6 | static public void play(String filename) {
if (filename == null)
return;
// stop
if (musicfile != null && !musicfile.equals(filename))
stop();
musicfile = filename;
int p = musicfile.lastIndexOf(".");
String ext = musicfile.toLowerCase().substring(p);
if (ext.equals(".mid") || ext.equals(".midi")) ... |
3ae88b58-29a2-4c44-b51b-e6fb4098c5e3 | 6 | public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)parent.getLayout();
} ... |
99b1ffe3-1872-41e5-ae7c-e297eb0a77e3 | 0 | public SkillSet(int numOfSkills)
{
this.numOfSkills = numOfSkills;
skillNames = new String[numOfSkills];
skillValues = new int[numOfSkills];
skillCosts = new int[numOfSkills];
skillDescriptions = new String[numOfSkills];
} |
f5a2d8ee-3dfa-44e8-beb3-99c5ad311d8e | 1 | private void LoginBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LoginBtnActionPerformed
//Get entered username and password
String uName = UserNameField.getText();
char[] pwd = PasswordField.getPassword();
String pwds = new String(pwd);
//Try to get use... |
a2bab347-1305-4efb-9e26-b70ea60441b1 | 3 | @Override
public void run() {
super.run();
while (health > 0) {
long time = System.currentTimeMillis();
update();
time = (1000 / start.FPS) - (System.currentTimeMillis() - time);
if (time > 0) {
try {
Thread.sleep(time);
} catch (Exception e) {
}
}
}
endGame(false);
} |
31e13215-242b-4f8f-bad5-86701543261a | 4 | public void gridletResume(int gridletId, int userId, boolean ack)
{
boolean status = false;
// finds the Gridlet in the execution list first
int found = gridletPausedList_.indexOf(gridletId, userId);
if (found >= 0)
{
// removes the Gridlet
ResGridlet... |
5b535004-668c-4ca9-bc8c-cc95fd386652 | 1 | public CtClass[] getInterfaces() throws NotFoundException {
String[] ifs = getClassFile2().getInterfaces();
int num = ifs.length;
CtClass[] ifc = new CtClass[num];
for (int i = 0; i < num; ++i)
ifc[i] = classPool.get(ifs[i]);
return ifc;
} |
08273b71-76de-4302-9538-07341a5d0579 | 7 | public static void main(String[] args) {
try {
Options clOptions = getCommandLineOptions();
CommandLine cl = parseCommandLine(args, clOptions);
if( !requiredOptionsSetted(cl) || helpOptionSetted(cl) ) {
showHelpAndExit(clOptions);
}
E... |
1a67cc40-962b-498e-a8f7-71c9d4247b93 | 2 | private void indentLine (int indent, String m)
{
for (; indent > 8; indent -= 8)
System.out.print ('\t');
for (; indent > 0; indent -= 1)
System.out.print (' ');
System.out.println (m);
} |
8f6ecb5f-d2b0-4d04-964f-adce105f6610 | 1 | @Override
protected String fetchArticleHtml(HtmlPage page, List<IResource> resources) {
HtmlDivision articleDiv = (HtmlDivision) page.getElementById("content");
HtmlElement head = page.getFirstByXPath("/html/head");
StringBuilder newHtml = new StringBuilder();
newHtml.append("<html>"... |
d6beb45e-7c73-4ac6-85fc-ba380ce282a4 | 5 | public static BaseFractalAlgorithm getByName(String name) {
Set<Class<? extends BaseFractalAlgorithm>> algorithms = getSubClasses();
BaseFractalAlgorithm result = null;
try {
// Find an algorithm with a matching name and return a new instance
// of it
... |
1ee71641-6c31-4b3b-99a4-6ffe913d3a1b | 2 | public static ArrayList<Atributos> sqlSelectTodos()
{
ArrayList<Atributos> attr = new ArrayList();
if(!BD.getInstance().sqlSelect("select * from atributos ")){
return attr;
}
while(BD.getInstance().sqlFetch()){
attr.add(new Atributos(BD.getInstance().g... |
3f812d61-a789-4e8f-a46f-3ace17bfc8a5 | 0 | @Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
} |
f5049587-147e-400e-8841-16148223dcf8 | 3 | public static String sortedOrder(String s) {
byte b[] = s.getBytes();
byte temp;
for (int i = 0; i < b.length; i++) {
for (int j = i; j < b.length; j++) {
if (b[i] > b[j]) {
temp = b[i];
b[i] = b[j];
b[j] = temp;
}
}
}
s = new String(b);
return s;
} |
e8b096bb-749f-4198-bc15-282fa49af046 | 2 | private void shutdownSocket() {
if (mSocket != null) {
try {
mSocket.close();
} catch (Exception exception) {
// Ignore.
}
mSocket = null;
mInput = null;
mOutput = null;
}
} |
61d57383-2239-4268-ac17-da4687a48f10 | 9 | @Override
public void put(String name, Scriptable start, Object value)
{
int info = findInstanceIdInfo(name);
if (info != 0) {
if (start == this && isSealed()) {
throw Context.reportRuntimeError1("msg.modify.sealed",
n... |
d4ce90ce-e337-4e7d-b3d8-268e072ec7ec | 5 | public void add(Entity e) {
e.init(this);
if (e instanceof Item) {
items.add((Item) e);
} else if (e instanceof Particle) {
particles.add((Particle) e);
} else if (e instanceof BackgroundParticle) {
backgroundParticles.add((BackgroundParticle) e);
} else if (e instanceof Projectile) {
projectiles.... |
049b2291-a0a8-4fef-b056-a7d266d27eb8 | 1 | public int numTokens() throws Exception {
if (!tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine().trim());
return numTokens();
}
return tokenizer.countTokens();
} |
adbc4b6c-7ff7-4b62-9f61-c6dd45c8ad07 | 7 | public void resetaPainelJogador() {
painel.setEnabled(false);
// Mutreta estupida pra conseguir remover as pecas do painel
for (int i = 0; i < painel.getComponentCount(); i++)
// garantir a remocao da primeira peca
painel.remove(i);
if (painel.getComponentCount() > 0) {
for (int i = 0; i < painel.get... |
fa992e2b-a779-4172-8adf-95a9cc7f8a13 | 5 | static String getRed5Root() throws IOException {
// look for red5 root first as a system property
String root = System.getProperty("red5.root");
// if root is null check environmental
if (root == null) {
// check for env variable
root = System.getenv("RED5_HOME");... |
d392c1fe-28fc-461a-9432-e5a7f1185faa | 9 | boolean checkRow(FieldContainer fc) {
int last=fc.getLastMove();
Character c=fc.getFields(last);
assert(null!=c);
int n = fc.getSize();
int col = (last % n);
//if first field in row
if(0!=col)
{
//check row in west direction
for(int... |
8a2e811e-0c58-4a8a-a725-881dddc43f4b | 9 | public void walk(Object root) {
if (visited.contains(root)) {
return;
}
visited.add(root);
for (EntryAction onEntryAction : onEntryActions) {
onEntryAction.onEntry(root);
}
Field[] fields = allFields(root.getClass());
for (Field field : fields) {
try {
if (!shouldTr... |
890334d0-53ce-4c9e-ae9b-6e3e35c32512 | 1 | public Animator getAnimator() {
if (_animator == null) { throw new IllegalStateException(); }
Animator returnValue = _animator;
_animator = null;
return returnValue;
} |
2ca8c804-7c4c-4a6f-b67a-ed338266a42b | 3 | /* */ @EventHandler
/* */ public void onBlockPhysics(BlockPhysicsEvent event)
/* */ {
/* 20 */ for (Map.Entry entry : PlayerListener.getPlayerMap().entrySet())
/* 21 */ if ((((Player)entry.getKey()).getWorld().equals(event.getBlock().getWorld())) &&
/* 22 */ (Main.pointDistance((this.l... |
e07cf3f5-be5d-409e-94e8-a455e2a1273f | 5 | public Vertex noSuccessor() {
Vertex noSuccessorVertex;
for (int r = 0; r < ROWS; r++) {
noSuccessorVertex = vertices[r];
int noSuccessorColumn = r;
for (int c = 0; c < COLS; c++) {
if (graph[r][c] > 0) {
noSuccessorVertex = null;
}
}
if (noSuccessorVertex != null) {
for (r = 0; r <... |
6187066d-fd2f-4093-8d81-f968676cb79d | 8 | public Set<Map.Entry<Byte,Float>> entrySet() {
return new AbstractSet<Map.Entry<Byte,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TByteFloatMapDecorator.this.isEmpty();
}
publ... |
86fe99a9-be2f-47ba-9573-42635a9cf8c1 | 1 | public boolean hasStyle(String key) {
return styles!=null && styles.containsKey(key);
} |
d5b07fee-4689-44f1-8ffd-cb46282d9b38 | 0 | public String getToolTip() {
return "State Creator";
} |
23b510e5-c6b1-4c70-9158-975a9f82ef16 | 2 | protected void executeTask(Task task, NodeInstallInformation information) throws CommandLineException, MojoExecutionException {
if (task instanceof NodeJsTask) {
NodeJsTask nodeJsTask = (NodeJsTask) task;
Commandline commandLine = getCommandLine(nodeJsTask.workingDirectory, information.executable.getAbsolutePat... |
53b3fba8-5134-45e9-8f76-352fef8cc8f8 | 0 | public synchronized boolean isOnline(String robot_name) {
return robots.get(robot_name) != null;
} |
fd3a74db-94b9-41fd-bf95-51484508347a | 8 | @Override
public void openLink(IHyperlink link) {
String linkText = link.getHyperlinkText();
if (link.getTypeLabel().equals("action")) {
if (linkText.startsWith("'") && linkText.endsWith("'")) {
// Static file, e.g. @{'/public/images/favicon.png'}
String path = linkText.substring(1, linkText.length() - ... |
d27d14f7-72c8-45ba-9671-bc52a11436a2 | 3 | public static HashMap<String, Object> fixData(HashMap<String, Object> hashMap) {
for (Entry<String, Object> entry : hashMap.entrySet())
if (entry.getKey().matches("(\\_(\\d+)\\_day\\_change|daily\\_pct\\_change)"))
hashMap.put(entry.getKey(), Double.valueOf(String.valueOf(entry.getValue()).replaceAll("\\,", ""... |
7ef1f615-190b-4239-96f7-900c7f296c70 | 4 | public void head(Node source, int depth) {
if (source instanceof Element) {
Element sourceEl = (Element) source;
if (whitelist.isSafeTag(sourceEl.tagName())) { // safe, clone and copy safe attrs
ElementMeta meta = createSafeElement(sourceEl);
... |
aace1ec1-10bb-437d-a49c-4fb726e2c293 | 8 | private void listagemAlunos() {
final Main m = new Main();
JLabel NomeAlunos = new JLabel("Alunos:", JLabel.CENTER);
String[] v5 = new String[m.alunos.size() + 1];
v5[0] = " ";
for (int i = 1; i < m.alunos.size() + 1; i++) {
v5[i] = m.alunos.get(i - 1).toStringNumero... |
93755436-e17e-41ae-93d0-5a7d48f4548b | 2 | @Override
public void handleEvent(String sender, String type, String receiver, String content) {
if (receiver.startsWith("#"))
recvChannelMsg(sender, receiver, content);
else if (content.startsWith("\001"))
recvCtcpMsg(sender, receiver, content);
else
recv... |
c5bb031e-21e5-4f22-af6f-499e0f8f0ebd | 7 | public void actionPerformed(ActionEvent e) {
//Handle split button action.
if (e.getSource() == splitButton) {
int returnVal = fc.showOpenDialog(Main.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
log.appe... |
69afe9af-f2fd-43a6-abdb-2f9ed772a7b5 | 9 | static void lsp_to_curve(float[] curve, int[] map, int n, int ln,
float[] lsp, int m, float amp, float ampoffset){
int i;
float wdel=M_PI/ln;
for(i=0; i<m; i++)
lsp[i]=Lookup.coslook(lsp[i]);
int m2=(m/2)*2;
i=0;
while(i<n){
int k=map[i];
float p=.7071067812f;
floa... |
bad7da92-9254-49ca-bb6c-efa548993595 | 9 | public void putAll(Map<? extends K, ? extends V> map) {
int size = map.size();
if (size == 0)
return;
if (size > threshold) {
if (size > MAXIMUM_CAPACITY)
size = MAXIMUM_CAPACITY;
int length = table.length;
while (length < size) l... |
209cd368-cf0e-470c-a0e5-a3d92b8d3c02 | 3 | public static String[] nameSearch(String inName) {
String[] userInfo = new String[5];
Connection c = null;
Statement stmt = null;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:Restuarant.db");
c.setAutoCommit(false);
System.out.println("Opened database successf... |
0484a857-3748-4984-a53e-50736b3cca42 | 2 | public void save(JSONObject customers){
try{
JSONArray arr = customers.getJSONArray("customers");
for(int i=0;i<arr.length();i++){
JSONObject customer = new JSONObject(arr.get(i).toString());
System.out.println(customer.toString());
System.out.println(customer.get("first_name"));
//mapper.saveCustomer... |
53fc6265-b1ce-49fc-a058-60958a9dc4e6 | 3 | public final JSONObject accumulate(String key, Object value)
throws JSONException {
testValidity(value);
Object o = opt(key);
if (o == null) {
put(key, value instanceof JSONArray ?
new JSONArray().put(value) :
value);
} else... |
2a43a31c-4e4d-49e8-ac34-93b552d127e4 | 6 | @Override
protected Result doInvoke(Invocation invocation, List<Invoker<T>> invokers, LoadBalance loadbalance) {
if (invokers == null || invokers.size() == 0) {
throw new RpcException("Failed to invoke the method " + invocation.getMethodName() + " in the service "
+ getInterface().getName() + ". ");
}
in... |
7d92ee4d-0702-4687-aad6-caf2a4ea51b4 | 1 | private void openPrivateChat(MouseEvent e) {
if ( e.getClickCount() < 2 )
return;
openChatByClick(e);
} |
ee489524-d057-4094-95ed-1035b26ccfb5 | 1 | public boolean isMoving() {
return currAction == Action.MOVE || currAction == Action.MOVE_COMMITTED;
} |
4ddac773-b100-4648-952c-4a1937f20543 | 3 | @Override
public int getLeader() {
int res = this.isSuspect(leader) ? p.pid : leader;
for (int pid : alives) {
res = Math.max(res, pid);
}
if (leader != res) {
Utils.out(p.pid, "leader : " + Integer.toString(res));
}
leader = res;
return res;
} |
229c9fee-3c0f-4e80-a0a8-5d4bd55aa5c5 | 3 | public static String booleanArray2BinaryString(boolean[] input) {
if(input == null) return null;
String result = "";
for(boolean b : input)
result += b ? "1" : "0";
return result;
} |
f7420b4f-8b29-4785-a344-0f9339abfada | 9 | private void send(Message input)
{
HashMap<String, UserInformation> temp = currentUser.getUsers();
synchronized (temp) {
if (input.getCommand().equals("\\w")) {
try {
if (temp.containsKey(input.getReceiver())) {
synchronized (temp.get(input.getReceiver()).getOutToClient()) {
... |
58a0ed6b-8d67-44fe-9217-2a36e7c47488 | 8 | public List<PotentialAction> killActions(Set<Pawn> targets) {
List<PotentialAction> actions = new ArrayList<>();
for(Pawn target : targets) {
for(Vector dir : Utils.dirs) {
Vector p = target.getLocation().add(dir);
if(!game.isVoid(p)) {
if(target.getHealth() < 2) {
actions.add(new PotentialAct... |
9434b37c-3edd-4741-a472-63d888ef26df | 2 | private List<Country> getCountryInfo(AbstractDao dao, List<LinkDirectionCountry> links) throws DaoException {
List<Country> list = new ArrayList<>();
for (LinkDirectionCountry link : links) {
Criteria crit = new Criteria();
crit.addParam(DAO_ID_COUNTRY, link.getIdCountry());
... |
874eab41-5f27-46b9-93fd-6edee94a1f7b | 2 | public static List<EntityMinecart> getMinecartsIn(World world, int i1, int j1, int k1, int i2, int j2, int k2) {
List entities = world.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBox(i1, j1, k1, i2, j2, k2));
List<EntityMinecart> carts = new ArrayList<EntityMinecart>();
... |
07405741-704c-4549-9fb1-d0ae3e41b7fa | 6 | public List<Message> getMessagesAbout(String hashtag, int nbMes){
List<Message> res = new ArrayList<Message>();
for(Message msg : recentMessages){
if(msg.getHashtags().contains(hashtag)){
res.add(msg);
}
}
int logInd = 0;
while(res.size() < nbMes && logInd < logs.size()){
List<Messag... |
27a5e013-6c18-4867-a6d3-9459b51c083f | 2 | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
String sexStr;
if (sex == Sex.Male) sexStr = "1";
else if (sex == Sex.Female) sexStr = "2";
else sexStr = "0";
sb.append(familyId + "\t");
sb.append(id + "\t");
sb.append(fatherId + "\t");
sb.append(motherId + "\t");
sb.... |
3aff941e-aae9-4c01-aecf-aec09a3770ef | 1 | public void creerLien(ZLien lien)
{
enleverFocus();
lienTemp = lien;
lienTemp.setElement(null, Constantes.MCDENTITE1);
lienTemp.setElement(null, Constantes.MCDENTITE2);
if (zliens.contains(lien))
removeLien(lien);
creationLien = true;
creationLienC... |
24b0ffbc-bff4-499a-87b0-e27cddde1643 | 0 | public MultiplePane(JSplitPane split) {
super(new BorderLayout());
add(split, BorderLayout.CENTER);
mySplit = split;
} |
95035e46-fa67-448c-a340-afba465e6056 | 4 | public void login(String nickname) throws SQLException {
if (name != null && !name.equals(nickname)) { // logging in using
// another account
logout("Ausgeloggt");
}
synchronized (channels) {
if (channels.isEmpty()) { // is logged out
Client client = Server.get().getClient(nickname);
... |
e313e709-550a-4155-bed4-e64a95d9d5c7 | 8 | private void writeJSON(Object value) throws JSONException {
if (JSONObject.NULL.equals(value)) {
write(zipNull, 3);
} else if (Boolean.FALSE.equals(value)) {
write(zipFalse, 3);
} else if (Boolean.TRUE.equals(value)) {
write(zipTrue, 3);
} else {
... |
a082a814-4816-4a3d-8aa8-6bef5401a54c | 0 | public CheckResultMessage checkF04(int day) {
return checkReport.checkF04(day);
} |
1dab30a8-6f70-4bae-9f03-1ed69ba00eee | 8 | @Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if(!CMLib.flags().isWithSeenContents(this))
affectableStats.setDisposition(affectableStats.disposition()|PhySta... |
b062b14a-a398-4434-a7f3-594540c02805 | 9 | public static boolean equal(final Paint p1, final Paint p2) {
// handle cases where either or both arguments are null
if (p1 == null) {
return (p2 == null);
}
if (p2 == null) {
return false;
}
boolean result = false;
// hand... |
dc938506-1cb3-4936-a99b-26aa99291656 | 8 | private void sendReservation(ArrayList resARList, ArrayList resNameList) {
// total reservation made.
int totalPE = 3;
int totalReservation = jobs.size() + 2; // total number of Gridlets
// wants to reserve 1 hour after the init simulation time
long time = 1 * HOUR;
... |
b53ba8d4-e4f1-4914-9ff5-1c77e242aab5 | 1 | public synchronized float get() {
if (this.last - this.reset == 0) {
return 0;
}
return this.bytes / ((this.last - this.reset) / 1000.0f);
} |
589c4b20-9327-4901-b3c2-b913da10d62c | 6 | public void dealGame(CardPanel panel) {
while (!panel.isReady()) {
try {
//Wait for graphics to render once before we deal.
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
//Ensures ... |
7045339f-4493-4ee1-9b0d-cbb760cf4567 | 5 | public static void getPlayers(){
try{
players = Integer.parseInt(JOptionPane.showInputDialog("How many HUMAN players 1-4? (AI will take any non-human spots)"));
if(players>4)
players = 4;
if(players<0)
players = 0;
}catch(Exception e){ players = 1; }
for(int i = 0; i < players; i++){
Play... |
7576dc32-deef-4e2c-837b-906b5ab531f6 | 4 | @Override
public double getValue(int row, int col) throws MatrixIndexOutOfBoundsException {
if ((row < 0) || (col < 0) || (row >= mas.length) || (col >= mas[0].length)) {
throw new MatrixIndexOutOfBoundsException("Inadmissible value of an index.");
}
return mas[row][col];
} |
aab7c5f8-7320-4eb4-88b1-56e63303a351 | 3 | public void close() {
try {
this.listening = false;
for (Socket e : sockets.toArray(new Socket[0])) {
writeTo(e, "Server Closing..");
e.close();
}
server.close();
System.out.println("Server Closed");
} catch (IOException e) {
if (!e.getMessage().equals("socket closed"))
e.printStackTra... |
ce2f771b-b504-49f0-b138-cb2b83217d14 | 5 | public static HashMap<String, String> readFile(String filePath){
HashMap<String, String> returnMap = new HashMap<String, String>();
FileReader fileInput;
BufferedReader fileReader;
try {
fileInput = new FileReader(filePath);
fileReader = new BufferedReader(fileInp... |
85525e18-3a87-44ce-b383-182d37e616ac | 6 | private void generateKeys(int keyBitSize) {
keyByteSize = keyBitSize / 8;
// Generate Primes for Q and P
do {
// Use Cores parallel, if there are more than 1
if (cores > 1) {
do {
BigInteger[] primes = getPrimesParallel(keyBitSize);
... |
9eed4efb-1cd1-4ce1-9eea-0859ed56fe78 | 3 | public boolean hit(GroupOfUnits target)
{
int c = 0;
if(type.name.equals("Wąpierz") && new Random().nextInt(10) > 6)
c = new Random().nextInt(1) + 1;
target.totalHP -= number*getAttack()*type.damageRatio(target.type)*target.type.receivedDamageRation(type)*1.0/3.0;
target.number = java.lang.Math.max(0, (int)... |
542d4bd9-4879-494a-9e6a-f51692d157f5 | 7 | private FontFile getType1Fonts(String fontName, int flags) {
FontFile font = null;
boolean found = false;
boolean isType1Available = true;
// find a match for family in the type 1 nfont table
for (int i = 0, max = TYPE1_FONT_DIFFS.length; i < max; i++) {
for (int j = ... |
43be2128-6034-4f1b-b7de-c1664f7a57d8 | 4 | protected void interruptAllWaitingReplyThreads() {
Iterator iter = waitingReplyThreads.values().iterator();
while (iter.hasNext()) {
WaitingWorkerInfo waitingWorkerInfo = (WaitingWorkerInfo) iter.next();
if (trace > API_TRACE_NONE) {
Log.current.println("Interrupting reply worker " + waitin... |
44e931bc-f5b3-4f30-aeae-3b260d04b4f6 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
btnVisiteur = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 ... |
55b93678-c1e1-4b2a-84bd-0886caf5fc72 | 1 | @Override
public void run() {
for (int i = 0; i < listeners.size(); ++i)
listeners.get(i).periodicAddonUpdate();
} |
f9c1d65c-d90b-4322-bc6e-43bb742806ca | 4 | private boolean jj_3R_42() {
if (jj_scan_token(REPEAT)) return true;
if (jj_3R_85()) return true;
if (jj_scan_token(UNTIL)) return true;
if (jj_3R_50()) return true;
return false;
} |
4f0cf9e4-5ede-44d2-9eae-a5045f3e5060 | 6 | public void draw(Graphics2D g){
g.drawImage(image, 0, 222 , null);
g.setFont(font);
int bullets = player.getBullet();
int healths = player.getHealth();
int maxBullets = player.getMaxBullets();
int maxHealth = player.getMaxHealth();
long btTimer = GameStateManager.getBTTimer();
for(int i = 0; i<(
(he... |
909eee9f-9ce0-4d1a-bf63-8b769374990e | 3 | @Override
public void run() {
InetAddress address = datagramPacket.getAddress();
int port = datagramPacket.getPort();
byte[] data = datagramPacket.getData();
String dataString = new String(data);
try (Scanner sc = new Scanner(dataString).useDelimiter(":")) {
String keyword = sc.next();
if (keyword.e... |
17d72b55-bbf7-4c05-8faa-791cd68714ea | 9 | int eatStack(List<String> s){
System.out.println(s);
if(s==null || s.isEmpty())
return 0;
int result = 0;
int pn = Integer.MIN_VALUE;
String pop = "";
int n =Integer.MIN_VALUE;
for(String str:s){
if("+-*/".contains(str)){
i... |
7b860f1c-3f66-4629-96e0-1b20cda16ebc | 1 | @Override
public Dimension getMinimumSize()
{
if(this.image == null) return new Dimension(500, 100);
return new Dimension(this.image.getWidth() + 2*border, 300);
} |
d9bd5832-ba46-4563-97e2-f658a00d1cc8 | 7 | public static String stRetValDes (int expVal,int actVal,String functionName,String flow,HashMap<String, String> data)
{
String status;
status=null;
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.n... |
6def1253-4ecd-4c07-a8de-c69b6d05e1ea | 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... |
0a81fe02-fa9b-4389-b760-5d5e20029859 | 2 | public synchronized void stopReactor() {
if (!_shouldRun)
return;
_shouldRun = false;
_data.getSelector().wakeup(); // Force select() to return
_data.getExecutor().shutdown();
try {
_data.getExecutor().awaitTermination(2000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Someone didn... |
eed6b531-7319-4164-995f-c5df3be776b5 | 1 | private static int showMainPrompt(){
if (currentDocument!=null){
System.out.println("\nOpen Document: " + currentDocument.getName());
}
String displayStr = "1). Create a new Survey\n"
+"2). Create a new Test\n"
+"3). Display a Document\n"
+"4). Load a Document\n"
+"5). Save a Document\n"
+... |
5e94257d-c0e9-46c2-bd99-e6913e18ddfb | 1 | public List<Producto> ObtenerProducto(String consulta){
List<Producto> lista=new ArrayList<Producto>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
7762449e-ee08-4e99-82a6-f4f083e53f33 | 4 | public void visitLookupSwitchInsn(final Label dflt, final int[] keys,
final Label[] labels) {
checkEndCode();
checkStartCode();
checkLabel(dflt, false, "default label");
checkNonDebugLabel(dflt);
if (keys == null || labels == null || keys.length != labels.length) {
throw new IllegalArgumentException(
... |
5d0353a7-4fa8-4ced-af6f-b5f18b2354ec | 0 | public void setjLabel9(JLabel jLabel9) {
this.jLabel9 = jLabel9;
} |
a4bae15d-2507-4aa8-9108-a3002fe16bb7 | 8 | public void visit_dup2_x1(final Instruction inst) {
// 0 1 2 -> 1 2 0 1 2
// 0 1-2 -> 1-2 0 1-2
if (Tree.USE_STACK) {
saveStack();
final Expr[] s12 = stack.pop2();
final StackExpr s0 = (StackExpr) stack.pop1();
if (s12.length == 2) {
// 0 1 2 -> 1 2 0 1 2
final StackExpr[] s = new StackExpr... |
024a1a13-18b8-4c6e-aefa-3de8212448d9 | 5 | @Override
public Query parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("ALTER TABLE ");
sB.append(this.t.replace("#__", this.db.getPrefix()));
sB.append("\n ");
if(this.ren) {
sB.append(" RENAME TO ");
sB.append(this.renTo.repla... |
4305919d-bec2-4963-afaa-bc2b4b6d2507 | 4 | private void takeFirstTurn() {
Player currentPlayer = this.game.getCurrentPlayer();
if (this.game.getStatus() == GameStatus.NEW_GAME
&& this.game.getGameType() == GameType.ONE_PLAYER
&& currentPlayer.getPlayerType() == PlayerType.COMPUTER_PLAYER) {
tr... |
a01388e1-c916-4acb-bc90-49ef3810dfd8 | 3 | @EventHandler
public void handleBucketFillings(PlayerBucketFillEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
if (user != null) {
Cuboid cuboid = Cuboid.getCuboid(player.getLocation());
if (cuboid != null) {
if (!Flag.hasFlag... |
83145a64-7723-474d-867c-c0c21d8bc877 | 0 | public String getLabel() {
return label;
} |
ec2fb3c9-c6bb-4712-bb90-fe3ba3fbe387 | 2 | private void closeProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeProjectActionPerformed
if (workCombo.getItemCount() > 0) {
String wd = ((File) workCombo.getSelectedItem()).getPath();
try {
saveProjectConf(wd);
closeAll();
... |
78f44e8e-ac45-4391-b090-b76461210bf4 | 0 | public int getPhysicalHeightDpi() {
return physicalHeightDpi;
} |
19a518fa-497e-4b4a-b401-f8aa66ede3dc | 3 | private Cromosoma seleccionarPadres(int max){
int azar = 0;
Cromosoma padre;
azar = (int) (Math.random()*max);
int i = 0;
for(i = 0; i < individuos-1 && padres[i] < azar; ++i){}
if(progenitor[i]){
progenitor[i] = false;
padre = poblacion[i];
}
... |
ce981e01-6eda-43fb-ad0d-49ad09641af0 | 1 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if (this.pretarate()) {
}
}//GEN-LAST:event_jButton1ActionPerformed |
d7f2af63-a463-4b98-8350-5da940caf502 | 1 | public int setContentHandler (PdbContentHandler aContentHandler) {
// we don't accept null handlers
if (aContentHandler == null) {
return NULL_OBJECT_REFERENCE ;
} // end if
// set it, return in triumph
ourContentHandler = aContentHandler ;
return SUCCESS ;
} // end method setContentHandler |
e0ec1af5-9203-4e69-83ac-248b597d2e7a | 4 | private void checkArgDecls(AST caller, AST fct) {
// check number and types of args/formals match
AST formals = fct.getKid(3);
Iterator<AST> actualKids = caller.getKids().iterator(),
formalKids = formals.getKids().iterator();
actualKids.next(); // skip past fct name
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.