method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bd813a3a-516b-47e2-872c-3ad57aaf4601 | 6 | public Header readFrame() throws BitstreamException
{
Header result = null;
try
{
result = readNextFrame();
// E.B, Parse VBR (if any) first frame.
if (firstframe == true)
{
result.parseVBR(frame_bytes);
firstframe = false;
}
}
catch (BitstreamException ex)
{
if ((ex.getErrorCo... |
dff3b71f-b5b3-4696-a112-733d62b1e417 | 1 | public void insert(Person person) {
if (isAlmostFull()) {
doubleArraySize();
}
personArray[queueSize] = person;
personArray[queueSize].setPosition(queueSize);
queueSize++;
} |
705832ff-bbe8-487b-990e-727ab3cfe2b6 | 0 | public void testSubtract()
{
System.out.println("From Subtract Test !");
} |
70faf9ff-ddd5-4477-a7bc-ac330045fde8 | 8 | @Override
public synchronized void removeFromFloor(ElevatorInterface elevatorToEnter, Direction directionToGo)
{
if(directionToGo != Direction.IDLE)
{
ArrayList<Person> peopleToRemove;
if(directionToGo == Direction.UP)
{
peopleToRemove = this.goingUp;
}
else
{
peopleToRemove = this.goin... |
343589e3-bffe-4464-a6e6-a266f4aaad4d | 1 | private void setRemoteServerConnection(IRemoteServerConnection rsc) {
if (rsc == null) {
throw new IllegalArgumentException("aRemoteServerConnection is null");
}
this.remoteServerConnection = rsc;
} |
4c4cea57-3025-4148-83ea-643ce2e8f709 | 9 | public void readFunction(Element function) throws MaltChainedException {
boolean hasSubFunctions = function.getAttribute("hasSubFunctions").equalsIgnoreCase("true");
boolean hasFactory = false;
if (function.getAttribute("hasFactory").length() > 0) {
hasFactory = function.getAttribute("hasFactory").equalsIgn... |
8219b6a9-fe11-44f7-8286-5e7acbc34114 | 8 | protected void defineWorld(int worldType) {
world = new HashMap<Position,Tile>();
String[] layout;
if ( worldType == 1 ) {
layout = new String[] {
"...ooMooooo.....",
"..ohhoooofffoo..",
".oooooMooo...oo.",
... |
708234db-344a-4df0-a59d-fbf20ae6b8b6 | 1 | @Override
public void render (float delta) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
countdown.update(delta);
if(countdown.isDone()){
Objects.playScreen = new PlayScreen();
ld.setScreen(new MainMenu(ld));
}
Objects.BATCH.begin();
Objects.FONT.draw(Objects.BATCH, score, Gdx.graphics.getWidth() / 2, ... |
6462c02e-4bb7-4038-8660-621418a47003 | 6 | @Override
public void mouseMoved(MouseEvent event) {
//System.out.println(event.getX() + " " + event.getY());
int x, y;
x = event.getX();
y = event.getY();
if(buttonArea.contains(x, y))
hoverButton = true;
else
hoverButton = false;
if(boundLeft.contains(x, y) || boundRight.contains(x, y) || boundTo... |
d2a12eec-c72d-43de-9a8e-bef270d98630 | 7 | private void parseResponse(String rawResponse, GoogleResponse gr) {
if (rawResponse == null || !rawResponse.contains("\"result\"") || rawResponse.equals("{\"result\":[]}")) {
return;
}
if (rawResponse.contains("\"confidence\":")) {
String confidence = StringUtil.substringBetween(rawResponse, "\"confidence\"... |
917f5bd8-6961-416c-a015-9db24f1df0de | 3 | public static Integer getInteger(final Context context, final int position) {
if (position < 0 || context.arguments.size() <= position) return null;
if (!Parser.isInteger(context.arguments.get(position))) return null;
return Integer.parseInt(context.arguments.get(position));
} |
9add7878-34ea-4deb-97de-66f8d84bf412 | 5 | public static String getDirectoryName(){
String relativeWdPath,workingDirectory;
String inputFileName;
//Folder workingDirectory;
//Because userHome is a public static field, it can be used without having initialized any instance of Folder:
//This because the static variables have their own memor... |
441fc24f-2e7a-450a-a92a-cad4c1cda85f | 8 | public static ArrayList<String> selectRecursion(char[] arr, int start, int num, Stack<Character> stack, ArrayList<String> arrayList, boolean print) {
if(start == arr.length) {
return arrayList;
}
if(arrayList == null) {
arrayList = new ArrayList<String>();
}
for(int i=start;i<arr.length;i++) {
sta... |
e95db3ad-947f-4c62-ba77-d2e49bf72184 | 8 | @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPickUpItemIntoLockedSlot(PlayerPickupItemEvent event) {
Player player = event.getPlayer();
if (player.hasPermission("disable.slot.locking")) {
return;
}
PlayerInventory inv = player.getI... |
0feba74d-1b56-4bcd-9d60-63bc6a822b68 | 7 | public Document merge(XPathExpression expression,
List<String> excludedTags,
Set<String> files)
throws ParserConfigurationException,
IOException,
SAXException,
XPathExpressionException
{
... |
d7c96e6d-758c-47dc-b147-d940b533b45d | 7 | private static String trim(String text)
{
String result = text;
if (text != null && text.length() > 0)
{
int start = 0;
int end = text.length();
char firstChar = text.charAt(start);
char lastChar = text.charAt(end - 1);
if (firstChar == lastChar)
{
if (firstChar == '\'' || firstChar == '"... |
d6cd4d70-ed42-4dd9-8c4d-1708649ab24e | 8 | private void invokeKrisletAction(DataInstance di, SoccerAction action) {
ObjectInfo object;
if (action == null) {
defaultAction();
} else {
switch (action) {
case DASH:
object = di.getObject("ball");
if (object != null)
... |
5ce2ce9d-ab67-425f-8346-1006400ed868 | 9 | private static String lineFlow(String line, boolean insideTable, boolean isALastLine) {
// TODO : documentation
if (insideTable == true) {
if (line.startsWith("|")) {
line = line.substring(1, line.length());
}
if (line.endsWith("|")) {
... |
8272d1ac-b993-4cb2-a205-97193284c715 | 1 | public void addNewPlayer(String username){
try {
cs = con.prepareCall("{call addNewPlayer(?)}");
cs.setString(1, username);
cs.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
} |
860f8619-090c-4ad6-b73b-fe91a9a2e9b3 | 0 | public void setArrivalCity(String arrivalCity) {
this.arrivalCity = arrivalCity;
} |
66899ed2-78df-4ae6-b64c-793638083a27 | 9 | public void updatePosition() {
if (xPos < xDestination)
xPos+=2;
else if (xPos > xDestination)
xPos-=2;
if (yPos < yDestination)
yPos+=2;
else if (yPos > yDestination)
yPos-=2;
if (xPos == xDestination && yPos == yDestination) {
if (command==Command.GoToSeat) agent.msgAnimationFinishedGoToSea... |
fa0f1e71-ab8c-4db4-8429-6909b6bf8c17 | 9 | @Override
public boolean afterEpoch(Inference inferenceImpl, Model model,
int epoch, double loss, int iteration) {
if (averaged) {
try {
// Clone the current model to average it, if necessary.
LOG.info(String.format(
"Cloning current model with %d parameters...",
((DPGSModel) model... |
8142dee1-c921-4735-b59b-f45a541f6258 | 1 | private void doDeleteTest() {
System.out.print("\n[Performing DELETING CHOCOLAT FROM COFFEES] ... ");
try {
Statement st = conn.createStatement();
st.executeUpdate("DELETE FROM COFFEES WHERE COF_NAME='chocolat'");
} catch (SQLException ex) {
System.err.println... |
4df258cd-03aa-4e3a-8702-6ab562cd6acd | 0 | public long getMin() {
return min;
} |
40efc9ed-4671-4544-844c-58aadf3be8eb | 2 | public ArrayList viewBooking() {
ArrayList temp = new ArrayList();
Query q = em.createQuery("SELECT t from BookingEntity t");
for (Object o : q.getResultList()) {
BookingEntity p = (BookingEntity) o;
System.out.println("viewbooking: reached 1" + userId);
if (... |
71ccb791-f7dc-4767-964f-2ed6dd42dd2e | 7 | private String[] showList(ArrayList<String> players, Integer pageNum) {
Iterator<String> it = players.iterator();
String[] str = new String[players.size()];
Integer i = Integer.valueOf(0);
while(it.hasNext()) {
String play = (String)it.next();
String playJobList ... |
57130d6c-8aeb-4912-a68d-9bc77e03cee1 | 0 | @Override
public boolean isWebDriverType(String type)
{
return StringUtils.equalsIgnoreCase("ie", type);
} |
60cab027-11e5-49aa-bf26-ca23d9ff3601 | 6 | @Override
public List<String> onTabComplete(CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args) {
for (CommandGroup command : commands) {
if (command.getName().equalsIgnoreCase(cmd.getName())) {
if (args.length > 0) {
int command... |
b8fee3cd-d1f8-4bf8-9134-04f979578299 | 1 | protected void _toTerminal(String string, int l) {
if (l == 0) {
System.err.print(string);
} else {
System.out.print(string);
}
} |
79469daa-8729-49be-922e-9055eb9db7ed | 7 | private void handle_start(Message msg) {
System.out.println("Handle start process cmd!");
// response message prepared!
Message response=new Message(msgType.RESPONSE);
response.setResponseId(ResponseType.STARTRES);
response.setProcessId(msg.getProcessId());
response.setProcessName(msg.getProcessName());
... |
5e3cac61-641a-4b60-ad18-46e69a5e2e8a | 1 | public String getParam(String key)
{
String value = queryData.get(key);
if ( value == null )
return "";
return value;
} |
17fbc886-95dd-46bd-a055-9e160aebe549 | 9 | public boolean isUnstyled() {
if (font != null)
return false;
if (rise != 0)
return false;
if (metrics != null)
return false;
if (foreground != null)
return false;
if (background != null)
return false;
if (fontStyle != SWT.NORMAL)
return false;
if (underline)
return false;
if (strik... |
6c290bbb-1377-42bf-8feb-20c06bdc2dd4 | 3 | public void carrega(String arq) {
try {
ObjectInputStream is = new ObjectInputStream(new FileInputStream(arq));
contaRaiz = (ContaComposite) is.readObject();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
... |
04b99f0d-5448-4859-bd65-ff100eea99d0 | 6 | private boolean valid() {
String clientname = (String) clientBox.getSelectedItem();
Contact _client = Database.driver().getClientsAlphabetically().get(clientname.toLowerCase());
if (clientBox.getSelectedIndex() == 0 || _client == null) {
JOptionPane.showMessageDialog(null, "Gelieve ... |
e7ae60ca-4a62-4e8c-ab3c-71dd9501cdaa | 2 | private void tick() {
StringBuilder sb = new StringBuilder();
for (Iterator<Snake> iterator = getSnakes().iterator();
iterator.hasNext();) {
Snake snake = iterator.next();
snake.update(getSnakes());
sb.append(snake.getLocationsJson());
if (... |
edfcc0b8-44cf-4a11-93a9-b17f83755930 | 3 | public HashMap<String, String> parseXml (String fileName) {
try {
HashMap<String, String> hmap = new HashMap<>();
DocumentBuilder rBuilder = init();
Document rDoc = rBuilder.parse(fileName);
Element root = rDoc.getDocumentElement();
iterativeParseElem... |
bb4caafa-076c-4ce2-8ae8-bd64200509c1 | 4 | public static long getBanTime(String playerName){
long bantime = 0;
if(isBanned(playerName)){
try {
SQL_STATEMENT = SQL_CONNECTION.createStatement();
SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM bans WHERE username='" + playerName + "'");
// This loop checks all bans on ... |
b03ce0c8-574c-4c80-974e-e9b36ad7941c | 6 | public static String encode(byte[] input) {
StringBuilder result = new StringBuilder();
int outputCharCount = 0;
for (int i = 0; i < input.length; i += 3) {
int remaining = Math.min(3, input.length - i);
int oneBigNumber = (input[i] & 0xff) << 16 | (remaining <= 1 ? 0 : i... |
39b76ef2-02ad-44bb-ac23-35da2718f60f | 7 | protected List refreshTicksVertical(Graphics2D g2,
Rectangle2D dataArea,
RectangleEdge edge) {
List result = new java.util.ArrayList();
result.clear();
Font tickLabelFont = getTickLabelFont();
g2.setFont(ti... |
17bb8554-02ed-4de1-a676-99bcb28be10e | 4 | public boolean stillRoom() {
int zeroCnt = 0;
for (int i = 0; i < 6; i++) {
for (int n = 0; n < 7; n++) {
if (_board[i][n] == 0) {
zeroCnt++;
}
}
}
if (zeroCnt == 0) {
return false;
}
else {
return true;
}
} |
fab2589e-e579-40fd-b415-79d6e68b454e | 7 | private static ChemistryUnit apart(ChemistryUnit unit){
if(unit.getType() == ChemistryUnit.TYPE_BASE){
return unit;
}
ChemistryUnit unitValue = new ChemistryUnit();
for(Map.Entry<ChemistryUnit, Integer> unitPart : unit.getUnitEntrySet()){
ChemistryUnit unitPartValue = new ChemistryUnit();
ChemistryUnit... |
2ea88bf8-01b9-4ace-b27e-d5ec5f0b0909 | 0 | @After
public void tearDown() {
} |
f4238e0f-a7ca-41ef-a616-0fea14203a23 | 8 | public static void main(String[] args) {
EvolvingGlobalProblemSetInitialisation starter = new EvolvingGlobalProblemSetInitialisation();
starter.initLanguage(new char[] { '0', '1' }, 10, "(0|101|11(01)*(1|00)1|(100|11(01)*(1|00)0)(1|0(01)*(1|00)0)*0(01)*(1|00)1)*");
int solutionFoundCounter = 0;
int noSolutionF... |
71460a71-fa46-4e11-a968-e8ac238349fe | 7 | public void fusionWithDodgeFullAlpha(CPLayer fusion, CPRect rc) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(rc);
for (int j = rect.top; j < rect.bottom; j++) {
int off = rect.left + j * width;
for (int i = rect.left; i < rect.right; i++, off++) {
int color1 = data[off];
int alpha1 = ... |
b2dca493-a0fa-41d7-a7ea-51eeb005f3c7 | 4 | public float[] getInput(){
float[] values = new float[2];
values[0] = 0;
values[1] = 0;
if(Gdx.input.isKeyPressed(Keys.W)){
values[1] += 1;
}
if(Gdx.input.isKeyPressed(Keys.A)){
values[0] += -1;
}
if(Gdx.input.isKeyPressed(Keys.S)){
values[1] += -1;
}
if(Gdx.input.isKeyPressed(Keys.D)){
... |
e4434f3c-bfb0-449d-abf6-539b138fd60b | 5 | private String getNextWord(String line) {
StringBuffer buff = new StringBuffer(line);
StringBuffer ret = new StringBuffer();
while ((buff.length() > 0) && Character.isWhitespace(buff.charAt(0))) {
buff.deleteCharAt(0);
}
while ((buff.length() > 0) && !(buff.charAt(0) == ' ')){
if (isEndingPunctuation(bu... |
6284d1e1-4f67-43be-883f-8f439d97de1f | 4 | static protected void AdjustBuffSize()
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = 0;
available = tokenBegin;
}
else
ExpandBuff(false);
}
else if (available > tokenBegin)
available = bufsize;
else if ((tokenBegin - available... |
c42d8e05-3eac-463d-83b1-eee798d4614c | 8 | public static void calculateP1(double[] lambda, int[] MAXBUFFER, double mu, int lambdaNum,int bufferNum){
double currentTime = 0;
double nextArrivTime;
int queueSize = 0; //This is the 'length' in the instructions
GEL eventList = new GEL();
Queue<Node> packetQueue = new LinkedList<Node>(); //Queue represents ... |
a55bf24d-e457-432a-bc60-35e70e24bacf | 7 | public boolean onCommand(CommandSender sender, String[] args) {
if(args.length != 1) {
return false;
}
//go through all players to find ours
OfflinePlayer[] players = plugin.getServer().getOfflinePlayers();
int total = players.length;
boolean found = false;
String player = "";
for(int i = 0; i < t... |
8dc4073e-4b98-4a09-9b20-288d736dc110 | 7 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException
{
switch (qName) {
case "node":
if (convertRoadTypeToInt(roadType) != -1)
{
edges.add(new Edge(placeNameNode, placeNameNode, conv... |
def00ac3-0012-4c44-9d48-634c0fa7e417 | 7 | @Override
public void actionOnPChoice(int choice, int player) {
if(victory){
switch(choice){
case PlayersChoices.CHOOSE_THRONE :
putInFirstPlace(model.getThrone(), player);
end();
break;
case PlayersChoices.CHOOSE_BLADE :
putInFirstPlace(model.getFiefdoms(), player);
updateFiefdom();
... |
628b4a8b-322a-4cce-a079-95eda32dcbee | 5 | public boolean isFinished() {
if (!canStillMoveToAPosition(getActivePlayer()))
return true;
for (Player p : players) {
for (Player p2 : players) {
if (p2 != p && p.getPosition().equals(p2.beginPosition))
return true;
}
}
return false;
} |
52bcd16f-3864-4a10-824c-9cb017bb05c4 | 9 | public static boolean show(final BookDraggable b) {
if (b == null)
return false;
if (!b.getTab().open()) {
return false;
}
final WidgetChild window = Widgets.get(BookDraggable.BOOK_WIDGET, BookDraggable.CLICK_WINDOW);
final WidgetChild wc = b.getChild();
final WidgetChild scrollbar = Widgets.get(BookD... |
5be5bdb4-623b-41fa-a149-8ec688d55bdc | 3 | public void setSourceText(String sourceText) {
if( !sourceText.equals(AlchemyAPI_LanguageParams.CLEANED_OR_RAW)
&& !sourceText.equals(AlchemyAPI_LanguageParams.CQUERY)
&& !sourceText.equals(AlchemyAPI_LanguageParams.XPATH))
{
throw new RuntimeException("Invalid setting " + sourceText + " for parameter s... |
14357e0b-7597-46cb-8103-316bf978abad | 8 | public Map<String, Map<String, Boolean>> getPermissions(String world) {
Map<String, Map<String, Boolean>> result = new LinkedHashMap<String, Map<String, Boolean>>();
Map<String, Boolean> groupperms = new LinkedHashMap<String, Boolean>();
//add group permissions
groupperms.put("droxperms.meta.group." + name, tru... |
e8d42c3f-a70d-41e1-8652-2e2e8b6c241e | 9 | public static int windowImgs(String wnd, boolean free) {
int cnt = 0;
Widget root = UI.instance.root;
for (Widget wdg = root.child; wdg != null; wdg = wdg.next) {
if (wdg instanceof Window)
if (((Window) wdg).cap.text.equals(wnd))
for (Widget img =... |
cd2e3e42-a6d1-4965-a511-5cf7af81c318 | 9 | public void loadPlugins(){
String runPath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
try {
List<File> files = Util.getFileList(Folders.PLUGIN.getAbsolutePath());
for(File f: files){
if(!f.getName().endsWith(".jar"))
return;
URL path = new URL("jar:" + f.toURI()... |
1f04ee85-e000-479f-9b86-aac55e6aa457 | 9 | int test4( ) throws MiniDB_Exception{
int points = 0;
// IN_SOLUTION_START
MiniDB db = new MiniDB( "minidb.test4" );
BufMgr bm = db.getBufMgr();
BPlusTree bpt = db.createNewBPlusTreeIndex( "table", "val", 8 );
BPlusTreeLeafNode leaf = (BPlusTreeLeafNode)bpt.getRootNode();
int slot;
... |
753580a2-231f-4bb6-9899-d6c118329da2 | 0 | public String getLabel() {
return label;
} |
ad5e7930-aa40-495c-872f-91b19f607b17 | 4 | public static void displayHP(Graphics g, GameController gc, ImageLoader il, int x, int y, int progress) {
int xPos, yPos;
int progressWidth;
BufferedImage bi;
x = x - (CONTAINER_WIDTH / 2);
y = y + CONTAINER_HEIGHT;
//container
bi = il.getImage("... |
acfe8585-2f16-432b-8994-9aa386f7a2ed | 3 | @Override
public void mousePressed(MouseEvent e) {
for(int i = 0; i < Rocket.getRocket().currentGui.compList.toArray().length; i++){
if(((Button) Rocket.getRocket().currentGui.compList.get(i)).isInside(e.getX(), e.getY())){
((Button) Rocket.getRocket().currentGui.compList.get(i)).click(true);
if(((Button)... |
4491bff5-6320-4628-8841-2ecce637d2c4 | 0 | public void setLeft(Node<K> left) {
this.left = left;
} |
38cb6a10-01fe-4bf4-a486-efd47261b3ba | 4 | public void setPosition(Point position) {
int x, y;
// Make sure the position is a legal position(not to far to the sides so view space is given away)
if (position.x < this.viewWidth / 2) {
x = (int) Math.ceil(this.viewWidth / 2.0);
} else if (position.x > (this.plan.getWidth() - (int) Math.ceil(t... |
d8ba1c0e-cfec-4528-9a27-5e00ebca3994 | 8 | public static void requestToTeleportToPlayer( String player, String target ) {
final BSPlayer bp = PlayerManager.getPlayer( player );
final BSPlayer bt = PlayerManager.getSimilarPlayer( target );
if ( playerHasPendingTeleport( bp ) ) {
bp.sendMessage( Messages.PLAYER_TELEPORT_PENDING... |
eb5ad7ab-9ade-4989-91d6-d55cf5a0f13e | 3 | public void fillGaps() {
// Utilisation du générateur de nombres aléatoires :
// x.nextInt(6) + 1
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
if (matrix[i][j] == 0)
matrix[i][j] = x.nextInt(6) + 1;
}
}
} |
13e85cd7-d376-4f0e-ad2f-148df72450e5 | 4 | public App(ASMController a) {
this.asmController = a;
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.p... |
ad91c27e-6274-438a-bbdc-817fec0037e6 | 9 | private Node<K, V> lowerAll( V value ) {
if( value == null ) { return null; }
Node<K, V> node = mAllRoot;
Node<K, V> ret = null;
if( mValueComparator != null ) {
Comparator<? super V> comp = mValueComparator;
while( node != null ) {
int c = com... |
d6bc57a3-d4f6-4adb-abd3-91d1cdbdf7cb | 5 | @Override
public void addResourceLoader(Class<? extends ResourceLoader<?>> clazz)
throws ResourceException {
ChronosLogger.info("Register loader: " + clazz.getSimpleName());
// Check if the class is registered
ResourceType annotation = clazz.getAnnotation(ResourceType.class);
if (annotation != null) {
... |
0de59c50-de3c-4c1a-b247-ea4d013ee2c6 | 7 | @Override
public void visitLocalVariable(final String name, final String desc,
final String signature, final Label start, final Label end,
final int index) {
if (signature != null) {
if (localVarType == null) {
localVarType = new ByteVector();
... |
60907ac0-5cef-4931-8c5f-1cdf5cc365d1 | 4 | public List<String> parse(String line) {
StringBuffer sb = new StringBuffer();
list.clear(); // recycle to initial state
int i = 0;
if (line.length() == 0) {
list.add(line);
return list;
}
do {
sb.setLength(0);
if (i < line.length() && line.charAt(i) == '"')
... |
aafa9f5c-ca14-4f8d-b9c7-d15f2a60aa40 | 0 | @Override
public void mouseEntered(MouseEvent e) {
} |
2abe0d09-2cb0-42c2-ab3d-455933695d58 | 2 | private void solve(int n, short[][] board)
{
SudokuBoard sudoku = new SudokuBoard(n, board);
System.out.format("Initial %d x %d Board {\n", n, n);
System.out.print(sudoku);
System.out.println("}");
Solver<SudokuMove> solver = new Solver<SudokuMove>();
solver.setInitialState(sudoku);
// True since th... |
21f34ed1-10af-47e2-b6ae-0d6c3f93b50c | 8 | public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
int port = 1099;
InetAddress localhost = null;
try {
localhost = InetAddress.getLocalHost();
System.err.println("Host name : "+localhost.g... |
79f92294-f591-45b6-967c-c6d9ff18929a | 6 | public java.lang.Float get() {
elapsed = ((double) System.currentTimeMillis() - timeStart) / timeAnim;
if (elapsed > 1.0)
elapsed = 1.0;
switch (method) {
case -METHOD_LINE://line
elapsed = elapsed * 2 - 1;
break;
case METHOD_S... |
669d07ca-316e-4ace-9efa-291deeeaee64 | 9 | private boolean diagonalIncrementingBlock(int[][] grid, LinkedList<Square> squareStore, boolean pickOne) {
//Block - Diagonal Inc
if ((grid[2][0] == 1 && grid[1][1] == 1) && grid[0][2] != 2) {
BuildAndAddSquareZeroTwo(squareStore);
pickOne = updateGridZeroTwo(grid);
} els... |
dceed697-6a8e-498d-b816-a917a85b3bfd | 6 | public static HashSet getRandomIndexes_HashSet(
Vector aVector,
int aNumberOfIndexes,
Random aRandom) {
HashSet tIndexesToSwap_HashSet = new HashSet();
int aIndex;
int count = 0;
if (aNumberOfIndexes > aVector.size() / 2) {
for (aIndex = 0;... |
4dd5294d-6e57-46c3-8016-c7340ffba359 | 3 | @Override
public TLValue evaluate() {
TLValue a = lhs.evaluate();
TLValue b = rhs.evaluate();
// number + number
if(a.isNumber() && b.isNumber()) {
return new TLValue(a.asDouble() - b.asDouble());
}
// list + any
if(a.isList()) {
List<TLValue> list = a.asList();
list.r... |
1b27a181-865b-4fc3-bfc2-02fa4a86a87a | 9 | private Class<?> transformInPrimitive(final Object param) {
Class<?> retorno = null;
if (param instanceof Byte) {
retorno = byte.class;
} else if (param instanceof Short) {
retorno = short.class;
} else if (param instanceof Integer) {
retorno = int.class;
} else if (param instanceof Long) {
retor... |
65b2041a-6a5e-442d-a978-2112645f03d4 | 3 | private ListElement progressRoboMeeting(ListElement currentRobot) {
ListElement helpRobot = currentRobot;
while (helpRobot != null) {
if (helpRobot.getNext() != null) {
if (!this.robotPlace.exist(helpRobot.getNext().getId())) {
helpRobot.setNext(helpRobot.... |
f739066c-2d6b-4605-86fc-ecfdb573db23 | 1 | public void visit_i2f(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
8fdcaa74-e324-48fb-936d-631b156d0ae7 | 7 | private STS createSemaphore() {
init();
State initState = this.createState("s0");
List<State> stateList = new ArrayList<State>();
stateList.add(initState);
int index = 1;
for (Correction corr : corrections) {
State s = createState("s" + index);
stateList.add(s);
index++;
}
STS sem = new... |
cc82ae04-a60d-4d59-9630-5031e46adfb9 | 9 | @Override
protected NodeValue exec(Node[] nodes, FunctionEnv env, SPINModuleRegistry registry) {
Model baseModel = ModelFactory.createModelForGraph(env.getActiveGraph());
Node exprNode = nodes[0];
if(exprNode == null) {
throw new ExprEvalException("No expression specified");
}
else if(exprNode.isLitera... |
6f7cd5cd-32e8-4363-bcbb-3cc5135a472a | 3 | public static Node treeSearch2(Node root,int key){
while(root != null && root.key != key){
if(key < root.key)
root = root.left;
else
root = root.right;
}
return root;
} |
0b039e9c-01d5-425a-96f7-fae3f4cf53bb | 5 | public void setActive(int x, int y) {
activeX = x;
activeY = y;
switch(actualRole)
{
case Leader:
if (cells[activeX][activeY].valueState == committedByTesterByRows || cells[activeX][activeY].valueState == committedByTesterByColumns ||
cells[activeX][activeY].valueState == committedByTesterBySquar... |
e8eeba75-7665-4353-8dc0-dcf1dc850ca7 | 4 | private List setCurrentConnection(int nodeId) {
List list = new List();
for (int i = 0; i < this.connection.length; i++) {
int upI = i + 1;
if (robotPlace.existConnection(upI) && this.connection[nodeId - 1][i] == 1) {
list.add(true, upI);
} else {
... |
d383c65e-0cb9-4abe-82a5-f8e14e5365c6 | 8 | public void func_4059_a(int var1, int var2, byte[] var3) {
byte var4 = 4;
byte var5 = 32;
int var6 = var4 + 1;
byte var7 = 17;
int var8 = var4 + 1;
this.field_4163_o = this.func_4057_a(this.field_4163_o, var1 * var4, 0, var2 * var4, var6, var7, var8);
for(int var9 = 0; var9 < ... |
f1cd5536-2c0c-49d9-9442-908848ce8581 | 5 | private static boolean processOneTokenForWrapToPixelWidth(String token, Font font, StringBuilder buffer, StringBuilder lineBuffer, int width, int[] lineWidth, boolean hasBeenWrapped) {
int tokenWidth = getSimpleWidth(font, token);
if (lineWidth[0] + tokenWidth <= width) {
lineBuffer.append(token);
lineWidth[0... |
a436a8e9-68cf-4f23-9c80-a82246dd6123 | 3 | @Override
public void mouseClicked(MouseEvent arg0) {
if (Player == tg.gl.getTurn()) {
JButton l = (JButton) arg0.getSource();
int move = tg.getInt(l.getName());
if (tg.gl.validMove(move, this.Player)) {
TiarUserMessage tum = new TiarUserMessage(move, this.Player);
try {
sendMessage(enc.en... |
6262d756-e67e-4552-9976-875db4161d83 | 3 | public void pollControls() {
while (mainState != KeyState.NONE) {
Set<String> keyNames = KEYS.keySet();
for (String str : keyNames) {
if(mainState.getKeyCode() == KEYS.get(str)) {
keyStates[KEYS.get(str)] = mainState.getState();
}
... |
45869904-da62-40cd-9841-ca3231ea3010 | 2 | public static AnvilSlot bySlot(int slot) {
for (AnvilSlot anvilSlot : values()) {
if (anvilSlot.getSlot() == slot) {
return anvilSlot;
}
}
return null;
} |
11602efa-ace2-41fc-ac5a-74df5e272ef3 | 0 | public void printlnToLog(String s) {
synchronized (this) {
printToLog(s + System.getProperty("line.separator"));
}
} |
936feb38-ea16-4057-adb2-274c8754c4b7 | 2 | @Override
public Date read(String value) throws Exception {
for (SimpleDateFormat df : KNOWN_FORMATS) {
try {
Date result = df.parse(value);
return result;
} catch (ParseException e) {}
}
throw new ParseException("Unparseable date: " + value, 0);
} |
edfcc3cc-98fe-4bc8-b103-bb3af2abfb71 | 1 | public static void updateTva(int idtva,String libelle, Float taux) throws SQLException {
String query;
try {
query = "UPDATE TVA set TVALIBELLE=?,TVATX=? WHERE ID_TVA=? ";
PreparedStatement pStatement = (PreparedStatement) ConnectionBDD.getInstance().getPreparedStatement(query);... |
436b36c3-3b88-4789-89ec-aeb222f56945 | 0 | public void setSumbitTime(Timestamp sumbitTime) {
this.sumbitTime = sumbitTime;
} |
648ff6e4-a141-4e64-81ca-874034e96a80 | 1 | @Override
public void onEnable() {
PluginDescriptionFile pdfFile = this.getDescription();
// load configuration, this way dis&enabling the plugin will read changes in the config file
this.config = new SheepFeedConfig(this);
// only register event listeners once
//TODO will need to unr... |
50b5d93c-dbb1-40b2-a691-711a3c2ee2b0 | 4 | public boolean checkHitPlatform(Object obj) {
Platform other = (Platform) obj;
if (getX() + getWidth() >= other.getX()
&& getX() <= other.getX() + other.getWidth()
&& getY() + getHeight() >= other.getY()
&& getY() + getHeight() <= other.getY() + other.getHeight())
return true;
return false;
} |
bbc174c0-3f17-4654-b799-f2201b5bc22d | 2 | public void testProperty() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
assertEquals(test.hourOfDay(), test.property(DateTimeFieldType.hourOfDay()));
assertEquals(test.minuteOfHour(), test.property(DateTimeFieldType.minuteOfHour()));
assertEquals(test.secondOfMinute(), test.property... |
0c75b2bf-de07-45e8-9e38-9ef3552c9fb7 | 8 | public void executeTask() {
if (!isModifyAction()) {
if (getSelectedStudent() == null) {
showError("No Student Found", "Please select a student");
} else if (courseList.isEmpty()) {
showError("No Courses Found", "Please select at least one Course to proc... |
3f2a26c5-d086-400e-933a-3d76913604c7 | 7 | private static void testListReader(String listWithBrackets) {
System.out.println("Parsing list:\n"+listWithBrackets);
List<DaTextVariable> l = ListHandler.parseListString(listWithBrackets);
/* boolean first = true;
StringBuilder postProcessed = new StringBuilder();
postProcessed.append("[");
for(DaTextVar... |
ee09110b-4148-4cae-b0a0-05ab8559c67b | 7 | public boolean containsSegment(Segment s) {
Iterator<Point> it = this.iterator();
while (it.hasNext()) {
Point p = it.next();
if (p.equals(s.getP1())) {
Point q;
if (it.hasNext()) {
q = it.next();
} else {
q = this.getFirst();
}
if (q.equals(s.getP2())) {
return true;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.