method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
60cae6ab-8179-4307-84a3-bc0647142528 | 6 | public boolean SendData() throws IOException
{
DataOutputStream l_out = null;
FileInputStream l_in = null;
byte []l_buffer = new byte[1024];
int l_read = 0;
/*
* Check if filename and/or socket are not null
* Check if file size is not equal to 0
*/
if( ( up_filename =... |
845299d5-b5e2-4c4a-8181-e7fd59663b63 | 6 | @Override
protected int runTest(StdConverter.Operation oper) throws Exception
{
if (oper == null) {
throw new RuntimeException("Internal exception: no operation passed");
}
final boolean doRead = (oper != StdConverter.Operation.WRITE);
final boolean doWrite = (oper !... |
b71cba12-665e-4cb4-9031-9509c36ef6dd | 0 | public TileMap getMap() {
return map;
} |
280c1446-3fc9-44c8-8850-9c692d367cee | 0 | public void setFesIdPos(Integer fesIdPos) {
this.fesIdPos = fesIdPos;
} |
d4c3826d-3b07-40e5-a2de-c89a47d1a382 | 8 | private static void jobshopScheduling() {
store = new Store();
Machine[] machines = new Machine[6];
for (int i = 0; i < machines.length; i++) {
machines[i] = new Machine(i);
}
Job[] jobs = new Job[data.length];
for (int job = 0; job < jobs.length; job++) {
jobs[job] = new Job(job);
int[] row = d... |
af4ac83b-0929-479d-a706-7b9600c2cacf | 2 | private static ArrayList<Edge> getPath(HashMap<String, Edge> previousInPath, String source, String destination)
{
ArrayList<Edge> pathToDestination = new ArrayList<Edge>();
if (previousInPath.containsKey(destination))
{
String current = destination;
while (current != source) {
pathToDestination.ad... |
b51a848a-8317-43e0-b099-1db8a37eb96d | 8 | @Override
public BakingActionResult checkActionIsApplicableInState(State state, String[] params) {
BakingActionResult superResult = super.checkActionIsApplicableInState(state, params);
if (!superResult.getIsSuccess()) {
return superResult;
}
String spaceName = params[2];
ObjectInstance space = state... |
3dff3549-f0cb-4b0e-b1a9-558d552837ff | 9 | public static FieldState countToFieldState(int n){
switch (n){
case 0: return FieldState.NONE;
// unfoldAround(x, y);
case 1: return FieldState.ONE;
case 2: return FieldState.TWO;
case 3: return FieldState.THREE;
case 4: return Field... |
62833be0-a522-4511-9ea0-b7b68a76429d | 3 | public static boolean serialize(Config config){
File file = new File(CONFIG_FILE_NAME);
try {
if(!file.exists())
if(!file.createNewFile())
return false;
FileOutputStream fileOut = new FileOutputStream(CONFIG_FILE_NAME);
ObjectOutp... |
2ef4d118-c75e-46be-b7c0-c805b97c45b1 | 5 | private void deleteEntity(String entity, HttpServletRequest request) {
String parameter = request.getParameter("ID");
if(entity.equalsIgnoreCase("studententity")){
PersonDao.deletePerson(parameter);
}else if(entity.equalsIgnoreCase("professorentity")){
PersonDao.deletePerson(parameter);
}else if(entity.eq... |
941ee6b6-ace1-4488-9216-1c2670a0b5a5 | 7 | @SuppressWarnings("unchecked")
public static <T> T getFieldValue(Class<?> clazz, Object instance, String fieldName){
Field[] fields = clazz.getDeclaredFields();
//Scan Fields for the one we are looking for.
for(Field f: fields){
if(f.getName().equalsIgnoreCase(fieldName)){
try{
boolean accessD... |
673fccfb-d91b-46b4-8df6-9ab1d954f47e | 4 | public boolean isStraightAngle()
{
if (last.prev == null || last.prev.prev == null)
return false;
if (last.x == last.prev.x && last.y == last.prev.y)
return true;
return Math.abs(getAngle(last) - getAngle(last.prev)) < Const.fdAngleTolerance;
} |
51468a2d-5238-4183-b769-54c96c2825ee | 3 | public static void makeConnected(mxAnalysisGraph aGraph)
{
// an early check, to avoid running getGraphComponents() needlessly, which is CPU intensive
if (mxGraphStructure.isConnected(aGraph))
{
return;
}
Object[][] components = getGraphComponents(aGraph);
int componentNum = components.length;
if (c... |
f7cc3d27-5516-4d7d-985c-a32373464e26 | 0 | @Override
public String getType() throws IndexOutOfBoundsException{
String[] type = kit.get(0).getClass().toString().split("\\.");
return type[type.length-1].replace(";","");
} |
0debc645-bae5-40d8-8b9a-a2714a1013bd | 6 | @EventHandler
public void SlimeFireResistance(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.getSlimeConfig().getDouble("Slime.Fir... |
b51183b2-1277-4c11-abc8-5b7c6c65b8b3 | 0 | public String subscribe(final Subscription subscription) throws MailChimpException {
return post("/lists/subscribe", subscription, new Function<Subscription, String>() {
@Override public String apply(Subscription input) {
return gson.toJson(input);
}
});
} |
9bdd2317-9d47-4e67-829b-b9b59aed97a9 | 6 | public void paintComponent (Graphics g2)
{
//super.paintComponent(g2);
Graphics2D g = (Graphics2D) g2;
g.setRenderingHint ( RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
if (angle == 90) g.translate(height, 0);
else if (angle == 1... |
76a761cd-2bcc-4ffe-a9af-a5f858d19bf6 | 7 | public static void main(String[] args) {
int limit = 2000000;
boolean[] isPrime = new boolean[limit + 1];
for (int i = 0; i < limit; i++) {
if (i % 2 != 0) {
isPrime[i] = true;
}
}
for (int i = 2; i * i < limit; i++) {
if (isPrime[i]) {
for (int j = i; i * j < limit; j++) {
isPrime[i... |
aaf54d45-0d38-4c16-b0d1-4b2bd03ddfdf | 8 | public int allQuantity(String cou_name){
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
int result = 0;
try{
conn = getConnection();
sql = "select cou_name,count(*) as quantity from coupon where cou_name=?";
pstmt = conn.prepareStatement(sql);
pstmt... |
42c43957-ddc1-40d4-9abf-ba71c832ffaa | 0 | @Override
public int countFilters() {
return filters.size();
} |
43424994-55b9-4999-a54f-7b4cfde21bc9 | 1 | private void compute_pcm_samples13(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[13 ... |
5cbed3cd-2337-402f-b115-9163c451ff4f | 2 | public void loop()
{
if (volume != Volume.MUTE)
{
if (!clip.isRunning())
{
clip.setFramePosition(0); // rewind to the beginning
clip.start(); // Start playing
}
}
} |
09dc017e-ae79-4926-9ae4-9095e7bde2ae | 3 | public boolean withdrawBipolarQuestion(BipolarQuestion bipolarQuestion) {
boolean flag = false;
Element bipolarQuestionE = (Element) document
.selectSingleNode("//bipolarQuestion[@id='" + bipolarQuestion.getId() + "']");
if (bipolarQuestionE != null) {
bipolarQuestionE.element("dialogState").setText(bipola... |
da93afc0-7086-46a9-af3d-fae7f53d069d | 1 | public void listarPesqProjetos() {
ProjetoBO projet = new ProjetoBO();
try {
tbProjetos.setModel(DbUtils.resultSetToTableModel(projet.pesquisa(txtPesquisaProjetos.getText(), usuarioLogado.getDepartamento().getCodigo())));
} catch (SQLException ex) {
}
} |
3ea3d3f1-84e5-4e1e-a9a4-823e46b009c1 | 6 | private Stack<URL> getLibraries(File jsonFile)
{
Log.i("Loading libraries.");
Stack<URL> libraries = new Stack<URL>();
JarProfile profile = null;
try
{
profile = Util.readObject(jsonFile, JarProfile.class);
}
catch (IOException e)
{
... |
bad1ad97-8640-4380-bf23-bd3749a82f9e | 1 | static void writeFrequencies(BitOutputStream out, FrequencyTable freq) throws IOException {
for (int i = 0; i < 2; i++)
{
writeInt(out, 32, freq.get(i));
}
} |
182bc839-6595-4d95-aaf7-6225d07f23a3 | 8 | public void draw(GOut g) {
if (screenshot && Config.sshot_noui) {
visible = false;
}
super.draw(g);
drawcmd(g, new Coord(20, 580));
if (screenshot && (!Config.sshot_nonames || names_ready)) {
visible = true;
screenshot = false;
try ... |
651df319-e3c7-4f4b-bc86-17fe18169d7f | 2 | public static void setOrder(int i) {
if (i >= 0 && i <= 3) {
order = i;
}
} |
1d623a75-363f-43e4-90a1-86c8b807adf1 | 6 | public DownloadFrame() {
setTitle("Advanced Youtube Download");
setResizable(false);
setIconImage(Media.ICON_DOWNLOAD.getImage());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final GridBagLayout gbc_main = new GridBagLayout();
gbc_main.columnWidths = new int[] {
10, 100, 200, 200, 100, 10
};
g... |
857baa38-561e-48ca-bbb8-067a9ac868fd | 6 | private boolean tileCheck(int layer, int x, int y, int id){
if(x < 0) return false;
if(y < 0) return false;
if(layer >= tileID.length) return false;
if(x >= tileID[0].length) return false;
if(y >= tileID[0][0].length) return false;
if(tileID[layer][x][y] == id) return true;
else return false;
} |
7272e35f-4f81-454e-b7ee-75921469e1f3 | 5 | public void dragDropEnd(DragSourceDropEvent e) {
//getDropSuccess()对应DropTargetListener的drop()方法调用dropcomplete()时指目标指定的值
//getDropAction()对应DropTargetListener的drop()方法调用acceptDrop()时指定的操作
if (!e.getDropSuccess()||e.getDropAction()!= DnDConstants.ACTION_MOVE) {
return;
... |
3ac39296-2e22-444b-a07d-418c76929ac8 | 6 | public static void rehashStellaHashTable(StellaHashTable self, int newsize) {
if (self.theTable == null) {
StellaHashTable.initializeStellaHashTable(self);
return;
}
{ int size = self.size;
KvCons[] table = self.theTable;
KvCons[] newtable = new KvCons[newsize];
int newbucketin... |
d0e02e45-a97e-40e1-9ab3-7264d3362cd1 | 0 | Des(SecretKey key) throws Exception {
//byte[] iv = new byte[] { (byte) 0x8E, 0x12, 0x39, (byte) 0x9C, 0x07, 0x72, 0x6F, 0x5A };
//AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
//ecipher = Cipher.getInstance("DESede/CBC/PKCS5Padding");
ecipher = Cipher.getInstance("DESede/E... |
596f580b-65fb-483b-ab23-f60231c829a1 | 2 | public void launchSimulation(AccessPoint ap, Model model, double rightLimit, double bottomLimit) {
this.apLoc = ap.getLocation();
this.apFreq = ap.getFrequency();
this.apPower = ap.getPower();
this.areas.clear();
if (model == null) {
return;
}
this.are... |
1b75f152-f88d-475d-8ebd-ac5272edbaf8 | 0 | public void setLinkID(String linkID) {
LinkID = linkID;
} |
09c25b2c-25db-4fbd-a87b-661ea1f7821a | 6 | private static void loadItemTypes(String fn) {
String line;
String parts[];
String armorBonuses[];
try {
InputStream in = Armor.class.getResourceAsStream(GameController.CONFIG_DIR + fn);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
... |
4d931d1c-80de-4008-abfc-83c470e0ed2f | 0 | private void bDayDate(String locator2, String bday) {
new Select(driver.findElement(By.name(locator2))).selectByVisibleText(bday);
} |
357e0fa9-902e-4b3c-9211-c43e8b03dc1d | 9 | private static StaffSequence populateSequence(String timeSig,
ArrayList<String> songData, String tempo) {
StaffSequence song = new StaffSequence();
song.getTheLines().clear();
song.setTempo(Double.parseDouble(tempo));
int accum = 0;
for (String s : songData) {
... |
d116d54a-d667-40f4-8f6f-e0c4b07f010f | 6 | public static void insertUser(String uName, String fName, String lName, String pWord)
{
Connection conn = null;
PreparedStatement ps = null;
try{
//variables containing passed in values
String userName = uName;
String firstName = fName;
... |
ad018d63-bd47-43a6-ba25-f9e049585ba4 | 4 | public Compass invert180() {
switch (this) {
case NORTH:
return SOUTH;
case SOUTH:
return NORTH;
case EAST:
return WEST;
case WEST:
return EAST;
}
return null;
} |
8a348d6e-2fdd-4713-98b1-18a45f477615 | 0 | public String getName() {
return name;
} |
4e5a34bf-8933-427d-8c4c-b40471a75b83 | 8 | protected ArrayList<Position> getSmPiecesNrby(Board b, Position tgt) {
ArrayList<Position> posArray = tgt.adjacentP(b, false, false);
int i;
Rank r1 = Rank.Bomb;
Position pos1 = null;
Rank r2 = Rank.Bomb;
Position pos2 = null;
Piece p = null;
for (i = 0; i < posArr... |
82f690eb-6bd3-40db-8fcc-48c1d3706ca5 | 1 | private void setSetting(){
for (int i = 0;i < indentLenght;i++) {
indentString = indentString + indentChar;
}
} |
ea044c1f-0aaf-45a8-b853-e855b3b8b82e | 5 | public List<List<Integer>> levelOrderBottom(TreeNode root) {
List<List<Integer>> allLevel = new ArrayList<List<Integer>>();
Queue queue = new LinkedList();
Queue sameLevel = new LinkedList();
queue.offer(root);
TreeNode p;
List<Integer> level = new ArrayList<Integer>();
... |
55a47b0c-f494-4c1c-aaa2-8b9d78011eee | 2 | public static PathwayElement createGroup(
String groupRef, String graphRef,
String type) {
// create group element
MGroup pwElt = (MGroup) PathwayElement.createPathwayElement(ObjectType.GROUP);
// set ids
pwElt.setGroupId(groupRef);
pwElt.setGraphId(graphRef);
// style type
if (type.toLowerCa... |
d5d32419-c600-4429-9bd5-78f5c59c5c59 | 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... |
bb787189-4680-4d09-8898-c460fdad05d0 | 4 | private void movement(){
if(Greenfoot.isKeyDown("up")){
this.move(MOVE_SPEED);
}
if(Greenfoot.isKeyDown("left")){
this.setLocation(this.getX()-MOVE_SPEED, this.getY());
}
if(Greenfoot.isKeyDown("right")){
this.setLocation(this.getX()+MOVE_SPEED, this.getY());
}
if(Greenfoot.isKeyDown("down")){
... |
5f5789ec-1461-4385-bf08-956c965ae941 | 6 | public boolean add(T e) {
boolean existsElement = false;
Iterator<T> it = iterator();
while(it.hasNext() && !existsElement){
T nextElement = it.next();
if(nextElement.equals(e)){
// Element found
existsElement = true;
Comparator<? super T> comparator = comparator();
int compare = comparat... |
18c4f2db-47a6-44a6-ac71-d57582f8b15f | 6 | private void writeToButton(int i, String possibleAnswer, boolean isTrue) {
switch (i) {
case 1:
frame.setButton1Text(possibleAnswer);
bool1 = isTrue;
break;
case 2:
frame.setButton2Text(possibleAnswer);
bool2... |
0949f429-c8cc-4dea-9f5a-22f1742e8f9b | 3 | @Override
protected void reactPressed(MouseEvent e) {
if (isPressed)
return;
super.reactPressed(e);
if (StateMachine.getState() == ProgramState.EDITING) {
StateMachine.setState(ProgramState.SONG_PLAYING);
theStaff.startSong();
} else if (StateMachi... |
b17fa4fd-be18-4d4e-845c-e741d89f7434 | 8 | public void renderLight(int x, int y, int r) {
x -= xOffset;
y -= yOffset;
int x0 = x - r;
int x1 = x + r;
int y0 = y - r;
int y1 = y + r;
if (x0 < 0) x0 = 0;
if (y0 < 0) y0 = 0;
if (x1 > w) x1 = w;
if (y1 > h) y1 = h;
// System.out.println(x0 + ", " + x1 + " -> " + y0 + ", " + y1);
for (int yy... |
4af39ea5-a5c7-4327-a9b4-dcc932528e4c | 9 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == ok) {
boolean write = true;
// get nums and name
if (x.getText() != null && y.getText() != null
&& name.getText() != null) {
try {
xTiles = java.lang.Integer.parseInt(x.getText());
yTiles = java.lang.Integer.parseInt(y.getTe... |
10aa3992-01b5-47a0-836f-4f5e480b6b98 | 3 | public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
if (item instanceof ToolItem) {
ToolItem tool = (ToolItem) item;
if (tool.type == ToolType.shovel) {
if (player.payStamina(4 - tool.level)) {
level.setTile(xt, yt, Tile.dirt, 0);
level.add(new ItemEntit... |
74766bc3-9dbb-4ec9-8662-e417678d2c52 | 0 | public void setPrpMoaTipo(String prpMoaTipo) {
this.prpMoaTipo = prpMoaTipo;
} |
fe4a222a-96ef-4b5b-9ea3-250d27e25590 | 9 | private int readAddress()
{
AddressingMode addrMode = OPADDRESSING[readMemory(getLPC())];
switch (addrMode)
{
case Absolute: return readAbsolute(readMemory(getLPC() + 2), readMemory(getLPC() + 1));
case AbsoluteX: return readAbsoluteX(readMemory(getLPC() + 2), readMe... |
d2fdb087-456b-44a9-99b9-4c21cd03d446 | 8 | public static void main (String [] args) {
try {
if (args.length < 8) {
System.err.println("Usage : BoundaryPanelDistributed <dataset> "
+"<class col> <xAtt> <yAtt> "
+"<base> <# loc/pixel> <kernel bandwidth> "
+"<display width> "
+"<display height> <classifier "
+"[classifier o... |
90f4a89e-6bf1-4a69-97aa-a0746afd6b75 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Station other = (Station) obj;
if (position == null) {
if (other.position != null)
return false;
} else if (!position.equals(other.posi... |
363e2ba7-6d2c-4233-abe0-6741a8795173 | 4 | public void addEdge(Vertex start, Vertex end, int weight) {
if (graphContainsVertex(start) && graphContainsVertex(end)) {
edges.insert(new Edge(start, end, weight, this.directed));
if (start != end) {
adjacencyList.addEdge(start, end);
}
}
if (... |
210626db-733a-4b20-8606-23ed0ccf5992 | 4 | protected static Element getArtifactWrapperNode(Entry entry) {
Element element = entry.getAnyOtherElement();
if (isWrapperElement(element)) {
return element;
}
for (Object anyOther : entry.getAnyOther()) {
if (anyOther instanceof Element && isWrapperElement((Element) anyOther... |
3e38a324-3a19-4162-b164-f874ccc2c7b9 | 2 | private void insertTournament() {
TournamentBO tournamentBO = ServiceLocator.getBean(TournamentBO.class);
CountryBO countryBO = ServiceLocator.getBean(CountryBO.class);
TournamentTypeBO typeBO = ServiceLocator.getBean(TournamentTypeBO.class);
BufferedImage imBuff = null;
InputStream is = InsertImag... |
4105fc8f-c8b5-4afd-b592-297249ccc062 | 4 | private static ContactRelation CheckContact(ERA[] rel)
{
ContactRelation contact = ContactRelation.NULL;
ERA rel1 = rel[0];
ERA rel2 = rel[1];
if (rel1 != ERA.TAKES_PLACE_BEFORE && rel1 != ERA.INVERSE_TAKES_PLACE_BEFORE
&& rel2 != ERA.TAKES_PLACE_BEFORE && rel2 != ERA.INVERSE_TAKES_PLACE_... |
f86ee1b4-6e7a-4a99-92ac-9f095a2ec6df | 8 | @Override
public BMPImage apply(BMPImage image) {
Filter grey = new Grey();
image = grey.apply(image);
BMPImage filteredImage = new BMPImage(image);
BMPImage.BMPColor[][] bitmap = image.getBitMap();
BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap();
fo... |
506aed01-8681-4127-b8b2-8b7d7f3fca9f | 7 | private static final <T extends Value<?>> T createValueImpl(Class<T> type, Parser p, InputStream is) {
try {
return type.getConstructor(Parser.class, InputStream.class).newInstance(p, is);
} catch (IllegalArgumentException e) {
} catch (SecurityException e) {
} catch (InstantiationException e) {
} catch (I... |
c46d0c1f-9556-4a90-b2f3-c782640470bb | 6 | public int minPacks(int R, int G, int B) {
int result = 0;
result += R / 3;
R = R % 3;
result += G / 3;
G = G % 3;
result += B / 3;
B = B % 3;
if (R + G + B > 3) result += 2;
else if (R == 1 && G == 1 && B == 1) result += 1;
else if (R ... |
e392be4e-824d-4bb2-8d42-3f70166954da | 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 &&
... |
04210ddc-7d14-4066-a905-7680035b9a88 | 6 | static public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextCol... |
068d2da1-b550-42ed-bbd2-9ed58b12dad3 | 2 | private void addSensorEx(){
Form form = new Form();
form.add("name", "Capteur_Vent");
form.add("date", "2015-01-31 17:14:06");
form.add("unity", "m/s");
form.add("sensorType", SensorType.GRAPH.toString());
form.add("samplingFrequency", 1222);
form.add("statementFrequency", 1000);
try {
ClientConfig c... |
2ce62516-c2d8-40fa-81fa-7e21c5d84647 | 5 | public void search(String pattern)
{
int leftBorder=0;
int rightBorder=suffarr.length;
int mid;
int startIndex=0;
while (leftBorder<rightBorder)
{
mid=((leftBorder+rightBorder)/2);
if(compare(pattern,suffarr[mid])>0)
{
leftBorder=mid+1;
}
else
{
rightBorder=mid;
}
System.out... |
ca093649-7c10-4970-a175-38e513d457a0 | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(args.length != 3) {
printArgsError(args);
printHelp(sender, label);
return true;
}
String target = findTarget(args[1]);
int chargeId = -1;
try {
chargeId = Integer.valueOf(args[2]);
} catc... |
20f287f7-748e-4cb6-bc0c-1ffccd7f3c70 | 1 | private void initUI() {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fonts = ge.getAvailableFontFamilyNames();
list = new JList(font... |
1c4011c7-2694-414f-ad2a-42f8b3ef6ea9 | 7 | private final boolean cvc(int i)
{ if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false;
{ int ch = b[i];
if (ch == 'w' || ch == 'x' || ch == 'y') return false;
}
return true;
} |
2e947d8c-d73c-4e18-bc15-e70a9fb3cdbe | 2 | @Override
public synchronized void put(Integer item) {
while (isFull()) {
try {
wait();
} catch (InterruptedException ex) {
System.out.println("Interrupted exception in thread "
+ Thread.currentThread() + " while putting " + item);
... |
b8973a21-a98a-496c-811f-968960ef1cb9 | 9 | @Override
public void actionPerformed(ActionEvent e) {
String komento = e.getActionCommand();
switch (komento) {
case "UUSI":
gui.alustaJaAloita();
peli.aloitaUusiPeli();
break;
case "TALLENNA":
try {
... |
465cfecd-5a2c-4ee3-876e-e63961035b70 | 7 | public static Stella_Object rewrapArgument(Stella_Object argument) {
{ Stella_Object wrapper = null;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(argument);
if (Surrogate.subtypeOfIntegerP(testValue000)) {
{ IntegerWrapper argument000 = ((IntegerWrapper)(argument));
... |
c8c68c1f-2806-4801-8ede-0822d898b5a6 | 7 | private double [][][][] readPairMatrixEntropy(String fName, int numRes){
BufferedReader bufread = null;
try {
File file = new File(fName);
FileReader fr = new FileReader(file);
bufread = new BufferedReader(fr);
}
catch (FileNotFoundException e) {
return null;
}
double asasE[][][][] = new d... |
88408263-c347-4ec2-a810-45eed49d4df0 | 3 | @Override
public void mouseEntered(MouseEvent e) {
if(isEmpty()) {
return;
}
for(UIElement ui : uiElements) {
if(ui.getBoundsAsRect().contains(e.getPosition())) {
setSelection(ui);
}
}
e.consume();
} |
98d1d118-62f8-4eaa-9e7c-27133e48a200 | 1 | private PlayerTheme(String factionName, String[] firstWordCharPool, String[] secondWordCharPool, String torsoImageFolder, String[] torsoImageFiles) {
// Assign variables
this.factionName = factionName;
this.firstWordCharPool = firstWordCharPool;
this.secondWordCharPool = secondWordCharPool;
// Create filep... |
ff2f8402-ee50-4ec2-8c90-3bd679139568 | 5 | private boolean versionCheck() {
final String title = this.versionName;
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(DELIMETER).length == 2) {
// Get the newest file's versio... |
0bb2ea96-90e9-42f2-9652-3fb33ffba49b | 8 | private void setDetailedDescription(String helpType) {
if (helpType == null || helpType.equals("")) {
// no specific helpType -> general help!
setGeneralHelpContent();
} else {
switch (helpType) {
case HELP_ADD:
setAddHelpContent();
break;
case HELP_DELETE:
setDeleteHelpContent();
... |
e45f6c36-5d28-45f1-ac97-b471e06a6935 | 7 | public void merge(int a[], int start1, int end1, int start2, int end2) {
int temp[] = new int[end1 - start1 + end2 - start2 + 2];
int ptr1 = start1, ptr2 = start2, ptrmain = 0;
while (ptr1 <= end1 && ptr2 <= end2) {
if (a[ptr1] < a[ptr2]) {
temp[ptrmain++] = a[ptr1++]... |
07c8ead0-fc90-4b93-8ed3-ff29326e2773 | 2 | private static int indexOf(String name, List<Joueur> list) {
for(int i = 0; i < list.size(); i++) {
if(list.get(i).getNom().equals(name))
return i;
}
return -1;
} |
bb4b4f56-6407-41a6-ac3d-be1c2f840938 | 4 | private int isPower(int n){
for (int i=2;i<=10;i++){
int temp = n;
int p = 0;
while(temp>1){
p++;
if(temp%i != 0) break;
temp=temp/i;
}
if(temp == 1) return p;
}
return 0;
} |
38586c1f-6a1f-4ff1-b1f9-21beba83b375 | 9 | public void teleport(){
if(player.teleportationRing) c.println("You activate your ring of teleportation.");
else{
c.println("You activate one of your scrolls of teleportation.");
player.teleportationScrolls--;
}
if(d20.roll()>10){
c.println("You fail to control the spell and you end up in a random loca... |
cf4afe78-7963-4c37-af3f-0f5c9627c56c | 2 | @Override
public boolean contains(int x, int y) {
// If the button has changed size,
// make a new shape object.
if (shape == null
|| !shape.getBounds().equals(getBounds())) {
shape = new Ellipse2D.Float(0, 0,
getWidth(), getHeight());
}
... |
f34330ba-9e6f-4146-8151-f30716ac2275 | 1 | public static void exchange(int[] array,int i,int j){ //exchange 2 elements array[i] and array[j]; i and j is the index of the array.
if(j!=i){
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
} |
70c234f0-66f9-47dd-b26b-58761202df92 | 7 | @Override
public void unInvoke()
{
if(canBeUninvoked())
{
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((taming!=null)&&(!aborted))
{
if(messedUp)
commonTell(mob,L("You've failed to domesticate @x1!",taming.name()));
else
{
if(taming.amFollowing()==mob)... |
09b45cab-acf8-4184-b3c5-5d8f1c1c71a0 | 2 | public boolean heeftKlant(String nm){
boolean b = false;
for (Gebruiker k: alleKlanten){
if (k.getNaam().equals(nm)){
b = true;
}
}
return b;
} |
79fd5e18-cdb8-4bd2-a81d-9f305dfd7f4b | 0 | public void addPark(Park park) {
this.parkList.add(park);
} |
5c8d7307-5e72-44ce-9693-06635f5d8bb3 | 1 | @Override
public void init(List<String> argumentList) {
if (argumentList.size() > 0) {
functionName = argumentList.get(0);
}
} |
2890089f-bd2c-4b48-b35d-3cb219610ad6 | 4 | @Override
public void run() {
Socket socket;
while (!Thread.currentThread().isInterrupted()) {
try {
socket = this.serverSocket.accept();
InputStream in = socket.getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
while(true) {
i... |
f1715654-d9e3-487e-8406-a5a4963c43b4 | 6 | private void recordSound() {
AudioFormat audioFormat = new AudioFormat(8000, /* sampleRate as a float */
8, /* sampleSizeInBits */
1, /* channels */
true, /* signed */
true); /* bigEndian */
int frameSize = audioFormat.getFrameSize();
DataLine.Info datalin... |
7cb7cbe3-4288-4f25-ab83-653fb9157c91 | 5 | private ItemStack parseItem(String item){
String[] splits = item.split(" ");
String items = splits[0];
String[] spliti = items.split("\\|");
int itemid = 0;
int amount = 1;
short damage = 1;
int percentage = 0;
int enchantmentlevel = 1;
ItemStack itemstack = null;
i... |
f79300c7-cf38-490c-9894-dcd6b6205d35 | 4 | private void invertColors(){
this.bufferImageTemp=ObjTransformFormats.iconToBufferedImage(this.jLabelImage.getIcon());
switch(jComboBox_Invert.getSelectedItem().toString()){
case "RGB":
this.bufferImageTemp=ObjBasicFilters.invertColorsRGB(this.bufferImageTemp,
... |
a48f932e-b677-4c88-bdbe-09bb1235d527 | 9 | private int get_next_page(Page page, long boundary){
if(boundary>0)
boundary+=offset;
while(true){
int more;
if(boundary>0&&offset>=boundary)
return OV_FALSE;
more=oy.pageseek(page);
if(more<0){
offset-=more;
}
else{
if(more==0){
if(bou... |
620a178d-042c-4cec-9983-97ca780a8292 | 9 | public boolean setInputFormat(Instances instanceInfo) throws Exception {
super.setInputFormat(instanceInfo);
m_AttIndex.setUpper(instanceInfo.numAttributes() - 1);
if (!isNumeric() && !isNominal()) {
throw new UnsupportedAttributeTypeException("Can only handle numeric " +
"or nominal attribu... |
b3428c06-8dea-477d-b926-b50e8569d4e0 | 9 | public void renderBottomFace(Block par1Block, double par2, double par4, double par6, int par8)
{
Tessellator tessellator = Tessellator.instance;
if (overrideBlockTexture >= 0)
{
par8 = overrideBlockTexture;
}
int i = (par8 & 0xf) << 4;
int j = par8 & 0xf... |
728629d9-be0e-44ad-8f0b-de889655b5dd | 0 | public static void main(String[] args) {
OverridingPrivate2 op2 = new OverridingPrivate2();
op2.f();
op2.g();
// You can upcast:
OverridingPrivate op = op2;
// But you can't call the methods:
// ! op.f();
// ! op.g();
// Same here:
WithFinals wf = op2;
// ! wf.f();
// ! wf.g();
} |
808de0d8-d3f1-4d22-a48b-3e53aa2e9811 | 5 | public String act(String s){
String[] comds = Parser.parse(s);
String output = "";
if(comds[0].equalsIgnoreCase("inv")) output = inv();
else if(comds[0].equalsIgnoreCase("go")) output = go();
else if(comds[0].equalsIgnoreCase("use")) output = use(comds[1]);
else if(comds[0].equalsIgnoreCas... |
61169d7d-c06e-4a8a-9f28-0a34be7add88 | 1 | public synchronized void removeAllRows() {
int rowCount = getRowCount() - 1;
System.out.println("hola");
for (int i = rowCount; i >= 0; i--) {
removeRow(i);
System.out.println("removidas");
}
} |
1163a44d-0084-4318-b450-04c43c6bce80 | 2 | public void deleteByUsername(String userName) {
EntityManager em = PersistenceManager.createEntityManager();
try {
em.getTransaction().begin();
List<Openchatroom> ochrs = em.createNamedQuery("Openchatroom.GetByUser", Openchatroom.class)
.setParameter("u", userName)
.getResultList();
for (Open... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.