method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dd9bdfdb-c1ac-4550-85c3-089c6f992ed2 | 1 | public static int[][] getPath(char[][] map)
{
SearcherAgent agent = new SearcherAgent(BoardGenerator.getInstance().generateFromCharArray(map));
agent.setHeuristic(new ThirdHeuristic());
agent.setTieBreaker(new MayorHTieBreaker());
List<AState> result = agent.search();
int[][] road = new int[result.size()]... |
7ed70245-477e-4e89-a6c9-34273cad2432 | 1 | public void run() throws IOException {
fillYCbCr();
int hideLay1[] = hideLay(getLay(0));
int hideLay2[] = hideLay(getLay(1));
int hideLay3[] = hideLay(getLay(2));
hideLay1 = runWavelet(hideLay1);
hideLay2 = runWavelet(hideLay2);
hideLay3 = runWavelet(hideLay3);
... |
4fb76654-7c1f-4dbd-9afb-b30b3c3c17b9 | 8 | public void action(GraphData graphData) {
GraphModel g1 = graphData.getGraph();
GraphModel g2 = new GraphModel(false);
g2.setIsEdgesCurved(true);
for(Vertex v : g1.getVertexArray()) {
Vertex tmp = new Vertex();
tmp.setLocation(v.getLocation());
g2.ad... |
36548cca-6add-4e21-9cae-7b2e7b43a0c6 | 9 | void setPoints() {
super.setPoints();
if (dn > 150 && this == sim.dragElm)
setSize(2);
int hs = gheight;
int i;
ww = gwidth2; // was 24
if (ww > dn/2)
ww = (int) (dn/2);
if (isInverting() && ww+8 > dn/2)
ww = (int) (dn/2-8);
calcLeads(ww*2);
inPosts = new Point[inputCo... |
e7197b88-a35d-41fe-ad4b-c540b9a6627c | 3 | private void doSubLWorkerStarted(SubLWorkerEvent event) {
InferenceStatus oldStatus = status;
status = InferenceStatus.STARTED;
Object[] curListeners = getInferenceListeners();
List<Exception> errors = new ArrayList<Exception>();
for (int i = curListeners.length - 1; i >= 0; i -= 1) {
try {
... |
ba53840d-c353-4311-8f49-1f803b45bf28 | 3 | public void setType(int color) {
setIcon(null);
setText("");
switch (color) {
case 0:
setIcon(new IconBlack());
break;
case 1:
setIcon(new IconWhite());
break;
case 2:
setIcon(new ... |
b372706f-2ca6-4617-a153-610f8fd0c752 | 8 | public void update(){
if(JudokaComponent.input.up) selectedItem --;
if(JudokaComponent.input.down) selectedItem ++;
if(selectedItem > items.length - 1) selectedItem = items.length - 1;
if(selectedItem < 1) selectedItem = 1;
if(JudokaComponent.input.enter){
if(selectedItem == 0) JudokaComponent.changeMenu(J... |
00cebc00-ca1c-493b-bbff-1e0dcf33182f | 9 | public void onMessage(MessageEvent event)
{
Channel channel = event.getChannel();
//display channel messages to bot
System.out.println(event.getUser().getNick() + ": " + event.getMessage());
//trollin`
if(event.getMessage().toLowerCase().contains("its getting bigger") ||... |
4a650b0f-703f-493d-8570-f0862fa6a304 | 3 | private void initializeReplicationAwareMappings() throws IOException {
Properties props = new Properties();
slaveAddresses = new HashSet<String>();
props.load(new FileInputStream(filePath));
this.masterAddress = props.getProperty(BookStoreConstants.KEY_MASTER);
if (!this.masterAddress.toLowerCase().startsWi... |
b460022e-f0c9-4dc1-b959-28aead02d028 | 0 | public void setTitle(String title) {
this.title = title;
} |
d488817e-1188-49be-9066-c4e44ea55395 | 4 | public static Font getFont(Font initial)
{
if (initial == null)
initial = new Font("Arial",Font.PLAIN,12);
map = new Hashtable<TextAttribute,Object>();
map.put(TextAttribute.FAMILY, initial.getFamily());
map.put(TextAttribute.SIZE, initial.getSize());
if (initial.isBold())
map.put(TextAttribute.WEIGH... |
94aa4c8f-67b7-4b93-87b2-4e889591816f | 8 | private void GenerateFileList()
{
//ClientFolderPath = Utils.getWorkingDirectory() + File.separator + GlobalVar.itemsServers[GlobalVar.CurrentServer] + File.separator;
ClientFolderPath = Utils.getWorkingDirectory() + File.separator + GlobalVar.itemsServers[GlobalVar.CurrentServer] + File.separator + ".minecraft... |
02adbf45-6231-4d15-996c-07c232b18104 | 8 | private void drawText(String[] lines, Graphics g) {
if (g == null || lines == null) {
return;
}
for (int i = 0; i < lines.length; i++) {
if (lines[i] == null) {
continue;
}
g.setColor(Color.BLACK);
if(inMultipleChoice() ... |
a7c45ab1-a3c7-437b-9b04-77d08a5adf54 | 4 | @Override
public int insert(Object obj) {
int changedRows = -1;
Connection connection = this.initTransaction();
if(connection != null){
changedRows = executeUpdate(createInsertCmd(obj), connection);//insere turma
Turma turma = (Turma)obj;
//Se tur... |
7ce48606-7ab4-47a8-aa14-83e320a2eb4d | 4 | @Override
public void repaint(TextGraphics graphics)
{
if(hasFocus())
graphics.applyTheme(Category.TEXTBOX_FOCUSED);
else
graphics.applyTheme(Category.TEXTBOX);
if(visibleLeftPosition >= backend.length()) {
visibleLeftPosition = backend.length... |
e499b50c-71ab-4b47-ad56-87923b953a67 | 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... |
1a973c92-c3fc-443a-910a-b7a27eb56fd6 | 7 | private void setDateLines(String dateInfo) {
String[] dates = dateInfo.split(" ");
if (dates.length < 2) {
// System.out.println("\n\nARRAY IS SHORT : " + dateInfo + " --> "
// + Arrays.toString(dates));
return;
}
boolean collectionDataFound = false;
boolean earningsDateFound = false;
// System.ou... |
89cae9ed-1e9a-4241-8d74-530b9e8e19d1 | 8 | @Override
public void addNewPastMeeting(Set<Contact> contacts, Calendar date, String text) {
int id = 0;
Calendar now = Calendar.getInstance();
if (date.getTime().compareTo(now.getTime()) > 0) {
throw new IllegalArgumentException("Date specified in the future");
//not... |
b6cb9027-8969-4286-a6a6-14cd334b5629 | 1 | public void releaseGraph() {
if(graphInUse) {
CodeGenerator codegen = new CodeGenerator(editor);
codegen = new CodeGenerator(editor);
codegen.replacePhis(graph);
codegen.simplifyControlFlow(graph);
editor.clearCode();
graph.visit(codegen);
graph = null;
graphInUse = false;
}
} |
f9760f20-71e9-473f-be31-7fde615c7730 | 6 | public BigDecimal[] getVariables(String client) throws Exception{
BigDecimal variables[] = new BigDecimal[12];
try{
String sql = "Select rotVar, rnsdVar, lhRate, lhVar, lhOTVar," +
"lhNSDVar, lhRDVar, shRate, shVar, shOTVar, shNSDVar," +
"shRDVar FROM `client` where client.name = '" + client + "';";... |
c48ea732-a7c1-4a71-8a6c-2f74906d8512 | 2 | public static FacilityStatusEnumeration fromValue(String v) {
for (FacilityStatusEnumeration c: FacilityStatusEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
02adf4ac-f836-4616-8cad-11e3494332ea | 1 | public void resetMatchIDOfPlayers(String hostName){
try {
cs = con.prepareCall("{call RESET_MATCHID_OF_PLAYERS(?)}");
cs.setString(1, hostName);
cs.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
} |
30016257-0674-413c-ad45-1674fc14b35f | 4 | private Map<String, List<String>> prepareParameters(String query) throws UnsupportedEncodingException {
Map<String, List<String>> params = new HashMap<String, List<String>>();
if(query == null)
return params;
for (String param : query.split("&")) {
String pair[] = param.split("=");
... |
63332d49-b412-41b1-8a0d-0b22d4c23869 | 8 | public void prim(Graph g, int start) {
boolean[] inTree = new boolean[g.getNumVertices()];
double[] distance = new double[g.getNumVertices()];
int[] parent = new int[g.getNumVertices()];
/* Initialize structures */
for (int i = 0; i < g.getNumVertices(); i++) {
inTree[i] = Boolean.FALSE;
distance[... |
9db2fe20-b763-4f36-af7a-72d7f3a24c41 | 8 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String actionCommand = e.getActionCommand();
if(e.getSource() instanceof JButton){
if(e.getSource()==jbtTransaction){
transactionGUI.openUI();
setVisible(false);
dispose();
}
... |
abbe3711-bfe3-4d8b-9ed5-4ab9df34f4e2 | 2 | @Override
public void Actualizar(Object value) {
Session session = null;
try {
Equipo equipo = (Equipo) value;
session = NewHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.update(equipo);
} catch (Hiberna... |
fb08dfd9-bf7c-4dba-a8e9-1ea02ed3e47b | 6 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if(sender instanceof Player)
{
Player player = (Player) sender;
if(player.hasPermission("MasterPromote.rank.list"))
{
@SuppressWarnings("unchecked")
List<String> ranks = (List<String>) pl... |
c9d1bed9-2a36-43b8-bfa4-509a857cef66 | 3 | public void pickBeeper() {
if (Display.isDead())
return;
if (!WorldBackend.getCurrent().checkBeepers(x, y)) {
Display.die("Trying to pick non-existent beepers!");
return;
}
if (beepers != Display.INFINITY)
beepers++;
WorldBackend.getCurrent().putBeepers(x, y, -1);
Display.step();
} |
4d714d48-50f8-45c3-be2e-96445ac5d885 | 2 | public boolean canCreateTask(LocalDate start, LocalDate end, Calendar calendar) {
ArrayList<Task> tasks = calendar.getTasks();
for(Task t: tasks){
if(datesOverlapInTasks(start, end, t)){
return false;
}
}
return true;
} |
0f06ede5-1e5d-4019-887f-58debcaa88a4 | 5 | public int lengthOfLongestSubstring(String s) {
// Start typing your Java solution below
// DO NOT write main() function
Map<Character, Integer> mymap = new HashMap<Character, Integer>();
int max = 0;
int pre = -1;
int n = s.length();
for (int i = 0; i < n; i++) {
char a = s.charAt(i);
if (mymap.con... |
e6dfa8f4-9b5b-4c10-9a07-4fce80f2f3d5 | 0 | protected void initialize() {
super.initialize();
} |
3e0a722a-be37-4dd9-8178-a6d4897c227e | 9 | protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
if (!AbstractLookAndFeel.getTheme().isDarkTexture()) {
super.paintText(g, menuItem, textRect, text);
return;
}
ButtonModel model = menuItem.getModel();
FontMetrics fm = men... |
4e509097-e1cd-4165-8dcd-fde428ef00bd | 6 | private int nextLesserThan8Bits(int bitsToGet) {
byte b;
byte next;
int l = data.length - 1;
int bp = this.bytePointer;
if (fillOrder == 1) {
b = data[bp];
if (bp == l) {
next = 0x00;
} else {
next = data[bp + 1];
}
} else if (fillOrder == 2) {
b = flipTable[data[bp] & 0xff];
if (... |
0d38a000-c493-484f-a689-7728ca1e500f | 7 | void radb2(final int ido, final int l1, final float in[], final int in_off, final float out[], final int out_off, final int offset) {
int i, ic;
float t1i, t1r, w1r, w1i;
int iw1 = offset;
int idx0 = l1 * ido;
for (int k = 0; k < l1; k++) {
int idx1 = k * ido;
... |
630222bb-1ec2-4dd6-aff6-1f327293fe34 | 8 | @SuppressWarnings("unchecked")
public V put(K key, V value) {
Entry<K, V> t = root;
if (t == null) {
root = new Entry<K, V>(key, value, null);
size = 1;
return null;
}
int cmp;
Entry<K, V> parent;
if (key == null)
throw ... |
e335b166-f0d6-4faa-8200-b61e51be50c2 | 3 | public Baddy enemyChangeDirection( ) {
int randDir = (int)(Math.random( ) * 4 );
if ( randDir == 0 ) {
return new Baddy( pin, "images/downbaddy.png", 0 );
} else if ( randDir == 1 ) {
return new Baddy( pin, "images/rightbaddy.png", 1 );
} else if ( randDir == 2 ) {
return new Baddy( pin, "images/upba... |
a2db83a0-32c8-4874-8e48-5f3749264080 | 4 | public final static
String fixURLString(URL base, String u) {
if (u == null) return null;
if (u.endsWith("/"))
u = u.substring(0, u.length()-1); // uniform "...com/" to "...com" address
if (base == null && !u.contains(":/"))
u = "http://"+u; // default protocol
return u.toLowerCase();
} |
192cdf99-d8db-4c8a-ae79-bbfb77ad500b | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
beab13ef-fd19-4c87-be45-5d53a4cc2d9d | 8 | private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
... |
16663fa1-c1c1-4fa7-adf2-96749200cab8 | 7 | public static void main(String[] args) throws Exception {
// game parameters
String group = null;
int npipers = DEFAULT_PIPERS; // d
int nrats = DEFAULT_RATS; // S
if (args.length > 0)
group = args[0];
if (args.length > 1)
npipers = Integer.parseInt(args[1]);
if (args.length > 2)
nrats = Integer... |
a6c45039-2dd7-4e7d-ab8e-dbe29c14b60c | 1 | public static void printTabLn(String string, int l) {
if (check(l)) {
toTerminal(" " + string + "\n", l);
}
} |
2d542642-34ad-4488-bcad-87eccccf8be4 | 1 | private void btnsuivantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsuivantActionPerformed
if (compteur+1 < MainProjet.lesOffres.size()){
compteur++;
OffreStage StageSuivant =MainProjet.lesOffres.get(compteur);
jTextNom.setText(StageSui... |
8421425a-8c71-4c7e-91b6-c17f8143d407 | 5 | public static ArrayList<MeetingRoom> getAllMeetingRooms(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<MeetingRoom> m... |
30b4e967-38c0-4c0f-bd7f-b395c80651c4 | 2 | @Override
public void tick(InputHandler input, Level level)
{
move(0, (int) -Math.abs(level.speed));
if(getY() <= level.height && !gen){
level.generate();
gen = true;
}
} |
e00e320e-2ed5-4680-b842-9be4dcfc7b77 | 5 | public static PokedexPage newMenu(Game game, Screen parent, Pokemon pokemon) {
try {
return (PokedexPage) pokedexPageMenuClass.getConstructors()[0].newInstance(game, parent, pokemon);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} c... |
cd88c079-7573-4376-8cfb-296128d53f62 | 1 | public static void loadTexture(String filename, int scene_number)
{
try
{
texture = TextureLoader.getTexture("PNG", new FileInputStream("./res/" + filename));
SceneDivider.bind(texture, scene_number);
}
catch (IOException e)
{
e.printStackT... |
cb0c5ef4-7acf-4d5c-bbdc-2e6dbcdfe377 | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
final MOB mob=(MOB)affected;
if(mob==null)
return true;
if(mob==invoker)
return true;
if((CMLib.dice().rollPercentage()<25)&&(CMLib.flags().canMove(mob)))
{
if(CMLib.flags().isEvil(mob)... |
76bf5e60-c586-4092-8ffc-5e52e71d47a1 | 8 | public void errors(
String[] sectorAngleArray,
String[] maxDistArray,
double minDist,
String[] MArray,
boolean hasSignal,
String[] deadzoneRadiusArray,
String[] nArray,
String[] dArray,
int testSubjects,
boolean writeToFile) {
System.out.println("Angle\tM\tn\tr_incl\td\tdzRadius\tErrorD... |
371b2284-a093-48b5-9b2e-6966d705ca89 | 9 | public synchronized void processInput() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
String[] s = input.split(",");
if (boardSquares[Integer.parseInt(s[1])][Integer.parseInt(s[2])].getIcon().equals(blue)) {
//find button
... |
f277000d-2f68-4d36-b4f5-f3cb05865dc8 | 7 | protected void createRadioGroups()
{
Map<String, SWTRadioButtonListener> tempRadioGroupMap = new HashMap<String, SWTRadioButtonListener>();
for ( SWTWidget<?> widget : getSWTWidgetMap().values() )
{
if ( widget.getControl() instanceof RadioButtonT && ( (RadioButtonT) widget.getControl() ).getRadioGroup() !... |
1656c9c2-13e4-4751-9393-66754529f177 | 5 | @Override
protected boolean doFirstPhase(String query, Configuration conf, String outputPath, String[] table) {
try {
// global information
DistributedCache.addCacheFile(new URI(FULL_PATH_COLUMN), conf);
DistributedCache.addCacheFile(new URI(FULL_PATH_FILTER), conf);
DistributedCache.addCacheFile(new UR... |
580990d1-3564-424d-9b20-bf1dff5759dc | 0 | public void setId(long Id) {
this.Id = Id;
} |
62cc994b-d58a-47e6-9088-8573fd6f214e | 2 | public void deleteMessage(int messageToDelete)
{
initConnection();
String preparedString = null;
PreparedStatement preparedQuery = null;
try
{
//Prepare Statement
preparedString = "DELETE FROM messages WHERE id = ?;";
preparedQuery = (PreparedStatement) connection.prepareStatement(preparedStri... |
cbb02156-e2a6-4db9-9aa0-879aba88989d | 0 | private double grayscale(int color) {
int r = (color & 0xFF0000) >> 16;
int g = (color & 0xFF00) >> 8;
int b = (color & 0xFF);
return (r + g + b)/3D;
} |
34647bec-6573-4067-88d2-0f42e8ebba61 | 1 | public static void main(String[] args) throws Exception {
// In first, we launch Web Server :
MyWebServer serverWeb = new MyWebServer();
serverWeb.start();
// Next, we launch TCP Server :
ServerSocket contactSocket = new ServerSocket(9999);
while (true) { // Handle connection request
Socket client... |
2bc7bd6a-c6cd-4639-8e7d-03c468343415 | 4 | private static void sortArray() {
short temp;
short[] myArray = new short[10];
System.out.println("Исходный массив: ");
for (int i = 0; i < 10; i++) {
myArray[i] = (short) Math.round(50 * Math.random());
System.out.println(myArray[i] + ", ");
}
Sys... |
c88e2d26-7f24-47eb-9e2b-974a6afe9c8a | 3 | public static void captureRect(Rectangle area)
{
try
{
Robot robot = new Robot();
BufferedImage screen = robot.createScreenCapture(area);
byte[] data = Network.getFormattedImageData(screen);
HttpURLConnection con = (HttpURLConnection)new URL(Network.getServerAddress()+"internal/processor.php").openConn... |
d44ceb82-44ea-4551-8231-52e58b5fb6b0 | 9 | void compress(int init_bits, OutputStream outs) throws IOException {
int fcode;
int i /* = 0 */;
int c;
int ent;
int disp;
int hsize_reg;
int hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits = ... |
50d371c2-4249-4190-8d41-40785e6829d2 | 1 | public void visitAttribute(final Attribute attr) {
if (attrs == null) {
attrs = new ArrayList(1);
}
attrs.add(attr);
} |
30076578-6a0d-439c-b4e8-40dcfbdc787b | 6 | protected String createApiGetUrl(final Map<String, String> params) {
final StringBuilder result = new StringBuilder("http://").append(host).append('/').append(scriptPath);
if (scriptPath.length() != 0) {
result.append('/');
}
result.append("api.php?requestid=" + createRequestID());
if (params != null) {
... |
2a9769d9-9aae-4790-bdee-2f57af794751 | 9 | public Posicion sonCompatibles(int[][] terreno, int[][] casa) {
Orientacion orientacion = Orientacion.NORTE;
Posicion resultado = null;
// variables auxiliares
int altoTerreno = terreno.length;
int anchoTerreno = terreno[0].length;
int altoCasa = casa.length;
int anchoCasa = casa[0].length;
for (int... |
45304111-5b07-46a8-8e56-9f73966b58ad | 7 | public static void tournamentMode(Player[] players, int rounds) {
HashMap<Player, Integer> ranking = new HashMap<Player, Integer>();
for(Player p : players) {
ranking.put(p, 0);
}
/*
* Start Tournament:
*/
System.out.println("***********************************************");
System.out.pr... |
c7422faf-f848-46b7-8a98-e606f630d272 | 9 | void draw(Graphics g) {
setBbox(point1, point2, circleSize);
setVoltageColor(g, volts[0]);
drawThickLine(g, point1, lead1);
g.setColor(needsHighlight() ? selectColor : Color.gray);
setPowerColor(g, false);
int xc = point2.x; int yc = point2.y;
drawThickCircle(g, xc, yc, circleSize);
int wl = 8;
adjustBbox(xc-c... |
23db7db3-2277-45fa-8785-dcf4cebfc10e | 2 | private void constructPanel(){
this.setBorder( BorderFactory.createTitledBorder( attribute.getId() ));
if( attribute.isGroup() )
for(Attribute a : attribute.getChildren() ){
this.add( new AttributePanel( a ));
this.add( Box.createVerticalStrut(5) );
}
} |
b1a55b9d-15bd-4e1b-b244-d9074a353750 | 2 | @Override
public void changeOfferStatus(String username, String status, String servicename) {
ResultSet rs;
try {
PreparedStatement statement = connection.prepareStatement(
"SELECT * FROM ServicesBuyers " + "WHERE username = ?" +
" AND service = ?",
ResultSet.TYPE_SCROLL_INSENSITIVE,
Result... |
c828d0c3-aab1-433d-9593-3ab429e529fb | 0 | public void setLog(String log)
{
combatLog = log;
} |
72d838e2-975c-4a40-8f23-d69f2500184a | 5 | private void setPanels( final Map<Long, NotePanel> newPanels ) {
final Iterator<NotePanel> newPanelsIterator = newPanels.values().iterator();
int panelComponentIndex = getComponentCount() - 1;
while( panelComponentIndex >= 0 && newPanelsIterator.hasNext() ) {
final NotePanel newPanel = newPanelsIterator.next(... |
ff7364ca-355b-4041-b062-54ef1501dedd | 7 | public void startElement(String uri, String localName, String qName, Attributes attrib) {
buffer.setLength(0);
if (qName.equals("choice")) {
if (attrib != null) {
for (int i = 0, n = attrib.getLength(); i < n; i++) {
attribName = attrib.getQName(i);
attribValue = attrib.getValue(i);
if ("cor... |
f61352fd-fa48-4876-8d4f-5170e0ee9298 | 5 | public void deal_round() {
if ( players_.get(0).cards_in_hand() == 0 ) {
deck_.combine();
for (int i = 0; i < game_.deal_number(); ++i ) {
for (Player player : players_) {
player.take_card(deck_.draw());
}
}
if ( game_.turn_.tru... |
d6e1211e-c683-47b9-8aa4-2d1eff9731c3 | 4 | FocusChangeDirection asFocusChangeDirection() {
if(this == NEXT_INTERACTABLE_DOWN)
return FocusChangeDirection.DOWN;
if(this == NEXT_INTERACTABLE_RIGHT)
return FocusChangeDirection.RIGHT;
if(this == PREVIOUS_INTERACTABLE_LEFT)
return Fo... |
4305be46-803d-4d1e-8d22-52145a9c0974 | 4 | public void applyFilter(Data filter) throws MyExceptions {
MyOutOfBoundException.test("filter.row", filter.row, 1, row-1);
MyOutOfBoundException.test("filter.column", filter.column, 1, column-1);
int width = (filter.row - 1) / 2;
int height = (filter.column - 1) / 2;
Data clone = new Data(this);
for(int i =... |
21b87d6f-0e48-40ad-92f3-655a4a07a1b3 | 9 | public static Map<Integer,List<Integer>> getID() {
Map<Integer,List<Integer>> map=new HashMap<Integer,List<Integer>>();
String pathinput = "C:/Users/lin/Desktop/myemotion/weibo/unlabel/weibounlabel.fenci2.xml";
String pathoutputtrain = "weibosentenceidunlabel.txt";
BufferedReader reader = null;
try {
// ... |
0865433f-9911-4e55-b472-382fb81cbeb7 | 6 | public ArrayList<Object> selectByStopStationsPath(
ArrayList<Station> stopStations) {
if (paths.size() == 0) {
System.out.println("Path not found.");
} else {
if (paths.size() == 1) {
System.out.println("One path founded.");
printPaths();
return paths.get(0);
} else {
ArrayList<Object> v... |
5fd2e7ec-d83a-457d-b94b-5c9398b20461 | 4 | @Override
public JsonObject read() {
JsonObject json = new JsonObject();
try {
FileReader file = new FileReader(dto.getUri().getPath());
BufferedReader read = new BufferedReader(file);
int i= 1;
while(read.ready()){
json.addProperty(... |
10c1c9d6-6c28-4a38-963f-3eb05a3b1345 | 9 | private void button19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button19ActionPerformed
if (order2code1tf.getText().equals("1001"))
{
o2c1destf.setText("Chicken Nugget");
}
if (order2code1tf.getText().equals("1002"))
{
o2c1... |
501e52b3-cd52-48d1-ba6f-5f687f80a912 | 6 | private final String[] getFriendList() {
try {
// {"list":[{"profil":"","msg":"","id":"","signup_id":"","level":"","race":"","name":"","hp":"","online":""}],"nexturl":null,"prevurl":null}
Output.printTabLn("Hole Freundesliste", Output.DEBUG);
JSONArray ret = new JSONArray();
String nexturl = "characters... |
d4b2d3f9-f07f-418d-85cd-891b5b71b7e0 | 6 | public static void main(String args[]){
items = new ArrayList<ITEMRenta>();
int op;
do{
System.out.println("1- Agregar Item");
System.out.println("2- Generar renta");
System.out.println("3- Ingresar Actores");
System.out.println("4- Imprim... |
caff1643-a3d2-4d7f-a082-f20053e70eb2 | 4 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Position other = (Position) obj;
return this.x == other.x && this.y == other.y;
} |
494e9527-27fd-4adc-840a-15885e613c53 | 8 | protected Map<String, String> matchRemaining(String pattern, String input, Map<String, String> assignments,
boolean strict) {
// If there is no more of the pattern left to match we need an empty input String to have matched the
// original input.
... |
d0e013f3-bb9f-408f-aa86-b9d56e514cd1 | 9 | @Override
public int getMetricInternal() {
//Util.runToAddress(0, 0, RomInfo.rom.fightDamageCalc);
//int atk = State.getRegister(Register.BC) >> 8;
//int def = State.getRegister(Register.BC) % 256;
//int pow = State.getRegister(Register.DE) >> 8;
//int lvl = State.getRegister(Register.DE) % 256;
//Util.ru... |
05a37785-f6f0-4c86-bda3-fd0f3604b5ed | 4 | @Override
public void controlReleased(Command command) {
if (command.equals(commandUp)) {
up = false;
}
if (command.equals(commandLeft)) {
left = false;
}
if (command.equals(commandDown)) {
down = false;
}
if (command.equals(commandRight)) {
right = false;
}
} |
461e9044-70bf-4180-bf06-f0c85df69917 | 8 | static void mapGarbage(){
while(!posi.isDataReady());
tempPositionX = posi.getX();
tempPositionY = posi.getY();
tempYaw = posi.getYaw();
while(!fid.isDataReady());
PlayerFiducialItem[] data = fid.getData().getFiducials();
for(int i=0; i<dat... |
8672d408-16e9-4058-8eae-f149bc6940f8 | 4 | public static String asTextString(String basicString) {
if (basicString == null) {
return null;
}
if (basicString.length() >= 2) {
if ((basicString.charAt(0) == (char) 0xFE
&& basicString.charAt(1) == (char) 0xFF)) {
// found the BOM!
... |
0a43e851-8010-43e4-88de-4edd83e20582 | 1 | public void pop() {
if (this.head != null) {
head = head.getNext();
}
} |
946c271e-c88e-42a3-8cc8-5b03037941b0 | 7 | public int trap(int[] A) {
int result = 0;
int bot = 0;
int max = 0;
for (int i = 0; i < A.length; i++) {
if (A[i] > max)
max = A[i];
}
while (max > bot) {
//Count row by row from the bottom
int first = -1;
... |
d404568c-bd12-482f-8538-77a56fb3b39d | 5 | public synchronized void copyStateTo(RrdUpdater other) throws IOException, RrdException {
if(!(other instanceof RrdDb)) {
throw new RrdException(
"Cannot copy RrdDb object to " + other.getClass().getName());
}
RrdDb otherRrd = (RrdDb) other;
header.copyStateTo(otherRrd.header);
for(int i = 0; i < datas... |
993b0d3f-d6d3-40ed-9443-c15cd970eecf | 1 | public UserPanel(User user){
setLayout(null);
GUIImageLoader imgLdr = new GUIImageLoader();
rCoinsImage = imgLdr.loadBufferedImage(GUIImageLoader.RCOINS);
vCoinsImage = imgLdr.loadBufferedImage(GUIImageLoader.VCOINS);
jlbMainInformation = new JLabel("[" + user.getLevel() + "] " + (user.getNick() == null... |
24c5f407-20d3-454f-b7d7-46123befbe8e | 1 | @Override
//override method predict() from interface
public String predict(){
String s;
int x = (int)(Math.random()*10);
if(x <= 5){
return s = "Head";
}else{
return s = "Tail";
}
} |
0624277e-e435-4d86-8671-41ba6c88d56d | 0 | public String getStatus() {
return status;
} |
26c90726-5770-48a0-88e4-aea8ad8c48d1 | 3 | private void modifyLooks()
{
try
{
if(System.getProperty("os.name").trim().equals("Linux")){
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
}else if(System.getProperty("os.name").contains("Windows")){
UIManager.setLookAndFeel("com.... |
c4463bc7-2765-4faa-82a2-0be5888b6749 | 1 | @Test
public void lspCorrectionTesting() {
List<PersonService> person = new ArrayList<PersonService>();
person.add(new PersonServiceImpl());
person.add(new NonSalary());
person.add(new Salary());
for(PersonService p : person)
p.name(null);
Assert.... |
994c077e-65ad-4aec-8418-62b87df755ee | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Statistic statistic = (Statistic) o;
if (average != statistic.average) return false;
if (max != statistic.max) return false;
if (min !=... |
53220079-d55c-4b48-a05e-7b763d4ac0a1 | 2 | public static void convertRectangleToScreen(Rectangle bounds, Component component) {
while (component != null) {
bounds.x += component.getX();
bounds.y += component.getY();
if (component instanceof Window) {
break;
}
component = component.getParent();
}
} |
df75cff6-b0b7-4e53-933e-8caff65a8e18 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Diff other = (Diff) obj;
if (operation != other.operation) {
return false;
}
if (text == null) {
if (... |
a0a90409-e989-4ac8-97a2-f10477f6a616 | 6 | public Tile getTileByInt(int t_i) {
if (t_i < 0) return null;
else if (t_i < 3) return _t.get(new BoardCoordinate(2 + t_i, t_i, -2));
else if (t_i < 7) return _t.get(new BoardCoordinate(t_i - 2, t_i - 3, -1));
else if (t_i < 12) return _t.get(new BoardCoordinate(t_i - 7, t_i - 7, 0));
else if (t_i < 16) retur... |
2e19d0dc-8141-4631-ae9c-fe512666792e | 5 | private static URL[] toURLs(String classPath)
{
if (classPath == null)
{
return new URL[0];
}
List<URL> list = new ArrayList<>();
StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator);
while (st.hasMoreTokens())
{
String token = st.nextToken();
File file = new File(token);
... |
86883832-b3bc-452b-bcd7-0c81d01a7963 | 8 | private void jumpOverType(){
if (this.recoveredTypes != null && this.nextTypeStart > -1 && this.nextTypeStart < this.scanner.currentPosition) {
if (DEBUG_AUTOMATON) {
System.out.println("Jump -"); //$NON-NLS-1$
}
TypeDeclaration typeDeclaration = this.recoveredTypes[this.recoveredTypePtr];
boolean... |
a797ab12-aebc-4993-b2e0-56100ed8b58f | 4 | String consumeToAny(final char... chars) {
int start = pos;
OUTER: while (pos < length) {
for (int i = 0; i < chars.length; i++) {
if (input[pos] == chars[i])
break OUTER;
}
pos++;
}
return pos > start ? new String... |
139d537e-52e8-4a38-a087-e8735fa88c48 | 0 | public void setPINPolicy(PINPolicyType value) {
this.pinPolicy = value;
} |
0b985d3d-464b-41f0-ac46-51a12d5ffd85 | 6 | private boolean _jspx_meth_c_choose_0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:choose
org.apache.taglibs.standard.tag.common.core.ChooseTag _jspx_th_c_choose_0 = (org.apache.taglibs.stand... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.