method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8363e3fb-1b89-4499-a502-89ef1b801aea | 9 | public static String stripNonCharCodepoints(String input) {
StringBuilder retval = new StringBuilder();
char ch;
for (int i = 0; i < input.length(); i++) {
ch = input.charAt(i);
// Strip all non-characters http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[:Noncharacter_Code_... |
e2e2c14d-c377-40a0-8a83-9a6332d76c92 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Connective other = (Connective) obj;
if (left == null) {
if (other.left !... |
9cbc7a88-2f68-4bc8-b1a6-0abdf33a9471 | 4 | @Test
public void testName() {
Iterator<Pair<?>> i = info.namedValues.iterator();
String s = null;
Label label = null;
while(i.hasNext() && s == null){
pair = i.next();
label = pair.getLabel();
switch (label){
case cNme:
s = (String) pair.second();
break;
default:
s = null;
}
}... |
4ec962d4-987b-444d-8dcc-901165938856 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(((msg.targetMajor()&CMMsg.MASK_MALICIOUS)>0)
&&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_ALWAYS))
&&((msg.amITarget(affected))))
{
final MOB target=(MOB)msg.target();
if((!target.isInCombat())
&&(msg.source().getVict... |
07000227-68e7-4eb1-ada1-fee54a17b1be | 0 | public Float getGainTrack_dB() {
return gainTrack_dB;
} |
c937d96b-c393-46bb-96bf-d3bf6057c451 | 3 | public boolean hasItem(int itemSlot)
{
if(inv[itemSlot] != null)
if(itemSlot <= 5 && itemSlot >= 0)
return true;
return false;
} |
98728e87-ac1c-445d-ac1d-959900c8e9d3 | 5 | public void putAll(Map<? extends K,? extends V> m) {
for (Map.Entry<? extends K,? extends V> entry : m.entrySet()) {
put (entry.getKey(), entry.getValue());
}
} |
fe7fef38-90c2-43e8-86a9-86708afba32b | 3 | public static List<String> parseList(String listStr) {
if (isStringNullOrWhiteSpace(listStr) || listStr.length() < 2) return null;
listStr = listStr.substring(1, listStr.length() - 1);
if (isStringNullOrWhiteSpace(listStr)) return new ArrayList<String>();
return Arrays.asList(listStr.split(", "));
} |
1d820426-e63d-4517-b0c5-b4cec7704fe4 | 9 | public PapaBicho Factory (String pBicho){
if(pBicho == "tank"){
list = units.tanqueXMLUnit();
setVar();
PapaBicho tank = new PapaBicho(pLevel,pPrice,pIntelligence,pStrenght
,pWeight,pResistance,pMovespeed,
pHitpoints,pWeightLimit,pMana,
pMaxHitPoints);
return tank;
... |
d7a9bc73-3fec-4ab2-bb8d-fc9ae3939586 | 3 | public boolean LoadWallet() throws LoadingOpenTransactionsFailure {
if (!isPasswordCallbackSet) {
throw new LoadingOpenTransactionsFailure(LoadErrorType.PASSWORD_CALLBACK_NOT_SET, "Must Set Password Callback First!");
}
if (isWalletLoaded) {
throw new LoadingOpenTransact... |
695572ca-2117-4ce0-bd52-09652af36349 | 1 | protected void initGUI() throws SlickException {
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
try {
Renderer renderer = new LWJGLRenderer();
ThemeManager theme = loadTheme(renderer);
gui = new GUI(emptyRootWidget, renderer, null);
gui.applyTheme(theme);
... |
99b8e46b-07ac-49de-b403-f12fa80c7c41 | 0 | public AbstractOutlinerJDialog(boolean resizeOnShow, boolean alwaysCenter, boolean modal, int initialWidth, int initialHeight, int minimumWidth, int minimumHeight) {
super(Outliner.outliner, "", modal);
this.alwaysCenter = alwaysCenter;
setSize(initialWidth, initialHeight);
addComponentListener(new Window... |
2f8d2272-6416-4ced-ae68-f1a78240b789 | 8 | private static Node arrayToTree(Integer[] arr) {
if(arr == null || arr.length<=0)
return null;
Node[] narr = new Node[arr.length];
if(arr[0]!=null){
narr[0] = new Node(arr[0]);
}
for(int i=0;i<arr.length;i++){
if(2*i+1 < arr.length && arr[2*i+1]!=null){
narr[2*i+1] = new Node(arr[2*i+1]);
... |
b45273d5-c247-4176-a3d1-ee7eac9128f1 | 6 | @Override
public String getSheetName()
{
if( sheetname == null )
{
if( parent_rec != null )
{
WorkBook wb = parent_rec.getWorkBook();
if( (wb != null) && (wb.getExternSheet() != null) )
{ // 20080306 KSC: new way is to get sheet names rather than sheets as can be external refs
String[] s... |
946c07c5-0506-4eb1-86da-d60e1905d81d | 6 | public List<Station> findStations( String prefix ) throws ApiException {
if ( prefix.length() < 2 )
return Collections.emptyList();
prefix = prefix.toUpperCase();
try {
Set<Station> fromServer = findStationsOnServer( prefix.substring( 0, 2 ) );
List<Station> results = new ArrayList<Station>();
for ... |
48b1ae14-ddf0-4b34-a31b-bfc1b5080a7f | 1 | public Integer pop() {
if(len == 0) return null;
int max = heap[0];
heap[0] = heap[len - 1];
len--;
bubbleDown(0);
return max;
} |
ed135670-b5a6-4990-a56c-6b5657a3beee | 1 | public Tagesspiel(JSONObject setup) {
super("Tagesspiel");
try {
zwerg = setup.getBoolean("Zwergeneinsatz");
} catch (JSONException e) {
}
} |
74196f4f-bde6-466c-a054-d9d50ee28e5e | 4 | private synchronized void processEvent(Sim_event ev) {
double currentTime = GridSim.clock();
boolean success = false;
if(ev.get_src() == myId_) {
// time to update the schedule, remove finished jobs,
// removed finished reservations, start reservations, etc.
if (ev.get_tag() == UPT_SC... |
4b5bb9b3-68c7-45e7-9715-918c16d69716 | 7 | public FastaItem getNextFastaItem() throws IOException {
String line;
String headerRow;
String acNum;
int counter = 0;
FastaItem fastaItem = null;
while ((line = reader.readLine()) != null) {
if (line.charAt(0) == '>' && counter == 0) {
headerRow = line;
acNum = line.split(... |
8b550fa3-ddd3-4397-bf3d-b419ea5df4cb | 6 | public boolean processMsg(CConnection cc) {
InStream is = cc.getInStream();
OutStream os = cc.getOutStream();
// Read the challenge & obtain the user's password
byte[] challenge = new byte[VNC_AUTH_CHALLENGE_SIZE];
is.readBytes(challenge, 0, VNC_AUTH_CHALLENGE_SIZE);
// JW: Launcher passes in p... |
f7f08906-44fd-43ab-8155-0567d796f876 | 5 | public static String[] forgetPassword(String UserName) {
String strQuestion[] = new String[2];
String strList = FileHandle.readDataFile(strFile_User);
strList = strList.replace("<DairyRecord>", "");
strList = strList.replace("</DairyRecord>", "");
//String[] strLine = strList.split(System.getProperty(st... |
60e71460-5241-4c2f-b08e-4faf1c3ba916 | 8 | public void run() {
try {
in = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
output = new DataOutputStream(socket.getOutputStream());
String line, path = root;
int method = 0;
while ((line = in.readLine()) != null) {
String temp = line.toUpperCase();
if (tem... |
324adda7-c079-4ff5-a339-9b59f4be920a | 8 | private void update(int delta) {
rotation += 0.15f * delta;
if (Keyboard.isKeyDown(Keyboard.KEY_LEFT))
xpos -= 0.35f * delta;
if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT))
xpos += 0.35f * delta;
if (Keyboard.isKeyDown(Keyboard.KEY_UP))
ypos -= 0.35f * delta;
if (Keyboard.isKeyDown(Keyboard.KEY_DOWN))
... |
8c327e47-abf9-4f75-adc9-d7d722cf64d9 | 7 | public final assignStatement assignStatement() throws RecognitionException {
assignStatement assignStatement = null;
Token ID20=null;
expression op1 =null;
expression op2 =null;
try {
// /Users/yefang/Documents/research/frontEndGen/test1/src/grammar1/Pi.g:90:58: ( ID ( '[' op1= expr ']' )* '=' op2= expr... |
0dfcad65-3f37-4523-a165-aba13c0e9229 | 4 | public Display(final double s, final Chunk c) {
chunk = c;
scale = s;
setPreferredSize(getAssumedSize());
addMouseMotionListener(new MouseAdapter() {
@Override
public void mouseMoved(final MouseEvent e) {
final double scale = getScale();
final int x = (int) (... |
34dd5717-d41c-4986-b684-e70b3f98a26e | 2 | public static void main(String[] args) throws InterruptedException, ExecutionException {
final SynchronousQueue<Integer> queue = new SynchronousQueue<Integer>();
new Thread() {
@Override
public void run() {
try {
while (running) {
... |
4a152046-4537-4da8-8dd9-66bc51ace1f3 | 0 | @Override
public BufferedImage draw()
{
BufferedImage image = new BufferedImage(Chunk.getPixelLength(), Chunk.getPixelLength(), BufferedImage.TYPE_INT_ARGB);
Graphics2D gI = image.createGraphics();
return image;
} |
8c028770-8af0-4d45-bea7-0efc7212d263 | 3 | public void solveSudoku(char[][] board) {
boolean [][] rows = new boolean[9][9];
boolean [][] cols = new boolean[9][9];
boolean [][] cells = new boolean[9][9];
for(int i = 0; i < 9; ++i){
for(int j = 0; j < 9; ++j){
if(board[i][j] == '.') continue;
... |
f5cb3653-5bdf-4996-bb8e-210f1f2c58ce | 2 | public static void executeInstance(NanoHTTPD server) {
try {
server.start();
} catch (IOException ioe) {
System.err.println("Couldn't start server:\n" + ioe);
System.exit(-1);
}
System.out.println("Server started, Hit Enter to stop.\n");
try ... |
b999c868-4b6c-44cb-b3ed-3d93f5dbb7a1 | 4 | public boolean clearPathInDiagonalBetween(Field from, Field to) { // Is diagonal path between fields clear?
int fileAdjustment = from.file < to.file ? 1 : -1; // Move left or right
int rankAdjustment = from.rank < to.rank ? 1 : -1; // Move up or down
char file = (char) (from.file + fileAdjustment);
char rank = ... |
d2f8bbbc-1ffb-4d5d-a1ef-b764b0ed5272 | 9 | public TalkingFrame() {
frame = this;
this.setVisible(true);
this.setIconImage(new ImageIcon("images/logo.ico").getImage());
this.setLayout(new BorderLayout());
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
talkPanel = new JPanel();
talkPanel.setLayout(new FlowLa... |
dbcf148d-d96b-4231-8033-f55a17bc9d13 | 6 | public IndoorFaceControl(IndoorFace srcIndoorFace)
{
super();
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(new BevelBorder(BevelBorder.LOWERED));
this.indoorFace = srcIndoorFace;
CollapsablePanel.IndirectDataSource data1IndirectDataSource = new CollapsablePa... |
cbc7724e-ec2c-4417-bfa9-40f0dc0b8534 | 3 | private void updateDisplay() {
StringBuilder txt = new StringBuilder();
for (Player p : game.getPlayers()) {
txt.append("Player ").append(p.getNum());
if (game.getCurrentPlayer().equals(p)) {
txt.append(" *");
}
txt.append("<br>");
txt.append("Money: ").append(p.getMoney()).append("<br>");
txt... |
2c834ee5-568b-409e-95a8-75b0ce553196 | 9 | @Override
public double getResult(Object[] object) {
double temp = ((Complex)object[1]).getRe();
double temp2 = ((Complex)object[1]).getIm();
return (Boolean)object[2] ? (temp > -bailout && temp < bailout || temp2 > -bailout && temp2 < bailout ? (Integer)object[0] + 100906 : -((Integer)obj... |
0ae8ac24-fe44-446e-999e-edfa6911af45 | 3 | private void placeIdentityDiscs() {
while (getElementCoverage(IdentityDisc.class) < COVERAGE) {
final Position randomPos = getRandomPosition();
final IdentityDisc idDisc = new IdentityDisc(grid);
if (grid.validPosition(randomPos) && canHaveAsElement(randomPos, idDisc))
grid.addElementToPosition(idDisc, r... |
a0f11014-6d62-49a0-8f15-09e2d489712f | 3 | @Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
return "Player";
case 1:
return "Status";
case 2:
return "Score";
}
return null;
} |
0d8d1d61-a507-463f-8d9c-49a86413f508 | 9 | private void parsePrimitiveDef(){
PrimitiveDef def = new PrimitiveDef();
def.setType(Utils.createPrimitiveType(parts[2]));
int pinCount = Integer.parseInt(parts[3]);
int elementCount = Integer.parseInt(parts[4]);
ArrayList<PrimitiveDefPin> pins = new ArrayList<PrimitiveDefPin>(pinCount);
ArrayList<Element> ... |
38f4b8d2-2c12-441a-892d-2db7ca802baf | 3 | private static String exec(String ...cmd)
{
try {
ProcessBuilder pb = new ProcessBuilder(cmd);
Process process = pb.start();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream stdout = process.getInputStream();
int readByte = std... |
449fac94-c531-49f5-805d-50e56e04bfbf | 4 | public static void extract(File file, String outDir)
{
String result="";
String outFileName = null;
POITextExtractor extractor = null;
boolean filefound=false;
try {
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
if (file.getName().toLowerCase().endsWith(".docx"))
{
... |
522c2a9f-ca57-4552-a2ba-c826afd9b8b8 | 2 | private void ArribaM() {
//Arriba
Punto temp = vibora.get(0);// La antigua Cabeza
Punto p = new Punto();
p.x = temp.x;
p.y = temp.y - 1;
if (validacion(p)) {
List<Punto> nueva = new ArrayList<Punto>();
nueva.add(p);
nueva.addAll(vibora);
if (!esComida(p))
nueva.remove(nueva.size() - 1);
... |
583afd93-0e71-4717-92aa-e98e146d42a7 | 3 | public void shoot(){
if(player.ammo > 0){
for(int i = 0; i < lasers.length; i++){
if(lasers[i] == null){
lasers[i] = new Laser(this,settings.shieldLaserColor, settings.laserSpeed,
player.getCenterPointX(), player.getCenterPointY() - 20,
Math.PI * 3, false, false,
settings.laserWidth,... |
e11b39a1-a03b-4503-9736-b0631f5210b3 | 0 | public void SetWaitTime(int waitTime)
{
//set the wait time
this.waitTime = waitTime;
} |
1f220283-d4f1-4ed0-be4c-9ffedd01d33d | 2 | private void printSubclasses(final Type classType, final PrintWriter out,
final boolean recurse, final int indent) {
final Iterator iter = this.subclasses(classType).iterator();
while (iter.hasNext()) {
final Type subclass = (Type) iter.next();
indent(out, indent);
out.println(subclass);
if (recurse)... |
2a7d60f8-0d58-4c34-842c-2922b6c9ecf4 | 3 | private Object[] readOpenList() throws IOException {
ArrayList objects = new ArrayList();
int code;
while (true) {
try {
code = readNextCode();
} catch (EOFException e) {
code = Codes.END_COLLECTION;
}
if (code == Co... |
4d5df22d-1147-41d0-a252-14c0b1566116 | 4 | @Override
public void render(Graphics2D graphics) {
int startPointGridXCoordinate = 150;
int startPointGridYCoordinate = 20;
for (PlayerInfo p : objectTron.getPlayers()) {
Image cellToRender = cellFinishRed;
if (p.getPlayerNumber() == 2)
cellToRender = cellFinishBlue;
else if (p.getPlayerNumber... |
e52ce353-16f7-4f74-a469-bec79823ba7d | 9 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (args.length != 0) {
return false;
}
sender.sendMessage(plugin.getBroadcaster().styleMessage("Commands: "));
if (sender.hasPermission(HGPermission.ADMIN.toString())) {
sender.sendMessage("/hgadm... |
d90500a7-cb16-42e3-9b2b-30bbab300f18 | 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://download.oracle.... |
6f6f0beb-6d36-45c7-a5f7-dba644961fe3 | 3 | @WebMethod(operationName = "ReadInvoiceIn")
public ArrayList<InvoiceIn> ReadInvoiceIn(@WebParam(name = "inv_in_id") String inv_in_id) {
InvoiceIn inv_in = new InvoiceIn();
ArrayList<InvoiceIn> inv_ins = new ArrayList<InvoiceIn>();
ArrayList<QueryCriteria> qc = new ArrayList<Quer... |
5e86aaad-e8d0-4b43-b6c8-3e14bbf4d9b3 | 6 | public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print("\n -------------------- MENU --------------------");
System.out.print("\n| |");
System.out.print("\n| 1 - Habitantes |");... |
9825b3d9-5b37-406c-85c8-5406e6d22572 | 8 | @Override
public void mouseReleased(final MouseEvent e) {
if (this.draggedComponent != null) {
final Point p = e.getPoint();
final Set<Element> ignoreSelection = new HashSet<>();
ignoreSelection.add(this.draggedEdge);
final Element element = getGraphicPanel().... |
928a8b6a-5eb6-46dc-a06e-73d0c6b09aff | 0 | public int getSpeed() {
return speed;
} |
ec7131e1-0031-47b4-b1ab-56b3e5020445 | 5 | public void placeableDoneDestroying(Placeable p) {
Player player = p.getDestroyingPlayer();
gameController.stopGather(player);
if (player != null) {
if (gameController.playerAddItem(player, p.getItemName(), 1) == 0) {
p.destroy();
SoundClip cl = new ... |
1a715e16-bc50-4fa4-9db3-55e7f03d103a | 2 | private static Kind findKind(String lexeme) {
for (Kind kind : Kind.values()) {
if (kind.lexeme.equals(lexeme)) {
return kind;
}
}
return null;
} |
d18b9368-1212-401d-af26-021a4ccbbb4a | 3 | private Emision buscarEmision(List idEmisionTemporada){
Emision emi = null;
for (Emision emision : emisiones) {
if (emision.obtenerTVEmite().equals(idEmisionTemporada.get(0)) &&
emision.obtenerFechaPrevista() == idEmisionTemporada.get(1)) // Comprobar como se comparan fec... |
fa03d769-1ca4-451e-bbf0-0db3c91e08d1 | 6 | public static LedShape asciiToShape(int ascii) {
if(ascii >= 65 && ascii <= 90 || ascii >= 97 && ascii <= 122)
return charset[-65 + (ascii & ~(1 << 5))].clone();
if(ascii >= 48 && ascii <= 57)
return charset[-22 + ascii].clone();
return new LedShape(0,0, new LedRow(0));
} |
3e7b67da-3e39-433d-ac87-0f0f1480e63f | 9 | private void addItem(int numToAdd, ArrayList<Location> locations, boolean checkTargets)
{
Random rand = new Random(); //Random number generate to determine locations of spaces randomly
for(int i = 0; i < numToAdd; i++)
{
//Generate random location
Location newItem = new Location(rand.nextInt(MAX_X),rand.... |
671fd296-5587-45b9-b7bd-2abd8b788253 | 4 | public static Mask buildAnOtherMask(Direction d) {
switch (d) {
case HORIZONTAL:
double[][] dValues = { { 1, 1, -1 }, { 1, -2, -1 }, { 1, 1, -1 } };
return new Mask(dValues);
case VERTICAL:
double[][] aValues = { { 1, 1, 1 }, { 1, -2, 1 }, { -1, -1, -1 } };
return new Mask(aValues);
case DIAGONAL:
... |
49cd28fd-3508-4ab3-991d-0bf7fcf709e8 | 3 | private int esitaytaRivi(int rivinumero, int eiSaaJaadaTyhjaksi)
{
int tyhjaksiJatettava = -1;
do
tyhjaksiJatettava = satunnaisgeneraattori.nextInt((int)pelialue.alue().leveys() + 1) + (int)pelialue.alue().alkupiste().x();
while(tyhjaksiJatettava == eiSaaJaadaTyhjaksi);
... |
149bf001-200e-490f-ab5e-63d085b34a23 | 3 | public static WaveData getWave(String pathToFile) {
File file;
if(Game.isRunningInIdea()) {
file = new File("src/main/resources/" + pathToFile);
}
else{
Console.log("outside IDE FOR WAVE");
file = new File(pathToFile);
}
byte[] bfile ... |
559b0366-021d-4a20-8d86-ed9a7d3b73a3 | 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 &&
... |
08851333-acd2-4b1b-b1cb-90b68c361e1c | 5 | public void setType(int n) {
InputStreamReader isReader= new InputStreamReader(MyMenu.class.getClassLoader().getResourceAsStream(pathAttr));
try (BufferedReader reader = new BufferedReader(isReader)) {
String line = reader.readLine(); // read the first line containning the description of the column
whil... |
97e14df8-2b80-4125-a91f-190c7d4cc75c | 0 | public void setEnvironmentFrame(EnvironmentFrame frame) {
myEnvFrame = frame;
} |
0c450067-319b-46be-9927-98ab6600c700 | 2 | public void addFriend(User user) {
if (isFriend(user) == IS_FRIEND)
return;
try {
String statement = new String("INSERT INTO " + FriendDBTable
+ " (uid1, uid2)"
+ " VALUES (?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, userID);
stmt.setInt... |
5c869485-0d63-4610-8ba3-b4c4fa61c1bf | 4 | @EventHandler
public void onPlayerInteractEvent(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)
&& clickedBlock.getType() == Material.WALL_SIGN
&& clickedBlock.getState() instanceof Sig... |
c13b9460-8a9d-4365-9e5f-1058130fd470 | 8 | private static String prepare(LocalizationInfo info, Locale lang, boolean isDefaultLang) {
StringBuilder result = new StringBuilder();
result.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n");
result.append("<!-- " + GENERATOR_COMMENT + " -->\n\n");
result.append("<resources>\n");... |
7ab59a07-64d3-4d3a-9d39-541afc9dd3cd | 5 | protected JSONValue serialize( Object value )
{
if( value instanceof String )
{
return serializeJSONString((String)value);
} else if( value instanceof Number ) {
return serializeJSONNumber((Number)value);
} else if( value instanceof Boolean) {
return serializeJSONBoolean((Boolean)value... |
273dbc2a-41fc-45e1-b02b-b08cea152284 | 1 | public void registerImportable(IImportable importable) throws StructureException {
if (this.parts.containsKey(importable.nameOf()))
throw new StructureException(String.format(
"Cannot register IImportable with the name %s: already exists!", importable.nameOf()));
parts.put(importable.nameOf(), importable);
... |
4449d3bc-13aa-431e-837a-1545dd52925d | 1 | @SuppressWarnings("deprecation")
public Homework_current() {
initComponents();
try {
jEditorPane1.setPage("http://www.patana.ac.th/Gateway/eHomework.asp");
jEditorPane1.setMinimumSize(new Dimension(100, 16));
} catch (IOException ex) {
Logger.getLogger(Hom... |
74560585-07a3-4c9d-be47-b35f8e83bb88 | 7 | private void selectChart() {
Object[] possibilities = {"Circolar", "Rectangular", "Linear"};
String s = (String)JOptionPane.showInputDialog(
getMainFrame(),
"Choose the chart type:\n",
"Chart Shape",
JOptionPan... |
b27c802c-e214-4eb9-91e0-32b63bbe59fc | 0 | public boolean hasNext() {
return (this.size() != 0);
} |
cb37501f-a847-43f0-be7c-d19ad23c389c | 0 | public int getIdPos(){
PhpposAppConfigEntity appConfig = getAppConfig("id_pos");
return Integer.parseInt(appConfig.getValue());
} |
4b7788dd-2f33-4f98-87f2-fd57ed0db9dc | 0 | public void setHireDay(int year, int month, int day)
{
Date newHireDay = new GregorianCalendar(year, month - 1, day).getTime();
// Example of instance field mutation
hireDay.setTime(newHireDay.getTime());
} |
1181457a-15e7-4a08-aade-c06e611a873b | 8 | private void process() {
boolean borderGeometryWas;
boolean lineGeometryWas;
boolean voronoiGeometryWas;
boolean flatGeometryWas;
boolean gcodeGeometryWas;
boolean wasTranslucent;
double toolDiameterWas;
long startTime = System.currentTimeMillis();
String processName = getClass().t... |
355b8d6d-5082-4137-92e1-a87fd9f2162b | 6 | public EditorRightMenu(Editor editor, SkinPropertiesVO skinProps, Color background) {
this.editor = editor;
this.bg = background;
this.generalChangesMenu = new GeneralChangesMenu(this.bg, skinProps);
this.buttonChangesMenu = new ButtonChangesMenu(this.bg, skinProps);
this.userli... |
43011be1-ac57-413b-91b1-078a55bdef7a | 7 | public void measure(long time) {
// sila ktora sa snazi odoslat spravu
if (player.state == RunState.running)
force = 1;
else
force = 0;
// spravy si udrzuju rozostupy
if ((prevM != null) && (prevM.position - position < defDist)) {
force -= Ma... |
bf12b7a3-f072-40fb-bd37-14da4005acaf | 5 | public void tarjanSCC(int u) {
dfs_num[u] = dfs_low[u] = dfsNumberCounter++;
s.push(u);
visited[u] = true;
for (int i = 0; i < ady[u].size(); i++) {
int v = ady[u].get(i);
if (dfs_num[v] == -1)
tarjanSCC(v);
if (visited[v])
dfs_low[u] = Math.min(dfs_low[u], dfs_low[v]);
}
if (dfs... |
a8103caa-8035-4166-b5d9-dded588dcc22 | 8 | @EventHandler
public void receivePluginMessage( PluginMessageEvent event ) throws IOException, SQLException {
if ( event.isCancelled() ) {
return;
}
if ( !event.getTag().equalsIgnoreCase( "BSWarps" ) ) {
return;
}
if ( !( event.getSender() instanceof S... |
c423826d-1575-422f-8f41-fe436eef1b2d | 3 | public DiceImage() {
setPreferredSize(new Dimension(32, 32));
try {
for(int i = 0; i < activeDiceImage.length; i++) {
activeDiceImage[i] = ImageIO.read(
new File(getClass().getResource("/storage/images/dice/" + (i + 1) + ".png").toURI()));
inactiveDiceImage[i] = ImageIO.read(
new File(getCla... |
c6053ddc-535e-408f-99c2-c74b4eb42d2f | 0 | public void onDisable() {
UVSave.save(vampires, (getDataFolder() + File.separator + "vampires.bin"));
saveConfig();
getLogger().info("UVampires v0.2 disabled!");
} |
6deabdd7-243c-479e-baf3-d4839b7698d2 | 7 | @Override
public Rectangle getBounds() {
float x = position.x, y = position.y;
float width = getKeyFrame().getRegionWidth(), height = getKeyFrame().getRegionHeight();
bounds.x = x;
bounds.y = y;
bounds.width = width * scale.x;
bounds.height = height * scale.y;
switch (registration) {
case BOTTOM_CENTER:... |
81bbb0b6-c8ea-4b63-a0ac-08596dfc59c0 | 1 | public void testPlus_Minutes() {
Minutes test2 = Minutes.minutes(2);
Minutes test3 = Minutes.minutes(3);
Minutes result = test2.plus(test3);
assertEquals(2, test2.getMinutes());
assertEquals(3, test3.getMinutes());
assertEquals(5, result.getMinutes());
as... |
4c227670-81b7-462b-8b27-c4fc2f316da0 | 1 | private RandomAccessFile getTmpBucket() {
try {
TempFile tempFile = tempFileManager.createTempFile();
return new RandomAccessFile(tempFile.getName(), "rw");
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
}
... |
007ace9d-70b0-4235-b958-6674b0b53d6c | 1 | public void testIsBefore_YM() {
YearMonth test1 = new YearMonth(2005, 6);
YearMonth test1a = new YearMonth(2005, 6);
assertEquals(false, test1.isBefore(test1a));
assertEquals(false, test1a.isBefore(test1));
assertEquals(false, test1.isBefore(test1));
assertEquals(false, t... |
01642c16-7625-4b0f-a4a2-331521e2ac6e | 0 | @Override
public int compareTo(Edge e) {
return this.weight - e.getWeight();
} |
1cad8bc4-7cb7-457f-85c3-aae53b0c9edd | 7 | public void process() {
ArrayList<GroundItem> toRemove = new ArrayList<GroundItem>();
for (int j = 0; j < items.size(); j++) {
if (items.get(j) != null) {
GroundItem i = items.get(j);
if(i.hideTicks > 0) {
i.hideTicks--;
}
if(i.hideTicks == 1) { // item can now be seen by others
i.hi... |
14061ae7-53ae-4c58-9921-9c9eb07fbf5a | 5 | private List<URI> getUrisInContext(RepositoryConnection connection, Resource context) throws RepositoryException {
List<URI> uris = new ArrayList<URI>();
// Get all triples in the context
RepositoryResult<Statement> statements = connection.getStatements(null, null, null, false, context);
... |
89c97253-01cd-4137-8722-d6ef6a764da7 | 8 | static void Algoritmo(MatingPool Pool, int Repeticiones)
{
while(Repeticiones > 0 && TieneSolucion)
{
ArrayList<Mochila> NuevaPoblacion = new ArrayList<>();
NuevosCandidatos.clear();
System.out.println("\nNUEVOS CANDIDATOS BASADOS EN EL P... |
8de33352-2ad5-4f63-adf3-41d007621c63 | 9 | public void placeGnome() {
try {
Graph country = graph;
if (graph2 != null) {
Object [] countryOptions = {graph.getName(), graph2.getName()};
String ans = (String) JOptionPane.showInputDialog(mapFrame, "To which country would you like to add a gnome?",
"Adding a gnome", JOptionPane.PLAIN_MESSAGE, ... |
9a1226ad-e48b-408b-91d5-1cfcba459f14 | 5 | public void buttonClicked(int ID)
{
switch (ID)
{
case 50:
updateCharClass();
break;
case 52:
updateThirdSkill();
break;
case 100:
game.beginGame(charClass, skill2, characterStr.count, characterDex.count, characterCon.count, characterInt.count, skill1control.count, skill2control.count, skill3c... |
c797c36e-9e42-4af3-b449-3f44061faa8d | 8 | private String useAtomVariables(String s, int frame) {
if (frame >= model.getTapePointer()) {
out(ScriptEvent.FAILED, "There is no such frame: " + frame + ". (Total frames: " + model.getTapePointer()
+ ".)");
return null;
}
int n = model.getAtomCount();
int lb = s.indexOf("%atom[");
int rb = s.inde... |
68670683-1987-42d0-9af6-d4bb3c8ed45f | 8 | public static Suit valueOf(char c) {
switch (c) {
case 'S':
case 's':
return Spades;
case 'H':
case 'h':
return Hearts;
case 'D':
case 'd':
return Diamonds;
case 'C':
c... |
db464d8d-5347-4f9b-acfa-2799fdbe484d | 5 | @Override
public void happens() {
// TODO: Change to ensure only explorers
ArrayList<Character> chars = Game.getInstance().getCharacters();
for(Character character: chars){
if(character.getCurrentRoom().getFloor() == Floor_Name.BASEMENT){
int rollResult = character.getTraitRoll(Trait.SANITY);
if((roll... |
f0b031e9-9bde-43b1-9081-bee54592eb41 | 3 | public boolean[] arePasswordsInitialised() {
boolean[] arePasswordsInitialised = new boolean[4];
byte[] response = null;
try {
response = worker.getResponse(worker.select(DatabaseOfEF.MF.getFID()));
for (int i = 0; i < 4; i++) {
String binaryForm;
... |
6ab590da-931c-4b9e-b3b0-ecb49bd7cb2a | 9 | public Block[][] createNewBoard() {
board = new Block[size][size];
Random r = new Random();
int start = 1;
int end = 18;
int numberOfTreasure = 3;
while (numberOfMines != 0 && numberOfTreasure != 0) {
for (int a = 0; a < size; a++) {
for (int b = 0; b < size; b++) {
int num = r.nextInt((en... |
97b2c874-4f15-4b59-bd67-5e042ef19275 | 4 | public void spawn() {
Bubble bubble = (Bubble) getEntity();
if (bubble.type == BubbleType.Small) {
level.addEntityBack(bubble);
} else
if (bubble.type == BubbleType.Middle) {
if (new Random().nextBoolean()) {
level.addEntityPop(bubble);
... |
0d0294da-e611-4ca7-8e32-b9ed8a397581 | 5 | @Override
public String processCommand(String[] arguments)
throws SystemCommandException {
Election election = facade.getCurrentElection();
if (election == null)
throw new SystemCommandException("No current election set.");
String guid = facade.getCurrentUserGUID();
if (guid == null)
throw ne... |
98cf29b6-0e11-4105-806a-72fcfbb660e7 | 1 | public boolean currentlyPlacing() {
if (currentlyPlacing == null) {
return false;
}
return true;
} |
063aab71-f448-4199-8797-13a76bcb5b9e | 9 | public static String fromUTF8ByteArray(byte[] bytes)
{
int i = 0;
int length = 0;
while (i < bytes.length)
{
length++;
if ((bytes[i] & 0xf0) == 0xf0)
{
// surrogate pair
length++;
i += 4;
... |
e07cdb72-7354-42ff-9876-5ff9657ebb47 | 4 | public TrayInteract( Controller ctrl, MainWindow main )
{
if (!SystemTray.isSupported())
{
// Tray not supported !
Logger.error("FATAL : Tray system not supported !");
System.exit(0);
}
this.ti_image = new ImageIcon("ressources/network.png")... |
10ef57f0-d4a4-4075-9db9-e1612f698418 | 3 | @Override
public void render() {
super.render();
int indx = 0;
int offset = 0;
if(overflow() > 0) {
offset = overflow();
}
Iterator<String> it = inputHistory.iterator();
while(offset > 0) {
it.next();
offset--;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.