method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c3167a2d-4e49-43f4-8d95-57953b9a3a1c | 2 | private void jTextFieldFindKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldFindKeyTyped
// TODO add your handling code here:
try {
clearVentHas();
clearVentas();
String sql = "SELECT t1.idVentas AS id_venta, t2.nombre AS empleado, t1.precio_total "
... |
ebb0f70a-473b-4cd5-b214-f0f7bf609137 | 0 | public Integer getTaskId() {
return taskId;
} |
914102ba-086e-452e-ab3b-69e8a3c3fbe8 | 0 | public void setAuteur(String auteur) {
this.auteur = auteur;
} |
31006582-c37a-46b9-b1cc-5aa59de22210 | 6 | protected void tick(double theta) {
scoreText.updateText((String.format("%06d", score)));
lastCreated += theta;
if (lastCreated > 1 && !Main.game.dead) {
lastCreated = 0;
Obstacle o = new Obstacle();
o.obstacle.position.x = (float) Math.random() * 2 - 1;
... |
b69a6a0a-56b4-49ec-ba5c-b141d288319d | 9 | public boolean func_78760_a(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, Vec3 par8Vec3)
{
syncCurrentPlayItem();
float f = (float)par8Vec3.xCoord - (float)par4;
float f1 = (float)par8Vec3.yCoord - (float)par5;
float ... |
0460b65d-6088-4d3a-9bc7-2ad7ddc75c5d | 6 | private void modificar(){
r_con.Connection();
// Controlo los campos Numericos si son en blanco hay que ponerle null, sino da error
// ej:String dni = field_codigo.getText();
String codigo=null;
if (!field_codigo.getText().equals("")){
codigo=field_codigo.g... |
42eb4ae1-37d0-4c2b-b2d1-21ef1ff1c1e4 | 3 | public static char[] loadFile(String file) throws IOException {
BufferedReader reader = null;
CharArrayWriter writer = null;
UnicodeReader r = new UnicodeReader(new FileInputStream(file), null);
char[] buffer = new char[16 * 1024]; // 16k buffer
int read;
try {
reader =... |
3f2f9fab-6f92-4ee4-a552-0bbc9d6bd06b | 4 | int getB(String s1, String s2) {
int b = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (i == j) { // this situation has handled by getA.
continue;
}
if (s1.charAt(i) == s2.charAt(j)) { // if their digit m... |
06566703-2eaa-4b8d-b148-ec1280ec4bd5 | 6 | private Table2Parser(String s) throws Exception
{
StringTokenizer sToken = new StringTokenizer(s, " ");
this.isolateNumber = sToken.nextToken();
this.species = sToken.nextToken();
String phenoString = sToken.nextToken();
if( phenoString.equals("pansusceptible"))
{
phenotypicProfiles.add(phenoStrin... |
469e9fff-0d87-4770-aa7d-6c9a90d0acac | 8 | public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 133
// do, line 134
v_1 = cursor;
lab0: do {
// call prelude, line 134
if... |
3cab986d-e495-4905-b05b-90b1c7841302 | 9 | public ListNode sortList(ListNode head) {
if (head == null || head.next == null) {
return head;
}
ListNode fast = head, slow = head;
while (fast.next != null && fast.next.next != null) {
fast = fast.next.next;
slow = slow.next;
}
ListNo... |
0814e872-7fea-47f4-9801-958e597ed646 | 2 | public String getPrimarySuffix() {
if ( exts != null && exts.length > 0 ) return exts[0];
else return null;
} |
b878dc4e-f043-44fe-b1b2-91edababdb21 | 2 | public void reload() {
if (file == null) {
file = new File(InstaScatter.ins.getDataFolder(), name);
}
config = YamlConfiguration.loadConfiguration(file);
// Look for defaults in the jar
InputStream defConfigStream = InstaScatter.ins.getResource(name);
if (defConfigStream != null) {
YamlConfiguration ... |
6e772e10-456f-410e-b311-d7d734b4b614 | 6 | private String set_nick(String newnick) {
newnick = restrict(newnick);
if (newnick.equals(ms.admin_name)) {
cliprint_h(VT100.crlf + "You cannot open connection as Administrator");
return null;
}
if (newnick.length() > 16) newnick = newnick.substring(0, 16);
if (newnick.length() < 1) {
newnick = nr ... |
9573839a-f6a7-41f7-89e3-05dcc6290d1e | 8 | public void putAll( Map<? extends Float, ? extends Long> map ) {
Iterator<? extends Entry<? extends Float,? extends Long>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Float,? extends Long> e = it.next();
this.put( e.getKey(),... |
7cac8540-15c7-49d7-ad9a-2db0f425d132 | 7 | public void testConstructor_int_int_int() throws Throwable {
YearMonthDay test = new YearMonthDay(1970, 6, 9);
assertEquals(ISO_UTC, test.getChronology());
assertEquals(1970, test.getYear());
assertEquals(6, test.getMonthOfYear());
assertEquals(9, test.getDayOfMonth());
t... |
7739af94-b294-47d2-97fe-644eba35028d | 6 | public Tile getTile(int x, int y, int layer) {
if (x < 0 || x > tileArray[0][0].length || y < 0 || y > tileArray[0].length || layer > 1 || layer < 0) {
return null;
}
return tileset.getTile(tileArray[layer][y][x]);
} |
d741ba43-14fd-47d8-b42a-039f4ece88af | 6 | public void GetBonus() {
for (int i = 0; i < playerEquipment.length; i++) {
if (playerEquipment[i] > -1) {
for (int j = 0; j < 9999; j++) {
if (server.itemHandler.ItemList[j] != null){
if (server.itemHandler.ItemList[j].itemId == playerEquipment[i]) {
for (int k = 0; k < playerBonus.length; ... |
39945fdd-1b9e-4940-ad58-0cf6a3a3f7a4 | 1 | private static boolean isTransient(final Field field) {
return Modifier.isTransient(field.getModifiers()) || field.isAnnotationPresent(Transient.class);
} |
bfa4b62f-f712-426b-bc62-8ec97241c225 | 5 | static String getDefaultLibPath(final typeOS os) {
if (os.equals(typeOS.WINDOWS)) {
try {
String value = WinRegistry.readString(WinRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Open-Transactions", "Path");
if (null == value) {
return "";
... |
51da6e02-b230-4e9f-8bd7-f3b144846fb4 | 0 | public static void run(){
// Application.main(new String[] = {"1+2*3"});
// Application.main("(1+2)*3");
// Application.main("2/3+2*3");
// Application.main("1 + 2 * 3");
// Application.main("-d 2/3+2*3");
} |
ecdee8e1-5ef2-45ca-bf0c-b69176c91478 | 7 | @Override
public void keyPressed(KeyEvent ke) {
if(ke.getKeyCode() == KeyEvent.VK_ENTER){
if(routeNr.getText()!=null){
routeNrS = routeNr.getText();
if(destination!=null){
destinationS = destination.getText();
}
if(routeNrS == n... |
08740374-47a6-456d-908d-c790b62a324f | 0 | public int getCategoryId() {
return categoryId;
} |
025e3140-dc5c-43e4-a152-bf48252e9cb1 | 5 | public int count(int x) throws Exception {
int count = 0;
if (this.array.length == 0) {
throw new Exception();
}
for (int[] temp : this.array) {
if (temp.length == 0) throw new Exception();
for (int aTemp : temp) {
if (x == aTemp) count... |
72150150-67bc-4082-a5bd-3cf96e73d406 | 5 | public void doShell(String cmd){
connected();
try {
Channel channel = session.openChannel("exec");
StringBuffer rst=new StringBuffer();
InputStream is=null;
if(channel!=null){
((ChannelExec)channel).setCommand(cmd);
channel... |
745fda0f-2da8-428f-8bc4-26ddec54ba22 | 4 | public static void screenshot()
{
glReadBuffer(GL_FRONT);
ByteBuffer buffer = BufferUtils.createByteBuffer(WIDTH * HEIGHT * 4);
glReadPixels(0, 0, WIDTH, HEIGHT, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
for(int x = 0; x < WI... |
137631ed-b6f9-4644-ac07-0b282bec7082 | 1 | public boolean setCommandButtonMinWidth(int minWidth) {
boolean ret = true;
if (minWidth <= 0) {
this.buttonCom_MinWidth = UISizeInits.COM_BTN.getWidth();
ret = false;
} else {
this.buttonCom_MinWidth = minWidth;
}
somethingChanged();
... |
dc56c7fc-a015-44ff-8604-2c407e78de2a | 1 | public boolean isFinalized() {
return this.aWaitingId.size() <= 0 && this.aRejectedId.size() <= 0;
} |
a5ac1dd0-a4f4-452c-ab1f-761d3b12ef27 | 0 | private static String getLogInfo(int _obj) {
return ARBShaderObjects.glGetInfoLogARB(_obj, ARBShaderObjects.glGetObjectParameteriARB(_obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB));
} |
d4dd4c98-c76f-4209-8f5b-0639af88a537 | 7 | public void saveBlock() {
colorHEX.requestFocus();
editing.obj=objName.getText();
String c=((ComboText)command.getSelectedItem()).getValue();
editing.command=c;
if(c.equals("MAKE")){
editing.data=new Object[4];
editing.data[0]=makeW.getValue();
... |
a454265e-7507-4fcd-aaa4-8e0d6c7bdbbd | 5 | @Override
public void ejecuta() {
/**
* si la hora actual, esta en nuestro mapa de vientos, asignaremos el
* viento a las bicicletas
*/
for (Ciclista c : lista_de_ciclistas) {
Iterator<Entry<Integer, Integer>> it = arbolCurvas.entrySet()
.iterator();
while (it.hasNext()) {
Entry<Integer... |
106ed106-9f0f-4f58-bbeb-ee43c9be86ea | 2 | public void printSomeStatus (int indent)
throws IOException
{
StringBuffer buf = new StringBuffer ();
int temp;
buf.append ("Driver Mode: ");
buf.append (getDriverMode ());
indentLine (indent, buf.toString ());
buf.setLength (0);
buf.append (getCameraType ());
buf.append (", ");
buf.append ("battery... |
e8f5a0a9-0484-4045-bf4a-a736bbe40b77 | 8 | @Override
public String getStat(String code)
{
if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0)
return CMLib.coffeeMaker().getGenItemStat(this,code);
switch(getCodeNum(code))
{
case 0:
return "" + powerCapacity();
case 1:
return "" + activated();
case 2:
return "" + powerRemaining();
case ... |
f82bf305-4de2-407f-a043-472bc83a136d | 3 | public SudokuBoard[] createSudokuBoards() {
inFile = new FileIO((filePath != null ? filePath : folderPath));
String[] rawData = inFile.loadAllBoardData();
SudokuBoard[] boards = null;
if (rawData != null) {
boards = new SudokuBoard[rawData.length];
for (int i=0; i < boards.length; i++) {
... |
bd654f40-2f51-4b9c-8db2-43b78710c904 | 1 | public static void main(String[] args){
try{
Object[] data = Parser.parse(Constants.LEVEL_FILENAME);
new GameFrame( (List<Entity>)data[0], (List<Tile>)data[1], (List<PickUpObject>)data[2], (Player)data[3]);
}
catch(IOException e){
e.printStackTrace();
System.out.println("ERROR LOADING FILE, ABORTING... |
b5dda071-2254-43c5-a9b4-e0d5514b5285 | 4 | public boolean brainRotate() {
if (currentPiece == null || idealLocation == null || idealLocation.piece == null) {
// Hack to avoid an Exception where I just manually lower the piece to end the game
tick(DROP);
board.commit();
board.place(currentPiece, currentX, currentY);
board.commit();
tick(DROP)... |
ac199066-c1f4-4384-a335-6dc515aae66c | 7 | public boolean isSymmetricRec(TreeNode t1, TreeNode t2){
if((t1 == null && t2 != null) || (t1 != null && t2 == null))
return false;
if(t1 == t2) return true;
if(t1.val != t2.val) return false;
TreeNode tmp1 = t1.left;
TreeNode tmp2 = t2.right;
if(!isSymmetricR... |
95f7cf0b-5463-4c1f-a6d8-397053f73878 | 9 | private void rookMove(KrakenState state,ArrayList<KrakenMove> list,XYLocation location) {
XYLocation kingLocation = state.getKingLocation(color.equals(KrakenColor.WHITE_ITEM)? "b":"w" );
int row,column = location.getYCoOrdinate();
//uprigth moves
for (row = location.getXCoOrdinate()-1;row>-1;row--)
if (a... |
84d066c7-514f-4eeb-ba1c-48ba46d0c11f | 8 | @Override
public Iterator<GridCell> getChildren(boolean visited) {
List<GridCell> ret = new ArrayList<GridCell>();
if (this.top != null && this.top.visited == visited) ret.add(this.top);
if (this.bottom != null && this.bottom.visited == visited) ret.add(this.bottom);
if (this.left != null && this.left.vis... |
c10937aa-fc2d-44a8-94e3-2b057e3cdf38 | 9 | public int numDistinct(String S, String T) {
int l1 = T == null ? 0 : T.length();
int l2 = S == null ? 0 : S.length();
if (l1 == 0 || l2 == 0) return 0;
int[][] dp = new int[l1 + 1][l2 + 1];
dp[0][0] = 1;
for (int i = 1; i <= l1; i++) {
dp[i][0] = 0;
}... |
65b7c0b6-6f49-456f-96a3-34260f2972c5 | 2 | void changeText(Schedule s, RoomOutput[][] r, int i, int j){
for(int k=0; k<r.length; k++){
for(int m=0; m<r[0].length; m++){
r[k][m].setTextName(s.schedule[i][j].rooms[k][m].getCode(),
s.schedule[i][j].rooms[k][m].getName(),
... |
04a93154-114c-4fb6-b654-4a8b90fd423b | 0 | public void pause_egress() {
synchronized(egress_paused) {
egress_paused = true;
}
} |
a81a60da-64e1-48f8-8ed2-cca664546cc4 | 3 | public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out=response.getWriter();
Connection conn;
Statement stmt;
ResultSet rs;
String str;
HttpSession hs=request.getSession(true);
hs.setA... |
a578d52a-678e-4812-9b50-591882d7cb6b | 6 | private int randomizeMinimap(int arg0, int lightness) {
if (arg0 == -2) {
return 0xbc614e;
}
if (arg0 == -1) {
if (lightness < 0) {
lightness = 0;
} else if (lightness > 127) {
lightness = 127;
}
lightness = 127 - lightness;
return lightness;
}
lightness = lightness * (arg0 & 0x7f) /... |
1323d6ba-7a07-4a93-95fc-f14094aaa256 | 3 | protected String removeSpacesInsideTags(String html) {
//remove spaces around equals sign inside tags
html = tagPropertyPattern.matcher(html).replaceAll("$1=");
//remove ending spaces inside tags
//html = tagEndSpacePattern.matcher(html).replaceAll("$1$2");
Matcher matcher = tagEndSpacePattern.matcher(html... |
e83b9348-f375-4552-855b-d126c008a970 | 6 | @Override
public RoleSchool addRole(String json, int id) throws NotFoundException {
JSONObject jObj = new JSONObject(json);
String roleName = jObj.getString("roleName");
RoleSchool role = null;
if (roleName.equalsIgnoreCase("Teacher")) {
role = new Teacher(jObj.getString(... |
5b788f05-6f4e-46ff-a87a-3946a680d325 | 4 | public String to(String field, int min, int max)
{
String newField = "";
System.out.println(field.substring(0, 2));
if(field.substring(0, 2).equals("TO"))
{
field = field.substring(3);
for(int i = 1; i <= field.length(); i++)
{
i... |
370660bc-98cf-4a21-b513-55a4d6e2b8e9 | 7 | private JComponent createRowHeaderRow(final DataTableObject dataTableObject, String format) {
final ArchiveDataKind dataKind = dataTableObject.getDataKind();
final SystemObject systemObject = dataTableObject.getObject();
String dataKindText;
String dataKindTooltipText;
if(dataKind == ArchiveDataKind.ONLINE) {... |
5fab2750-efeb-4a98-aa9d-2706f87c1fa0 | 1 | public void runFileDataBaseEditor(){
if(fileDataBaseEditor == null){
fileDataBaseEditor = new FrameFileDataBaseEditor();
}
} |
938fbfc2-5fff-4168-ba1b-2102a7631b2a | 0 | public void setLuck(double luck) {
this.luck = luck;
} |
bf6ccf1b-9d14-4b39-be37-181cd61ed972 | 8 | private double sIB_local_MI(Matrix m, double[] Pt) {
double Hy = 0.0, Ht = 0.0;
for (int i = 0; i < Pt.length; i++) {
Ht += Pt[i] * Math.log(Pt[i]);
}
Ht = -Ht;
for (int i = 0; i < m_numAttributes; i++) {
double Py = 0.0;
for (int j = 0; j < m_numCluster; j++) {
Py += m.get(i... |
b854a3a6-fcb0-4e67-ad73-131820303d3c | 5 | private void acao173(Token token) throws SemanticError{
try {
idAtual = tabela.get(token.getLexeme(), nivelAtual);
if (idAtual instanceof IdentificadorVariavelCampoRegistro) {
if (regAtual.getListaCampos().contains(idAtual)) {
tipoVariavel = ((IdentificadorVariavel) idAtual).getTipo();
} else {
... |
8d52e19b-988f-4f79-a3c1-2ae2f70224b7 | 0 | @Override
public void setPostalCode(String postalCode) {
super.setPostalCode(postalCode);
} |
3d880107-a802-485c-9fce-d51a1923bc10 | 9 | public static void main(String[] args) {
try {
List<String> strDNAs = FileUtils.readFileFASTA2("d:/temp/rosalind_lcsq.txt");
//String st1 = "GAC"; // вертикальная
//String st2 = "AGCAT";
//st1 = "XMJYAUZ"; // вертикальная
//st2 = "MZJAWXU";
String st1 = strDNAs.get(0);
String st2 = strDNAs.get... |
8300bd86-629e-4f87-87d9-635085ec2aa3 | 4 | public static void update(Clan clan) {
System.out.println("update clan");
Player player = Worlds.getPlayer(clan.getOwner());
long[] names = new long[clan.getMembers().size()];
byte[][] ranksAndWorlds = new byte[clan.getMembers().size()][2];
System.out.println(names.length);
for (int i = 0; i < names.length;... |
c5277924-6e39-480f-8726-57cdde7c8725 | 4 | public int compare(Instance s1, Instance s2)
{
if(!s1.containsFeature(fid)) return 1;
if(!s2.containsFeature(fid)) return -1;
if(s1.getFeature(fid) - s2.getFeature(fid) > 0)
return 1;
if(s1.getFeature(fid) - s2.getFeature(fid) < 0)
return -1;
return 0;
} |
14e099a1-efe5-4671-b785-fef0ebc9caa7 | 5 | static final void method699(IndexLoader class45, byte i, IndexLoader class45_4_,
IndexLoader class45_5_, IndexLoader class45_6_) {
try {
Class348_Sub40_Sub28.aClass45_9365 = class45_6_;
anInt1147++;
Entity.widgetSpriteIndexLoader = class45_5_;
Class229.aClass45_2978 = class45_4_;
Class348_... |
3b8d5be5-469d-4963-a769-15acf09bb749 | 6 | private void debugSetGoods(Colony colony) {
Specification spec = getSpecification();
List<ChoiceItem<GoodsType>> gtl
= new ArrayList<ChoiceItem<GoodsType>>();
for (GoodsType t : spec.getGoodsTypeList()) {
if (t.isFoodType() && t != spec.getPrimaryFoodType()) continue;
... |
4372679b-2a5e-45f3-b56e-d02126445c41 | 6 | private void insertMessages(List<Message> newMessages) {
if ( newMessages == null ) return;
for (Message msg : newMessages) {
if ( type == QueueType.REDUCE ) { // only perform duplicate detection for reduce queues
if ( committedMap == null )
logger.fatal("CommittedMap cannot... |
6caae837-f67c-4fa1-9e48-7a848fa9d69f | 8 | @SuppressWarnings("unchecked")
@Override
public Actor put(Location loc, Actor obj) {
if (loc instanceof AdvancedLocation) {// We only use advanced locations
// but
// the framework may put normal locations
AdvancedLocation aloc = (AdvancedLocation) loc;
switch (aloc.getLayer()) {... |
81a5dc29-11a7-4255-aed5-1981f71feaf5 | 0 | @Test
public void findBestDistance(){
List<ArithmeticQuantity> quantity_list = new ArrayList<ArithmeticQuantity>();
quantity_list.add(new ArithmeticQuantity(10, Distance.FEET));
quantity_list.add(new ArithmeticQuantity(2, Distance.YARDS));
quantity_list.add(new ArithmeticQuantity(9,... |
f9db7c38-d71f-4057-a9cb-d4a25e62c49d | 5 | private static String getTextOfFather(Element element) {
String innerHTML = element.html();
Pattern p = OPENING_BLOCK_TAG;
Matcher m = p.matcher(innerHTML);
if (!m.find()) {
try {
// System.out.println("textTillStartOfNextBlock not found");
t... |
1c83eb96-87d3-45a0-b077-85f1a8c853e7 | 0 | public Character getProductCode() {
return productCode;
} |
e33fa51e-5f1a-459c-b47b-bfd56e5f08e1 | 1 | protected void stopFadeOut() {
if(fadeOut != null) {
fadeOut.fadeStop();
fadeOut.interrupt();
fadeOut = null;
}
} |
c7724306-7dc5-496f-95d4-75161d5940ca | 8 | protected void setContraction(String contraction) {
this.contraction = contraction;
if (contraction.equals(MetarConstants.METAR_VERTICAL_VISIBILITY)) {
isVerticalVisibility = true;
} else if (contraction.equals(MetarConstants.METAR_SKY_CLEAR)) {
isClear = true;
} else if (contraction.equals(MetarConstants... |
5f311f32-58fd-4e34-b1d5-8d7dd569aa38 | 9 | protected ThueRule findRule() {
ThueRule result = null;
boolean[] checkedRules = new boolean[rulesList.size()];
int checkruleCounter = 0;
for (int i = 0; i < checkedRules.length; i++)
checkedRules[i] = false;
if (ruleSelectionPolicy.equals(RuleSelectionPolicy.RULELIST_ASC))
ruleIndex = -1;
else if (... |
df1c50da-c42a-4007-8750-1dc1cc462b4f | 7 | @Override
public final void display(final JPanel panel,
@SuppressWarnings("hiding") final KeyEventHandler key) {
final JPanel mainPanel = new JPanel();
final JPanel buttonPanel = new JPanel();
final JTextField textField = new JTextField();
if (this.content.length() == 0) {
textField.setText(getTooltip()... |
b92207b4-c5f5-48b9-b391-939071304b7c | 5 | private void UpdateCharacterMovements()
{
for( int i = 0; i < world.length ; i++ )
{
for( int j = 0; j < world[0].length ; j++ )
{
if( world[ i ][ j ].equals( "Victim" ) )
{
UpdateCharacterPosition( i , j, "Victim" );
}
else if( world[ i ][ j ].equals( "Hunter" ) )
{
UpdateChara... |
182213e3-19ec-48be-b146-944a4635f8b1 | 4 | private void go(){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int ntemp = n;
int m = in.nextInt();
Node[] nodes = new Node[n+1];
nodes[0]=new Node(0, 0);
int index=1;
while(ntemp-->0){
nodes[index]=new Node(index, in.nextInt());
index++;
}
while(m-->0){
int a = in.nex... |
47907501-045a-44f0-ae64-dcaa7a74cb77 | 2 | public void connectedComponents() {
int size = graph.getVertices().size();
for (int i = 0; i < size; i++) {
if (visited[i] == 0) {
dfs(i);
id++;
}
}
} |
c113ab80-392b-4b91-83a3-aead4cb8e931 | 7 | public void testValidEdge7() {
try {
TreeNode tree = new TreeNode("tree", 2);
TreeNode subtree = new TreeNode("subtree");
tree.setBranch(new TreeNode[]{ subtree, null });
setTree(tree);
TreeNode realTree = ((Question1)answer);
((Question1)a... |
74994591-872b-4f14-9a51-20726dc24872 | 4 | @Test
public void testProtectionEntryMaintenanceOnChangePropertyToSuperclass() throws Exception
{
// Change property from one subclass to superclass.
PersistenceManager pm = new PersistenceManager(driver, database, login, password);
// drop all tables
pm.dropTable(Object.class);
// create two OriginalObject... |
5c818808-c414-4caf-859d-ea975af67238 | 5 | public Xml_HUDElement_Reader(MTApplication mtApplication) {
File f = new File("data/xml/HUDcoordinates.xml");
XmlHandler xmlHandler = XmlHandler.getInstance();
Document xmlFile = xmlHandler.load(f);
NodeList allElements = xmlFile.getElementsByTagName("HUDElement");
for (int i = 0; i < allElements.getLen... |
d89e88df-2fa3-42f9-b973-771f79838afe | 4 | public static LinkedListNode partition(LinkedListNode n, int x) {
LinkedListNode before = null;
LinkedListNode after = null;
while (n != null) {
LinkedListNode node = n.next;
if (n.val < x) {
n.next = before;
before = n;
} else {
n.next = after;
after = n;
}
n = node;
}
if(... |
682f6d28-e113-4b5d-b347-c07e4d686023 | 8 | private static void readClusterFile(String clusterFile, String file) {
ArrayList<String> queries = new ArrayList<String>();
ArrayList<Integer> SKU = new ArrayList<Integer>();
try {
BufferedReader bReader = new BufferedReader(new FileReader(file));
String line = bReader.readLine();
while ((line = bReader... |
6cbf0d9c-6707-4815-8c01-e777a4176443 | 5 | public Node merge()
{
System.out.println("size is --"+this.size());
if(this.size()%2!=0)
return null;
Node p1, p2, r=null;
p1 = this;
p2 = this;
Node p3=this;
while(p1.next!=null && p1.next.next!=null)
{
p1=p1.next.next;
p2=p2.next;
}
System.out.println("mid is-->"+p2.data);
int i = 0;
... |
59e5c78e-d3a5-4a7c-aaba-96864bd15569 | 4 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Position other = (Position) obj;
return this.x == other.x && this.y == other.y;
} |
c2be1aba-159d-48f7-8b26-512c0f655bc3 | 4 | private void adjustWeights(int mood, int curFacit, double act) {
int desiredOutput = 0;
if (curFacit == mood) {
desiredOutput = 1;
}
double error = desiredOutput - act;
if (error != 0) {
for (int i = 0; i < neuralNetwork.length; i++) {
for (int j = 0; j < neuralNetwork[i].length; j++) {
double... |
5fe31ce6-62e2-47c1-8835-aadc87e2d1f8 | 2 | private void goNew(String url) {
myCurrentPosition++;
try {
while (true) {
String removed = (String) myURLHistory
.remove(myCurrentPosition);
}
} catch (Throwable e) {
}
myURLHistory.add(url);
setDisplay(url);
} |
b6932df6-6463-4725-b389-46357d07fd68 | 7 | @Override
protected void setExceptionError(InvalidFieldException e) {
if (e.isHandled())
return;
MainFrame mf = MainFrame.getRunningFrame();
switch (e.getField()) {
case CONT_ID:
if (!GameData.getCurrentGame().isSeasonStarted()){
mf.setStatusErrorMsg("Invalid ID (must be 2 alphanumeric "
+ "cha... |
7e60227f-3373-4c98-8ec7-a12827a2354f | 8 | public int[] adjacentBlackSquare(Integer row, Integer col) {
int rowOfBlack;
int colOfBlack;
// check the above square
rowOfBlack = row - 1;
colOfBlack = col;
if (isInGrid(rowOfBlack, colOfBlack)
&& grid[rowOfBlack][colOfBlack].equals(Color.BLACK)) {
return (new int[] { rowOfBlack, colOfBlack });
... |
aefc8097-fb3c-49be-9492-3bfe41723b43 | 3 | public void generateSymbolTables(List<String> st, String filename) {
FileWriter outputStream = null;
try {
outputStream = new FileWriter(filename);
int ct = 1;
for (String s : st) {
outputStream.write(ct + " " + s + "\n");
ct++;
}
} catch (IOException e) {
e.printStackTrace();
}
t... |
b6bd8d3a-919c-4c60-8613-ac83756821f8 | 5 | public static void main (String args[]){
empleados = new ArrayList<Empleado>();
int resp;
do{
System.out.println("1. Agegar Empleado");
System.out.println("2. Pagar Empleado");
System.out.println("3. Registar Venta");
System.out.println("4. Imprim... |
264949ba-ddf2-417e-8be8-6ee0dc03226e | 0 | @XmlElement
public void setAge(int age) {
this.age = age;
} |
7a7c1996-a7bd-4c56-86a5-cf3e7f47a41d | 1 | public void testConstructor_Object6() throws Throwable {
IntervalConverter oldConv = ConverterManager.getInstance().getIntervalConverter(new MutableInterval(0L, 0L));
IntervalConverter conv = new IntervalConverter() {
public boolean isReadableInterval(Object object, Chronology chrono) {
... |
bf1a4e66-c622-4e9e-8fe7-cf11fd533ff5 | 4 | public static void playMidi(Sequence midi)
{
try
{
if(sequencer == null)
sequencer = MidiSystem.getSequencer();
if(sequencer.isOpen())
{
sequencer.stop();
sequencer.setTickPosition(0);
}
if(midi == null)
{
sequencer.stop();
s... |
ad5ee113-cb50-4e31-9c4e-c959e0b851b4 | 0 | public void templateMothod(){
doOperate1();
doOperate2();
doOperate3();
} |
bb654eb7-eb6d-4736-a5f8-a61287d2cbe9 | 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 fe... |
cf295cc9-ebb8-478c-8c7c-547b5d7eb0a6 | 0 | public SimpleVector getTotalForce() {
return totalForce;
} |
3731aca5-258e-4579-b518-a660f33dfc6d | 1 | public static PlayersBallot createPlayersBallot(Player player) {
if (player == null) throw new IllegalArgumentException("Player is Null");
return new PlayersBallot(player);
} |
e6f05988-2ab8-4158-b2a9-57d32a6dc646 | 8 | public FaltaVO[] consulta (FaltaVO falta){
FaltaVO[] faltas = new FaltaVO[0];
boolean bandera = false;
String quiry = "SELECT * FROM faltas WHERE";
if(falta.getAlumno() != null){
quiry += " CAST(alumno AS CHAR) LIKE '" + falta.getAlumno() + "' AND";
bandera = true;
}
if(falta.getFecha() != null){
D... |
7a0dd32b-b48d-4e41-870f-01b72b757b23 | 9 | public static void main(String[] args) {
//defaults
String host = "localhost";
int port = 1337;
int threadCount = 20;
if (args.length > 0) {
host = args[0];
if (args.length > 1) {
try {
port = Integer.parseInt(args[1]);... |
57b68fd0-ce78-4600-be5f-4efa1d87496f | 4 | @Override
public boolean activate() {
return (Inventory.isFull()
&& !Bank.isOpen()
&& (!Constants.VARROCK_WEST_BANK_AREA.contains(Players.getLocal())
&& !Constants.VARROCK_EAST_BANK_AREA.contains(Players.getLocal()))
&& !Constants.ESCAPE_AREA.contains(Players.getLocal())
);
} |
8db3784f-ae62-4e5c-a29f-c0bc717bebe0 | 0 | public double getLongitude()
{
return longitude;
} |
73da89cb-40a2-4f47-9a2b-cb03cac3e85c | 8 | public int getFileCount(int idx) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs =null;
int result = 0;
try{
conn = getConnection();
pstmt = conn.prepareStatement("select count(*) from travel where idx=?");
pstmt.setInt(1, idx);
rs = pstmt.executeQuery();
... |
b40343ed-852e-49a0-ab6f-41b1d8f2d868 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Message other = (Message) obj;
if (encrypted != other.encrypted) {
return false;
}
if (id != other.id) {
return false... |
b58b7919-33b0-4f7c-94fd-adc0bad5ea5f | 9 | public static void insertData(String c_id, String c_pw, String c_name, String c_email, String c_phone, String path) {
String sql = "insert into member ( id, pw, name, email, phone, photo) values (?, ?, ?, ?, ?, ?)";
Connection conn = null;
PreparedStatement psmt = null;
FileInputStream fis = null;
try {
... |
765bdf1f-de59-445d-9c0c-e39e7511ed28 | 2 | private StockItem getStockItemById(int id) {
for (StockItem item : warehouse) {
if (item.getId() == id)
return item;
}
throw new NoSuchElementException();
} |
3ec7f6ce-4e69-463f-bb97-910d4873e62e | 8 | private void process(String json){
if(json.equals("")) return;
Gson gson = new Gson();
Response response = gson.fromJson(json, Response.class);
long nextTime = time;
System.out.println("Code: " + response.getMeta().getCode());
if(response.getMeta().getCode() == 200){
... |
0c85cde8-f6cf-40ac-8dd1-c8c4f8f9a678 | 2 | public String toString() {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < array.length; i++) {
sb.append("LinkedListFromArray[" + i + "] = " + array[i]);
if (i < array.length - 1) {
sb.append("\n");
}
}
return sb.toString();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.