method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f18d91f0-e217-47a4-9b58-3c6a0dbc1a5f | 1 | public int getIndex(boolean b) {
if (b) {
return 0;
}
else {
return this.toDo.size() - 1;
}
} |
56f30717-eebb-491e-ba88-ccefac7df9e0 | 1 | public void loadLower30DegreeSlopeRight(Rectangle2D e) {
for(int x = 0; x < e.getHeight() / 4; x++) {
platforms.add(new Platform(new Rectangle2D.Double(e.getX() + ((e.getWidth() / (TileSet.tileWidth / 4)) * x),
e.getMaxY() - (((e.getHeight() / 4) / (TileSet.tileHeight / 8)) * x), (e.getWidth() / (TileSet.til... |
6a1f3334-9ad0-4ef3-a8e6-3a9bdca06f18 | 8 | protected Object evaluateElement(Object current, Object next)
throws UDFArgumentException {
if (next==null)
return current;
if (current == null)
return next;
boolean greaterThan = false;
switch (elementOI.getPrimitiveCategory()) {
case INT: greaterThan = (((IntObjectInspecto... |
0711c08b-c8c8-47f9-b828-4f8273ba1781 | 4 | private static void showRS(ResultSet rs, int num)
{
try
{
while ( rs.next() )
{
//System.out.printl( "%s, %s, %s %n", rs.getString(1));
for(int i = 1; i<=num; ++i)
{
System.out.print(rs.getString(i) + " ");
}
System.out.println("");
}
}
catch (SQLException e)
{
System... |
aa31b331-9e31-4059-a61c-a16e686ba891 | 5 | protected int readBlock() {
blockSize = read();
int n = 0;
if (blockSize > 0) {
try {
int count = 0;
while (n < blockSize) {
count = in.read(block, n, blockSize - n);
if (count == -1)
break;
n += count;
... |
2a941e2c-4ae7-49b8-83e1-0cebafecad55 | 0 | @Override
@RequestMapping(value = "/beers/{id}", method = RequestMethod.POST)
@ResponseBody
@Transactional
public BeerResponse update(@PathVariable("id") Long id, @RequestBody BeerRequest beerRequest) {
Beer beer = persistenceService.read(Beer.class, id);
beer.setName(beerRequest.getName())... |
3c6a0105-bf44-4e05-9bf5-4af9e4c6e985 | 8 | public String longestPalindrome(String s) {
if (s == null || s.length() == 0) {
return s;
}
mapping = new boolean[s.length()][s.length()];
int maxI = 0;
int maxJ = 0;
for (int k = 0; k < s.length(); k++) {
for (int i = 0; i < s.length() - k; i++) ... |
6e738374-f387-48f1-ac37-cb39ba9a347d | 5 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
9d3d8dc7-413a-4262-9654-5937ec6bdd8c | 7 | public boolean equals(Object y) {
if (y == this) return true;
if (y == null) return false;
if (y.getClass() != this.getClass()) return false;
SET<Key> that = (SET<Key>) y;
if (this.size() != that.size()) return false;
try {
for (Key k : this)
i... |
a5ee2a29-8958-4f96-b4ff-dfdd1b9ee972 | 6 | public static void method335(int i, int j, int k, int l, int i1, int k1)
{
if(k1 < topX)
{
k -= topX - k1;
k1 = topX;
}
if(j < topY)
{
l -= topY - j;
j = topY;
}
if(k1 + k > bottomX)
k = bottomX - k1;
if(j + l > bottomY)
l = bottomY - j;
int l1 = 256 - i1;
int i2 = (i >> 16 & 0xff... |
fa0299d5-7139-4523-b93e-7569ed2c829a | 1 | public void actionPerformed(ActionEvent e) {
boolean editor = false;
Automaton inside = null;
State block = null;
if (environment.getActive() instanceof EditBlockPane) {
editor = true;
EditBlockPane blockEditor = (EditBlockPane) environment.getActive();
inside = blockEditor.getAutomaton();
block = b... |
e8953f69-0d9e-46ba-bf80-962ef79b50f1 | 4 | @Override
public User checkUserName(String userName) {
User myUser = null;
try {
InputStream resourceAsStream = this.applicationContext.getResource(dataSourceFile).getInputStream();
InputStreamReader in = new InputStreamReader(resourceAsStream);
BufferedReader buffer = new BufferedReader(in);
String li... |
8717785e-2b5b-444f-aba1-6c4f940baf36 | 6 | public static double crank(List<Double> w)
{
double s;
int j=1,ji,jt;
double t,rank;
int n=w.size();
s=0.0f;
while (j < n)
{
if ( ! w.get(j).equals(w.get(j-1)))
{
w.set(j-1,j + 0.0);
++j;
}
else
{
for (jt=j+1;jt<=n && w.get(jt-1).equals(w.get(j-1));jt++);
rank=0.5f*(... |
a8d528da-c0e3-4759-b143-2ffb2e9b8e80 | 5 | @FXML
private void relaxationResultClick(MouseEvent me) {
int curMethod = 3;
if (me.getButton().equals(MouseButton.PRIMARY)) {
if (coef == null || free == null || results[curMethod] == null) {
return;
}
if (curMode[curMethod]) {
curMode[curMethod] = false;
relaxationResult.setText(VECTOR + res... |
a491a7fe-8864-4f91-b957-b930e96932d6 | 1 | @SuppressWarnings("nls")
private static void pad(StringBuilder buffer, int depth) {
for (int i = 0; i < depth; i++) {
buffer.append("...");
}
} |
1c0fc683-c934-48a1-8ed9-9ef58103452d | 2 | public static void handleTopic(String topic) {
if (getActiveTab() instanceof ChannelTab == false) {
appendError("Téma lze změnit pouze ve vybraném kanále.");
return;
}
if (topic == null)
return;
String channel = getActiveTab().getTabName();
g... |
7e7620db-9492-4cec-995a-c57fb1203abf | 4 | public ArrayList<Point> getValidTiles(int exitX, int exitY, char[][] floodedLayout)
{
//stores valid player spawns
ArrayList<Point> validTiles = new ArrayList<>();
//go through char array
for(int y = 0; y < houseLength; y++)
{
for(int x = 0; x < houseLength; x++)
{
//if a tile is reachable, and i... |
97aa0580-21b0-4f48-b5ad-846beb1b0b11 | 7 | private boolean maybeServeRange(HttpRequest request, ByteBuffer contents, HttpResponse response) {
String range = request.header("Range");
if (null == range) {
return false;
}
Matcher matcher = SINGLE_BYTE_RANGE.matcher(range);
if (!matcher.matches()) {
r... |
6ace693c-f0b8-438e-91d5-ed22749d59e0 | 9 | public void escolheRelatorio(){
if (jRadioButtonExcessiva.isSelected()) {
if (validarDataRelTransfExcedido()) {
imprimeRelatorioTransferenciaExcessiva();
this.setVisible(false);
}
} else if (jRadioButtonProducao.isSelected()) {
... |
83c07043-1fab-46fd-9a2e-ca3a2db6dfb9 | 1 | public void sqlUpdate(String sql) {
try {
Statement stat = (Statement) conn.createStatement();
stat.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
7d795277-d198-47f3-8697-e60b176507dd | 8 | public Set<Country> deserialize(File csvFile) {
BufferedReader br = null;
String line;
Set<Country> countries = new HashSet<Country>();
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(csvFile), System.getProperty("file.encoding")));
while((line = br.readLine()) != null) {
in... |
965f30f1-cb44-45d9-a106-6e9fba602e94 | 8 | public String replaceObfuscation() {
String replaceObfuscatedCode = null;
/*
* 難読化に使用する文字の個数を乱数で決める。
* 個数は必ず4以上とする。
*/
int keyCharacterNumber = keyCharacterList.size();
int quantyKeyCharacter = 0;
Random random = new Random();
while (true) {
quantyKeyCharacter = random.nextInt(keyCharacterNumbe... |
b58b0dc3-0129-4639-b223-9b39b60e6304 | 3 | private String getDecenas(String num) {// 99
int n = Integer.parseInt(num);
if (n < 10) {//para casos como -> 01 - 09
return getUnidades(num);
} else if (n > 19) {//para 20...99
String u = getUnidades(num);
if (u.equals("")) { //para 20... |
f77f0eb6-6c94-4994-b943-4f4ae9fd4830 | 3 | public void onReceiveBid(MessageBid bid){
if (bid.getRound() == super.currentRound()) {
if (bestBid == null) {
bestBid = bid;
synchronized (syncIncr) {
shouldIncrease = true;
}
} else {
if (bestBid.getRound() < bid.getRound()) {
bestBid = bid;
synchronized (syncIncr) {
shoul... |
fba84cd1-676d-4b9c-aa17-582319db24fb | 5 | private AttributeStatistics generateStringStat(double coverage, String... values) {
Multiset<String> counts = HashMultiset.create();
int totalCount = values.length;
Collections.addAll(counts, values);
int max = -1, min = totalCount + 1;
List<String> maxCont = new ArrayList<>(), minCont = new ArrayList<>();
... |
e1a2f393-c15c-4560-84c9-5deccf2f6ea8 | 1 | public void testIsBefore_YMD() {
YearMonthDay test1 = new YearMonthDay(2005, 6, 2);
YearMonthDay test1a = new YearMonthDay(2005, 6, 2);
assertEquals(false, test1.isBefore(test1a));
assertEquals(false, test1a.isBefore(test1));
assertEquals(false, test1.isBefore(test1));
as... |
2fa00ae7-56e8-454e-8c7c-e91b11c357d4 | 9 | @Override
public void mousePressed(MouseEvent mouse) {
if(mouse.getButton() == MouseEvent.BUTTON1){
if(mouse.getX() >= startButton.x && mouse.getX() <= startButton.x + startButton.width){
if(mouse.getY() >= startButton.y && mouse.getY() <= startButton.y + startButton.height){
st.currentLevel = 1;
st... |
41c0dc1c-a050-41c8-beef-06c0a12e99da | 3 | public static void resolvedor(Estado testarestado){
if(testarestado.getBlankcells().isEmpty()){
JOptionPane.showMessageDialog(null, "Resolvido");
interfacee.preencher(testarestado.getMatriz());
return;
}
else {
for(int t = 1; t<=9; t++){
... |
37c95d98-fc9b-406f-81e5-4b3fce0a8361 | 0 | public String getAddress() {
return address;
} |
957b7d8d-56ff-4e96-81c0-e98dfc71d1b4 | 6 | public void run() {
try {
Thread.sleep((int) (fadeTimeOffset*1000.0f));
isFading = true;
if(fadeEndGain < fadeStartGain) {
gameSong.startFadeOut();
}
int maxLoops = (int)(fadeTime*(1000.0f/(float)RATE));
for(int i = 0; i < m... |
f3f561c9-51b1-4ea8-bde3-423a22367070 | 1 | public CSVColumn getSimulated() {
if (sim == null) {
throw new IllegalArgumentException("Missing 'sim' argument");
}
return sim;
} |
dc39c9e8-3b73-4b64-81c9-4477b20c2512 | 0 | public void setNewText(String newText) {
this.newText = newText;
} |
caf77e10-64c8-4104-bad7-ec02fec852f2 | 1 | private static void disableCertificateValidation() {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
... |
873e5803-1060-41c7-a8c1-7b50934737be | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
PuzzlePair<Piece, Move> other = (PuzzlePair<Piece, Move>) obj;
if (move == null) {
if (other.move != null)
... |
10c22645-dd99-4f37-881e-acb9d9096da0 | 4 | @Override
public Element next() throws ParsingException
{
canStepDown = false;
if(!stepForward())
{
currentElement = null;
return null;
}
try
{
lastEvent = eventReader.nextEvent();
}
catch (XMLStreamException e)
{
throw new ParsingException(e);
}
if(lastEvent.isStartElement(... |
38ac0a07-8c3c-4910-bb34-fb6d18e429fa | 0 | public SearchTask(BlockingQueue<File> queue, String keyword)
{
this.queue = queue;
this.keyword = keyword;
} |
2d8ad648-eb99-4ca5-9794-fdb366b48cb9 | 5 | @Override
public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game)
{
ArrayList<Integer> subtypes = game.getSubTypes(itype);
for (Integer i: subtypes) {
Iterator<VGDLSprite> spriteIt = game.getSpriteGroup(i);
if (spriteIt != null) while (spriteIt.hasNext()) ... |
f1607312-4c84-4901-8452-b699da021a81 | 2 | private static int pairs(int []a,int k){
int result=0;
Map<Integer, Integer> map = initMap(a);
for(int value:a){
int target = value + k;
if (map.containsKey(target)){
result +=map.get(target);
}
}
return result;
} |
c5c896c0-742a-4f2a-a3c7-e8cfab3c6617 | 0 | public static String getNomeUser() {
return nomeUser;
} |
36287c33-ba80-4d80-9e2d-247c23bec6fb | 6 | public void renderFilter()
{
image = loader.getImage();
raster = image.getRaster();
int[] pixels = new int[image.getWidth() * image.getHeight() * 3];
raster.getPixels(0, 0, image.getWidth(), image.getHeight(), pixels);
for(int i = 0; i < pixels.length; i += 3)
{
r = pixels[i];
g = pixels[i+1];
... |
1f2b80dc-cf62-46a5-bdd9-f8d6e4919148 | 2 | public void mostrarPorMes(String mes)
{
DefaultTableModel modelo = crearCabecerasTabla();
for (clsPersona p : lstPersonas) {
if (p.getMes().equals(mes)) {
crearFila(p,modelo);
}
}
tablaRegistrar.setModel(modelo);
} |
415a0795-613d-4324-9a5a-1c383336a22f | 0 | @Override
public void setNationality(String nationality) {
super.setNationality(nationality);
} |
1df6e7a0-500e-485d-b53a-e79ea0ef269e | 1 | private void searchPropietarioTextKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchPropietarioTextKeyTyped
cList = taller.searchClientes(searchPropietarioText.getText());
clientsModel.clear();
for(int i=0; i<cList.size(); ++i){
clientsModel.addElement(cList.get(i).getNo... |
29cf8a03-512e-4e21-856f-776854168775 | 4 | @Override
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
} else {
String path = file.getAbsolutePath().toLowerCase();
for (String extension : extensions) {
if ((path.endsWith(extension) && (path.charAt(path.length()
- extension.length() - 1)) == '.')) {
r... |
32e45673-5391-4c80-ba35-1ee960191e90 | 7 | private ShapelessRecipe makeRecipe(String s) {
/*
recipe: 106,106,106
result: 341
amount: 1
displayname: false
lore: ""
*/
String[] ingredients = plugin.getRecipesConfig().getString("shapeless." + s + ".recipe").split(",");
String[] result_id... |
12aa1f5b-7e7b-49e5-9cf5-44f8fd34fd94 | 0 | public void setStudentId(int studentId) {
this.studentId = studentId;
} |
99e8b70b-7ad6-4d9c-b7f8-9e33185b3236 | 8 | public boolean hasCollided(int xa, int ya) {
int xMin = -6;
int xMax = 20;
int yMin = 10;
int yMax = 18;
for (int x = xMin; x < xMax; x++) {
if (isSolidTile(xa, ya, x, yMin)) {
return true;
}
}
for (int x = xMin; x < xMax; x... |
83d2a0e4-2df1-4a36-9a79-efc911bb1340 | 0 | final public Property getNodeProperty() {
return property;
} |
9e61e626-5953-4f80-97b4-96a8a086779a | 1 | private void CheckText(String text) {
if (null == text )
throw new IllegalArgumentException("Enter some text to analyze.");
} |
9450e80b-db6d-4a45-af1c-31dbea8a2a34 | 3 | public int nod(Model model){
int res = 0;
for(Generalization g : model.getGeneralization()){
if(g.getIdentifier().equals(this.identifier)){
System.out.println("blub");
for(String c : g.getArrayIdent()){
res += findNombreSousClasse(model, c);
}
}
}
//System.out.println("la classe : " + thi... |
eee17e71-8026-4e96-bec7-ba4f9f46a90e | 7 | public void changeround(String[] split, String command)
{
if (split.length != 3)
{
PrintMessage("Syntax:!round [game] [east|south|west|north|#]");
return;
}
TournyGame m = (TournyGame) games.get(split[1]);
if (m == null)
{
PrintMessage(split[1] + " is not an existing game");
return;
}
if (s... |
026839fe-dd1e-4721-86a3-241d658df53c | 1 | private Collection<TrendBar> returnCollection(Collection<TrendBar> trendBars) {
if (trendBars.isEmpty()) {
return Collections.emptyList();
}
return trendBars;
} |
18fe7359-2031-48d7-b5ca-06fdb5f83562 | 9 | public int insertarParametro(String codigo, String descripcion, String valor,String estado) {
if(codigo.trim().length()==3){
if(descripcion.trim().length()>0 && descripcion.trim().length()<=50
&& valor.trim().length()>0 && valor.trim().length()<=70
&& estado.trim().lengt... |
bb447d3c-c057-4315-9ed0-17a2de191071 | 5 | @Override
public int altaTurno(Turno turno)
{
turno.setIdTurno(-1);
EntityManager em = null;
EntityManagerFactory ef = null;
try
{
ef = Persistence.createEntityManagerFactory("MerkaSoftPU");
em = ef.createEntityManager();
... |
a2d20aef-5125-4f14-921e-a21b6d047b86 | 8 | @Override
public Mower move(RectangularLawn lawn) {
L.debug("move from " + this);
switch (orientation) {
case E:
if (x < lawn.getWidth() - 1)
x++;
break;
case W:
if (x > 0)
x--;
break;
case N:
... |
711921e0-4936-46bc-965e-c58b5ecd8a4f | 3 | @Override
public boolean equals(Object other) {
if(other == null || other.getClass() != getClass())
return false;
return this.id ==((ActorId)other).id && this.playerId ==((ActorId)other).playerId;
} |
519f26e0-1a19-437b-b3b8-e0c0f6a32ed1 | 6 | public long readFromConnection(ManagedConnection mc,BitMap b){
List<Response> rlist = mc.getPeerResponseBlocks();
long bytes = 0;
if(rlist!=null){
for(Response r : rlist){
bytes+=r.block.length;
if(disseminatedPiecesToCompete.containsKey(r.index)){
// System.out.println("working towards complete!")... |
75b95fed-d1ac-4abd-93d3-178ab71300f5 | 7 | public JdkCompileTask(JdkCompilerClassLoader classLoader, Iterable<String> options) {
compiler = ToolProvider.getSystemJavaCompiler();
if (compiler == null) {
throw new IllegalStateException("Cannot find the system Java compiler. " + "Check that your class path includes tools.jar");
}
this.classLoader = cl... |
8f78c65b-a991-4d3c-b49d-eddc9d921367 | 6 | private static HashMap<Integer,Node> loadNode(ArrayList<String> texts,ArrayList<Branch> branches)
{
ArrayList<String> strings = new ArrayList<String>();
int startLine = 0;
for(int lineNumber = 0;;lineNumber++){
String aString = texts.get(lineNumber);
if(aString.equals("nodes:")){
startLine = lineNumber... |
23181077-0f04-42c6-bcbf-5d7dbe66fc21 | 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... |
59865edb-8c34-4453-8ed1-7ff5d6d35ac0 | 9 | protected void initSpecialParameters() throws MaltChainedException {
if (getConfiguration().getOptionValue("singlemalt", "null_value") != null && getConfiguration().getOptionValue("singlemalt", "null_value").toString().equalsIgnoreCase("none")) {
excludeNullValues = true;
} else {
excludeNullValues = false;
... |
4702a0d6-cc27-407e-bf93-30804150096a | 6 | private int calculate(String first, String second, String operator) {
assert (!isNullOrEmpty(first) && !isNullOrEmpty(second) && !isNullOrEmpty(operator)) : "Please check input!";
int a = Integer.parseInt(first);
int b = Integer.parseInt(second);
int result = 0;
switch (operator){
case "+":
result = a + ... |
dea1a72e-b20c-4091-a93d-c2446408f1d4 | 7 | public static final String getRegex(Object par1) {
if (par1 instanceof Map<?, ?>) {
return "\\{([key=>.*?&val=>.*?],?)*\\}";
} else if (par1 instanceof String[]) {
return "\\{(.*?\\,?)*\\}";
} else if (par1 instanceof Integer[]) {
return "\\{(\\d\\,?)*\\}";
} else if (par1 instanceof List<?>) {
r... |
712a33d4-3f94-4bc3-9062-c5cc45b7f3bb | 9 | public void cmdBid(CommandSender sender, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if(args.length != 4) {
sender.sendMessage(Conf.colorMain + "Usage:");
sender.sendMessage(Conf.colorAccent + "/ee bid <quantity> <material name> <price>");
... |
4648bda2-ef54-42a5-b644-03e20db55182 | 9 | private void _list(Class<?> clazz, MethodVisitor mw, FieldInfo property, Context context,
int fieldInfoIndexParm) {
Type propertyType = property.getFieldType();
Type elementType;
if (propertyType instanceof Class) {
elementType = Object.class;
} else {
elem... |
2943b21c-ca23-44e2-986e-c4c8dc43db82 | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if((ticking instanceof MOB)&&(tickID==Tickable.TICKID_MOB))
{
final MOB mob=(MOB)ticking;
if(hpToKeep<=0)
{
hpToKeep=mob.curState().getHitPoints();
mob.recoverMaxState();
}
else
... |
6ea79bc6-1fc5-475b-b360-d5246b91b77d | 9 | public void renderBottomFace(Block par1Block, double par2, double par4, double par6, int par8)
{
Tessellator var9 = Tessellator.instance;
if (this.overrideBlockTexture >= 0)
{
par8 = this.overrideBlockTexture;
}
int var10 = (par8 & 15) << 4;
int var11 = ... |
763dc2da-86bf-47c8-953b-4acb19f6f6c7 | 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... |
40f4308d-d506-4e99-9171-dedf30f87de0 | 6 | public Integer recompressChunkData(byte[] buffer, boolean overwriteInput, long[] hashes, PassthroughConnection ptc) {
if(buffer.length < 163840) {
return null;
}
int inputOffset = inputDataBufferSize + outputDataBufferSize;
int inputSize = 81920;
int outputOffset = overwriteInput?0:inputDataBufferSize;
... |
caff0433-35c6-4e55-91b3-2393c14f7745 | 2 | public void print(int n)
{
if (n > 0)
{
for (int i = 0;i < n; i++)
System.out.print(" ");
}
System.out.println("\"" + strVal + "\" ");
} |
491d124c-f0f0-447e-8db9-884f24f72769 | 8 | public static int crypto_stream_xor(byte[] c, byte[] m, int mlen, byte[] n, int noffset, byte[] k)
{
byte[] inv = new byte[16];
byte[] block = new byte[64];
int coffset = 0;
int moffset = 0;
if (mlen == 0)
return 0;
for (int i = 0; i < 8; ++i)
inv[i] = n[noffset + i];
for (int i = 8; i < ... |
3fa533a1-78fe-4211-96cf-869dfd1bfc35 | 3 | public String toString(int itemsPerLine) {
StringBuilder deckString = new StringBuilder();
int itemsPrinted = 1;
for (Card c : DeckCards) {
deckString.append(c.toString());
if (DeckCards.indexOf(c) < (DeckCards.size() - 1) ) {
deckString.append(", ");
... |
ca61156f-e6bd-4a07-8b29-fd3104b5ee76 | 3 | public RGB closest(RGB... candidates) {
if (candidates.length == 0)
return this;
// 255 * sqrt 3 ≅ 441
double closestDistance = 445;
RGB closest = null;
for (RGB color : candidates) {
double dist = this.distance(color);
if (dist < closestDista... |
a798a29f-1aea-4c31-b7a7-8e19e3e22549 | 2 | @Override
public void caseAProgram(AProgram node)
{
inAProgram(node);
{
List<PClassdecl> copy = new ArrayList<PClassdecl>(node.getClassdecl());
Collections.reverse(copy);
for(PClassdecl e : copy)
{
e.apply(this);
}
... |
17164f53-7f2f-429a-9af0-71e7978d8bd8 | 1 | protected void externalMoveDrop(Transferable transferable) {
if (transferable.isDataFlavorSupported(TreeRowSelection.DATA_FLAVOR)) {
deleteSelection();
}
} |
de30667b-7c5a-42a6-8b9f-eac4fed58436 | 5 | public Map<String, Set<Flight>> readCsvAddData(String csvFile)
throws NewCustomException {
BufferedReader reader;
Map<String, Set<Flight>> flightData = new HashMap<String, Set<Flight>>();
csvFile = Constants.CSV_FILES_URL + "/" + csvFile;
try {
reader = new BufferedReader(new FileReader(csvFile));
Str... |
e7b1d415-dc10-4b7d-9a20-f2ee24462b21 | 6 | public int compareTo(Version arg)
{
final int minNums = Math.min(nums.length,
arg.getVersionNumbers().length);
int diff = 0;
for (int i = 0; i < minNums; i++)
{
if (nums[i] > arg.getVersionNumbers()[i])
{
diff++;
... |
1e94157a-c314-44ce-9ca3-f22a349c6c9f | 4 | private void btnSelecionaBancoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelecionaBancoActionPerformed
JFileChooser flc = new JFileChooser();
flc.setMultiSelectionEnabled(false);
flc.setFileFilter(new FileNameExtensionFilter("Banco de Dados \".GDB\" ou \".FDB\"", new S... |
b00de06f-9062-434b-8bf2-4825c7313184 | 7 | public static byte[] getBCDcode(long data) {
int seq = 0;
byte[] tmp = new byte[20];
while ((data >= 1L) && (seq < 20)) {
byte t = (byte) (int) (data % 10L);
tmp[(seq++)] = t;
data /= 10L;
}
byte[] tmp2 = new byte[seq];
System.arraycopy(tmp, 0, tmp2, 0, seq);
int length2 = seq / 2 + 1;
byte[... |
b58c3e80-4f8f-442c-9fa8-ed79e3cb8fb9 | 5 | public static String secondsToTime(int seconds) {
if(seconds == 0) {
return "0 sekund";
}
int minutes = seconds / 60;
seconds %= 60;
int hours = minutes / 60;
minutes %= 60;
int days = hours / 24;
hours %= 24;
StringBuilder sb = new Str... |
53a560d1-933a-473e-a054-3d8c1ea08f16 | 7 | protected void fitLogistic(Instances insts, int cl1, int cl2,
int numFolds, Random random)
throws Exception {
// Create header of instances object
FastVector atts = new FastVector(2);
atts.addElement(new Attribute("pred"));
FastVector attVals = new FastVector(2);
attVals.ad... |
07555a2d-4a36-43fd-ac51-84bc376e1c6e | 7 | public int readB(int bits){
int ret;
int m=32-bits;
bits+=endbit;
if(endbyte+4>=storage){
/* not the main path */
ret=-1;
if(endbyte*8+bits>storage*8){
ptr+=bits/8;
endbyte+=bits/8;
endbit=bits&7;
return (ret);
}
}
ret=(buffer[ptr]&0xff)... |
50b6a3a5-a977-4e97-a8d4-3c83fc21d8d0 | 8 | public boolean restartLevel()
{
GameState state = StateUtil.checkCurrentState(proxy);
if(state == GameState.WON || state == GameState.LOST)
{
proxy.send( new ProxyClickMessage(420,380));//Click the left most button at the end page
System.out.println(" restart the level ");
try {
Thread.sleep(2000);
... |
95f17282-a839-4372-9fd4-200ae862c25c | 8 | void move() {
if (currentDirection == Direction.RIGHT) {
if (checkIndex(i, j + 1)) {
j++;
arr[i][j] = currentIndex;
currentIndex++;
} else {
turn();
}
} else if (currentDirection == Direction.DOWN) {
... |
2710bd3e-c81b-459c-bd73-a461be9c8e22 | 1 | private void update() {
if (abklingzeit > 0) {
--abklingzeit;
}
geschoss.update();
} |
365c3064-5b0a-4889-96d9-21c3b51b572f | 9 | private void createComponentImage() {
if (start != null && end == null) {
componentImage = start.getSnapshot();
} else if (start == null && end != null) {
componentImage = end.getSnapshot();
} else if (start.getWidth() != end.getWidth() ||
start.getHeight... |
de345647-6fdb-463a-8759-c96bc9518126 | 3 | public double[] getOutput(double[] inputs, boolean squash) {
lastOutput = new double[weights[0].length];
for (int neuron = 0; neuron < lastOutput.length; neuron++) {
lastOutput[neuron] = 0;
for (int input = 0; input < inputs.length; input++) {
... |
d5b911f2-f06f-4534-9f7d-900683f561df | 3 | public static Selector open () throws IOException
{
PollSelector polls = POLL_SELECTOR.get();
if (polls == null) {
synchronized (POLL_SELECTOR) {
polls = POLL_SELECTOR.get();
try {
if (polls == null) {
... |
2f85b242-ae7b-433e-ab57-b602d0fc2fbf | 3 | @Override
public int compareTo(DockTab other) {
int result = NumericComparator.caselessCompareStrings(mDockable.getTitle(), other.mDockable.getTitle());
if (result == 0) {
int h1 = hashCode();
int h2 = other.hashCode();
if (h1 < h2) {
result = -1;
} else if (h1 > h2) {
result = 1;
}
}
re... |
e03a4982-95c7-40d7-8e36-401139c32d70 | 3 | public void cancelPedido() {
for (int row = tmprod.getRowCount() - 1; row >= 0; row--) {
tmprod.removeRow(row);
}
jLblPrecio.setText(null);
for (int row = tmcli.getRowCount() - 1; row >= 0; row--) {
tmcli.removeRow(row);
}
cargarProductos();
... |
04b0bafa-384b-45a6-bc4d-e388f0e03c5f | 0 | public Blog() {
} |
f05f58c8-9b29-44a4-b6e2-389262228a1d | 0 | public void setSysDate(int year, int month) {
gregorianCalendar.set(year, month, 1);
} |
7f5216e2-cd2a-40a0-b813-bda520e80311 | 3 | public void visitTypeVariable(final String name) {
if (type != TYPE_SIGNATURE || state != EMPTY) {
throw new IllegalStateException();
}
CheckMethodAdapter.checkIdentifier(name, "type variable");
state = SIMPLE_TYPE;
if (sv != null) {
sv.visitTypeVariable(n... |
0a39cd40-ec43-4085-a446-bbc8054d59cd | 6 | private boolean showTopLevelMenu()
{
stream.println("1. Show all books.");
stream.println("2. Show all Cds.");
stream.println("3. Show all magazines.");
stream.println("4. Show loans.");
stream.println("5. Search");
stream.println("6. Exit.");
stream.println("... |
fb9a3c62-e1ca-484c-8b38-7f4b25f842ee | 4 | public static void findNumbersWithSum(int[] array,int sum){
if(array.length < 0){
return ;
}
int begin = 0;
int end = array.length - 1;
int curSum = 0;
while(begin < end){
curSum = array[begin] + array[end];
if(curSum == sum){
System.out.println(array[begin] + " " + array[end]);
break;
}... |
a405ef25-84f3-4bc6-bfd2-4f0d25ebaf4c | 2 | public void go_recno( long new_recno )
{
recno = new_recno;
if(Idx!=null) Idx.recno = recno;
else if(cdx_file) Cdx.recno = recno;
geteof(); getbof();
getfieldsValues();
} |
02a1ade8-1d6f-49ef-af85-05617005b0c0 | 4 | private void btnRemoveKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btnRemoveKeyPressed
if (evt.getKeyChar() == evt.VK_ENTER) {
btnRemove.doClick();
} else if (evt.getKeyCode() == 38) {
jButton1.grabFocus();
} else if (evt.getKeyCode() == 37) {
jList1.grabFocus();
} ... |
61261bf5-52c1-41ce-ac7f-e53154748e77 | 7 | public static String times(String sFactor, int iFactor)
{
String s = "";
int y = iFactor;
if(sFactor.equals("") || iFactor == 0)
return s;
else
if(iFactor < 0)
{
StringBuilder sb = new StringBuilder(sFactor).reverse();
String q = sb.toString();
while(true)
{
s += q;
... |
f0653d9f-6993-47ba-bb22-4bc57b354040 | 0 | public CtrlMenu(VueMenu vue, VueAbstrait vueA) {
super(vueA);
this.vue = vue;
// Gérer la persistance
em = EntityManagerFactorySingleton.getInstance().createEntityManager();
em.getTransaction().begin();
} |
5aa65518-ef35-491e-8fa9-1d7c1c59eb91 | 5 | public Vector collide(PhysicsObject a){
Vector aPosition = a.getPosition();
Vector aOldPosition = a.getOldPosition();
Vector aSize = a.getSize();
//System.out.println(aPosition);
//if( this.y >= doA.oy + doA.height && (doA.y + doA.height >= this.y) && (doA.x < this.x + this.width && doA.x + doA.width > this.x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.