method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c36725aa-f93a-4790-b84c-cf29e517975e | 2 | public Value newValue(final Type type) {
if (type == Type.VOID_TYPE) {
return null;
}
return new SourceValue(type == null ? 1 : type.getSize());
} |
b91d5594-fb69-4d22-b8e2-94fc35b0bc8b | 6 | public Point playerTakesTurn(Player player, Point selectedLocation) throws Connect4Exception, GameException {
Point locationMarkerPlaced = null;
if (player == null) {
throw new Connect4Exception(ErrorType.ERROR106.getMessage());
}
if (player.getPlayerType() != PlayerType.R... |
38a96dca-6abf-465f-95bf-60a3a2045523 | 2 | public static float getFloatValue(String value) {
if(value != null) {
try {
return Float.parseFloat(value);
} catch(NumberFormatException exception) {}
}
throw new IllegalArgumentException("Invalid value");
} |
591cf506-9e86-486f-abf3-52a1030f4ac8 | 4 | public void start() throws IOException {
myServerSocket = new ServerSocket();
myServerSocket.bind((hostname != null) ? new InetSocketAddress(hostname, myPort) : new InetSocketAddress(myPort));
myThread = new Thread(new Runnable() {
@Override
public void run() {
... |
82bab8b8-8ae3-4b3c-93f2-c7d052ebe1b1 | 0 | public void removeNode(int i) {
nodes.remove(i);
} |
e6bcd971-f193-4ba2-b755-5c447f1bff63 | 8 | public static void traverse(Story story){
//Start game
boolean firstInit = true;
Scanner sc;
while( !story.getCurrent().isEnding()){
if(story.getCurrent().hasBattle()){
//System.out.println("BATTTTLE HEREEEEE");
System.out.println("Battle comme... |
7d2c0495-7c91-4e00-a338-9f445abfca9d | 4 | private void insertCase4(RBTreeNode<K, V> node) {
//If we're the right child of our parent
//and our parent is the left child of our grandparent
if (node == node.parent.right && node.parent == node.grandparent().left) {
//Then we want to perform a left rotation about the parent/
... |
5aa651ae-94a7-4f1f-88f3-e17f9dde0953 | 9 | private XMLNoteImageIcon getIcon() throws SAXException {
XMLNoteImageIcon.Provider prov=_doc.getXMLNoteImageIconProvider();
XMLNoteImageIcon icn=null;
String description="no description";
XMLNoteImageIconSize size=new XMLNoteImageIconSize(-1,-1,XMLNoteImageIconSize.TYPE_PT);
if (prov==null) {
... |
4a216485-c2d6-4454-b8fd-d87ad19e9c02 | 9 | @Override
public boolean equals(Object obj) {
if ((obj == null) || (obj.getClass() != this.getClass())) {
return false;
}
if (obj == this) {
return true;
}
Permissions test = (Permissions) obj;
// id seems to be photo id
if (id == null ... |
ae449d9c-3ccc-44a8-b873-3bf95813ec0f | 6 | private void displayMainMenu() {
int userOption = -1;
//Loop while the user as not selected quit
while (userOption != 5) {
displayMainMenuOptions();
userOption = console.nextInt();
System.out.println("<" + userOption + ">");
//Run the selected function
switch (userOption) {
case ... |
3af47d69-f3ca-464e-a0c9-30c11d7a202c | 6 | static final public void statement() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SELECT:
select_statement();
break;
case DELETE:
delete_statement();
break;
case SAVE:
save_statement();
break;
case SAVEAS:
saveas_statement();
br... |
968eda6d-72b5-459f-ab32-0999bc6d22fa | 4 | private boolean checkConnections(Dijkstra dijkstra, List<Position> base,
List<Position> goals) {
for (Position diamondPos : base) {
boolean foundWay = false;
for (Position goalPos : goals) {
List<Vertex> path = dijkstra.getPath(diamondPos, goalPos);
// needs to be greater than 1
if (path.size() >... |
c37dfd26-0079-46ea-a9e8-91cc97344cdc | 4 | @Override
public void checkMapCollision() {
super.checkMapCollision();
if (x > Constants.GAME_WIDTH) {
MapManager.shiftMap(MapManager.RIGHT);
setLocation(0, y);
}
if (x < 0) {
MapManager.shiftMap(MapManager.LEFT);
setLocation(Constants.GAME_WIDTH, y);
}
if (y > Constants.GAME_HEIGHT) {
MapMa... |
579d8dc7-6ba1-4eb0-8c6c-0f0986d8cb51 | 3 | public int inserir(Cliente c){
Connection conn = null;
PreparedStatement pstm = null;
int retorno = -1;
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setString(1, c.getNome())... |
0059468f-8da3-4d1a-afb9-2760cac78196 | 0 | public void loadImages() {
this.whiteKingImage = this.getImageIcon(this.IMG_KING_WHITE);
this.whiteQueenImage = this.getImageIcon(this.IMG_QUEEN_WHITE);
this.whiteRookImage = this.getImageIcon(this.IMG_ROOK_WHITE);
this.whiteBishopImage = this.getImageIcon(this.IMG_BISHOP_WHITE);
this.whiteKnightImage = this.... |
63fd61db-f3ee-49e9-9161-a5112bd830ac | 3 | public String toString()
{
StringBuffer sb = new StringBuffer();
if ( states != null )
{
for ( int i=0;i<states.length;i++ )
{
sb.append( states[i].toString() );
if ( i<states.length-1 )
sb.append( "," );
}
}
else
sb.append("empty");
return sb.toString();
} |
e33f7628-1f5c-49bd-abb2-19f8d30384a1 | 1 | public SendFile() {
initComponents();
for(String x : ChatBox.usersList){
jComboBox1.addItem(x);
}
} |
a1eeec53-9c2d-4692-a56c-d61eef3a7536 | 1 | public static float[] minus(float[] a, float[] b){
float[] res = new float[a.length];
for (int i = 0 ; i < a.length; i++){
res[i] = a[i] - b[i];
}
return res;
} |
4884509f-960f-45a6-89ae-5f1d8846e255 | 2 | public void open(Player player) {
Inventory inventory = Bukkit.createInventory(player, size, name);
for (int i = 0; i < optionIcons.length; i++) {
if (optionIcons[i] != null) {
inventory.setItem(i, optionIcons[i]);
}
}
player.openInventory(inventory);
} |
7979df23-203e-4dd2-afdd-9769b68c50cc | 5 | private double getDropChance(Player damager) {
FileConfiguration fileConfig = new YamlConfiguration();
FileManager.loadFile(FileManager.Config, fileConfig);
if (damager.hasPermission("staff.owner")) {
return 1.00;
}
else if (damager.hasPermission("rank.vip")) {
return fileConfig.getDouble("Head Drop ... |
d7821e6f-4004-4c33-964f-18717d7f8471 | 1 | private final void removeOnline(HashCounter hc) {
if (onl[hc.mli].remove(new Entry<K,V>(hc.key))) { onlsize--; }
else { cam.remove(hc.key); }
} |
a67079b9-826a-41e6-a881-b8c05085f4a7 | 0 | public void setFile(File file) {
this.file = file;
} |
d6b9991d-36f8-4267-8c5a-4fc271224689 | 8 | private void filterOnDominance(DominatorTreeExceptionFilter filter) {
DominatorEngine engine = filter.getDomEngine();
for (Integer head : new HashSet<>(mapExtPostdominators.keySet())) {
FastFixedSet<Integer> setPostdoms = mapExtPostdominators.get(head);
LinkedList<Statement> stack = new LinkedLi... |
9f21c3be-2b94-44b9-a7e3-340c4b8fc222 | 7 | @Override
public void service( HttpServletRequest req, HttpServletResponse res )
throws IOException, ServletException {
MadProps settings = new MadProps( this.settings );
Map<String, String> headers = new LinkedHashMap<String, String>( 16, 0.75F );
@SuppressWarnings("unchecked")
Enumeration<String> names = re... |
38cd28a6-4d48-4367-b4ca-f3b719f2eef6 | 5 | private void incrementLetterGradeCounter( int grade ) {
switch (grade / 10 ){
case 9:
case 10:
++aCount;
break;
case 8:
++bCount;
break;
case 7:
... |
b203536d-689c-4f72-a1ff-5e3a3ed6fd91 | 7 | protected static BigInteger convertValueToBigIntegerDatatype( Object aValue )
{
if ( aValue == null )
{
return null;
}
else if ( aValue instanceof BigInteger )
{
return (BigInteger) aValue;
}
else if ( aValue instanceof String )
{
String str = (String) aValue;
if ( str.trim().length() == 0 ... |
6f86d7cd-d462-424f-b5b7-f53f49d9797f | 6 | private void drawImage() {
Graphics2D g = (Graphics2D) tileImage.getGraphics();
switch (value) {
case white:
background = new Color(0xFFFFFF);
break;
case red:
background = new Color(0xFF0000);
break;
case blue:
background = new Color(0x0033FF);
break;
case orange:
background = new Colo... |
61ad4412-c76f-4fd5-8270-69d42e2945fa | 6 | public boolean pickAndExecuteAnAction() {
if (!marketBills.isEmpty()){
for (Market market : marketBills.keySet()){
ProcessMarketBill(market, marketBills.get(market));
marketBills.remove(market);
return true;
}
}
for(Bill bill : bills.values()){
if(bill.state == BillState.pendingCustomer){
... |
87b3dfa8-14e2-4cf7-889c-959618cb6c67 | 9 | public void update()
{
if(game)
{
timer++;
if(timer >= 30)
{
timer = 0;
count++;
if(count < Content.song.length)
{
if(Content.song[count].equals("NULL NULL")) {}
else
{
elves.add(new Elf(Content.song[count]));
}
}
else if(count > Content.song.length+3)
... |
8704cb7d-ef1b-4434-9828-93217b597bd9 | 7 | public static void handleEvent(int eventId) throws IOException
{
// return to main menu
if(eventId == 1)
{
System.out.println("Exit new game menu selected");
Main.newGameMenu.setVisible(false);
Main.newGameMenu.setEnabled(false);
Main.newGameMenu.setFocusable(false);
Main.mainFrame.remove(Main... |
9ae76593-6a59-4e95-8803-728a3116413c | 9 | protected void repulse() {
for (int i = 0; i < vertexArray.length; i++) {
// Only go through rest of array and displace both
// vertices at once. Saves 50% CPU
for (int j = i; j < vertexArray.length; j++) {
if (progress.isStopped())
return;
if (i != j) {
// NOTE - this loop forms the q... |
edd85661-69ce-4d42-a1c5-fdb7bb494fe0 | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 62
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 62
... |
d0e0db1d-a750-4374-9b16-f2b56b8c001b | 8 | public boolean isResultRequired(ResultProducer rp, Object[] key)
throws Exception {
if (m_ResultProducer != rp) {
throw new Error("Unrecognized ResultProducer calling isResultRequired!");
}
if (m_Debug) {
System.err.print("Is result required...");
for (int i = 0; i < key.length; i... |
c627137f-293f-430f-89b4-05de9ff6484b | 4 | public double calcWoodNeeded(double inputLength, double inputWidth) {
if (inputLength < 1 || inputLength > 50) { // length value not within the accepted range?
return 0;
}
if (inputWidth < 1 || inputWidth > 50) { // width value not within the accepted range?
return 0;
... |
fe12d336-432a-46c4-86fd-e7a54f5399a0 | 5 | public List<T> find(T start, T goal, StopDemander stop) {
Node<T> startNode = new Node<T>(start, null);
if (start.equals(goal)) {
return startNode.getPathElements();
}
List<Node<T>> queue = new LinkedList<Node<T>>();
Set<T> visited = new HashSet<T>();
queue.add(startNode);
visited.add(start);
... |
127d2e48-38cb-45f7-83a8-8f31edd0f882 | 7 | @Override
public void apply(StateMachineWrapperAcceptor<EventType> machine, StateMachineWrapperAcceptor<EventType> wrapped)
throws FSMWrapperException {
if (wrapped instanceof FSMWrapper) {
wrapped.acceptWrapperTransport(this);
} else {
if ... |
ecf33b04-3c6f-4bac-a45b-44584f3de06f | 1 | public AlgorythmFile getFile(int index){
if( dataBaseFiles != null){
return dataBaseFiles.get(index);
}
return null;
} |
9a70c922-48ad-4e28-8410-c14f45df296b | 1 | public void doConnect() {
synchronized (this) { //atomic
connections++;
System.out.println("Current connections (max 10 allowed): " + connections);
}
try {
//do your job
System.out.println("Working on connections " + Thread.currentThread().getName(... |
6200c3df-2c6f-492b-ae6a-b49c6a816679 | 2 | public void resize(int w, int h) {
if (w == width() && h == height())
return;
width_ = w;
height_ = h;
createImage(w, h);
} |
c85e541b-a9ef-4510-9f45-5d6f7d65a9f6 | 8 | public static boolean readFailure(String fileName,int nodeID){
System.out.println("Reading Failure for"+nodeID);
BufferedReader bReader = null;
try {
bReader = new BufferedReader(new FileReader(fileName));
String line = bReader.readLine();
boolean firstLine=true;
while(line!=null){
if(firstLine){... |
f474cb06-77fb-4d8d-bfa3-8460f1a4a874 | 5 | private static void writeMethods(final ClassEditor ce,
final DataOutputStream dos) throws IOException {
// Sort constructors by their names and signatures
final SortedSet sorted = new TreeSet(new Comparator() {
public int compare(Object o1, Object o2) {
MethodEditor me1 = (MethodEditor) o1;
MethodEdi... |
0fa59ff6-6c4a-48a4-a760-842f40f6e603 | 6 | public static TransitionCreator creatorForAutomaton(Automaton automaton,
AutomatonPane parent) {
if (automaton instanceof automata.fsa.FiniteStateAutomaton)
return new FSATransitionCreator(parent);
if (automaton instanceof automata.pda.PushdownAutomaton)
return new PDATransitionCreator(parent);
if (autom... |
011ce5e9-ac4a-4fbd-bd7b-d7c9115a540e | 3 | private boolean detectgay() {
for (int y = 0; y < sz.y; y++) {
for (int x = 0; x < sz.x; x++) {
if ((img.getRGB(x, y) & 0x00ffffff) == 0x00ff0080)
return (true);
}
}
return (false);
} |
7c7ed43a-5a52-429f-8191-99b14b0ff490 | 5 | public void testRec(Configuration conf,byte depth){
depth++;
nbAppelListeFils++;
if (depth == 2)
System.out.println("nbappelListeFils : "+nbAppelListeFils);
ArrayList<Configuration> listeConfig = listeFils(conf);
if (depth<depthMax){
for (Configuration c : listeConfig) {
testRec(c, depth);
... |
10dcb755-8a8d-43ea-bad5-9d217561e0de | 0 | public TaskRunner<T> getTaskRunner() {
return taskRunner;
} |
9882446b-3da5-4166-8d06-1970ff51b263 | 8 | public ConstructorAccessBenchmark () throws Exception {
int count = 1000000;
Object[] dontCompileMeAway = new Object[count];
Class type = SomeClass.class;
ConstructorAccess<SomeClass> access = ConstructorAccess.get(type);
for (int i = 0; i < 100; i++)
for (int ii = 0; ii < count; ii++)
dontCompileMeA... |
2a99221f-db93-4940-be9d-7c46a5a0ed5d | 2 | private void populateEntity() {
enemys = new ArrayList<Enemy>();
entities = new ArrayList<EntitySpecial>();
Slugger s;
Crawler s2;
Point[] points = new Point[] {};
Point[] points2 = new Point[] {};
for (int i = 0; i < points.length; i++) {
s = new Slugger(tileMap);
s.setPosition(points[i].x, points[... |
aee2b814-8ba5-4d6d-9034-ce08feaa7293 | 2 | public void render(Graphics g) {
if (hitTimeLeft > 0) {
g.setColor(Color.green);
g.fillOval(x - radius, y - radius, radius * 2, radius * 2);
} else if (active) {
g.setColor(Color.red);
g.fillOval(x - radius, y - radius, radius * 2, radius * 2);
} else {
g.setColor(Color.yellow);
g.drawOval(x - r... |
3652d5ac-9f6e-4f5b-a6b8-eb05be692b6e | 0 | public String getResponse()
{
return response;
} |
098c4f8e-2dad-4ea4-a37e-e0ac2058d51e | 5 | public void processConnectionEvent(ConnectionEvent ce) {
for (int i = 0; i < m_Listeners.size(); i++) {
ConnectionListener cl = m_Listeners.elementAt(i);
if (ce.isType(ConnectionEvent.CONNECTION_IDLE)) {
cl.connectionIdle(ce);
} else if (ce.isType(ConnectionEv... |
1497096e-fedb-46c6-a3b3-0e1e80faa510 | 6 | static CreateToken show(JFrame parent) {
JPanel contentPane = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = GridBagConstraints.RELATIVE;
c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(2, 2, 2, 2);
if (red == ... |
3c63c7eb-f1b9-4c98-8349-5ff1ea8788c5 | 1 | @Override
public void addCandidate(Route route)
{
if (withinLimit(route))
{
routes.add(route);
}
} |
60458e7b-1890-4516-a833-03f3aa15ca09 | 5 | public void selecionarRobo(int x, int y) {
boolean daVez = this.isJogadorDaVez();
if (daVez){
Posicao posicao = this.tabuleiro.recuperarPosicao(x, y);
boolean ocupada = posicao.estaOcupada();
Robo roboDaVez = posicao.informaRobo();
if (ocupada && roboDaVez... |
a796fb82-2701-46ac-9e38-f94ddae487f6 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Stationofficer)) {
return false;
}
Stationofficer other = (Stationofficer) object;
if ((this.stationOfficerID =... |
2a594d2b-e35f-4be9-b690-56c5d327a387 | 5 | private void checkDead() {
for (int row = 0; row < ROWS; row++) {
for (int col = 0; col < COLS; col++) {
if (board[row][col] == null)
return;
if (checkSurroundingTiles(row, col, board[row][col])) {
return;
}
}
}
dead = true;
if (score >= highScore) {
highScore = score;
}
// TO... |
897804d4-7c35-4cc5-bdca-c089f3f7e995 | 5 | public String[] getSequence()
{
List<String> sequenceCmds = new ArrayList<String>();
try{
m_fStream = new FileInputStream(SEQUENCE_FILENAME);
m_dataInStream = new DataInputStream(m_fStream);
m_reader = new BufferedReader(new InputStreamReader(m_data... |
6409d565-ff8a-4b12-bbdc-02524443b992 | 3 | public void updateGrid(ImageIcon[][]plateau){
images=plateau;
for (int i=0; i<this.getRowCount()+hauteurZoneFantome;i++){
for (int j=0;j<this.getColumnCount(); j++){
if (i>=hauteurZoneFantome){
this.setValueAt(images[i][j], i-hauteurZoneFantome, j);
... |
89d173a4-b2fd-43df-a140-56d5c90bcaa1 | 3 | public void sort(double[] input) {
for (int i = 1; i < input.length; i++) {
for (int j = i; j > 0 && Helper.less(input, j, j-1); j--) {
Helper.exch(input, j-1, j);
}
}
} |
c90313fe-204e-402d-990b-725e4d8fed9c | 8 | public void drop(DropTargetDropEvent evt) {
// Called when the user finishes or cancels the drag operation
try {
Transferable transferable = evt.getTransferable();
if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);... |
3db2fd8f-d52a-4b43-b16a-a9afd1975dfa | 4 | public void removeAll(String type) {
if (type == "wav") {
for (int i = 0; i < clips.size(); i++) {
clips.remove(i);
}
} else if (type == "ogg") {
for (int i = 0; i < oggs.size(); i++) {
oggs.remove(i);
}
} else {
game.log.jukebox("unknown file type '" + type + "'");
}
} |
bc741df0-1b7b-44cb-8934-ad8b23d2d8d7 | 1 | public ArrayList<Rectangle2D.Float> setUpBars(int[] histogram) {
int max = maxBar(histogram);
ArrayList<Rectangle2D.Float> histoBars = new ArrayList<Rectangle2D.Float>();
float graphicsScale = ((float) PIXELS_HEIGHT * verticalSizeInt) / max;
for (int i = 0; i < StatInfo.nbars; i++) {
float htop = top
+... |
6bd2a9d2-859c-445d-a700-81e9f93fec50 | 4 | public void close () {
connectedAddress = null;
try {
if (datagramChannel != null) {
datagramChannel.close();
datagramChannel = null;
if (selectionKey != null) selectionKey.selector().wakeup();
}
} catch (IOException ex) {
if (DEBUG) debug("kryonet", "Unable to close UDP connection.", ex);
... |
672789ef-3ede-4576-9199-5658c3951bc4 | 9 | @Override
public Staff getStaff(final int index) {
Staff staff = super.getStaff(index);
/* We need to populate key/clef/timeList with events from the past */
if (staff != null && !staff.isEmpty()) {
final Fraction startMoment = staff.get(0).getMoment();
for (Event event: part.getMu... |
4f6a74cb-2c70-42ed-8f67-a60a32e71716 | 5 | static final String method2157(int i, int i_15_) {
anInt6238++;
if (i_15_ != -1431655765)
method2157(-27, 75);
Class348_Sub15 class348_sub15
= ((Class348_Sub15)
Class27.aClass356_389.get((long) i));
if (class348_sub15 != null) {
Class348_Sub23_Sub4 class348_sub23_sub4
= ((Class348_Sub15) cl... |
42050435-e366-4b92-8a50-294d6c9d3ea3 | 8 | private void pivot(int p, int q) {
// everything but row p and column q
for (int i = 0; i <= M; i++)
for (int j = 0; j <= M + N; j++)
if (i != p && j != q) a[i][j] -= a[p][j] * a[i][q] / a[p][q];
// zero out column q
for (int i = 0; i <= M; i++)
... |
d8baecd1-d589-47e1-b21d-55a7c5ee0f0a | 1 | public boolean ModificarPropietario(Propietario p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} |
f833bf0a-2481-4029-b9c2-855440a73206 | 9 | public static <T extends Buffer<T>> long copy(ReadableContainer<T> input, WritableContainer<T> output, T buffer) throws IOException {
long read = 0;
long totalCopied = 0;
// if the output is limited and we know the limit, only read as much as you can write from the input
// otherwise we are forced to throw an e... |
8cee6e23-a11c-4f65-b0bd-3e24c94279f1 | 9 | private static void calculateOverlap(String nameSetA, EnumMap<RatChromosomes, ArrayList<Deletion>> deletionSetA, String nameSetB, EnumMap<RatChromosomes, ArrayList<Deletion>> deletionSetB) {
//initialize the maps to store the concordant and discordant call
EnumMap<RatChromosomes, ArrayList<Deletion>> c... |
813783fb-b872-4d73-ab9a-350805566f9d | 7 | @Override
public void affectPhyStats(Physical mob, PhyStats stats)
{
super.affectPhyStats(mob,stats);
if(((toDoCode==CODE_UPENVPER2)||(toDoCode==CODE_UPENVPER5))
&&(toDoString.length()>0)
&&(invoker()!=null))
{
int lvl=adjustedLevel(invoker(),0);
if(toDoCode==CODE_UPENVPER2)
lvl=lvl/2;
else
... |
c2836d7c-70d2-4413-830f-0cf484e15713 | 4 | public String execute() throws Exception {
// Il messaggio di Hello va provato qualche volta, per dare
// il tempo agli altri server di essersi settati.
for (int i=0; i<NetConstants.HelloRetry; ++i) {
try {
Registry registry = LocateRegistry.getRegistry(destPeer.IPaddr, destPeer.serverPortno);
ServerSi... |
0bd0524a-6569-4376-a788-1e23e58f14b7 | 4 | private void editBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editBtnActionPerformed
EditQuestionFIB editQPanel = new EditQuestionFIB();
editQPanel.setDefaultCloseOperation(this.DISPOSE_ON_CLOSE);
editQPanel.addWindowListener(new java.awt.event.WindowAdapter() {
... |
b4af2bf3-4af5-42fd-a475-c99ceab47080 | 3 | private void createPreferences(){
Preferences pref = Preferences.getInstance();
if (!pref.containsKey("AutonomousCommand")){
pref.putString("AutonomousCommand", autonomousDefault);
}
if (!pref.containsKey("ActuatorVertical")){
pref.putInt("ActuatorVertical", 270);... |
6a05395b-d3a9-49b0-821c-0fa0b7f3bb2c | 6 | public void setVertex2(final int x, final int y, final int z) {
if (this.x2 != null && this.y2 != null && this.z2 != null && this.x2 == x && this.y2 == y && this.z2 == z) return;
this.x2 = x;
this.y2 = y;
this.z2 = z;
this.refresh();
} |
b6485a9d-f427-4f48-b1ee-3c12a914e838 | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
ServerView window = new ServerView(null);
window.frmProgrammingContestSystem.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
7d911b5a-4190-433f-aeaf-fc4fc750c6cb | 6 | public static String longestCommonPrefix(String[] strs) {
if (null == strs || 0 == strs.length) return "";
String prefix = strs[0];
for (int i = 0; i < strs.length; i++) {
String str = strs[i];
int j = 0;
for(j = 0; j < prefix.length(); j++) {
if (j >= str.length() || prefix.char... |
585b83f6-3cb4-4745-bcfc-5fe076d75c97 | 0 | public static void main(String[] args) {
TreeNode treeNode1=new TreeNode(1);
TreeNode treeNode2=new TreeNode(2);
TreeNode treeNode3=new TreeNode(3);
treeNode1.left=treeNode2;
treeNode1.right=treeNode3;
BinaryTreeSerialize binaryTreeSerialize=new BinaryTreeSerialize();
... |
ca01c2ad-0aee-44a0-8316-81e0978f3b96 | 7 | @Override
public MapLayer createDiff(MapLayer ml) {
if (ml == null) { return null; }
if (ml instanceof TileLayer) {
Rectangle r = null;
for (int y = bounds.y; y < bounds.height + bounds.y; y++) {
for (int x = bounds.x; x < bounds.width + bounds.x; x++) {
... |
bab5390c-11de-4c2a-8876-10ae55ace529 | 7 | public ICSVTypeConverter<?> getConverter(Field field) {
ICSVTypeConverter<?> ret = converters.get(field);
// yep - marker interface, this is primitive, lets find a normal
// converter for it
if (ret.getClass() == MarkerConverter.class) {
Class<?> queryType = field.getType();
// here is a list auto boxed... |
9b9d1e00-6970-492f-a564-62043124662a | 4 | public void send_msg(String empf, String inhalt) {
int triesLeft = MAX_RETRIES;
do {
try {
server.newMessage(empf, inhalt);
System.out.println("Message sent!");
break;
} catch (RemoteException ex) {
triesLeft--;
System.out.println("Failed to send message.");
System.out.println("Retr... |
eae6fc54-f235-47e6-9c1c-bc20e715d74a | 0 | public void setType(String value) {
this.type = value;
} |
47ff33ea-8c16-4c81-ad10-e07d4743d323 | 1 | public List<String> getMethods(){
List<String> returnList = new ArrayList<String>();
for(int i = 0; i<methods.size();i++){
returnList.add("<" + className + ": " + methods.get(i) + ">");
}
return returnList;
} |
6fe3b082-d2c3-4607-a015-c5f4466b0506 | 9 | public void setResources(){
if(location.equalsIgnoreCase("Arts & Entertainment"))
resourceSet = new Resources(0.65f, 0.025f, 0.025f, 0.025f, 0.25f, 0.025f);
else if(location.equalsIgnoreCase("College & University"))
resourceSet = new Resources(0.05f, 0.75f, 0.05f, 0.05f, 0.05f, 0.05f);
else if(location.equa... |
b22788ae-beba-4c13-8ee1-4ab3a59a514c | 6 | public BasicTabuStageParams(Solution solution,
double initialAlpha,
int beta,
int p,
int q,
int minTheta,
int maxTheta,
int maxSteps) {
super(maxSteps, minTheta, maxTheta);
if (solution == null) {
throw new I... |
723874a6-ce2f-4ec9-ba59-8531deffc949 | 6 | public StandardDecrypter(
EncryptionAlgorithm encryptionAlgorithm,
PDFObject documentId, int keyBitLength,
int revision, byte[] oValue, byte[] uValue, int pValue,
boolean encryptMetadata, PDFPassword password)
throws
IOException,
Encryp... |
a383921f-408a-4c66-8575-6aac5758e2c1 | 2 | @Test
public void testData(){
User user = dataStoreImpl.getUser("randomUser");
Set<Account> accounts = dataStoreImpl.getAccounts(user);
Set<Record> records = new HashSet<Record>();
for (Account a: accounts){
records.addAll(dataStoreImpl.getRecords(a));
}
assertEquals(10, records.size())... |
c1928757-7eb9-45b6-9ddd-93fbdbd55d1e | 4 | @Override
public final int compareTo(final Path o) {
if (this == o) {
return 0;
}
final int m = getNameCount();
final int n = o.getNameCount();
final int min = m > n ? n : m;
for (int i = 0; i < min; i++) {
final String mS = getComponentAt(i);
final String nS = o.getComponentAt(i);
final int c ... |
5e6a04c2-73c1-4487-a6b3-3610866da1f0 | 9 | static AccessPoint importAccessPoint(Element element, String attribute,
String circuitName, SEPFormatConverter converter,
boolean funckitFormat) throws SEPFormatImportException {
AccessPoint point;
if (funckitFormat) {
UUID uuid = converter.ensureUUID(element, "fck:" ... |
a36ecf0d-6e45-44f6-b2dd-54036ff199d8 | 1 | public VariableStack mapStackToLocal(VariableStack stack) {
/*
* There shouldn't be any JSR blocks remaining, but who knows.
*/
/*
* The innerBlock is startet with a new stack entry (return address) It
* should GOTO immediately and never complete.
*/
LocalInfo retAddr = new LocalInfo();
retAddr.s... |
d7e8608c-cdf4-49c5-8ccf-a4eb3d124e60 | 8 | @SuppressWarnings("deprecation")
protected boolean isDate(String date){
if (date.length() < 8) return false;
String sMonth = date.substring(0, 2);
String sDay = date.substring(3, 5);
String sYear = date.substring(6);
int month;
int day;
int year;
try{
month = Integer.valueOf(sMonth);
day = Integ... |
f044156e-a322-42f3-9d45-292b04f57751 | 7 | public PageFetcher(CrawlConfig config) {
super(config);
HttpParams params = new BasicHttpParams();
HttpProtocolParamBean paramsBean = new HttpProtocolParamBean(params);
paramsBean.setVersion(HttpVersion.HTTP_1_1);
paramsBean.setContentCharset("UTF-8");
paramsBean.setUseExpectContinue(false);
params.setP... |
255fd557-91d5-4c85-989a-28ec915e5eb6 | 9 | private Command[] readCommandSystem(String fileName, int lcount) throws FileNotFoundException, NumberFormatException, IllegalArgumentException {
Scanner in = new Scanner(new FileReader(new File(fileName)));
Vector<Command> commands = new Vector<Command>();
while(in.hasNextLine()) {
String[] tokens = in.nextLin... |
e5fcfe66-8c3c-4559-b837-b754ef94b2cd | 4 | public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
thr... |
6f31b274-f6cd-41ae-80b1-99f4478787cf | 8 | private static boolean encodeUnescaped(char c, boolean fullUri) {
if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')
|| ('0' <= c && c <= '9'))
{
return true;
}
if ("-_.!~*'()".indexOf(c) >= 0)
return true;
if (fullUri) {
return U... |
b82596fb-f161-4bb3-bd55-115f8fce3ef2 | 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... |
084b609f-7bf7-4ee3-ab3c-8607b3297fd1 | 4 | public static void assignTeams()
{
Random rand = new Random();
int random, p = players.length, bigTeam = 0;
for (int i = 0; i < p; i++)
{
random = rand.nextInt(teams.length);
if(teams[random].getPlayers().size() < (p / teams.length)) //balance out teams
{
teams[random].register(players[i... |
fb496e62-cbc4-4bb3-b2e1-2831e281d03d | 1 | @Override
public double distribute(TVC newCon) {
try {
stepsCount = 0;
SortedSet<TVC> conns = environment.getConnectionsSortedUp();
return walkThrough(conns.toArray(new TVC[conns.size()]), environment.getFirewalls());
} catch (Exception e) {
throw new RuntimeException("fatal error", e)... |
facbfb23-3f87-4d4f-b40f-0d44ef344d90 | 4 | public boolean equals(Object other)
{
if(other==null || !(other instanceof Posizione))
return false;
Posizione altra=(Posizione) other;
if(riga==altra.riga && colonna==altra.colonna)
return true;
return false;
} |
3ecac23b-a827-4d19-babf-519c055895cf | 6 | @Override
public void mouseDragged(MouseEvent e) {
if(Orientation==HORIZONTAL){
if(parent.getWidth()+e.getX()-pos.x>min){
if(e.isControlDown())
parent.setPreferredSize(
new Dimension(round(parent.getWidth()+e.getX()-pos.x),
... |
a705b34a-4c93-4cf0-b7a3-a92ef96a14ec | 0 | public Tile(int x, int y) {
this.x = x;
this.y = y;
} |
b8f2d66d-3461-4170-98ed-b27570e4bc5e | 1 | public void testSetInterval_RI_RI2() {
MutableInterval test = new MutableInterval(TEST_TIME1, TEST_TIME2);
try {
test.setInterval(new Instant(TEST_TIME1 - 1), new Instant(TEST_TIME1 - 2));
fail();
} catch (IllegalArgumentException ex) {}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.