method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0e01ef13-f7e8-4f76-9928-d109484137fc | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TestDescriptor other = (TestDescriptor) obj;
if (!getOuterType().equals(other.getOuterType()))
return false;
if (size != other.si... |
770c29ac-8120-4fc7-be54-8b8e263f31ed | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((code == null) ? 0 : code.hashCode());
return result;
} |
5f013e3d-c7a9-45cd-b44d-2bda212f2d45 | 2 | public void create(int x, int y, double d, double e, Color color) {
for (Particle p : particles) {
if (!p.active) {
p.life = 0.05F;
p.x = x;
p.y = y;
p.yV = d;
p.xV = e;
p.active = true;
p.color = color;
return;
}
}
} |
ef3961f9-b18f-47b2-993e-0283154e8759 | 9 | public static void main(String[] args){
UCIParams p = new UCIParams();
for(int a = 0; a < args.length; a++){
try{
if(args[a].equals("--hash")){ //sets main hash size (must be power of 2)
p.hashSize = Integer.parseInt(args[++a]);
} else if(args[a].equals("--pawnHash")){ //sets pawn hash size (must... |
1cfef0a9-fc83-4f98-b9c2-b85ddf536b4e | 2 | @Override
public void componentResized(ComponentEvent ce) {
FRAME_HEIGHT = this.getHeight();
FRAME_WIDTH = this.getWidth();
FONT_SIZE = (FRAME_HEIGHT / 100) * 4;
LABEL_SIZE = new Dimension(FRAME_WIDTH/5 + FONT_SIZE*2, FONT_SIZE + FONT_SIZE/4);
for (Component p : getC... |
ad000a87-7f3f-4aac-b179-33e74155a5e0 | 3 | protected void activate(){ // Activation de l'Environnement en creant un tableau de cellule et en lan�ant tous ces agents cellules
requestRole(Societe.SOCIETE , Societe.SIMU , Societe.CARTE );
// Créer la grille de jeu (grille de cellule)
for (int i=0 ; i < this.longueur; i++){
f... |
02df4f67-a0bf-4952-b268-5807a395b5e3 | 7 | public boolean itemDeposit(WebInventoryMeta wim) {
// Unsupported action
if (!this.canDeposit) {
this.player.sendMessage(MineAuction.prefix + ChatColor.RED
+ MineAuction.lang.getString("action_invalid_deposit"));
return false;
}
try {
// Save item to database
// exist in database (a - update, ... |
632a2632-bd50-4024-9294-aa001d56e3c1 | 9 | public <T> T loadConfig(Class<T> cl, String configPath) {
try {
T config = cl.newInstance();
Map<String, String> map = FileUtil
.readKeyValueConfigFile(configPath);
if (map == null) {
Log.e(TAG + ":" + " read configfile error filepath is "
+ configPath == null ? "null" : configPath);
retur... |
ae17f9d1-f64d-4784-884f-43d5ba746293 | 3 | public static String cPath(String path) {
for (int i = 0; i < path.length(); i++) {
if (path.charAt(i) == '/' && File.separatorChar != '/') {
path = path.substring(0, i) + File.separator + path.substring(i + 1);
}
}
return path;
} |
abe35ade-8c5b-4251-b097-e1e541f7e704 | 8 | * @param directory
* @param input
* @param output
* @param error
* @return int
*/
public static int executeShellCommand(Stella_Object command, String directory, InputStream input, OutputStream output, OutputStream error) {
{ ShellProcess self000 = ShellProcess.newShellProcess();
self000.comm... |
6c427c32-128c-4aaa-a470-4580a3be941a | 5 | @Override
public double compute(double[] params) {
double a = params[0];
double b = params[1];
switch (type) {
case ADD:
return a + b;
case SUBTRACT:
return a - b;
case MULTIPLY:
return a * b;
case DIVIDE:
return a / b;
case POWER:
return Math.pow(a, b);
}
return a;
} |
a53aa5ab-d298-4b12-a62d-c564546138b3 | 6 | private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
... |
1c6c9447-4134-4f1d-b82b-a059b0896688 | 6 | private void jBtnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnAceptarActionPerformed
// TODO add your handling code here:
try {
if (flagcli) {
//Le Codigo
Connection connPed = Conexion.GetConnection();
connPe... |
1a1dbb8c-a80d-409c-a50c-7d3d76d021d5 | 2 | @Override
public void deleteOfOldResults() throws SQLException {
switch (driverName) {
case "org.h2.Driver":
statement = connection.prepareStatement(deleteOfOldResultsStringH2);
break;
case "com.mysql.jdbc.Driver":
statement = connecti... |
162809d0-9437-4b65-b3c9-36b6e1e208a0 | 9 | public final GalaxyXLinkingParser.modifier_return modifier() throws RecognitionException {
GalaxyXLinkingParser.modifier_return retval = new GalaxyXLinkingParser.modifier_return();
retval.start = input.LT(1);
int modifier_StartIndex = input.index();
CommonTree root_0 = null;
Tok... |
48bff8d7-abac-4565-b9ac-43904b162e23 | 1 | public void test_getValue_long_long() {
assertEquals(0, MillisDurationField.INSTANCE.getValue(0L, 567L));
assertEquals(1234, MillisDurationField.INSTANCE.getValue(1234L, 567L));
assertEquals(-1234, MillisDurationField.INSTANCE.getValue(-1234L, 567L));
try {
MillisDurationFiel... |
ff01e557-f46f-4ea1-998f-cb254c9bec2f | 6 | public void updateTo(int index) {
if (index >= 0 && index < chain.size()) {
if (currentIndex > index) {
//Go back
for (int i = currentIndex; i > index; i--) {
chain.get(i).revert();
}
} else if (currentIndex < index) {
... |
a1e74e2f-2cf0-401c-9623-85b8883e8ff0 | 1 | public SLKeyframe(SLConfig cfg, float duration) {
this.cfg = cfg;
this.duration = duration;
for (SLSide s : SLSide.values()) {
cmpsWithStartSide.put(s, new ArrayList<Component>());
cmpsWithEndSide.put(s, new ArrayList<Component>());
}
} |
483808b5-5868-44af-b4e6-6fbdb2fe179a | 8 | public Message getNextMessage () throws IOException {
// check for pending message from peek.
if (pending != null) {
Message msg = pending;
pending = null;
return msg;
}
// read incoming message from wrapped channel
Message msg = next.getNextMessage();
if (msg == null)
return null;
// g... |
eafbfb8b-4a8b-4f6a-bdbf-95fe1c4d69f1 | 0 | public static File getFile(String path) {
return new File(path);
} |
21ce0a86-3c67-4d80-9ac5-e69956e6c210 | 8 | public boolean batchExecIntQuery(String command, Vector<int[]> values) throws SQLException
{
boolean value = false;
Connection connection = null;
PreparedStatement stmt = null;
try
{
Class.forName(driver);
connection = DriverManager.getConnection(url, username, passwd);
connection.setAutoCommit(fal... |
7bcf3462-4c8e-4efe-97a4-f5ce6ac0f98b | 3 | public static boolean check(int row, int col) {
for (int prev = 1; prev < col; prev++)
if (board[prev] == row // Verify row
|| (Math.abs(board[prev] - row) == Math.abs(prev - col))) // Verify
// diagonals
return false;
return true;
} |
4358934d-78b3-4c46-abc7-70d7a5575d55 | 3 | public boolean attemptCast(Player p) {
if (!Mana.hasMana(p, manaCost)) {
p.sendMessage(ChatColor.RED + "You do not have enough mana to cast this spell.");
return false;
} else {
String name = p.getName();
long t = System.currentTimeMillis();
if (!cast.containsKey(name)) {
cast.put(name, t);
M... |
a14e7cf5-f744-4295-89a8-efad63457729 | 7 | @Override
public void actionPerformed(ActionEvent e) {
if((e).getSource() == view.getButtons()[CANCELMOVE]){
view.setVisible(false);
model.getMove().resetTerritories();
model.nextPhase();
}else if((e).getSource() == view.getButtons()[MOVE]){
view.setVisible(false);
model.getMove().moveUnits(view.get... |
1b1b3977-a112-491c-98b8-85894f0d27d4 | 8 | @Override
public void execute(Map<String, Object> map, MainFrame frame) {
System.out.println("Receive Confirm Msg" + map);
String origin = (String) map.get("Origin");
Map<String, Object> reply = (Map<String, Object>) Utilities.deserialize((byte[]) map.get("Content"));
Boolean isConfi... |
b4125d25-a024-4933-8413-36b80697ed43 | 7 | public void renderPiston(TileEntityPiston par1TileEntityPiston, double par2, double par4, double par6, float par8)
{
Block block = Block.blocksList[par1TileEntityPiston.getStoredBlockID()];
if (block != null && par1TileEntityPiston.getProgress(par8) < 1.0F)
{
Tessellator tessell... |
a3e5d480-8044-4dbd-b29a-2f55658fb258 | 0 | public void setDuplicate(boolean duplicate){
this.duplicate = duplicate;
} |
5ed25b38-c687-4097-852e-5187d1c7cd9d | 8 | public void putAll( Map<? extends Double, ? extends Integer> map ) {
Iterator<? extends Entry<? extends Double,? extends Integer>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Double,? extends Integer> e = it.next();
this.put(... |
15a8d251-ed65-4af6-94c7-bd1e2b76ec3e | 5 | public int getSelection()
{
if(selectionOvalY == 94) return 1;
else if(selectionOvalY == 114) return 2;
else if(selectionOvalY == 134) return 3;
else if(selectionOvalY == 154) return 4;
else if(selectionOvalY == 174) return 5;
return 0;
} |
b8e7921f-84d0-4f97-8f1d-524d5ae14c9b | 3 | public void launchDialog(){
NotificationFactory.notify("https://au.finance.yahoo.com/", "Visit finance.yahoo.com to look up Stock Symbols");
JTextField stockfield = new JTextField("");
JRadioButton fullscreen = new JRadioButton();
JRadioButton testdata = new JRadioButton();
JSlider ... |
27c82066-4c72-4075-a395-3507532dd4cb | 9 | private void validateCustomerInfo(HttpServletRequest request, Customer customer) {
if (!customer.isValid())
request.setAttribute("error", "true");
if (!customer.isValidGivenName())
request.setAttribute("invalidGivenName", "Given Name must not be empty and number");
if (!customer.isValidSurname())
requ... |
28992c8d-2c0b-4667-adb7-ce5cb7e45ca1 | 5 | public int getTextDisplayedWidth(String text) {
if (text == null)
return 0;
int width = 0;
/*
* Iterate through every character in the text.
*/
for (int c = 0; c < text.length(); c++) {
/*
* If the current character is the start of a colour
* code or a crown code we can skip it as it will... |
4f76bb4b-b072-4ab1-84eb-b162fdb62d7f | 7 | @Override
public int hashCode() {
int result = item != null ? item.hashCode() : 0;
result = 31 * result + (item2 != null ? item2.hashCode() : 0);
result = 31 * result + (item3 != null ? item3.hashCode() : 0);
result = 31 * result + (item4 != null ? item4.hashCode() : 0);
resu... |
5d599fde-ff9a-4197-a847-21c3cb5959c4 | 6 | public double weightedGeometricMean_as_double() {
if (!weightsSupplied) {
System.out.println("weightedGeometricMean_as_double: no weights supplied - unweighted value returned");
return this.geometricMean_as_double();
} else {
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weighting... |
96444f5f-c56a-4de5-ac09-49c7e8abd5f4 | 8 | final void da(int i, int i_254_, int i_255_, int[] is) {
try {
anInt7528++;
float f
= (((float) i_254_
* (((Class101_Sub3) ((OpenGlToolkit) this).aClass101_Sub3_7760)
.aFloat5754))
+ (((Class101_Sub3) ((OpenGlToolkit) this).aClass101_Sub3_7760)
.aFloat5756) * (float) i
+ ((... |
bb8f36ed-696c-4f88-86b9-7672c15ad7c9 | 7 | private void leftPossibleMoves(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if(x1 >= 1 && x1 <= 7)
{
boolean pieceNotFound = true;
for (int i = x1 - 1; pieceNotFound && (i >= 0) && (board.getChessBoardSquare(i, y1).getPiece().getPieceColor() !=... |
f4cc8c5b-9be5-4407-b0bc-827f8e646433 | 7 | public static void main(String [] args) {
try {
boolean readExp = Utils.getFlag('l', args);
final boolean writeExp = Utils.getFlag('s', args);
final String expFile = Utils.getOption('f', args);
if ((readExp || writeExp) && (expFile.length() == 0)) {
throw new Exception("A filename must be ... |
ca95301f-6874-470a-a26d-a4e107dae49e | 8 | private void printJoins(Vector<LogicalJoinNode> js, PlanCache pc,
HashMap<String, TableStats> stats,
HashMap<String, Double> selectivities) {
JFrame f = new JFrame("Join Plan for " + p.getQuery());
// Set the default close operation for the window,
// or else the progra... |
708d99ee-f6ea-42db-8923-686d937f9e7a | 7 | static Point[] convexHull2D(Point[] ps, Point normal) {
final Point dir = perpendicular(normal); // 任意の点が相異ならdir=ps[1]-ps[0]でよい
Arrays.sort(ps, new Comparator<Point>() {
@Override
public int compare(Point o1, Point o2) {
double d = dir.dot(o2.subtract(o1));
... |
400a6b4f-0962-4934-a27e-ab491af8a376 | 1 | private void downloadParseOutput() {
try {
WebPage page = loadWebPage();
quotes = Parser.getQuotes(page);
sortQuotesByScore();
takeOnlyTopTenQuotes();
shuffleQuotes();
takeOneQuoteAndSetOutput();
cooldown.start();
} catc... |
4236e8a5-f7ee-49c4-9b05-246ed09c3be7 | 6 | public void run() {
// If any of these stay the same then something is wrong
InetAddress IPAddress;
try {
IPAddress = InetAddress.getByName(request.getIP());
} catch (UnknownHostException e1) {
e1.printStackTrace();
bot.sendMessageToChannel("Error: Query IP address could not be resolved or is using IPv... |
7a9b8cd8-9a0f-4c06-ae4f-7ad9a0e973f8 | 1 | public ArtistFeature(File song)
throws MP3Exception {
super(song);
this.obf= new ObjectFactory();
this.artist= this.obf.createArtistType();
this.getHttp= GetHttpPage.getInstance();
try {
this.log= ArtistLogger.getInstance().getLog();
} catch (LogException e) {
throw new MP3Exception("LogExcepti... |
f2425482-f500-4d4c-99db-7adf5a17047e | 1 | public void visitAttribute(final Attribute attr) {
buf.setLength(0);
buf.append(tab).append("ATTRIBUTE ");
appendDescriptor(-1, attr.type);
if (attr instanceof Traceable) {
((Traceable) attr).trace(buf, null);
} else {
buf.append(" : unknown\n");
... |
31b69813-6bbf-4634-82bf-730e14572cdf | 0 | public OutlineEditableIndicator(OutlinerCellRendererImpl renderer) {
super(renderer, GUITreeLoader.reg.getText("tooltip_toggle_editability"));
} |
33da8602-7798-442e-a0ca-7e8c132f47d1 | 8 | public Config newConfig(App app)
throws IOException
{
//System.out.println("MultiConfigMaker.newConfig");
MultiConfig ret = new MultiConfig();
for (Object obj : configs) {
if (obj instanceof Config) {
ret.add((Config)obj);
} else if (obj instanceof File) {
File f = (File)obj;
if (f.isDirectory()) {
r... |
37565933-da19-4ac5-a5db-a90a3b2f1c71 | 0 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Number:");
int input = in.nextInt();
System.out.println("Square is "+(input*input));
System.out.println("Cube is "+(input*input*input));
System.out.println("Fourth Power ... |
73d99fe5-188c-46f7-b9f7-9781867c933d | 5 | protected NCBIFastqIdParser(String id) {
Matcher m = Pattern.compile(REGEX).matcher(id);
if (!m.matches())
return;
if (m.group(2) != null) {
IdParser subParser = IdParserFactory.createParser("@" + m.group(2));
if (subParser != null) {
for (IdAttributes a : subParser.getAllAttributes())
setAttrib... |
e6e12a7b-bcce-4efb-bab1-ae50ae20dd31 | 9 | public void buttonClicked(WizardButtonEvent wbe) {
if( wbe.getButtonType() == WizardButtonListener.NEXT && wbe.getCard() == ep ){
options = new EmbedExtractOptions();
options.setInputFile( sif.getSelectedFile() );
options.setOutputFile( sof.getOutputFile() );
opt... |
b9172ac2-c44f-410e-9c04-306ca97d7e19 | 3 | @Override
public double getVariance() throws VarianceException {
if (lambda <= 1) {
throw new VarianceException("Pareto variance lambda > 1.");
} else if (1 < lambda && lambda <= 2) {
return Double.POSITIVE_INFINITY;
} else {
return Math.pow(k / (lambda - 1), 2) * lambda / (lambda - 2);
}
} |
a5563f5f-d8ab-491f-827c-643718a1680e | 4 | public void actionPerformed(ActionEvent e){
String action = e.getActionCommand();
if (action.equals("refreshList")){
System.out.println("refreshing...");
refreshGUIServer();
} else if(action.equals("arClick")){
System.out.println("arClick");
if(cRefresh.getModel().isSelected()){
timerText.setEdita... |
69f3de97-a065-4b8f-9793-619050902b84 | 0 | public long getId() {
return Id;
} |
0d3a44f8-72cc-41f5-830a-1a4b80df073d | 0 | @Override
public String call() throws Exception {
return "result of TaskWithResult " + id;
} |
c8583184-dc7d-49dd-8396-7a51eaedb6fb | 9 | public void keyReleased(KeyEvent ke) {
Action action = actionOf(ke.getKeyCode());
if (action == null) return;
releaseKey(action);
switch (action) {
case MOVE_UP:
if (vy < 0) { vy = 0; }
break;
case MOVE_DOWN:
if (vy > 0) { vy = 0; }
break;
case MOVE_LEFT:
if (vx < 0) { vx = 0; }
break;
... |
70ea9d83-1fab-4086-bc42-4551e0faccda | 4 | public static void setLook()
{
try {
// for( LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
// System.out.println("look and feels: " + info.getClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel")... |
e520b7f7-0f4b-491c-a79e-d317b5678e88 | 4 | protected void load(PropertiesConfiguration config) throws IOException, ConfigurationException {
this.name = config.getString("name");
this.collection = config.getString("collection");
if (collection != null) collection = collection.trim();
String urlPattern = config.get... |
878e868f-bbf2-4216-85b7-a4301ed1f1ac | 9 | public void keyPressed(KeyEvent evt)
{
int modifiers = evt.getModifiersEx();
int keyCode = evt.getKeyCode();
// Ctrl + <key>
int onmask = KeyEvent.CTRL_DOWN_MASK;
int offmask = KeyEvent.SHIFT_DOWN_MASK | KeyEvent.ALT_DOWN_MASK;
if ((modifiers & (onmask | offmask)) == onmask)
{
switch(keyCode)
... |
a3068979-4e27-4830-a578-5bf530cb42f3 | 2 | private void buildIntersections() {
//initialize
_intersections = new Intersection[_gridDimensions.getRow()][_gridDimensions.getColumn()];
// Add organize by [rows][column]
for (int i=0; i<_gridDimensions.getRow(); i++) {
for (int j=0; j<_gridDimensions.getColumn(); j++) {
//create a ... |
c0e4db9a-fc68-4a8a-a574-9efe14ea824e | 1 | public static Type getType(String name) {
Type type = null;
if(listTypes.containsKey(name)) {
type = listTypes.get(name);
}
return type;
} |
593eb90c-5ba6-4a44-bfe8-526d0516550d | 0 | public static void main(String[] args) {
int i = 200;
long lng = (long)i;
lng = i; // "Widening," so cast not really required
long lng2 = (long)200;
lng2 = 200;
// A "narrowing conversion":
i = (int)lng2; // Cast required
} |
e86cbe6b-40d5-4543-9c5c-4f18f5ff53cb | 4 | public double MacroRecall() {
if (computed == 0) countStuff();
double mrec = 0;
for (int i=0; i<catnum; i++) {
if ((tp[i] != 0) && (tp[i]+fn[i] != 0))
mrec += tp[i]/(tp[i]+fn[i]);
}
re... |
c1d3b0ee-4917-444b-9a29-69eb8e0fd137 | 1 | protected void changedBroadcastEnable(){
for(ModelChangeListener mcl : listeners){
mcl.changedBroadcast(bcast_enabled);
}
} |
bae22313-8ca7-4fa6-b2c4-48db9f3ac07a | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jCheckBoxComptesRendus = new javax.swing.JCheckBox();
jCheckBoxVisiteurs = new javax.swing.JCheckBox();
jCheckBoxPracticiens = new jav... |
d45e28f7-c976-4d97-a07d-77e4a4fcdea9 | 1 | public static UUID nameUUIDFromBytes(byte[] name) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException nsae) {
throw new InternalError("MD5 not supported");
}
byte[] md5Bytes = md.digest(name);
md5Bytes[6] &= 0x0f; /* clear version ... |
408449cd-5a7f-4be1-9fb3-396be4c46fb2 | 8 | private void jTextField5FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField5FocusLost
if(!responsableAntiguo.equals(jTextField5.getText())){
int i = JOptionPane.showConfirmDialog(frame, "Seguro que quieres cambiar el rol responsable: "+responsableAntiguo+
"\npor "+... |
5ff4cc9e-d380-46a1-9445-71528e74e9db | 1 | @Test
public void testRandomArray() throws Exception {
FileWriter FW = getFileWriter();
TestClass[] tests = FW.getArray("arrRand", new TestClass());
assert tests.length == testArray.length;
for(int i = 0; i < tests.length; i++) {
assert tests[i].val == testRandomArray[i];
}
} |
dbb4b5a2-0b94-47d6-adb9-fab1221cdc13 | 2 | private void queueInorder(BSTNode node){
//Fill queue inorder
if(node.getLeft() != null) {
queueInorder(node.getLeft());
}
Term t = (Term)node.getTerm();
queue.add(t);
if(node.getRight() != null){
queueInorder(node.getRight());
}
} |
d61095bf-6950-41ac-96ec-dcff379e838c | 4 | public void play(Sequence sequence, boolean loop) {
if (sequencer != null && sequence != null && sequencer.isOpen()) {
try {
sequencer.setSequence(sequence);
sequencer.start();
this.loop = loop;
}
catch (InvalidMidiDataException... |
12a7966d-6462-474b-ac4b-8f0a436f7196 | 3 | public void login(String password)
{
currentEmployee = timeMan.login(password);
if(currentEmployee == null)
{
JOptionPane.showMessageDialog(null, "Sorry, no password match found. Please try again.");
return;
}
else
{
bLogin.setEnabled(false);
bLogout.setEnabled(true);
tPassword.setEnabled... |
d1fefdc3-55ba-4c2c-a1c0-dba1ffe43394 | 7 | public static void main(String args[]) {
Board b = new Board();
b.loadBoardGraphFromResource("cs283/catan/resources/board.csv");
b.loadBoardTilesFromResource("cs283/catan/resources/tiles.csv");
for (Map.Entry<Coordinate, Node> x : b.nodeSet.entrySet()) {
System.out.println(x.getKey());
... |
079b03d7-f299-4396-b644-78dad99e2065 | 4 | public void loadRoomConfig() throws BadConfigFormatException, FileNotFoundException {
// Creates a FileReader and then wraps it in a scanner to read the file
FileReader roomConfigFile = new FileReader(roomConfigFilename);
Scanner fileScanner = new Scanner(roomConfigFile);
String nextLine;
Character key;
... |
b5155bf3-9260-4fe6-9996-1a154afe0877 | 8 | public void setData(Object data) {
if(data.getClass().isArray()){
if(!Array.get(data, 0).getClass().isArray()){
this.data = vectorToMatrix(data);
}else{
this.data = data;
}
}else{
if(data instanceof Byte){
this.data = new byte[][]{{(Byte)data}};
}
else if(data instanceof Short){
th... |
ef8d35cd-e06f-49a7-9bab-e38a7de21e5f | 3 | public boolean exchangeCashPurse(String serverID, String assetID, String nymID, String oldPurse, ArrayList selectedTokens) throws InterruptedException {
Helpers.setObj(null);
System.out.println(" Cash Purse exchange starts, selectedTokens:" + selectedTokens);
String newPurse = processCashPurse(... |
afb8cd9c-b09d-4e83-9500-a07cade3adb4 | 5 | public String errorMessage() throws Exception {
switch (errorCode) {
case OK:
throw new Exception("TILT: Should not get here.");
case UNEXPECTED_ARGUMENT:
return unexpectedArgumentMessage();
case MISSING_STRING:
return String.fo... |
3a3c56b2-922f-4950-85a7-21f599cab36b | 6 | @Override
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == clearAll)
{
clear();
}
else if(e.getSource() == save)
{
saveFile();
}
else if(e.getSource() == load)
... |
73ca85cc-8149-4abc-b826-e88407760687 | 3 | public HashMap beep() throws Exception
{
ArrayList<Integer> answer = this.device.send(0x13, 1, new char[]{});
if (answer.size() == 0 || answer == null)
throw new Exception("Пустой ответ");
HashMap<String, Integer> result = new HashMap<String, Integer>();
result.put("resu... |
e42c215e-3f4b-4d25-89ad-929389d1beef | 8 | public List<Conversation> getConversationList( int person_id, int page_size, int offset ){
if( !handler_cvs.initialize() || !handler_msg.initialize()
|| !handler_person.initialize() || !handler_group.initialize() ){
System.out.println( "ConversationServer : failed to initialize!" );
return null;
}
L... |
3b178ad2-d414-4672-9780-c0dc80e24e9b | 7 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._avalie_ == oldChild)
{
setAvalie((PExpLogica) newChild);
return;
}
for(ListIterator<PEstrCaso> i = this._... |
244c69e6-efea-45ce-b84f-5e43cd6ea9b6 | 5 | @Override
public void onEnable() {
getConfig().options().copyDefaults(true);
saveConfig();
gm = new GameManager(this);
lh = new LocationHandler(this);
tm = new TeamManager(this);
fm = new FlagManager(this);
sm = new ScoreManager(this);
sm.setupScoreboa... |
5e984b52-2dfd-480e-a28f-29384c16a410 | 7 | @Override public void reflect(State s) {
state = s;
if (s.gameOver()) {
// show end state, overlaid with scores and shit
JFrame f = new JFrame();
int[] players = s.players();
f.setLayout(new GridLayout(0, players.length));
// sigh. gridlayout insists on ltr, ttb child insertion
for (int y = 0; ... |
bae06096-b986-420c-9a3b-6b0d5611d0ce | 4 | public static void main(String[] args) throws Exception {
Collection<DataClip> clips = new LinkedList<DataClip>();
for(int i = 0; i < args.length; i++) {
if(args[i].equals("-b")) {
bufsize = Integer.parseInt(args[++i]);
} else {
DataClip c = new DataClip(new java.io.FileInputStream(args[i]));
clips.ad... |
605db0cd-7b4c-40c4-9e94-025bdf98a31b | 1 | @Test
public void testGetValue() {
Layer l = new Layer();
List<Double> weights = new ArrayList<Double>();
l.insertNeuron(new ConstantOneInputNeuron());
l.insertNeuron(new ConstantOneInputNeuron());
weights.add(1.0);
weights.add(1.0);
try {
FeedForwardNeuron neuron = new FeedForwardNeuron(l, weights);
... |
56d764f7-c552-41ec-9050-ada011beda8f | 5 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... |
d0246808-3f76-48f7-9544-bb2344895726 | 9 | final private void createActiveLayer()
{
// DeferredByteArray3D statemap = fm.getStateMap();
int px_zero = 0, px_inside = 0, px_outside = 0;
int grey_zero = 0, grey_inside = 0;
final DeferredObjectArray3D<StateContainer.States> statemap = init_state.getForSparseField();
for (int x = 0; x... |
bebc5e29-8471-451d-8b1c-273e618ed190 | 6 | public void get_audio( byte[] output_buffer, int frames ) {
int output_idx, mix_idx, mix_end, count, amplitude;
output_idx = 0;
while( frames > 0 ) {
count = tick_length_samples - current_tick_samples;
if( count > frames ) {
count = frames;
}
mix_idx = current_tick_samples << 1;
mix_end = mix_i... |
51afe168-df4a-4224-91ef-5d7afdd2cb6f | 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... |
ee676a54-2bc4-4ce0-b18c-1f8ddf1b0893 | 3 | private void checkSpriteCollisions(ArrayList<ArrayList<Sprite>> spriteLists)
{
for (ArrayList<Sprite> spriteList : spriteLists)
{
int startIndex = spriteList.indexOf(this) + 1;
for (int i = startIndex; i < spriteList.size(); i++)
{
if (intersects(s... |
27a3b6b6-a33b-452f-8b9c-3869fabab893 | 3 | private JPanel createVerticalList( String[] strings, boolean decorate ){
JPanel list = new JPanel();
BoxLayout l = new BoxLayout( list, BoxLayout.Y_AXIS );
list.setLayout( l );
list.setAlignmentX( JPanel.RIGHT_ALIGNMENT );
for( String s : strings ){
// JLabel label = new JLabel( s );
//
// list.add(... |
4cf8add6-5ec4-4513-a246-379a0fe5b6f0 | 6 | public T read(Timestamp currentDateTime) throws IOException {
Deal deal = new Deal();
int type = dataInput.readUnsignedByte();
if ((type & DealFlags.DATE_TIME.getValue()) > 0) {
DataReader.readDateTime(dataInput, baseDateTime);
}
deal.setTime(currentDateTime);
... |
d1b2d708-1924-45f0-9c46-4bf6d9d65a0c | 2 | private static void login(BufferedReader br, ServiceInterface obj,
Scanner cs) throws IOException{
// TODO Auto-generated method stub
String str[] = new String[2];
for (int i = 0; i < 2; i++) {
str[i] = br.readLine();
}
if (obj.login(str[0], str[1])) {
System.out.println("Hello "+str[0]);
showMe... |
15f7c303-f2ab-47b8-8141-9075f2c89f3c | 1 | @Override
public void run(){
byte[] data = new byte[1024];
DatagramPacket packet = new DatagramPacket(data, data.length);
try {
socket.receive(packet);
} catch (IOException e) {
e.printStackTrace();
}
this.parsePacket(packet.getData(), packet.g... |
b8fed476-4bc6-4374-bdce-dfb978373637 | 2 | static String judge(String a,String b){
if(a.equals(b)){
return ACCEPTED;
}
a=a.replaceAll("[ \n\t]+","");
b=b.replaceAll("[ \n\t]+","");
if(a.equals(b)){
return PRESENTATION_ERROR;
}
return WRONG_ANSWER;
} |
bf24b230-15ed-4d23-a90b-9d262412e382 | 1 | @After
public void tearDown() {
try
{
AqWsFactory.close(clientProxy);
}
catch(Exception ex)
{
fail("tearDown failed...");
}
} |
0109e333-e9a6-448e-ba38-b78387ee64f6 | 8 | @Test
public void testConstructNimMatrix_10Sticks() {
int numberOfSticks = 10;
int matrixSize = numberOfSticks + 1;
NimVertex[][] expectedMatrix = new NimVertex[matrixSize][matrixSize];
expectedMatrix[10][9] = new NimVertex(10,9);
expectedMatrix[9][2] = new NimVertex(9,2);
expectedMatrix[8][4] = new Nim... |
6d144b57-c49a-4ad9-a329-d29139096fef | 2 | private static void normalizeVariableContent(String varName) {
String value = Config.get(varName);
if (value != null && value.toLowerCase().endsWith(".zip")){
Config.set(varName, value.replaceFirst("\\.[Zz][Ii][Pp]$", ""));
}
} |
8116b603-fd3d-4df3-b10c-a1871df6a9ab | 1 | public boolean assignSong(Song s) {
String path= s.getPath();
if(this.songMap.get(path) != null)
return false;
this.songMap.put(path, s);
return true;
} |
fb149953-c872-498f-a54f-83efd395bdb0 | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((country == null) ? 0 : country.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
} |
4e5a2b81-f475-41f7-b782-160cc8f17206 | 3 | public User loginUser(User user){
try {
Socket loginSocket = new Socket(SERVER_ADDRESS_LOGIN, LOGIN_PORT);
loginSocket.setSoTimeout(TIMEOUT);
OutputStream outputStream = loginSocket.getOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(
outputStream);
objectOutp... |
fdc385e2-8a01-4884-81fd-91214360ffc4 | 6 | public void setPropertyElementType (Class type, String propertyName, Class elementType) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null.");
if (elementType == null) throw new IllegalArgumentEx... |
c40190f3-ffac-49da-bd13-4b182dd23d55 | 7 | public void convertSolu(){
if (brute == false) {
for (int i = 0; i < this.soluList.size(); i++) {
ArrayList tmp = this.soluList.get(i);
HashMap<Integer, ArrayList<Unit>> solu = new HashMap<Integer, ArrayList<Unit>>();
for (int j = 0; j < tmp.size(); j++) {
ArrayList<Integer> rowY = mtrY.get(tmp.ge... |
585049df-2acc-4933-a464-13a24a00af84 | 5 | public void getSoundsToPlay(int deltaTime){
if(!soundToggled)
return;
int lastTime = currentTime;
currentTime += deltaTime * scale;
//Check each time for sounds that should play this frame
for(int i = 0; i < times.size(); i++){
int time = times.get(i);
//If this index's time is between last... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.