method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7c0cd788-821e-4969-a141-d43c13561a87 | 2 | public static void main(String[] args) {
Miner miner = new Miner(458, "Bob");
MinersWife wife = new MinersWife(82, "Elsa");
MinersSon son = new MinersSon(50, "Billy");
try {
for(int i=0; i<40; ++i){
miner.update();
wife.update();
son.update();
Thread.sleep(800);
}
// System.err.println ... |
835d4ed0-d359-4f04-a33c-6074e90c6c36 | 1 | public void setRight(Node child) {
right = child;
if (child != null) {
child.parent = this;
}
} |
10f78f1a-841f-4595-8ced-4557d22a0e3b | 7 | private void doAction(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
String forwardPage = errorPage;
Map<String, String[]> params = request.getParameterMap();
String action = request.getParameter("action");
sessio... |
333f7637-14b8-4209-9387-ca7ffc806c99 | 0 | public Vector<String[]> getData() {
return data;
} |
2411d13b-1736-41ee-b229-daa3a351e332 | 1 | @Override
public void dispose() {
this.listModel = null;
this.previewList = null;
this.lblPreviewLabel = null;
this.lblBaseInfoLabel = null;
this.btnApplyButton = null;
this.btnEditButton = null;
this.btnDeleteButton = null;
this.list = null;
t... |
fcc3fc3a-72da-4a43-a07e-f3f895d7e0f8 | 0 | public void setPersonId(int personId) {
this.personId = personId;
} |
49a5d17c-376e-4ac0-9e38-b24671b698f0 | 7 | public static void main(String[] args) {
// TODO Auto-generated method stub
int[] A = new int[]{0,0,0,2,5,7,40,50,100,120,200,300,350,370,380,355,390,400,800,432,450,500};
int n = A.length;
int[] B = new int[n+1];
int INF = 100000000;
int cur_lis_len = 1;
B[0] = 1;
for(int i = 1; i < n; i++ ){
int ma... |
322436ab-ef0e-48ce-a7f9-752b90609cba | 9 | public static void launchScoreDialog(final Context context, final String score, final String displayScore, final String levelId, final Drawable gameIcon,
final String gamePackage, final boolean fromSdk, final boolean skipModalDialog) {
final Float scoreF = Float.parseFloat(score);
final Sha... |
afa0ae94-bf67-43ba-84d2-4c42ea853d12 | 0 | public CardType getType() {
return type;
} |
2c431d3c-2bec-45f0-af88-055d4ad2d4ac | 4 | @Override
public SquareMatrix getIdentityMatrix() {
int size = getRowsNumber();
try {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
if (i == j) {
setElementAt(i + 1, j + 1, 1);
} else {
setElementAt(i + 1, j + 1, 0);
}
}
}
} catch (OutOfBoundsException... |
34b04961-4c66-4adb-a6f8-81efd62626e1 | 5 | @Override
public void paintComponent (Graphics g) {
super.paintComponent(g);
if (state == 0) { //main menu
} else if (state == 1) { //load save menu
g.drawRect(0, 0, getWidth(), getHeight());
} else if (state == 2) { //options screen
} else if (state == 3) { //... |
3edfb493-3873-4a69-a541-4aad72df75fb | 1 | */
public Iterator iterator() {
final Iterator iter = super.iterator();
return new Iterator() {
Object last = null;
public boolean hasNext() {
return iter.hasNext();
}
public Object next() {
last = iter.next();
return last;
}
public void remove() {
if (last == nul... |
ee709c69-fa14-40c4-88be-0b9cc014a94a | 6 | private void updateStateTellNotExist(List<Keyword> keywords, List<String> terms, List<String> approval, boolean inAden, boolean askPrice) throws WrongStateClassException {
if( approval.isEmpty()) {
if( keywords.isEmpty() ) {
DialogManager.giveDialogManager().setInErrorState(true);
return;
}
CanteenInf... |
ba8e45dc-11b4-41e7-a24c-8d5047726030 | 8 | public static void comp() {
int i1 = 123;
int i2 = 123;
int i3 = 456;
if (i1 == i2) {
System.out.println("i1とi2は等しい");
}
if (i1 != i3) {
System.out.println("i1とi3は等しくない");
}
if (i1 < i3) {
System.out.println("i3はi1より大... |
a96f7ee6-5bc0-4309-be85-5346280fda5f | 0 | @Before
public void setUp() throws Exception
{
_underTest = new Player("Tester");
} |
0f1d26ad-b2bb-461f-98dd-08a9cf57ae6f | 9 | private static int runProcess(String[] cmd, String[] environment,
InputStream in, OutputStream out,
OutputStream err)
throws IOException
{
Process p;
if (environment == null) {
p = Runtime.getRuntime().exec(cmd);... |
4ee2a98c-fb91-4540-8073-9d55868775a0 | 9 | private String setFax( String line){
Pattern p = Pattern.compile("(fax)?.*[0-9\\.\\s]+(fax)?", Pattern.CASE_INSENSITIVE);
Pattern p2 = Pattern.compile("([0-9])");
Matcher m, m2;
int nbNumeric = 0;
String result=null;
if(null!=line && line.length()>0){
m = p.matcher(line);
if(m.find() && line.length()>... |
35ed5b3e-1de8-406f-816e-d62c9d749197 | 6 | public static void shellSort(Comparable [] array,int increment){
int index=0;
int bounder=index+increment;
int innerIndex=0;
while(index < array.length && index < bounder)
{
//单次的插入排序程序
for(innerIndex = index+increment;innerIndex<array.length-increment;innerIndex=innerIndex+increment){
... |
20aa6a65-b836-44b8-9e9c-f444c0ebf10d | 4 | public void keyPressed(KeyEvent w) {
int code = w.getKeyCode();
if (code == KeyEvent.VK_A) {
left = true;
right = false;
dx = -SPEED;
} else if (code == KeyEvent.VK_D) {
right = true;
left = false;
dx = SPEED;
} else... |
3f98609a-8ace-4004-b4e9-2664ebe20941 | 5 | public int hashCode()
{
final int MOD_ADLER = 65521;
int a = 1;
int b = 0;
String nodeStr = Integer.toString(startIndex);
String offsetStr = Integer.toString(startOffset);
String vStr = versions.toString();
int hDataLen = data.length+nodeStr.length()
+offsetStr.length()+vStr.length();
char[] hashDat... |
c3212d89-045d-423f-aad9-99fa051b1057 | 4 | public static void aesOfbCrypt(byte[] data, byte[] iv) {
//Maple's OFB is done in piecemeal every 1460 bytes (I'm guessing it has
//to deal with maximum segment size). First piece is only 1456 bytes
//because the header, although not encrypted, adds 4 blocks to the first
//segment.
BlockCipher ciph = aes256.g... |
f447a523-3ce1-4f78-a4c2-c487c5e2c3f4 | 3 | @Override
public void handleMessages(Inbox inbox) {
while (inbox.hasNext()) {
Message msg = inbox.next();
if (msg instanceof PackHelloOldBetEtx) {
PackHelloOldBetEtx a = (PackHelloOldBetEtx) msg;
handlePackHello(inbox.getSender(), inbox.getReceiver(), a);
}else if (msg instanceof PackReply... |
2ee13254-49a4-49dd-a03e-8144b13b62ac | 9 | static final void method3385(int i, int i_0_, int i_1_, int i_2_, int i_3_, int i_4_, int i_5_, boolean bool, int i_6_) {
anInt3582++;
if (!CacheNode_Sub15.method2379(7015, i)) {
if ((i_4_ ^ 0xffffffff) == 0) {
for (int i_7_ = 0; i_7_ < 100; i_7_++)
Class195.aBooleanArray2387[i_7_] = true;
} else {
... |
a5d5a3ff-03f5-4eab-a4c4-8702a0a4196e | 9 | public void startServer(){
//read network configuration
Configuration config;
try{
config = new PropertiesConfiguration("network.cfg");
} catch (ConfigurationException e) {
try{
config = new PropertiesConfiguration("network.cfg.default");
... |
e5b5a9ac-f1dd-4a71-8ee0-f8411913163e | 9 | public static String pad(String s) {
if (s.length() == 0) return " ";
char first = s.charAt(0);
char last = s.charAt(s.length()-1);
if (first == ' ' && last == ' ') return s;
if (first == ' ' && last != ' ') return s + " ";
if (first != ' ' && last == ' ') return " " + s;... |
124132ba-5ea3-4912-938a-d1757786d237 | 4 | public static void playSound(String filename) {
try {
// From file.
AudioInputStream stream = AudioSystem.getAudioInputStream(
filename.getClass().getResource(filename));
// At present, ALAW and ULAW encodings must be converted to
// P... |
177a26f4-b72b-4618-85a7-72f8fa1c0e0e | 0 | public void clear() {
accessTimes.clear();
map.clear();
}//clear |
69dc87d6-144a-4630-96db-ecdece99d906 | 5 | @Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + (int) (this.id ^ (this.id >>> 32));
hash = 97 * hash + this.numeroEtudiant;
hash = 97 * hash + (this.prenom != null ? this.prenom.hashCode() : 0);
hash = 97 * hash + (this.nom != null ? this.nom.hashCode() : 0... |
40c85ce1-a766-4414-92b7-d0f62d22c601 | 5 | public int GetCLFishing(int ItemID) {
if (ItemID == 10755) {
return 100;
}
if (ItemID == 10757) {
return 100;
}
if (ItemID == -1) {
return 1;
}
String ItemName = GetItemName(ItemID);
if (ItemName.startsWith("Fishing cape")) {
return 100;
}
if (ItemName.startsWith("Fishing hood")) {
return 1... |
73f9522f-de55-4a5d-b061-7a0eaa53262a | 2 | @Override
public NormalLikeDistribution[] getOrderDistributions(double mean, double sd) {
double periodMean = mean/(forerun+1);
double periodSd = Math.sqrt(((sd*sd)/(forerun+1)));
NormalDistribution orderDistribution = new NormalDistribution(periodMean, periodSd);
RealSinglePointDistribution emptyOrder = new R... |
8159a691-2eac-4470-9079-4265fa89202b | 3 | public boolean accountMatch(String name, String password) {
if (User.getUserByUsername(name) == null)
return false;
Encryption e = new Encryption();
String hashedPassword = e.generateHashedPassword(password);
try {
String statement = new String("SELECT password FROM " + DBTable +" WHERE username = ?");
... |
0a26970f-1415-44a7-8185-dbdae954689c | 2 | public static void main(String arg[]) {
try {
MmsParamsReader mp = new MmsParamsReader(new java.io.FileReader(arg[0]));
ParameterSet mps = mp.read();
System.out.println ("Dimensions = " + mps.getDims());
System.out.println ("Parameters = " + mps.getParams());
... |
0d90aef5-4ec4-4527-98a1-79fe4194e1d4 | 7 | public void breadthFirst() {
int start = 0;
int end = 0;
graph[0].setIdentified();
queue[end] = graph[0];
end++;
while (start != end) {
Node u = queue[start];
start++;
for (int i = 0; i < size; i++) {
Node v = u.getNode... |
a4cd2b09-0a84-4866-bb4d-1e342136586b | 0 | public void setWait(){
wait = true;
} |
71b56136-b2b3-4d44-90b3-c0421317099e | 2 | public Collection interfaces(final Type type) {
final TypeNode node = getImplementsNode(type);
if (node != null) {
final List list = new ArrayList(implementsGraph.succs(node));
final ListIterator iter = list.listIterator();
while (iter.hasNext()) {
final TypeNode v = (TypeNode) iter.next();
iter... |
35a72265-bb48-45ae-9c82-53b44c7b81f7 | 1 | public boolean conditionMatches(CombineableOperator combinable) {
return (type == POSSFOR || cond.containsMatchingLoad(combinable));
} |
7b6b3119-07d5-4649-b1c0-05448147314a | 5 | public void saveSimulation(String fname) {
if (sim != null) {
try {
Path td = Files.createTempDirectory("PDTemp_");
List<WorldDescriptor> worldsToSave = sim.getWDStack();
for (int i = 0; i < worldsToSave.size(); i++) {
WDLoader loader = new JAXBWDLoader(td + "/"
+ Integer.toString(i) + ".xm... |
ec6fd229-da1b-4460-b113-59e9b0d81f66 | 2 | public void damage(int amt)
{
if(state == STATE_IDLE)
state = STATE_CHASE;
health -= amt;
if(health <= 0)
state = STATE_DYING;
} |
a27bec36-160d-4feb-b7e8-28d7da751463 | 3 | private void btnFinalizarVendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinalizarVendActionPerformed
try {
if (JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0) {
Funcionario f = (Funcionario) jcbFuncionarioVend.getSelectedI... |
81c73bc3-17b2-4ad9-a172-0ab4cb6008c5 | 0 | public void actionPerformed(ActionEvent arg0) {
Component apane = environment.tabbed.getSelectedComponent();
JComponent c=(JComponent)environment.getActive();
SaveGraphUtility.saveGraph(apane, c,"GIF files", "gif");
} |
ddf8bb36-f48d-45e9-a581-426883567a3f | 6 | public void init(Map attributes) throws InvalidKeyException {
synchronized(lock) {
if (currentKey != null) {
throw new IllegalStateException();
}
Integer bs = (Integer) attributes.get(CIPHER_BLOCK_SIZE);
if (bs == null) { // no block size was specified.
... |
9def8b94-c105-4935-a1ac-a8385774a5fd | 6 | public static void main(String args[]){
//Creating a colour scheme to test the renderer with
Colour[] colours = new Colour[5];
final int MAP_SIZE = 5;
for (int i=0; i<MAP_SIZE; i++) {
switch (i) {
case 0: Colour black = new Colour("#000000");
colours[i]... |
fd4c12f4-8086-4c8c-b7b6-813a9006df72 | 8 | public static void printGRNToFile(final String fileName, final Grn grn, final double[][] results) {
NumberFormat formatter = new DecimalFormat("###.#########");
try{
File file =new File(fileName);
//if file doesnt exists, then create it
boolean created = false;
if(!file.exists()){
... |
e1819ef5-6563-4d7c-88e9-4297a51750ce | 7 | private void ConvertToCell(int x, int y)
{
Color basic = this.grid[x][y].getBackground();
Color a = new Color(255, 255, 255);
Color b = new Color(147, 208, 81);
Color c = new Color(52, 153, 51);
Color d = new Color(1, 73, 0);
Color e = new Color(231, 31, 27);
... |
ee16cd83-7770-4fbd-8d13-58fd86a89942 | 8 | public static void main(String[] args) throws Exception {
String env = null;
if (args != null && args.length > 0) {
env = args[0];
}
if (! "dev".equals(env))
if (! "prod".equals(env)) {
System.out.println("Usage: $0 (dev|prod)\n");
... |
c09e00e2-d9c8-4446-a3d2-fd8c10a34a34 | 7 | void readFrequencies() throws Exception {
int totalFrequencyCount = 0;
int atomCountInFirstModel = atomSetCollection.atomCount;
float[] xComponents = new float[5];
float[] yComponents = new float[5];
float[] zComponents = new float[5];
discardLinesUntilContains("FREQUENCY:");
while (line !=... |
3b1de8ae-0378-4401-83b6-2f65546871d5 | 6 | public void read(BufferedReader buff)
{
try
{
while(buff.ready())
{
line = buff.readLine();
piecePlace = pattern[0].matcher(line);
pieceMove = pattern[2].matcher(line);
castle = pattern[1].matcher(line);
if(piecePlace.find())
{
String chessPiece = piecePlace.group("ChessPie... |
737fa782-37f2-423c-b3e9-ca1d96bdf99e | 1 | exact(int N, int[][] m){
this.sets = new ArrayList();
nodes = new HashSet();
for (int i = 0;i < N; i++)
nodes.add(i);
matr = m;
size = N;
ss = new int[size];
} |
43174f98-fce6-490a-a843-c5604119b5ac | 9 | private static boolean updateJoinCardinality(Join j,
Map<String, Integer> tableAliasToId,
Map<String, TableStats> tableStats) {
DbIterator[] children = j.getChildren();
DbIterator child1 = children[0];
DbIterator child2 = children[1];
int child1Card = 1;
... |
28e9b09e-c77a-462b-a854-5be7d13fcdb1 | 9 | protected boolean checkIfDivide(int previousToken){
if (previousToken == TokenNameIdentifier || previousToken == TokenNameStringLiteral ||
previousToken == TokenNameCharacterLiteral ||
previousToken == TokenNameIntegerLiteral ||
previousToken == TokenNameDoubleLiteral ||
previousToken == TokenNameLongLite... |
a8676d10-4e5d-4d85-9a5f-ccd12e7c4bac | 5 | @Override
public void actionPerformed(ActionEvent ae) {
String comm = ae.getActionCommand();
switch (comm) {
case START_SERVER_AC:
if (electionsServer != null) {
System.err.println("Duplicate StartServer request in ServerFrame.actionPerformed(ActionEve... |
a22510c0-052b-490f-80a9-9ab188f005bb | 8 | public int parseSDStatus(){
if(len<17) return 0;
//Starts with SD
int sdtext=17;
if(startsWithSD()){
int idx = indexOf('/');
if(idx == -1) return 0;
int done;
int total;
try {
done = Integer.parseInt(subSequence(sdtext, idx).toString());
int idx2 = indexOf('\n',idx+1);
if(idx2 == -1){... |
0855432b-2f41-457c-bf54-63e7f0e8c3c2 | 9 | private boolean save() {
String name = informationPanel.getName().trim();
String source = informationPanel.getSource().trim();
int time = informationPanel.getTime();
int calories = informationPanel.getCalories();
int portions = informationPanel.getPortions();
if ( name ... |
7ff1bdea-4592-414c-82c1-05a5859e0a5b | 6 | protected void receive(String line) {
if(line.startsWith(FILE_START_MAP)){
String name = TEMP_FOLDER_PATH+"map.smap";
FileTools.saveFromInput(new File(name), in, bufferSize);
Map map = new Map(new File(name));
game.init(map, this);
send(READY);
msg = "Now waiting for other players to be ready";
}
... |
3df1c65a-df68-45ca-b634-790ca413b0c1 | 5 | private void addChildren(JsonElement fromElement, JsonElement toElement) {
if (fromElement instanceof JsonObject && toElement instanceof JsonObject) {
JsonObject fromObject = (JsonObject) fromElement;
JsonObject toObject = (JsonObject) toElement;
for (Entry<String, JsonElement> entry : fromObje... |
722af625-fdb8-4883-9d0c-d96ea06ad5a2 | 8 | public static MoodleGroup[] getGroupsFromCourseId(long id) throws MoodleRestGroupException, UnsupportedEncodingException, MoodleRestException {
Vector v=new Vector();
MoodleGroup group=null;
StringBuilder data=new StringBuilder();
String functionCall=MoodleCallRestWebService.isLegacy()?M... |
d77856d5-4538-464b-997f-115d2d222229 | 7 | @Override
public void solve(DenseMatrix64F b, DenseMatrix64F x) {
if( b.numCols != x.numCols || b.numRows != numRows || x.numRows != numCols) {
throw new IllegalArgumentException("Unexpected matrix size");
}
int numCols = b.numCols;
double dataB[] = b.data;
doub... |
2234701a-6598-40f0-aa48-1ff06b30995c | 0 | public boolean isBreakpointSet() {
return breakpointSet;
} |
d2ae6076-31c5-4cb5-9b64-a88c21e77031 | 1 | public ByteVector putByte(final int b) {
int length = this.length;
if (length + 1 > data.length) {
enlarge(1);
}
data[length++] = (byte) b;
this.length = length;
return this;
} |
f447f17c-794d-4e0c-81c9-783371b397ae | 0 | public void addChangeListener(ChangeListener listener) {
listeners.add(listener);
} |
618b4bd5-bc28-4806-b5a1-c01194d3bfa8 | 0 | public void setHorasteoricas(Tempo horasteoricas) {
this.horasteoricassemanais = horasteoricas;
} |
2fd13548-392a-41cb-987a-02048010b5ce | 6 | void Expr() {
printer.startProduction("Expr");
if (StartOf(3)) {
BaseExpr();
if (StartOf(4)) {
op();
BaseExpr();
this.generator.commandOp(this.currentContext.previousOp);
printer.endProduction("Expr");
} else if (la.kind == 6 || la.kind == 10) {
printer.endProduction("Expr");
} e... |
90761bdf-8da3-4adf-a03b-e33a1006d62c | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(((msg.targetMinor()==CMMsg.TYP_GET)||(msg.targetMinor()==CMMsg.TYP_PUSH)||(msg.targetMinor()==CMMsg.TYP_PULL))
&&(msg.target() instanceof Item)
&&(juggles.contains(msg.target(... |
27bc5798-60d3-48f1-9265-b58de2fb0374 | 6 | public static String translate(String str) {
if(!turnedon)
return str;
String res = "";
URL url = url(str);
if(url == null)
return str;
try {
final HttpURLConnection uc = (HttpURLConnection) url
.openConnection();
uc.setRequestMethod("GET");
uc.setDoOutput(true);
try {
String ... |
4d816fae-5714-4fc8-8ca4-e49b3492ae06 | 5 | public static List<Field> inVars(Class<?> comp) {
List<Field> f = new ArrayList<Field>();
for (Field field : comp.getFields()) {
In in = field.getAnnotation(In.class);
if (in != null) {
Role r = field.getAnnotation(Role.class);
if (r != null && Ann... |
2e920603-e906-4691-91dd-c9eb1530f873 | 1 | public void add(int[] bowl) {
assert(nkindfruits == bowl.length);
if (nfruits == 0)
nfruits = sum(bowl);
assert(nfruits == sum(bowl));
nround++;
history.add(bowl);
scoreHistory.add(dot(bowl, pref));
assert(nround == history.size());
} |
49daea5e-dbec-44b1-bf03-1ff92d56ff3d | 4 | public boolean isOptOut() {
synchronized(optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.ge... |
c4e42639-58c9-42a3-9673-5cc14258c36d | 7 | static public boolean isWrapperClass (Class type) {
return type == Integer.class || type == Float.class || type == Boolean.class || type == Long.class || type == Byte.class
|| type == Character.class || type == Short.class || type == Double.class;
} |
ff6f32c7-fec4-4586-81f8-9e10e28dac8f | 9 | @Override
public FREObject call(FREContext c, final FREObject[] args) {
final InAppPurchaseExtensionContext context = (InAppPurchaseExtensionContext) c;
context.executeWithService(new Runnable() {
@Override
public void run() {
InAppPurchaseExtension.logToAS("Getting products from the native store ..."... |
98e03351-0ab7-4deb-87ff-0ff3b2448ff7 | 3 | @Override
public void mouseClick(double x, double y) {
_tempToClick.clear();
for (MenuButton but : _buttons) {
if (but.isMouseWithin(x, y)) {
_tempToClick.add(but);
}
}
if (_tempToClick.size()==0)
return;
_tempToClick.get(_tempToClick.size()-1).actionOnClick();
} |
69d2e3a5-9fc1-4b76-9ce0-1f829e6b6215 | 3 | private static Move BackwardLeftForWhite(int r, int c, Board board){
Move backwardLeft = null;
if( r>=1 && c>=1 &&
board.cell[r-1][c-1] == CellEntry.empty
)
{
backwardLeft = new Move(r,c, r-1, c-1);
}
return backwardLeft;
} |
d85de20e-c4d0-4317-ba8a-ffd7692da612 | 4 | private void scanDir(File dir, List<LessFileStatus> lstAddedLfs) {
if (!dir.isDirectory())
throw new BugError("Bad directory: " + dir);
File[] subf = dir.listFiles();
if (subf != null) {
for (File f : subf) {
if (f.isFile())
scanFile(f.getName(), f, lstAddedLfs);
}
}
} |
cc6b3f03-9b12-4c0c-b0ba-cab871b170f5 | 3 | private void addNewWormSprites() {
Collection<Worm> worms = getFacade().getWorms(getWorld());
if (worms != null) {
for (Worm worm : worms) {
WormSprite sprite = getWormSprite(worm);
if (sprite == null) {
createWormSprite(worm);
}
}
}
} |
fc1f8e8b-84c5-4aba-9d14-aaacf813cb76 | 3 | @Override
public void paintComponent(final Graphics g) {
// Check if we have a running game
super.paintComponent(g);
g.setColor(this.getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
if (this.model != null) {
// Draw all tiles by going over them x-wise and y-wise.
for (int i = 0; i < this.... |
2dae00c4-16c3-40c9-b362-fa56d69f6505 | 0 | public static AIMerger getInstance() {
return instance;
} |
2f7e2b42-728a-413d-b911-7621da0fd623 | 5 | private void updateNPCs(Buffer stream, int amount) {
actorsToUpdateCount = 0;
playersObservedCount = 0;
updateNPCMovement(stream);
updateNPCList(amount, stream);
updateNPCBlock(stream);
for (int k = 0; k < actorsToUpdateCount; k++) {
int npcId = actorsToUpdateIds[k];
if (npcs[npcId].lastUpdateTick != ... |
1ec55328-862f-4b01-b027-28e98e56f63d | 6 | @EventHandler
public void MagmaCubeHunger(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.getMagmaCubeConfig().getDouble("MagmaCube... |
e04a54b1-4b47-4ed5-a18c-638fa6699c12 | 7 | public void dribbleToGoal(ObjBall ball) {
if(stayInBounds()) {
ObjGoal goal = mem.getOppGoal();
if((goal != null) && (mem.getPosition().x < 35.0)) {
kickToPoint(ball, new Polar(5.0, (goal.getDirection() - ball.getDirection())));
}
else if((goal != null) && (mem.getPosition().x >= 35.0)) {
... |
ffe44da8-0f2e-4967-9455-6541814364b1 | 6 | public ShipChassis readChassis(InputStream stream) throws IOException, JAXBException {
log.trace("Reading ship chassis XML");
// Need to clean invalid XML and comments before JAXB parsing
BufferedReader in = new BufferedReader(new InputStreamReader(stream, "UTF8"));
StringBuilder sb = new StringBuilder();
S... |
76684127-7309-4da9-a9b4-7ff9637a86bb | 3 | public JSONArray toJSONArray(JSONArray names) throws JSONException {
if (names == null || names.length() == 0) {
return null;
}
JSONArray ja = new JSONArray();
for (int i = 0; i < names.length(); i += 1) {
ja.put(this.opt(names.getString(i)));
}
re... |
3fb85c35-5896-4e4f-8492-a755b6fe71ae | 0 | public float getImporte() {
return importe;
} |
0208b766-8b17-40b7-91cb-cac72905aa3b | 0 | protected CityHall() {} |
9052f633-ccb7-40a1-9c68-f640ac90ec80 | 3 | @Override
public boolean verifier() throws SemantiqueException {
super.verifier();
if(gauche.isBoolean()){
setBoolean();
if(!droite.isBoolean()) GestionnaireSemantique.getInstance().add(new SemantiqueException("Expression droite arithmetique, booleenne attendue pour le ET lig... |
00387b90-77f7-492d-99a1-f9eecdf59f23 | 0 | public void solicitudRealizada(final int idSolicitud){
logger.info("Id Solicitud " + idSolicitud);
getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query query = session.createQuery("update Pos... |
1ffcf9dd-8b18-4644-9c2a-510d37b37e8f | 4 | public List<PwdItem> GetItems() {
List<PwdItem> pwdlist=new ArrayList<PwdItem>();
if (this.connection == null) {
return null;
}
try {
Statement stmt = null;
stmt = this.connection.createStatement();
int count = 0;
//... |
21461086-0ddf-476b-95ea-a50a7ea19d8d | 6 | public boolean checkEntrance(Vehicle vehicle)
{
for (int i = 0; i < vehicleCount(); i++)
{
if (m_vehicles.get(i).getState() == Vehicle.State.INSIDE)
{
float theta = m_vehicles.get(i).getTheta();
float dist = getRadius() * (theta - vehicle.getTheta());
float dist2 = getRadius() * (float) Math.abs(... |
b5a27afb-4069-43be-9c5d-26f49e23e7e0 | 5 | public char firstNonRepeating(String s) {
char return_char = 0;
if (s == null || s.isEmpty()) {
return 0;
}
int[] arr = new int[256];
for (char i : s.toCharArray()) {
int index = (int) i;
arr[index]++;
}
for (char i : s.toCharArray()) {
int index = (int) i;
if (arr[index] == 1) {
return... |
82d6dbd5-943e-4beb-8225-25d661c17b40 | 5 | public CheckResultMessage checkTF04(int day) {
int r1 = get(20, 2);
int c1 = get(21, 2);
int r2 = get(23, 2);
int c2 = get(24, 2);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != getValue(r1 + 3, c1 + day, 2).abs().compar... |
de989996-9daf-426a-843b-c742ffdcff16 | 3 | public static UnitType getTier(int tier, CastleType type)
{
for (UnitType i: UnitType.values()) {
System.out.println ("unit "+i.level+", "+i.castle);
if (i.level == tier && i.castle == type) {
return i;
}
}
return null;
} |
cd4f04b5-42b9-478d-8f8a-2fe2b2850379 | 0 | Welcome() throws PropertyVetoException {
setResizable(false);
setTitle("BOLSA DE EMPLEOS REP.DOM");
setIconImage(Toolkit.getDefaultToolkit().getImage(Welcome.class.getResource("/InterfazGrafica/Images/Encontrar-Trabajo.jpg")));
setForeground(new Color(0, 0, 0));
setFont(new Font("Tahoma", Font.BOLD, 15));
s... |
d1ab81ba-dae1-4589-bd80-367903390b86 | 6 | public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out
.println("Please type in your score in percentage (0 to 100).");
float score = s.nextFloat();
s.close();
if (score >= 100) {
System.out.println("Your grade is A+");
} else if (score >= 90) {
System.out.println(... |
b485248f-8c13-4a4a-8250-ba9615ddf9b0 | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost, msg);
if ((System.currentTimeMillis() - lastClanCheck) > TimeManager.MILI_HOUR / 2)
{
if ((clanID().length() > 0)
&& (owner() instanceof MOB)
&& (!amDestroyed()))
{
if ((CMLib.clans().getCl... |
4abee73d-64a3-4a34-b232-b335ebe4e761 | 5 | public String toString() {
Stack<String> stack = new Stack<>();
StringBuilder full = new StringBuilder();
Set<Integer> powers = terms.keySet();
for (int power : powers) {
StringBuilder sb = new StringBuilder();
double coefficient = terms.get(power);
s... |
cdff60d2-8ba3-43e4-8480-0732dff9e150 | 6 | public void showTable() {
waitlb1.setVisible(true);
l.remove(0);
if (!l.isEmpty()) {
content = new String[l.size()][l.get(0).split(";").length];
for (int i = 0; i < l.size(); i++) {
content[i] = l.get(i).split(";");
}
for (int i = 0; i < l.size(); i++) {
for (int j = 0; j < content[i].length; ... |
02721ae2-fbde-4797-a90e-9dbc3dfe34b5 | 5 | @Override
public void serialEvent(SerialPortEvent event) {
if(event.isBREAK())
{
if(state!=SerialState.Disconnected)
{
disconnect();
System.out.println(">>Break);"); //$NON-NLS-1$
}
}
if(event.isERR())
{
if(state!=SerialState.Disconnected)
{
disconnect();
System.out.print... |
bb4b93cd-f807-4a34-957f-ec8e444138d4 | 9 | public void switchPanel(Screen screen)
{
cardLayout.show(cardPanel, screen.name());
switch (screen)
{ case CAMPUS:
campus.requestFocus();
campus.continueClasses();
break;
case CLASS:
classroom.requestFocus();
break;
case MINISPLASH:
miniSplash.requestFocus();
break;
case BATT... |
01dc95d0-c96e-4ffb-b508-3c125eca907e | 3 | public Boolean secondUp()
{
if (time.getSeconds() < 59)
{
time.setSeconds(time.getSeconds() + 1);
} else
{
if (time.getMinutes() < 59)
{
time.setSeconds(0);
time.setMinutes(time.getMinutes() + 1);
} else
... |
1287b791-1e95-4c75-b82a-5b4796ee64f9 | 7 | public void setOptions(String[] options) throws Exception {
String tmpStr;
String[] tmpOptions;
setChecksTurnedOff(Utils.getFlag("no-checks", options));
tmpStr = Utils.getOption('C', options);
if (tmpStr.length() != 0)
setC(Double.parseDouble(tmpStr));
else
setC(1.0);
tmp... |
77b8db2e-3d41-4f7a-b993-c5a311a1d583 | 2 | public boolean insertAt(int index, E element) {
if (indexOK(index)) {
if (index == 0) {
addFirst(element);
} else {
expandArrayCapacityBy(1);
System.arraycopy(array, index, array, index+1, array.length - index - 1);
array[index] = element;
}
return true;
}
return false;
} |
3bc48d34-4f2e-48f9-8b26-363138893f6c | 5 | public static String compileAlgorythm(String commandLine){
BufferedReader bufDone;
BufferedReader bufError;
String stringDone = "";
String stringError = "";
try{
Process compile = Runtime.getRuntime().exec(commandLine);
bufDone = new BufferedReader(new In... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.