method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6ead4843-1669-4190-93db-7ce52e6102b3 | 1 | public static synchronized DAOFactory getInstance() {
if (daoFactory == null) daoFactory = new DAOFactory();
return daoFactory;
} |
cb361817-8ba6-4cc9-93cf-72ea8312f990 | 0 | public void setId(String value) {
this.id = value;
} |
64881944-f05c-4340-87a3-fd9c6a98a833 | 0 | public void setRange(int min, int max)
{
myMax = max;
setMin(min);
} |
8e8e8d14-3f57-42cf-bf7a-dd8b50c5b38c | 9 | public boolean scanBoolean() throws StringScanException {
StringScanException exception = null;
int idxSave = idx;
String testStr = "false"; // MUST BE LOWERCASE
boolean testval = false;
char c;
skipWhiteSpace();
if (Character.toLowerCase(buf[idx]) == 't') {
testStr = "true";
... |
3517977c-657c-4848-9be5-84ce37225ef0 | 3 | public void rebuildTreeList() {
if (tree != null && treePane != null) {
tree = null;
}
treePane.remove(treeScroll);
getTreeList();
createTree();
treeScroll = new JScrollPane(tree);
treePane.add(treeScroll);
try {
treePane.setSelected(true);
} catch (PropertyVetoException e) {
e.printStackTrac... |
6ef5210e-218b-4d42-828b-b51c7055c296 | 1 | @Override
public void collideWithMovableElement(ElementField element, CollisionMan.TYPE type) {
//Спрайт мяча
Sprite sp = Buffer.findSprite(this);
//Спрайт элемент, с которым произошло столкновение
Sprite el = Buffer.findSprite(element);
if (type == CollisionMan.TYPE.PAIR) {
... |
4f980d2d-86db-43a4-8554-71ff30225653 | 2 | public static HighScore read(int n, String file){
HighScore r = null;
try{
RandomAccessFile f = new RandomAccessFile(file, "r");
f.seek(n * FILE_SIZE);
char[] ch = new char[STRING_SIZE];
for(int i = 0; i<STRING_SIZE; i++){
ch[i] = f.readChar();
}
int s = f.readInt();
r = new HighScore(ch, s... |
d56634da-cc77-4833-89ce-82857d8222a6 | 6 | @Override
public boolean validate(MessageCollector collector, User target) {
boolean result = true;
if (!isEmpty(target.getLogin())) {
if (usersRepository.findByLogin(target.getLogin()) != null) {
collector.addMessage(Severity.error, "Такой пользователь у... |
b9dc9928-3b12-4ae6-a91c-821d75aa9074 | 8 | private static int maxProduct() {
int horizontal = -1, vertical = -1, diagonal1 = -1, diagonal2 = -1, max = 0;
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 20; j++) {
if (i + 3 < 20)
vertical = num(i, j) * num(i + 1, j) * num(i + 2, j) * num(i + 3, j... |
37b41514-f192-4bf2-9e28-3c6abe06bfe6 | 0 | private Filters()
{
// do nothing
} |
b4f96191-806c-4c7f-b94f-6aac3659881d | 1 | @Override
public void removeServerExceptionListener(IExceptionListener listener) {
if (serverExceptionListenerList != null) {
serverExceptionListenerList.remove(IExceptionListener.class, listener);
}
} |
07244088-8be9-48ec-86d8-2abc6391c7cf | 9 | public void execute(Logger logger) {
GameSession session = new GameSession(channel);
DatabaseConnection con = DatabaseManager.getSingleton().getConnection("player-loader");
DatabaseResult result = null;
String hashedPass = "failed";
int rights = 0;
try {
hashedPass = Misc.getMD5(password);
} catch (Exc... |
5eb5605a-4282-4e66-863a-3fb5b37971e9 | 2 | public int[] twoSum2(int[] numbers, int target) { // O(n) solution
Map<Integer, Integer> numMap = new HashMap<Integer, Integer>();
int [] res = new int[2];
for(int i = 0; i < numbers.length; ++i){
if(numMap.containsKey(target - numbers[i])){
res[0] = numMap.get(target - numbers[i]) + 1;
res[1] = ... |
e5f10430-f292-40f9-ab5a-2295b35cae76 | 3 | private int[] smallestIndices() {
int[] smallest = new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE };
for (BufferedImage b : history) {
if (b.getWidth() < smallest[0])
smallest[0] = b.getWidth();
if (b.getHeight() < smallest[1])
smallest[1] = b.getHeight();
}
return smallest;
} |
27437cc3-7ef4-416b-b8f9-d49d8537bf1c | 9 | public static ArrayList<String> parseDoc( File f ){
importFiles = new ArrayList<String>();
try{
filePath = f.getAbsolutePath();
Scanner scan = new Scanner(f);
String readline;
boolean commentStart = false;
while ( scan.hasNextLine() ){
readline = scan.nextLine();
Pattern startBlock = Pattern.... |
a765df42-7e41-48f2-a575-50c541274c78 | 2 | public int size() {
int s = 0;
for (Attribute r : attr.keySet())
if (attr.get(r) != 0) s++;
return s;
} |
4b2ded6b-e1af-48c3-9108-9678dc37e4fc | 4 | public void loadFile(){
try
{
File file = new File(getDataFolder() + "/names.txt");
boolean newFile = file.createNewFile();
if (newFile)
{
getLogger().info("Created a file called names.txt");
}
BufferedReader read =... |
3351ef4f-e8c2-4fda-a49b-05746441b8a6 | 8 | private void constructDissertation(JSONObject object, Connection conn) {
PreparedStatement prep = null;
JSONArray dissertArr = null;
try {
dissertArr = object.getJSONArray("Dissertation Info");
} catch(Exception ex) {
ex.printStackTrace();
}
if... |
857fdc5f-c22b-458a-a464-c70a9007f744 | 2 | @Override
public Point getToolTipLocation(MouseEvent event) {
int x = event.getX();
Column column = overColumn(x);
if (column != null) {
Row row = overRow(event.getY());
if (row != null) {
Rectangle bounds = getCellBounds(row, column);
return new Point(x, bounds.y + bounds.height);
}
}
retur... |
8a105b9b-bbe1-4391-8716-a9570daed5fb | 4 | public static List<Field> parameter(Class<?> comp) {
List<Field> f = new ArrayList<Field>();
for (Field field : comp.getFields()) {
Role r = field.getAnnotation(Role.class);
if (r != null && Annotations.plays(r, Role.PARAMETER)) {
f.add(field);
}
... |
23ba63ce-85e6-46a9-96e1-f60b5ea21c09 | 6 | public void playSoundLine(int index) {
if (!run)
return;
StaffNoteLine s = theStaff.getSequence().getLine(
(int) (currVal.doubleValue() + index));
ArrayList<StaffNote> theNotes = s.getNotes();
tracker.stopNotes(s);
for (StaffNote sn : theNotes) {
... |
d1b4e424-9f23-4a1b-a621-71f092bfb6df | 2 | protected Transition createTransition(State from, State to, Node node, Map e2t, boolean isBlock)
{
/*
* The boolean isBlock seems to be ignored in FSATransducer.java, so I'm ignoring
* it here too.
*/
String label = (String) e2t.get(TRANSITION_READ_NAME);
String o... |
e06c941c-7ffe-457a-9936-f9b05b4c29b0 | 4 | @EventHandler
public void onPlayerInteractEvent(PlayerInteractEntityEvent e){
Player master = e.getPlayer();
Entity entity = e.getRightClicked();
PlayerLead.server.broadcastMessage("before");
if (plugin.checkLasso(master) && (entity instanceof Player) && !(entity instanceof NPC)){
try {
NPC test = (N... |
395be69f-4d4b-4459-9e7b-7f418e84ab25 | 1 | static Coordinate calcAbsPosition(Subject subject) {
double gx, gy;
if (subject.meta.type == SubjectType.SHIP) {
gx = (subject.parent.size + subject.p.radius) * cos(subject.p.angle);
gy = (subject.parent.size + subject.p.radius) * sin(subject.p.angle);
} else {
... |
ecb669d8-bd50-4fd2-b7fb-daaefa6ddeeb | 4 | public static Locale getLocaleFromString(String localeString) {
if (localeString == null) {
return null;
}
localeString = localeString.trim();
if (localeString.toLowerCase().equals("default")) {
return Locale.getDefault();
}
// Extract language
int languageIndex = localeString.indexOf('_');
Strin... |
a8795690-ef44-4eb1-8b04-bc58c5082603 | 2 | public void exibirCepZipCode(String numero){
String res = null;
for(int n = 0; n < zipCodes.size(); n++){
if(zipCodes.get(n)== numero){
res = zipCodes.get(n);
}
}
System.out.println(res.substring(0, 5)+"-"+res.substring(5));
} |
ec7814db-8090-46d8-9325-6d8d73ebb159 | 9 | public boolean similar(Object other) {
try {
if (!(other instanceof JSONObject)) {
return false;
}
Set<String> set = this.keySet();
if (!set.equals(((JSONObject)other).keySet())) {
return false;
}
Iterator<St... |
f8b66a36-affe-4143-a03b-403915d55d22 | 5 | public static void main(String[] args) throws IOException {
GraphIndexer indexer = new GraphIndexer();
indexer.init();
Path start = new Path("/tmp/start");
Path output = new Path(args[1]);
FileSystem fs = FileSystem.get(new Configuration());
fs.delete(start, true);
System.out.println("!!!!");
fs.mkd... |
a6c5e559-319c-4d18-8ffc-6ee21c8131fe | 9 | protected MediaWiki editPage(final MediaWiki.EditToken editToken, final String section, final Boolean requireExist, final String text, final String editSummary, final boolean bot, final Boolean minor) throws IOException, MediaWiki.MediaWikiException {
final Map<String, String> getParams = paramValuesToMap("action", "... |
9d2081d7-7418-4d3a-a4a1-a486c662238d | 9 | final public void Function_head() throws ParseException {
/*@bgen(jjtree) Function_head */
SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_HEAD);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(FUNCTION);
... |
d49446e5-1fbf-46c1-9b7d-0f57c99caf86 | 4 | public int read(BitReader bitreader) throws JSONException {
try {
this.width = 0;
Symbol symbol = this.table;
while (symbol.integer == none) {
this.width += 1;
symbol = bitreader.bit() ? symbol.one : symbol.zero;
}
tick(... |
f731152d-6fd6-451f-89a3-dc7b62a3db05 | 8 | private void pathFollow()
{
Vec3D var1 = this.getEntityPosition();
int var2 = this.currentPath.getCurrentPathLength();
for (int var3 = this.currentPath.getCurrentPathIndex(); var3 < this.currentPath.getCurrentPathLength(); ++var3)
{
if (this.currentPath.getPathPointFromI... |
cde48cb5-72f8-4281-a260-48f65597b4bf | 2 | @Override
public int run(String[] args) throws Exception {
Job countJob = new Job();
Job generateJob = new Job();
//Parse Arguments and Setting Job.
parseArguementsAndSetCountJob(args, countJob, generateJob);
//Run counter job.
countJob.waitForCompletion(true);
Counters counters = countJob.getCounters()... |
c2a2a7f3-77cf-4cbe-a3ad-ede3f1dda855 | 8 | private Registration parseRegistration(XmlPullParser parser) throws Exception {
Registration registration = new Registration();
Map<String, String> fields = null;
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.S... |
c84b54c9-be3c-4f55-8f52-cf72a1338039 | 2 | @Override
public void run() {
this.running = true;
while (this.running) {
try {
Thread.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
//Thread.yield();
}
} |
6bfdbf37-dfaf-4ca5-81cb-d158a90df926 | 8 | public static String getColumnString(int column) {
String strColumn = "unknown";
switch (column) {
case COLUMN_A: strColumn = "A"; break;
case COLUMN_B: strColumn = "B"; break;
case COLUMN_C: strColumn = "C"; break;
case COLUMN_D: strColumn = "D"; break;
... |
f2dcb22e-3cc6-471d-91f9-93d0e5fb64d0 | 7 | public void start() throws MediaException {
//System.out.println("START REQUEST: "+this);
if(state == CLOSED) {
throw new IllegalStateException();
}
if(state == STARTED) return;
if(state == UNREALIZED || state == REALIZED){
prefetch();
... |
cf940971-3959-42df-9749-407e3947d389 | 5 | private void initComponents() {
JButton button = null;
// Let's hear it for sloth!
button = new JButton("Finite Automaton");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
createWindow(new automata.fsa.FiniteStateAutomaton());
}
});
getConten... |
a8183a59-78b3-49b0-b56a-a5eca13cfa0a | 1 | @Test
@Ignore
public void test_PersonalEventsGet()
{
PersonalEventList laPEList = laClient.getPersonalEvents(
"20100729225131564332000000", "2012-01-25-12.36.43.023001");
if (laPEList.getPersonalEventList().size() > 0)
{
System.out.println(((PersonalEvent) laPEList.getPersonalEventList().get(0))
.g... |
f2185fa7-297e-4cfc-9d20-96559b294107 | 5 | public void coolOff(boolean buffedUp){
if (!firedUp && turnedOn){
coolant++;
if (coolant == (int)firingCoolDown*.75 && buffedUp){
firedUp = true;
coolant = 0;
shotsReady = maximumShots;
}
else if (coolant == firingCoolDown){
firedUp = true;
coolant = 0;
shotsReady = maximumShots;
... |
fc93db53-0041-4e04-8f0b-76b0b7115905 | 7 | protected static void loadExecutionPlansForStatements(List<DeltaSQLStatementSnapshot> sqlStatements,
ProgressListener progressListener) {
if (progressListener != null) {
progressListener.setStartValue(0);
progressListener.setEndVa... |
4518e55f-c97b-4204-9d33-c443e24b901f | 8 | @Override
protected void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
ss = value.toString();
String PostTypeId = "";
String Date = "";
String Tags = "";
StringBuilder sb = new StringBuilder();
ByteArrayInputStream bis = new ByteArrayInputStream(ss.getByte... |
81b67333-78df-4dff-b9ad-7c975c525df5 | 0 | public SimpleVector getInitialPosition() { return initialPosition; } |
536be244-0711-49c6-a881-5a169aac12d7 | 5 | @Override
/**
* creates a Socket if a connection is incoming, then reads the stuff we get
* and passes it to the ParserContainer
*/
public void run() {
while (alive) {
logger.log(2, logKey, "worker is now running in the while(alive) loop\n");
try (
... |
5d5f36e8-9cd0-4062-9923-343c7b2a5bb9 | 2 | private void findChanged(List<ClassChangeList> changedList, Node actual, ObjectStack otherStack)
{
// list all super-classes of actual
List<Node> supers = actual.getSupers();
for (Node s : supers)
{
//check if the two nodes are directly connected
if (!otherStack.hasSuper(actual, s))
{
ClassChangeL... |
68467961-f0b9-4f5b-b316-e156e87ab5e4 | 1 | private Stream<String> placePartOfChain(Stream<String> boardsStream) {
Set<String> boards = boardsStream.collect(Collectors.toSet());
Integer numberOfFigures = figureQuantityMap.get(getName());
if (Objects.nonNull(numberOfFigures)) {
IntStream.range(0, numberOfFigures)
... |
b98616d1-8f16-4b15-83bb-febbe6004d10 | 4 | public boolean connect() {
for(int i = 0; i < 3; i++) {
try {
_remoteObj = (ServerInterface) Naming.lookup("rmi://127.0.0.1:9090/server1");
_remoteObj.ping();
System.out.println("Connected to Server 1");
return true;
} catch(Exception ex) {
System.out.println("Server 1 is not responding. \nR... |
bccc5aad-5517-4236-97f3-4ebdf22bb114 | 8 | @Override
public void run() {
script.familiarFailed.set(false);
renew(script);
ctx.sleep(1000);
if (script.familiarFailed.get()) {
script.options.status = "Renewing familiar failed";
final Tile start = ctx.players.local().tile();
final List<Tile> tiles = familarTile(ctx);
for (final Tile tile : ti... |
dfd3a286-cdf0-421e-8893-3cea4aaee11b | 5 | private void ok() {
String key = attributeField.getText();
String value = valueField.getText();
AttributeTableModel model = (AttributeTableModel) panel.getModel();
// Validate Existence
if ((key == null) || key.equals("")) {
errorLabel.setText(ERROR_EXISTANCE);
return;
}
// Validate alpha-nume... |
6533ec7b-2156-45c4-80d1-f746047785c4 | 7 | @Override
public void decode(FacesContext context, UIComponent component) {
FileUpload fileUpload = (FileUpload) component;
if (!fileUpload.isDisabled()) {
ConfigContainer cc = RequestContext.getCurrentInstance().getApplicationContext().getConfig();
String uploader = cc.getU... |
17283a39-64a7-4522-ba46-e630f4c5448d | 5 | public void setDisabledPlugins(Collection<PluginWrapper> plugins)
{
if (!plugins.isEmpty())
{
StringBuilder sb = new StringBuilder();
Iterator<PluginWrapper> it = plugins.iterator();
if (!it.hasNext())
{
return;
}
while (true)
{
PluginWrapper p = it.n... |
83aa3973-a407-4067-a594-5184f38d3835 | 4 | public boolean hidePlayer(Player player) {
if (this.hiders.contains(player)) return false;
//Event
HidePlayerEvent event = new HidePlayerEvent(player);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) return false;
this.hiders.add(player);
for (Player p : Bukkit.getOnlinePlayers(... |
9ad7096a-08dc-4c98-b583-b31aeef13464 | 4 | public static boolean isCaptureMove(Board b, Move m, int color) {
int opponentColor = opponentColor(color);
if (color == Board.white) {
if (b.board[m.end.rank][m.end.file] < 0) {
return true;
}
} else if (color == Board.black) {
if (b.board[m.end.rank][m.end.file] > 0) {
return true;
}
}
r... |
2afaad7b-906f-42b7-bd91-749a7b5fd578 | 8 | public void put(String name, Object value) {
if(value == null) {
with(name, "NULL");
}else if(value instanceof String) {
with(name, (String)value);
} else if(value instanceof NVBase) {
with(name, (NVBase)value);
} else if(value instanceof Integer) {
with(name, (Integer)value);
} else if(value inst... |
0f2c2440-9f54-485f-a493-a2dbcdbeb4ae | 4 | public Batch <Upgrade> workingUpgrades() {
final Batch <Upgrade> working = new Batch <Upgrade> () ;
if (upgrades == null) return working ;
for (int i = 0 ; i < upgrades.length ; i++) {
if (upgrades[i] != null && upgradeStates[i] == STATE_INTACT) {
working.add(upgrades[i]) ;
}
}
r... |
d89d2c2a-b483-40d9-bdd7-3754501e5ecb | 9 | public void print(String prefix) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if (prefix != null)
pw.printf ( "%s", prefix);
byte []data = getData();
int size = size();
boolean is_bin = false;
int cha... |
1a0e7f1a-393e-49d8-8439-2a92145e8991 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
80a4080c-f5f9-4980-8105-b7322884a707 | 9 | protected void resolveTransitions(Element root, Map<String, Element> stateMap, Map<Element, Element> transMap) {
for(Element state: root.getChildren(STATE_TAG)){
boolean hasTimeout = false;
for(Element trans: state.getChildren(TIMEOUT_TAG)) {
Element target = stateMap.get(trans.getAttributeValue(TRANSIT... |
9e74eac9-aa9d-4d08-a897-ab25cc5f816a | 6 | public static void retractFactsOfInstance(LogicObject self) {
if (self == null) {
return;
}
{ Proposition p = null;
Cons iter000 = Logic.allFactsOfInstance(self, false, true).theConsList;
loop000 : for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
p = ((Proposition)(iter00... |
c69799b6-8bb5-4cf5-b790-404682220b6b | 2 | private void calculateEnabledState(Document doc) {
if (doc == null) {
setText(TEXT);
setEnabled(false);
} else {
setText(new StringBuffer().append(TEXT).append(" ").append(doc.getUndoQueue().getUndoRangeString()).toString());
if(doc.getUndoQueue().isUndoable()) {
setEnabled(true);
} else {
se... |
a8472246-863c-497c-92cd-0590a131a42f | 7 | final private void compile() {
children = (XML[]) childList.toArray(XML.class) ;
attributes = (String[]) attributeList.toArray(String.class) ;
values = (String[]) valueList.toArray(String.class) ;
if (children == null)
children = new XML[0] ;
if ((attributes == null) || (values == null))
... |
b896abf9-314b-4919-b382-c9cb5e0049ad | 2 | @Override
public Source putSource(Source s) throws JSONException,
BadResponseException {
Representation r = new JsonRepresentation(s.toJSON());
r= serv.putResource("intervention/" + interId + "/source", null, r);
Source source = null;
try {
source= new Source(new JsonRepresentation(r).getJsonObject());... |
086ebc10-a7d1-471b-a9fb-ed9e26f47c22 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (depDepartamento != null ? depDepartamento.hashCode() : 0);
return hash;
} |
d4b1e2aa-2bf2-4e7e-9caf-64f80200a7c5 | 2 | @Override
public void meetWith(Host host) {
if (host == null) {
return;
}
try {
exchange_.execute(host);
} catch (CommunicationException e) {
logger_.error("{}:{} cannot be reached.", host, host.getPort());
repair_.fixNode(host);
... |
402f8daa-c467-4289-b283-a3a9b55f90da | 1 | public void upkeep(){
build_level+=(Empous.Gov.getStat("infrastructure")-7)*build_rate;
if (build_level>max_build)
build_level=max_build;
} |
d3d114b3-b8d3-4b52-bab9-4d38e9cbc509 | 8 | public static int search(int[] A, int target) {
int index = -1;
int left = 0;
int right = A.length - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if(A[mid] == target){
return mid;
}
if (A[left] <= A[mid]) {
if (target >= A[left] && target <= A[mid]) {
ri... |
cc2d78e3-da62-4022-add2-4ded9d2fe2c4 | 4 | public static Player getPlayersOfTeam(Teams team) {
switch (team) {
case GREEN:
return greenMembers;
case RED:
return redMembers;
case ORANGE:
return orangeMembers;
case BLUE:
return blueMembers;
default:
return null;
}
} |
b3894fcb-9be4-4544-8964-ead1506449ea | 5 | public String[] JSONReadInt( String pNombre, int pCantidad) {
JSONParser parser = new JSONParser();
String [] arregloInt = new String [pCantidad];
int cont = 0;
try {
Object obj = parser.parse(new FileReader("src/" + pNombre +".json"));
JSONObject jsonObject = ... |
4cdd7ddc-de64-49cc-93f1-31a5b47c68a2 | 6 | @EventHandler
public void SpiderHeal(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.getSpiderConfig().getDouble("Spider.Heal.Dodge... |
8ab511d6-77d6-41a9-ad55-d57bc7716de7 | 5 | private VeldType[][] genSpeelveld(double aandeelLeeg) throws IllegalArgumentException {
if(aandeelLeeg < 0 || aandeelLeeg > 1) throw new IllegalArgumentException("De verhouding tussen lege velden en muren moet tussen 0 en 100 liggen");
int max = 2;
int min = 1;
int range = (max - min) +... |
ea6851c7-a7b4-414a-9640-e2aec4ac8ed2 | 8 | @Override
public void close() throws IOException {
if(os != null){
try{
os.flush();
os.close();
os = null;
} catch (IOException e ){
e.printStackTrace();
}
}
if(fWriter != null){
try{
fWriter.close();
fWriter = null;
} catch (IOException e ){
e.pri... |
7ae39f8f-e8e5-4a3d-853b-78fd86caf1c5 | 4 | public String parse(CodeType codetype, boolean printLineNumbers, boolean genNewName){
Tree.printLineNumber = printLineNumbers;
Tree.generateNewNames(genNewName);
Tree.initializeIdentifierTable();
Tree tree = programPro();
if(codetype == CodeType.JS_MINIFIED)
return tree.toString();
else if(codetype == C... |
c1e25fd0-a17b-40e7-bc0c-79d5a0276c50 | 9 | public static void main(String[] args) {
logger.setLevel(Level.SEVERE);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.SEVERE);
logger.addHandler(handler);
if (args.length == 0) {
logger.warning("Invalid arguments count.");
return;
... |
f492b64f-5ad7-4ffc-8da4-16dd36515002 | 9 | private void addCustomer(int customernum) {
int index;
Customer c = factory.makeCustomer();
c.setCustomernumber(customernum);
int smallestnumberofitems;
int currentitems;
int lanetoaddto = -1;
if (this.val.expresslanenum > 0) // there are express lanes
{
if (c.size() <= this.val.expresslaneitemlimit)... |
e668aaa2-37a8-4ea8-9658-4c2bde76aeb7 | 0 | public void setJList(DefaultListModel<String> uList)
{
//System.out.println("asdf");
//dListModel = uList;
} |
b3a734ad-b34d-4952-9826-0c4570780390 | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
827d7541-0af1-4256-aa10-ca735ba1fd7b | 0 | @Size(min = 2)
public String getPin() {
return pin;
} |
1278979d-c8c7-4f1d-a71d-e5e577409a93 | 0 | @Override
public void setAddress(Address address) {
super.setAddress(address);
} |
527121ec-99d1-45ce-b92d-039fe736d990 | 4 | static LinkedListNode getKth(LinkedListNode n, int k) {
int i = 0;
LinkedListNode m = n;
while (i<=k && m!=null) {
m = m.next;
i += 1;
}
if (i != k+1) return null;
while (m != null) {
n=n.next;
m=m.next;
}
re... |
a4e29607-bd9d-4cb8-912f-663839aff82d | 9 | private void readData(UUID parameterId) throws IOException {
String line = findLine("Obj#", false);
if (line == null) {
errorsFile.add("Can't find Obj# tag");
}
// Get the columns widths from the header
int[] columnStartingPositions = getColumnStartingPositions(line)... |
3a2a3f6d-4a60-465b-b4bc-05183d783865 | 9 | private void Heapify(int i) {
int left = (2*i + 1);
int right = (2*i + 2);
Racer leftRacer = null;
Racer rightRacer = null;
if(left < heapSize-1)
{
leftRacer = heapArray[left];
}
if(right < heapSize-1)
{
rightRacer = he... |
5e57beca-ff9f-4bba-85c5-8b0e5be57c8e | 7 | public static String getFileContents(String u) {
String contents = "";
BufferedReader br = null;
try {
URL url = new URL(u);
InputStream is = url.openStream();
br = new BufferedReader(new InputStreamReader(is));
} catch (MalformedURLException e) {
... |
e2e5c077-beab-43b3-8852-538efa3a7603 | 2 | public MapModel(String mapFilePath) {
initImages();
explosionDeaths = new ArrayList<Integer>();
if (mapFilePath == null) {
generateRandomMap();
} else {
try {
loadMapFromFile(mapFilePath);
} catch (Exception ex) {
Logg... |
47a6af6e-b237-43a9-a925-5ca6d7d1e1eb | 0 | public YamlPermissionEntity(String n, ConfigurationSection config) {
super(n, config);
} |
6b7ed860-9f3b-400c-a253-d329ec04f8f0 | 5 | public static boolean stateHasChanged(int objectType, int objectX, int objectY, int objectHeight)
{
for (StateObject so : stateChanges)
{
if(so.getHeight() != objectHeight)
continue;
if(so.getX() == objectX && so.getY() == objectY && so.getType() == objectType)
return true;
}
return false;
} |
8902217a-3c82-40cf-bd0d-8e3667735d7c | 9 | private TypeAndValue plus(Vector<TypeAndValue> arguments, String caller) {
if ( arguments.size() < 1 ) {
System.err.println("Plus expected at least one argument and got zero.");
System.exit(-1);
}
// our return value
TypeAndValue ret = new MyVoid();
/... |
17c992b6-5947-417c-8710-67da5af7bc13 | 5 | public String getCuentas(){
if(numCuentas<=-1)
return null;
else{
String temp="";
for(int i=0;i<=numCuentas;i++){
temp+="Cuenta "+(i+1)+":\n"+"Numero de Cuenta:"+cuentas[i].getNumDeCuenta();
if(cuentas[i].getNumDeCuenta().charAt(0)=='C')
temp+=" Tipo de Cuenta: Cheques";
else if(cuentas[i]... |
ecd155dc-7580-46ce-8884-be114b5703c9 | 2 | public void clearScorecard() {
for (int column = 1; column < 4; column++){
for (int row = 0; row < 18; row++)
tblScorecard.setValueAt("", row, column);
}
} |
2e219090-6387-4b88-a20d-41b7f426c522 | 9 | public OptionsPanel(LauncherFrame parent)
{
super(parent);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent arg0)
{
OptionsPanel.this.setVisible(false);
}
});
launcherFrame = parent... |
f275330f-b9d9-4054-9fa7-bd2e7c75317b | 1 | public boolean evaluate_boolean(Object[] dl) throws Throwable {
if (Debug.enabled)
Debug.println("Wrong evaluateXXXX() method called,"+
" check value of getType().");
return false;
}; |
c9ccf52a-589b-4289-a699-2d5b9d91c26e | 0 | public void setTime(String timeOfDay) {
this.timeOfDay = timeOfDay;
} |
aa092ac7-ab06-44a1-b057-828f135f30f3 | 5 | public static void main(String[] args)
{
int x,y,r;
double proceso,co=1,co1=1;
x=Integer.parseInt(JOptionPane.showInputDialog("Ingrese el valor del entero X"));
y=Integer.parseInt(JOptionPane.showInputDialog("Ingrese el valor del entero Y"));
double a=(double)x;
... |
2dd56418-d9ec-49e4-8e78-d1409d93b174 | 7 | @Override
public void startElement(String s,
String s1,
String elementName,
Attributes attributes) throws SAXException
{
if (elementName.equalsIgnoreCase("bulgarian"))
{
cyrillic = true;
}
if (elementName.equalsIgnoreCase... |
afa37f0e-3035-4940-9300-9fbf6e058293 | 6 | @Override
public void update() {
if (bounded) {
int newy = y;
newy += down ? 1 : -1;
if (Game.getInstance().map.hasCollisionExcept(x, newy, this) || Game.getInstance().map.outOfBounds(x, newy)) {
down = !down;
} else {
y = newy;
}
} else {
y += down ? 1 : -1;
level--;
if (level == 0... |
ba3c2346-6578-4f65-b76a-ebcfcce9fce5 | 2 | private void createNewMap()
{
//Criando os tiles:
tileMaps = new Tile[MAP_SIZE_H][MAP_SIZE_W];
//Instanciando tudo como grama:
for (int y = 0; y < MAP_SIZE_H; y++) {
for (int x = 0; x < MAP_SIZE_W; x++) {
tileMaps[y][x] = new Tile(Tile.TILE.GRASS,... |
968b9e15-4485-48be-a264-018b5c02adca | 9 | public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
// if the element name is valid and in the elementMap
if (elementMap.containsKey(qName.toUpperCase())) {
Element name = elementMap.get(qName.toUpperCase());
// if the parent of the element is ... |
69a0a4b3-3ea9-4510-88d9-1f1081259971 | 4 | public List<String> databaseInfo(String columnName) throws SQLException{
List<String> supplierInfo=new ArrayList();
try{
databaseConnector=myConnector.getConnection();
stmnt=(Statement) databaseConnector.createStatement();
SQLQuery="SELECT * FROM... |
50899048-ee04-4a6b-897c-c03e131ee164 | 9 | @Test
public void UpdateFilesTest() {
this.observable.addObserver(this.mockObserver);
assertEquals(this.mockObserver.nbTimesUpdated,0);
File dropins = new File("./dropins/plugins/");
int preUpdate=0;
if(dropins.listFiles().length!=0){
try {
this.observable.updateFiles();
} catch (ClassNotFoundEx... |
1ad4f7cb-3890-487b-a74e-202a03a25448 | 6 | public Solver(WordSearch wordSearch)
{
this.solutions = new HashSet<>();
char[][] grid = wordSearch.getGrid();
String[] words = wordSearch.getWords();
next:
for (String word : words)
{
for (int x = 0; x < grid.length; x++)
{
for (int y = 0; y < grid[x].length; y++)
{
for (Direction d :... |
bf63bff5-464f-4a57-8673-23818eb03ea1 | 9 | public static boolean shouldIncludeFunction(Function fn) {
if (Directives.has(fn, "keep") || Directives.has(fn, "export") || Directives.has(fn, "main")) {
return true;
}
if (Directives.has(fn, "inline") || Directives.has(fn, "native") || Directives.has(fn, "!keep")) {
return false;
}
if (fn.isCompiled()... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.