method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
36185891-8655-4bcd-b032-7290e7870b42 | 0 | public float calcualteNiceLat(double inX, double inY) {
x = inX;
y = inY;
lng=RD2lng(x,y);
return Float.parseFloat(printGPS(lat).replace(",", "."));
} |
56f2787d-ae74-4846-9371-4bb65202469c | 3 | public void saveConfig()
{
if (config == null || configFile == null)
return;
try
{
config.save(configFile);
} catch (IOException ex)
{
plugin.getLogger().log(Level.SEVERE, "Could not save data to " + configFile, ex);
}
} |
1c68c5d7-94bd-4cf4-8a25-31f0cf3ce64c | 0 | public void addMethod(String method){
methods.add(method);
} |
0390882b-0fc2-45bc-ab6e-9c72c11ddc0a | 5 | public static void handleProjectileEvent( Entity myEntity , char[][] TilesArray){
for(int i=0;i<myEntity.Projectiles.size();i++){
boolean test = false;
if(myEntity.Projectiles.size()-1 >= i){
if(myEntity.Projectiles.get(i).hasValidPosition()
&& !onTileType(myEntity.Projectiles.get(i), 'x', TilesArra... |
1d7c8f62-af09-40b4-a9cf-abd962b212d3 | 4 | public WriteHandler getWriteHandler(String tag, Object o) {
Map<String, WriteHandler> h = lookup(chainedLookup, getClassOrNull(o));
if (h == null)
return null;
Map.Entry<String, WriteHandler> taggedWriter = soloEntry(h);
if (tag != null && !tag.equals(taggedWriter.getKey()) &... |
e5ceee7f-a569-497b-a01e-c29ee7bb8c2e | 4 | @Override
public synchronized int read() throws IOException {
if (in == null) {
if ((in = nextLine()) == null) {
return -1;
}
} else if (in.available() <= 0) {
try {
return -1;
} finally {
in = null;
}
}
return in != null ? in.read() : -1;
} |
4f6404d1-9a69-4ec7-aba6-67dc253b3b14 | 6 | private static void readChildren(Element rootElement,BusinessCollection businessCollection){
String shortName = businessCollection.getChildType();
// get Children e.g. <Accounting>
NodeList childrenNodeList = rootElement.getElementsByTagName(shortName);
// iterate children and create o... |
bd87241c-876d-49ba-a13e-38793823956e | 7 | public ConnexionVisualiserRaster(){
arrayy.clear();
geomms.clear();
Connection con = null;
try{
Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://"+ConnexionBaseDonnees.getHote()+":"+ConnexionBaseDonnees.getPort()+"/"+ConnexionBaseDonnees.getNomBase(),Connexion... |
671d4305-44c3-47cf-af70-f75ccd950bda | 0 | public void setColor(String color) {
this.color = color;
} |
ba6da518-451e-46e6-875a-a194b4a21dc1 | 0 | public Collection<Word> getList(){
return list;
} |
9aa74a3b-fcaf-40b7-b218-603736abd1fa | 7 | public void buildFrame() {
ActionListener listener;
listener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PolinomeBuilder builder = new PolinomeBuilder();
Polinome polinom1 = new Polinome();
Polino... |
f242264d-10a5-42e2-98b9-61d0a7fd0f31 | 5 | public HashSet<String> search(String text){
if(text.length()==0){
return null;
}
HashSet<String> termsThatHit = new HashSet<String>();
int i = patternLength;
for (int count = i; count > 0; count--) {
int k, j, N = text.length();
int P = pattern[i - count].length();
for (k = 0, j = 0; k < N && j <... |
81553ecb-2a70-4766-9a02-17177ff47c06 | 2 | private void siftUp(int pos) {
if (pos == 0)
return;
else if (heap[pos] > heap[pos / 2]) {
swap(pos, pos / 2);
siftUp(pos / 2);
}
} |
df384449-9489-4fce-b8ac-b05ae5fdded7 | 8 | public boolean searchMatrix(int[][] matrix, int target) {
if (matrix == null || matrix.length == 0)
return false;
int top = 0, bot = matrix.length - 1;
int left = 0, right = matrix[0].length - 1;
int line = 0;
while (top <= bot) {
int mid = top + (bot - t... |
d88e9010-e4bb-403c-ab5b-f0a352281cf5 | 3 | private void refreshRec(DataEditorMap dataEditorMap, DatabaseTreeItem parentItem, Map<Integer, TreeItem> itemsById){
for(DataEditorBase data : dataEditorMap.children){
DatabaseTreeItem item = null;
//System.out.println(data.name);
if(itemsById == nul... |
4c804be1-a503-4bb3-a14b-f92479691194 | 3 | @Override
public List<Manutencao> listAll() {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Manutencao> manutencoes = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LIST... |
6e938252-7042-4212-98e1-c79da753f4fb | 8 | protected void reCompute() {
short in = inputPins[0].get();
short sel = inputPins[1].get();
outputPins[0].set((short)(sel == 0 ? in : 0));
outputPins[1].set((short)(sel == 1 ? in : 0));
outputPins[2].set((short)(sel == 2 ? in : 0));
outputPins[3].set((short)(sel == 3 ? in... |
330e36e5-d6ca-4261-aed2-dbc4482feffc | 6 | public EvolvingGraph randomSample(){
EvolvingGraph sample = new EvolvingGraph(this.sampleSize);
int T = this.original.getMaxTime();
int numOfSamples = 0;
Random generator = new Random();
int newSample;
int NNodes = this.original.getNumOfNodes();
this.sampledNodes = new ArrayList<Integer>();
// Get the i... |
ed2d84c7-dd15-4e93-bf0f-ebebd663d97c | 4 | private void checkRanks(List<Player> plyr,Table tbl,Dealer dlr){
int rank=0;
int maxrank=0;
Rank rnk=new Rank();
for (Player player : plyr) {
InputHelper.getInput('\n'+"want to go to next player to check rank");
if(player.isFold()){
player.setRankOfHand(0);
}else{
rank=rnk.chkRank(tbl.getCrdOnT... |
0a6c4e09-c62f-4e92-aeb8-4966eb97aa91 | 3 | private void shutdownAndAwaitTermination(ExecutorService executorService) {
executorService.shutdown(); // Disable new tasks from being submitted
try {
// Wait a while for existing tasks to terminate
if (!executorService.awaitTermination(5, TimeUnit.SECONDS)) {
ex... |
03cf1929-8fb7-4f98-9ef8-8235aaa66cf2 | 9 | @Override
public void mouseReleased(MouseEvent e) {
//Don't want multiple threads in here really
synchronized (lock) {
try {
if (e.getX() < X_BOARD_OFFSET || e.getX() > (getWidth() - X_BOARD_OFFSET)) {
//Clicked off the board, nothing to do with us.
... |
a418dc61-364a-437d-86fc-c828f34c96a0 | 7 | @Override
public void keyReleasedFramework(KeyEvent e)
{
switch (gameState)
{
case GAMEOVER:
if(e.getKeyCode() == KeyEvent.VK_ESCAPE)
System.exit(0);
else if(e.getKeyCode() == KeyEvent.VK_SPACE || e.getKeyCode() == KeyEvent.VK_ENTER... |
eb9a8b4e-252d-48df-95e6-64357ab2a0e2 | 6 | private static int partition(Comparable[] a, int left, int right) {
int leftPos = left;
int rightPos = right + 1;
Comparable v = a[left];
while(true) {
while(less(a[++leftPos], v))
if (leftPos == right) break;
while(less(v, a[--rightPos]))
... |
994b647c-b5c2-4ecf-af0e-1b95e9b3d7ef | 5 | public static void main(String[] args) {
int x,y,r;
x=Integer.parseInt(JOptionPane.showInputDialog("Ingrese valor del entero X"));
y=Integer.parseInt(JOptionPane.showInputDialog("Ingrese valor del entero Y"));
if (x<=0 || x>255)
{
r=-1;
JOptionP... |
80b1c731-de31-4f7d-b10e-07828ad6af97 | 1 | public void addOuterValueListener(OuterValueListener l) {
if (ovListeners == null)
ovListeners = new Vector();
ovListeners.addElement(l);
} |
39ae7cf8-7b91-4a01-b0f1-94def228e430 | 2 | public void tick() {
for (int y = 0; y < slots[0].length; y++) {
for (int x = 0; x < slots.length; x++) {
slots[x][y].tick();
}
}
} |
63a8d6b9-8a0f-4b33-938d-06cd085f8900 | 6 | private static ArrayList<? super Object> loadData() {
ArrayList<? super Object> res = new ArrayList<Object>();
try {
Scanner indata = new Scanner(new File(path));
indata.useLocale(Locale.ENGLISH);
while (indata.hasNext()) {
addValue(res, indata);
}
indata.close();
} catch (FileNotFoundExceptio... |
58eafcde-ae90-460b-b688-1afe8cccf7ae | 9 | public ArrayList<Command> addPossibleCommandsForAgent(AgentInState aPos,
State currentState) {
ArrayList<Command> possibleCommands = new ArrayList<Command>();
Field agentLocationInPlan = aPos.f;
// Commented because we are not interested in move commands at current
// time.
for (dir direction : dir.value... |
6cd242f0-6323-4d22-8342-fb0e2d14fd6d | 8 | private void setup() {
initComponents();
//{{{ Set up the text area
textPane.setCaretPosition(0);
initDocument();
textPane.addCaretListener(new CaretListener() {
// int lastLocation = 0;
public void caretUpdate(CaretEvent e) {
... |
85fc055b-f8fa-48f0-a466-082b1cea35db | 8 | public void runit() throws Exception {
Random random = new Random();
// Wait a delay to ensure that all threads are ready
sleep(4 * DEFAULT_DELAY + random.nextInt(NB_CLIENTS));
long time = 0;
String response = null;
int counter = 0;
int min_count = 10 * 1000 / de... |
e0556f26-8735-416f-a15f-63fb7d2a7fa2 | 8 | public int left(){
int movedNr = 0;
for(int i=0;i<getX();i++){
ArrayList<Integer> merged = new ArrayList<Integer>(2); //list of all tiles which are already merged and are not allowed to be merged again
for(int u=0;u<getY()-1;u++){//go from left to right
int cv = u+1;
if(cells[i][cv] != 0){
Boolea... |
e3a95fdb-222d-46f4-b22f-7be6701c15a3 | 5 | private View getView(String action) {
if (views.containsKey(action))
return (View) views.get(action);
else {
String category = this.getClass().getSimpleName().replace("Controller", "").toLowerCase();
String viewsPackage = "app.views.";
category = category.equals("app")? "" : (category + ".");
v... |
e2ee1169-c798-414f-b3c8-6bf983772f2a | 5 | public ParseTreeNode rexp1Prime() throws SyntaxError {
ParseTreeNode node = new ParseTreeNode("<rexp1'>");
if (symbol == '(') {
/*
* accept(symbol); node.addChild(String.valueOf(symbol));
* node.addChild(rexp()); accept(')'); node.addChild(")");
* node.addChild(rexp2Tail());
*/
node.addChild(r... |
18a5876d-2ab5-4dae-9771-cc6b50e1b89b | 2 | public void Update()
{
// call the update events from the game elements
if(this.SceneManager.getCurrentScene() != null)
{
// Update the Scene Elements
Scene SelectedScene = this.SceneManager.getCurrentScene();
SelectedScene.updateScene();
// U... |
73849182-be2e-4439-b3b2-b4ddb24e06d1 | 0 | public int getWidth() {
return this.size * dimensionRatio;
} |
ad269c6d-a02f-4cea-a29b-6dea50018d71 | 0 | public static void main(String[] args) throws Exception {
Socket socket = new Socket("127.0.0.1",5000);
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();
os.write("Hello World !".getBytes());
byte[] buffer = new byte[5];
int length = is.read(buffer);
... |
6280eb38-3bb3-4045-9b65-577beb848848 | 8 | public boolean setScores() {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: setScores() BEGIN");
}
setPlayer1Score(0);
setPlayer2Score(0);
for (int i = 0; i < getGrid().getGridWidth(); i++) {
for (int j = 0; j < getGrid().getGridHeight(); j++) ... |
ba6413e8-bcf0-47a3-b927-527e1eec5473 | 4 | public void serviceClient () throws java.io.IOException {
System.out.println("Accepting clients now");
Socket clientConnection = serverSocket.accept();
// Arrange to read input from the Socket
InputStream inputStream = clientConnection.getInputStream();
bufferedReader = new BufferedReader(new InputStreamReade... |
0b86dd43-94b6-41a3-bc60-57ed11913127 | 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... |
a44d057e-bdee-4602-8562-1ce451c0c2a8 | 3 | public int getPrice(String itemName, int command){
final String AVERAGE = "average",LOW= "recent_high", HIGH="recent_low";
String item = format(itemName),extracted;
int price = 0;
openStream(item);
extracted = retrieveData(item);
switch (command){
case 1:
... |
0b321d30-c412-4b06-8e3b-b799e7528551 | 7 | private static void opcionsAsignatures(){
int opcio = 0;
while( opcio != 4 ) {
System.out.println(" Unitat Docent:"+unitatDocent+" llista d'assignatures:");
ArrayList llista = cd.llistaAssignatures();
for( int i = 0; i < llista.size(); ++i)
... |
a1c89f10-f746-49c7-9936-133ae25bd699 | 9 | @Override
public void init() {
List<Cell> cells = new ArrayList<Cell>();
StartCell sc = new StartCell();
sc.initPlayers(this.players);
cells.add(sc);
/*
* Goose : 9 18 27 36 45 54
* Trap : 31 52
* Wait : 19 2tours
* Teleport : 6 vers 12 42 vers 30 58 vers 1
*
*/
for(int i=1; i<64;i++)... |
9906d190-79ea-44e1-846d-6b636068268d | 9 | public JPanel display(){
JPanel frame = new JPanel();
frame.setLayout(new BorderLayout());
JPanel labelHolder = new JPanel();
JPanel gameHolder = new JPanel();
gameHolder.setLayout(new GridLayout(size, size));
gameHolder.setOpaque(true);
for(AbstractCookie cookie : cookies){
cookie.addActionListene... |
a726b09c-6e51-478b-8648-6374029903f6 | 8 | @Override
public int move(String o2) {
if (this.board[1][1].equals(" ")) {
this.board[1][1] = o2;
return 4;
}
// check corners 00 02 20 22
if (checkCorner (0,0,o2)) {
this.board[0][0] = o2;
return 0;
}
if (checkCorner (0,2,o2)) {
this.board[0][2] = o2;
return 2;
}
if (checkCorner ... |
4aaf9684-222d-45f0-b7c6-c6125ffac24c | 1 | private boolean eiLiianLahellaToista(Pelihahmo h){
Pelihahmo toinen;
if (h==h1){
toinen = h2;
} else {
toinen = h1;
}
double etaisyys = annaHahmojenEtaisyys();
return h.getMahdSuojakilvenHalkaisija()/2 + toinen.getSuojakilvenHalka... |
b8dc4c74-176c-4a7d-b53b-4872f41e5c76 | 5 | public void run(){
try{
for(ListenerPriority priority : priorityOrder){
//Use each priority in the correct order
for(RegisteredEventListener listener : listeners.get(priority)){
//Call each RegisteredEventListener at each priority
boolean cancelled = false;
if(event instanceof Cancellable){
... |
954628a9-a6ae-4381-aff5-b1d3acbd4882 | 0 | public long getRoleId() {
return this.roleId;
} |
33d34595-bddf-431f-aecd-3e142ee94b3e | 9 | public void readFromOutDataFileMethod(String filename) {
try {
FileInputStream fipstream = new FileInputStream(filename);
System.out.println("Total size of the file to read "+ fipstream.available());
int count = 0;
in = new DataInputStream(fipstream);
br = new BufferedReader(new InputStreamReader(in))... |
e4f10077-a92d-4ca6-9cfe-6f547d2ef920 | 5 | protected void paintLeftTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) {
Graphics2D g2D = (Graphics2D)g;
int tc = tabPane.getTabCount();
int currentRun = getRunForTab(tc, tabIndex);
int lastIndex = lastTabInRun(tc, currentRun);
int firstI... |
252fc9f3-5527-4601-bb6b-2a31f9df32ea | 7 | public static List<Point> PolyCorners (ABObject ob)
{
int[] x = {};
int[] y = {};
List<Point> poly = new ArrayList<Point>();
// Fix the error in render regular rectangle
if (ob.getType() != ABType.Hill && !ob.IsAngular() && ob.shape == ABShape.Poly)
{
x = new int[]{(int)ob.... |
553b2b38-9a98-4b97-a1ab-112b490c17e8 | 1 | public JPanel getAccessibilityBtnMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.accBtn;
} |
b9c39625-6064-4c84-9cb2-b2d902c9470c | 4 | public void setSeance(Seance seance) {
if (seance == null) {
throw new NullObjectInsertionException("Seance shouldn't be NULL.");
}
//TODO: do something with this crap
if (this.seance != null && !this.seance.equals(seance)) {
throw new ReassignObjectException("Ticket already assigned to anot... |
5eff31c3-e813-473d-ab2d-e035f7a4acee | 3 | public void addReal(final VarExpr real) {
if (real.stmt() instanceof PhiStmt) {
return;
}
final Block block = real.block();
if (real.isDef()) {
defBlocks.add(block);
}
Assert.isTrue(block != null, real + " not in a " + block);
LinkedList l = reals[cfg.preOrderIndex(block)];
if (l == null) {
... |
702a0c1c-b277-4132-96a5-dae73924735b | 9 | public void body() throws Exception {
//writeToLog(this.processId+"running now");
slotNumber = 1;
minUndecided = 1;
while(true && this.alive) {
PaxosMessage pMessage = getNextMessage();
if(PaxosMessageEnum.PERFORM.equals(pMessage.getMessageType())) {
if(pMessage.isReadMessage()) {
performReadRequ... |
d0632aed-d3bc-463c-a139-cb51471f716f | 0 | public GameWorld getGameWorld(int i) {
return locations.get(i);
} |
f0667dfc-e274-4a0a-bda8-d43ed9bbacbb | 7 | private void sendHelp(CommandSender sender) {
if (sender.hasPermission("decapitation.bounty.search"))
sender.sendMessage(ChatColor.RED + "/bounty search [username] - search for a bounty on a player");
if (sender.hasPermission("decapitation.bounty.list"))
sender.sendMessage(ChatCo... |
5ae34eac-4edf-4318-a32d-869d8551b2f6 | 7 | public Level(int width, int height, int depth, BufferedImage map) {
blocks = new short[width][height][depth];
this.w_width = width;
this.w_height = height;
this.w_depth = depth;
for(int i = 0; i < width; i++) {
for(int k = 0; k < depth; k++) {
setBlock(Block.floor, i, 0, k);
setBlock(Block.wall,... |
fce65c79-2e95-41c2-a733-79878fd19f6c | 8 | @Override
protected void doAction(int option) {
switch (option) {
case 1:
try
{
playASong(); //afspil sang menu
}
catch (Exception ex)
{
Logger.getLogger(SubMenuCon.c... |
6758d65b-1269-49bd-af3a-372669997e2e | 1 | protected boolean canChange(int value){
Controller c = gui.getController();
if (centerCause(c.getX1(), value, c.getY1(), c.getY2(), c.getR1(), c.getR2())){
return true;
}
else{
showCenterWarning();
return false;
}
} |
833474a7-785d-4a3e-8968-7ab2f55a5168 | 3 | protected void splitTask() throws IOException, CloneNotSupportedException {
if (downLen == 0) { // Was not load from file
offset = 0;
downLen = getContentLen();
if (downLen == 0) throw new FileNotFoundException();
}
tasks = new ArrayList<DownloadTask>();
int sectionLen = (int) Math.ceil((float)downLe... |
cfdeef6c-6468-4f15-ac97-08adacf2a54d | 8 | public static void main(String[] args) {
try {
JFrame window = new JFrame();
String title = "Tili-toli";
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
if(args.length > 3) {
throw new Exception("Rossz argumentum");
}
if(args.length == 0) {
window.setContentPane(new ToliG... |
a04eeac5-9a43-4cf0-8ed3-6355a301c761 | 3 | public static void fillDP() {
dp = new int[1000001];
int con = 1, lim = 0, ch = (int) 'A';
for (int i = 0; i < dp.length; i++) {
if (ch > (int) 'Z')
ch = (int) 'A';
if (lim == con) {
dp[i] = ch;
lim = 0;
con++;
ch++;
} else {
lim++;
dp[i] = ch;
}
}
} |
31fde1ad-6cf2-48ba-bbfc-c75a02f048a6 | 6 | protected int getVersionIndex(String romId) {
switch (romId) {
case "BR5J0":
return 0;
case "BR6J0":
return 1;
case "BR5E0":
case "BR5P0":
return 2;
case "BR6E0":
case "BR6P0":
return 3;
default:
throw new IllegalArgumentException("Unknown ROM ID \"" + romId
+ "\".");
... |
d5eb5da1-5e92-4c3b-87fa-22a49b0fa0f1 | 3 | @Override
public void deserialize(Buffer buf) {
objectUID = buf.readInt();
if (objectUID < 0)
throw new RuntimeException("Forbidden value on objectUID = " + objectUID + ", it doesn't respect the following condition : objectUID < 0");
position = buf.readUByte();
if (positi... |
9a989f3c-2a8a-4eed-865b-71d885232175 | 0 | public CuentaTest() {
} |
0009a969-4be9-498d-ac7f-a3c01b682cb3 | 2 | public boolean outScreen(ItemDisplay item) {
if (item.getPosX() + item.getWidth() >= getWidth()) {
return true;
} else if (item.getPosX() <= 0) {
return true;
}
return false;
} |
e08025e2-663a-4ebc-8c66-a6f5e9703879 | 6 | private void writeFile(String path, String data, boolean isDelete) {
File file = getFile(path);
boolean isWriteFile = true;
if(file.exists()){
if(isDelete){
System.out.println("파일이 존재하여서 쓸수없습니다.");
isWriteFile = false;
}else{
System.out.println("기존파일을 삭제후 재작성합니다.");
file.delete();
}
}
... |
a1d27b6b-b9da-4a35-ac54-63a64cf4681f | 9 | public void create(TipoFreio tipoFreio) {
if (tipoFreio.getConfiguracaoFreioCollection() == null) {
tipoFreio.setConfiguracaoFreioCollection(new ArrayList<ConfiguracaoFreio>());
}
if (tipoFreio.getConfiguracaoFreioCollection1() == null) {
tipoFreio.setConfiguracaoFreioCol... |
2be6a1da-19eb-49e5-8216-c06e73c2b6f6 | 5 | public Clip(final String f) {
new Thread() {
public void run() {
try {
File file = new File(f);
AudioInputStream audioStream = AudioSystem
.getAudioInputStream(file);
AudioFileFormat format = AudioSystem
.getAudioFileFormat(file);
frameSize = ((byte) (format.getFormat().getFra... |
91a2e519-fd07-4038-8ce5-bc3a18c7ba4c | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE) ... |
4c4af202-27b6-498f-b92b-7071e05c3126 | 0 | public boolean addUnit(int x, int y, Unit u)
{
return grid[x][y].addUnit(u);
} |
82f068a8-3cc2-4017-9d81-e8ef1e4f002f | 4 | private void save() {
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element options = doc.createElement("options");
doc.appendChild(options);
Element advance = d... |
49532c5e-2f9b-46bf-9462-1770861dc379 | 1 | public void testNegated() {
Period base = new Period(1, 2, 3, 4, 5, 6, 7, 8);
Period test = Period.ZERO.negated();
assertEquals(Period.ZERO, test);
test = base.negated();
assertEquals(-1, test.getYears());
assertEquals(-2, test.getMonths());
asse... |
0ff31ff3-18fe-4d56-8839-477cba01cad2 | 2 | public Room registerRoom(Room room) {
int index = rooms.indexOf(room);
if (index == -1) {
addRoom(room);
return room;
} else {
Room foundedRoom = rooms.get(index);
Iterator<Row> rows = room.getAllRows();
while (rows.hasNext()) {
foundedRoom.registerRow(rows.next());
... |
08a52626-6483-46c6-ae3c-3e9c419a7e95 | 0 | public String getPersistenceType() {
return type;
} |
84976027-4dff-4863-880f-355fac8abd2b | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
1398c499-5d79-40fd-8c5c-a35fa8e00ab5 | 3 | @Test(expected = ImpossibleSolutionException.class)
public void test_singular_matrix_solve() throws
ImpossibleSolutionException,UnsquaredMatrixException,
ElementOutOfRangeException{
int height=2;
int width=2;
System.out.print("Testing singular matrix solve m... |
161d656d-a153-4d11-b935-e2dfe27b950c | 2 | private void showPlaylists() {
try {
BLLPlaylist ds = new BLLPlaylist();
System.out.println("Playlists: ");
for (BEPlaylist aSong : ds.getAllPlaylists()) {
System.out.println(aSong.getId() + ": " + aSong.getName());
}
System.out.println... |
263f5b9b-4992-4fe6-a095-20c5ccebc5df | 7 | @Override
public String getMessage() {
String msg = super.getMessage();
if (msg != null)
return msg;
msg = getProblem();
if (msg != null)
return msg;
Object response = getParameters().get(HTTP_RESPONSE);
if (response != null) {
msg ... |
02793009-cfe4-4f06-af60-94c20c22508f | 0 | @Test
public void testCompare() {
System.out.println("compare");
assertEquals(0, new SortMode(true,1).compare(new Cube(3,0,0), new Cube(3,0,0)));
} |
022df65b-3104-4dff-9e50-0595afe5e855 | 0 | protected void setEnvironment(Environment newEnv) {
environment = newEnv;
} |
ecd2fe43-4b1a-4a95-a20a-a3ed9edd6827 | 7 | @Override
public <N, T> List<QualifiedValue<T>> getQualifiedValues(TKey<N, T> key, Enum<?>... qualifiers) {
List<QualifiedValue<T>> result = new ArrayList<>();
List<QualifiedValue<?>> values = fields.get(key);
if (values != null && values.size() > 0) {
for (QualifiedValue<?> valu... |
9261ec21-dd24-46ac-932c-c0d69a73fc2a | 4 | private AuthenticationDescriptor getAuthenticationModel(String login, char[] password) {
String hash = login + ":" + new String(password);
if (modelCache.containsKey(hash)) {
AuthenticationDescriptor cachedModel = modelCache.get(hash);
if (cachedModel != null) {
... |
77c51935-5492-45f3-b7b7-69a9e756c296 | 7 | public static Node createNode(Graph2D graph, Node parentNode, String label, double x, double y, PathCaseShapeNodeRealizer.PathCaseNodeRole role) {
NodeRealizer realizer;
switch (role) {
case REACTION:
case GENERICPROCESS:
realizer = PathCaseViewGenerator.getGenericProcessShapeNodeRealizer(label, x, y);
... |
3b47b9b2-e89c-412d-b4cd-75df141f0cdc | 8 | public static void executarAlgoritmo(FunctionInterface f, Decoder d, int chromosomeSize, SurvivorSelection selector) {
int i = 0;
double mediaMelhorResultado = 0;
long mediaTempoDecorrido = 0;
int nrExecucoes = 10;
String funcaoTeste = null;
String metodoSelecao = null;
if(f instanceof DeJongF1Fu... |
e411b368-b30f-46cc-99c1-3ea287bbeffa | 7 | public void updateRoleWords(TheaterPlay play) {
for (Role role : play.getRoles()) {
role.setWords(0);
}
for (Act act : play.getActs()) {
for (Scene scene : act.getScenes()) {
for (Paragraph paragraph : scene.getParagraphs()) {
if (paragraph instanceof Passage) {
Passage passage = (Passage) p... |
e45354e5-80bb-429d-b431-1ba486cb22bb | 1 | public boolean equals(Object o) {
if (! (o instanceof Peuple)) {
return false;
}
return this.nom.equals(((Peuple) o).nom);
} |
43d772b1-80d6-43b3-b22a-ed5792cb9e0a | 2 | public void traverseForward() {
Patient current = head;
System.out.println(head.getName() + ", " + head.getAge() + ", " + head.getIllness());
current = head.getNext();
while (current != null && current != head) {
System.out.println(current.getName() + ", " + current.getAge() + ", " + current.getIllness());
... |
0932b605-dfc7-4b02-8843-7e03769485dd | 9 | @Override
public void doScheduling(long availableExecTime, VMOffers vmOffers) {
Enumeration<DataItem> dataIter = dataItems.elements();
while(dataIter.hasMoreElements()){
DataItem item = dataIter.nextElement();
dataRequiredLocation.put(item.getId(), new HashSet<Integer>());
}
//===== 1.Determine a... |
8e99a944-b656-4d3f-8a72-68b271d4fea1 | 7 | public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
if (isExtended(var5))
{
switch (getOrientation(var5))
{
case 0:
t... |
b4bd68f3-f9ca-4566-8590-4cf9e0bb243e | 8 | public ActionBuilder() {
fileParser = new FileParser(KEYS);
List<File> files = FileUtils.getFiles(getActionsDirectory());
for (File file : files) {
try {
Action action = buildAction((FileUtils.readFile(file)));
String missingKey = FileValidator.isValid(action, REQUIRED_KEYS);
if (missingKey == null... |
c2f73079-29d2-4696-8e43-b228dd9d30a5 | 5 | public LanguagePanel(LanguageDescription lang, Preferences prefs) {
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
this.prefs = prefs;
languagePicker.setEditable(false);
add(buildBoxPanel());
Set<String> correctOrder = new LinkedHashSet<>();
for (ColorProfile profile : lang.d... |
42908b4e-f50a-428a-9daa-e934dd1b360d | 9 | public void render() {
//Draw black square
glDisable(GL_TEXTURE_2D);
Molybdenum.setAwtColor(Color.BLACK);
Molybdenum.GLQuad(0, 0, Display.getWidth(), Display.getHeight());
glEnable(GL_TEXTURE_2D);
Molybdenum.setAwtColor(Color.WHITE);
//Render Map
int w = mapData.WIDTH;
int h = mapData.HEIGHT;
for(in... |
35209ef3-fb7b-408a-b143-60b124953907 | 4 | public int hashCode () {
final int prime = 31;
int result = 1;
result = prime * result + ((declaringClass == null) ? 0 : declaringClass.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * resu... |
da540bce-3050-41a7-89e9-f23572fc044a | 0 | public int getBiggestX(){ return biggestX; } |
290a16da-5712-4986-9085-0af58b632c2c | 4 | public boolean isBST(BTPosition<T> current, T min, T max) {
if (current == null)
return true;
T currentV = current.element();
if (comp.compare(currentV, min) > 0 && comp.compare(currentV, max) < 0)
return isBST(current.getLeft(), min, currentV)
&& isBST(current.getRight(), currentV, max);
else
r... |
e378045a-d2b7-403a-8d6b-4928539471b6 | 6 | public void createRandomBoard(int cols, int rows) {
for(int y = 0; y < cols; y++) {
for(int x = 0; x < rows; x++) {
if(y == 0 || x == 0) {
squares[y][x] = SquareType.OUTSIDE;
}else if(y == cols-1 || x == rows-1) {
squares[y][x] = SquareType.OUTSIDE;
}else {
squares[y][x] = SquareType.val... |
858e1b3e-487e-45b9-898b-5418fa859433 | 0 | public static byte[] decrypt(byte[] data, String password, byte[] salt)
throws Exception {
Key key = toKey(password);
PBEParameterSpec paramSpec = new PBEParameterSpec(salt, 100);
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
return cipher.doFinal(data)... |
ae4b1bee-610f-4315-8dc3-1b04dab7339d | 8 | public long doUpdate(Master master, UpdateRequest updateRequest) {
incrementAccessAndMaybeRecalibrate(master);
File f = updateRequest.getFile();
Location accessLoc = updateRequest.getLocation();
MasterMeta fm = master.map.get(f.getId());
boolean allSucceeded = true;
long maxDelay = -1;
Set<C... |
967fc20d-8592-46e6-a63f-4dd5ea5195aa | 4 | public ActionErrors validate(ActionMapping mapping, HttpServletRequest req)
{
ActionErrors errors = new ActionErrors();
if(username == null || username.length() < 1)
{
System.out.println("Validating....");
errors.add(this.username, new ActionMessage("error.username.required"));
}
if(password == null ||... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.