method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
70b1d76a-07ef-4e15-97ad-3fb8935a1b9e | 3 | private static Options fromURI(URI uri, Options opts) {
if (opts == null) {
opts = new Options();
}
opts.host = uri.getHost();
opts.secure = "https".equals(uri.getScheme()) || "wss".equals(uri.getScheme());
opts.port = uri.getPort();
... |
b7793197-0246-46bd-95d0-1a22aedab599 | 4 | private void resolveTypeRefs(List<? extends ModelElement> moduleElements,
Map<String, Type> types) {
for (ModelElement moduleElement : moduleElements) {
if (moduleElement instanceof TypeRef) {
resolveTypeRef((TypeRef) moduleElement, types);
} else {
// A moduleElement can be null... |
3fe2be90-5ce3-41c5-9719-525aa994e911 | 2 | public void testAddIntervalConverterSecurity() {
if (OLD_JDK) {
return;
}
try {
Policy.setPolicy(RESTRICT);
System.setSecurityManager(new SecurityManager());
ConverterManager.getInstance().addIntervalConverter(StringConverter.INSTANCE);
... |
fd8f3357-d771-46c6-a8ba-947e769ddc6d | 5 | public static void parseArtistDirectory() {
artistMap = DataManager.getArtistMap();
artistMap.clear();
Logger.LogToStatusBar("Parsing artists from SongMeanings");
Logger.LogToStatusBar("Parsing symbol based names");
for(char c = 33 ; c <= 34 ; c++) {
Logger.LogToStatusBar("Parsing directory " + c);
Stri... |
20b0b0d7-9b8b-4c26-af30-5be818e1b4d1 | 6 | public boolean importData(TransferSupport support) {
if(!canImport(support)) {
return false;
}
// Extract transfer data.
MutableTreeNode[] nodes = null;
try {
Transferable t = support.getTransferable();
nodes = (MutableTreeNode[])t.getTransfer... |
3149e262-83e5-4820-ad6e-39cd0bd7f2b7 | 1 | public char[] getCharacters() {
if (c.length == length) {
return c;
}
char[] chars = new char[length];
System.arraycopy(c, 0, chars, 0, length);
return chars;
} |
e1251a27-f2d6-40e8-8b80-12355196c905 | 0 | public void windowDeiconified(WindowEvent e) {
System.out.println("Die Anwendung wurde minimiert...");
} |
2b7aaeaf-bf9b-4191-a199-9bf0d6ca1bec | 1 | public boolean openResourceConnection(){
boolean returned = true;
try {
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
public boolean verify(String s, SSLSession sslSession) {
return true;
}
});
//System.out.println(domainName + resourceLocat... |
f746d4ad-f689-403f-a329-2b04a9a41770 | 0 | public void setSeatType(long value) {
this._seatType = value;
} |
ff4979c5-d26d-4453-b374-39de21b83dd6 | 4 | @Override
public Roleschool addRoleFromGson(String json, Integer id) {
EntityManager em = emf.createEntityManager();
Roleschool role = gson.fromJson(json, Roleschool.class);
System.out.println(role.getRoleName());
if(role.getRoleName().equals("Student")){
role ... |
84277756-b5ed-4452-8ac9-96c8317be2d2 | 2 | public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.load... |
d0ba4920-b985-4ea0-8848-122b23d7c652 | 9 | public boolean loadBoardTilesFromResource(String resourceName) {
boolean isSuccessful = false;
// Attempt to read the data from the file
InputStream resourceStream = Thread.currentThread().
getContextClassLoader().
getResourc... |
e65652fe-febe-40d8-aff7-cbffe2939ce6 | 6 | public void runJSCover(String[] args) {
if (printVersion()) {
System.out.println(getVersionText());
} else if (isServer()) {
runServer(ConfigurationForServer.parse(args));
} else if (isFileSystem()) {
runFileSystem(ConfigurationForFS.parse(args));
} el... |
702c9fb4-e455-45e1-b984-5d35ca5cb012 | 4 | private int separatorPosition(String line){
line = line.trim();
int pos = line.indexOf(':');
if(pos==-1)pos = line.indexOf(';');
if(pos==-1)pos = line.indexOf(',');
if(pos==-1)pos = line.indexOf('\t');
if(pos==-1)line.indexOf(' ');
return pos;
} |
38c57432-cf17-49d7-ad03-a17f5f87b9f9 | 8 | @Override
public void actionPerformed(ActionEvent event) {
Object source = event.getSource();
if (source == reset) {
resetGame();
} else if (source == easy || source == medium || source == hard) {
handleDifficultySettins(source);
} else if (source == customGa... |
51118463-4128-4f7f-b1c9-595f16370c0a | 6 | public static void reorderGoals(Proposition andproposition, List initiallyclosedgoals, List goalsequence, List residuegoals) {
{ Vector arguments = andproposition.arguments;
int originalnumberofarguments = arguments.length();
int index = 0;
{ Proposition g = null;
Cons iter000 = initially... |
3a950830-5fa4-4b1e-8d6e-946dbbfd3553 | 6 | public void parse(String skin)
{
if(skin.equals(""))
return;
String parts[] = skin.split("/");
int l = parts.length;
if(l > 0)
headColor = part(parts, 0);
if(l > 1)
handsColor = part(parts, 1);
if(l > 2)
bodyColor = part(parts, 2);
... |
f39255a9-439b-4268-a5ee-0d1a6443a320 | 4 | public static final void exampleInferenceParameters() {
System.out.println("Starting inference parameters examples.");
try {
// Note: The available inference engine parameters and descriptions are documented
// in the KB and can be viewed using the Cyc browser. The inference parameters will
//... |
184a2e37-437a-44de-8558-c9df17ead2bb | 5 | public boolean buscarCoincidenciasEnOferta(beansProducto prod, String descripcion, String inicio, String accion){
boolean repetido = false;
for(beansOferta oferta : prod.getListaDeOfertas()){
if(descripcion.equals(oferta.getDescripcion()) && inicio.equals(oferta.getFechaDeInicio()) && accion.equals(oferta.getAcc... |
380ba34a-2827-4b0c-ab3c-a36925ea2502 | 9 | public void buildShrine(Location loc) {
double x = loc.getX(), y = loc.getY(), z = loc.getZ();
Location cloc = new Location(loc.getWorld(), x - 2, y, z -1);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
Location tloc = new Location(cloc.getWorld(), cloc.g... |
ef0bea39-76b1-41aa-b7a9-e4fb5d4e8ccc | 1 | public void setLoadingStatusFonttype(Fonttype fonttype) {
if (fonttype == null) {
this.loadingFontType = UIFontInits.LOADINGSTATUS.getType();
} else {
this.loadingFontType = fonttype;
}
somethingChanged();
} |
d725996d-56ff-4d80-8a58-adbbcac0d335 | 9 | private void newCommand(String line) {
if (line.equals("call mrx")) {
System.out.println("Calling MrX...");
this.state = ShellState.MRXCALL;
this.caller.callMrX();
} else if (line.equals("call test")) {
System.out.println("Testcalling...");
this.state = ShellState.TESTCALL;
this.caller.testCall();... |
58af532a-baf4-4bbe-b8b3-6620a174b801 | 7 | void update(float delta) {
this.width = img.getWidth();
this.height = img.getHeight();
delta /= 5;
this.x += dx * delta;
this.y += dy * delta;
InstanceBlock[] coll = world.intersects(getRect());
if (coll[UP] != null) {
if (this.dy < 0) this.dy = 0;
... |
d5ea0a63-6f39-49ab-8047-4512ccd7d5c2 | 8 | public static Result getInstance(Node root) throws ParsingException {
int decision = -1;
Status status = null;
String resource = null;
Set obligations = null;
NamedNodeMap attrs = root.getAttributes();
Node resourceAttr = attrs.getNamedItem("ResourceId");
if (res... |
86217ad0-5e47-4cae-88e4-93f6c5f4b34e | 9 | private void parseEdgesString(String nodeLine) {
StringTokenizer tokenizer = new StringTokenizer(nodeLine);
// number of node parameters to parse (counts at linestart)
int parameters = 6;
// test against an empty line
if (!tokenizer.hasMoreElements()) {
// Log.printLine("this line contains no tokens...")... |
f290225d-7f9c-4073-bb98-8aa658338734 | 7 | protected Event update() {
// 生きてたらセリフとダメージ加算
if(!parent.isDead()) {
if(!parent.isTalking()) {
parent.setMessage(MessagePool.getMessage(parent, MessagePool.Action.Burning), 20, true, true);
}
parent.addDamage(TICK * 90);
parent.addStress(50);
}
// 燃焼時間
burnPeriod += TICK * 90;
// お飾り消失
... |
16592359-054f-4489-9683-60205031cbec | 2 | public Object calculate(List<RouteLeg> route)
{
RouteLength length = new RouteLength(0);
for (RouteLeg currentRouteLeg : route)
{
Connection foundConnection = graph.findConnection(currentRouteLeg);
if (foundConnection == null)
{
return new RouteLength();
}
length = length.plus(foundConnection.... |
4b4e9079-93a7-4516-ad2b-a7b777a53045 | 4 | @Override
public void doLogic() {
if (inputList[0] == true && inputList[1] == true && inputList[2] == true && inputList[0] == true){
power = true;
} else {
power = false;
inputList[0] = false;
inputList[1] = false;
inputList[2] = false;
inputList[3] = false;
}
} |
b36a080d-ee78-42b3-9d6f-8af5ac4acd74 | 8 | protected final List<Position> getNeighborPositions(final Position center) {
final List<Position> neighborPositions = new LinkedList<Position>();
final Integer x = center.getX();
final Integer y = center.getY();
for (Integer c = x - 1; c <= x + 1; c++) {
for (Integer r = y ... |
9756d1c7-e8af-459f-bdb6-af265ac13c01 | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
AnimalInfo frame = new AnimalInfo();
frame.setVisible(true);
//center the frame in the middle of the screen.
frame.setLocationRelativeTo(null);
} catch (Exception e) {
e.print... |
a9fb0e30-2b4d-43d9-99d5-9d8ab9c21b27 | 2 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
this.setEnabled(false);
// On limite le nombre de parties a 3
if(this._profil.getParties().size() >= 3) {
this.buttonNouvellePartie.setEnable... |
d61f1146-7314-42c4-89ae-d785b1520efb | 7 | public static <T extends Comparable<T>> void insertToBST(BasicNode<T> root, T valueToInsert) {
if (null == root || null == valueToInsert) {
throw new IllegalArgumentException("Root or value to be inserted can not be null.");
}
BasicNode<T> nodeToInsert = new BasicNode<T>(valueToInsert);
BasicNode<... |
4b16e7e9-4e96-4e90-9fdd-64b7a4487137 | 4 | private void verificarParametro() throws SemanticError {
if(idMetodoChamado.getParametros().size() < numeroParametrosAtuais)
throw new SemanticError("Número de parâmetros não corresponde à declaração do método");
IdentificadorParametro parFormal
= idMetodoChamado.getParametros().get(numeroParametrosAtuais... |
ab22ac5d-72e2-48a6-bdc0-c73e7166eabf | 3 | public void mouseReleased(MouseEvent e) {
if (e.getButton() == 1) {
mouse.clicked = false;
}
if (e.getButton() == 2) {
mouse.midleClicked = false;
}
if (e.getButton() == 3) {
mouse.rightClicked = false;
}
} |
34545527-4b4e-4dbe-86e7-486c16c3cf67 | 0 | public FileConfiguration getConfig() {
return this.yaml;
} |
7c6b25a2-1402-41fb-956a-77101f119454 | 2 | public static void main(String[] args)
{
SimpleCollection<Integer> objArr1 = new SimpleCollection<Integer>(20);
for(int i = 0;i<=10 ;i ++)
{
objArr1.add(new Integer(i));
}
for(int i = 0; i<=10; i++)
{
System.out.println(objArr1.get(i));
}
System.out.println("Length :"+ objArr1.getLength(... |
36365ecc-8ce6-40fe-8e81-5ee6f67802d6 | 5 | void play(String audioFilePath) {
File audioFile = new File(audioFilePath);
try {
AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);
AudioFormat format = audioStream.getFormat();
DataLine.Info info = new DataLine.Info(Clip.class, format);... |
1d07978d-5792-4d65-ab3e-e84d7d3f6f3b | 4 | @Override
protected List<Device> build(InputStream instream) throws BuilderException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setNamespaceAware(true);
factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
try {
DocumentBuilder bui... |
f93c27aa-828b-4a26-a4bf-ac53758242d7 | 5 | private List<Room> path(Room start, Room destination) {
Queue<Room> frontier = new LinkedList<Room>();
frontier.add(start);
Map<Room, Room> visited = new HashMap<Room, Room>();
visited.put(start, null);
while(!frontier.isEmpty()) {
Room current = frontier.poll();
if(current == destination) {
List... |
24d55d10-1c84-45bb-ab4f-e8c752c7f614 | 0 | public void tearDown() {
// sender.close();
// reciever.stopListening();
// reciever.close();
} |
a6e22bd9-5f5d-46e2-9d29-49a47dbd066c | 1 | private void insert() {
Random rnd = new Random();
for (int n=0; n<N; n++) {
Integer key = rnd.nextInt();
Short value = (short)rnd.nextInt(Short.MAX_VALUE);
fht.insert(key, value);
table.put(key, value);
}
} |
d75e443f-4ffd-40ad-bc2b-798d6d0631d2 | 5 | public boolean doLogin(xAuthPlayer xp) {
int accountId = xp.getAccountId();
String ipAddress = xp.getIPAddress();
Timestamp currentTime = new Timestamp(System.currentTimeMillis());
try {
// create account if one does not exist (for AuthURL only)
if (plugin.getConfig().getBoolean("authurl.enabled") && acc... |
0cd1f258-2259-4f03-8bf3-297e793725cf | 9 | public static Condition parse(LinkedList<HistObj> hist) throws SyntaxError {
HistObj self = hist.pop();
if(self.rule.equals("Condition")) {
Condition res = Condition.parse(hist);
HistObj next;
while((next = hist.peek()).rule.equals("Condition1")) {
his... |
509c79d8-2ff4-46c2-81f5-f0ea774bdd86 | 0 | public Manufacturer getManufacturer() {
return manufacturer;
} |
cdfbf364-d39c-4f6e-8444-6871c9a76bbb | 3 | protected boolean titleMatched(String title) {
if ( titlePatterns.isEmpty() )
return true;
for(String pattern : titlePatterns)
if( title.indexOf(pattern) != NOT_FOUND )
return true;
return false;
} |
14f38fd9-177a-4595-872f-348f6b251c0a | 4 | public void run(){
try{
BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
String input;
Message message;
while ((message = (Message)(oin).readObject())!=null) {
input = message.getMessage();
if (in... |
881985f4-0452-4373-b559-56a211ba89d2 | 7 | protected static void copyOrMove(File sourceLocation, File targetLocation, boolean move) throws IOException {
String[] children;
int i;
InputStream in;
OutputStream out;
byte[] buf;
int len;
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists())
targetLocatio... |
7899900c-93af-461d-8e59-9ad1367975bd | 4 | @EventHandler(priority = EventPriority.LOW)
public void onFoodChange(FoodLevelChangeEvent e) {
if (e.getEntity() instanceof Player) {
if (PermissionHandler.has((Player) e.getEntity(),
PermissionNode.ADMIN)) {
if (Settings.world
|| WorldSettings.worlds.contains(e.getEntity()
.getWorld().getN... |
60fb919c-b8f8-424c-bb7b-5a2b532ecbb9 | 0 | @Override
public void setValue(Object o) {
// instance must encapsulate a FileMetadata
this.embeddedImageLink=(FileMetadata) this.convertObject(o);
Id3v2PictureFrame.updateNodePictureType(this);
} |
69df95cd-3400-41c6-a813-e243fd0b1b70 | 7 | @Override
public ClanPosition addPosition()
{
final Authority[] pows=new Authority[Function.values().length];
for(int i=0;i<pows.length;i++) pows[i]=Authority.CAN_NOT_DO;
final Set<Integer> roles=new HashSet<Integer>();
int highestRank=0;
for(final ClanPosition pos : positions)
{
roles.add(Integer.valu... |
81c4e772-6da7-4b02-8901-d8fe5b391f76 | 7 | public static String crypt(String key, String setting)
{
long constdatablock = 0L; /* encryption constant */
byte[] cryptresult = new byte[13]; /* encrypted result */
long keyword = 0L;
/* invalid parameters! */
if(key==null||setting==null)
return "*"; // will N... |
ce8b9dde-5611-4083-a4af-00ef7b9d0316 | 1 | static public boolean getBooleanFromSubLString(String val) {
return (val.toUpperCase(Locale.ENGLISH).equals("NIL")) ? false : true;
} |
50d089ab-5ef6-44c0-8e83-c91e7ad3ea85 | 7 | private boolean processData(RdpPacket_Localised data, int[] ext_disc_reason)
throws RdesktopException, OrderException {
int data_type, ctype, clen, len, roff, rlen;
data_type = 0;
data.incrementPosition(6); // skip shareid, pad, streamid
len = data.getLittleEndian16();
data_type = data.get8();
ctype = d... |
8af3effb-2159-45ab-9737-da695ba9fb35 | 1 | public void stop() throws DataBaseServerException {
httpServer.stop(0);
try {
System.out.println("Making data backup...");
dbManager.makeBackup();
dbManager.stop();
System.out.println("Backup is made successfully");
} catch (IOException e) {
... |
7dd35235-6b84-4d4d-b9e9-3817967e8cec | 5 | public void keyPressed(int k){
switch(k){
case KeyEvent.VK_ENTER:
select();
break;
case KeyEvent.VK_UP:
currentChoice--;
if (currentChoice == -1){
currentChoice = options.length - 1;
}
break;
case KeyEvent.VK_DOWN:
currentChoice++;
if (currentChoice == options.length){
currentCho... |
b8c17aee-dfee-40d0-a42b-fbf7b82c3beb | 4 | private List expandNoContext(List symbols) {
List ne = new ArrayList();
for (int i = 0; i < symbols.size(); i++) {
String s = (String) symbols.get(i);
List[] replacements = lsystem.getReplacements(s);
List replacement = null;
switch (replacements.length) {
case 0:
// This cannot be replaced, so w... |
a3606e81-4e78-4a1e-a339-48546468188d | 6 | @Override
protected void afterExecute(Runnable r, Throwable t) {
TaskThread task = (TaskThread) r;
IExcuteOperation excutor = task.getExcuter();
TaskInfoStorage tis = QueueApi.getTaskInfoStorage(this.getTypeId());
if (excutor != null) {
try {
logger.debug("-----执行afterRun------");
task.getTask().get... |
3bb473fe-f834-4363-9057-0cf97d45733c | 6 | public static double getInterestRateCD(int duration)
{
double rate = 0;
switch(duration)
{
case 0:
rate = InterestRateCD6Month + CDSavingsOffset;
break;
case 1:
rate = InterestRateCD1Year + CDSavingsOffset;
break;
case 2:
rate = InterestRateCD2Year + CDSavingsOffset;
break;
case 3:
ra... |
ad1129e8-11d1-4c5a-a265-e06a3a1a1dab | 9 | public static void drawCenter(int x0 , int y0 , int radius , byte data[]) {
int pos;
if (((y0 - radius) >= 0)&&((x0 - radius) >= 0) &&
((y0 + radius) < 240 )&&((x0 + radius) < 960)) {
for (int y = y0 - radius ; y <= y0 + radius ; y++) {
for (int x = x0 - radius ; x <= x0 + radius ; x++) {
if ((Math.... |
98798498-20ca-47d7-b8a8-3e8f498e726c | 5 | @Override
public int compareTo( Timer<?> t ) {
return time < t.time ? -1 : time > t.time ? 1 : order < t.order ? -1 : order > t.order ? 1 : 0;
} |
6548e438-a0fe-49b8-bdfc-ad0359c13244 | 2 | public void terminated (Pipe pipe_)
{
final int index = pipes.indexOf (pipe_);
// Remove the pipe from the list; adjust number of active pipes
// accordingly.
if (index < active) {
active--;
Utils.swap (pipes, index, active);
if (current == acti... |
fa7d8d4a-c031-4220-929e-2f7c50b901e2 | 4 | private void setOthers(ColorFilter filter, String replacing, String test, int testValue, int otherValue, int testGap, int otherGap, int shift) {
boolean set = false;
if (shift == LEFT_SHIFT) {
filter.setShift("left");
} else if (shift == RIGHT_SHIFT) {
filter.setShift("right");
} else {
if (replacing.... |
58434570-6606-4871-9248-02d6d875f35f | 3 | public JSONObject accumulate(
String key,
Object value
) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
this.put(key, value instanceof JSONArray
? new JSONArray().put(value)
... |
4cda1f76-46dc-4055-a05d-f1113e2573fb | 9 | protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
boolean oldBusy = isBusy();
setBusy(true);
try {
if (widget instanceof Item) {
final Item item = (Item) widget;
// remember element we are showing
if (fullMap) {
associate(element, item);
} else {
Object da... |
fda83de9-db02-4486-917a-fabf0a872b91 | 4 | public static boolean authenticateUser(String inName, String inPassword) {
Connection c = null;
Statement stmt = null;
boolean authenticated = false;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:Restuarant.db");
c.setAutoCommit(false);
System.out.println("Open... |
816df1ba-488e-43a1-9bf4-67ae990a5680 | 6 | private void modeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modeComboBoxActionPerformed
// TODO add your handling code here:
Sorter sort = new Sorter(DATA_POINTS);
int mode = sortDirComboBox.getSelectedItem().toString().equals("Low to High") ?
Sorter.... |
bc6fcb48-cc3b-4529-b5eb-c2184fc6b590 | 4 | private static String getStoreString(int amount) {
switch (amount) {
case 0:
return "Store-All";
case 1:
case 5:
case 10:
return "Store-" + amount;
default:
return "Store-X";
}
} |
c52e42e6-7a9e-462f-a837-a9e758385eaf | 9 | */
protected void handlePLAYERELEMENT_numRsrc
(PlayerElement mes, Player pl, int rtype, String rtypeStr)
{
/**
* for SET, check the amount of unknown resources against
* what we think we know about our player.
*/
if (D.ebugOn && (pl == ourPlayerData) && (mes.ge... |
25e8425b-060c-4033-a9ad-2282bd30e91f | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
builder.append('\\');
builder.append(chr);
break... |
1c40f80c-aa92-4472-9700-0e46926b7cf6 | 5 | public boolean dropthing(Widget w, Coord c, Object thing) {
if (w instanceof DropTarget) {
if (((DropTarget) w).dropthing(c, thing))
return (true);
}
for (Widget wdg = w.lchild; wdg != null; wdg = wdg.prev) {
Coord cc = w.xlate(wdg.c, true);
if (c.isect(cc, wdg.sz)) {
if (dropthing(wdg, c.add(cc.... |
392b28fe-8b7a-4a70-b564-9bbd3a552f09 | 9 | public void paintComponents(Board newBoard, boolean turn) {
board = newBoard;
pane.removeAll();
JButton[] buttons = new JButton[64];
pane.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
ButtonListener bl = new ButtonListener(this, game);
ButtonObserver bo = new ButtonObser... |
f1f612a0-85e2-4165-9c04-eb73e14a42b4 | 4 | public boolean validatePassword(String password, String confirmation, String passwordKey, String confirmationKey, int passwordMinLength, int passwordMaxLength) {
boolean success = true;
if(password.isEmpty()) {
virheet.addValue(passwordKey, "Salasana ei saa olla tyhjä!");
success = false;
}
else if(pa... |
fbc15d34-bc74-402a-b1b7-56c05aac59c2 | 0 | @Override
public void actionPerformed(ActionEvent e) {
Outliner.statistics.show();
} |
0d5e9497-321c-4380-a29c-af4b650bd4b9 | 1 | public void printList(){
System.out.println("Name: " + this.name + ", Age: " + this.age + ", Illness: " + this.illness);
if (nextPatient != null){
nextPatient.printList();
}
} |
6314a882-427b-4e66-a52f-94370c9d1de3 | 0 | public void setModuleName(String moduleName) {
this.moduleName = moduleName;
} |
8eb1bcb7-91b4-44b1-b467-b64032b6a565 | 7 | public static void main(String[] args) {
try {
String fileName = System.getProperty("file");
String dirName = System.getProperty("dir");
if ((fileName != null && dirName != null)
|| (fileName == null && dirName == null)) {
System.err.println("Usage -Dfile=xx ou -Ddir=xxx");
}
String destFile =... |
786c9ac2-6ea1-425e-9af8-98686ddd84b9 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
Outliner.documents.addOutlinerDocumentListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
setEnabled(false);
} |
00fd5015-af80-434e-9384-60d834f973a3 | 3 | public static HashSet<String>[] filterStartingNodes(Graph[] g, int thresh)
{
int i=0;
HashSet<String>[] startingNodes=new HashSet[g.length];
for(i=0;i<g.length;i++)
{
startingNodes[i]=new HashSet<String>();
HashMap<String,Node> mapNodes=g[i].getMapNodes();
Iterator<String> it=mapNodes.keySet().iterato... |
e1f35fb4-53c7-40ba-ad47-824a8c9985c7 | 6 | public void checker(Player player){
pos = war.getLocalTranslation();
if((player.getPosition().x >= (pos.x - size) && player.getPosition().x <= pos.x + size ) &&
(player.getPosition().y >= (pos.y - size) && player.getPosition().y <= pos.y + size) &&
player.getPosition().z >= (pos.z - size) && player.getP... |
e57bd426-42fd-4f20-89ce-1bd0c8a7a467 | 4 | public void tableChanged(TableModelEvent e)
{
if (! isColumnDataIncluded) return;
// A cell has been updated
if (e.getType() == TableModelEvent.UPDATE)
{
int column = table.convertColumnIndexToView(e.getColumn());
// Only need to worry about an increase in width for this cell
if (isOnlyAdjustLar... |
b8cd7f3d-1092-4311-966b-5f710792be73 | 8 | private double [] calculateRegionProbs(int j, int i) throws Exception {
double [] sumOfProbsForRegion =
new double [m_trainingData.classAttribute().numValues()];
for (int u = 0; u < m_numOfSamplesPerRegion; u++) {
double [] sumOfProbsForLocation =
new double [m_trainingData.classAttribute... |
597363b9-df03-4736-873b-b0f7e6eb112b | 4 | private float multilinearInterpolate(float[] encoded, int od) {
// first calculate the distances -- the differences between
// each encoded value and the integer below it.
float[] dists = new float[encoded.length];
for (int i = 0; i < dists.length; i++) {
dists[i] = ... |
ee7ac6eb-f1ce-4e0e-8f61-c23135fb747a | 7 | public final Map<String, Integer> getEquipStats(final int itemId) {
if (equipStatsCache.containsKey(itemId)) {
return equipStatsCache.get(itemId);
}
final Map<String, Integer> ret = new LinkedHashMap<String, Integer>();
final MapleData item = getItemData(itemId);
if (... |
9088a2a3-10f4-4b73-853d-e2ed14b28476 | 2 | public UserService(){
UserXMLHandler usXMLHandler= new UserXMLHandler();
try {
userList=(UserListRoot) usXMLHandler.readFromFile();
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace()... |
58e9854f-fe8d-4bd5-80fa-31ff95c3c84f | 5 | private void msgs(Graphics g) {
String raw = game.getPlayer().toStatus();
List<String> all = new ArrayList<>();
all.addAll(Arrays.asList(raw.split("\n")));
g.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (14) * per));
for (int i = 0; i < all.size(); i++) {
String s = ... |
998b630d-0c61-4498-afb3-7e2b77b3f96c | 2 | void parseInfo() {
// Parse info entries
info = new HashMap<String, String>();
for (String inf : infoStr.split(";")) {
String vp[] = inf.split("=");
if (vp.length > 1) info.put(vp[0], vp[1]);
else info.put(vp[0], "true"); // A property that is present, but has no value (e.g. "INDEL")
}
} |
84589b12-bbee-4121-ae0e-d2d31ff6f4cd | 5 | public void moveUp() {
if(!win && !m.getMap(p.getTileX(), p.getTileY() - 1).matches(pattern) && p.getTileY() != 0) {
if(yOffset > 0 && p.getTileY() == yOffset + 10) {
Board.yOffset--;
p.move(0, -1);
} else {
p.move(0, -1);
}
}
} |
a3cdbf10-eca7-464b-b4eb-d4584fa7c19a | 9 | public void getSample(int numUsers, int numItems) throws Exception {
int rows = rateMatrix.numRows();
int cols = rateMatrix.numColumns();
int users = numUsers <= 0 || numUsers > rows ? rows : numUsers;
int items = numItems <= 0 || numItems > cols ? cols : numItems;
int[] userIds = Randoms.nextNoRepeatIntArra... |
2e0c9df1-4182-4a67-8b38-87f8b4dbb8e2 | 7 | protected void displayMenu() {
displayData();
System.out.println("-------------------Create HMM-----------------------");
System.out.println("Enter States...................................... 1");
System.out.println("Enter Emissions....................................2");
if (this.states != null) {
System... |
cddfcf76-e80c-4ba9-9dba-56002992944e | 3 | public void receiveShippingNotice(int shipid) {
try {
//System.out.println("WTF");
PreparedStatement statement = connection.prepareStatement("select stock_number, amount from ShippingListed where ship_id = ?");
statement.setInt(1, shipid);
ResultSet rs = statement.executeQuery();
... |
135ffa12-693c-4ed0-87b5-563019c2f467 | 5 | public ICommand getHit (String CommandURI) {
boolean ack;
ICommand c = new Hit("");
Vector<Vector<String>> triples;
String xml = kp.queryRDF(Config.NAME_SPACE + CommandURI, null, null, "uri", "uri");
ack = xml_tools.isQueryConfirmed(xml);
if(!ack)
System.err.println ("Error during RDF-M3 query");
else
... |
bcad2e9b-4003-408a-bb98-8e148bb481f5 | 4 | private int explore(int startPostion, int depth, int dicrection, int lastFoundPlayer, LongBoard state,int threatPlacement, int emptyPostions) {
if(depth == 0) {
return threatPlacement;
}
long mask = 1l <<(startPostion + dicrection);
if((state.boards[lastFo... |
8ab58fb5-f5f1-49bb-9822-fb8f7bec977a | 0 | public void setHuff(boolean toBeHuffed){
this.toBeHuffed = toBeHuffed;
} |
8264e615-6ff2-47e0-9533-cad90533c715 | 1 | private Labo chargerUnEnregistrement(ResultSet rs) throws DaoException {
try {
Labo labo = new Labo(null,null,null);
labo.setCode(rs.getString("LAB_CODE"));
labo.setNom(rs.getString("LAB_NOM"));
// labo.setChefvente(rs.getString("LAB_CHEFVENTE"));
... |
0fcb7606-c2ac-417a-b33a-020b367efef5 | 3 | public static String[] getStylenames(String style)
{
List<String> result = new ArrayList<String>();
if (style != null)
{
String[] pairs = style.split(";");
for (int i = 0; i < pairs.length; i++)
{
if (pairs[i].indexOf("=") < 0)
{
result.add(pairs[i]);
}
}
}
return result.toArr... |
48dc8e5e-3445-4aac-b4f5-2e05b7e147c8 | 5 | public String execute(DeleteEventObject deleteEventObject) throws SQLException{
resultSet = queryBuilder.selectFrom("events").where("eventName", "=", deleteEventObject.getEventToDelete()).ExecuteQuery();
if(resultSet.next()){
String calendarID = resultSet.getString("calendarid");
resultSet = queryBuilder.... |
367bd775-ca42-402a-aa12-a972fd4a7724 | 5 | public void load(String json) {
super.load(json);
JSONObject flags = getData().getJSONObject("flags");
if (flags == null) {
flags = new JSONObject();
getData().put("flags", flags);
}
if (flags.names() != null) {
for (int i = 0; i < flags.names(... |
d7394c30-6e2d-4220-aa0b-11898e54a5d8 | 2 | private static Boolean check_solution(Hashtable<String, Tuple<LinkedList<Integer>, Integer>> queues) {
Boolean solution = true;
Enumeration<String> words = queues.keys();
while(words.hasMoreElements()){
String word = words.nextElement();
Tuple<LinkedList<Integer>, Integer> tuple = queues.get(word);
Linke... |
4849a65d-edb4-4d6e-aa93-c6c474435b46 | 5 | public void actionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == addButton) {
CustomModeDialog.this.addButtonActionPerformed(evt);
}
else if (evt.getSource() == removeButton) {
CustomModeDialog.this.removeButtonActionPerformed(evt);... |
7e854685-a63e-459a-b1dc-825fd6ca03d7 | 3 | @Override
public EntidadBancaria get(int id) {
PreparedStatement preparedStatement;
EntidadBancaria entidadBancaria;
ResultSet resultSet;
Connection connection = connectionFactory.getConnection();
try {
preparedStatement = connection.prepareStatement("SELECT * FRO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.