method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6fff3951-eebe-4748-8ced-349e80192c19 | 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... |
30d275ee-8532-49c5-8d7d-2ef6fcba5fa6 | 1 | private void firePieceAvailabity(Piece piece) {
for (PeerActivityListener listener : this.listeners) {
listener.handlePieceAvailability(this, piece);
}
} |
43029b5f-9778-4441-b5c3-33cac6a653a3 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TileSources other = (TileSources) obj;
if(other.sources == null && sources == null){
return true;
}
if(other.sources == null || sources ==... |
a39fb71a-2065-4302-ab44-35840b0aac51 | 6 | public static void save(String filename, double[] input) {
// assumes 44,100 samples per second
// use 16-bit audio, mono, signed PCM, little Endian
AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false);
byte[] data = new byte[2 * input.length];
for (int i = 0; i... |
2371cfa4-5fe4-4898-a7f3-4b03cd41d31f | 0 | public void setDepartureStop(int value) {
this._departureStop = value;
} |
8bd19940-406d-4565-80d8-4052620377cf | 5 | protected void extractJars(String path) throws Exception
{
for (int i = 0; i < this.urlList.length; i++) {
String filename = getFileName(this.urlList[i]);
if (filename.endsWith(".pack.lzma")) {
frame.txtrn.setText("Extracting: " + filename + " to " + filename.replaceAll(".lzma", ""... |
056376dc-f8ea-43b7-9434-985cb2c9332d | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
132dbc9d-cb7f-434a-a790-b8d0c7c34359 | 7 | private synchronized void sendPacket()
{
if (packetList_ == null || packetList_.isEmpty() == true)
{
return;
}
// submits the first packet in the list
Packet np = (Packet) packetList_.remove(0);
boolean ping = false; // a flag to determine ping packet or... |
9f78f1f0-b0c3-4858-81ce-b7318980765f | 7 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
// now try to reject equality
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof XYShapeAnnotation)) {
return false;
}
XYShapeAnnotation t... |
678dabce-850f-4e48-9a0c-dc605ee883bb | 4 | private void CriarTorneio_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CriarTorneio_ButtonActionPerformed
// TODO add your handling code here:
Collection<String> equipas = new ArrayList<String>();
DefaultListModel model1 = (DefaultListModel) jList4.getModel();
... |
7ad04bc9-b410-49f9-803f-8b3918d47b7c | 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... |
a9956c43-cf24-40cd-8b80-0e063835d509 | 5 | private void actualizarPosicionesRelaciones( ClaseGrafica clase ){
if ( listaFigura!=null ){
for ( int i=0 ; i<listaFigura.size(); i++ ) {
Figura figura = listaFigura.get(i);
if ( figura instanceof RelacionGrafica ){
RelacionGrafica r = (RelacionG... |
429a4297-b5e1-43e5-90d6-84dc5fa27e3a | 3 | @Override
protected boolean xsend(Msg msg_, int flags_) {
boolean msg_more = msg_.has_more();
// For the first part of multi-part message, find the matching pipes.
if (!more)
subscriptions.match (msg_.data (), msg_.size(),
mark_as_matching, this);
// ... |
8b25c0f8-5436-4e5a-a0c0-da8f026fba27 | 9 | public final void end() {
if(this.vertices > 0) {
this.buffer.clear();
this.buffer.put(this.data, 0, this.length);
this.buffer.flip();
if(this.texture && this.color) {
GL11.glInterleavedArrays(10794, 0, this.buffer);
} else if(this.texture) {
GL... |
16e5c480-4959-43ae-81c9-0852d97923fb | 8 | private static void loadUnpackedShops() {
Logger.log("ShopsHandler", "Packing shops...");
try {
BufferedReader in = new BufferedReader(
new FileReader(UNPACKED_PATH));
DataOutputStream out = new DataOutputStream(new FileOutputStream(
PACKED_PATH));
while (true) {
String line = in.readLine();
... |
3e97ef7d-c98b-4cdb-9e3a-f665232227d0 | 4 | public void copyToPencilMode() {
for(int i = 0; i < 9; i++) {
for(int j = 0; j < 9; j++) {
if((pencilEntries[i][j].isEditable()) && (pencilEntries[i][j].getText().equals(""))) {
pencilEntries[i][j].setText(entries[i][j].getText());
}
}
}
} |
b173c75e-3aa5-42d9-a4be-71a6232634d1 | 4 | public static String getPhrase(String number, String[] dictionary)
{
Comparator<String> c = new Comparator<String>()
{
@Override
public int compare(String s1, String s2) {
if(s1.length() != s2.length())
return s1.length() - s2.length();
return s1.compareTo(s2);
}
};
String s = "";... |
b3527dea-1976-43f3-a920-511b5e0fab40 | 3 | public void run() {
Console.log("[TCP] сlient started.");
byte[] dataFromQueue;
try {
while (!done) {
dataFromQueue = queue.take();
if (dataFromQueue != null) {
send(dataFromQueue);
receive(data);
... |
bd532e5e-ef7d-47f7-97b8-8ef6f1b156cf | 8 | public void move(short sSlot, short dSlot, short slotMax) {
if (dSlot > slotLimit) {
return;
}
Item source = (Item) inventory.get(sSlot);
Item target = (Item) inventory.get(dSlot);
if (source == null) {
throw new InventoryException("Trying to move empty sl... |
19a2844f-5dd1-4e58-8e2b-da7e72101084 | 7 | public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
Option option = (Option) o;
if (opt != null ? !opt.equals(option.opt) : option.opt != null)
... |
240164b4-44e8-44f5-b2d0-c44358bda2e1 | 8 | private String getSingleLineOfChildren(List<? extends BaseToken> children) {
StringBuilder result = new StringBuilder();
Iterator<? extends BaseToken> childrenIt = children.iterator();
boolean isFirst = true;
while (childrenIt.hasNext()) {
Object child = childrenIt.next();
... |
fcff21c2-c0d6-43e8-b5b4-c8b4a319d793 | 7 | public void on_data_available(DataReader reader){
KeyedBytesDataReader datareader = (KeyedBytesDataReader) reader;
SampleInfo info = new SampleInfo();
while(true){
try{
KeyedBytes sample = new KeyedBytes();
datareader.take_next_sample(sample,info);
if(info.valid_data){
@SuppressWarnings(... |
6e70c326-ca8f-4bec-b206-e321d8588dfa | 1 | public boolean isValidSerialization(String preorder) {
index=0;
this.tokens=preorder.split(",");
if(!validate()) return false;
return index==tokens.length;
} |
c6521d80-8c59-4ff8-a915-fb541b6d07dd | 3 | @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
Object open = "Open";
Object inprocess = "In process";
lbl.setText((String) value);
lbl.setOpaque(true);
//set fore and backgrou... |
5193439e-d701-418d-b6a6-91d4b3c9f829 | 1 | public int getInt(){
try{
return Integer.parseInt( value );
}
catch( NumberFormatException ex ){
throw new XException( ex );
}
} |
2d6ca2ce-8c4d-46d6-ab28-edd72c129aae | 3 | public static void main(String[] args)
{
long startTime = System.currentTimeMillis();
if(args.length == 0){
System.out.println("Please provide the location of the workload file!");
System.exit(1);
}
try {
String fileName = args[0];
... |
05234d06-fd96-4c26-8a23-fda99b0bf856 | 4 | public ServerGame GetGameByPlayerId(int playerID) {
ServerGame game = null;
try {
game = GetActiveGameByPlayerId(playerID);
}
catch (RuntimeException ex)
{}
if (game == null)
{
try {
game = Lobby.GetGameByPlayerId(playerID... |
24e261ce-88c7-41aa-a257-1b8ba8816d43 | 7 | public void keyPressed(KeyEvent e) {
if (e.isControlDown()) {
switch (e.getKeyCode()) {
case KeyEvent.VK_DOWN:
// zoom in, mag gets bigger
total_mag *= MAG_INCREMENT_PER_MOUSE_WHEEL_NOTCH;
x_max *= MAG_INCREMENT_PER_MOUSE_WHEEL_NOTCH;
x_min *= MAG_INCREMENT_PER_MOUSE_WHEEL_NOTCH;
y_m... |
e92205b5-05ba-44fe-ae0a-f6320da8b258 | 2 | private String _toString(String delim)
{
String ret = Integer.toString(id) + delim + date.getTimeInMillis();
// past/future flag and notes (empty for Future meetings)
if(this instanceof FutureMeeting)
ret += delim + "F" + delim;
else
ret += delim + "P" + delim + ((PastMeetingImpl)this).getNotes();
... |
68c9dbd5-6aca-4f9a-b0d4-43683dd99e20 | 4 | private boolean isNearby(TurnCoordinate tc1, TurnCoordinate tc2) {
if((tc1.x - tc2.x) == 2 || (tc1.x - tc2.x) == -2) {
return false;
}
if((tc1.y - tc2.y) == 2 || (tc1.y - tc2.y) == -2) {
return false;
}
return true;
} |
7d78f276-0839-481f-a069-8527e686a6ae | 7 | public static void createVariableFromText(Object[] what) {
String phrase;
//int column_start, int column_end, String name, String type, boolean absolute
// TODO: La variable type --> w, s, d... (posible modificacion)
int column_start = (int) what[0];
int column_end = (int) what... |
ccf48309-8b2c-4a13-9da4-85eff4ecf78f | 6 | public static String unquote(String str) {
int length = str == null ? -1 : str.length();
if( str == null || length == 0 )
return str;
if( length > 1 && str.charAt( 0 ) == '\"' && str.charAt( length - 1 ) == '\"' ) {
str = str.substring( 1, length - 1 );
}
... |
963df80f-d48b-411e-b9b2-b818d5a26359 | 2 | public boolean hasFlags(String... flags)
{
for (String flag : flags)
{
if (!this.hasFlag(flag))
{
return false;
}
}
return true;
} |
57d39b09-441e-4c68-a282-74f1cf4b77f6 | 2 | public DefaultListModel<String> buildAmmoList() {
DefaultListModel<String> listModel = new DefaultListModel<String>();
for(int x = 0; x<itemDatabase.size(); x++) {
String[] temp = itemDatabase.get(x).split(";");
if(temp[0].startsWith("3"))
listModel.addElement(temp[0] + ": " + temp[1]);
}
return li... |
32b74a3a-127d-4e18-92b1-9e9d3950f970 | 8 | @Override
public void run() {
try {
startServer();
} catch (IOException e) {
e.printStackTrace();
}
while (!this.isInterrupted()) {
try {
selector.select();
} catch (IOException e) {
e.printStackTrace(... |
481b3447-b5af-4bd8-b9d5-76ffba57c96b | 1 | private void renderChosenDirection() {
if (validChosenDirection())
label.setText(getChosenDirection().toString());
} |
552a467f-e1a6-4a41-bf55-7a5c60a060b6 | 2 | private static char [] zzUnpackCMap(String packed) {
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 90) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--cou... |
ec0b78da-51d0-447f-a3c3-d0c52a9e4175 | 4 | public HashMap getInfo(String link){
String html = GetHTML.getHtml(link,"utf-8");
Document document = Jsoup.parse(html);
if(html.contains("抱歉,您指定要查看的文章不存在或正在审核")||html.contains("Database Error")){
MyLog.logINFO("抱歉,您指定要查看的文章不存在或正在审核");
}
else{
String style... |
0b22810f-327e-4223-a5af-11d9350d2a56 | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
final Room R=mob.location();
if((R!=null)&&(!R.getArea().getClimateObj().canSeeTheMoon(R,null)))
{
if((R.getArea().getTimeObj().getTODCode()!=TimeClock.TimeOfDay.DUSK)
&&(R.getArea().getTimeObj().getTODCode()!=TimeClo... |
4a368288-6a66-4909-bbf9-d6ef0fa5c7cc | 6 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if(cmd.getName().equalsIgnoreCase("permissions")) {
if(args.length == 0) {
for(PermissionsCommand c : cmds) {
sender.sendMessage(ChatColor.YELLOW + "/permissions " + c.getName() + " " + c.getArgs());
}
... |
5ced2d43-392c-4014-acec-521720ac8082 | 3 | public BuffPoolInstrument(SootClass mainActivity) {
// TODO Auto-generated constructor stub
mainAct = mainActivity;
SootClass buf = Scene.v().getSootClass("util.objectpool.BufferPool");
//add BufferPool object as field
SootField f = new SootField("buffPool", RefType.v(buf), Modifier.STATIC | Modifie... |
89269a2c-b879-403a-9ba7-fb576430ea63 | 1 | public List<Long> sortIds(){
List<Long> result = new ArrayList<Long>();
for (Long l : ids)
result.add(l);
Collections.sort(result);
return result;
} |
3f385054-0b0b-42c8-83df-8cc831bf21fd | 6 | public void onUse(ItemStack s, Entity owner, int x, int y, World lvl)
{
AABB aabb = new AABB(x*Block.BLOCK_WIDTH,y*Block.BLOCK_HEIGHT,Block.BLOCK_WIDTH, Block.BLOCK_HEIGHT*2);
if(lvl.getEntitiesInAABB(aabb, null).size() == 0)
{
Block above = Block.getBlock(lvl.getBlockAt(x, y+1))... |
43911982-6b21-42b4-b9e8-76cb5686e8d4 | 3 | public String getSDA(String sda) {
try {
//System.err.println("DBThread Runs");
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/cdr_data?user=root&password=root");
preparedStatement = connect.prepareStatement("... |
d72778be-e9cb-4e03-969f-46fca8b27972 | 1 | public String toString(){
String str = "return";
if(expression != null)
str += " " + expression.toString() + "";
return str;
} |
58450c72-67c3-46f3-aedc-9ca3c503d529 | 4 | private void sanitizeNumTrials() {
// Maximum number of trials is infinite if we're sampling random targets with replacement,
// but it's only |# Stimulus| if we're sampling with replacement
Integer newMax = (chkRandomTarget.isSelected() && !chkRandomWithReplacement.isSelected()) ? cbxTargetType.getItemCount()... |
0c55ddfd-bb6a-4a37-85f2-7c1b69cd0213 | 4 | public static Boolean parseBoolean( String str,
boolean caseSensitive )
throws NullPointerException,
NumberFormatException {
if( str == null )
throw new NullPointerException( "Cannot parse null to a boolean." );
if( caseSensitive )
str = str.toLowerCase();
// This method only recognize... |
09f9e134-4d6f-4e22-b032-684df0da4806 | 2 | private void acao121() throws SemanticError {
if (tipoConstante != Tipo.INTEIRO)
throw new SemanticError("Esperava-se uma constante inteira");
if (Integer.parseInt(valorConstante) > 255)
throw new SemanticError(
"Tamanho da cadeia maior que o permitido (255)");
tipoAtual = Tipo.CADEIA;
} |
3689b78c-fcfd-4d3a-8d96-5a2eddeaa77c | 7 | private int yy_advance() throws java.io.IOException {
int next_read;
int i;
int j;
if (yy_buffer_index < yy_buffer_read) {
return yy_buffer[yy_buffer_index++];
}
if (0 != yy_buffer_start) {
i = yy_buffer_start;
j = 0;
whil... |
a7f5f329-1be2-4382-a345-2f01f47dffb6 | 5 | public int isHit(int mdmg)
{
int toDo = (mdmg-def);
if (toDo <= 0)
{
toDo = 0;
//stays the same
}
else if(toDo > 0) //if it actually does damage
{
curHP = curHP-toDo; //take away the damage from hp
if(curHP < (-2*maxHP))
{ //if it does more than twice your maxhp it's an overkill
System.ou... |
f0bb421f-9414-4461-b512-e49b21e905c4 | 7 | @Override
public void paintComponent(Graphics g) {
super.paintComponents(g);
Graphics2D g2d = (Graphics2D) g;
for (int i = 0; i <= 100; i++) {
g2d.draw(new Line2D.Double(i * 10, 0, i * 10, 10));
}
AffineTransform trans = new AffineT... |
28b1320a-2d32-42e9-bb05-71a17ebf5721 | 0 | @Test
public void virheellinenFormaattiTapausA() {
Este s = new Este(200, 200, 100, 100);
Este r = new Este(100, 100, 200, 200);
assertTrue("Este ei muuttanut kulmia oikeiksi. " + s.toString(),
s.toString().equals(r.toString()));
} |
c1afe07d-33db-4708-8d68-ad75fa88f876 | 7 | public static Ability markOfTheStorm(){
float[] cooldown = {15, 15, 15, 15};
int[] manacost = {40, 50, 60, 70};
String name = "Mark of the Storm";
String[] tooltip = new String[5];
for(int a=0;a<5;a++){
StringBuilder sb = new StringBuilder();
sb.append("Ma... |
a084c007-9b6e-4275-b02c-542ac2430941 | 9 | private void bBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bBrowseActionPerformed
// Create and show File Chooser Window
FileChooser f = new FileChooser();
JFileChooser j = f.getChooser();
if (this.getAddedItems().size() > 0) {
File file = new File... |
859b96c5-cc45-48e3-ad58-d94804d92fa6 | 7 | @Override
public void sequence(String id, String sequence, String quality) {
IdParser parser = IdParserFactory.createParser(id);
if (parser != null) {
String xcoord = parser.getAttribute(IdAttributes.X_COORD);
String ycoord = parser.getAttribute(IdAttributes.Y_COORD);
String indexId = parser.getAttribute(... |
7cd7ecda-6db1-4461-88f1-ae0716f5faf1 | 8 | private int ensureBuffering(int size) throws IOException {
if (size < bpos) {
return bpos;
}
// refill the buffer as more buffering is requested than the current buffer status
try {
if (chunk.size() < buffer.length) {
while (reader.hasNext()) {
... |
39e51d1c-3001-4c1b-8aa2-77cb9e65fec1 | 9 | private void addPlayer(JTextField textField) {
try {
Player p = DataBase.addPlayer(textField.getText(), this);
if (textField.equals(textField1)) {
lblPicture1.setIcon(new ImageIcon(p.getImage().getScaledInstance(70, 70, Image.SCALE_SMOOTH)));
label2.setVisible(true);
textField2.setVisible(true);
... |
55620779-a8fd-4b08-bdaa-a3c51e08c8e8 | 3 | public boolean sendPlaceBlock(EntityPlayer var1, World var2, ItemStack var3, int var4, int var5, int var6, int var7) {
int var8 = var2.getBlockId(var4, var5, var6);
return var8 > 0 && Block.blocksList[var8].blockActivated(var2, var4, var5, var6, var1)?true:(var3 == null?false:var3.useItem(var1, var2, var4, ... |
9f3eab51-721d-4354-aada-116c9fb9cfa8 | 9 | private String useRectangleVariables(String s) {
int n = view.getNumberOfInstances(RectangleComponent.class);
if (n <= 0)
return s;
int lb = s.indexOf("%rectangle[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
RectangleComponent rect;
while (lb != -1 && rb != -1) {
v = s.substr... |
6622cc6e-2b42-462a-98fa-39d947139d07 | 0 | @Override
public void windowActivated(WindowEvent e) {
} |
8974a7f9-42c1-4d86-a65a-6f16da179098 | 5 | public static void writePropertiesWorkflow(ArrayList<String> tl, GenerateCommon gc){
ArrayList<String> srcTlf=new ArrayList<String>();
MyArrayList<String> srcWf=new MyArrayList<String>();
ArrayList<String> odsTlf=new ArrayList<String>();
MyArrayList<String> odsWf=new MyArrayList<String>(... |
92e3715f-4660-48f1-9dec-eac099da9285 | 0 | protected Appointment()
{
super(Appointment.class.getSimpleName());
} |
2e161adb-761e-47b8-97ab-dda10641708b | 6 | int reduce(int threshold, int next_threshold) {
if (nchild != 0) {
for (int id = 0; id < 8; id++) {
if (child[id] != null) {
next_threshold = child[id].reduce(threshold,
next_threshold);
... |
5b7b323f-6027-4283-a0a9-82b2145641df | 0 | public int getLegForce() {
return legForce;
} |
22f54e52-6ac2-4bfc-8215-3a649bb9d8fc | 6 | public boolean matches( Class<?> clazz )
{
Class<?> current = clazz;
while ( current != null )
{
for ( Method method : getDeclaredMethods( current ) )
{
if ( this.name.equals( method.getName() )
&& Arrays.equals( this.argumentsType,... |
be8bbbb1-e003-4827-8fb3-cd8be01de03d | 6 | private void setLookAndFeel() {
//<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/lookandfeel/... |
0402a9f9-a782-4ca1-a515-a95cdeb2c602 | 2 | @Before
public void start_tunnel() throws Exception {
props.load(new FileInputStream(props_file));
try {
if (tunnel_main != null) return;
write_tunnel_config();
tunnel_main = new Main(working_directory, new String[]{config_file.getAbsolutePath()});
t... |
fcd94ed0-a584-4549-8696-319c105c9cb5 | 7 | public int mostVisitedAction() {
int selected = -1;
double bestValue = -Double.MAX_VALUE;
boolean allEqual = true;
double first = -1;
for (int i=0; i<children.length; i++) {
if(children[i] != null)
{
if(first == -1)
fi... |
385f7bce-5514-411f-97dc-5149e1f9de19 | 3 | public static void main(String[] args) throws FileNotFoundException, InterruptedException {
lock = new Lock();
controlador = new LeitorEscritor();
bd = new EstruturaBD();
for (int k = 0; k < 2; k++) { //fazer os 2 tipos de implementação
long inicioPrograma = System.currentTimeMillis(); //começando a conta... |
cfe26459-9ae1-4510-96a3-0827f3bbdf63 | 2 | public void setFog(){
for (int i=0; i < heros.recensement(); i++){
Soldat s = heros.getSoldat(i);
if (!s.estMort()){
decouvrir(s.getPos(), s.getPortee());
}
}
} |
9ce944c2-4a75-4794-b66b-bd43fb3e5961 | 9 | @Override
public String toCode() {
switch (type) {
case BOOLEAN:
return "boolean";
case BYTE:
return "byte";
case CHAR:
return "char";
case SHORT:
return "short";
case INT:
... |
9e4b3f56-676c-4edc-9034-d32d75865a3b | 9 | public void namespace(int namespaceCode, int properties) throws XPathException {
try {
String nsprefix = namePool.getPrefixFromNamespaceCode(namespaceCode);
String nsuri = namePool.getURIFromNamespaceCode(namespaceCode);
int len = nsuri.length() + nsprefix.length() + 8;
... |
0c9b6890-ef95-449d-b07e-44f508a19843 | 4 | private static boolean verifyCube(char[] state) {
// Check that the length is 54
if (state.length != 54) {
return false;
}
// Check that the centers are of the proper color
for (Map.Entry<Character, Integer> center : Cube.CENTERS.entrySet()) {
if (state[center.getValue()] != center.getKey()) {
retur... |
8412a185-de07-4f5b-9243-cf579a47159c | 4 | public void testComplexFloatLargeArrayArraycopy()
{
float[] data = new float[]{1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 10.10f};
int startPos = 1;
int length = 3;
LargeArray.setMaxSizeOf32bitArray(1073741824);
ComplexFloatLargeArray a = new ComplexFloatLargeArray... |
39f0c82d-5259-4dd0-9c2a-62535c53fce5 | 1 | @Override
public List<ValidateException> validate(String parameter) {
List<ValidateException> validateExceptionList = new LinkedList<>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd.MM.yyyy");
simpleDateFormat.setLenient(false);
try {
simpleDateFormat.p... |
3f010df9-cbfa-488e-96d1-534587dfe044 | 2 | public static void getColumnAlphabet(StringBuffer result, int columnIndex) {
// 取余数
int mod = columnIndex % ALPHABET.length;
// 取商
int quotient = columnIndex / ALPHABET.length;
if (result == null) {
result = new StringBuffer(quotient);
}
result.insert(0, ALPHABET[mod]);
// 递归
if (quotient == 0) ... |
db4f397c-265d-42a9-9d4a-d37e718d88b6 | 7 | public MDIDesktopOptionFrame(final JComponent parentComponent,
final JOptionPane optionPane, String title) {
super(parentComponent, title, false, false, false, false);
init();
optionPane.setValue(null); // default to null
if (desktopPane == null
&& (parentComponent == null || (parentComponent.getPar... |
b80be5cd-c764-45d7-8744-46dfabe0d0bf | 9 | private void retrieveParametersValues()
{
try
{_numRows = Integer.parseInt(getParameterValue(numRowsOpt,""+_numRows));}
catch(Exception e)
{ System.err.println("'"+getParameterValue(numRowsOpt,""+_numRows)+"' is not a integer value for the number of rows !");}
try
{_numColumns = Integer.parse... |
cd057bb6-13e7-4b02-9f4f-713402986416 | 3 | private void printDefine(Node t, int n)
{
if (t.getCdr().isNull())
{
t.getCar().print(n+4, false);
System.out.println();
if (n > 0)
{
for (int i = 0; i < n; i++)
System.out.print(" ");
}
t.get... |
6b1febe8-2382-4af5-85b5-53496844f342 | 2 | public void insertDates() throws ParseException {
// http://docs.oracle.com/javase/tutorial/essential/io/file.strHtml
// http://docs.oracle.com/javase/tutorial/java/data/manipstrings.strHtml
//
Path file = Paths.get("/home/mark/0-prj/bible/bookchap-v3.csv");
Charset charset = Cha... |
0350371c-91cc-4899-ab5c-21473e8ea8c2 | 5 | @Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + (this.bold ? 1 : 0);
hash = 97 * hash + (this.color != null ? this.color.hashCode() : 0);
hash = 97 * hash + (this.background != null ? this.background.hashCode() : 0);
hash = 97 * hash + (this.underline ? 1 : 0);
hash = 97 * h... |
8456f5e2-e223-4dce-a614-3c316fc878fd | 3 | public void run() {
try {
Socket socket = _ss.accept();
socket.setSoTimeout(60000);
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStrea... |
a81e5084-ebf9-4796-8522-0ba5c7b4f011 | 9 | public Vector<VertexType> acyclicSP(BaseGraph<VertexType, EdgeType> g, VertexType v) throws InvalidVertexException {
BaseGraph<VertexType, EdgeType> gcopy = g.copy(gc);
final Integer dist[] = new Integer[g.getVerticesCount()];
Vector<VertexType> prev = new Vector<VertexType>();
Queue<Ver... |
4d4f6d0f-ec83-416d-a656-3abde1e1d8ca | 7 | public void removeAssignment(int meeting)
{
Integer timeslot = this.Assignment.remove(meeting);
if(timeslot == null)
return;
ArrayList<Integer> slots = new ArrayList<Integer>();
for(int j = 0; j < this.NumTimeSlots; j ++)
{
slots.add(j + 1);
}
this.SlotsForMeetings.put(meeting, slots);
A... |
c67f8ed6-0eb9-482b-96f6-7104e36acf10 | 4 | private boolean checkForValidTradeValues() {
send = ((this.offeredBrick + this.offeredOre + this.offeredSheep + this.offeredWheat + this.offeredWood) > 0);
receive = ((this.desiredBrick + this.desiredOre + this.desiredSheep + this.desiredWheat + this.desiredWood) > 0);
if(send && receive) {
getTradeOverlay().s... |
171acb55-4b1b-45a7-b7cb-cbccf4adcc72 | 4 | public static String rank(int Player){
String rank = "";
if(Player == 0){
rank = "grosse Dalmuti<br>";
}
if(Player == 1){
rank = "kleine Dalmuti<br>";
}
if(Player == 2){
rank = "kleine Diener<br>";
}
if(Player == 3){
rank = "grosse Diener<br>";
}
return rank;
} |
3790b03c-1c06-4dae-a23e-c86affbec8f5 | 9 | public String toString() {
if (name != null && ! name.isEmpty()) return name;
String ret = "Anonymous";
if (mbox != null && ! mbox.isEmpty()) ret = mbox;
else if (mbox_sha1sum != null && ! mbox_sha1sum.isEmpty()) ret = mbox_sha1sum;
else if (openid != null && ! openid.toString().isEmpty()) ret ... |
ccbd307b-29c2-4880-9639-de0e1006f36b | 9 | private void map(Map<?, ?> map) {
add("{");
Iterator<?> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<?, ?> e = (Map.Entry<?, ?>) it.next();
value(e.getKey());
add(":");
value(e.getValue());
if (it.hasNext()) add(',')... |
ef01db22-4ee5-4f47-bad2-1846a66fdeb2 | 0 | public long id() { return id; } |
3b59eaa1-0a36-4db8-8966-bbcdaf5bc429 | 6 | public int getTile(int x, int y, int z) {
return x >= 0 && y >= 0 && z >= 0 && x < width && y < height && z < length
? blocks[(y * length + z) * width + x]
: 0;
} |
92b07012-1514-4b6a-aecb-7ceefcd428c3 | 9 | public ImmuSet initExamples() {
SetAccumulator acc;
SetAccumulator result;
FilterSpace space;
ImmuSet simple;
acc = SetAccumulator.make();
acc.step((IntegerRegion.make()));
acc.step((IntegerRegion.make(3)));
acc.step((IntegerRegion.make(1, 7)));
acc.step((IntegerRegion.make(5, 7)));
acc.step((IntegerRegion.ma... |
017ba78c-10ae-452c-ad4a-5b823718a0b2 | 3 | public void printSocialGraph(Member m) {
queue.add(m);
exists.add(m);
/*
* Do a breadth-first search starting from member m.
* A breadth-first seach will do a by-level traversal.
* We dequeue whoever is on top, print his/her info, then
* enqueue that member's friends. If the friend has already
*... |
6b309ef4-c922-4e1d-8d8f-fcabef08a0ba | 2 | private boolean jj_3R_80() {
if (jj_3R_92()) return true;
if (jj_3R_93()) return true;
return false;
} |
fd696d25-9181-4743-badf-14dea67b5ce3 | 4 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_UP) {
translateZ += .1f;
}
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
translateZ -= .1f;
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
translateY += .1f;
}
if ... |
b5bb81fe-2caf-422f-b99a-a2ed85f0f5b6 | 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... |
1da1aa18-1c83-4c40-8500-7ee3cfefdaae | 0 | public Date getDateOfJoining() {
return dateOfJoining;
} |
f131f2ac-b9ef-457f-9056-674bef253635 | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
30884137-9fa1-4972-b69e-7c97acf0da1a | 9 | public static void main(String[] args)
{
// TODO code application logic here
int n = Integer.parseInt(JOptionPane.showInputDialog("Ingrese el Rango del Vector:"));
int[] arreglo = new int[n];
int c = 0;
for (int i = 0; i < arreglo.length; i++)
{
int nu... |
ccc9f6b3-7ff8-4c5d-8db2-a2cedd174a10 | 0 | public void setPrpIdElemento(Integer prpIdElemento) {
this.prpIdElemento = prpIdElemento;
} |
dddf70e0-77fe-40a2-a3f7-74015a315f01 | 8 | public static List<File> getFilesFromDir (String directory, List<String> exclusionPattern) {
if (directory == null || directory.equals("")) {
return null;
}
File directoryToScan = new File(directory);
File[] dirList = directoryToScan.listFiles();
List<File> fixedSizeResult = Arrays.asList(dirList);
List<... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.