method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5640fd46-2547-4465-8290-30bf67b2bc92 | 0 | public void setId(Integer id) {
this.id = id;
} |
5516df76-dec6-427b-b813-9a0b69e4b545 | 6 | static final void method842(boolean bool) {
anInt1501++;
Class138.aClass46Array1942 = null;
if (Class59_Sub1.aBoolean5300
&& (Class348_Sub42_Sub12.method3229() ^ 0xffffffff) != -2)
OutputStream_Sub1.method132(106,
((Class240.anInt4674 ^ 0xffffffff)
== -4) || Class240.anInt4674 == 7,
za_Sub1... |
5cc692ad-0074-4362-8e0f-f574f8ea02df | 9 | public PaymentDialog(Member member, ClassType ct,String message,int flag) {
messageTextArea.setText(message);
globalMember = member;
globalClassType = ct;
globalFlag = flag;
makePaymentButton = new JButton("Make Payment");
makePaymentButton.addActionListener(new ActionListener() {
@Override
public vo... |
ccd8ac96-56e5-45ca-9814-da4472d212e5 | 4 | @Override
public void render(Graphics2D gd) {
_gameView.gameFieldView().render(gd);
String lifes = "LIFES:" + String.valueOf(_gameModel.player().numberOfLives());
font.drawString(gd, lifes, 10, 530);
String level = "LEVEL:" + String.valueOf(_gameModel.level());
font.drawStrin... |
49e85b19-3e78-4f7c-83b3-e5188fd0dc52 | 2 | public boolean hasElement(T a)
{ if(this.a.equals(a))
{ return true;}
else if(this.next!=null)
{ return this.next.hasElement(a);
}
else
{ return false;
}
} |
f9a47881-9848-4c01-a141-0b9dac30b9f1 | 8 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {try {
//GEN-FIRST:event_jButton1ActionPerformed
list = new DrinksDao();
} catch (SAXException ex) {
Logger.getLogger(addItemToDrinkMenu.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParserConfiguratio... |
b824f32c-6f12-402f-80ad-04072f875d8e | 7 | private int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
return 3;
}
switch(curChar)
{
case 70:
... |
e7e05f4e-a47f-40de-8be6-6a34892176f0 | 4 | public void testCompareTo() {
LocalDateTime test1 = new LocalDateTime(2005, 6, 2, 10, 20, 30, 40);
LocalDateTime test1a = new LocalDateTime(2005, 6, 2, 10, 20, 30, 40);
assertEquals(0, test1.compareTo(test1a));
assertEquals(0, test1a.compareTo(test1));
assertEquals(0, test1.compa... |
811e1d25-d0db-4b28-99db-a45599d3f398 | 5 | private void jButtongetArrivalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtongetArrivalsActionPerformed
if ("".equals(jXDatePickergetArrival.getEditor().getText()) || "".equals(jXDatePickergetDeparture.getEditor().getText())) {
JOptionPane.showMessageDialog(rootPane, "Mak... |
6413f8a6-bb02-4159-b415-76bb5493815a | 0 | public CtrlMenu getCtrlM() {
return ctrlM;
} |
6b6ebaa3-bdfe-456f-82de-84ee0e1f7305 | 6 | public static void main(String[] args) {
SavingsAccount bank[] = new SavingsAccount[2];
Scanner stdin = new Scanner(System.in);
createAccounts(bank,stdin);
System.out.println("Initial accounts:");
displayAccounts(bank);
int choice;
SavingsAccount acc;
do{
System.out.print(
"1) make a depos... |
b7e1aba0-4955-43ba-a5e4-df2dc2dd03bf | 1 | public ItemStack getIcon(IconType type) {
if (IconManager.getInstance().getIcon(type).getItemStack() != null) return IconManager.getInstance().getIcon(type).getItemStack();
else return null;
} |
3831f2fd-e431-4f66-a1ca-a4a6422bbfd3 | 5 | public void paint(Graphics g) {
final Shire shire = ((PopupShire)parent).getShire();
if(shire==null){return;}
final Library library = shire.getLibrary();
super.paint(g);
int r = 0;
Clan gov = shire.getGovernor();
if (gov != null) {
g.drawString("Governor: " + gov, 2, 15+15*r++);
g.drawString("of : ... |
02f418ea-ce2e-4117-abab-52cf48a8fc07 | 1 | public static List<ModelFiledDesc> getModelFiledByTableColumn(TableDesc tableDesc){
List<ModelFiledDesc> result = new ArrayList<ModelFiledDesc>();
Iterator<TableColumnDesc> it = tableDesc.getTable().iterator();
while (it.hasNext()) {
ModelFiledDesc mfd = new ModelFiledDesc();
TableColumnDesc tcd = it.next... |
947d38f4-d440-441b-970a-ab699ffcd4eb | 3 | private void showAccounts(String instanceUrl, String accessToken,
PrintWriter writer) throws ServletException, IOException {
HttpClient httpclient = new HttpClient();
GetMethod get = new GetMethod(instanceUrl
+ "/services/data/v20.0/query");
// set the token in the h... |
28b43499-33c0-4195-9c04-d0aa33c37a0c | 5 | public void geraCruzCelulasPossiveis() {
jogandoEmCruz = true;
jogandoEmLinha = false;
podeMudarPivo = false;
int cAbaixo = celulaPivo + 10;
int cAcima = celulaPivo - 10;
int cDireita = celulaPivo + 1;
int cEsquerda = celulaPivo -1;
if(cAbaixo > 99)
cAbaixo = celulaPivo;
if(cAcima < 0)
c... |
765df978-6344-415d-b472-29bebdd0ca60 | 3 | public static void main(String[] args) {
try {
MainWin window = new MainWin();
for(String s : args )
{
if( s.compareTo("--hide") == 0 ) //$NON-NLS-1$
{
window.hiddenAtStart=true;
}
}
window.open();
} catch (Exception e) {
e.printStackTrace();
}
} |
5be5d48c-d16e-46fd-b2a7-d5c5261f18c8 | 7 | public void paint(Graphics g) {
if (!v.forme.equals("")) {
int p1X = (int) v.p1.getX();
int p1Y = (int) v.p1.getY();
int p2X = (int) v.p2.getX();
int p2Y = (int) v.p2.getY();
listeDessin.add(new Donnee(v.forme, v.c, p1X, p1Y, p2X, p2Y));
for (int i = 0; i < listeDessin.size(); i++) {
g.setColor(... |
246730f1-2a3a-4f33-9fb6-680703d7c84e | 4 | public int Delete(ArrayList<QueryCriteria> criteria) {
this.DBConn = new DBHelper();
String whereClause = "", QueryStr;
for (int i = 0; i < criteria.size(); i++) {
if (!whereClause.equals("")) {
whereClause += " and ";
}
whereClause += criteri... |
91813546-3d1b-46c3-ba03-164e78133f1d | 6 | private int concurDataSizeRecv(Map<Integer, Integer> observed, Iterator<XORFragment> left) throws InsufficientFragmentsException {
if(left.hasNext()) {
// Process the next fragment
XORFragment frag = left.next();
int fragValue = frag.getClusterDataSize();
Integer ... |
a0d4498a-8f27-4e68-bca1-f346e860de85 | 2 | public boolean hasAlpha() {
return hasAlphaChannel() ||
paletteA != null || transPixel != null;
} |
c7a8e071-ee0c-4121-a12d-3a9ad2b32dcc | 8 | public void setup() {
size(1300, 700, GLConstants.GLGRAPHICS);
smooth();
col1 = color(255, 247, 236);
col2 = color(254, 232, 200);
col3 = color(253, 212, 158);
col4 = color(253, 212, 158);
col5 = color(252, 141, 89);
col6 = color(239, 101, 72);
col7 = color(215, 48, 31);
col8 = color(179, 0, 0);
... |
5305520a-8f99-43de-8f3d-24d763ddac33 | 0 | public void setOrder(String order) {
this.order = order;
} |
817e7714-bd09-47dd-8f8f-df321ab11d2c | 2 | public List<Planet> NotMyPlanets() {
List<Planet> r = new ArrayList<Planet>();
for (Planet p : planets) {
if (p.Owner() != 1) {
r.add(p);
}
}
return r;
} |
3c3b1f91-467b-49dd-b049-24b6f7c27400 | 2 | private static String loadShader(String fileName)
{
StringBuilder shaderSource = new StringBuilder();
BufferedReader shaderReader = null;
try
{
shaderReader = new BufferedReader(new FileReader("./res/shaders/" + fileName));
String line;
while((line = shaderReader.readLine()) != null)
{
s... |
d11f0e26-2fc1-4826-a4ce-657791150929 | 9 | private void findScripture() {
boolean extracted = true;
extractChapterWord();
while (extracted == true) {
extracted = bbbcvv();
//This series of if statements check for the most complex to the
//least complex of possible scripture statements. When one is... |
7c8c509e-ffd9-4acb-adde-13ddb91304c6 | 9 | public static void DFSTest(WUGraph g, WUGraph t, DFSVertex[] vertArray) {
int[][] maxOnPath;
Neighbors neigh;
int i, j;
System.out.println("Testing the tree.");
maxOnPath = new int[VERTICES][VERTICES];
for (i = 0; i < VERTICES; i++) {
for (j = 0; j < VERTICES; j++) {
vertArray[j]... |
c21f974e-ab92-4d6c-baa7-71524374c916 | 3 | public void paintComponent(Graphics g) {
super.paintComponent(g); // fill with background color.
g.setFont(bigFont);
g.setColor(Color.GREEN);
g.drawString(message, 10, getHeight() - 10);
// Draw labels for the two sets of cards.
g.drawString("Dea... |
f896b4c5-dcbd-4bf8-afb4-e3a41cb3f3ab | 8 | public static CellFormat fromPatternString( String pattern )
{
if( (null == pattern) || "".equals( pattern ) || "General".equalsIgnoreCase( pattern ) )
{
return new GeneralCellFormat();
}
String[] pats = pattern.split( ";" );
String tester = StringTool.convertPatternExtractBracketedExpression( pats[0] )... |
735690bc-a981-43fd-a754-e5c4e458cb84 | 8 | public boolean equals(PixImage image) {
int width = getWidth();
int height = getHeight();
if (image == null ||
width != image.getWidth() || height != image.getHeight()) {
return false;
}
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (! (getRed(... |
a60a58cb-f1b5-404c-b77b-b04825f1284f | 5 | public ArrayList<Integer> getRow(int rowIndex) {
//store the result
ArrayList<Integer> a = new ArrayList<>();
//store all the elements
int[] b = new int[rowIndex + 1];
if (rowIndex < 0) {
return a;
}
//the rowIndex is 3, the b.size is 4
for (i... |
b53db656-7d6c-4152-9023-d9dadba42b1c | 1 | List<Tile> getTiles(List<Component> cmps) {
List<Tile> ts = new ArrayList<Tile>();
for (Component c : cmps) ts.add(tiles.get(c));
return ts;
} |
34e06035-c295-4390-a407-f1a21c0b6e6c | 9 | private void jToggleButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton3ActionPerformed
//Agregar Clase al Plan
boolean ver = false;
if (this.getTemp().getClases().isEmpty()) {//si es diferente de 0 verificamos
for (int i = 0; i < th... |
0179fdb2-a172-4d8a-84de-7eeb3052bdb0 | 8 | public static void main(String[] args) {
BinaryTree tree = new BinaryTree();
System.out.println(tree.isEmpty());
tree.setRoot(new Node(7, null, 'c'));
System.out.println(tree.root());
tree.setRoot(new Node(8, null, 'd'));
System.out.println(tree.root());
tree.addLeft(tree.root(), new Node(10, null, '... |
1ab7aa87-9b9f-4043-b00d-584f5b7e2fab | 7 | private static void assignClientToVehicle(Individual child, Individual parent1, Individual parent2, int[] assignedVehicle, int[] numberOfCustomerServed,int period)
{
for(int client=0; client<problemInstance.customerCount;client++)
{
if(child.periodAssignment[period][client]==false) continue;
int vehicle... |
19aa876b-effe-4301-b009-556d8328647e | 2 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int choise;
System.out.println("Enter 1 to run test with java.util.concurrent");
System.out.println("Enter 2 to run test without java.util.concurrent");
choise = scanner.nextInt();
switc... |
564c2125-ba83-46b2-a8ef-b91d224ce223 | 5 | public static void main( String [ ] args )
{
RedBlackTree<Integer> t = new RedBlackTree<>( );
final int NUMS = 400000;
final int GAP = 35461;
System.out.println( "Checking... (no more output means success)" );
for( int i = GAP; i != 0; i = ( i + GAP ) % NUMS )
t.insert( i );
... |
b9c2e960-c17f-437e-8f04-dc8ea6817bc1 | 8 | public static void main(String[] args) {
int i, rotate_x = 0, rotate_y = 60, rotate_z = 0;
for (i = 0; i < args.length; ++i) {
if (!args[i].startsWith("--rotate-x")) {
rotate_x = Integer.parseInt(args[i].substring(11));
} else if (!args[i].startsWith("--rotate-y")) {
rotate_y = Integer.parseInt(args... |
59ac81df-be9b-425d-ac4d-4b40de68d2b3 | 1 | private static boolean getKeyDown(int keyCode)
{
return getKey(keyCode) && !lastKeys[keyCode];
} |
ab47eda4-ada2-48d5-9fe3-57f579564057 | 0 | public int getHeight() {
return height;
} |
11752c97-95fa-499b-be4f-333d2f69a147 | 6 | @Override
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex == DELIVERY_PACKET_ID) {
return Integer.class;
} else if (columnIndex == MEMBER_NAME) {
return String.class;
} else if (columnIndex == EVENT) {
return String.class;
} else ... |
73bb8ee4-297f-42d9-a1f1-6a9741b192ea | 7 | public final Connection getConn() throws ReportTestException, ClassNotFoundException, SQLException {
if (conn != null) {
return conn;
}
//busca as configurações do banco de dados
BancoDadosDao dao = new BancoDadosDao();
Projeto p = DataManager.getInstance().getProje... |
a07a3594-fff8-4202-9244-e7df8999b20b | 9 | public static void gerenciarClientes() {
int opcao;
String nome;
String cpf;
String telefone;
String endereco;
int anoCNH;
int anoValidadeCNH;
ArrayList<Cliente> clientes;
while (true) {
opcao = menu.menuClientes();
switch (... |
225918f0-ac12-4093-b0cb-360ae5900088 | 0 | public String proposeFilename(String filename, Serializable structure) {
return filename;
} |
1a4d6dbf-bfe3-4c7f-aa92-fad65bf812ed | 1 | @Override
public DateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException
{
String text = jsonParser.getText();
try
{
return dateTimeFormatter.parseDateTime(text);
}
catch (Throwable... |
23318591-28ed-4c3c-afd6-97ed36e7df0d | 5 | public void topList(String senderName, DB_Timers timer) {
this.plugin.util.messagePlayer(senderName, "Top " + this.plugin.top_amount + " Times:");
this.plugin.util.messagePlayer(senderName, "Timer: " + timer.getTimername());
Integer timerID = timer.getId();
HashMap<String, String> timerRanks = this.plugin.ra... |
c090e302-99b2-42ed-9764-d6138b19036e | 0 | public ArrayList<CompanyApplication> getCompanyApplications() {
return CompanyApplications;
} |
d516d88e-cb1c-473a-a58d-506ef9a483c6 | 1 | public void test_getValue_long() {
assertEquals(0, MillisDurationField.INSTANCE.getValue(0L));
assertEquals(1234, MillisDurationField.INSTANCE.getValue(1234L));
assertEquals(-1234, MillisDurationField.INSTANCE.getValue(-1234L));
try {
MillisDurationField.INSTANCE.getValue(((l... |
6ae4d654-3876-41a3-a1ca-da1c32f4c269 | 6 | public static void main(String args[]) {
//<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://download.oracle.com/javase/tutorial/uiswing/lo... |
ab5482bc-b1ac-4864-9b30-45e6cbc9eeac | 6 | public int getNextWalkingDirection() {
if(wQueueReadPtr == wQueueWritePtr) return -1; // walking queue empty
int dir;
do {
dir = misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]);
if(dir == -1) wQueueReadPtr = (wQueueReadPtr+1) % walkingQueueSize;
else if((di... |
b9f06dbc-fa35-4c46-a788-4c10e9fc71c5 | 4 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
Connection connection;
String sqlString;
String url;
//连接数据库222.205.38.252
url = "jdbc:mysql://"+jtfipField.getText()+":3306/test?user=root&password=root";
ResultSet result;
try
{
Class.forName("com.m... |
f4823e13-b638-425b-bd9a-53cbcd35585b | 8 | protected void processMouseMovedEvent(MouseEvent e) {
// let the tool tip show the current coordinates
setToolTipText("(" + format.format((e.getX() - origin.x) / xScale) + ", "
+ format.format(-(e.getY() - origin.y) / yScale) + ")");
e.translatePoint(-origin.x, -origin.y);
int x = e.getX();
int y = e.ge... |
af02d76d-4100-4144-9f99-f4f64b84dddc | 1 | private void btnFnalizarCompraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFnalizarCompraActionPerformed
VendaDAO dao = new VendaDAO();
venda.setCliente((Cliente)cbxCliente.getSelectedItem());
venda.setFormaPagamento((FormasPagamento) cbxTipoPagamento.getSelectedItem());... |
c23ebcb7-aa74-4bd1-9690-fb49654a9cd3 | 8 | public void onInput(String input){
if (this.abortMessage != null && this.abortMessage.equalsIgnoreCase(input)){
this.abort();
return;
}
Node<? extends Conversation<? extends CommandSender>, T> node = this.nextNode.processInput(input);
if (node != null && (!node.isRecurring() || !node.getClass().equa... |
a7eaaf42-5286-4627-b60c-46395a0865d9 | 1 | public Ticket in(Car car) {
if(isFull()) {
throw new ParkException("停车场已满,不能停车了。");
}
Ticket ticket = new Ticket(car.getCode());
this.carList.put(ticket, car);
return ticket;
} |
37a0ef8a-e9c9-469d-99ea-a6beb8cd62bb | 2 | public static NameNode NameNodeDesserial() {
File file = new File("namenode.out");
ObjectInputStream oin;
NameNode namenode = null;
try {
oin = new ObjectInputStream(new FileInputStream(file));
namenode = (NameNode) oin.readObject();
oin.close();
} catch (IOException e) {
/... |
856ee7a7-cf44-4822-b275-b9857f179821 | 2 | public void addAxon(Integer startNeuronLayer, Integer startNeuronColumn,
Integer endNeuronLayer, Integer endNeuronColumn) {
if (startNeuronLayer >= neurons.size()
|| endNeuronLayer >= neurons.size()) {
throw new IllegalArgumentException(
"Start or End Layer equals not the size of the Perceptron.");
}... |
e4ebc057-0557-4045-aa11-0c05fbbff378 | 9 | public void setVoisins () {
// Attribut a chaque Neuron du reseau ses voisins directs
ArrayList<Neuron> voisins;
for (int col = 0 ; col < colNumber ; col ++) {
for (int row = 0 ; row < rowNumber ; row ++) {
voisins = new ArrayList<Neuron>();
if(col < colNumber -1){
voisins.add(neurons... |
25dc8243-4ad0-438f-91d7-63b0407e7ccc | 1 | public static String unescapeDoubleQuotes(String string) {
if (string == null) { return null; }
String result = string.replaceAll("\\\\\\\"", "\\\"");
return result.replaceAll("\\\\\\\\", "\\\\");
} |
e82bb1c4-12ae-42ac-b2d3-a3525b59c3d9 | 8 | /* */ private void checkDirection(int tx, int ty)
/* */ {
/* 153 */ if (Core.activeClass == this)
/* 154 */ if (this.y < ty) {
/* 155 */ if (this.x > tx) {
/* 156 */ if (Math.abs(this.x - tx) > Math.abs(this.y - ty))
/* 157 */ this.image = Core.unitDirections.getTileI... |
bb52fa2c-543a-4f0e-99f0-e11e9d38b7a8 | 8 | public static void convertFolderToBinary(String dir, boolean recursive)
{
File file = R2DFileUtility.getResource(dir);
if(!file.exists() || !file.isDirectory())
return;
R2DFileFilter filter = new R2DFileFilter();
for(File f : file.listFiles())
{
if(f.isFile() && filter.accept(file, f.getName()))
{
... |
b0e6382f-b90b-4bce-97c1-6047c7b5b5f7 | 5 | public static int getMethod(String item) {
if ("GET".equalsIgnoreCase(item)) {
return GET;
} else if ("POST".equalsIgnoreCase(item)) {
return POST;
} else if ("PUT".equalsIgnoreCase(item)) {
return PUT;
} else if ("DELETE".equalsIgnoreCase(item)) {
... |
776aa1d8-7435-494e-942d-3cd1e741eeb2 | 2 | public boolean WolfAttack(int [] inTargets){ // carries out the lead wolf's murder. returns true if allowed
int TargetRole = PlayerRoles[inTargets[this.LeadWolf() - 1] - 1];
if ((TargetRole >= 3) || (TargetRole < (0))){
return false; // Target is either a wolf, or dead. This gamestate should be removed.
} els... |
7de5b9be-5cdc-46ef-b369-82bc2fd83897 | 1 | int addUninitializedType(final String type, final int offset) {
key.type = TYPE_UNINIT;
key.intVal = offset;
key.strVal1 = type;
key.hashCode = 0x7FFFFFFF & (TYPE_UNINIT + type.hashCode() + offset);
Item result = get(key);
if (result == null) {
result = addType(key);
}
return result.index;
} |
2f4e8273-4782-4b58-92ca-3f3f5a55dcaf | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Discarded)) {
return false;
}
Discarded other = (Discarded) object;
if ((this.itemId == null && other.itemId !=... |
c9d19758-42f8-4d9c-8fc7-e89b4fe9ac8a | 9 | public static String[] toStringRaw(ItemStack is) {
ArrayList<String> msg = new ArrayList<String>();
MaterialData md = is.getData();
msg.add("Item: " + md.getItemType().name() + "; Amt: " + Integer.toString(is.getAmount()) + "; Dur: " + Short.toString(is.getDurability()));
if( is.hasItemMeta() ) {
ItemMe... |
75ab6467-ef6f-402e-96d3-48876847bcab | 4 | public void removeVertex( Vertex<T> v ) {
int pos = getVerticesIndexFor( v );
if ( pos == -1 ) {
throw new IllegalArgumentException( "vertex not found" );
}
this.numberOfVertices--;
this.vertices[pos] = null;
// now we need to go through the adjacency matrix and
// remove all edges i... |
a2d7dac0-7180-426c-9133-06fbca2b888a | 3 | public Socket acceptSocketSafe(ServerSocket x) { //Anti-nuller by Slysoft
boolean socketFound = false;
Socket s = null;
do {
try {
s = x.accept();
int i = s.getInputStream().read();
if ((i & 0xFF) == 14) {
socketFound = true;
}
} catch (Exception e) {
}
} while (!soc... |
f239efe2-17da-434c-88ce-111f2ed15ba9 | 6 | public OwnerTableCellEditor(JTable table, IManagerOwner managerOwner) {
this.table = table;
this.managerOwner = managerOwner;
panel = new JPanel();
panel.setBorder(new EmptyBorder(0, 0, 0, 0));
panel.setLayout(new GridLayout(0, 3));
buttonValid = new JButton();
... |
8996fb78-0e78-4836-9b95-e052db4de30a | 1 | @Override
public String toString() {
return (isProvided ? "Provided" : "Required") + " interface " + getName() + " = component:" + component.getName() + " interface:" + toInterface + " EP:" + getEnergyPoints() + " size:" + size;
} |
8091de91-0a18-41d4-be47-7d7df19bc32a | 0 | public void go()
{
frame = new Frame("Frame for Flow lay out !");
b1 = new Button("B1");
b2 = new Button("B2");
b3 = new Button("B3");
b4 = new Button("B4");
frame.setLayout(new FlowLayout()); //使用FlowLayout替换默认的BorderLayout
// frame.pack();
frame.setSize(200,200);
frame.add(b1);
frame.... |
ec981ae4-a506-43e6-a6c4-02a0954f01d6 | 6 | public String serialize() {
String str = "";
for (int i = 0; i < this.mapGrid.length; i++) {
for (int j = 0; j < this.mapGrid[0].length; j++) {
if (mapGrid[i][j].isPawnOn()) { // set the id if there is pawn on the cell
str = str + "-" + mapGrid[i][j].getP... |
4e96f0ed-1386-410b-b712-3fd125e84af7 | 8 | private boolean isMirror(TreeNode left, TreeNode right) {
if(left== null && right == null) return true;
if(left == null && right != null) return false;
if(left != null && right == null) return false;
if(left.val != right.val) return false;
return isMirror(left.left, right.right... |
ff0f23e4-5f5e-4505-bbfb-a27b9d7bfff3 | 8 | public void redraw(Graphics g){
if (roadGraph!= null && loaded ){
roadGraph.redraw(g, origin, scale);
if (selectedNode!=null) {
g.setColor(Color.red);
selectedNode.draw(g, origin, scale);}
if(destinationNode!=null) {
g.setColor(Color.red);
destinationNode.draw(g, origin, scale);}
}
if (se... |
2c69c837-5938-4686-b86f-6a8593633a1e | 3 | public Item returnItem(String search){
for (int f = 0; f < width; f++){
for (int k = 0; k < height; k++){
if (inventory[f][k].returnName().equals(search)){
return inventory[f][k];
}
}
}
return null;
} |
6864e8df-6883-4ea2-970f-fc73615d1d91 | 8 | private String [] getPDBfiles(String fName, int numFiles){
BufferedReader bufread = null;
try {
File file = new File(fName);
FileReader fr = new FileReader(file);
bufread = new BufferedReader(fr);
}
catch (FileNotFoundException e) {
System.out.println(" ... pdbs config file not found");
System... |
d85e89f5-0ea3-4718-b4fb-b160b0b8169f | 2 | public void dispose() {
for (TabListItemWidget listItem : listItems) {
if(!listItem.isDisposed())
listItem.dispose();
}
super.dispose();
} |
5a3b702a-60c7-4229-bbbd-a61fb615c3ae | 6 | private boolean checkALError()
{
switch( AL10.alGetError() )
{
case AL10.AL_NO_ERROR:
return false;
case AL10.AL_INVALID_NAME:
errorMessage( "Invalid name parameter." );
return true;
case AL10.AL_INVALID_ENUM:
... |
0cf4c308-9cac-467f-88da-e7bf59362b1d | 3 | private Pattern createPattern(String urlStr, String sepStr1, String sepStr2) {
if (urlStr == null || "".equals(urlStr))
return null;
String[] urlArray = urlStr.split(",");
StringBuffer buffer = new StringBuffer(urlStr.length() + urlArray.length * 2);
buffer.append(sepStr1).... |
4cf3ce7b-7488-434d-a012-a629f6fd5bf9 | 5 | private static int getPrice(Element work) throws Exception{
try{
int price = 0;
Elements tmp = work.getElementsByClass("work_price");
if(tmp==null || tmp.size()==0) return 0;
String str = tmp.get(0).text();
//数字抜き出し
StringBuilder b = new StringBuilder();
String num = str.substring(0, str.inde... |
41be6625-f7be-4162-8476-4ba590ee8a61 | 3 | public static boolean upload(String text)
{
try
{
byte[] data = Network.getFormattedTextData(text);
HttpURLConnection con = (HttpURLConnection) new URL(Network.getServerAddress() + "internal/processor.php").openConnection();
if (!Network.processRequest(con, data))
return false;
if (!Network.process... |
47f85d0f-5998-4ee5-813e-d44baf4f9517 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Scene other = (Scene) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fals... |
bee231e9-f180-41bc-b0a0-cd8c09a7a68f | 0 | public Object getColumnValue() {
return columnValue;
} |
df17a8f6-5113-4371-b9ff-7a3e387e29e6 | 8 | public void render() {
// Get the loaded materials and initialise necessary variables
Material[] materials = treeMesh.materials;
Material material;
Triangle drawTriangle;
int currentMaterial = -1;
int triangle = 0;
// For each triangle in the object
for (triangle = 0; triangle < treeMesh.triangles.len... |
fc07437d-ccd5-452d-b3c3-6a213f9098bd | 1 | public PreparedStatement createStatement(String statement){
PreparedStatement con = null;
try {
con = this.connection.prepareStatement(statement);
} catch (SQLException ex) {
Logger.getLogger(DatabaseConnection.class.getName()).log(Level.SEVERE, null, ex);
}
... |
95524e0a-eda5-4306-bb6f-a43e4a59a95a | 4 | public static byte[] decrypt(byte[] in,byte[] key){
byte[] tmp = new byte[in.length];
byte[] bloc = new byte[16];
K = expandKey(key);
int i;
for (i = 0; i < in.length; i++) {
if (i > 0 && i % 16 == 0) {
bloc = decryptBloc(bloc);
System.arraycopy(bloc, 0, tmp, i - 16, bloc.length);
}
if (i < i... |
6eb0563b-025c-423d-8437-6072a8055fb6 | 3 | private static void createQRImage(File qrFile, String qrCodeText, int size,
String fileType) throws WriterException, IOException {
// Create the ByteMatrix for the QR-Code that encodes the given String
Hashtable hintMap = new Hashtable();
hintMap.put(EncodeH... |
d30dadb1-f175-4587-9f33-f52dae2cf016 | 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... |
4aa8fdf7-83a7-4c5c-a804-fd7e41070259 | 1 | public void runDataWindow(){
if(dataWindow == null){
dataWindow = new FrameAddArraysData();
}
} |
9b6d4f11-c248-4268-9526-fde275778d82 | 4 | @Override
public void map(LongWritable ignored, Text filepath,
OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
FileSystem fs = FileSystem.get(new Configuration());
// TIFF in
LocalFile tif = new LocalFile(tempdir + "/" + filepath.toString().... |
1d906284-1251-4aa3-9545-b3aefd3809e7 | 8 | public boolean IsAngular() {
double degree = Math.toDegrees(this.angle);
if ((degree <= 85 && degree >= 5) || (degree <= 175 && degree >= 95)
|| (degree <= 265 && degree >= 185)
|| (degree <= 355 && degree >= 275))
return true;
return false;
} |
1d07f1f5-7c5f-4d53-99b8-ea235b131cf4 | 6 | @EventHandler
public void SnowmanFireResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getsnowgolemConfig().getDouble("Sno... |
d146c3a0-69aa-48e1-95b8-7924a0fc6b71 | 1 | public void connectMySql() throws InstantiationException,SQLException,ClassNotFoundException,IllegalAccessException{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://"+server+"/"+
dbName+"?useUnicode=true&characterEncoding=utf-8&jdbcCompliantTruncation=false",
userName,pass... |
1a8a3613-f270-4484-b81c-894c3eb40d4b | 0 | public void onAccount(IAccount account) throws JFException {
// アカウント情報が更新された際に呼ばれます。
// LOGGER.trace("onAccount : " + account.getAccountId());
} |
3d549c77-f324-4cca-89c3-ee44530d2391 | 8 | public void tick() {
if (items.size() > 0) {
if (player.input.up && moveTimer <= 0) {
selected--;
moveTimer = 12;
}
if (player.input.down && moveTimer <= 0) {
selected++;
moveTimer = 12;
}
... |
242f6657-1d46-4528-80b6-9f3865cc8560 | 0 | public int createNewGame(String name) throws Exception {
prepareConnection();
webResource = client.resource(address + "adminPanel/newGame/" + name);
ClientResponse response = webResource.type(MediaType.APPLICATION_JSON)
.post(ClientResponse.class, null);
return response.getStatus();
} |
e0e1621a-361a-4555-b4b0-df3508025f2c | 3 | public static Double[][] intializeArray(int N) {
Double[][] array = new Double[N][];
for (int i = 0; i < N; i++) {
array[i] = new Double[N];
for (int j = 0; j <= i; j++) {
if(i == j)
array[i][j] = 0.0;
else
array[i][j] = Double.POSITIVE_INFINITY;
}
}
return array;
} |
8c984303-5583-420e-a51d-4aef0a85fbb1 | 5 | public List<PastMeeting> getPastMeetingList(Contact contact)
throws IllegalArgumentException {
List<Meeting> pastMeetings = getMeetings(contact);
List<PastMeeting> pastReturn = new ArrayList<PastMeeting>();
;
if (pastMeetings != null) {
for (int i = 0; i < pastMeetings.size(); i++) {
if (pastMeeting... |
29c5fa85-eeac-45ed-831e-4207607791e6 | 0 | public int getComputerScores(){
return computerScores;
} |
9c2af060-567c-4e84-9826-d126c93f56d3 | 4 | public static void main(String[] args) throws IOException {
// parse arguments
if (args.length == 0 || args.length > 2)
usage();
boolean recursive = false;
int dirArg = 0;
if (args[0].equals("-r")) {
if (args.length < 2)
usage();
recursive = true;
dirArg++;
}
//TODO Configurations to be a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.