method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3cad5e8c-f5f2-43ac-a4cd-8f3a9be0a7cc | 5 | void setFocusItem (CTableItem item, boolean redrawOldFocus) {
if (item == focusItem) return;
CTableItem oldFocusItem = focusItem;
if (oldFocusItem != null) oldFocusItem.getAccessible(getAccessible(), 0).setFocus(ACC.CHILDID_SELF);
focusItem = item;
if (redrawOldFocus && oldFocusItem != null) {
redrawItem (oldFoc... |
659c2881-e559-4e9e-941a-a2b573c9a54b | 8 | public Segment(JSONObject json) throws JSONException {
if (json.has(BOOKINGCLASS)) {
this.setBookingclass(new Bookingclass(json.getJSONObject(BOOKINGCLASS)));
}
if (json.has(DURATION)) {
this.setDuration(json.getString(DURATION));
}
if (json.has(CARRIER)) {
JSONObject carrierObject = json.getJSONObje... |
663adb4b-c2e6-49e5-9844-46708e2f3d9a | 5 | private boolean modificaPregunta(HttpServletRequest request, HttpServletResponse response) {
String enunciado = request.getParameter("enunciado");
String respuesta1 = request.getParameter("respuesta1");
String respuesta2 = request.getParameter("respuesta2");
String respuesta3 = request.g... |
85c2458a-dfc8-4b3c-8c63-1155f00dff29 | 2 | public void rollback ()
{
// Remove incomplete message from the outbound pipe.
Msg msg;
if (outpipe!= null) {
while ((msg = outpipe.unwrite ()) != null) {
assert ((msg.flags () & Msg.more) > 0);
//msg.close ();
}
}
} |
3e034066-c5e6-4c2b-8a15-8944dba154a5 | 4 | @Override
public void replace(byte[] newFile, Object editor)
{
if (!isAGoodEditor(editor))
throw new RuntimeException("NOT CORRECT EDITOR " + name);
if (comp == CompressionType.None)
parentFile.replace(newFile, this);
else if (comp == CompressionType.Lz)
... |
69213d0d-64a5-431f-9622-261fe6d23d84 | 0 | public Object getFirstValue() {
return getValue(0);
} |
795ec37a-255c-4ddf-a80b-1b1e4d376d1f | 8 | private static SimpleType combineEnumeration(SimpleTypeUnion orig, List<SimpleType> transformedChildren) {
if (transformedChildren.size() < 2)
return null;
SimpleType first = transformedChildren.get(0);
if (!(first instanceof SimpleTypeRestriction))
return null;
String builtinTypeName = ((Si... |
506fce1b-20f4-475a-8217-d9c3ef3fb135 | 4 | public void restoreBorder() {
int c; // count;
// top edge
c = 0; // count
for (int cx = x; cx < x + w; cx++ ) {
pixels[cx+(y*width)] = pixelsTop[c++];
}
// bottom edge
c = 0;
for (int cx = x; cx < x + w; cx++ ) {
pixels[cx+((y+h... |
8ff5aecf-472a-4584-8dc1-fa8ff3f37cfa | 4 | private void endShape(String to) {
if (to.equals("slide"))
slide.addEntity(polygon);
else if (to.equals("quizslide"))
quizSlide.addEntity(polygon);
else if (to.equals("scrollpane"))
scrollPane.addEntity(polygon);
else if (to.equals("feedback"))
quizSlide.addFeedback(polygon);
} |
31459801-38e8-432e-82c2-24d6693301d3 | 8 | public void run(String code) {
final Tokenizer tokenizer = new Tokenizer(mapping);
final List<Token> tokens = tokenizer.tokenize(code);
final Map<Integer, Integer> loopIndex = buildLoopIndex(tokens);
Stack<Integer> loopStack = new Stack<>();
int tokenIndex = 0;
while (t... |
7a56f3fa-ac2f-4da8-a80a-b395d4469a35 | 4 | @Test
public void addNewShapeToBoard() {
testee.getBoard().addNewShape(new Square());
List<CellGui> populateCells = new ArrayList<CellGui>();
List<CellGui> emptyCells = new ArrayList<CellGui>();
for (CellGui cell : testee.getCellGuis()) {
if (cell.underlying().isPopulated... |
76f631fd-1423-4f81-9b0e-aacbce4b95cd | 4 | @Test
public void testUploadFile3() {
File file = new File("e:/upyuntest/ssh_hd.zip");
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
client.uploadFile("/测试/ssh_hd.zip", fis, fis.available());
List<FileVo> list = client.listFile();
... |
7987ab6c-83d6-40da-b337-3d5af27180d0 | 3 | public int compare(Destination d1, Destination d2) {
if(d1.getDuration() == d2.getDuration()){
return 0;
} else if(d2.getDuration() > d2.getDuration()) {
return -1;
} else if(d2.getDuration() < d2.getDuration()) {
return 1;
}else{
return 0;
... |
58fed5dc-f478-4fb5-aa05-7670a33461aa | 1 | public List<AlbumType> getAlbum() {
if (album == null) {
album = new ArrayList<AlbumType>();
}
return this.album;
} |
577abfef-54f7-47aa-b2fb-b5fe7d6f6270 | 4 | public int numDefenders(int x, int y) {
// num defenders takes in the coordinates of a piece and returns the
// number of pieces on its team that are defending it.
// numDefenders starts at -1 because the piece that will be moving to
// that square doesnt count as a defende
int a = 0;
for (int i = 0; i <... |
9294ae19-e6a2-4653-870c-009e8d148dae | 4 | public Boolean rightFantasma(int n){
Query q2;
switch(n){
case 0:
q2 = new Query("rightBlinky");
return q2.hasSolution();
case 1:
q2 = new Query("rightClyde");
return q2.hasSolution();
case 2:
... |
b955110f-7494-4f28-b243-d2fa618e894d | 2 | public void updateEmployee(boolean equal) {
Database db = dbconnect();
try {
StringBuilder query = new StringBuilder ();
query.append("UPDATE employee SET firstName = ?, lastName = ?, username = ?, ");
if (!equal) {
query.appe... |
be84f443-420e-48bc-8813-d4031f12cf7d | 9 | String findNearest(String previous, int index, int maxShapes) {
if (previous == null || previous.length() <= index) {
// Select or create new
// Checks all exists
Character c = this.findEmpty(maxShapes);
//if no
if (c != null) {... |
a09e44ff-c1ab-458e-9fd3-9feb9b632983 | 1 | public void run() {
setupRobot();
while (true) {
wheel.act();
radar.act();
gun.act();
targetSelector.act();
// paint range
Util.paintCircle(this, getX(), getY(), 400, Color.gray);
execute();
}
} |
37cf926d-30f4-4ebe-9c0b-4ecc8b6f1013 | 8 | public boolean replaceRecord(PatientRecord pr) {
if (pr.type().equals("c")) {
for (int i = 0; i < _controlPatients.size(); i++) {
if (_controlPatients.get(i).pnumber() == pr.pnumber()) {
if (_controlPatients.get(i).hasRecord(pr.timeline())) {
... |
aa91c841-5fe6-48e4-8d7b-1812db7c5e6e | 2 | public Matrix4f mul(Matrix4f r) {
Matrix4f res = new Matrix4f();
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
res.set(i, j, m[i][0] * r.get(0, j) +
m[i][1] * r.get(1, j) +
m[i][2] * r.get(2, j) +
... |
f3b8c7cc-3624-4a49-910a-c6493f65c708 | 9 | private static void insertSemaphore(ControlFlowGraph graph,
Set<BasicBlock> setTry,
BasicBlock head,
BasicBlock handler,
int var,
... |
72322933-6907-4268-9498-25734b6a124c | 1 | public static void main(String[] args) {
final String username = "";
final String password = "";
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
... |
c0b24fc0-4094-4aa8-ac56-6953283e02e9 | 7 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
super.unInvoke();
if(canBeUninvoked())
{
final Room centerR=mob.location();
if((centerR!=null)&&(!mob.amDead()))
mob.location().show(mob,null,CMMsg.MSG_OK... |
12f77cad-840a-4c20-bd86-83c3c65917ca | 0 | public PrioritizedTaskConsumer(PriorityBlockingQueue<Runnable> q)
{
this.q = q;
} |
2749affd-cc69-45f6-a83c-464d24db4bb7 | 2 | private File getDirectory(String arg) {
File dir = new File(arg);
if (!dir.exists()) {
System.err.println("Couldn't find dir " + arg);
invalid = true;
showHelp = true;
}
if (dir.isFile()) {
System.err.println(arg + " is a file. It should be... |
3ae83971-bc86-4895-9de4-9c2a5128bd80 | 3 | @Override
public GameState[] allActions(GameState state, Card card, int time) {
GameState[] states = new GameState[1];
states[0] = state;
if(time == Time.DAY)
{
states = allPreacherDay(state, card).keySet().toArray(new GameState[0]);
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTre... |
e2988edd-ebb6-40a1-b991-261b210d4392 | 2 | public boolean verificarLetra(String letra) {
int verificacion = 0;
letrasUsadas = letrasUsadas + letra + " ";
for(int i=1; i<palabraActual.length; i++){
if(palabraActual[i].equals(letra)){
palabraRespuesta.set(i-1,letra);
palabraActual[i] = "_";
verificacion++;
aciertos++;
puntuacion += 10... |
4335c6c0-41da-4efb-9f70-9b6083dc7860 | 4 | public ListNode swapPairs(ListNode head) {
if(null == head || head.next == null) return head;
this.h = new ListNode(0);
this.h.next = head;
ListNode source = h;
while(source != null && source.next != null) {
source = exchange(source);
}
return h.next;
... |
85da5566-5140-441d-9355-30c759ea7d0d | 9 | public static int lengthOfLongestSubstring2(String s) {
int len=s.length();
String[] str=new String[len];
for (int i = 0; i <len ; i++) {
str[i]=s.substring(i,len);
}
int max=0;
int temp=0;
int half=(len+1)/2;
String old_sub_str=null;
... |
81d7fcbe-f36b-443b-af88-95f13a98e6ca | 3 | public void setGameState( SavedGameParser.SavedGameState gameState ) {
generalPanel.reset();
if ( gameState != null ) {
SavedGameParser.ShipState shipState = gameState.getPlayerShipState();
ShipBlueprint shipBlueprint = DataManager.get().getShip( shipState.getShipBlueprintId() );
if ( shipBlueprint == nul... |
10cd5a37-5b7e-4144-8945-4f8448e08fb0 | 6 | private static final void seleccionaMetodesAProvar()
{
int iterador_dopcio = 1;
Method[] array_metodes_a_provar = driver_a_provar.getDeclaredMethods();
// Els fico a una LinkedList per poder treure els que no siguin publics
metodes_a_provar = new LinkedList<Method>( Arrays.asList( array_metodes_a_provar ) );... |
d08ab942-1b0e-42ff-82bd-f860918e47b5 | 0 | public ConfigFile(String fileName)
{
//set the config file filename
this.fileName = fileName;
//set data to empty string
//data = "";
} |
7608fa1c-975f-43b4-9426-82fbf21153bd | 8 | private static List<AgentController> createAgents(HashMap<String, ContainerController> containerList) {
System.out.println("Launching agents...");
ContainerController c;
String agentName;
List<AgentController> agentList = new ArrayList<AgentController>();
c = containerList.get("container1");
agentName="Job... |
2821ecb7-d16c-4655-ab5f-f01cff25b684 | 3 | public void update(Ship ship ,int delta) {
if (state == States.MISSILE) {
setX(getX() - delta * speed);
anims[States.MISSILE.ordinal()].update(delta);
check_collisions(ship);
} else if (state == States.EXPLOSION) {
if (anims[States.EXPLOSION.ordinal()].is_stopped()) {
state = Sta... |
4c7baeda-464d-474b-aa25-80d8ad3b1d35 | 6 | protected static void setKit(PlayerInventory i) {
File folder = Bukkit.getPluginManager().getPlugin("EventoThor").getDataFolder();
List<ItemStack> items = new ArrayList<ItemStack>();
File config = new File(folder, "config.yml");
ItemStack h = i.getHelmet();
ItemStack p = i.getChe... |
10102174-61d3-418e-878a-0726ce95fc6a | 6 | public void analyzeLinks(List sourcesChildren, Vector simultaneousLinks, Namespace ns){
if (sourcesChildren.size() > 1){
Element source1 = (Element)sourcesChildren.get(0);
String linkName1 = source1.getAttributeValue("linkName");
//Falls der Link eine transitionCondition besitzt
if (source1.getChild("... |
b5b0dcce-496b-4945-b5fb-f5490a9a88a4 | 9 | private void jButtonPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesquisarActionPerformed
Estoque estoque = new Estoque();
Material material = new Material();
DadoMaterial dadoMaterial = new DadoMaterial();
if (!jTextFieldTitulo.getText().isEmpty()) ... |
22e1cf7c-d4be-490d-bca0-988bb072dd5a | 5 | public void paintStateCard(State state, boolean isActive, Rectangle bounds, Graphics g) {
//draw rect, color depending on active state
g.setColor(isActive? Color.GREEN : Color.LIGHT_GRAY);
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
g.setColor(isActive? new Color(0, 127, 0) : Color.BLACK);
g.... |
041c93d5-aed5-4789-b73b-9d4624c1016c | 8 | private void initialise()
{
Properties prop = new Properties();
try
{
// load our properties file
prop.load(new FileInputStream("config.properties"));
// get the property values for pushover notifications if any
_pushoverAppToken = prop.getProperty("PUSHOVER_APP_TOKEN");
_pushoverUserToken = pr... |
8cf38738-cd9f-4ade-97b8-76588b914708 | 3 | public boolean hasNext() {
if (empty) return false;
// first check if current segment can be read for next Wig item
if (wigItemIndex < wigItemList.size())
return true;
// need to fetch next data block
else if (leafItemIndex < leafHitList.size())
ret... |
0d369093-15b0-490e-aab0-890d2489b27c | 4 | public void unbind() {
//Make sure there was a previous texture before we try to unbind.
if(prevTexture != -1 && isBound) {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, prevTexture);
prevTexture = -1;
isBound = false;
}
else if(prevTexture != -1 && !isBound) {
System.err.print("RoyalFlush: Texture2D.unbin... |
0f90174d-0e3d-4b9e-8a71-c3738098a99b | 2 | @Override
public void getFromPane(Contestant c) throws InvalidFieldException {
String oID = c.getID();
c.setID(tfContID.getText());
GameData g = GameData.getCurrentGame();
if (!g.checkID(c, Contestant.class)) {
if (oID != null)
c.setID(oID);
throw new InvalidFieldException(Field.CONT_ID_DUP, "D... |
96796f0e-b825-461c-8a7b-45023ff8cec4 | 6 | public BEXElemCollector(final BEXNodeAdapter node, final String uri, final String name, final boolean self) throws NullPointerException {
if (node == null) throw new NullPointerException("node = null");
if (uri == null) throw new NullPointerException("uri = null");
if (name == null) throw new NullPointerExcept... |
b0a14f74-8491-47c2-8fd6-3746af370662 | 9 | private int minMove(Board prev, int depth, int alpha, int beta)
{
moves++; // fixme
if(depth >= maxDepth) return prev.getScore(); // exceeded maximum depth
int minScore = MAX_SCORE;
Board b = new Board(prev);
b.turn(); // min player's turn
for(int j = 0; j < size; j++)
{
for(int i = 0... |
331b37d3-6902-4a54-8082-29fa88d784c6 | 6 | private final short method669
(int i, long l, int i_200_, int i_201_, int i_202_, int i_203_,
float f, int i_204_, float f_205_, Model class124, int i_206_) {
try {
if (i_203_ >= -49)
anIntArray5519 = null;
anInt5407++;
int i_207_ = anIntArray5455[i_204_];
int i_208_ = anIntArray5455[i_204_ + ... |
c2f8d2eb-df29-4c0e-8230-dab12c74bff5 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TabelProdBrand other = (TabelProdBrand) obj;
if (!Objects.equals(this.brandId, other.brandId)) {
... |
c5e6df45-6c07-4f2b-968c-9378f4dda113 | 5 | public boolean moovable(){
/*
* judge to be a hit walls, plants and animals.
*/
if (getElapsedTime() % actionFrequency > 0){
return false;
}else{
if ((getX() < 0 || MainPanel.WIDTH < getX() + getSize())
|| (getY() < 0 || MainPanel.HEIGHT < getY() + getSize())){
hitWall();
return false;
... |
e8aacf8d-0fdf-48e7-99e5-ae49c56a391c | 2 | public void dump_stack()
{
if (stack == null)
{
debug_message("# Stack dump requested, but stack is null");
return;
}
debug_message("============ Parse Stack Dump ============");
/* dump the stack */
for (int i=0; i<stack.size(); i++)
{
debug_message("Symbol: " + ((Symbol)stack... |
0e6153dc-2106-4288-9aee-c9067b421be5 | 8 | public void processTemplateFile(File template) throws IOException {
converter = Converter.getInstance();
if (!FileUtil.isReadableFile(template)) {
System.err.println(String.format("%s: cannot be accessed", template.getName()));
return;
}
String templateFileName ... |
d58f2304-6d13-4d2b-83de-7cb968dfff1f | 2 | @Override
public Event decode(RemoteEvent event) {
InputStream is;
try {
is = new ByteArrayInputStream(event.getBody().getBytes());
ObjectInputStream i = new ObjectInputStream(is);
return (Event) i.readObject();
} catch (IOException e) {
e.pri... |
5a55276f-0147-4618-a1b4-c199c0026584 | 0 | @Override
public void packetSent(PacketSentEvent e) {
} |
23d894fe-4cef-410a-8cc3-27885593ad4d | 7 | public double additionInfo() {
double result = 0.0;
double milkSize = 0.0;
double milkGood = 0.0;
double milkBad = 0.0;
double lemonSize = 0.0;
double lemonGood = 0.0;
double lemonBad = 0.0;
double noneSize = 0.0;
double noneGood = 0.0;
double noneBad = 0.0;
for (Tea t : trainingSet) {
if (t.ge... |
3a583c18-3b75-4a63-9587-8a9b0267cf14 | 4 | public boolean containsValue(Object value)
{
if (value == null) return containsNullValue();
Entry[] tab = this.table;
for (int i = 0; i < tab.length; i++)
for (Entry e = tab[i]; e != null; e = e.next)
if (value.equals(e.value)) return true;
return false;
} |
d301d19f-f27e-4d9a-97ff-5736ba865918 | 8 | public Game(int numberOfCards) {
super("Memory game.Game");
setLayout(new BorderLayout());
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setVisible(true);
setSize(GAME_WIDTH, GAME_HEIGHT);
currentPlayer = new Player();
loginDialog = new LoginDialog(this);... |
b7fd7ded-7d96-4f46-9105-213d5e1abe33 | 9 | public static boolean isSameLocalTime(Calendar cal1, Calendar cal2) {
if (cal1 == null || cal2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
return (cal1.get(Calendar.MILLISECOND) == cal2.get(Calendar.MILLISECOND) &&
cal1.get(Calendar.S... |
4a2717fb-0f39-46f4-a978-4ab699ce2c18 | 2 | public static void main(String[] args) {
int[][] matrix = {
{1,2,3,4,5,6,7,8},
{1,3,5,7,9,0,2,4},
{2,4,6,8,1,1,3,5},
{1,4,8,3,6,9,1,0}
};
markLines(matrix);
for (int[] rows: matrix) {
for (int i: rows) {
System... |
74fe2ef8-9748-420b-a701-f5dd422005fe | 5 | private void tryAction(ControlAction ca)
{
switch (ca.action)
{
case SEND_ID: // send ID
sendID(ca.getID());
break;
case SEND_MESSAGE: // SEND MESSAGE
sendChatMessage(ca.message);
break;
case START_SERVER:// start server
startServer();
// TODO gui.setMeldung blubb was auch immer
... |
36df1e93-a8e3-4a67-b58f-f15d1a5960dd | 3 | public String toString(){
StringBuffer sb = new StringBuffer();
switch(errorType){
case ERROR_UNEXPECTED_CHAR:
sb.append("Unexpected character (").append(unexpectedObject).append(") at position ").append(position).append(".");
break;
case ERROR_UNEXPECTED_TOKEN:
sb.append("Unexpected token ").append... |
88c22433-d104-48b0-b178-be891d8192f9 | 2 | public void runInstruction(String instruction){
Pattern writePattern = Pattern.compile("^write\\s([a-zA-Z]*)\\s([a-zA-Z]*)\\s(\\d+)", Pattern.CASE_INSENSITIVE);
Pattern readPattern = Pattern.compile("^read\\s([a-zA-Z]*)\\s([a-zA-Z]*)$", Pattern.CASE_INSENSITIVE);
Matcher matcher = writePattern.m... |
61c13c1f-9374-4b0f-94bf-646e2db1d723 | 8 | protected String encodeSingleProperty(String propName, List<Object> propValues) throws InformationProblem {
String fullPropStr = "`" + propName + "`" + ":";
if (propValues.size() > 1) {
fullPropStr = fullPropStr + "[";
}
int propCount = 0;
for (Object propVal : propValues) {
if (propCount > ... |
a9262eff-b841-40cc-becc-e867129e9dc6 | 0 | public void setHead(Items head) {
this.head = head;
} |
045aa693-66d8-4642-8c2d-5894e852ee52 | 2 | private Boolean isAnXMLFile(final String filePath) {
String[] splitted = filePath.split("\\.");
if ((splitted.length > 1) && (splitted[1]).compareTo(XML_FILE_EXTENSION) == 0) {
return true;
}
return false;
} |
de9589bd-adcd-4e25-b0c8-5e7a43e97748 | 1 | public String toString() {
try {
return this.toJSON().toString(4);
} catch (JSONException e) {
return "Error";
}
} |
28b98900-1c09-4619-a8b1-05a7bd71a495 | 0 | public XMLProcessor() {
init();
reset();
} |
2888d97e-aa9a-454f-8a9f-871cc9081a33 | 1 | private void nextQBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextQBtnActionPerformed
//store response!
setResponse();
//Show next question
if (qIndex < quiz.questionList.size() - 1)
{
qIndex++;
ShowQuestion(qIndex);
}
... |
7084d160-6f7d-4fec-bff5-0e20e22d59f4 | 5 | private void loadHexFile() {
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(new FileFilter() {
@Override
public String getDescription() {
return lnf.getFileChooserHEXFilter();
}
@Override
public boolean accept(File f) {
return f.isDirectory() || f.toString().endsWith(".hex")... |
4dbcabd6-6229-44f9-9342-c0c604f46e83 | 1 | public void updatePanel(User user){
jlbMainInformation.setText("[" + user.getLevel() + "] " + (user.getNick() == null ? "???" : user.getNick()));
jprgLevelProgress.setMaximum(user.getLevelUpExp());
jprgLevelProgress.setValue(user.getCurrentExp());
jlbRealMoney.setText("" + user.getrCoins());
jlbInGameMoney.se... |
af7a0318-d516-4dd4-90ff-dd7a7d046afb | 5 | @Override
public boolean offer(T t) {
boolean result = false;
if (firstItem == null) {
firstItem = new PriorityItem(t);
length++;
result = true;
} else {
boolean searching = true;
PriorityItem currentItem = firstItem;
PriorityItem NewItem = new PriorityItem(t);
if(NewItem.priority > firstIt... |
c2532582-41b7-4251-9979-9ade4d4af546 | 9 | void setData(){
id = 0;
num = 0;
BufferedReader br = null;
try {
//File file = new File((Catapult.class.getResource(dir+fileName[fid])).getFile());
URL data = (Catapult.class.getResource(dir + fileName[fid]));
InputStream ins = data.openStream();
br = new BufferedReader(new InputStreamReader(ins));... |
ce102d49-116a-48db-98f5-3bb5d7b4526f | 9 | public void update() throws MaltChainedException {
// Retrieve the address value
final AddressValue arg1 = addressFunction1.getAddressValue();
final AddressValue arg2 = addressFunction2.getAddressValue();
if (arg1.getAddress() != null && arg1.getAddressClass() == org.maltparser.core.syntaxgraph.node.Dependency... |
4517cf8e-0619-433a-8564-8463bcf096c8 | 4 | public static LinkedList<CONSTANTPoolElement> loadElements(DataInputStream mainInput, int count) throws IOException // Возвращает пул констант
{
LinkedList<CONSTANTPoolElement> pool = new LinkedList<CONSTANTPoolElement>();
pool.add(new CONSTANT_FICTIVE()); // Для сдвига нумерации с 0 до 1
... |
9f3300c8-0253-48ff-a21a-5ffaada44c6e | 7 | public void addChildToBack(Node child) {
child.next = null;
if (last == null) {
first = last = child;
// <netbeans>
if (sourceEnd < child.sourceEnd) {
if (sourceStart == sourceEnd && sourceStart == 0) {
sourceStart = child.sourceSt... |
3a459eaa-c310-4a8d-a214-6f66e6748ef6 | 4 | public static void drawWrappedString(String string, float x, float y, float z, float scale, int wrapWidth)
{
texture.bind();
scale /= 1000;
float currentXOffset = 0;
float currentYOffset = 0;
for(int i = 0; i < string.length(); i++)
{
char character = string.charAt(i);
if(character == '\n')
... |
7723ec7b-7b7e-4ee4-8064-a0419ca9956b | 7 | public Main() throws Exception {
super();
prop = new Properties();
try {
configFile = this.getClass().getResourceAsStream("/config/config.properties");
prop.load(configFile);
} catch (IOException e) {
e.printStackTrace();
}
if(
prop.getProperty("uploadPath") =... |
1bc76060-ff24-47fc-893c-cfcbd4255d79 | 2 | static LogWriter getLogWriter(String name) {
LogWriter current = logWriters;
while (current != null) {
if (name.equalsIgnoreCase(current.name)) return current;
current = current.next;
}
return null;
} |
efd73de0-0585-49c7-a56d-e12a0842ad6a | 1 | public void playFox() throws InterruptedException{
try
{
in = new FileInputStream(fox);
as = new AudioStream(in);
ap.player.start(as);
}
catch(Exception e)
{
System.out.println("Got an IOException: " + e.getMessage());
e.printStackTrace();
}... |
c1c93f85-9409-4e32-838d-661a598cbaf0 | 4 | public static <T extends Comparable<? super T>> T max(T a, T b) {
if (a == null) return b;
if (b == null) return a;
return a.compareTo(b) > 0 ? a : b;
} |
6c6852de-078b-43b0-94c6-e4457385e08e | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Vulnerability other = (Vulnerability) obj;
if (n... |
44ef505f-f984-425a-83f3-fb16594219aa | 8 | public E remove(Position<E> v)
throws InvalidPositionException
{
BTPosition<E> vv = checkPosition(v);
BTPosition<E> leftPos = vv.getLeft();
BTPosition<E> rightPos = vv.getRight();
if(leftPos != null && rightPos != null)
{
throw new InvalidPositionException("Cannot remove node with two children.");
}
... |
c126b281-2338-408c-88a5-03b2d4a21d6d | 2 | //@Command
@RequiresPermission("libminecraft.test")
private void test(CommandSender sender, CommandArgs args)
{
sender.sendMessage("Params:");
for (String param : args.getParams())
{
sender.sendMessage(" - '" + param + "'");
}
sender.sendMessage(" ");
... |
cb50312a-c3fa-4df1-ba14-bce832947336 | 5 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
String serverID = "ALL";
if (serverID != null && serverMap.size() > 0 && jComboBox2.getSelectedIn... |
47bfac47-9a51-48a2-a76d-b7ff967ea16e | 2 | private static Map<String, Double> parseSiteWeights(Map<String, SiteConfig> configs) {
double sum = 0;
ImmutableMap.Builder<String, Double> siteWeights = ImmutableMap.builder();
for (Map.Entry<String, SiteConfig> entry : configs.entrySet()) {
sum += entry.getValue().getWeight();
siteWeights.put(... |
d471301c-d208-4a37-84fe-3dafbe8679a6 | 5 | public byte[] getEncoded() {
try {
byte[] versionBytes = new byte[]{(byte) majorVersion,
(byte) releaseVersion};
BERTLVObject versionObject = new BERTLVObject(VERSION_LDS_TAG,
versionBytes);
byte[] tagListAsBytes = new byte[tagList.size()];
for (int i = 0; i < tagList.size(); i++) {
int dgTag... |
05238b2b-75fe-4d3f-a9eb-28bef49632d5 | 3 | @CaseHandler(routine = AUTHENTICATED_USER, reqType = RequestType.GET)
public String handleAuthenticated() {
// If user is tried to authenticate
if (this.userSession != null) {
//ожидаем пока AccountService вернет данные
if (this.userSession.isComplete()) {
//п... |
5b0cec7f-d895-498d-b90f-a660eed41d8a | 0 | protected String getLabel(Instrument instrument) {
String label = instrument.name();
label = label.substring(0, 2) + label.substring(3, 5);
label = label + (tagCounter++);
label = label.toLowerCase();
return label;
} |
fa1520be-e68f-4588-b7e4-68a721bb7e1f | 8 | public void update() {
//
// If there are bubbles awaiting display, see if you can move the existing
// bubbles up to make room.
final Bubble first = showing.getFirst() ;
final boolean
shouldMove = toShow.size() > 0,
canMove = showing.size() == 0 || first.alpha <= 1,
isSpace = sh... |
767ce053-28df-4c58-a10d-7dc8f52b2b89 | 3 | @WebMethod(operationName = "ReadCustomer")
public ArrayList<Customer> ReadCustomer(@WebParam(name = "cust_id") String cust_id) {
Customer cust = new Customer();
ArrayList<Customer> custs = new ArrayList<Customer>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
... |
251a687e-9621-42ae-a8cd-489607156249 | 5 | public void saveData(File file, QuestManager qm) throws IOException
{
if(!file.exists())file.mkdir();
File players = new File(file, "Players");
if(!players.exists())players.mkdir();
File quests = new File(file, "Quests");
if(!quests.exists())quests.mkdir();
for(Quest q:QuestManager.getInstance().getQuests(... |
9f494e75-8a69-45ef-9cd7-687d7360de2a | 2 | private void jButtonLogarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLogarActionPerformed
try{
conn.executaSQL("select * from tb_perfil where login='"+ jTextFieldLogin.getText() +"'");
conn.rs.first();
if(conn.rs.getString("senha").equals(jPassw... |
a24e96c1-ecfe-4197-bed3-bf426c036b02 | 6 | static final public void primaire() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VRAI:
case FAUX:
case entier:
case ident:
valeur();
break;
case 54:
jj_consume_token(54);
expression();
jj_consume_token(56);
break;
default:
jj_... |
ce7c3d8d-6cd2-48d9-a8b2-81a8c53a2d86 | 3 | public static void main(String[] args) {
if (args.length == 0) {
System.out
.println("usage: java Sobel imagefile [iterations] [RLE]");
System.out.println(" imagefile is an image in TIFF format.");
System.out
.println(" interations is the number of blurring iterations"
+ " (default 0).");... |
60226eb3-6af8-4fb3-a3cc-7a15aa7f4d53 | 4 | public static byte[] computeDigest(byte[] bytes) {
byte[] src;
if((bytes.length % 8) == 0) {
src = new byte[bytes.length + 8];
System.arraycopy(bytes, 0, src, 0, bytes.length);
}
else {
src = new byte[bytes.length + 8 - (bytes.length % 8) + 8];
System.arraycopy(bytes, 0, src, 0, bytes.length);
}
... |
389aa9a2-b2ac-46fe-be0a-3db986833c04 | 1 | public static String intListToString(int[] lst, String ...params) {
String[] str_list = new String[lst.length];
for (int i=0; i<lst.length; i++) {
str_list[i] = String.valueOf(lst[i]);
}
return listToString(str_list);
} |
4aea5d44-a7b8-40b3-ae9a-678a4f984528 | 6 | static void validate(FilterCoder[] filters)
throws UnsupportedOptionsException {
for (int i = 0; i < filters.length - 1; ++i)
if (!filters[i].nonLastOK())
throw new UnsupportedOptionsException(
"Unsupported XZ filter chain");
if (!filters[... |
924a210d-8027-4666-86ca-70e6d32e7866 | 0 | public int getMouseY() {
return mouseLocation.y;
} |
53f1572e-6d8d-4844-b257-a1106af629c5 | 6 | public void setChecked (boolean value) {
checkWidget ();
if ((parent.getStyle () & SWT.CHECK) == 0) return;
if (checked == value) return;
checked = value;
if ((parent.getStyle () & SWT.VIRTUAL) != 0) cached = true;
if (isInViewport ()) {
if (parent.isListening (SWT.EraseItem) || parent.isListening (SWT.PaintIt... |
e91ca06c-fc49-4bfd-9948-335e397a0495 | 5 | @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
if(label.equalsIgnoreCase("getblock"))
{
if(sender.isOp())
{
if(args.length == 4)
{
World world = Bukkit.getServer().getWorld(args[0]);
if(world == null)
... |
d8523d91-baef-40a2-9528-762ea2a13750 | 0 | @Override
public String getHouseNumber() {
return super.getHouseNumber();
} |
b28c47b0-c0a6-4774-ad59-60414c33cf46 | 2 | public boolean equals(Object ob) {
if (super.equals(ob)) {
ChocolateForKid other = (ChocolateForKid) ob;
if (figured != other.figured)
return false;
}
return true;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.