method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c45a7030-b248-4ade-82c8-9debfd922b74 | 2 | @Override
public boolean equals(Object other)
{
return other != null && other instanceof CharSequence ? toString().equals(other.toString()) : false;
} |
10c91d64-ae30-4fde-870e-e35f945e88c2 | 9 | public static Position moveFromExplicitMoveString(Position pos, String move) {
//System.out.println("Get move from explicit: " + move);
//handle king side castle:
if(move.equals("O-O") || move.equals("O-O+")) {
return ChessMover.moveWeird(pos, Position.KING_SIDE_CASTLE);
//handle queen side castle:
} e... |
3e4357e7-f726-4093-8823-3ddbf44b0ea7 | 4 | public int getProtons(String str)
{
for(int i = 0; i < eSymbol.length; i++) //look for symbols that match the string
if(str.equals(eSymbol[i]))
return i;
str = str.toLowerCase();
for(int i = 0; i < eName.length; i++) //look for names that match the string
if(str.equals(eName[i].toLowerCase()))
r... |
37a75f00-3b57-404a-91df-2fa1a04ff69a | 0 | public void info() {
super.info();
System.out.println ("head:\t" + head);
} // end info() |
ab1915ff-9039-4722-9e71-21d24464415c | 2 | @Override
protected void finalize()
{
if(m_resource.RemoveReference() && !m_fileName.isEmpty())
{
s_loadedModels.remove(m_fileName);
}
} |
4499a728-2b21-45b1-b44d-35b1f18da44e | 0 | @Override
public void reduce(Text text, Iterator<IntWritable> intWritableIterator, OutputCollector<Text, IntWritable> textIntWritableOutputCollector, Reporter reporter) throws IOException {
} |
74e53697-d293-4dda-991a-5ae0144687ef | 0 | public void setAccount(Account account) {
this.account = account;
} |
ce582d52-e9ca-4973-af52-151f2c2f585e | 4 | public void transformPointer(Face face) {
if(face==Face.SOUTHERN){
rotationRequired = Math.toRadians(90);
}else if(face==Face.WESTERN){
rotationRequired = Math.toRadians(180);
}else if(face==Face.NORTHERN){
rotationRequired = Math.toRadians(270);
}else if(face==Face.EASTERN){
rotationRequired = Math... |
9e01f4ef-ecc4-4b5e-a519-5251ab69d0ff | 2 | private static void readMagicItemsFromFile(String fileName,
ListMan lm) {
File myFile = new File(fileName);
try {
Scanner input = new Scanner(myFile);
while (input.hasNext()) {
// Read a line from the file.
... |
24dbc1c9-0fda-4260-b28a-6883406a3be6 | 7 | protected void initate(int cells, boolean debug) {
this.debug = debug;
if (data == null) data = new byte[cells];
else
for (int i=0; i<data.length; i++)
data[i] = 0;
if (exec != null) exec.stop();
dataPointer = 0;
charPointer = 0;
posInput = 0;
breakCycle = false;
close = false;
ide.c... |
23ccf37d-dc85-4eb1-886f-c108b766ca5c | 5 | private void texData(BufferedImage img) {
if(glTexId == -1 || img == null) {
return;
}
int[] pixels = new int[textureWidth*textureHeight];
img.getRGB(0, 0, textureWidth, textureHeight, pixels, 0, textureWidth);
Out.dbg("TexData!");
ByteBuffer buf = BufferUtils.createByteBuffer(textureWidth*textureH... |
fbb06396-3a30-4ea8-a49b-0079c6bcc224 | 3 | private boolean topEdge(int particle, int cubeRoot) {
for(int i = 1; i < cubeRoot + 1; i++){
if(particle < i * cubeRoot * cubeRoot - 1 && particle > i * cubeRoot * cubeRoot - cubeRoot){
return true;
}
}
return false;
} |
b5696d51-1497-47d5-bcea-fa2815b69622 | 4 | Class<?> getReturnType(String methodRoot) {
Class<?> returnType = null;
String methodName = "get" + methodRoot;
Widget[] widgets = getExampleWidgets();
try {
java.lang.reflect.Method method = widgets[0].getClass().getMethod(methodName, (Class<?>)null);
returnType = method.getReturnType();
} catch (Excep... |
e48a25b5-8eda-4b1d-901a-21fd34ce775e | 6 | public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
int numAlum=teclado.nextInt(),
i=0, j=0;
double suma = 0, media=0,Suma=0;
//
System.out.println("numero de alumnos de la clase: "+numAlum);
int[]notas = new int[numAlum];
//
for(i = 0; i<notas.length;++i)... |
5e22255d-64ce-405d-a417-5cbeb526bd7c | 1 | public void stop() {
if (!isRunning)
return;
isRunning = false;
} |
d95f84c3-a38a-40b6-bb0a-72eb3d1217bc | 3 | public Codec( String extension, Class iCodecClass )
{
extensionRegX = "";
// Make sure an extension was specified:
if( extension != null && extension.length() > 0 )
{
// We are only interested in the file extension. The filename
//... |
380b7c5b-980f-4922-97e9-05d9d6aa3729 | 9 | public static String fromArray (byte[] data) {
// allocate result buffer
StringBuffer buf = new StringBuffer();
int size = data.length;
// compute padding
int padding = (3 - (size % 3)) % 3;
// process all bytes in array...
for (int n = 0; n < size; n += 3) {
// check for final (truncated) block
... |
99140fbb-857f-441a-b486-f9536c35cd63 | 5 | public ImageIcon getFoldingIcon(mxCellState state)
{
if (state != null && isFoldingEnabled()
&& !getGraph().getModel().isEdge(state.getCell()))
{
Object cell = state.getCell();
boolean tmp = graph.isCellCollapsed(cell);
if (graph.isCellFoldable(cell, !tmp))
{
return (tmp) ? collapsedIcon : exp... |
c8cc1c8f-8e30-40ad-861f-7d7bc9845d61 | 2 | private static <S> TreeNode<S> seekAccept(ArrayDeque<TreeNode<S>> stack) {
while (!stack.isEmpty()) {
TreeNode<S> top = stack.pop();
stack.addAll(top.children);
if (top.isAccept()) {
return top;
}
}
return null;
} |
a8cda5a8-eb27-4edd-a6d9-a07c44cbad52 | 2 | public void wakeUp() {
if (getState() == STATE_NORMAL && getVelocityX() == 0) {
setVelocityX(-getMaxSpeed());
}
} |
4f78b20d-9e99-4f32-84c2-5f67519ca394 | 5 | protected static Ptg calcColumns( Ptg[] operands )
{
//
if( operands[0] instanceof PtgFuncVar )
{
// we need to return the col where the formula is.
PtgFuncVar pfunk = (PtgFuncVar) operands[0];
try
{
int loc = pfunk.getParentRec().getColNumber();
loc += 1;
return new PtgInt( loc );
}
... |
e2037dff-0e20-4247-8d5c-17467ab3865d | 2 | public String getRadioButtonSelected()
{
String returnVal = null;
Enumeration<AbstractButton> allRadioButton=group.getElements();
while(allRadioButton.hasMoreElements())
{
JRadioButton temp=(JRadioButton)allRadioButton.nextElement();
if(temp.isSelected())
{
returnVal = temp.getText();
... |
40761c0d-9301-4a65-b7fe-049dd1a8d7a5 | 2 | public Object clone() {
try {
SlotSet other = (SlotSet) super.clone();
if (count > 0) {
other.locals = new LocalInfo[count];
System.arraycopy(locals, 0, other.locals, 0, count);
}
return other;
} catch (CloneNotSupportedException ex) {
throw new jode.AssertError("Clone?");
}
} |
17da9261-77da-4265-b2fa-6a7a8690a379 | 1 | public Level NextLevel() {
if (currentlevel < maxlevel) {
Level lvl = new Level(levels[currentlevel].toString());
currentlevel++;
return lvl;
} else {
Framework.gameState = Framework.GameState.COMPLETED;
return null;
}
} |
5c3478bb-f6e8-44ee-9850-d377815a1dda | 5 | public void selectedTeam(String team, String homeOrAway) {
try {
//load xml file to get team
File file = new File("teams/" + team + ".xml");
JAXBContext jaxbContext = JAXBContext.newInstance(Players.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
Players players = (Play... |
43c1cb6e-cf4d-46c9-a915-fa4ad67c0bc4 | 0 | public static void main(String[] args) {
new Car(22).start();
} |
a1efd3a3-041c-4871-9cab-34232e95186e | 5 | private boolean isLowestRankingStraight(ArrayList<Integer> sortedHand) {
for (int i = 0; i<sortedHand.size()-3; i++) {
if (sortedHand.get(0) == 2 && //has 2
sortedHand.get(1) == 3 && //has 3
sortedHand.get(2) == 4 && //has 4
sortedHand.get(3) == 5 ) //has 5
return true;
}
return false;
} |
31ed2a44-dbbb-4de3-a485-209350f1277b | 0 | private static void unitTest() {
System.out.println("PARSE/ASSEMBLE TESTS");
// Dirs and Files
unitTestParseAssemble("http://www.organic.com");
unitTestParseAssemble("http://www.organic.com/");
unitTestParseAssemble("http://www.organic.com/file.jsp");
unitTestParseAssemble("http://www.organic.com/dir"... |
68801d6e-6904-4017-9a0e-d66632c24fe8 | 5 | public DFS addBankJumpPointerTable(int address, int length) {
rom.labelType[address] = 3;
for(int i=0; i<length; i++) {
int ca = address + 3*i;
rom.type[ca] = ROM.DATA_BANKJUMPPOINTER;
if (i > 0 && i % 8 == 0)
rom.comment[ca] = "$" + Util.toHex(i);
int goalBank = rom.data[ca] ... |
a29a51dc-3967-43e5-aa55-5a37b66d3a2f | 0 | public void asetaPelaajanAlkusijainti(Piste sijainti) {
this.pelaajanAlkusijainti = sijainti;
} |
d5f88ec8-32c6-4dec-91ea-7f1025bc1ba9 | 5 | private boolean goBack(Command command){
int backage = 0;
if(!command.hasNthWord(2)){
backage = 1;
} else {
String sWord = command.getNthSegment(1);
try {
backage = Integer.parseInt(sWord);
} catch(NumberFormatException e) {
... |
a4406cd2-eaa0-478e-9bdd-5526734cb1ea | 0 | public void setComment(String comment) {
this.comment = comment;
} |
8d7fdd99-dd04-4f0e-9ccf-e64db31d1e3a | 8 | static int Action(Client joueur) {
int tempDette = 0;
int choiceInt = -1;
boolean wrong = true;
boolean quit = true;
do {
System.out.println("Que voulez vous faire?"
+ "\n pour dormir tapez 1"
+ "\n pour appeler le room service ... |
95795bef-ae58-4634-9204-524fae13cdc3 | 5 | public static void main(String[] args) {
LabControl control = get();
if(args.length < 4){
control.err("wrong parameter count!");
control.halt();
}
if(args[3].equalsIgnoreCase("train")) control.executeTrainAction(args[0], args[1], args[2]);
if(args[3].equalsIgnoreCase("resumetrain")) control.executeResum... |
2f9738db-0437-41e5-8409-f9513411c72d | 3 | public Board getDeepCopy() {
Piece[][] piecesCopy = new Piece[8][8];
for(int x = 0; x < pieces.length; x++) {
Piece[] row = pieces[x];
for(int y = 0; y < row.length; y++) {
if(row[y] != null) {
piecesCopy[x][y] = row[y].getDeepCopy();
}
}
}
re... |
5014e591-e986-4ab3-88a4-c3838894d418 | 2 | @Override
public void update(GameContainer gc, StateBasedGame sbg, int delta)
throws SlickException{
if(MenuManager.getMenuType()==0)
MenuManager.menuUpdate(gc, sbg, delta);
else if(MenuManager.getMenuType()==1)
MenuManager.levelUpdate(gc, sbg, delta);
} |
4d7feeb6-7ef8-44b1-b000-7bc1646f7ae5 | 0 | private String calcWeekDay(final String input) throws ParseException {
String res = "";
String y,m,newInput;
StringTokenizer st = new StringTokenizer(input,"-");
y=st.nextToken();
m=st.nextToken();
newInput = new StringBuilder()
.append(y)
.append("-")
.append(Integer.parseInt(m)+1).to... |
9151417c-64c5-4c69-8a94-f9a2e6ede3eb | 3 | protected void mixnmatch(Organism org1, Organism org2) {
posX = (org1.posX + org2.posX) / 2;
posY = (org1.posY + org2.posY) / 2;
if (r.nextInt(2) == 1) {
speed = org1.speed;
} else {
speed = org2.speed;
}
if (r.nextInt(2) == 1) {
defense = org1.defense;
} else {
defe... |
7dfaef48-62cb-4e7c-ad66-53789e586817 | 0 | public static void main(String[] args) {
Collection<Integer> collection = new ArrayList<Integer>(
Arrays.asList(1, 2, 3, 4, 5)
);
Integer[] moreInts = { 6, 7, 8, 9, 10 };
collection.addAll(Arrays.asList(moreInts));
// Runs significantly faster, but you can't
// construct a Collection this way:
Collect... |
32e576c7-bb63-4d70-b9af-2c310a42a0cf | 1 | @Test
public void getValofCol_test() {
try{
double [][]mat= {{3.0,2.0}, {1.0,3.0}};
int j=0;
double[]result = Matrix.getVecOfCol(mat, j);
double []exp= {3.0,1.0};
Assert.assertArrayEquals(exp, result, 0.0);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemented"... |
d1d77124-1d74-490c-a915-c18cb4ecf892 | 4 | public boolean checkPostion() {
if (x < 0 || x > 800 || y < 0 || y > 600)
return true;
return false;
} |
c81c45a3-e346-4575-bc29-35b43e04cfe9 | 7 | public void Assign(String name) {
boolean error = false;
if(Values.getType(name) == null) {
Error("Variable \'" + name + "\' has not been declared.");
return;
}
if(current.getId().equals("ASSIGN")) {
nextToken();
Expression(name);
}
else if(current.getId().equals("LSBRACKET")) {
nextToken();
... |
ef480393-cfe0-413d-956b-55b36b30ea91 | 3 | public void setState(String state) {
//Verify state Abbreviation (2) places
if(state == null || state.isEmpty() || state.length() > 2){
throw new IllegalArgumentException();
}
this.state = state;
} |
3ff31f3c-452a-4950-b803-ea08ba3ca027 | 0 | private EventJsonConverter() {
} |
2e623a06-5056-4dee-860e-01288df5b1a1 | 3 | public void raiseSalary(int employeeType) throws Exception
{
switch (employeeType) {
case JUNIOR:
this.salary = (salary * 105 + 10000) / 100;
break;
case MEDIOR:
this.salary = (salary * 106 + 20000) / 100;
break;
case SENIOR:
this.salary = (salary * 107) / 100;
break;
default:
throw new ... |
6cfbf3b5-e262-4c03-9494-d126110aad72 | 5 | public void testHeavyConcurrentAccess()
{
final int MAX = 1 << 20;
// Writers pop from this.
final AtomicStack<Integer> source = new AtomicStack<Integer>();
// Writers push to this, Readers pop from this (concurrent action!).
final AtomicStack<Integer> transfer = new AtomicStack<Integer>();
// Readers p... |
1604f0c7-2c56-4550-87ae-6ed607a22836 | 8 | @SuppressWarnings("unchecked")
private static final Object[] decodeDictionary(byte[] bencoded_bytes, int offset) throws BencodingException
{
HashMap map = new HashMap();
++offset;
ByteBuffer info_hash_bytes = null;
while(bencoded_bytes[offset] != (byte)'e')
{
//... |
e64f2dcf-56c2-4c56-a29e-3557c0e0c569 | 5 | private void parsePacket(byte[] data, InetAddress address, int port) {
String message = new String(data).trim();
PacketTypes type = Packet.lookupPacket(message.substring(0, 2));
switch (type) {
default:
case INVALID:
break;
case LOGIN:
Packet00Login packet = new Packet00Login(data);
System.out.prin... |
59aa9705-0384-49f6-aa12-b4167e3288b7 | 9 | public double CalculateNDCG(Corpus corpus, int K, int numtopics,
TIntIntHashMap trainCitations) {
double CNDCG = 0;
System.out.println("Stat: test docs:" + corpus.docs.size()
+ ":Total citations in training:" + trainCitations.size());
for (int doc = 0; doc < corpus.docs.size(); doc++) {
ContextDocument... |
119deeec-87d2-46a5-aeed-cf908d9c53df | 5 | public static ArrayList<MediaCopy> searchMediaByTitle(String title){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<MediaCopy> medi... |
86510096-cc25-470c-8092-804bd804b41b | 9 | public static void copyPEFiles(File startFolder) throws IOException {
File[] files = startFolder.listFiles();
if (files == null) {
System.out.println("Skipped unreadable file: "
+ startFolder.getCanonicalPath());
return;
}
for (File file : files) {
total++;
if (file.isDirectory()) {
copyPEF... |
1313d059-276f-4758-ac8d-e0920a56b2e1 | 5 | public void testBigData6MB() throws TimeoutException, MemcachedException {
if(c instanceof QuickCachedClientImpl) {
c.setMaxSizeAllowedForValue(-1);
} else if(c instanceof XMemcachedImpl) {
//does not send the command to server at all for large value
//todo verify this
return;
} else if(c instanceof S... |
1f5c9115-cf0b-4faf-87ee-9d42e220660a | 5 | private void updateSettingsSaveBtnVisibility()
{
boolean show=false;
if( btnFkSettingsSave != null)
{
if( FkManager.getInstance().getBanner().compareTo( txtBanner.getText() ) != 0 )
{
show=true;
}
if( cmbLayout.getSelectionIndex() != -1 && cmbLayout.getItem(cmbLayout.getSelectionIndex()).compar... |
7539d738-e3a2-4f69-a78f-adf8bd2f6fe8 | 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... |
86656602-4ccd-4d4d-9387-84ee2c8469e9 | 1 | @Override
public void registUrl(String url, String keyword, String twitterUserName) {
try {
String query = "INSERT INTO " + TABLE_NAME;
query += " (url,search_word,twitter_user_name, created_at,updated_at) VALUES (?,?,?,?,?) ";
PreparedStatement stmt = con.prepareStatement(query);
stmt.setString(1, url... |
e0c561ab-ada8-4cff-8419-7482adc3aea0 | 1 | public static void indent(Node node, StringBuffer buf) {
for (int i = 0, limit = node.getDepth(); i < limit; i++) {
buf.append("\t");
}
} |
1d191d36-ac62-4395-81f8-317b1c32f50c | 7 | public BankAccount getMainBankAccount() {
if (!Constants.Banking) {
return null;
}
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
BankAccount account = null;
try
{
conn = iConomy.getiCoDatabase().getConnection();
ps = conn.prepareStatement("S... |
6e5c1cb7-23d1-43c2-848d-f804882c7c9b | 2 | private void systemListAddListener() {
systemList.addMouseMotionListener(genericMouseMotionListener);
systemList.addMouseListener(new MouseListener() {
private String chosenSystem;
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mousePressed(MouseEvent e) {}
@Override
... |
e5bdc320-da1f-419a-aedf-e8232a66b58e | 9 | public void setValueAt(Object valor, int indiceLinha, int indiceColuna) {
//Obtém o objeto em questão, para alteração, de acordo com o índice de linha recebido
JobProtheus job = linhas.get(indiceLinha);
if (indiceColuna == 0){
job.setStatus((String) valor... |
d2d57d9e-1ce7-4625-8917-d9876c13cd63 | 2 | public void add(ChangeEffect changeEffect) {
// Passes the filter? => Add
if ((changeEffectResutFilter == null) || (!changeEffectResutFilter.filter(changeEffect))) changeEffects.add(changeEffect);
} |
517ec513-b76d-49df-9225-7ffe03ae78ef | 1 | private Gene matchingGeneSelect_secondMethod(Gene par1, Gene par2) {
int x = (Math.random() < 0.5) ? 0 : 1;
//TODO
return null;
} |
d613c518-98f0-4a78-9d4d-e6290e4122e7 | 1 | public void testMultipliedBy_int() {
Years test = Years.years(2);
assertEquals(6, test.multipliedBy(3).getYears());
assertEquals(2, test.getYears());
assertEquals(-6, test.multipliedBy(-3).getYears());
assertSame(test, test.multipliedBy(1));
Years halfMax = Years... |
a219ee13-8307-42c4-aee2-e6ab1a6205b8 | 3 | static void preprocess(char[] p) {
int i = 0, j = -1, m = p.length;
b = new int[p.length + 1];
b[0] = -1;
while (i < m) {
while (j >= 0 && p[i] != p[j])
j = b[j];
b[++i] = ++j;
}
} |
688f9b5c-d5cb-44fd-9fe8-115f17d388e0 | 2 | @Override
public void fill(Parameter parameter, Type type, Annotation[] annotations)
{
Requirement requirement = Requirement.DEFAULT;
for (Annotation annotation : annotations)
{
if (annotation instanceof Optional)
{
requirement = Requirement.OPTION... |
54b6fff3-833a-4451-9cd7-6b9b5b50b4a4 | 2 | public static boolean isVariableInProductions(Grammar grammar,
String variable) {
ProductionChecker pc = new ProductionChecker();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
if (ProductionChecker.isVariableInProduction(variable,
productions[k])) {... |
153504a5-0d50-46dd-baea-7bf465d1cc9e | 0 | public void run() {
position++;
} |
f8d51147-83cf-46c7-b61d-728a5ddffd0a | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HtmlAttributeToken other = (HtmlAttributeToken) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(o... |
0eb14ff4-3dc4-464c-9104-8885161f4da1 | 0 | public void setNewImage(String newImage)
{
URL loc = this.getClass().getResource("/karel/themes/" + newImage);
ImageIcon iia = new ImageIcon(loc);
Image image = iia.getImage();
this.setImage(image);
} |
1e389dc7-6704-4b1a-b2c8-0278ed851eac | 9 | String getSpaceGroupInfoText(String spaceGroup) {
if (frame == null)
return "";
SpaceGroup sg;
String strOperations = "";
int modelIndex = viewer.getDisplayModelIndex();
if (spaceGroup == null) {
if (modelIndex < 0)
return "no single current model";
if (frame.cellInfos == null)
return "not ap... |
86a2e3b4-a8a4-4105-8460-bc6e8e7a1ba9 | 3 | public void stopGame() {
// Setting isRunning to false will
// make the thread stop (see run())
this.isRunning = false;
// Unset the game model...
this.view.setModel(null);
// Stop listening for events
this.view.removeKeyListener(this.keyListener);
// Make sure we wait until the thread has stopped...... |
31f49b95-7d63-4944-8c51-d73fbe42ab6b | 8 | public static double toDouble(String nb){
char[] nr=nb.toCharArray();
int i;
double f;
double result=0;
boolean fraction=false;
if(nb==null||nb.equals(""))
return 0;
for(i=0;i<nr.length &&!fraction;i++)
if(Character.isDigit(nr[i]))
{result*=10;
result+=(nr[i]-'0');
}
else
{fractio... |
adf4f7b4-fe5f-4896-aa71-edf8b54d7126 | 3 | public static void main (String [ ] args) {
int x = 1;
int y = 1;
while (x < 5) {
if (y < 5) {
x = x + 1;
if (y < 3) {
x = x - 1;
}
}
y = y + 2;
System.out.print (x + "" + y + " ")... |
c8351513-fca2-4685-95be-1b76b4fa77bb | 3 | static double[] eigenValues(double[][] A){
double[] values = new double[A.length];
String[][] stringA = new String[A.length][A.length];
for(int i = 0; i < A.length; i++)
for(int j = 0; j < A.length; j++){
if(i == j)
stringA[i][j] = String.valueOf(A[i][j]) + " - x";
else
stringA[i][j] ... |
685531c2-83b5-41ac-bd59-f1699ceddb7a | 9 | private void handleNumericAttribute(Instances trainInstances)
throws Exception {
m_c45S = new C45Split(m_attIndex, 2, m_sumOfWeights);
m_c45S.buildClassifier(trainInstances);
if (m_c45S.numSubsets() == 0) {
return;
}
m_errors = 0;
Instances [] trainingSets = new Instances [m_compl... |
5ae3dd82-116d-4d9a-9e2e-465ed1682361 | 9 | public String verificaMenorTempo()
{
double tempoTorno;
double tempoMandril;
double tempoFresa;
ordenaPeloTempoDeSaidaM(maquinaMandril);
ordenaPeloTempoDeSaidaF(maquinaFresa);
ordenaPeloTempoDeSaidaT(maquinaTorno);
if(maquinaTorno.get(0).getRolamento() != null)
{
tempoTorno=maquinaTorno.get(0)... |
46fc44b4-65a4-44b3-89df-24f4aca2f067 | 7 | public static int getNextIDDzien(){
if(dni[0]==null)
return 1;
for(int i=0 ; i<10 ; i++)
if(freeIDDni[i]!=0)
{
int d = freeIDDni[i];
freeIDDni[i]=0;
return d;
}
int ID;
boolean flaga=true;
while(true)
{
IteratorDni.first();
ID= dni[CountDni-1].id + 1;
while(IteratorDni.isDone())
{
... |
f5b5b71a-af62-4eec-bf5d-0252b4d2bcaa | 2 | public static boolean addInfo(databook bk){
boolean flag=false;
try{
contct=connector.getConnection();
Sttt=contct.prepareStatement("insert into bk "+"values(?,?,?,?,?,?)");
Sttt.setString(1,bk.Gin());
Sttt.setString(2,bk.Gte());
Sttt.setString(4,bk.Gpe());
Sttt.setString(6,bk.Gpr());
... |
02d5fb14-b813-44f6-82e4-ecb71bb57e45 | 2 | public RiverNode calculateNext() {
double[][] array = instance.array;
ArrayList<Integer[]> o = getNearbyRegions(array, x, y);
double min = array[x][y];
int mX = x, mY = y;
for (Integer[] i : o)
if (array[i[0]][i[1]] <= min) {
min = array[i[0]][i[1]];
mX = i[0];
mY = i[1];
}
return new Rive... |
c4bd4613-8153-413b-8907-3f4fe8a36113 | 7 | public ListNode rotateRightII(ListNode head, int n) {
int length = 0;
ListNode newHead = null, prevNewHead = null, end = null;
for (ListNode node = head; node != null; node = node.next) {
if (node.next == null) {
end = node;
}
length++;
}
if (length < 2 || n == 0 || n % length == 0) {
return h... |
7e50665c-818e-4531-b7ec-d43f8d478aa7 | 8 | @Override
public void onCommand(String command) {
final String[] splits = command.split(" ");
if (splits[0].equals("enlist")) {
// enlist <<node_id>> <<transaction_id>>
Integer tid = Integer.parseInt(splits[2]);
if(!_xacts.containsKey(tid)){
System.out.println("Invalid tid " + tid.toString());
... |
e60659b5-714d-44a4-8d75-4688fe179813 | 2 | long f(int n) {
cache.put(1, 1L);
cache.put(2, 2L);
for (int i = 3; i <= n; i++) {
if (cache.get(i) == null) {
cache.put(i, cache.get(i - 1) + cache.get(i - 2));
}
}
return cache.get(n);
} |
02799c51-fff7-4fb9-bcd5-6c3cf8ed4279 | 4 | public Collision collision( GameObject with )
{
if ( topX >= with.getX()+with.getWidth() ||
topX+width <= with.getX() ||
topY >= with.getY()+with.getHeight() ||
topY+height <= with.getY() )
return Collision.NO_HIT;
else {
return Collision.HIT;
}
} |
4a939ca5-eab5-400e-9a05-0e24b804059b | 3 | public List getList(Class type)
{
if (type == null) return entities;
List list = new ArrayList();
for (Object e : entities)
{
if (type.isInstance(e))
{
list.add(e);
}
}
return list;
} |
c42e0ada-a4de-4615-bb38-f627c176cffd | 6 | * @param options
* @return Cons
*/
public static Cons decomposeNamestring(String namestring, Cons options) {
{ PropertyList self000 = PropertyList.newPropertyList();
self000.thePlist = options;
{ PropertyList plist = self000;
Keyword breakoncap = Stella.KWD_CLEVER;
Keyword break... |
8cf2a63a-96a0-4c30-b6f0-84c1af103ac7 | 2 | protected static void add(DoItLater c) {
if (isHtmlOutput()) {
getInstance().actionQueue.add(new DoItLater() {
@Override
public void doIt() {
try {
Thread.sleep(50);
} catch (InterruptedException e) {
}
}
});
getInstance().actionQueue.add(c);
}
} |
6de2825f-da6d-41c2-aa14-41796e6f4fc8 | 1 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (Exception ex) {
Logger.getLogger(ControlJson.class
.getName()).lo... |
941a2ac0-4911-4bb2-be66-7ddd7e3e90c5 | 7 | public List<Alignment> importAlignments() throws IOException, ImportException
{
boolean done = false;
List<Taxon> taxonList = null;
List<Alignment> alignments = new ArrayList<Alignment>();
while (!done) {
try {
NexusBlock block = findNextBlock();
if (block == NexusBlock.TAXA) {
taxonList =... |
a8e1fad4-2fcd-400f-a11c-ec905e86cd19 | 6 | public ArrayList<String> getMovieXml(String movieName) throws TransformerConfigurationException, TransformerException{
URL url;
try {
url = new URL("http://www.omdbapi.com/?t="+movieName+"&y=&plot=short&r=xml");
URLConnection conn = url.openConnection();
Docum... |
66a34eac-afd0-4f5c-9c27-82c36b3b79a6 | 7 | public void make(Move m) throws IllegalMoveException {
FifteenMove fifteenMove = (FifteenMove) m;
isGameNew = false;
if (!isLegal(fifteenMove)) {
throw new IllegalMoveException(fifteenMove);
}
if (fifteenMove.equals(new FifteenMove(QUIT))) {
resignation(nextPlayer);
return;
}
if (nextPlayer == Ga... |
3c507b1f-0dab-491d-983f-3a68229886f4 | 8 | private int getEdgeNumber(double edgeLenght) {
System.out.println("D: " + edgeLenght);
int edgeNumber = -1;
if (edgeLenght < (edgeA + moe) && edgeLenght > (edgeA - moe))
return 0;
else if (edgeLenght < (edgeB + moe) && edgeLenght > (edgeB - moe))
return 1;
else if (edgeLenght < (edgeC + moe) && edgeL... |
0c0efd15-a289-444a-8df6-694af255de95 | 7 | public static State findBoxPathToGoal(Position box, Position goal, State currentState) {
HashSet<State> visited = new HashSet<>();
PriorityQueue<StateHolder> prio = new PriorityQueue<>();
// add the first state to the prio
prio.add(new StateHolder(currentState, box));
... |
efe63b81-8b40-4a2e-8ff1-47ae5fb7d94a | 3 | private boolean processNumberedReference() {
boolean isHexNumberedReference =
originalMessage.charAt(nextPotentialReferencePosition + 2) == 'x' ||
originalMessage.charAt(nextPotentialReferencePosition + 2) == 'X';
try {
int value = (!isHexNumberedReference) ?
... |
751790ec-8607-4dac-ae5c-440c4092c2d6 | 7 | public void monitorarBatimentosCardiacos(float batimentos, Paciente paciente)
throws ControllerException {
try {
if (batimentos < 0) {
throw new ControllerException(
"valor de quantidade de batimentos/seg inválido");
}
if (ValidarPaciente(paciente)
&& (batimentos < 30 || batimentos > 100))... |
bc942099-b3a7-4cbe-b010-19ab2a3c6355 | 6 | public void update(GameContainer gc, StateBasedGame sb, int delta) {
for (Component component : getComponents()) {
component.update(gc, sb, delta);
}
int mousePosX = Mouse.getX();
int mousePosY = Math.abs(Mouse.getY() - Game.app.getHeight());
Input input = gc.getInput();
if ( mousePosX > getPositio... |
6a0fba79-f0e9-4376-aab2-03b24b116df4 | 5 | public void keyPressed(int k){
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
} |
533116fe-5583-47ef-8e20-80b41bd65d57 | 8 | private void init( File file )
{
fileRef = file ;
String fileName = fileRef.getName() ;
int i1 = fileName.indexOf( '_' ) ;
int i2 = fileName.indexOf( '.', -1 ) ;
prefix = "" ;
suffix = "" ;
// check the java style filename -> "name_language_country_variant.php"
if ( i1 > 0 ) // has... |
66bd988e-cc66-4250-95a8-a549b7c591a1 | 3 | private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
f... |
d5c5074e-8568-44d7-b529-29655d8a6cf0 | 1 | public SoundClip(String clipURL)
{
clipLoader = new AudioClipLoader();
try {
clip=clipLoader.loadClip(clipURL);
} catch (UnsupportedAudioFileException | IOException
| LineUnavailableException e)
{
e.printStackTrace();
}
} |
26997bdb-aca4-4a96-8c91-6852f8d47252 | 9 | public void checkTriggers(){
Debug.println("Checking room triggers");
ArrayList<Trigger> all_trig = new ArrayList<Trigger>(triggers);
for(String item : items){
all_trig.addAll(Game.item_list.get(item).getTriggers());
}
for(String container : containers){
all_trig.addAll(Game.container_list.get(container... |
b359b0fa-8c83-488c-93b8-e47d11769cdb | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.