method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b28a488e-0550-4956-9a3f-624632e6ab52 | 0 | public String getValue() {
return value;
} |
bf99a10f-243b-4186-ba7f-eb96730ab326 | 6 | static Implementation getImplementation(
String baseName,
String algorithm,
String provider)
throws NoSuchProviderException
{
if (provider == null)
{
Provider[] prov = Security.getProviders();
//
// search every prov... |
147e0c79-99f9-4fa8-ab24-d2f12cfa5597 | 1 | private boolean jj_3_71() {
if (jj_scan_token(OR)) return true;
return false;
} |
ddf608dd-65ef-43f2-8139-a6782d91dfe5 | 5 | @Override
public void endElement(String uri, String localName, String qName) {
switch (localName) {
case TagConstants.ARTIFICIAL_FLOWER_TAG:
case TagConstants.NATURAL_FLOWER_TAG:
case TagConstants.CUT_FLOWER_TAG:
floralComposition.addFlower(currentFlower);... |
c15c41ef-7185-4c01-9f23-debac7b1415d | 4 | public void setSelectedItem(Object item) {
if ((selected != null && !selected.equals(item))
|| (selected == null && item != null)) {
// YUCK from useing generics + old SWING stuff
selected = (T)item;
fireContentsChanged(this, -1, -1);
}
} |
506fbdaf-9866-4fe0-b154-c36250e83b4c | 2 | public void testPropertyCompareToMonthOfYear() {
MonthDay test1 = new MonthDay(TEST_TIME1);
MonthDay test2 = new MonthDay(TEST_TIME2);
assertEquals(true, test1.monthOfYear().compareTo(test2) < 0);
assertEquals(true, test2.monthOfYear().compareTo(test1) > 0);
assertEquals(true, te... |
22e1e057-c56f-4ead-a2d2-52f112b6dc54 | 2 | public void fin() {
total = System.nanoTime() - then;
nm = new String[nw.size()];
prt = new long[pw.size()];
for(int i = 0; i < pw.size(); i++) {
nm[i] = nw.get(i);
prt[i] = pw.get(i);
}
hist[i] = this;
if(++i >= hist.length)
i = 0;
pw = null;
nw = null;
} |
ca8785e9-f5a7-4405-a81c-1800244b9984 | 4 | public List<Booking> getBookingsOfRenter(String authToken, String renterID) throws AccessException{
if(authToken != "abcd1234") throw new AccessException("Access denied");
Renter r = this.getRenterByID(authToken, renterID);
try{
List<Booking> b = r.getBookings();
if(b == null || b.size() == 0) throw new Bus... |
609b2467-a321-43e4-818e-45ba58ec10e4 | 0 | public String getName() {
return s;
} |
b22ef2cc-5fb9-4038-95a0-6afc38608053 | 0 | @Override
public void keyTyped(KeyEvent e) {
} |
0406e65f-2dba-4320-afb3-a071dc6900bf | 3 | public ArrayList<ArrayList<Integer>> levelOrder(TreeNode root) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
ArrayList<Integer> row = new ArrayList<Integer>();
if (root == null) {
return result;
}
TreeIterator iterator = new TreeIter... |
17040744-d829-418b-afd0-ec3e52090934 | 8 | public static void main(String[] args) throws Exception
{
// the first row and last column were manually removed...
File inFile = new File( ConfigReader.getBigDataScalingFactorsDir() + File.separator +
"MouseDonors" + File.separator + "otu_table_edited.txt");
File outFile = new File( ConfigReader.getBigD... |
0d6d0e91-83ef-4084-89fe-e41f0f80b8d5 | 3 | private void readDataFromTextFile() throws IOException
{
//read each data line or until end of file reached
String line;
if ((line = in.readLine()) != null){
dataVersion = line;
}
for (int i=0; i<DATA_SIZE; i++){
if ((line = in.readLine()) == null) { break; }
data[i] ... |
b62b71a3-ae3b-4620-a590-585214aec20b | 9 | private HttpRespons send(String urlString, String method,
Map<String, String> parameters, Map<String, String> propertys)
throws IOException {
HttpURLConnection urlConnection = null;
if (method.equalsIgnoreCase("GET") && parameters != null) {
StringBuffer param = new StringBuffer();
int i = 0;
for (... |
569f4e83-b2b1-4a35-80da-abfb919308ac | 9 | public static ListNode detectCycle(ListNode head) {
if (head == null || head.next == null || head.next.next == null)
return null;
ListNode oneStep = head.next;
ListNode twoStep = head.next.next;
ListNode ecounterPoint = null;
while (twoStep != null) {
if (oneStep == twoStep) {
ecounterPoint = oneSt... |
78488ef6-fbb4-4e11-8625-0f9e4ba946d0 | 3 | static String normalize(String address){
if(address==null){ return "localhost"; }
else if(address.length()==0 || address.equals("*")){ return ""; }
else{ return address; }
} |
f74e5f2f-e5bf-49f2-be9a-43b9fdff343b | 9 | public boolean confirmPossibleMaterialLocation(int resource, Room room)
{
if(room==null)
return false;
final Integer I=Integer.valueOf(resource);
final boolean isMaterial=(resource&RawMaterial.RESOURCE_MASK)==0;
final int roomResourceType=room.myResource();
if(((isMaterial&&(resource==(roomResourceType&Ra... |
34dac86b-5eaa-4123-8fd6-cdbeb894c0b0 | 7 | private void addVarOp(int op, int varIndex)
{
switch (op) {
case Token.SETCONSTVAR:
if (varIndex < 128) {
addIcode(Icode_SETCONSTVAR1);
addUint8(varIndex);
return;
}
addIndexOp(Icode_SETCONSTVAR, varIndex);
... |
266ffe7f-7acb-4dca-8e40-19d60f1c109c | 4 | public int checkWin(Player player){
int playerHandValue = player.getHand(1).isBust() ? 0 : player.getHand(1).getValues().get(0);
int dealerHandValue = dealer.getHand(1).isBust() ? 0 : dealer.getHand(1).getValues().get(0);
if(playerHandValue > dealerHandValue){
return 1;
}
else if(playerHandValue < dealerH... |
6811fd4c-aa4d-4200-9e27-6146b2934110 | 4 | public Event get_next_double_cpu() {
Event out = null;
double min = Double.MAX_VALUE;
if (tempoCPU1 < min) {
min = tempoCPU1;
out = Event.CPU1;
}
if (tempoCPU2 < min) {
min = tempoCPU2;
out = Event.CPU2;
}
if (tempoA... |
316b3d13-4dab-49bd-bb67-be8d56387a0c | 9 | public Component getRendererComponent(SubGraph sd) {
sgbck=sd;
final SubGraph mysd = new SubGraph(sd.graph);
mysd.vertices = new HashSet<Vertex>(sd.vertices);
mysd.edges = new HashSet<Edge>(sd.edges);
mysd.label = sd.label;
String txt = "";
txt = "<HTML><BODY>";
... |
7b262cca-930c-488f-ba8e-6d547d89caf3 | 5 | @Override
public String toString() {
if (type == VariableType.ARRAYLIST) {
StringBuilder str = new StringBuilder();
str.append("[");
for (Value val : (ArrayList<Value>) value) {
str.append(val.toString());
if (!val.equals(((ArrayList<Valu... |
cc4affb4-5bc1-4e55-9344-4122fa9b81ac | 2 | private static void myMenu(BufferedReader br, ServiceInterface obj,
Scanner cs) throws IOException {
// TODO Auto-generated method stub
System.out.println("1 Update");
System.out.println("0 Logout");
int val = cs.nextInt();
if (val == 0)
showMenu(br, obj, cs);
else if (val == 1)
update(br, obj, c... |
8b736dec-02fd-417a-8d75-a4c24649a4a4 | 2 | public static List<String> getAvailableLanguages () {
List<String> result = new ArrayList<String>();
result.add("");
for (String language : Locale.getISOLanguages()) {
String fileName = MESSAGE_BASENAME + "_" + language + ".properties";
URL url = MessageUtils.class.getClassLoader().getResource(CONFIG_DIR + ... |
3285627c-c89e-405c-a9c2-625c30036880 | 5 | public static void main(String[] args) {
// TODO Auto-generated method stub
String s = "Hello a olleH";
String str = "aaaa aabaa bbb samaaiaaksl iiii aisk";
String1 strObj = new String1();
String palindromeWords="";
String wordswithVowelInMid="";
if(strObj.isPalindrome(s))
System.out.println(... |
164d4d26-3072-4e27-ab91-4f2c7d745474 | 0 | public EsteTest() {
} |
67efee71-93d4-4fdf-b955-f967e32f29f8 | 1 | public void updateDisplay() {
if (this.stock != null) {
this.setTitle("Edit stock \"" + this.stock.getName() + "\"");
this.txfName.setText(this.stock.getName());
this.cbxType.setSelectedItem(stock.getType());
this.txfCapacity.setText(stock.getCapacity() + "");
this.txfMaxTrays.setText(stock.getMaxTrays... |
eb8e86dc-f554-4dc5-b416-a6196ffa1795 | 7 | private boolean isDragOk(final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt) {
boolean ok = false;
// Get data flavors being dragged
java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
// See if any of the flavors are a file list
int... |
7e73ebbc-b540-4b71-98f5-bfeaab56baa6 | 5 | @Override
public void run()
{
long previousTime = System.currentTimeMillis();
long currentTime = previousTime;
if( soundSystem == null )
{
errorMessage( "SoundSystem was null in method run().", 0 );
cleanup();
return;
}
... |
453ad5f6-9f62-4b56-a4f4-cb6d9309e131 | 6 | static int lowestBoard(Circuit circuit) {
int ypos = 0;
StringReader sr = new StringReader(circuit.toString());
StreamTokenizer st = new StreamTokenizer(sr);
st.parseNumbers();
try {
while (st.nextToken() != -1) {
if (st.ttype == -3 && st.sval.equals("Board") && st.nextToken() == -3) {
st.nextTok... |
26252442-9073-4834-8f6c-c799a29a8b0f | 9 | Space[] won() {
int n = numToWin - 1;
if (lastSpaceMoved == null)
return null;
int[] pos = lastSpaceMoved.getPos();
for (int i = 0, rowInd = pos[0]; i <= n; i++, rowInd = pos[0] - i)
for (int j = 0, colInd = pos[1]; j <= n; j++, colInd = pos[1] - j) {
boolean outOfBounds = rowInd < 0 || colInd < 0
... |
32270284-efc7-43af-b81c-193959bff261 | 3 | static String[] getPortForwarding(Session session){
java.util.Vector foo=new java.util.Vector();
synchronized(pool){
for(int i=0; i<pool.size(); i++){
PortWatcher p=(PortWatcher)(pool.elementAt(i));
if(p.session==session){
foo.addElement(p.lport+":"+p.host+":"+p.rport);
}
}
}
String[] ... |
6fe4e5d8-5e66-49a6-86d0-686d632c9030 | 6 | public void renderSlot(int id, float x, float y, int mx, int my, boolean[] buttons, boolean selected)
{
super.renderSlot(id, x, y, mx, my, buttons, selected);
String n = file.getName();
if(file.isDirectory() && !file.getName().endsWith(File.separator))
n+=File.separator;
if(!FontRenderer.drawStringInBounds(... |
a76b4ead-80d8-4096-9053-ce1d5313e885 | 9 | private static double[][] normalizeDensity(double[][] unNormDensity){
// The number of gridlines across the density domain
int numGridLines = getNumGridlines();
int iter = 0; // How many normalization cycles have been performed
double threshold = Math.pow(10, -8); // The maximum acc... |
b5c2bfc6-66c3-4789-94e7-3c57ddab1284 | 2 | public boolean Salvar(Produto obj){
try{
if(obj.getId() == 0){
PreparedStatement comando = bd.getConexao()
.prepareStatement("INSERT INTO produtos (nome,descricao,"
+ "valor_uni_Compra,valor_uni_Venda,ativo) VALUES (?,?,?,?,1)");
... |
6490a035-ff71-4f7e-a2da-f284b8ef8b5d | 8 | public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.ge... |
8c177cea-6698-4410-a4aa-fb83c68298c4 | 7 | public static void stopMusic()
{
if(BATTLE_TYPE.equals("WILD"))
{
if(!Mechanics.isLegendary(enemy[0]))
wildMusic.stop();
else
fatefulMusic.stop();
}
else if(BATTLE_TYPE.equals("TRAINER"))
{
if(b1.trainer.type==Trainer.TrainerType.JAVA)
javaMusic.stop();
else
traine... |
13af777b-1fe3-45d9-89a1-9992d9aec6a8 | 5 | public static void main(String[] args) throws Exception {
String languagesList = (args.length>0) ? args[0] : "en";
String dirName = (args.length>1) ? args[1].replace( '\\', '/' ) : "";
if(dirName.length() > 0 && !dirName.endsWith( "/" )){
dirName += '/';
}
String[] l... |
3f894b78-24dd-4e3d-bbc1-338fdf964b12 | 4 | public synchronized void mouseMoved(MouseEvent e) {
// this event is from re-centering the mouse - ignore it
if (isRecentering &&
centerLocation.x == e.getX() &&
centerLocation.y == e.getY())
{
isRecentering = false;
}
else {
int dx... |
294882bf-8155-4898-98ba-bebfec475911 | 6 | public void readHistory(DataInput input) {
try {
int unused = input.readInt(); // VERSION = 1
int commandCount = input.readInt();
if (directoryCombo == null) {
directoryCombo = new JComboBox();
}
for (int i = 0; i < commandCount; ++i) ... |
fdce4491-999d-4ba8-8700-1c74913ab19d | 2 | protected DateTimeField getField(int index, Chronology chrono) {
switch (index) {
case 0:
return chrono.year();
case 1:
return chrono.monthOfYear();
default:
throw new IndexOutOfBoundsException();
... |
e1c3da47-00d0-4657-9ff6-1cdae923055f | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
5f059f3e-dae9-45b9-9001-4421db6da362 | 9 | private double hilb_index(double x, double y, int lvl){
if (lvl==0) return x;
if ( x<0.5 && y<0.5 )
return hilb_index(y*2, x*2, lvl-1)*0.25;
if ( x<0.5 && y>=0.5)
return 0.25 + hilb_index(x*2, y*2-1, lvl-1)*0.25;
if (x>=0.5 && y<0.5)
return 0.75 + hilb_index(1-y*2, 2-x*2, lvl-1)*0.25;
if (x>=0.5 ... |
931a0b8b-e71d-4433-9fc7-5c7567544a4e | 1 | private boolean jj_2_62(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_62(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(61, xla); }
} |
58b938e7-a0da-4094-bf23-b6a74bf8aeea | 6 | private boolean overlaps(Piece pi, int x0, int y0) {
if( pi.w() + x0 > w() ){
return true;
}
if( pi.h() + y0 > h() ){
return true;
}
for( int x = 0 ; x < pi.w() ; x++ ){
for( int y = 0 ; y < pi.h() ; y++ ){
if( pi.contains(x, y) ){
if( _board[x+x0][y+y0] != null ){
return true;
... |
ad66b637-5a73-4b27-9310-fc33e2997c5c | 2 | public int I(Privacy p) {
switch (p) {
case PUBLIC:
return 0;
case PROTECTED:
return 1;
}
return 2;
} |
6bb9fb8e-8ef1-48b3-b702-d72d79934dc8 | 9 | public void start(){
try {
//ServerSocket serverSocket = new ServerSocket(port);
while(true){
if(shutdown){
break;
}
Socket socket = getServerSocket().accept();
Request request = new Request(socket);
Response response = new Response(socket);
... |
4bac8f4a-24ff-46af-8581-d3cbb8e193c7 | 6 | public boolean next() throws IOException {
while (true) {
if (count == df)
return false;
final int docCode = freqStream.readVInt();
if (currentFieldOmitTermFreqAndPositions) {
doc += docCode;
freq = 1;
} else {
doc += docCode >>> 1; // shift off l... |
b2bb8744-cdb4-42c0-9e9f-9e3bd1fb8761 | 9 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if(target instanceof MOB)
{
final Room R=((MOB)target).location();
boolean found=false;
if(R!=null)
for(int r=0;r<R.numInhabitants();r++)
{
final MOB M=R.fetchInhabitant(r);
if((M!=null)&&(M!=mo... |
88605ac7-c6c8-4990-8cdd-cdf4d05554e4 | 3 | @EventHandler
public void onVehicleExit(VehicleExitEvent event) {
if (event.getExited() != null && event.getExited() instanceof Player) {
Player player = (Player) event.getExited();
if (this.manager.isRoutePlayer(player)) {
event.setCancelled(true);
}
}
} |
6a107a8b-a868-4ee5-b6e9-f05bd2d138bf | 7 | public void addEdge(int from, int to, String edgeValueToken) throws IOException {
if (maxVertexId < from) maxVertexId = from;
if (maxVertexId < to) maxVertexId = to;
/* If the from and to ids are same, this entry is assumed to contain value
for the vertex, and it is passed to the ve... |
2c4fe340-6fd1-4641-bd16-e689e6935114 | 5 | @Override
public void run() {
AudioInputStream audioIn = null;
try {
audioIn = AudioSystem.getAudioInputStream(getClass()
.getResource(track));
} catch (UnsupportedAudioFileException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-g... |
129ba4e2-1d82-4fd5-8600-605cda636b07 | 7 | public static void refreshConnectionToTrackingServer() {
System.setProperty("java.rmi.server.hostname", currentPeerInfo.getIp());
int trackingServerPort = PeerConfig.getTrackingServerPort();
String trackingServerIp = PeerConfig.getTrackingServerIp();
while(true) {
try {
trackingServerRMIObjectHandle ... |
6a3e4bc0-94f1-4d58-8b8d-c5029781b8ab | 5 | @Override
public Solution search(Puzzle puzzle) {
fringe.add(new Node(puzzle.getInitialState(), null, null));
while (!fringe.isEmpty()) {
Node selectedNode = fringe.poll();
if (puzzle.getGoalTest().isGoalState(selectedNode.getState())) {
return new Solution(selectedNode, getNodeExpanded());
}
close... |
e916a23b-f70e-4b20-9d71-6877f36dfea7 | 8 | public static void main(String[] args) {
// 1,new A()
System.out.println("***new init***");
@SuppressWarnings("unused")
A a = new A();
// 2,Class.forname("package-path.class-name")
System.out.println("***Class.forname init***");
try {
Class<?> clazz =Class.forName(A.class.getName());
try {
cl... |
338b27b5-7460-42ab-ade9-5697a8ee1336 | 7 | public void run() {
synchronized (this) {
try {
this.wait(MainServerApp.initializationTime);
}catch(Exception e){}
}
while(true){
synchronized (monitor) {
while(registeredThreads != MainServerApp.numberOfThreads) {
try {
monitor.wait();
}
catch (InterruptedException e){
... |
6aa46538-35ec-41ce-b7c0-a2d46afc1029 | 7 | public static Figure getFigure(int figureId) {
Figure figure = null;
switch (figureId) {
case Figure.FIGURE_ID_I:
figure = new FigureI();
break;
case Figure.FIGURE_ID_T:
figure = new FigureT();
break;
case Figure.FIGURE_ID_O:
figure = new FigureO();
... |
2305565b-6fc5-4824-82bf-6615fe4b8e3e | 4 | public boolean within(MouseEvent e, int x, int y, int width, int height) {
if (e.getX() > x && e.getX() < x + width && e.getY() > y
&& e.getY() < y + height) {
return true;
}
return false;
} |
0c599afa-e4fa-4754-aee9-3d7a7fbfd1b8 | 7 | public static boolean isValidVector(Vector3f vector) {
if (vector == null) return false;
if (Float.isNaN(vector.x) ||
Float.isNaN(vector.y) ||
Float.isNaN(vector.z)) return false;
if (Float.isInfinite(vector.x) ||
Float.isInfinite(vector.y) ||
Float.isInfinite(v... |
56062d27-98a9-4249-9dfb-665096867391 | 1 | public void testWithField2() {
Partial test = createHourMinPartial();
try {
test.withField(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
check(test, 10, 20);
} |
77918b1f-0dc3-4ba3-abad-e9da1ebccdb4 | 3 | public boolean hasPermission(CommandSender sender) {
if (sender instanceof Player) {
return sender.isOp() || (permissionNode != null && sender.hasPermission("getperms." + permissionNode));
}
return true;
} |
143ba6ce-9f85-4524-9528-18a8f07a4dbf | 8 | @Override
public void execute(Object parent)
{
mxIGraphModel model = graph.getModel();
// Moves the vertices to build a circle. Makes sure the
// radius is large enough for the vertices to not
// overlap
model.beginUpdate();
try
{
// Gets all vertices inside the parent and finds
// the maximum di... |
90109f2a-f5ed-4dc5-8ac5-f4039941230d | 3 | public void update(long elapsedTime) {
ShipV2 player = (ShipV2)map.getPlayer();
JTabbedPane tabbelShipMenu = menu.tabbedShipMenu;
//JPanel sliderMenu = ((JPanel)menu.tabbedShipMenu.getComponent(0));
//menu.updateShipSliders(sliderMenu);
/* don't plan on doing this now
... |
206213e0-9ccd-48fd-b0ee-91e59fc84c41 | 3 | @EventHandler(priority = EventPriority.HIGH)
public void onPlayerRespawn(PlayerRespawnEvent event) {
try {
// first try to get our "default" home
ArrayList<HashMap<String, Object>> results = DatabaseManager.accessQuery(
"select * from homes where owner=? and name=?;",
event.getPlayer().getName(), "de... |
485e0cb9-2480-4736-810e-b69fe1206c06 | 8 | public void loadPreview()
{
if (selectedCard != null)
{
if (selectedCard instanceof HeroFrontCard)
{
creator = new CreatorTabHeroFront(frame, (HeroFrontCard)selectedCard);
ImageIcon ii = new ImageIcon(creator.getImage(214, 300));
preview.setIcon(ii);
}
if (selectedCard instanceof H... |
a241102d-cbf4-471e-9642-de2b1073df0e | 9 | private final void loadImages() throws IOException
{
// RenderableObjects
BufferedImage mainMenuSheet = ImageIO.read(Images.class.getResource(imageDir + "/mainMenu.png"));
BufferedImage saveManagerSheet = ImageIO.read(Images.class.getResource(imageDir + "/saveManager.png"));
// Map textures
Bu... |
bc346b96-b04a-4302-a79d-72e2fd4ba261 | 5 | @Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
switch (COLUMNS.values()[columnIndex]) {
case ID:
return false;
case FIRSTNAME:
case LASTNAME:
case BIRTH:
case EMAIL:
return true;
default:
throw new IllegalArgumentException("columnIndex");
}
} |
b5df8029-b171-466f-9e30-b2c75939433c | 1 | private boolean jj_3R_33() {
if (jj_3R_77()) return true;
return false;
} |
efd7a38b-6ff8-4338-b8e2-fed9fe3117af | 2 | public void test_01() {
initSnpEffPredictor("testCase");
String fileName = "./tests/vcf.vcf";
VcfFileIterator vcf = new VcfFileIterator(fileName, genome);
vcf.setCreateChromos(true);
for (VcfEntry vcfEntry : vcf) {
for (Variant seqChange : vcfEntry.variants()) {
System.out.println(seqChange);
Stri... |
72818d9d-6218-4378-965a-37d854856903 | 5 | public long getSumOfMostCommonValues(int[] result) {
if (result == null || result.length == 0)
return 0;
quickSort(0, result.length - 1, result);
int maxCount = 1;
int count = 0;
int base = result[0];
int number = base;
for (int i : result) {
if (base == i)
count++;
else {
if (count > ... |
4462fc28-e07a-4f2d-b582-636bb89c955c | 1 | private URL getURL(String filename) {
URL url = null;
try {
url = this.getClass().getResource(filename);
}
catch (Exception e) {
}
return url;
} |
212676f1-b495-446c-905f-26a87c117b45 | 1 | public void setVisible(boolean visible) {
if(frame == null) {
hud = new HUDManager(model);
flyups = new FlyUpsManager();
options = new OptionsManager(model);
buildGUI();
}
frame.setVisible(visible);
} |
eb040b1d-1d54-43c9-9826-7f0f301124b0 | 7 | protected void paintComponent(Graphics g) {
super.paintComponent(g); // Paints the background
if (image == null) {
return;
}
if (scale == 0.0) {
initializeParams();
}
if (isHighQualityRendering()) {
Rectangle rect = getImageClipBounds();
if (rect == null || rect.width == 0 || rec... |
57e401b7-8f2b-4230-b77f-bd55959169b0 | 9 | public void showHelpAndExit() {
List<String> names = new ArrayList<>(mOptions.keySet());
int cmdWidth = 0;
Collections.sort(names);
System.out.println();
System.out.println(BundleInfo.getDefault().getAppBanner());
System.out.println();
if (mHelpHeader != null) {
System.out.println(mHelpHeader);
Sy... |
a670878c-ad46-4d26-9c14-d51776e79032 | 5 | */
public void removeAll () {
checkWidget ();
if (itemsCount == 0) return;
setRedraw (false);
setFocusItem (null, false);
for (int i = 0; i < itemsCount; i++) {
items [i].dispose (false);
}
items = new CTableItem [0];
selectedItems = new CTableItem [0];
int oldCount = itemsCount;
itemsCount = topIndex = 0;... |
433f0c2d-8f66-40ae-8165-9339fbb1dd2f | 7 | @Override
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
if (cs instanceof Player) {
final Player player = (Player) cs;
if (Lobby.started && !Game.started) {
if (DatabaseHandler.hasPass(player)) {
if (!Lobby.forcedTraitors.contains(player) && !Lobby.forcedDetect... |
e78a1c7a-ed84-4571-9779-ce9d36e0fa58 | 1 | public TreeNode buildTree(Vector<Integer> v ,int sta, int end){
if(end - sta < 0 )
return null;
int mid = (sta + end)/2;
TreeNode node = new TreeNode(v.get(mid));
node.left = buildTree(v,sta,mid-1);
node.right = buildTree(v,mid+1,end);
return node;
} |
3090d052-3930-4201-9a50-d67d95aea0ad | 3 | @Test
public void testSolve() throws ParseurException {
SolutionState solutionState = null;
try{
solutionState = tournee.solve(MAX_TIME_SEC * 1000);
} catch (Exception e) {
e.printStackTrace();
fail();
}
if (solutionState == SolutionState.OPTIMAL_S... |
7a6b28f1-3fcc-4af9-95d3-1e6baa1eddad | 5 | @Override
public void start(Stage primaryStage) {
this.stage = primaryStage;
root = new StackPane();
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent... |
345a92f4-6ac3-4a0d-b64a-37ecde2831dc | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
invoker=mob;
final CMMsg msg=CMClass.getMsg(mob... |
bf5fc3ed-c684-4d58-82db-9b2d36d19f73 | 4 | public void active(int speed){
if( dir==DirKey.Up ){
this.y = this.y - speed;
}
else if( dir==DirKey.Down ){
this.y = this.y + speed;
}
else if( dir==DirKey.Left ){
this.x = this.x - speed;
}
else if( dir==DirKey.Right ){
this.x = this.x + speed;
}
} |
c85ed3c0-93ab-47e5-b549-8c370f1bb099 | 6 | private void ensureColumnBounds(Sheet sheet) {
if (gotBounds) {
return;
}
Iterator<Row> iter = sheet.rowIterator();
firstColumn = (iter.hasNext() ? Integer.MAX_VALUE : 0);
endColumn = 0;
while (iter.hasNext()) {
Row row = iter.next();
... |
893d14ed-5cbc-45b0-8861-ddacdd33d7be | 6 | public static void init() {
//Configurations for file properties using
Properties properties = new Properties();
FileInputStream propFile;
try {
propFile = new FileInputStream("test.properties");
properties.load(propFile);
} catch (IOException e) {
... |
9cca23a1-c431-41e1-8498-a0fae1440763 | 5 | public void incUtteranceWords(String[] units, Boolean[] stresses,
Boolean[] boundaries, boolean[] trusts) {
// If we're not using trusts, ignore the trusts passed
Boolean[] wordsTrusts;
if (!useTrust || trusts == null) {
wordsTrusts = null;
}
else {
wordsTrusts = SegUtil.wordsTrusts(trusts, boundarie... |
59f9c06c-ccde-497f-9f7a-f73fbbc76307 | 7 | @EventHandler
public void GhastConfusion(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Ghast.Nausea.... |
476d098c-7121-4621-a42c-98a9e245ee71 | 6 | public static Song interpret(String string) {
Song song = new Song("Imported Song", Instrument.BELL, 100);
for (int i = 0; i < string.length(); i++) {
char character = string.charAt(i);
Action act = Action.getActionFor(character);
if (act != null) {
if (string.length() > i + 2) {
... |
9a5a31e1-3a09-46b7-8292-4a573c14a901 | 7 | public static HashMap<String, ArrayList<HashMap<String, Object>>> bundle(ArrayList<HashMap<String, Object>> flatData) {
HashMap<String, ArrayList<HashMap<String, Object>>> bigBox = new HashMap<String, ArrayList<HashMap<String, Object>>>();
ArrayList<HashMap<String, Object>> experiments = new ArrayList<H... |
f411f5c7-8da0-43fe-a05f-fd4b6df9f5b7 | 0 | public int GetStopBusStop()
{
//get the person stop bus stop
return stopBustop;
} |
1619b36c-d3b0-4b14-86a8-e4bc6534e256 | 8 | protected RoomnumberSet getLocations()
{
final Vector<Physical> items=makeVector();
final RoomnumberSet homes=(RoomnumberSet)CMClass.getCommon("DefaultRoomnumberSet");
final RoomnumberSet set=(RoomnumberSet)CMClass.getCommon("DefaultRoomnumberSet");
Room R=null;
for(final Environmental E : items)
{
... |
339c6cc5-7708-4a94-9506-81acee252355 | 7 | private boolean lahdeSuuntaan(ArrayList<Merkki> merkit, Suunta suunta,
Merkki merkki, int askel, ArrayList<Laatu> jono) {
if (merkki.getLaatu() == (jono.get(askel))) {
if (askel + 1 == jono.size()) {
return true;//paatepiste
}
for (Merkki seuraava ... |
949b7dbe-9ddd-4731-b47f-289129cc718c | 4 | public Method findGetMethod(Field field) {
if(field == null)
return null;
if(getFieldDetailStore().isGetMethodPresentFor(field)) {
return getFieldDetailStore().getMethodOf(field);
}
String getterName = createMethodName("get", field.getName());... |
edaf06e1-2af7-4564-8e01-3974ff9e395e | 1 | StringWriter getResult() {
try {
is.close();
} catch (IOException e) {
System.err.println("Unable to close input stream in StreamReader");
}
/**
*
* the StringWriter is closed in {@link #doExec(String[])} after storing its string result.
*/
return sw;
} |
ef67fef6-7012-484a-ab33-d2d8cd979b1e | 8 | private void handleKeyPressed(KeyPressedEvent event) {
if (event.getCharacter() != 0 && event.getKeyCode() != KeyCode.KEY_BACK && event.getKeyCode() != KeyCode.KEY_ESC) {
this.tbv.addChar(event.getCharacter());
return;
}
switch (event.getKeyCode()) {
case KeyCode.KEY_BACK:
this.tbv.back();
bre... |
1a992808-74ea-4d73-9e50-fd4afff2966d | 3 | protected void getMods() {
if(modPath != null){
File file = new File(modPath);
modDir = file.list(new FilenameFilter() {
@Override
public boolean accept(File current, String name) {
File mfile = new File(current, name);
if(name.endsWith(".zip") || mfile.isDirectory())
return true;
... |
0554fd8e-6fed-4fbc-bf15-dc9009570af5 | 2 | @Test
public void delMinReturnsCorrectOrderWithManyIdenticalElements() {
Random r = new Random();
int[] expected = new int[100];
for (int i = 0; i < 100; i++) {
int randomInteger = r.nextInt(4);
h.insert(new Vertex(0, randomInteger));
expected[i] = randomI... |
17638fe7-1ed3-4b3c-a132-339968490a96 | 0 | public JButton getButtonOK(){
return buttonOK;
} |
4c9b454e-b55f-46b0-941f-4927d718557e | 2 | void scoreDnaAndQualitySequence(String seq1, String seq2, int start, int threshold, int result) {
// Overlapping with DnaAndQualitySequence
DnaAndQualitySequence s1 = new DnaAndQualitySequence(seq1);
DnaAndQualitySequence s2 = new DnaAndQualitySequence(seq2);
DnaQualSubsequenceComparator compartor = new DnaQual... |
68551b59-a803-4544-866f-0e5761deb260 | 8 | private boolean expr_sempred(ExprContext _localctx, int predIndex) {
switch (predIndex) {
case 0: return precpred(_ctx, 13);
case 1: return precpred(_ctx, 12);
case 2: return precpred(_ctx, 11);
case 3: return precpred(_ctx, 10);
case 4: return precpred(_ctx, 9);
case 5: return precpred(_ctx, 8);
... |
b1dbf844-7ebd-46a2-bad5-2eb699751021 | 0 | @Override
public BeerResponse getBeer(String beerId) {
BeerReadOnly beerReadOnly = barService.getBeer(beerId);
return new BeerResponse(beerReadOnly);
} |
dc870b1d-0507-43b2-9643-d2af8f8935d1 | 8 | public String toString() //Displays the rank and suit of the card as a string
{
String suitName;
String rankName;
if (suit == SPADES)
suitName = "spades";
else if (suit == CLUBS)
suitName = "clubs";
else if (suit == HEARTS)
suitName = "hearts";
el... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.