method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8ed5858e-96f0-4c44-95a0-69886b3924c1 | 9 | public SegmentGroup joinSplines() {
long startTime = System.currentTimeMillis();
System.out.println("Sorting and joining Splines...");
SegmentGroup s = new SegmentGroup();
recalculateAllSplines(splines, sGroups, HIGH_RES);
printl(currentID + " curr Id");
... |
25e6fd2d-cd12-4592-93a5-5b8e13c6c9f5 | 8 | public void getInput(Circuit c, boolean is_alice, BufferedReader br) {
String inpline = null;
// Scan through all format objects
for (int i = 0; i < FMT.size(); i++) {
IO io = FMT.elementAt(i);
logger.debug("pulled element from FMT");
// Verify it's an input o... |
781ae23f-107c-40d5-befe-8434cba5e470 | 8 | public void additionalDisplayCombo_actionPerformed (ActionEvent e) {
int selectedIndex = additionalDisplayCombo.getSelectedIndex();
switch (selectedIndex) {
case HackController.SCRIPT_ADDITIONAL_DISPLAY:
if (!scriptMenuItem.isSelected())
scriptMenuItem.set... |
770a2540-2c3d-41fb-86df-8970e76a18cc | 0 | public void setPreference(Preference pref) {
this.pref = pref;
} |
fd109350-5b0e-44b2-b98e-c19c8860fcbf | 0 | public int getWidth() {
return width;
} |
64ee1a04-b400-42cf-b40b-a94b695f5ec8 | 6 | MatrixFileReader(String fileName) throws IOException {
int ii, jj;
Scanner in = new Scanner(new FileReader(fileName));
if (!in.hasNextInt()) {
in.close();
throw new IOException("Cannot read matrix file.");
}
rows = in.nextInt();
if (!in.hasNextInt()) {
in.close();
throw new IOException("Can... |
a338aa30-7906-42ce-b0b4-3b7ea1080226 | 6 | public int getIndexMin(int start, int end) {
if (this.start == start && this.end == end)
return minIndexVal;
int mid = (this.start + this.end) / 2;
if (mid >= start && mid >= end)
return left.getIndexMin(start, end);
if (mid < start && mid < end)
return right.getIndexMin(start, end);
return m... |
7f4b8593-2b3d-4909-a65d-88574f0993b0 | 0 | public double mean()
{
//**************************
return this.mean;
//**************************
} |
fa54ebe7-2c8c-488f-8399-848d66ff40df | 2 | private void startFood(){
synchronized(envi.lock_food){
int count = 0;
while(count < 15){
envi.addFood();
food_count++;
count++;
if(food_count == food_needed){
break;
}
}
}
} |
a17fab4d-4f22-49ba-a8ed-8226aa7dd66f | 8 | private int nextCharToProcess() throws IOException, LexerException {
int ich;
if (nextich >= 0) {
ich = nextich;
nextich = -1;
}
else
ich = this.reader.read();
for (; ich != -1; ich = this.reader.read()) {
char ch = (char)ich;
if (Character.isSpaceChar(ch) || Character.isISOControl(... |
b86168c2-b34f-41ab-a5d4-e32d17e736ef | 1 | public static void restoreDefaults() {
for (Entry<String, Fonts> entry : DEFAULTS.entrySet()) {
UIManager.put(entry.getKey(), entry.getValue().mDefaultFont);
}
} |
8b689335-3609-45b3-a1ed-f0283bea174b | 9 | protected double[] computeOptimalPositions(double omega, double[] x_0,
double[] v_p, double[] u_p) {
// -------- initialize all vectors --------
double[] x = x_0;
double[] v = new double[unplacedNets.size()];
double[] u = new double[unplacedNets.size()];
// iterate over nets
for (int l = 0; l < unplaced... |
34b3fd95-a484-44c4-a44b-bb9012ed96b1 | 9 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map<String, String> errors = new HashMap<String, String>();
UserValidation uservalidate = new UserValidation();
User user;
String addressName = request.getParameter("details");
Strin... |
65989867-9b03-4cf9-9df0-e0f023d6a033 | 5 | protected void mapChildrenValues(Map<String, Object> output, ConfigurationSection section, boolean deep) {
if (section instanceof MemorySection) {
MemorySection sec = (MemorySection) section;
for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
output.put(createP... |
98f793d1-c7a2-4456-a9da-f28ba0481379 | 4 | public List <String> getAdjacent(String nodeID){
increaseAccess();
Node node = nodeMap.get(nodeID);
List <String> result = new ArrayList<String>();
if (node != null) {
for(Map.Entry<String, Edge> entrySet : this.edgeMap.entrySet()) {
Edge edge = entrySet.getValue();
if (edge.getNode1().equals... |
30fd03d0-803d-4fa7-ad77-98f89da9268f | 9 | public void HashSubtractor(Node Ax)
{
//given another hashTable head A, add to current hashtable
Node Oit = this.mainNode;
while(Oit != null && Ax != null)
{
OverlapType compared = RetOverlap(Oit,Ax,false);
switch(compared)
{
case Equals:
////System.Out.println(ToStrin... |
8656c17c-218d-441d-bde7-c2e2e4b532ad | 6 | public void atualizarTreeMap(){
List<Integer> listaprovisoria = new ArrayList();
List<Integer> listaprovisoriaexcluir = new ArrayList();
Iterator iterador = lista_de_linhas.keySet().iterator();
while(iterador.hasNext()){
Integer valorAtualizar = (Integer) iterador.next();
... |
5c682826-f07f-46f7-b011-89bb7c092e95 | 6 | private void loopDir(Context ctx, File dir) {
if (dir.isDirectory()) {
for (File f : dir.listFiles()) {
if (f.isFile() && f.getName().endsWith(".js")) {
String name = f.getAbsolutePath().substring(f.getAbsolutePath().indexOf(scriptDir.getAbsolutePath()) + scriptDi... |
1c46c83a-2def-4639-887e-bf111e6a57ed | 4 | public String next() throws IOException {
int next = skipWhite(getChar());
if (next == -1) {
return null;
} else if (isAlpha(next)) {
return getName(next);
} else if (isNumber(next)) {
return getNumber(next);
} else if (isQuote(next)) {
return getString(next);
} else {
return getSymbol(next);... |
78edc0ce-4b35-4c89-95e4-fc625f82715f | 5 | public void setRequest(Request request) {
// Fail immediately if there are problems in the glue code.
if (request == null) {
throw new IllegalArgumentException("request == null");
}
if (request.getPath() == null) {
throw new RuntimeException("Assertion Failure: re... |
de1ab4a0-d5bd-4c0b-af45-71cd60abda0c | 2 | public Register sibling(Width width) {
Register[] family = family();
for(int i=0;i!=family.length;++i) {
Register sibling = family[i];
if(sibling.width() == width) {
// first match
return sibling;
}
}
return null;
} |
73e5f755-a37e-4b4d-8979-c445265678ee | 6 | public boolean open() {
if (isOpen()) {
return true;
}
if (summoned() && select(Option.INTERACT)) {
if (Condition.wait(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return !ctx.chat.select().text("Store").isEmpty();
}
})) {
for (ChatOption option : ctx... |
02971fa2-214c-4e9e-a3be-b7aba458aae1 | 6 | private int jjMoveStringLiteralDfa16_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 15);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 15);
}
switch(curChar)
{
case 66:
return jjMoveStringLiter... |
b27e6c03-6b89-4953-ad3b-745c038f8b25 | 3 | public void pokemonStats() {// Determines pokemon initial stats and types
if (GameFile.pokemonParty[0].equals("Tykepol")) {// Using Turtwig base
// stats
type = "Fight";
baseHp = 55;
baseAtk = 68;
baseDef = 64;
baseSpAtk = 45;
baseSpDef = 55;
baseSpeed = 31;
} else if (GameFile.p... |
fb47aa1e-2690-4ad5-849f-ed9f3f1b4ecc | 2 | public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
if (filterConfig != null) {
if (debug) {
log("LoginFilter:Initializing filter");
}
}
} |
63483bfc-9e5d-4289-aaec-32ccbbd159b9 | 8 | void SetColor(int color) {
if (toggling == true)
{
// System.out.println("Warning! Detected Cyle of dependencies in Parents of Marker lists");
return;
}
toggling=true;
for (int i=0;i<NumPoints;i++)
{
GetPoint(i).mycolor=color;
}
if (Parent1Li... |
6e3ec732-af59-4e74-86d7-8e8be75ef22c | 6 | private static void errorMessage(String message, String expecting) { // Report error on input.
if (readingStandardInput && writingStandardOutput) {
// inform user of error and force user to re-enter.
out.println();
out.print(" *** Error in input: " + message + "\n");
... |
dcd54bae-9b9e-4380-8326-14e9b28225dd | 7 | private boolean isIdentifier(String s) {
if (s == null) {
return false;
}
s = s.trim();
if (s.length() > 0) {
if ( !Character.isLetter(s.charAt(0)) ) {
return false;
}
for (int i = 1; i < s.length(); i++) {
... |
e7ad5705-2cb6-4bfa-931d-952acac68648 | 9 | @Override
public boolean onFlushDirty(Object entity, Serializable id,
Object[] currentState, Object[] previousState,
String[] propertyNames, Type[] types) {
if (!(entity instanceof HibernateTree)) {
return false;
}
HibernateTree<?> tree = (HibernateTree<?>) entity;
for (int i = 0; i < propertyNames.le... |
e7e8dece-dc83-4a6d-ae45-93bccbbba98f | 3 | @Override
public MedicineDTO getMedicineById(Long id) throws SQLException {
Session session = null;
MedicineDTO medicine = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
medicine = (MedicineDTO) session.load(MedicineDTO.class, id);
}
... |
8002a634-3669-40ac-95f1-bde8cb7a4e0b | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(targ... |
e88c1477-a0f5-4588-9464-c8566b7b1d5c | 1 | @Override
public AState breakTie(AState state1, AState state2)
{
if(state1.getH() < state2.getH())
return state1;
else
return state2;
} |
f0ed4410-42ac-42c1-9c1b-5a9af7322409 | 4 | private boolean read() {
try {
final URLConnection conn = this.url.openConnection();
conn.setConnectTimeout(5000);
if (this.apiKey != null) {
conn.addRequestProperty("X-API-Key", this.apiKey);
}
conn.addRequestProperty("User-Agent", Up... |
968f51f4-4b62-493e-9417-d33488294658 | 9 | private static String formatString(String string){
StringBuilder temp = new StringBuilder(string);
boolean hasBeenGood = true;
for (int i = 0; i < temp.length(); i++){
char curChar = temp.charAt(i);
if ((curChar >= 'a' && curChar <= 'z') ||
(curChar >= 'A' && curChar <= 'Z') ||
(curChar >= '0' && ... |
14a93a34-cbca-4d70-89c9-641792a73ff0 | 2 | private static boolean isStringValid(String str, int size) {
return str != null && !str.isEmpty() && str.length() <= size;
} |
83c6d68f-6ed7-417c-9ce1-e6565c372e0d | 8 | private void setupLevelsEntities(){
resetPlayerPosition();
entities.clear();
view.actions.clear();
view.questionString = currentDepth.question;
view.situationString = currentDepth.exposition;
view.contextualString = null;
if(0 == currentDepth.entrances.size()){
... |
52e60913-01e2-45df-b8be-052aa43cc5a2 | 8 | public static void main(String[] args) throws FileNotFoundException
{
Scanner sc = new Scanner(new File("11grid.txt"));
int[][] a = new int[20][20];
int row = 0, column = 0;
String nextline;
while (sc.hasNextLine())
{
column = 0;
nextline = sc.nextLine();
Scanner sc2 = new Scanner(nextline);
w... |
f7670dab-e034-4b8e-9296-8e8a6c6a5d4a | 5 | @Override
public void move(GameBoard currentBoard) {
System.out.print(playerName + ", it's your turn. ");
int playerColumnInput = 0;
if (playerColor == Color.BLUE) {
System.out.println("You are player O (blue).");
}
else {
System.out.println("You are player X (red).");
}
currentBoard.draw();
Syst... |
656fe830-2f15-4829-a4fd-5115c1cbbc68 | 7 | public static String editString(String s, GameContainer container) {
Input input = container.getInput();
for (int key : collection) {
if (input.isKeyPressed(key)) {
String keyString = Input.getKeyName(key);
if (keyString.startsWith("NUMPAD")) {
... |
b7f6b592-5463-461c-a61b-54e86d954e0c | 1 | @Override
public void init(List<String> argumentList) {
literalValue = Integer.parseInt(argumentList.get(0));
if (argumentList.size() > 1) {
identifier = argumentList.get(1);
}
} |
8a2a6e6c-d88a-49f0-862a-a555f84fc9cd | 8 | protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_AssociatorEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter... |
e58da536-2de0-42b6-af20-925108b7116f | 3 | private void writeLog() {
String correct;
String time;
if(wasCorrect) {
correct = " correctly";
}
else {
correct = " incorrectly";
}
if(duration == 1){
time = " second.";
}
else{
time = " seconds.";
... |
26c76209-4d29-4075-b3a7-b28edd0fd25b | 2 | @Test
public void testConstantReadingAndWriting()
{
final LockRef<String> mod = new LockRef<String>("Hello World");
final AtomicInteger finished = new AtomicInteger();
final AtomicBoolean running = new AtomicBoolean(true);
Runnable writer = new Runnable() {
public void run() {
String newValue = nul... |
bc0e7043-f45e-47f0-981b-d541b28d8b46 | 7 | public final void dotted_attr() throws RecognitionException {
try {
// Python.g:93:5: ( NAME ( DOT NAME )* )
// Python.g:93:7: NAME ( DOT NAME )*
{
match(input,NAME,FOLLOW_NAME_in_dotted_attr213); if (state.failed) return;
// Python.g:93:12: ( DOT NAME )*
loop8:
while (true) {
int alt8=2;
... |
8d2dd209-4986-472a-b2cd-53de94fd3103 | 3 | private void refreshChatLogs() {
File dir = new File(ConfigManager.getInstance().chatlogsDir);
if (!dir.exists()) {
dir.mkdir();
}
File[] logs = dir.listFiles();
if (logs.length == 0) {
return;
}
String[] names = new String[logs.length];
... |
c8c28871-61a6-40d4-8ee4-3c06905c5c30 | 5 | private void initComponents() {
getStyleClass().add("body");
HBox hbox1 = new HBox(10);
GridPane grid1 = new GridPane();
grid1.setHgap(10);
grid1.setVgap(10);
grid1.getStyleClass().add("grid-region");
grid1.setPadding(new Insets(10, 10, 10, 10));
Button nameButton = new Button("Full Name");
nameBut... |
1543dac2-660d-4d11-ac7b-78b921ae90b5 | 1 | public String getFile() {
if (file == null) {
throw new RuntimeException("missing file name.");
}
return file;
} |
b703a990-1a7b-4568-89c7-9690243d3809 | 9 | Field getFieldWithPos(int position_) {
if (isPrimitive != null) { // if this is a primitive
return null;
//throw new ASNException("Cannot get subfield's position for a Primitive Type");
}
if (position_ != 6) { // Optimization for Tag 6 Object Identifier.
for (... |
c0fc696b-b594-4e13-874a-b2f32f7beb4b | 0 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
} |
8b6e73f0-d943-4a9c-bbc1-9a9950da1576 | 1 | public static void listItem(){
rover = head;
while(rover != null){
System.out.println("" + rover.name + " : " + rover.alt + " : " + rover.img);
rover = rover.next;
}
} |
d498c0b8-e910-490e-a462-409b34909687 | 2 | public static TicketRestrictionEnumeration fromValue(String v) {
for (TicketRestrictionEnumeration c: TicketRestrictionEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
5ccc9269-c208-4b4c-b696-20f68e1fdf01 | 7 | public Boolean calcHetero() {
// No genotyping information? => Use number of ALT field
if (genotypeFieldsStr == null) return isMultiallelic();
Boolean isHetero = null;
// No genotype fields => Parse fields (we only parse them if there is only one GT field)
if (genotypeFields == null) {
// Are there more... |
b1a87092-8137-4494-9b2d-0e857bae280b | 3 | protected static String describe(String name,Class[] params) {
StringBuilder invp=new StringBuilder();
invp.append(name);
invp.append('(');
if (params!=null)
for(int k=0;k<params.length;k++) {
if (k!=0) invp.append(',');
invp.append(params[k].toString());
};
invp.ap... |
075229a5-4e06-4b08-b61b-ab7a09b265fd | 9 | public final Method[] getReflectiveMethods() {
if (methods != null)
return methods;
Class baseclass = getJavaClass();
Method[] allmethods = baseclass.getDeclaredMethods();
int n = allmethods.length;
int[] index = new int[n];
int max = 0;
for (int i = ... |
fb6d3b95-9038-41a0-bb38-3b6f86968892 | 6 | public static String unescape(String string) {
int length = string.length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < length) {
... |
bd09856e-48ed-4939-b726-911a45d64abf | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SubCategoria)) {
return false;
}
SubCategoria other = (SubCategoria) object;
if ((this.getId() == null && other... |
44152a05-d927-4637-b1c4-eb023dd249a7 | 4 | private int[][] pasaArregloAMatrizLeft(int[] c0, int[] c1, int[] c2, int[] c3) {
int[][] res = new int[4][4];
for (int i = 0; i < 4; i++)
res[0][i] = c0[i];
for (int j = 0; j < 4; j++)
res[1][j] = c1[j];
for (int k = 0; k < 4; k++)
res[2][k] = c2[k];
for (int m = 0; m < 4; m++)
res[3][m] = c3[... |
26f2e39e-7e7e-4962-a8e7-a56c09413e32 | 6 | protected String constructCookies(String... names){
StringBuilder ret = new StringBuilder();
//syntax:
//name1=value1; name2=value2
if(names != null && names.length != 0){
//put in name + value
boolean start = false;
for(int i=0; i<names.length; i++){
if(start){
ret.append("; ");
}
... |
caee4399-ccfb-47a6-a206-4a240da885a6 | 1 | private int CountNumberLines()
{
int i;
for(i = 0; scn.hasNextLine(); i++){
scn.nextLine();
}
return i;
} |
05370394-2a10-438f-aeb7-4419c13469b9 | 9 | private void createUpperLayout() {
JPanel upper = new JPanel();
upper.setSize(100, 50);
upper.setLayout(new BorderLayout());
JPanel sticks = new JPanel();
sendSticks = new JButton("Send sticks");
sendSticks.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e... |
1709c855-4941-44df-b921-94f42a20963f | 6 | public static int mst(PriorityQueue<Edge> edges, Vertex[] noder) {
ArrayList<Edge> A = new ArrayList<Edge>();
Edge e = null;
while(!edges.isEmpty()) {
e = edges.poll();
Vertex from = noder[e.getFrom()];
Vertex fromsParent = from.getParent();
Vertex to = noder[e.getTo()];
Vertex tosParent = to.getPa... |
563a49b0-9754-453c-a002-f8676cf10478 | 0 | private Sundae() {
print("Sundae()");
} |
d192d0ae-afec-4564-b8cb-af0ea0eb708b | 9 | void event(){
//EFF: plays event if there is a trap
Trap trip = curPlayer.curRoom.trap;
Wumpus wump = curPlayer.curRoom.wumpus;
Random ran = new Random();
if(wump != null){
if(players.length==1){
new GameOver(curPlayer.score, "You were eaten by the Wumpus!");
}
... |
def4290a-2a8c-4444-82f1-6335a28b3c6f | 9 | public void checkFilesExist() {
String currDateString = DateModifier.getCurrDate();
fileName = "archives.txt";
File ArchivesFile = new File(fileName);
if (!ArchivesFile.exists()) {
PrintWriter writer = null;
try {
writer = new PrintWriter(fileName, "UTF-8");
} catch (FileNotFoundException | Unsuppo... |
c9e00281-fd5d-42cf-aed4-ece927bfdefe | 1 | public double haeVuosimyynti(int vuosi) throws DAOPoikkeus {
TilastointiDAO tilasto = new TilastointiDAO();
HashMap<Integer, Tilastointi> kktilaukset = tilasto.haeTilaukset(vuosi);
double vuosimyynti = 0;
for (int i = 1; i < 13; i++) {
Tilastointi tilastot = kktilaukset.get(i);
v... |
87b4d857-62e5-4910-aa11-092fe1992d08 | 7 | @Override
public void spring(MOB target)
{
if(target.location()!=null)
{
if((!invoker().mayIFight(target))
||(isLocalExempt(target))
||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))
||(target==invoker())
||(doesSaveVsTraps(target)))
target.location().show(target,null,null,CMMs... |
4f66fcd2-36d3-4906-baef-a5f654912932 | 2 | public Object get(String name) throws IllegalAccessError {
int index;
if((index = ObjectNames.indexOf(name)) != -1) {
if(ObjectType.get(index) == OBJECT_ARRAY) {
//technically miss used exception I think, but it fits the purpose
throw new IllegalAccessError("You may only access saved Arrays via the getAr... |
c052cf33-d259-4747-b14f-8f2352b1c6b7 | 0 | public Date getDate() {
return date;
} |
f110791a-4d64-403f-899c-0a3a49ee518b | 4 | @Override
public Intersection findIntersect(Ray r) throws Exception {
Intersection closest = null;
for (Entity o : entities) {
Intersection p = o.findIntersect(r);
if (p == null) {
continue;
}
if (closest == null) {
closest = p;
continue;
}
if (p.getDistance() < closest.getDistance())... |
d945ce89-cef5-4a81-8ae4-458470ea37af | 9 | public void writeTRJ(String filename, int reldepth, String release) {
File file = new File(filename);
BufferedReader br = null;
String ln = null;
try {
br = new BufferedReader(new FileReader(file));
br.readLine();
ln = br.readLine();
while (ln != null) {
StringTokenizer stk = new StringTokeniz... |
65e14816-6f86-433a-b69a-48cade1ad292 | 2 | protected void processMouseWheelEvent(MouseWheelEvent e) {
if (hasFocus()) {
int code = InputManager.MOUSE_WHEEL_DOWN;
if (e.getWheelRotation() < 0) {
code = InputManager.MOUSE_WHEEL_UP;
}
mapGameAction(code, true);
}
e.cons... |
68630c26-9439-48cb-a290-21c9ab86dea9 | 0 | public void setQuantita(Integer quantita) {
this.quantita = quantita;
} |
2713f80e-ccb3-4b46-a9fe-104025962319 | 5 | @SuppressWarnings ("unchecked")
protected final void delete(final BaseItem item) throws NullPointerException, IllegalArgumentException {
switch (item.state()) {
case Item.APPEND_STATE:
case Item.UPDATE_STATE:
case Item.REMOVE_STATE:
if (!this.equals(item.pool())) throw new IllegalArgumentException();
... |
c44f6944-65bd-4a70-b766-1a44947e638e | 0 | public static void main(String[] args) {
SprinklerSystem sprinklers = new SprinklerSystem();
System.out.println(sprinklers);
} |
74ab9d5c-f316-4f70-a9bf-030a6dfaecce | 1 | public void cancel() throws java.io.IOException {
if (!(getStatus() == SubLWorkerStatus.WORKING_STATUS)) { return; }
CycAccess cycAccess = getCycServer();
synchronized (cycAccess) {
cycAccess.getCycConnection().cancelCommunication(this);
}
} |
2a0e373c-853a-4853-b510-ed53b7eeb5eb | 0 | public void grow(float size)
{
this.size += size;
} |
348718eb-fbf7-44fb-bc8e-17f77cc659b7 | 9 | public void start() throws IOException {
/* Open DB Connection */
MongoClient mongoClient = new MongoClient(new ServerAddress("localhost", 27017));
ObservableThread userInputThread = new ObservableThread() {
@Override
public void run() {
try {
new BufferedReader(new InputStreamReader(System.in))... |
4607aa03-46b1-4277-b641-52ab358765fc | 4 | void doLower() {
if (gameInProgress == false) {
// If the game has ended, it was an error to click "Lower",
// So set up an error message and abort processing.
message = "Apasa \"Joc nou\" pentru a incepe!";
repaint();
return;
}
... |
a7608211-a1a6-49d0-9c8d-d44b39abb593 | 9 | public void GetInput() {
if (Input.MousePressed(org.newdawn.slick.Input.MOUSE_LEFT_BUTTON)) {
if ((Mouse.getX() >= this.x && Mouse.getX() <= this.x+48) && ((Main.SCREEN_HEIGHT-Mouse.getY()) >= this.y && (Main.SCREEN_HEIGHT-Mouse.getY()) <= this.y+48)) {
clicked = true;
}
}
if ((Mouse.getX() >= this.x... |
a2cf9451-b14e-4e35-a895-a51b15623c38 | 4 | private static int lcmList(ArrayList<Integer> list) {
if (list.size() == 0)
throw new NullPointerException();
if (list.size() == 1)
return list.get(0);
if (list.size() == 2)
return lcm(list.get(0), list.get(1));
int result = list.get(list.size() - 1);
for (int i = list.size() - 1; i >= 0; i--)
res... |
97f870db-327a-48de-bf36-1d45af7ba2ad | 1 | void draw(Graphics2D g) {
this.g = g;
if (Main.SELECTED_SUBJECT != null) {
reversDrawSubject(Main.SELECTED_SUBJECT, null, GCENTER);
} else {
drawSubject(Main.system, GCENTER);
}
drawRuler(100, 1050, 540);
} |
4287a8ac-0e63-4fe4-84da-19033856ea9e | 4 | private void writeKeywordFile(String[] keywords, boolean black) {
String temp = (black? "": ": ");
for (String s: keywords) { temp += s+", "; }
try {
if(!black){
out = new BufferedWriter(new FileWriter(fileName+"KeywordsList.txt",true));
out.append(fm.format(new Date())+temp+"\n");
}else{
out = ... |
a8378e7a-1528-44db-9d05-f36b10320fbc | 3 | public void repaintTripleBuffer(Rectangle clip)
{
if (tripleBuffered && tripleBufferGraphics != null)
{
if (clip == null)
{
clip = new Rectangle(tripleBuffer.getWidth(),
tripleBuffer.getHeight());
}
// Clears and repaints the dirty rectangle using the
// graphics canvas of the graph compo... |
f62eb2cf-2b7f-49f7-9cd3-82fea07e1d22 | 9 | public String getCurrentLightConditions(DemonstratorMain main, String dbName, boolean useJSON, LocalTime currentTime){
String lightConditions = "";
try {
//time since last update of the solar altitude (times for sunrise and sunset)
long diffInHours = Duration.between(lastUpdateSolarAltitude, LocalDateTime.... |
49a22de7-ec9c-4f82-800a-f92a20f69bb9 | 1 | private List<String> parseParameterTypes(String signature) {
int positionOfParameterStart = signature.indexOf("(");
int positionOfParameterEnd = signature.indexOf(")");
String allParams = signature.substring(positionOfParameterStart + 1,
positionOfParameterEnd);
String[] paramsInArray = al... |
b3a182a8-8f22-465e-8a6a-f10cd8f0f147 | 1 | private ServerSocket createServerSocket() {
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(this.serverInfo.getPort());
this.log.info("create Server Socket: " + serverSocket.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
server... |
66769c6d-65d9-44d8-ab6e-a44cd5dd666c | 4 | public void keyPressed(KeyEvent event) {
// println("You pressed: " + event.getKeyCode() + ", " + event.getKeyChar());
if (event.getKeyCode() == KeyEvent.VK_ESCAPE) {
System.exit(0);
} else if (event.getKeyCode() == KeyEvent.VK_ENTER) {
lab.genNewLab();
render();
} else if (event.getKeyCode() == KeyEven... |
f64779ec-6e9e-4939-8d4c-7b744c3783c0 | 2 | private Route contrueerRoute(RouteMetaData routemd[][], Knooppunt eind) {
Route korsteRoute = null;
if (routemd[eind.rij][eind.kol] != null) {
korsteRoute = new Route();
Knooppunt huidig = eind;
while (huidig != null) {
korsteRoute.prependKnooppunt(hu... |
9a393aea-cffd-45a5-aae6-f0abe97c7520 | 9 | @Override
public void simpleUpdate(float tpf) {
//For player movement and cam follow
Vector3f camDir = cam.getDirection().clone().multLocal(0.6f);
camDir.y*=0.3f;
camDir.normalize();
Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f);
walkDirection.set(0, 0, 0);... |
3c4b96e3-b6b5-4cb8-9e0d-b5d6eff2a04b | 7 | private void processThreePlayerActions(AIConnection currentPlayer){
JSONObject first = currentPlayer.getNextMessage();
JSONObject second = currentPlayer.getNextMessage();
JSONObject third = currentPlayer.getNextMessage();
int validActions = 0;
if(letPlayerPerformAction(first, currentPlayer, 2)){
broadcastActi... |
19e7e416-31f0-4088-87f4-c9a2e6d3984a | 2 | public static void main(String[] args) throws FileNotFoundException {
FileInputStream fileInputStream;
try {
fileInputStream = new FileInputStream("D:\\chapter7_exceptions_test.txt");
System.out.println("File Opened...");
fileInputStream.read();
System.... |
385cb53e-d440-46e7-be4d-e2a289b35791 | 3 | public Config() {
File file = new File("config");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder;
try {
dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(file);
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch blo... |
c684fb47-87db-456f-b996-00afcd521b8a | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Ausencia)) {
return false;
}
Ausencia other = (Ausencia) object;
if ((this.id == null && other.id != null) || (... |
c8a3007b-50ce-4520-96c2-d31b4ff46a8b | 6 | private <T> String getBeanName(Class<T> registeredClass) {
Class<?>[] interfaces = registeredClass.getInterfaces();
if (interfaces != null && interfaces.length > 0) {
for (Class<?> anInterface : interfaces) {
if (matchInterfaceClassName(registeredClass, anInterface)) {
... |
3d6e2001-5834-4392-908a-80746222e995 | 4 | public static double jauPap(double a[] , double b[] )
{
double am, au[] = new double[3], bm, st, ct, xa, ya, za, eta[] = new double[3], xi[] = new double[3], a2b[] = new double[3], pa;
/* Modulus and direction of the a vector. */
NormalizedVector nv = jauPn(a );
am = nv.r; au = nv.u;
... |
233b52b6-3c82-4e03-a89d-574a563e72d6 | 1 | public void refresh(){
try {
questionDAO = new QuestionDAO();
List<SettingQuestion> questions = null;
questions = questionDAO.getAllQuestion();
QuestionTableModel model = new QuestionTableModel(questions);
questionTable.setModel(mod... |
5241a7f3-1827-4a72-8845-82e86cb0b94b | 6 | public boolean skipField(final int tag) throws IOException {
switch (WireFormat.getTagWireType(tag)) {
case WireFormat.WIRETYPE_VARINT:
readInt32();
return true;
case WireFormat.WIRETYPE_FIXED64:
readRawLittleEndian64();
return true;
case WireFormat.WIRETYPE_LENGTH_... |
c71adeb0-8cf9-4c96-80e3-70d4b0865e98 | 2 | public void keyTyped(KeyEvent e) {
switch (e.getKeyChar()) {
case '[':
controller.setBrushSize(controller.getBrushSize() - 1);
break;
case ']':
controller.setBrushSize(controller.getBrushSize() + 1);
break;
}
} |
06fb6cca-feb3-44bd-9f61-b1a253257ad8 | 7 | private void button_add_red_hitboxMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button_add_red_hitboxMousePressed
if(frame_index_selected!=-1)
{
if(current_frame==null)
{
Element new_frame = hitboxes_doc.createElement("Frame");
new_frame.setAttribute("num... |
577d2473-7f63-4474-93e5-5302048fd1ab | 3 | public int addSoundtrack(OggAudioHeaders audio) {
if (w == null) {
throw new IllegalStateException("Not in write mode");
}
// If it doesn't have a sid yet, get it one
OggPacketWriter aw = null;
if (audio.getSid() == -1) {
aw = ogg.getPacketWriter();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.