method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7801ec6c-5ff1-495d-ac51-a56d8c0eddcf | 9 | final boolean method1692(int i, TemporaryItemDefinition class38,
boolean bool) {
anInt1921++;
int i_80_;
int i_81_;
if (bool) {
if (class38 == null || class38.anIntArray568 == null) {
i_81_ = anInt1863;
i_80_ = anInt1897;
} else {
i_81_ = class38.anIntArray568[0];
i_80_ = class38.anIntA... |
b07b5498-7714-4bfb-ac7b-471be3bf13ad | 4 | @Override
public List<Integer> generatePrimeUpTo(int boundary) {
List<Integer> primeNumbers = new ArrayList<Integer>();
// only positive boundaries
boundary = Math.abs(boundary);
int pp = 2;
primeNumbers.add(pp);
pp+=1;
primeNumbers.add(pp);
while (pp < boundary) {
pp += 2;
boolean test ... |
25121724-34a3-4999-95b5-85ba943c8173 | 2 | public static String sendRequest(String urlToRequest, String parameters) {
HttpURLConnection connection;
try {
URL url = new URL(urlToRequest);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequest... |
12744fde-fecf-4e17-bea5-1241b2578a66 | 3 | @SuppressWarnings("unchecked")
public synchronized Object getKeyFromValue(Map<String, Map <Object, Long>> map, String key, Long id){
if (map.get(key) == null)
return null;
for (Object o: map.get(key).entrySet()) {
Map.Entry<Object,Long> entry = (Map.Entry<Object, Long>) o;
if(entry.getValue().equals(id)... |
34d32246-fcfd-4b45-a6f1-dde05fd7d70b | 0 | public ItemList() {
} |
36d1f49e-2ec7-4064-8377-b2c73f3787cd | 8 | @Override
public boolean equals(Object other) {
if (other instanceof Pair<?, ?>) {
return left.equals(((Pair<?, ?>) other).left) &&
right.equals(((Pair<?, ?>) other).right);
}
return false;
} |
98877235-7099-4efb-bca5-6cebb9f622e5 | 3 | public boolean getShouldRemove(){
switch(steps){
case 0:{
System.out.println("step 0");
setImageIcon(blowup1);
steps++;
break;
}
case 1:{
System.out.println("step 1");
set... |
1c641e5d-c3c1-47c0-af43-59b0b7815a0e | 8 | public void makeExcitatoryVBHConnections6(CABot3Net linesNet, CABot3Net gratingsNet, String lineType, String grateType){
int netSize =linesNet.getInputSize();
int column;
int cols = linesNet.getCols();
double weight;
if (grateType.compareToIgnoreCase("vgrate6")==0){
weight = 1.5;
}
e... |
2e9d7a77-0eb7-4a76-ad09-3d33c3a93968 | 7 | public void render(GameContainer gc, Graphics g) throws SlickException {
// Display Map
mapFactory.getCurMap().render(0, 0);
// Draw player
// Draw bullets.
// loop if bullets visible draw
bulletFactory.renderBullets(g, debug);
// temp player party render
for (int i = 0; i < playerPartySize; i++) {
... |
725c1e10-aea0-46ca-94db-4947770239c7 | 2 | public List<Device> buildList(Element rootElement) throws ParseException{
LinkedList<Device> devices = new LinkedList<>();
NodeList childern = rootElement.getChildNodes();
logger.info(Messages.getString("document_start"));
for (int i = 0; i < childern.getLength(); i++){
Node node = childern.item(i);
... |
1b57fe88-f9c2-4c51-a5b8-0b75e3545d2e | 1 | public void visit_invokevirtual(final Instruction inst) {
final MemberRef method = (MemberRef) inst.operand();
final Type type = method.nameAndType().type();
pop(type.paramTypes().length);
pop(); // Pop receiver
if (type.returnType() != Type.VOID) {
push(inst);
}
} |
a1049f33-9b2a-4b90-bce6-f9d1786fb02c | 1 | public static void moveUnit(Tile source, Tile target) {
if (source.hasUnit()) {
target.setUnit(source.getUnit());
source.setUnit(null);
source.repaint();
target.repaint();
}
} |
abe16282-0bab-4985-867f-e5d8c97a4368 | 0 | @Before
public void setUp() {
} |
a3752e9f-6715-4d61-b2cf-a5dcf30fb94e | 1 | public static void setPaperSize(PrintService service, PrintRequestAttributeSet set, double[] size, LengthUnits units) {
double[] margins = getPaperMargins(service, set, units);
MediaSizeName mediaSizeName = MediaSize.findMedia((float) LengthUnits.IN.convert(units, size[0]), (float) LengthUnits.IN.convert(units, siz... |
faea5319-ad72-44c2-a4e1-546082324332 | 8 | public String computeStats(FastaItem fastaItem) {
String sequence = fastaItem.getSequenceString();
int[] stat = new int[26];
for (int i = 0; i < sequence.length(); ++i) {
char aminoAcid = sequence.charAt(i);
int index = acids.indexOf(aminoAcid);
if (index >= 0) {
++stat[index];
... |
59ffb6a8-9095-4645-bb99-deaa4225964f | 9 | private static void readXML(File file)
{
Document document;
DocumentBuilder documentBuilder;
DocumentBuilderFactory documentBuilderFactory;
NodeList nodeList;
Comment comment;
try
{
documentBuilderFactory = DocumentBuilderFactory... |
7f365e54-e17f-4ab2-94ae-04ddc43c0e96 | 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.g... |
a24d2d1a-c069-4e67-93c1-d88a13b0ede7 | 4 | final public void run()
{
// call the hook method to notify that the server is starting
serverStarted();
try
{
// Repeatedly waits for a new client connection, accepts it, and
// starts a new thread to handle data exchange.
while(!readyToStop)
{
try
{
... |
9692aa26-5169-47b1-9b90-0e0446c129bc | 3 | private boolean getDataBlock(int leafItemIndex) {
// check for valid data block
if (leafHitList == null || leafItemIndex >= leafHitList.size())
return false;
// Perform a block read for indexed leaf item
leafHitItem = leafHitList.get(leafItemIndex);
// get the chro... |
6a590cd8-87db-4b2f-8b1b-d478ad9c533d | 6 | private void drawTiles(Graphics2D g) {
int dtile;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
dtile = (i + scroll.getValue()) * height + j;
if (dtile < 1024) {
Image tileImage = MapDisplay.getTileImage(TileEditor.getDrawTilesetNumber(tilesetChooser.ge... |
d54dbfab-a456-459f-9328-aa68c1234353 | 2 | public boolean isPresent(String key)
{
for (int bucketIndex : getHashBuckets(key)) {
if (!filter_.get(bucketIndex))
{
return false;
}
}
return true;
} |
be549bb0-07a2-4faf-854e-0bdfde40c790 | 8 | @SuppressWarnings("unchecked") // FIXME in Java7
public TradeRouteDialog(FreeColClient freeColClient, final GUI gui,
Unit unit) {
super(freeColClient, gui);
this.unit = unit;
deassignRouteButton.addActionListener(this);
deassignRouteButton.setToolTipText... |
04e5a66b-dbac-45e5-a9b0-804c910e97df | 3 | public String get() {
String toReturn = "";
int highest = -1;
Probability prob;
if (Math.random() * 10 > 5) {
for (int i = 0; i < probs.size(); i++) {
prob = probs.get(i);
if (prob.occurances > highest) {
toReturn = prob.afterLetter;
}
}
} else {
Probability pro = probs.get((int) (Ma... |
9d219050-d1fc-4e58-9062-08da5f70cc13 | 7 | @Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if(!super.okMessage(host,msg))
return false;
if((msg.targetMinor()==CMMsg.TYP_REMOVE)
&&(msg.target()==affected)
&&(affected instanceof Item)
&&(((Item)affected).amWearingAt(Wearable.WORN_LEGS)||((Item)affected).amWearingAt(Wearable.WORN... |
a7840b89-3ba5-42e4-9e93-955c7f0a849c | 4 | public void sortAnagrams3(String[] arr) {
HashMap<String, LinkedList<String>> hm = new HashMap<>();
for (String s : arr) {
String key = sortString(s);
if (!hm.containsKey(key)) {
hm.put(key, new LinkedList<String>());
}
LinkedList<String> anagrams = hm.get(key);
anagrams.push(s);
}
//O(n^2)
... |
7d12a48a-9c8d-41b8-9cb6-93f04610a91a | 5 | public double weightedStandardDeviation_as_Complex_ConjugateCalcn() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weighti... |
b4e849b3-3fba-4de9-847d-ea6287a23d2b | 0 | public void setName(String name) {
this.name = name;
} |
ecb96cb7-5742-4eac-ad3b-f8bbeda18425 | 6 | @Override
public void addElement(GameFieldElementEvent e) {
SpriteGroup group;
//Проверка наличия файла с изображением
try {
BufferedImage image = ImageIO.read(new File(getImage(e.element)));
Sprite sprite = new Sprite(image, e.position.x, e.position.y);
... |
e25e6791-70de-4b8e-889f-fe5a058b296e | 5 | double scoreCutOff() {
// Create a list of p-values
ScoreList scoreList = new ScoreList();
for (String geneId : geneSets.getGenes())
if (geneSets.hasValue(geneId)) scoreList.add(geneSets.getValue(geneId));
double quantile = scoreCutOffQuantile;
if (orderDescending) quantile = 1 - scoreCutOffQuantile;
d... |
401b1af4-01b8-4f80-be57-baf6f2cc5d49 | 8 | public Picture getOppositeCornerImage() {
Color[][] col = new Color[h][w];
Color c;
int r=0;
int g=0;
int b=0;
for (int i=green.length-1; i>=0; i--) {
for (int j=green[0].length-1;j>=0; j--) {
for (int k=green[0][0].length-1; k>=0; k--) {
if (green[i][j][k]==1)
... |
d54468fd-db8c-40a7-a37f-1b6ff534e9e2 | 3 | public boolean start(){
display("Connecting to the server...");
try {
socket = new Socket(server, port);
} catch (IOException e) {
display("Error: Error on connecting to the server... " + e.getMessage());
System.out.println(e.getMessage());
e.pr... |
bf6edea6-c20a-4000-a280-ba4f120061f1 | 9 | public GenericCrud(Object beanObj, String fromQuery, MyDatabase database) {
this.database = database;
this.beanObj = beanObj;
this.fromQuery = fromQuery;
//Check for annotations
if (tablesFields.containsKey(beanObj.getClass().getName())) {
tableFields =... |
f5d0b9e2-75ad-4c09-9f59-cc6cfd2af0c8 | 3 | public boolean existeProducto(String nombre, int numRef){
getLista g = new getLista();
ListaProductos = g.getListaProductoSolo();
for(int i = 0;i<ListaProductos.size();i++){
if(ListaProductos.get(i).getNombre().equals(nombre) || ListaProductos.get(i).getNumRef()==numRef){
... |
553a8673-0074-40a2-b5d0-cf5ded603a9f | 1 | public T ProcurarPor(PK id) throws SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement(sqlSelect);
fillSqlSelect(ps, id);
//ps.setInt(1, id);
rs = ps.executeQuery();
List<T> results = getResults(rs);
if... |
b80014ba-682a-4dcd-8edb-3dbbfec1b321 | 6 | public static void menu(){
System.out.println("Please select an option.");
System.out.println("1:Create a new contact");
System.out.println("2:Print your entire contact list");
System.out.println("3:Search your contact by last name");
System.out.println("4:Quit the program");
System.out.pr... |
c8695b5b-a169-47f0-80f7-8d5495e51f5c | 0 | public void setAgentsField(int agents) {
agentsField.setText(String.valueOf(agents));
} |
470893f1-b83e-43ca-bc55-083e8bf36829 | 3 | private void listButtons(boolean enable)
{
/*for(int i = 0; i < Game.gui.BCOUNT; i++)
{
if(btList.get(i) == null) {
Game.gui.setButton("", i, true);
}
else {
Game.gui.setButton(btList.get(i), i, !enable || done);
}
... |
fd1166ea-6007-4d86-8ecf-5c728a4e4fef | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
3d2403f9-8264-4345-b725-4d842a5129bf | 3 | public void draw() {
for(int x = 0; x<actions.size(); x++) {
if(actions.get(x).hasText())
actions.get(x).getText().draw();
}
for(int x = 0; x<textboxes.size(); x++) {
textboxes.get(x).draw();
}
} |
fae954bb-c9c2-49df-93a9-210d6701600e | 9 | protected final void processValue(CharSequence value, XPathContext context) throws XPathException {
int nameCode = evaluateNameCode(context);
// if (nameCode == -1) {
// return null;
// }
SequenceReceiver out = context.getReceiver();
int opt = getOptions();
int a... |
3cae66c5-17fc-4a29-8e41-3a40f765caf5 | 8 | protected void performPlaceCallback(){
if (parent == null){
return;
}
if (!parent.isVisible()){
return;
}
if (parent.gamestate.gameFinished){
return; //game is over
}
AIBundle bundle = null;
try {
bundle = workerThread.get();
} catch (InterruptedException e){
} catch( ExecutionExcept... |
2953c6d0-6b7d-4e90-b9cb-9443ffbcdbc2 | 0 | public void setConsumerKey(String consumerKey) {
this.consumerKey = consumerKey;
} |
020569f7-13d3-4566-80af-ccaf612f60b4 | 0 | public String getPath() {
return this.path;
} |
71cc40be-f513-48cf-8def-3b5749c7ca4a | 0 | public int getCol()
{
return y;
} |
2df59b02-251c-4bbe-ad88-c68bf934fd84 | 3 | public boolean isTwoPairs(String cards[], int n) {
int count = 0;
for (int i=0; i<n-1; i++) {
if (cards[i].charAt(1) == cards[i+1].charAt(1)) {
count++;
i++;
}
}
if (count == 2)
return true;
else
return false;
} |
f9cf0a70-5038-49ef-b3c5-9da79fcc3d0e | 5 | @Override
public String write_the_aff(){
Sentence_tree st = this;
for(int index = 0; index < st.children.length; index++){
if(st.children[index].root.get_function().equals("aff")) return " se ";
else if(st.children[index].root.get_function().equals("aux_tps")){
for(int i = 0; i < st.children[index].child... |
1abf4706-8349-496f-804a-b38b1b7f3108 | 7 | public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "msg", false)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
if (args.length == 0) {
return false;
}
Player pla... |
4613f720-b6a4-4954-973d-faef394e6233 | 5 | public static void main(String[] args)
{
int secretNumber;
Scanner input = new Scanner(System.in);
int guess;
int answer;
do
{
secretNumber = (int)(Math.random() * 999 + 1);
System.out.print("Guess a number: ");
guess = input.nextInt();
System.out.printf("Your guess is %d.\n", guess)... |
3ea92aeb-81a4-4acb-8884-4e3acaf0bc25 | 2 | public static <T> int searchArray(T[] a, T key) {
for (int i = 0; i < a.length; i++) {
T t = a[i];
if (t == key) {
return i;
}
}
return -1;
} |
26e1cd1a-8c45-4409-a661-f54d79044a58 | 5 | public PrimsMST( AbstractGraph<BCNode,BCEdge> G){
// initialize new MST graph
_minimumSpanningTree = new UndirectedSparseGraph<BCNode,BCEdge>();
// V is the set of all vertices in G
ArrayList<BCNode> V = new ArrayList<BCNode>();
V.addAll(G.getVertices());
// pick ... |
f675d121-019f-4e16-9e24-12d3555ec9b8 | 0 | public boolean isBlockTransition() {
return blockTransition;
} |
02868257-5f88-4911-a576-ca963b154622 | 7 | public void applyUpdate(Contact update) {
if (update == null) return;
if (update.getId() != 0 && update.getId() != this.getId() )
throw new IllegalArgumentException("Update contact must have same id as contact to update");
// Since title is used to display contacts, don't allow empty title
if (! isEmpty( upd... |
c57473db-66cd-42c0-ba8c-a5163c99b6f1 | 3 | public Shader(String _vertexShader, String _fragmentShader) {
super();
try {
vertexShader = createShader(_vertexShader, ARBVertexShader.GL_VERTEX_SHADER_ARB);
fragmentShader = createShader(_fragmentShader, ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);
}
catch(Exception exc) {
exc.printStackTrace();
... |
3e836425-4f46-43ed-b203-b03b1737c4e0 | 1 | @Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
if(e.getClickCount() == 2){
int index = list.getSelectedIndex();
ClientContact client = clientContactCurrent.get(index);
String guestName = client.getName();
RequestChatHandler request = new RequestChatHandler(client.... |
7d15e67a-b5c8-4928-baf2-b33c6083b150 | 9 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/**
* Servlet ottaa vastaan paistetun tai toimitetun tilauksen ID-numeron,
* joka merkitään tietokantaan paistetuksi tai toimitetuksi.
* Toiminnon voi myös peruuttaa.
*/
// Kumman l... |
8aa4db0a-efce-4791-aa53-42aeaf95e977 | 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();
if (string... |
f8c42247-ac05-4b54-b1d0-4c19a5f38b85 | 2 | public boolean hasComponent(String key){
for (GameComponent component:components){
if (component.getName().equals(key)) return true;
}
return false;
} |
4de7caa8-73d4-4ce8-b678-7074024a1be4 | 3 | public void setHSBRightCorner(Component component) {
if (mHSBRightCorner != component) {
if (mHSBRightCorner != null) {
remove(mHSBRightCorner);
}
mHSBRightCorner = component;
if (mHSBRightCorner != null) {
add(mHSBRightCorner);
}
}
} |
a8074990-d6cb-4ebf-bf52-ecfa367268d4 | 6 | @Override
protected void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
super.paintComponent(g2);
// If initialized
if (viewImage != null && imageDimension != null) {
if (scaledImage == null || // If not yet scaled, or needs rescaling
... |
c2149d1b-4243-40cd-8a14-9b16adb89d63 | 5 | public static boolean isReservedForwardSlash(String candidate) {
int START_STATE = 0;
int TERMINAL_STATE = 1;
char next;
if (candidate.length()!=1){
return false;
}
int state = START_STATE;
for (int i = 0; i < candidate.length(); ... |
ac123ac9-e35e-43c6-9d6a-8ec289259075 | 4 | public TestInfo stopInTheCloud(String userKey, TestInfo testInfo) {
if (userKey == null || userKey.trim().isEmpty()) {
BmLog.debug("Test cannot be stopped in the cloud, userKey is empty");
return testInfo;
}
String url = this.urlManager.testStop(Constants.APP_KEY, userKey... |
d20b649d-ad18-4700-804b-f0cc539d9b84 | 2 | @Override
public Object exec(List params) throws TemplateModelException {
if(params == null || params.size() < 1){
throw new InvalidParameterException("invalid prams");
}
return RegexUtil.hump2snake(params.get(0)+"");
} |
0ee3dc84-9546-4d6a-a702-1a5f212f9fc1 | 9 | private CSVParser()
{
int yearIndex = 0;
int monthIndex = 1;
totalEntry=new ArrayList<DateWiseEntry>();
BufferedReader br = null;
String line = "";
try {
br = new BufferedReader(new FileReader(Constants.FilePath));
// Extr... |
a37f88b6-77d0-49f1-a8b9-b78ec85e24be | 2 | public void run() {
while (true) {
try {
updateJson();
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
625201fc-c3c4-47c7-8342-a05116d700f9 | 6 | private void run() {
isRunning = true;
int frames = 0;
long frameCounter = 0;
final double frameTime = 1.0 / FRAME_CAP;
long lastTime = Time.getTime();
double unprocessedTime = 0;
while (isRunning) {
boolean render = false;
long startTime = Time.getTime();
long passedTime = startTime - last... |
0e1a1107-aa5f-4370-9a62-051322dae8db | 6 | @Override
public void actionPerformed(ActionEvent event) {
Object source = event.getSource();
if (source instanceof JButton) {
JButton button = (JButton) source;
if (button == buttonOpen) {
openFile();
} else if (button == buttonPlay) {
if (!isPlaying) {
playBack();
} else {
stopPlay... |
47042e4e-beeb-4387-abdb-9c56cab01be5 | 0 | public static void main(String[] args) throws IOException {
// //创建文档并设置文档的根元素:第一种方式
//
// Document document = DocumentHelper.createDocument();
//
// Element root = DocumentHelper.createElement("学生手册");
//
// document.setRootElement(root);
//创建文档并设置文档的根元素:第二种方式
Element root = DocumentHelper.creat... |
87c7b177-10ba-4463-9842-6dae1a8a87b4 | 0 | @Override
public void setPostalCode(String postalCode) {
super.setPostalCode(postalCode);
} |
719f4a79-7088-4363-ab96-30e9ac92a1fc | 1 | public String getName() {
if (cachedName == null)
cachedName = constPool.getUtf8Info(name);
return cachedName;
} |
0640a3d6-55e1-4fa8-ba36-846009d4010f | 7 | private void checkLogLevel(String[] tokens) {
if (tokens[1].equals("ALL") || tokens[1].equals("DEBUG") || tokens[1].equals("INFO") || tokens[1].equals("WARN")
|| tokens[1].equals("ERROR")|| tokens[1].equals("FATAL") || tokens[1].equals("OFF")) {
Application.clientLogic.logLevel(Level.toLevel(tokens[1]));... |
97ea0337-f25b-40a6-914b-954faf779049 | 6 | public static void returnWord(String word) {
String current = "";
for (int i = 0; i < word.length(); i++) {
if (Character.isLetter(word.charAt(i)))
current += (Character.toLowerCase(word.charAt(i)));
else {
if (current.length() > 0 && !map.containsKey(current)) {
map.put(current, pos++);
lis... |
e46dce0a-1d1b-4e63-83fe-756e76f4f314 | 1 | private void registerLifecycle(Environment environment) {
Map<String, LifeCycle> beansOfType = applicationContext.getBeansOfType(LifeCycle.class);
for (String beanName : beansOfType.keySet()) {
LifeCycle lifeCycle = beansOfType.get(beanName);
environment.lifecycle().manage(li... |
fef614bf-ba1d-46a7-b12f-07f01787c0b1 | 4 | @Test
public void testMultiThreadIteration() {
ActorSet as = new ActorSet();
Thread[] threads = new Thread[16];
for (int i = 0; i < threads.length; i++)
threads[i] = new TestWorker(as, i);
for (Thread t: threads)
t.start();
try {
for (T... |
69641c24-a365-4baa-be5d-4aa36717b82b | 3 | protected int getKnownAttributeCount() {
int count = 0;
if (constant != null)
count++;
if (syntheticFlag)
count++;
if (deprecatedFlag)
count++;
return count;
} |
c832fe6f-c320-483d-8291-9008f3b1faf7 | 0 | public double getAvb() {
return avb;
} |
bc767339-f1a4-4855-9711-21ab00fe6253 | 8 | public boolean setDirections(JSONArray directionArray, int levelArg){
// TODO: check you can't specify longer directions than
// your droid level permits. The loop won't do too many
// steps anyway, but we should send back a message.
directions = new String[directionArray.length()];
try {
for(int i = 0; i < d... |
3528fb0f-db90-47c1-b2b6-8a2a6e3222d7 | 1 | public static void shutdown()
{
if (mStream != null)
mStream.close();
} |
15af72b4-5a96-451d-a277-4e1820d5933b | 7 | public Point getExtremum(Function function, Interval interval, double e) {
Point a = interval.getX1();
Point b = interval.getX2();
ExtremumType extremumType = interval.getExtremumType();
Point x = getX(a, b);
int iteration = 0;
do {
iteration++;
Co... |
27264462-6dd4-457a-bb94-490cf07030e9 | 1 | public JTextField getFontFamilyTextField()
{
if (fontFamilyTextField == null)
{
fontFamilyTextField = new JTextField();
fontFamilyTextField.addFocusListener(
new TextFieldFocusHandlerForTextSelection(fontFamilyTextField));
fontFamilyTextField.addKe... |
abe52a63-1d31-4b8e-950b-eae12cef09dd | 5 | public void update(Player p){
int px = p.getPosition().getX();
int py = p.getPosition().getY();
if(p.getPosition().equals(WIN_POSITION)){
Game.win();
return;
}
if(mapMatrix[px][py] == VISITEDCODE){
if(p.getState()!=Player.INVALIDSTATE){
p.updateState(Player.DEADSTATE);
mapMatrix[px][py] = DEA... |
1a40678c-cf17-4bd4-b25c-ea269891a7c8 | 2 | public static void checkAutoSaveConfigYAML() {
File save = new File(path + "AutoSave/config.yml");
if(!save.exists()){
try {
save.createNewFile();
FileConfiguration s = YamlConfiguration.loadConfiguration(save);
s.set("Interval.Hours", 0);
s.set("Interval.Minutes", 30);
s.set("Interval.Second... |
85aab088-f2f4-4821-baca-ded3d20205d6 | 1 | public boolean reduceMana(int value){
boolean v = false;
if(mana - value >= 0){
mana-= value;
v = true;
}
return v;
} |
567287ae-6688-4316-a400-34a57910902c | 4 | public Object clone(){
if(this==null){
return null;
}
else{
int nr = this.numberOfRows;
int nc = this.numberOfColumns;
Matrix b = new Matrix(nr,nc);
double[][] barray = b.getArrayReference();
b.numberOfRows = nr;... |
5090f705-03ec-44ba-b6a8-c6a46e10ed32 | 4 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (dead ? 1231 : 1237);
result = prime * result + dynamite;
result = prime * result + dynamiteTier;
result = prime * result
+ ((listeners == null) ? 0 : listeners.hashCode());
result = prime * result
+... |
52a82729-5f43-4dae-a499-2980f2dfdf37 | 0 | private void logClear(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logClear
world.resetStepThrough();
}//GEN-LAST:event_logClear |
f5f29164-da84-440a-9e3b-2c1d0c5015d2 | 3 | public void drawBuildings(Graphics2D g) {
BufferedImage bimg;
ImageObserver io = (img, infoflags, x, y, width, height) -> false;
Color bborder = new Color(0xFF32F2);
int offset = 2;
g.setColor(border);
g.setBackground(bborder);
for (Building building : game.pl... |
b16a5548-3c75-4443-b9fd-f44eda2fcfad | 1 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String msj_exito =... |
16cc1c15-e317-4a4b-9f24-1786873e58ce | 5 | static void decrypt(){
endText = new String[startText.length];
endText[0] = "UNENCRYPTED";
for(int i=1; i < startText.length; i++){
String[] temp = startText[i].split(" ");
for(int j=0; j < temp.length; j++){
try{
temp[j] = decrypter.decryptNumber(Integer.parseInt(temp[j]));
}c... |
e24c24a4-bb7a-4cfa-99dd-073ab828958b | 8 | @Override
public void update(Observable o, Object arg) {
if (presenter.getGames().size() > numGames || getNewNumberOfPlayers() > numPlayers) {
this.getJoinGameView().setGames(presenter.getGames(), presenter.getPlayerInfo());
numGames = presenter.getGames().size();
numPlayers = getNewNumberOfPlayers();
th... |
20d64c89-d107-420b-8b77-30847076ca67 | 8 | @Override
public JsonElement serialize(DataItem src, Type typeOfSrc, JsonSerializationContext context) {
JsonObject object = new JsonObject();
if (src.getName() != null) {
object.add("name", context.serialize(src.getName()));
}
if (src.getDoc() != null) {
object.addProperty("doc", src.g... |
110afda3-5a20-4532-beaa-75c971da7da5 | 3 | public boolean mousedown(Coord c, int button) {
parent.setfocus(this);
raise();
if (super.mousedown(c, button))
return (true);
if (!c.isect(tlo, sz.add(tlo.inv()).add(rbo.inv())))
return (false);
if (button == 1) {
ui.grabmouse(this);
dm = true;
doff = c;
}
return (true);
} |
ca869d1e-086a-4dc8-9621-d81ead773408 | 2 | @Override
public int getFirstSlotLocationY() {
return currentContainer == 2 ? centerY + 12 : isNotPlayerInventory() ? GamePanel.HEIGHT/2 - 75/2+ 8 :GamePanel.HEIGHT/2 - 75/2 + 32;
} |
e4fbb6b9-fd54-48a8-8a02-4af9dc807254 | 0 | @Override
public int getWidth() { return width; } |
cb5a62fe-b1ef-4836-a632-d7a5df028c6e | 3 | @Override
public void updateLong() {
super.updateLong();
if(generationTimerEnd == 0) {
resetGenerationTimer();
}
if(generationTimerEnd <= System.currentTimeMillis() && this.isActivated()) {
placeableManager.playerAddItem("Copper", 1);
... |
662e571a-9711-498b-9c87-ebc9e40e17fb | 8 | public PostObject(String category, String... paramList) {
if(paramList.length == 0 || paramList.length % 2 != 0)
throw new RuntimeException("PostObject's paramList length must be even, and greater then 0");
if(APIKEY_LABEL.equals("") == false && APIKEY_VALUE.equals("") == false)
mPostObjectMap.put(APIKEY_L... |
54f0a205-057a-4ae1-bb1a-8592459c696b | 3 | public void setVariavel(PVariavel node)
{
if(this._variavel_ != null)
{
this._variavel_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(... |
09cde4de-b6c0-4b7f-b87f-539ddc0a1af9 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ValidatePK other = (ValidatePK) obj;
if (idPresidingOfficier != other.idPresidingOfficier)
return false;
if (idRepport != other.idRepport)
... |
8583bd74-cb55-4813-9b96-2416bb3241ef | 7 | public String ableToCatchAll(int[] x, int[] y) {
String yes = "Able to catch";
String no = "Not able to catch";
Map<Integer, List<Integer>> points = new HashMap<Integer, List<Integer>>();
for (int i = 0; i < x.length; i++) {
List<Integer> list = points.get(y[i]);
if (list == null) {
list = new Arra... |
5097e1c1-c0ed-45b8-bd5d-bf3008cc5738 | 2 | public void svg2png(File svgFile, File pngFile, boolean fast) throws ConverterException, FileNotFoundException {
if(fast || inkscapePath==null) {
svg2pngUsingBatik(svgFile, pngFile);
}
else {
svg2pngUsingInkscape(svgFile, pngFile);
}
} |
2f5abffc-1106-4a51-91b1-b0350f701d94 | 1 | @Override
public Cotacao save(Long id, HashMap<String, Object> map) throws ValidationException {
System.out.println(map.get("CPF").toString() + " " + map.get("Solicitante").toString() + " " + map.get("Data Solicitacao").toString());
HashMap<String, String> vo = new HashMap<String, String>();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.