method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8b70bfd9-e324-4c26-abd6-c5735535ae73 | 8 | @Override
public void excecuteCommand(String channel, String sender, String message) throws Exception {
this.channel = channel;
String[] args = message.split(" ");
switch(args[1]) {
case "start":
if(GAMES.containsKey(sender)) {
GAMES.get(sender).start();
} else {
GAMES.put(sender, new Bla... |
299e06cb-c233-49ea-b59b-cc94c09b808f | 8 | public static boolean computeCell(boolean[][] world, int col, int row)
{
// liveCell is true if the cell at position (col,row) in world is live
boolean liveCell = getCell(world, col, row);
// neighbours is the number of live neighbours to cell (col,row)
int neighbours = countNeighbours(world, col... |
7ac21770-d483-4122-bd59-f4fbbbc5b3a8 | 6 | public static float GetAxis(String axis) {
if (axis.equalsIgnoreCase("Horizontal")) {
if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
return 1;
}
if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
return -1;
}
return 0;
}
else if (axis.equalsIgnoreCase("Vertical")) {
if (Keyboard.isKeyDown(Keyboard.KEY... |
839d5edb-4f41-4965-843b-ee3dc91db287 | 9 | public void createResPackDir(File file){
if(getExtension(file) == null){
if(!file.exists())createDir(file);//Create resourcepack folder
createDir(new File(file.getPath() + "/assets"));//create assets folder
if(!new File(file.getPath() + "/assets/minecraft").exists())createDir(new File(file.getPath() + "/... |
8dc37a88-c86a-4bff-bb5c-180a2b4f92f5 | 6 | private static <T> PartitionList<T> eparition(PartitionListElement<T> tail2) {
PartitionList<T> returner = new PartitionList<T>();
for(int i = 1; i <= tail2.size(); i++){
PartitionListItem<T> partition = OrderConstrainedPartitionList.partition(tail2, i);
returner.add(partition);
if(partition.size() > 1... |
e144828a-3356-485a-8557-ced2f1b9c1a7 | 1 | private URL getURL(String filename) {
URL url = null;
try {
url = this.getClass().getResource(filename);
} catch (Exception e) {
System.out.println("Error en " + e.toString());
}
return url;
} |
802e71ec-709f-4fa6-9bb6-3abfa3ec638b | 2 | private Enemy getEnemyById(String id) {
for (Enemy e : getEnemies()) {
if (e.getId().equals(id))
return e;
}
return null;
} |
6e7c8360-e28a-492d-b481-1775a5de540c | 0 | public void pushPlusOperator(){
((Vector)operatorStack).add(0, new PlusOperator());
} |
a315950b-c743-4c4d-b500-526d1de3ac66 | 1 | public Object whoIsRight(Object a, Object b)
{
Random r = new Random();
if(r.nextBoolean())
{
return a;
}
return b;
} |
432f2f96-f9ac-4487-a72b-ed6a47606d89 | 8 | private boolean inPoly(FastVector ob, double x, double y) {
//brief on how this works
//it draws a line horizontally from the point to the right (infinitly)
//it then sees how many lines of the polygon intersect this,
//if it is even then the point is
// outside the polygon if it's odd th... |
47620f06-f765-42ad-ae71-130649cec9dd | 7 | private void buildTrees(final Block firstBlock, final Map labelPos) {
db(" Building trees for " + firstBlock);
// Maps a "catch block" (beginning of exception handler that
// stores the exception) to a "catch body" (the code immediately
// follows the "catch block" -- the rest of the handler).
final HashMap... |
e4cb5c8c-82c5-4f8c-a6d0-103de89a7f97 | 8 | public static void compileGafAssetsFile(String prjCompileDir, String prjGameName, String prjDir) {
File selectedFile = new File(prjCompileDir + File.separator + prjGameName.toLowerCase() + ".assets.cache.jar");
File content = new File(prjDir);
File[] files = content.listFiles();
assert f... |
8006afad-d803-40ef-8609-faaf6ad96cb8 | 6 | public void setModelValue(Object obj) {
if (autoInsertCancel) {
this.autoInsertCancel = false;
}
// closing the editor if for some reason it is still active:
if (this.getCellEditor() != null) {
this.getCellEditor().stopCellEditing()... |
454a6b36-0710-40eb-be07-022b4a43616d | 1 | public String getTunnisteet(){
String palautettava = "";
for (String tunniste : tunnisteet) {
palautettava += tunniste + " ";
}
return palautettava;
} |
ca3ff720-b397-45bf-b0ca-692d6d97e0de | 7 | public void drawItem(Graphics2D g2,
XYItemRendererState state,
Rectangle2D dataArea,
PlotRenderingInfo info,
XYPlot plot,
ValueAxis domainAxis,
ValueAxis rangeAxis,
... |
81bae866-e8c7-4b85-b4ac-4080d28a9b02 | 3 | public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
t... |
86d99c83-d38f-4fe5-8faa-00444acbf3bc | 3 | public static Map<Class<? extends Object>, List<String>> config(String path) throws NoConfigException {
Map<Class<? extends Object>, List<String>> ret = configs.get(path);
if (null == ret)
return initConfig(path);
return ret;
} |
4697aa20-4358-4c14-b42e-31c129450683 | 5 | public Object showScoreList(String term) {
String command = "show;student_score_list;" + term;
ArrayList<String> list = null;
String[][] content = null;
try {
NetService client = initNetService();
client.sendCommand(command);
list = client.receiveList();
content = new String[list.size()][];
for (... |
ffbcb821-c6f6-4c4c-9e4e-ad7c7f144d6e | 3 | public boolean canMove()
{
Grid<Actor> gr = getGrid();
if (gr == null)
return false;
Location loc = getLocation();
Location next = loc.getAdjacentLocation(getDirection());
if (!gr.isValid(next))
return false;
Actor neighbor = gr.get(next);
... |
4db2cd71-9ef5-4a7a-8f6e-54ab3168770c | 0 | public static void testSeqRead() throws IOException{
Read rd = new Read();
rd.startTest();
} |
4c3f4508-2221-42cd-b22a-397052af12a1 | 0 | public void lastStep(Context ctx) {
ctx.setState(null);
} |
40786ced-87e5-46bd-b961-984526702f58 | 0 | @Override
public void removeExtension(String ext) {
extensions.remove(ext);
} |
2191e5e3-7686-4779-aa53-fb2a8c1caaef | 7 | public double timeLengthRank(double percentage)
{
boolean cutOffNotOkay=true;//determines if cut off is appropriate
Collections.sort(library,TimeLengthComparator.getTL());
double percentageOfMean=percentage*1.5;
while(cutOffNotOkay)
{
int count=0;
double cutoff= tlMean *percentageOfMean; // the cut of... |
996e6d0d-93dc-42ec-9f84-9910881b5db9 | 0 | public static void main(String[] args) throws Exception {
ObjectOutput out = new ObjectOutputStream(new FileOutputStream("X.file"));
Alien quellek = new Alien();
out.writeObject(quellek);
out.close();
} |
99d442a6-ab6a-4772-9f16-f2494bf4b5a3 | 6 | public void setAlphabet(String regex) {
int i = 0;
for (char c = regex.charAt(i); i < regex.length(); i++) {
if (c == '[') {
break;
}
}
if (i >= regex.length()) {
throw new IllegalArgumentException("Regex may only contain a group");
}
for (char c = regex.charAt(i); i < regex.length(); i++) {... |
0818812e-5202-4d74-8565-42165cc139f2 | 0 | public void clickTutorial() {
state.clickTutorial();
} |
b0b8b5de-ad3a-4e9a-b60f-e365a6b9617d | 1 | public static void main(String[] args) {
Model m = new Model();
m.getSearchFormats().add("mp3");
m.getSearchFormats().add("mov");
m.getSearchFormats().add("m4v");
m.getSearchKeywords().add("Videos");
m.getSearchKeywords().add("movies");
Controller controller = new Controller(m);
final testFrame t = new testF... |
f6dd139d-6fb7-4b91-a8ab-cf2deac06450 | 4 | public void close () {
boolean wasConnected = isConnected;
isConnected = false;
tcp.close();
if (udp != null && udp.connectedAddress != null) udp.close();
if (wasConnected) {
notifyDisconnected();
if (INFO) info("kryonet", this + " disconnected.");
}
setConnected(false);
} |
eec9dfbf-a9ee-4e34-b05f-3d314856c827 | 2 | public void reachableReference(Reference ref, boolean isVirtual) {
String clName = ref.getClazz();
if (clName.charAt(0) == '[')
/* Can't represent arrays */
return;
ClassIdentifier ident = getClassIdentifier(clName.substring(1,
clName.length() - 1).replace('/', '.'));
if (ident != null)
ident.reach... |
ccc1e1b3-b3cf-4d68-b800-041e1fd93a90 | 9 | protected TemplateIssue createTemplateIssue(String sourcePath,
CompileEvent event) {
SourceInfo info = event.getSourceInfo();
if (info == null) {
return null;
}
CompilationUnit unit = event.getCompilatio... |
07aad85f-1ab5-4002-aaae-2ff1f5a38939 | 6 | private void runParkingDisplay(Scanner scan, PrintWriter pout,
String spotNumber)
{
spot = garage.searchBySpotNumber(spotNumber);
if(!isConnectionAvailable(spotNumber))
{
System.out.println("Another display is connect... |
377a6b17-4887-4120-989a-73b5816cfebb | 5 | public static boolean isReservedMinusOp(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(); i++)
... |
e21b701b-5282-4313-b605-dd6b317bddb9 | 7 | String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... |
82d4c8dc-b953-4912-b66d-927c5222b202 | 4 | @Override
public byte[] getData()
{
if (ptr != 0) {
return null;
} else {
if (isConstant()) {
if (length > getMaxSizeOf32bitArray()) return null;
byte[] out = new byte[(int) length];
for (int i = 0; i < length; i++) {
... |
27c775e8-3180-4055-a590-386585a8ea67 | 0 | private void action(final String input) throws ParseException {
String s1;
s1 = calcWeekDay(input);
System.out.println(s1);
} |
a0b9ec25-21be-4a20-ae81-3bb0ff4b42db | 4 | public boolean isValidStatus(String status){
if(status.equals("available") || status.equals("lost") ||status.equals("checked-out")||status.equals("in-queue"))
return true;
else
return false;
} |
98754a1a-5c90-47ae-bee2-0599abb52c90 | 5 | @Override
public void onNeighborBlockChange(Block blockChanged) {
int meta = tileEntity.getBlockMetadata();
boolean valid = isRailValid(getWorld(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, meta);
if (!valid) {
Block blockTrack = getBlock();
blockTrack.... |
b8a0c81d-6c72-4f53-a0c6-67a4bb4091b9 | 1 | public String getPlayersName() {
String resultName = "";
for (Player player : players) {
resultName += player.getName() + "\n";
}
return resultName;
} |
92bc76aa-5759-4322-8eaf-30c9b7abce6b | 5 | public static Object fromReflectType(String typeSig, Object value) {
switch (typeSig.charAt(0)) {
case 'Z':
return new Integer(((Boolean) value).booleanValue() ? 1 : 0);
case 'B':
case 'S':
return new Integer(((Number) value).intValue());
case 'C':
return new Integer(((Character) value).charValue());... |
65c46a46-6a67-47d8-995e-bb5e82856665 | 5 | private Item nextToCatalogue() {
float quality = Float.POSITIVE_INFINITY ;
Item catalogued = null ;
for (Item i : stocks.matches(DATALINKS)) {
if (! (i.refers instanceof Skill)) continue ;
if (i.quality < quality) { catalogued = i ; quality = i.quality ; }
}
if (catalogued == null || cat... |
880a4514-d98c-42c9-ab4b-5fb9720df9ff | 7 | public static void rotateLeft2(int[] array, int shift) {
if (shift <= 0 || array == null || array.length <= shift) {
throw new IllegalArgumentException("Invalid args");
}
int n = array.length;
int i, j, k, temp;
for (i = 0; i < GCD.gcd(shift, n); i++) {
/*... |
b3a45552-6d48-4513-b6ec-8a706e663dcc | 3 | public static boolean destroy(String alias) {
if(aliasMap.containsKey(alias)) {
Shader removed = aliasMap.get(alias);
Iterator<Entry<String, Shader>> it = aliasMap.entrySet().iterator();
while(it.hasNext()) {
Entry<String, Shader> entry = it.next();
if(entry.getValue().equals(removed)) it.remove();
... |
e8c63467-ba86-420f-8706-8c582faf5ac7 | 8 | static void tumblep_drawsprites(osd_bitmap bitmap)
{
int offs;
for (offs = 0;offs < 0x800;offs += 8)
{
int x,y,sprite,colour,multi,fx,fy,inc,flash;
sprite = spriteram.READ_WORD(offs+2) & 0x3fff;
if (sprite==0) continue;
y = spriteram.READ_WORD(offs);
flash=y&0x1000;
if (flash!=0 && (cpu_g... |
bb13d419-7fa8-452e-a393-8719a37742e9 | 0 | public String getUnprocessedInput()
{
return myUnprocessedInput;
} |
7a3cce53-0844-4db1-b6d1-894c880dde69 | 7 | @Override
public List<Aluno> Buscar(Aluno obj) {
String sql = "select a from Aluno a";
String filtros = "";
if(obj != null){
if(obj.getId() != null){
filtros += "a.id = " + obj.getId();
}
if(obj.getMatricula() > 0... |
4258fd60-fccb-4648-9d35-81a4889b4a46 | 1 | public synchronized Collection getRefClasses() {
ClassFile cf = getClassFile2();
if (cf != null) {
ClassMap cm = new ClassMap() {
public void put(String oldname, String newname) {
put0(oldname, newname);
}
public Object get... |
8f8a3253-d5c8-4ec4-97db-1cb6304d8c29 | 0 | public Destination to(String s) {
return new Destination(s);
} |
55d6599e-ba8b-4bf3-8cab-ef5f7bf4f967 | 3 | @Override
public int read() {
FileInputStream fis = null;
try {
fis = new FileInputStream(src);
} catch (FileNotFoundException e1) {
return -1;
}
int result = -1;
try {
fis.skip(byteCounter++);
result = fis.read();
} catch (IOException e) {
e.printStackTrace();
}
try {
fis.... |
eeba948a-e33b-4c8b-99a1-53a86038bb61 | 5 | protected ExportData createExportData() throws RrdException
{
if ( sources == null)
throw new RrdException( "Sources not calculated, no data to return." );
// Now create a RrdDataSet object containing the results
Source[] sourceSet;
String[][] export = def.getExportDatasources();
HashMap legends = ne... |
9cf81957-e6e7-4a40-870a-4efd373b8fb0 | 3 | public void act(List<Actor> newFoxes)
{
incrementAge();
incrementHunger();
if(isAlive()) {
giveBirth(newFoxes);
// Move towards a source of food if found.
Location newLocation = findFood();
if(newLocation == null) {
... |
681cbfba-3ea9-4334-9406-eaabeb87dec4 | 3 | @Override
protected DPLotSizingDecision getDecision(DPBackwardRecursionPeriod[] periods, int setupPeriod, int nextSetupPeriod, double alpha) throws ConvolutionNotDefinedException{
//Get the vector of aggregated demand (there is no ADI in static uncertainty)
RealDistribution[] demand = new RealDistribution[nextSetu... |
b87ee9a2-ff2c-4e71-a4e2-c40ef2e29958 | 1 | public static String getPremier(String date, String state)
{
date = date.replaceAll("-", "");
DB db = _mongo.getDB(DATABASE_NAME);
DBCollection coll = db.getCollection(COLLECTION_PREMIER);
BasicDBObject query = new BasicDBObject();
query.put("start.date", new BasicDBObject("$lte", date))... |
27e8d44a-0384-49e9-84a4-8d63c0015da4 | 6 | private static void method495(char ac[])
{
int i = 0;
for(int j = 0; j < ac.length; j++)
{
if(method496(ac[j]))
ac[i] = ac[j];
else
ac[i] = ' ';
if(i == 0 || ac[i] != ' ' || ac[i - 1] != ' ')
i++;
}
for(int k = i; k < ac.length; k++)
ac[k] = ' ';
} |
99d5a269-6dad-4680-9d9a-9d4279b7120a | 1 | public Object[] lookupCflow(String name) {
if (cflow == null)
cflow = new Hashtable();
return (Object[])cflow.get(name);
} |
af2cbc8f-4849-4cc9-a584-94aeca37e2a7 | 4 | @Test
public void testMoveBackward()
{
Random rand = Mockito.mock(Random.class);
// On s'assure que le terrain et toujours franchissable.
Mockito.when(rand.nextInt(Land.CountLand())).thenReturn(0);
Robot r = new Robot();
r.land(new Coordinates(0,0), new LandSensor(rand))... |
f594204b-739e-4c40-ae1d-53c79caf5fdb | 3 | private static boolean matchesSeq(String[] words, String[]... sequence) {
// If there aren't enough words to possibly
// match the sequence, return false
if(words.length < sequence.length) {
return false;
}
// For each item in the sequence, ensure the
// word is one of the possibilities given
for(int ... |
dfcecf18-1c45-41bf-b6f7-8c2da86daae7 | 8 | @Override
public HTTPResponse handle(HTTPRequest req)
{
String HTTPAuthUsername = Config.getString(HOST, "AuthUsername", "");
if ( !HTTPAuthUsername.equals("") )
{
String responseAuthHeader = req.getHeader("Authorization");
if ( responseAuthHeader.equals("") )
{
HTTPResponse response = ErrorFactor... |
39332122-78a7-4f50-b12c-50c7b82ae051 | 9 | public static String getFeeders(ArrayList<TeamMatch> matches) {
boolean ground = false, feeder = false;
for (TeamMatch match : matches) {
if (Arrays.asList(match.getIntakes()).contains(TeamMatch.Intake.GroundPickup)) {
ground = true;
} else if (Arrays.asList(match... |
75c90e6f-90de-47a9-a8ab-a95c7a99e04e | 5 | public void mousePressed(MouseEvent e) {
super.mousePressed(e);
int selectedRow = m_tree.getRowForLocation(e.getX(), e.getY());
TreePath selectedPath = m_tree.getPathForLocation(e.getX(), e.getY());
if (selectedRow != -1) {
if (e.getClickCount() == 1) {
if (SwingUtilities.isRightMouseButton(e))
sho... |
c6072b72-b050-4802-837b-3f5e35639ec8 | 0 | private Object[] loadRow(DataStructures obj){
return new Object[]
{
Integer.toString(tableModelArrays.getRowCount()+1),
obj.getType(),
Integer.toString(obj.getLength(0)),
obj.getState(),
... |
8c7464bd-a6a2-447b-890c-6c687733cfc8 | 2 | private void setIcon(BufferedImage image)
{
Component root = SwingUtilities.getRoot(this);
if (root instanceof JFrame || root instanceof Frame)
{
Frame frame = (Frame)root;
frame.setIconImage(image);
}
} |
20b88d0a-33f9-4dfd-98d1-0adf096683f9 | 0 | public Queue(){} |
bf25df39-771f-4029-9cb7-f912bf43d769 | 5 | private static void keccakPad() {
if ((bitsInQueue % 8) != 0) {
// The bits are numbered from 0=LSB to 7=MSB
byte padByte = (byte) (1 << (bitsInQueue % 8));
dataQueue[bitsInQueue / 8] |= padByte;
bitsInQueue += 8 - (bitsInQueue % 8);
} else {
d... |
1d422cd2-276e-4cb8-b9f7-f2c9833a02ea | 8 | private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... |
77fd40c0-3747-436a-8110-431ee286c763 | 2 | public void decodeFrame() throws DecoderException
{
num_subbands = header.number_of_subbands();
subbands = new Subband[32];
mode = header.mode();
createSubbands();
readAllocation();
readScaleFactorSelection();
if ((crc != null) || header.checksum_ok())
{
readScaleFactors();
r... |
bc8dc239-7d36-4b1c-9062-27ea98b295eb | 3 | @Override
public void setPixel(int x, int y, int c)
{
int bx = x / 8;
int by = y / 8;
int offs = bx + by * (width / 8) - tileOffset;
if (offs < 0)
return;
offs *= 64;
offs += x % 8 + 8 * (y % 8);
if (offs < 0)
return;
if (... |
cdaf4bdc-78dd-4be8-a41c-9d8f916be48f | 2 | private static List<String> fillCollection(){
List<String> features = new ArrayList<String>();
HashMap<String,String> components = new HashMap<String, String>();
components.put("Settings", "Settings");
components.put("Map", "Map");
components.put("Attachment", "Attachment");
components.put("BGColor", "BGCol... |
f17c42b6-ed3c-42f3-a7cd-30b1d9038da6 | 9 | public RepositoryVm getRepoFiles(String repositoryName, String baseUrl) throws IOException {
String organizationName = ApplicationProperties.getProperties().getProperty(PropertiesConstants.GITHUB_ORGANIZATION);
Repository repository = getRepository(organizationName, repositoryName);
Release late... |
cae16da6-5d1d-4781-84e3-ef8f409734a0 | 7 | public void mergeClips(Collection<SpriteClip> mergeClips) {
if (mergeClips == null || mergeClips.size() == 0) {
return;
}
if (mergeClips.size() == 1) {
/**
* If only 1 clip is selected, then find overlapping clips and merge them.
*/
... |
7a32aa68-7ce3-49b2-887d-14a6fae9da98 | 3 | public IrodsFile asFile() throws IrodsException {
if (exists()) {
if (irodsFile.isFile()) {
return (this instanceof JargonFile) ? (IrodsFile) this : new JargonFile(conn, irodsFile);
} else {
throw new IrodsException("irods object already exists and is not ... |
8bc73137-7e9d-41eb-8d22-6fa065a251cf | 0 | public TableListener(JTable table, Preference pref) {
setTable(table);
setPreference(pref);
} |
e28c1ab7-cf61-4f5b-8fd3-35f0f012d055 | 2 | @Override
public void renderControl(Graphics2D g) {
BufferedImage control = new BufferedImage(this.getSize().getWidth(), this.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB);
BufferedImage itemsImage = new BufferedImage(this.getSize().getWidth() -10, 64 * this.Items.size(), BufferedImage.TYPE_I... |
e3b19151-c932-4814-9c63-fb03536d31b6 | 1 | public void deleteHostFromTeams(String hostName){
try {
cs = con.prepareCall("{call DELETE_HOST_FROM_TEAMS(?)}");
cs.setString(1, hostName);
cs.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
} |
a8e66d89-c545-4c94-9b03-7a81cb391d30 | 4 | public void pickedUpCoin(int xH, int yH) {
Rectangle heroCoin = new Rectangle(xH, yH, 50, 50);
if (rc1.intersects(heroCoin)) {
coinPicked1 = true;
button1Used = true;
}
if (rc2.intersects(heroCoin)) {
coinPicked2 = true;
button2Used = true;... |
899692dc-7ce7-4276-92b5-bae499a07041 | 2 | public static void save()
{
try
{
File f;
f = new File(System.getProperty("user.home") + "\\.Awesome Mario Remake\\MarioData.save");
if (!f.exists())
{
f.createNewFile();
}
FileOutputStream fos = new FileOutputSt... |
af99a4b7-9ef0-4b7c-8653-73267b85550e | 0 | public LaenderGraph() {
this.initKarte();
} |
f87a5baf-905c-4e91-b365-9b8c3b2f290e | 7 | private void paintMarker(Graphics g) {
Rectangle inside = getInside();
int length = (getOrientation() == HORIZONTAL) ? inside.width
: inside.height;
int[] xPoints, yPoints;
int value = (int) (Math.max(
0,
Math.min((1.0 / (getMaximum() - getMinimum()))
* (getValue() - getMinimum()), 1)) * len... |
6a2a1a02-8a1a-4009-9a17-126a525c0989 | 8 | public static void getControlSelect(Global global, GameContainer container){
if (global.getCurrent().getMenu().getName().equals("controlselect")){
Input input = container.getInput();
for (int i=0; i<Keyboard.KEYBOARD_SIZE; i++){
if (input.isKeyDown(i) && !input.isKeyDown(Input.KEY_LMENU)){
if (g... |
6bda55c9-92fd-4f05-9e88-818ce66e2e51 | 7 | protected void readImage() {
ix = readShort(); // (sub)image position & size
iy = readShort();
iw = readShort();
ih = readShort();
int packed = read();
lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
interlace = (packed & 0x40) != 0; // 2 - inte... |
de6900c5-f50d-484b-9741-38ac5603e491 | 7 | public static void generateNQueens(int[] position,int insertN,int n) {
for (int i=0;i<n;i++){
position[insertN-1] = i;
boolean satis = true;
for (int j=0;j<insertN-1;j++){
if(insertN-1-j==position[insertN-1]-position[j]||insertN-1-j==position[j]-position[inser... |
77b63c87-441a-4877-8244-83bf98269d6f | 5 | public int numDistinct(String S, String T) {
int[][] dp = new int[T.length() + 1][S.length() + 1];
dp[0][0] = 1;
//first column all 0
for (int i = 1; i <= T.length(); i++) {
dp[i][0] = 0;
}
//first row all 1
for (int j = 1; j <= S.length(); j++) {
... |
849055af-d9f6-4749-be04-0b6e412250fc | 7 | public static int showOptionDialog(Component parentComponent, Object message, String title, boolean resizable, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) {
JOptionPane pane = new JOptionPane(message, messageType, optionType, icon, options, initialValue);
pane.setUI(new SizeAw... |
d055cf0f-fd64-4bd7-bc5d-37f59af011b7 | 1 | @Test
public void NotOccupiedName() throws Exception {
LoginCheck logCh = new LoginCheck();
name = "sunny00000000000";
if (kesh.containsKey(name)) {
assertFalse(kesh.get(name));
} else {
boolean result = logCh.validate(name);
kesh.put(name, result)... |
42bd0954-0394-4501-8c7b-0dd4382231cb | 0 | @Override
public void method2() {
System.out.println("Running: method2()");
} |
aba0acea-fb65-4eb6-81c5-16413fdda376 | 2 | private void removeAppActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeAppActionPerformed
try {
int result = JOptionPane.showConfirmDialog(null, CONFIRM_MSG, CONFIRM_MSG_TITLE, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (result == JOptionP... |
6f23c964-7042-4c93-bf0b-27a54d3c89b1 | 2 | public static void main(String[] args) throws ParserConfigurationException, SAXException, XMLStreamException {
CommandLineParser clParser = new BasicParser();
Options options = new Options();
Option optFile = new Option(OPT_FILE, "file", true, "path to keepass xml file");
optFile.setArg... |
10fcf706-50d1-43a5-aa16-de3842300ab7 | 2 | public void set(final int portal, final Location block){
if(portal == 1) this.one = block;
else if(portal == 2) this.two = block;
else throw new IllegalArgumentException("Portal number must be 1 or 2");
} |
98824152-2791-4d46-a86b-1d55ea26afc7 | 0 | @Override
public int getWidth() { return width; } |
9bd72014-6a65-443d-ac01-21bf091ae175 | 5 | public static void main(String[] args) {
DataModel model = new DataModel();
SentenceSegmentation segmentation = new SentenceSegmentation();
List<Integer> list1 = model.getKeys1();
for (int i = 0; i < list1.size(); i++) {
// dohvati tekst ključa koji se nalazi na i-toj poziciji liste
int key = list1.get(i... |
c52ae343-5812-4929-aded-22520d19e766 | 5 | @Override
public void mouseDragged(MouseEvent evt)
{
if (!SwingUtilities.isLeftMouseButton(evt))
return;
Point current = evt.getPoint();
double x = viewer.getCenter().getX();
double y = viewer.getCenter().getY();
if(prev != null){
x += prev.x - current.x;
y += prev.y - current.y;
}
if (!vi... |
f41b9d92-72d7-491c-b7cb-ef8ad7ce58aa | 5 | public void handlePressedKeys(ArrayList<KeyButtons> keyPressed)
{
if (keyPressed.contains(KeyButtons.LEFT))
{
left = true;
}
if (keyPressed.contains(KeyButtons.RIGHT))
{
right = true;
}
if (keyPressed.contains(KeyButtons.UP))
{
... |
ba625a83-0cef-454f-baf0-00accc547ca0 | 8 | public int getSelection()
{
if(selectionOvalY == 3)
return 1;
else if(selectionOvalY == 27)
return 2;
else if(selectionOvalY == 51)
return 3;
else if(selectionOvalY == 75)
return 4;
else if(selectionOvalY == 99)
return 5;
else if(selectionOvalY == 123)
return 6;
else if(se... |
a1997a4a-b8c6-44fa-94f2-aef16efe04e7 | 8 | @Override
public void onRelocateTag( TagView tagViewToRelocate, TagView tagViewRelocationRef, InsertionPoint insertionPoint ) {
//Prevent modification between two similar TagLists
if( !this.containsTagView( tagViewToRelocate ) || !this.containsTagView( tagViewRelocationRef ) )
return;
... |
0e06d0d9-68c8-4141-bb86-aaf99d613b09 | 9 | private static void configureLoggerWrapperByConfigurator (LoggerWrapper loggerWrapper, Node configNode) {
boolean goOn = true;
Node classNameNode = configNode.getAttributes ().getNamedItem ("class-name");
String className = "(unknown)";
if (goOn) {
if (classNameNode != null) {
className = classNameNode.... |
03b2bc72-aa04-4edb-8d34-cf79c51347f0 | 1 | @Override
@SuppressWarnings("unchecked")
public JsonElement serialize(GeoJsonObject src, Type typeOfSrc, JsonSerializationContext context)
{
Class<GeoJsonObject> cls;
try
{
cls = (Class<GeoJsonObject>)Class.forName(GeoJson.class.getPackage().getName().concat(".").concat(src.getType()));
}
catch (ClassNo... |
2e05b9c0-e0f1-4ba2-aede-d864b93ebf00 | 2 | public static Transition[] getTransitionsForProduction(
Production production, VariableDependencyGraph graph) {
ArrayList list = new ArrayList();
String v1 = production.getLHS();
ProductionChecker pc = new ProductionChecker();
String rhs = production.getRHS();
for (int k = 0; k < rhs.length(); k++) {
ch... |
5f364e0a-9418-404a-a42b-6a604384277f | 5 | private AndroidMethod parseMethod(Matcher m) {
assert(m.group(1) != null && m.group(2) != null && m.group(3) != null
&& m.group(4) != null);
int groupIdx = 1;
//class name
String className = m.group(groupIdx++).trim();
//return type
String returnType = m.group(groupIdx++).trim();
//method n... |
66bea94d-6d3c-4eb8-95d6-f972e1799add | 7 | public String calculateResult(String expression) {
String result = parseExpression(expression);
Double lastOperand = 0.0;
// If no exception pop the top operand
if (result.equals("")) {
lastOperand = operands.top();
operands.pop();
}
// If no operands are left set result to the last operand
if... |
df2db9ba-6efe-4de0-a5e0-c00c02fd8df2 | 8 | @Override
public void actionPerformed(ActionEvent arg0)
{
Component f = ui;
while ((f != null) && (!(f instanceof Window)))
f = f.getParent();
if (arg0.getActionCommand().equalsIgnoreCase("Cancel"))
{
if (f != null)
f.setVisible(false);
}
else if (arg0.getActionCommand().equalsIgnoreCase("Save"... |
1626b798-c9c0-4ca4-a244-65c57d295aef | 6 | @Override
protected void dispatchEvent(AWTEvent event)
{
// Potentially intercept KeyEvents
if (event.getID() == KeyEvent.KEY_TYPED
|| event.getID() == KeyEvent.KEY_PRESSED
|| event.getID() == KeyEvent.KEY_RELEASED)
{
KeyEvent keyEvent = (KeyEvent)event;
KeyStroke keyStroke = KeyStrok... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.