method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
48bf6404-7d43-4222-b846-8674369163f6 | 6 | public String getNameAt(String baseName, int i) {
for (int f = 0; f < fieldsName.size(); f++) {
String name = fieldsName.elementAt(f);
Type type = fieldsType.elementAt(f);
// get to the next field
if ((type.size() <= i) && (f < (fieldsName.size() - 1))) {
i -= type.size();
continue;
}
/... |
8360dad9-045c-4171-a827-ed1af465ea90 | 1 | public void setByteArray( byte[] bs ){
StringBuilder builder = new StringBuilder( bs.length*2 );
for( byte b : bs ){
builder.append( Integer.toHexString( (b >> 4) & 15 ) );
builder.append( Integer.toHexString( b & 15 ));
}
value = builder.toString();
} |
50a45843-52e1-4ba1-b8fe-6c3d48f7fca8 | 3 | public long compute(int n) {
if (n == 0 || n == 1) return 1;
if (fib[n] != 0) return fib[n];
return compute(n - 1) + compute(n - 2);
} |
bff6b473-79bb-49cc-9959-8000d65db811 | 8 | public static void validate(FullCondition fullCondition)
throws CubeNotExistsException, SchemaNotExistsException,
InvalidConditionException {
CubeCondition cubeCondition = fullCondition.getCubeCondition();
SetCondition setCondition = fullCondition.getSetCondition();
Targe... |
b023be95-983d-47e1-8674-2a0ae6f5c39f | 7 | @Override
public void input() {
CKeyEvent k = this.Engine.getKeyboard().nextKeyEvent();
while(k != null){
if(k.getEventType() == CKeyEvent.KEYEVENT_PRESSED){
if(k.getKeyType() == CKeyInfo.KEY_TYPE_CHARACTER || k.getKeyType() == CKeyInfo.KEY_TYPE_SYMBOL){
processcharacter(k);
}else if(k.get... |
e8d92ce2-0be3-4a91-ab21-94f36e135564 | 0 | public static void question4() {
/*
QUESTION PANEL SETUP
*/
questionLabel.setText("What time of the day do you love the most?");
questionNumberLabel.setText("4");
/*
ANSWERS PANEL SETUP
*/
//resetting
radioButton1.setSelected(false);
... |
6e0ae591-c906-4dac-b923-288775ab65ae | 6 | protected String encodeInternal(byte[] data) {
if (data.length == 0) {
return "";
}
// SHIFT is the number of bits per output character, so the length of the
// output is the length of the input multiplied by 8/SHIFT, rounded up.
if (data.length >= (1 << 28)) {
... |
f768b331-470c-451a-9fce-2314e2d43c03 | 9 | private void transcribe() {
String workNumber = score.getWorkNumber();
String workTitle = score.getWorkTitle();
String movementTitle = score.getMovementTitle();
String composer = score.getComposer();
String lyricist = score.getLyricist();
boolean headerAvailable = false;
if (isNonEmpty(work... |
ba111501-bc14-49a8-8c39-e4cdb574362c | 3 | public void render(Graphics g)
{
if(hover)
g.setColor(Color.CYAN);
else
g.setColor(Color.WHITE);
g.drawRect(x, y, width, height);
if(hover)
g.setColor(new Color(0xAAAAAA));
else
g.setColor(new Color(0x888888));
g.fillRect(x + 1, y + 1, width - 1, height - 1);
if(hover)
g.... |
5608be3b-0bb3-4f77-a73d-1bce3b85099a | 8 | public BalancedTreeNode<E> deleteNodeRec(BalancedTreeNode<E> node, E value) {
if(node == null) {
return node;
}
if(value.compareTo(node.value) < 0) {
node.left = deleteNodeRec(node.left, value);
} else if(value.compareTo(node.value) > 0) {
node.right = deleteNodeRec(node.right, value);
} else if(n... |
9e3a4438-f39c-4e97-95b0-262b868838d0 | 8 | public void draw(Graphics2D g)
{
if(pointList.size() < 2)
return;
// Calculate each individual alpha step
double alphaStep = 127/(double)(pointList.size());
// Draw the trail
for(int i = 0;i < pointList.size()-1;i++)
{
// Get the current alpha
int alpha = (int)(alphaStep*i)+127;
if(alpha > 255)... |
2f2cbf55-43fd-4167-a14f-fed59fdeb84d | 0 | public String getFragment() {
return this.fragment;
} |
7746d0af-6f62-4e50-8b71-ce4beccf5347 | 2 | public boolean isOptOut() {
synchronized(optOutLock) {
try {
// Reload the metrics file
configuration.load(CONFIG_FILE);
} catch (IOException ex) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
return t... |
e09004a9-998d-4e27-aa9e-593f8960eed1 | 4 | static public ArrayList<ServerStatus> compare(ArrayList<ServerStatus> sl1, ArrayList<ServerStatus> sl2){
System.out.println("vergleiche...");
ArrayList<ServerStatus> sList = new ArrayList<ServerStatus>();
if(sl1 == null) return sl2;
if(sl1.size() != sl2.size()) return sl2;
int i = 0;
while (i < sl1.size())... |
a478f7d7-68b6-4104-b0f1-98c4f4f0475e | 7 | * @return TruthValue
*/
public static TruthValue callAsk(Stella_Object query) {
{ Object old$Queryiterator$000 = Logic.$QUERYITERATOR$.get();
Object old$ReversepolarityP$000 = Logic.$REVERSEPOLARITYp$.get();
Object old$Inferencelevel$000 = Logic.$INFERENCELEVEL$.get();
Object old$GenerateAllP... |
c379012c-0748-47c3-81d9-0c9a53de8eb7 | 7 | public static void main(String[] args) {
sc = new Scanner(System.in);
Integer[] A = new Integer[10];
Integer[] B = new Integer[10];
Integer[] C = new Integer[10];
Integer S = 0;
for (int i = 0; i < 10; i++) {
System.out.println("Entre com o valor de A" + (i + 1) + ": ");
A[i] = sc.nextInt();
}
f... |
06b60351-5076-4f82-a65f-d296d7fd9e2f | 4 | @Override
protected Pizza createPizza(String type)
{
Pizza pizza = null;
PizzaIngredientFactory ingredientFactory =
new ChicagoPizzaIngredientFactory();
if (type.equals("cheese"))
{
pizza = new CheesePizza(ingredientFactory);
pizza.s... |
826ee069-2744-4a0b-9091-93e1e6a6d923 | 4 | private Button whichButton()
{
for(int i = 0; i < BCOUNT; i++)
{
if(within(buttonArray[i].area())) {
return buttonArray[i];
}
}
for(Integer i : buttonMap.keySet())
{
if(within(buttonMap.get(i).area())) {
retu... |
01c8b96c-f509-45d3-9aad-72b0eb789a96 | 1 | static public Mantenimiento_Profesor instancia() {
if (UnicaInstancia == null) {
UnicaInstancia = new Mantenimiento_Profesor();
}
return UnicaInstancia;
} |
12024608-288b-4189-9c61-49098c55fdbf | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final JTprbPK other = (JTprbPK) obj;
if (!Objects.equals(this.IdOrder, other.IdOrder)) {
return fal... |
e671704c-acee-4f89-97c2-8b6e333e4734 | 7 | public void render(Graphics g) {
g.drawString("Blasting fun!", 100, 50);
playGame.draw(100, 100);
gameSettings.draw(100, 200);
exitGame.draw(100, 300);
if(model.getPlayerHero(1).name().equals("MAGE")){
mage.draw(700, 100);
g.drawString("Mage", 715, 150);
} else if(model.getPlayerHero(1).name(... |
34824f23-de91-453c-8c67-bca819cef7a9 | 5 | private void recQuickSort(int left, int right, int position, SplitNode spNode) {
int size = right-left+1;
int newPos = (position == 0) ? 1 : 0;
if(size == 1) {
if(position == 0) spNode.setLeft(new EndNode(spNode, objects[position]));
else spNode.setRight(new EndNode(spNo... |
ddb3a5c2-9f42-43aa-b53f-c450109845ab | 3 | @Override
public boolean equals(Object other){
return other != null && (other instanceof Location)
&& ((Location)other).x == x && ((Location)other).y == y;
} |
506b5fae-1773-491f-a56e-fb3c745d7a8d | 8 | public ArrayList<Reservation> ReservationsForDate(String date)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
/* Variable Section Start */
/* Database and Query Preperation */
PreparedStatement statment = null;
ResultSet res... |
423eeaac-db03-450d-892f-01fa381ff33a | 0 | public boolean isNeitherNor() {
return isNeitherNor;
} |
696acd73-f516-4ea6-92d4-7751f75d205f | 4 | public void inspect(CloudMapPanel<T> cloudMapPanel) {
newGeneratorButton.setEnabled(false);
redoButton.setEnabled(true);
goBackButton.setEnabled(false);
nextGenButton.setEnabled(false);
inspectedGenerator = cloudMapPanel;
System.out.println(cloudMapPanel.getGenerator().toString());
inspectGrid = new JPan... |
350151f4-0bb9-4c43-a9a0-78c26821943c | 4 | public PointGame getUpNeighbor() {
int x0 = x;
int y0 = y;
while (y0 > MINY) {
// check if x=3 and y=4, we cannot go down.
if (x0==3 && y0==4)
break;
y0--;
if (Board.validPoints.contains(new PointGame(x0,y0))) {
return new PointGame(x0,y0);
}
}
return null;
} |
a3f9923f-788e-403d-b943-f37bc7f3cade | 6 | public static void createTeamQueue() {
int[] randArray = new int[teamNum];
for (int i = 0; i < randArray.length; i++) {
randArray[i] = -1;
}
int randIndex = 0;
Boolean withinArray;
for (int i = 0; i < teamNum; i++) {
int rand = 0;
withinArray = true;
while (withinArray == true) {
int temp... |
91011005-bc1b-4987-848a-44dcd35c280f | 4 | private void parseModules(Element el){
NodeList nl = el.getElementsByTagName("Module");
if(nl != null && nl.getLength() > 0)
{
for(int i = 0; i < nl.getLength(); i++)
{
Element el2 = (Element)nl.item(i);
mp.put("Module" + i, el2.getAttribut... |
75b40c5a-ff03-4031-af28-71ff0dd69582 | 9 | public void buildMetaLevel() throws Exception {
debug("Building the ensemle of the meta level classifiers");
for (int i = 0; i < numLabels; i++) { // creating meta-level data new
ArrayList<Attribute> attributes = new ArrayList<Attribute>();
if (includeAttrs) {// create an Array... |
515d429f-923b-4ca9-86dd-98ac77549cdd | 0 | public static void split(String regex) {
System.out.println(Arrays.toString(knights.split(regex)));
} |
8bb647ee-29d4-4cdb-98da-16cd5e1f3af8 | 7 | public void zoneEventOccurred(String eventZone, int eventType){
// If within the bounds of the text, go to the link
if(!eventZone.equals("answer"))return;
if(eventType==ZoneEvents.ENTER){
Gui.changeCursor(Cursor.HAND_CURSOR);
}
// Print out the name of the zone pressed.
if(Debug.renderer) System... |
525531d1-ccad-45b9-b056-a17406b8a515 | 1 | public synchronized void editar(int i)
{
try
{
new AreaFormacaoView(this, list.get(i));
}
catch (Exception e)
{
}
} |
d0b1d919-5ad7-4eae-b614-b661236965ad | 1 | public void skipComment(char code) throws IOException {
getChar();
while ( c == code ) {
skipLine();
getChar();
}
} |
bac5158e-ba75-4cc6-b7e8-9f8300e630a2 | 9 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btnSelectDate){
int index = dateOfVisitcomboBox.getSelectedIndex();
currVisit = visits.get(index);
prescs = parent.getHandler().getVisitPrescriptions(visits.get(index).getPatUsername(), visits.get(index).getDocUsername(),
... |
8385effc-3d15-4298-b4b2-1a1edeca600d | 1 | @Override
public int hashCode() {
int hash = 5;
hash = 53 * hash + this.id;
hash = 53 * hash + Objects.hashCode(this.nome);
hash = 53 * hash + (this.alterado ? 1 : 0);
hash = 53 * hash + this.ativo;
return hash;
} |
294d86a6-444b-4fa9-baa7-cb63a25c3e69 | 2 | public void save(String name) throws IOException{
String path = name;
FileOutputStream out = new FileOutputStream(path);
out.write(width);
out.write(height);
for (int x = 0; x < width; x++){
for (int y = 0; y < height; y++){
Boot.getWorldObj().getTileAtCoords(x1 + x, y1 + y).save(out);
}
}
... |
fe440167-7997-4f36-9c62-d5bccf9e001f | 9 | public boolean canPlay(String mana){
if(mana.length() < this.getCmc())
return false;
ArrayList<Character> costArr = new ArrayList<Character>();
for(int i = 0; i < mana.length(); i++)
costArr.add(mana.charAt(i));
for(int i = (this.manaCost.length() - 1); i >= 0; i--){
Character c = this.manaCos... |
a266924c-bfee-44c9-bee5-a8ea5696589c | 6 | protected void validateTagsOnlyOnce(Node parentNode, String[] allowedChildNames) throws RrdException {
// validate node only once
if(validatedNodes.contains(parentNode)) {
return;
}
Node[] childs = getChildNodes(parentNode);
main:
for(int i = 0; i < childs.length; i++) {
String childName = childs[i].g... |
89867209-977f-4760-8d46-6dc718807e27 | 4 | public static void main(String[] args) {
long start = System.nanoTime();
boolean found = false;
String numStr = "1234567890";
Long maxsqr = new Long("1929394959697989900");
Long minsqr = new Long("1020304050607080900");
Long max = (long) Math.sqrt(maxsqr); //maximum value to check
Long min = (long) Math.s... |
da9feabf-088f-40e7-8b0a-075efa4472c9 | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
3d416e76-2ddc-44a1-87c5-122aafcd631d | 6 | @SuppressWarnings("resource")
@Override
public void perform() throws IOException {
JarFile gamePack = new JarFile("./data/currentGamePack.jar");
ZipEntry zipEntry = gamePack.getEntry("inner.pack.gz");
InputStream inputStream = gamePack.getInputStream(zipEntry);
OutputStream outputStream = new FileOutputStr... |
bde5dd31-3678-4728-a637-eb01d8a07ec6 | 2 | @Override
public void mouseClicked(MouseEvent e) {
if (e.getSource() == customerComboBox) {
if (customerComboBox.getSelectedItem().equals(
"<html><font color='red'>Add New Customer</font></html>")) {
driver.getGui().getTabbedPane().setSelectedComponent(
driver.getGui().getCustomerTab());
driver... |
eb8c80bb-8356-45fd-bc18-4a7dd08b373c | 3 | public synchronized void update(long timePassed){
if(scenes.size() >1){
movieTime += timePassed;
if(movieTime >= totalTime){
movieTime =0;
sceneIndex =0;
}
while(movieTime > getScene(sceneIndex).endTime){
sceneIndex++;
}
}
} |
49411409-d1a6-41cc-8901-c51a0baa7655 | 1 | public byte[] getBlockData(int index, int offset, int length){
Piece p = this.pieces.get(index);
if(p == null)
return null;
byte[] data = p.getBlock(offset, length);
this.uploadedTotal+=data.length;
return data;
} |
81b26956-2dfe-4a0e-9dc1-9594969e3a06 | 6 | private static void main2(String[] args) {
Config.cmdline(args);
ThreadGroup g = HackThread.tg();
setupres();//UNCOMMENT
MainFrame f = new MainFrame(800, 600);
if (Config.fullscreen)
f.setfs();
f.resetCenter();//
f.g = g;
if (g instanceof haven... |
ae457420-27f0-4843-9ba0-0f405378ec4f | 5 | public void SaveGame()
{
try
{
saveManifest = new File(this.getClass().getResource("/Orions_War/saves/spacegame manifest.txt").toURI());
}
catch (URISyntaxException e)
{
System.out.println("printing stack trace");
e.printStackTrace();
}
if(saveManifest == null) System.out.println("file null")... |
f73c4ff0-3b54-484a-af27-f5b7bb8be070 | 7 | protected String fillOutStatCode(final Modifiable E, final List<String> ignoreStats, final String defPrefix, final String stat, final XMLTag piece, final Map<String,Object> defined, final boolean debug)
{
if(!ignoreStats.contains(stat.toUpperCase().trim()))
{
try
{
return PostProcessAttempter(defined,new... |
b0b4ca3b-517e-4fd6-9b86-7d0c600b1024 | 9 | protected static String refineUrlPath(String url){
String endStr = "";
if(url == null || url.equals("")){
return "";
}
String headReg = "(http://|https://)(.*)";
String headStr = "";
Pattern p = Pattern.compile(headReg);
Matcher m = p.matcher(url);
if(m.matches()){
headStr = m.group(1);
url = m... |
c3dbe2e0-0812-4a7f-a5c7-ca0e9d2994d2 | 8 | public void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
if (value == null || value.length == 0)
return;
double minValue = 0;
double maxValue = 0;
for (int i = 0; i < value.length; i++) {
if (minValue > value[i])
minValue = value[i];
if (maxValue < value[i])
m... |
a8103240-4e1b-4596-873c-0a0daa9d7849 | 4 | public Model getHeadModel() {
Model models[] = new Model[5];
int modelCount = 0;
for (int m = 0; m < 5; m++)
if (headModelIds[m] != -1)
models[modelCount++] = Model.getModel(headModelIds[m]);
Model model = new Model(modelCount, models);
for (int colour = 0; colour < 6; colour++) {
if (originalModel... |
ceb53275-f9e8-4fea-a283-9d327a61d3a1 | 7 | @SuppressWarnings("unchecked")
public static <N, T> TKey<N, T> register(Class<N> namespace, String name, Class<T> type) {
if (namespace == null) {
throw new IllegalArgumentException("Namespace must not be null.");
}
if (name == null) {
throw new IllegalArgumentExcepti... |
30e9c7a1-57aa-43c7-9854-956303260f0b | 9 | private boolean r_mark_suffix_with_optional_n_consonant() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 132
// or, line 134
lab0: do {
... |
e6c77fe3-a8d1-48d1-915b-7432cde87bf5 | 2 | @Override
public String toString() {
if (places.size() == 0) {
return "[]";
}
StringBuilder sb = new StringBuilder();
sb.append(places.size());
sb.append("\\[");
sb.append(places.get(0));
for (int i = 1; i < places.size(); i++) {
sb.ap... |
30bd0684-14d9-48ca-ac4f-170d76be608f | 4 | private long getCPtrAddRefRippleServer(RippleServer element) {
// Whenever adding a reference to the list, I remove it first (if already there.)
// That way we never store more than one reference per actual contained object.
//
for(int intIndex = 0; intIndex < elementList.size(); intIndex++)
{
Object theObject =... |
8bc9ba80-d389-453b-9236-465a9c9ec1f6 | 7 | @Override
public void setSelectedItems( Iterable<Item> items ) {
Item primary = null;
Set<Item> selected = new HashSet<>();
if( items != null ) {
for( Item item : items ) {
if( primary == null ) {
primary = item;
}
selected.add( item );
}
}
for( DefaultItem<?> item : getDefaultItems()... |
f89a733b-c935-410f-b47d-80d8bba4484c | 4 | private void sendICMP(int type, byte[] data, String src)
throws IOException {
byte[] ipUDP = new byte[28];
for (int i = 0; i < ipUDP.length; i++) {
ipUDP[i] = data[i];
}
InetAddress sender = findMatch(src);
InetAddress virtSrc = InetAddress.getByName(src);
IP_Header ipHeader = new IP_Hea... |
886f8fba-8708-4724-8f36-36376c25c81c | 4 | @EventHandler(ignoreCancelled = true)
public void onSignChange(SignChangeEvent event) {
if (OITG.instance.getArenaManager().getArena(event.getBlock().getLocation()) != null) {
event.setCancelled(true);
event.getPlayer().sendMessage(OITG.prefix + ChatColor.RED + "Arena signs cannot be... |
096dc4ef-76de-4599-b462-2f8a8976a353 | 2 | public static List<String> GetNamesOfGalleries() {
List<String> names = new ArrayList<String>();
NodeList nList = getNodeList();
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Eleme... |
4a250cf2-5b0f-4585-bd91-a58627fd9113 | 7 | public static void doMultiThreadTest(String host, int txnPerSec, int threads, int runTimeSec) {
int eachUnitCount = (int) (txnPerSec/threads + 0.5);
final AgeTest at[] = new AgeTest[threads];
for(int i=0;i<threads;i++) {
at[i] = new AgeTest("Test-"+i, host, eachUnitCount, runTimeSec);
at[i].setUp();
}... |
de184deb-5663-46fe-8609-0fe8e304f086 | 7 | public Move move(boolean[] foodpresent, int[] neighbors, int foodleft, int energyleft) throws Exception {
this.age++;
Move m = null; // placeholder for return value
if ( this.age < 200 && !(foodleft>50) ) {
m = new Move(STAYPUT);
} else {
if(this.childrenLeft > 0){
if ( neighbors[NORTH] == -1 ) {
... |
039bc922-8ccd-42b9-91eb-30ac5c895bca | 6 | private void doCommand(String cmd) {
if (cmd.startsWith("P")) {
doPerfect(cmd.substring(1));
} else if (cmd.startsWith("L")) {
doLossy(cmd.substring(1));
} else if (cmd.startsWith("S")) {
doSleep(Integer.parseInt(cmd.substring(1)));
} else if (cmd.startsWith("X")) {
doShutdown();
} else if (cmd.eq... |
d8feb97f-864e-4ec4-93a1-b520a76763f4 | 4 | public String doLogin(String username, String password, boolean rememberMe)
{
String result = null;
final String url = main.getConfig().getString("login.url");
final Map<String, String> params = new LinkedHashMap<String, String>();
params.put("user", username);
... |
0b64d48e-a469-46a0-84b5-bd6a2e145235 | 7 | public static BookmarkReader predictSample(String filename, int trainSize, int sampleSize, int d, int beta, boolean userBased, boolean resBased, boolean tagBLL, boolean topicBLL) {
filename += "_res";
BookmarkReader reader = new BookmarkReader(trainSize, false);
reader.readFile(filename);
List<int[]> predict... |
0c6ae189-32e7-4996-b457-91c71833ffb2 | 6 | public void doFilter(ServletRequest req, ServletResponse resp,
FilterChain chain) throws ServletException, IOException {
HttpServletRequest httpReq = (HttpServletRequest) req;
HttpServletResponse httpResp = (HttpServletResponse) resp;
try {
... |
228c8d02-13c7-4c5a-811c-090b9540f3b2 | 0 | @Test
public void testIsAlive() throws IOException {
System.out.println("isAlive");
AntBrain b = new AntBrain("cleverbrain1.brain");
Ant instance = new Ant(b,true,0);
boolean expResult = true;
boolean result = instance.isAlive();
assertEquals(expResult, resu... |
4ed682c2-b9eb-420c-bba0-11fe496748a9 | 2 | public void testAdd_Field() {
MutablePeriod test = new MutablePeriod(1, 2, 3, 4, 5, 6, 7, 8);
test.add(DurationFieldType.years(), 10);
assertEquals(11, test.getYears());
test = new MutablePeriod(0, 0, 0, 0, 0, 0, 0, 1, PeriodType.millis());
test.add(DurationFieldType.yea... |
53954c4c-03fd-4b66-8f50-b43acf74e2fc | 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... |
56ca0964-4e7f-483f-bcf5-52c30ec9adfb | 0 | public void setMatricule(String matricule) {
this.matricule = matricule;
} |
03f0450e-ece2-4e63-997e-5493706ef1bc | 0 | public final float getY(){
return getLocalTranslation().getY();
} |
d730f149-34d3-4dac-973b-73374b2d448e | 0 | public Clock getTimeStamp(){
return this.timeStamp;
} |
323d9068-e7c9-4be6-98a8-d0f8816f1ce6 | 2 | public Reference getReferenceAlias(Reference ref) {
Reference alias = (Reference) aliasesHash.get(ref);
if (alias == null) {
Identifier ident = getIdentifier(ref);
String newType = getTypeAlias(ref.getType());
if (ident == null)
alias = Reference.getReference(ref.getClazz(), ref.getName(),
newTyp... |
31572aeb-9586-46ed-a228-a28839205481 | 2 | @Override
public void enter(GameContainer container, StateBasedGame game) throws SlickException
{
//Temos algum mapa carregado?
if(loadedMap != null)
loadedMap = null;
//Criando um novo mapa:
loadedMap = new Map(Map.MAPS.TEST, false);
//Crian... |
22166285-6a12-4c5e-9ce5-4e619b92cd8b | 6 | static protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
line += (column = ... |
111e5a67-db53-4288-8b80-7ae22a823405 | 5 | private Node balance(Node h) {
// assert (h != null);
if (isRed(h.right)) h = rotateLeft(h);
if (isRed(h.left) && isRed(h.left.left)) h = rotateRight(h);
if (isRed(h.left) && isRed(h.right)) flipColors(h);
h.N = size(h.left) + size(h.right) + 1;
... |
f170d5b1-f94a-492b-81e6-f164994052ba | 9 | public void renderInteractables()
{
for (Interactable i : interactables)
{
if(!i.isVisible())continue;
int[] image = i.getCurrentPixelArray();
for (int y = 0; y < i.getHeight(); y++)
{
for (int x = 0; x < i.getWidth(); x++)
{
if(x < 0 || x > width || y < 0 || y >= height )break;
... |
633e72f0-fa2b-4432-9574-d924a04e2545 | 6 | protected void processOtherEvent(Sim_event ev) {
int tag = ev.get_tag();
if(tag == MessageType.CREATE.intValue() ||
tag == MessageType.COMMIT.intValue() ||
tag == MessageType.CANCEL.intValue() ||
tag == MessageType.STATUS.intValue() ||
tag == MessageType.MODIFY.intValue() ||
... |
921dc6fc-27de-4fc8-b7ac-d0d24bde5b08 | 7 | public static void main( String args[] ){
byte buf[] = new byte[ MiniDB_Constants.BLOCK_SIZE];
int blockID = 1;
MiniDB_Block blk = new MiniDB_Block(buf, blockID, null);
blk.set((byte)'x');
blk.writeLong(8,-1);
blk.writeLong(24,-2);
blk.writeLong(64,1);
blk.writeLong(96,2);
Sy... |
0b83ffcf-df32-485d-b336-76a3465bf8b2 | 1 | @Override
public List<Position> getPositions() {
List<Position> positions = new ArrayList<Position>();
if (getPosition() != null)
positions.add(getPosition());
positions.addAll(otherPositions);
return positions;
} |
0cb1df42-2600-4a64-94f3-fc4764026e16 | 1 | @Override
public void onCollision(Player player) {
if(canPickUp()){
pickup();
player.points += amount;
}
} |
db3019f0-d0b3-40f0-9986-bba4d154cf2f | 3 | public static void main(String... args) {
long target = 600851475143L;
long divideNum = 2;
while (target != 1) {
System.out.println(divideNum);
if (isPrime(divideNum)) {
if (target % divideNum == 0) {
target = target / divideNum;
... |
54f850f4-1159-4c40-a726-92c1e1bf27b1 | 4 | private DataSource getSound(Integer soundNumber) {
if (_loadedSounds.containsKey(soundNumber)) {
return (DataSource) ((SourceCloneable) _loadedSounds
.get(soundNumber)).createClone();
}
DataSource soundsrc = null;
try {
soundsrc = new URLDataSource(new URL("file:///" + baseDir
+ _filenames.ge... |
629ecf2d-6521-411b-9539-7807c8cac04c | 2 | private void endType() {
if (arrayStack % 2 == 0) {
arrayStack /= 2;
} else {
while (arrayStack % 2 != 0) {
arrayStack /= 2;
declaration.append("[]");
}
}
} |
97b10d85-47bd-4744-89ec-c34f205d6a7b | 6 | public static void main(String[] args) throws Exception{
HashMap<String, Integer> errorlist = new HashMap<String,Integer>();
ArrayList<File> files = FileFinder.GetAllFiles("iccco/test", ".data", true);
for(File file: files){
@SuppressWarnings("resource")
BufferedReader br = new BufferedReader(new FileReader... |
b6535677-c848-4cba-b639-645443eee5bd | 9 | public static void main(String[] args){
int[] arr = new int[10000];
for(int i = 0; i <arr.length; i ++){
arr[i] = i;
}
int[] squares = new int[100];
for(int i = 0; i <squares.length; i ++){
squares[i] = 2*i*i;
}
/*for(int k : squares){
System.out.println(k);
}*/
int g = 2;
for(int i = 0;... |
a467910d-99b9-47b7-b7cd-3a5d81c53528 | 7 | public void generateAssociations() {
//this populates all the transactions
readInputFile(datafile);
//return all items that meet required min_support.
//We don't need this list to generated association rules as it only contains one element
//but we add it because we need to print it as required by th... |
befac3f4-6611-41e6-a88e-2871f6b86ef0 | 0 | public CarBuilder setSportKit(boolean sportKit) {
delegate.setSportKit(sportKit);
return this;
} |
d358ec2e-6c6d-4b23-90f6-aefaf0dd0ae1 | 1 | public void visitEnd() {
if (av != null) {
av.visitEnd();
}
} |
dcd82fba-f061-479d-941b-6b37873ad5cd | 4 | public static void updateWeights(){
//update weights to hidden nodes
for(int node = 0; node < inHid.length -1; node++){
for(int weight = 0; weight < inHid[node].length; weight++){
inHid[node][weight] = inHid[node][weight] + LR * (input[node] * hiddenError[weight]);
}
}
//update weights to output
... |
31e783e8-ada5-4650-8172-b2b7431863c7 | 3 | public <T extends Component> void removeComponent(UUID entity,
T component) {
synchronized (componentStores) {
HashMap<UUID, ? extends Component> store = componentStores
.get(component.getClass());
if (store == null) {
throw new IllegalArg... |
48155b1d-577f-4ca9-8b6e-2ac515ca6276 | 0 | @Override
public String toString() {
String b = String.format("%+f", this.b);
String c = String.format("%+f", this.c);
return "[y=" + a + "*x^2" + b + "*x" + c + "]";
} |
668affb5-8f62-4673-9b8d-103f45067a5a | 0 | public String getName()
{
return name;
} |
5c5b7576-0a1c-4e57-8e88-54ddbc1c85a4 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!mob.isInCombat())
{
mob.tell(L("You must be in combat to cast this spell!"));
return false;
}
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean ... |
0d2d80f9-fa73-4138-9a21-fec13501ce37 | 1 | public void visitAttribute(final Attribute attr) {
checkEnd();
if (attr == null) {
throw new IllegalArgumentException("Invalid attribute (must not be null)");
}
fv.visitAttribute(attr);
} |
ca00d1ff-7cad-4885-8773-d7f0b8503d0f | 9 | private Matrix getTObs(Instances data) throws Exception {
int p = m_numAttributes; // number of columns
// matrix of complete-data sufficient statistics for observed values
Matrix t = new Matrix(p+1, p+1);
// initialize T for observed data (T_obs)
int currentPatternStart = 0;
whil... |
74273d30-af15-4ae3-b61b-8d10f7a23a38 | 2 | public synchronized void addShapes(List<String> shapes){
for (String s : shapes)
if (!this.shapes.contains(s))
this.shapes.add(s);
} |
56d178cd-fed2-43d0-817c-0e0e27ef6ed6 | 6 | public void makeRealMap(int k){
for(int i = 1; i < realMap.length; i++){
realMap[i] = 0.0;
}
Random ran = new Random();
for(int i = 0; i < k; i++){
int total = 0;
for(int j = 0; j < numOfDice; j++){
while(true){
int eye = ran.nextInt(NUM_OF_EYE+1);
if(eye != 0){
total += eye;
... |
c96c1a2a-4cfe-4ee4-b2bb-022e4c284916 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
e5e1f7e4-9d74-409a-ba8e-e3da004d3bc2 | 7 | private Object[] dealWithPromotion(int key, String value,
Node<Integer, Object> node) {
if(value == null){
return null;
}
if(key > node.getKey(node.size()-1)){
node.addKey(key);
node.addChild(value);
}else{
for(int i=1; i<node.size(); i++){
if(key < node.getKey(i)){
node.addKey(key, i)... |
d8f73b07-f2b0-4da6-80f8-776c5684344e | 5 | private void paint(GameLabelBlank gameLabelBlank, GamePiece piece) {
if (piece.getId().equals("H")) {
gameLabelBlank.changeColor(new Color(0, 255, 0, 0x50));
gameLabelBlank.getParent().repaint();
gameLabelBlank.click();
}
if (piece.getId().equals("M")) {
gameLabelBlank.changeColor(new Color(255, 0, 0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.