method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4aa8d291-8ce6-4925-9252-4322b4ec9f10 | 0 | public void setLoginSgbd(String loginSgbd) {
this.loginSgbd = loginSgbd;
} |
f70e503e-e300-46c1-8b6c-c14946304fe4 | 5 | protected void settingsChanged() {
checkSettings();
if(regionSize == null || topology == null) {
dc = null;
return;
}
// Build Classifier
dc = new DiceClassifier(directory, regionSize, topology);
if(!dc.loadSamples()) return;
dc.train();
if(this.lastMat != null && this.lastInfo != null)
... |
ce1d10ff-bd51-4dc1-a7bf-ec715f9e63f4 | 6 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
e6a060fb-c11c-442b-95d7-80d5f8f8b688 | 0 | @Override
public List<Usuario> findByLogin(String usuatio,String clave){
return em.createNamedQuery("Usuario.findByLogin").setParameter("usuario",usuatio).setParameter("clave", clave).getResultList();
} |
86bee8be-1894-44fb-8f67-e67f0b9cb931 | 9 | public boolean VerificarCasilla(int posicion)
{
boolean estado=false;
switch (posicion)
{
case 1:estado=sub_VerificarCasilla(0,0); break;
case 2:estado=sub_VerificarCasilla(0,1); break;
case 3:estado=sub_VerificarCasilla(0,2); break;
case ... |
438b8864-8cf4-4b38-b705-ed1ad4314650 | 8 | @Override
public Ref lin(int dist,HexDir dir) {
if(dist == 0)
return this;
else if(dist < 0)
return lin(-dist, dir == N ?
S : dir == S ?
N : dir == NE ?
SW : dir == ... |
9e98f75d-e226-45dd-bc5a-03228660048a | 1 | @SuppressWarnings("unchecked")
public void addQustionToDB() {
String questionStr = getConcatedString((ArrayList<String>) question);
String answerStr = getConcatedString((ArrayList<String>) answer);
// add to database
try {
String statement = new String("INSERT INTO " + DBTable
+ " (quizid, position, q... |
339c05ce-2045-4d82-87df-038e7d1e937f | 1 | public Problem merge(Problem detachedInstance) {
log.debug("merging Problem instance");
try {
Problem result = (Problem) getSession().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
} |
8e922bb4-9eda-4b36-bac0-719b80651e43 | 4 | public int getPlacementRank()
{
switch(getPlacement())
{
case "Latent":
return LATENT;
case "Expectant":
return EXPECTANT;
case "Definitive":
return DEFINITIVE;
case "Undefined":
... |
add7999e-14bf-4a20-940c-0ad8031e9360 | 2 | public static void update()
{
for ( int i = 0; i < NUM_KEYCODES; i++ )
lastKeys[i] = getKey( i );
for ( int i = 0; i < NUM_MOUSEBUTTONS; i++ )
lastMouse[i] = getMouse( i );
} |
6b67a0fe-53dd-4c5c-bd11-4f0e919d9854 | 4 | public static void search(Node root,int k){
Node x=root;
if(x.key==k)
System.out.println("1");
while(x!=null)
{
if(k<x.key)
{
x=x.lc;
}
else if(k>x.key)
{
x=x.rc;
}
else
{
System.out.println("1");
break;
}
}
System.out.println("-1");
} |
46182d93-163f-4ab3-b56d-10a272d6b365 | 6 | public Simplex(double[][] A, double[] b, double[] c) {
M = b.length;
N = c.length;
a = new double[M+1][N+M+1];
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
a[i][j] = A[i][j];
for (int i = 0; i < M; i++) a[i][N+i] = 1.0;
for (int j = ... |
2bf4fa2d-30b9-4262-8c83-fd4d7e8b4b0d | 6 | @EventHandler
public void EndermanInvisibility(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.getEndermanConfig().getDouble("Ender... |
d8f2c1a7-492c-450a-82a6-476f986e0a8f | 1 | public void Info(String message) {
if (logger.isEnabledFor(Level.INFO)) {
logger.log(Level.INFO, message);
Reporter.log(message);
}
} |
4c7f1e2b-d014-4268-b246-4538f5b38cf7 | 7 | private int formatSpecifierHunt (int c1,int c2) {
if (c1!=c2) return -1;
else if (c1==112) return c1;
else if (c1==116) return c1;
else if (c1==114) return c1;
else if (c1==120) return c1;
else if (c1==102) return c1;
else if (c1==123) return c1;
else return -1;
} |
e34221ba-df3b-4114-a1f3-b9d5b365cfa1 | 5 | private void intersection(UserPreferences user1, UserPreferences user2) {
int[] originalItemIds1 = user1.getItemIds(), originalItemIds2 = user2.getItemIds();
double[] originalRatings1 = user1.getRatings(), originalRatings2 = user2.getRatings();
int[] intersectItemIds;
double[] intersectRatings1, intersectRating... |
de9ecc7c-18bc-4f03-aaaa-6586234d39d7 | 2 | public void setKey(char key) {
if (selectedPath != null && !editingCollection) {
System.out.println(key + " = " + selectedPath);
newCollection.set((int) key, selectedPath);
} else {
System.out.println("Setting key to a file in "
+ selectedCollection.getCollectionName());
selectedCollection.change... |
aa98afdd-2c3b-4405-84c6-20eb9105dcc1 | 1 | private int getMinInd(int pos1, int pos2){
return heap.get(pos1).compareTo(heap.get(pos2)) >= 0 ? pos2 : pos1;
} |
c3602275-a4b2-4dbe-9826-5e7310738560 | 1 | public static <T> CycList<T> makeCycList(final T... elements) {
final CycList<T> cycList = new CycList<T>();
for (final T element : elements) {
cycList.add(element);
}
return cycList;
} |
03dfbf0b-e180-480f-82c0-3b33a9b72ee3 | 8 | public String getErrorCode()
{
if( !getIsErr() )
{
return String.valueOf( iserr );
}
String retval = "";
if( (errorval & 0x0) == 0x0 )
{
retval = "#NULL!";
}
if( (errorval & 0x7) == 0x7 )
{
retval = "#DIV/0!";
}
if( (errorval & 0xF) == 0xF )
{
retval = "#VALUE!";
}
if( (errorval... |
2fb57abf-b3e3-458c-bfe8-45efd1c4bec4 | 7 | public static void redefineLogicObject(Symbol name, Stella_Object oldobject, Stella_Object newobject) {
{ List originatedprops = Logic.originatedPropositions(oldobject);
List exceptprops = originatedprops.copy();
{ Proposition prop = null;
Cons iter000 = originatedprops.theConsList;
fo... |
85d886e1-e9d4-4642-a81b-b3b3277e637d | 4 | private static Set<String> getClassNameFromJars(URL[] urls, String packageName, boolean isRecursion) {
Set<String> classNames = new HashSet<String>();
for (int i = 0; i < urls.length; i++) {
String classPath = urls[i].getPath();
//不必搜索classes文件夹
... |
186f09d1-d1e4-4906-b17c-b30a37c79151 | 0 | private String geberateRequestLink(String artistName) throws EncoderException {
URLCodec codec = new URLCodec();
String encodedArtist = codec.encode(artistName).replaceAll("\\+", "%20");
String requestLink = String.format(EVENTS_REQUEST_URL_TEMPLATE, encodedArtist);
return requestLink;
... |
e26d9045-e4d6-4f87-8f8a-26b92d460bb0 | 8 | public POSExtractor(Definitions defs) {
int anz = 0;
ArrayList<DataField> dfList = new ArrayList<>();
posArray = new POSArray();
System.out.println("Kassen werden ausgelesen.");
ArrayList<Definition> data = defs.getDefinitions();
for (Definition def : data) {
if (def.getLineTypeID() == 20000) {
POS... |
c4a3ff3b-7111-40ed-b7f6-ac2e58ae5a88 | 0 | public void setComboBox(JComboBox box) {
this.box = box;
} |
550ac640-0e5a-400f-b04c-ebb75e782dc7 | 6 | public static void main(String args[]){
//Creating a colour scheme to test the renderer with
Colour[] colours = new Colour[5];
final int MAP_SIZE = 5;
for (int i=0; i<MAP_SIZE; i++) {
switch (i) {
case 0: Colour black = new Colour("#000000");
colours[i] = blac... |
26a4377d-b7fb-457f-b6a7-826ae5e36783 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Player other = (Player) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fa... |
339ba84b-d907-4135-bb9e-e6165ef93a4d | 8 | @Test
public void testConstructNimMatrix_3Sticks() {
int numberOfSticks = 3;
int matrixSize = numberOfSticks + 1;
NimVertex[][] expectedMatrix = new NimVertex[matrixSize][matrixSize];
expectedMatrix[3][2] = new NimVertex(3,2);
expectedMatrix[2][2] = new NimVertex(2,2);
expectedMatrix[1][1] = new NimVert... |
1955ad59-45a0-4cfa-9d8f-0761629a329b | 1 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
sesion sesion=new sesion(this.userTextfield.getText(),this.passTextfield.getText());
if(sesion.getAcceso()=="Acceso Concedido"){
bandejaScreen bandeja=new bandejaScreen(win,this.us... |
2e1d06c7-1be0-4543-b213-aa2cea7d4398 | 3 | public int getHigh(int symbol) {
if (symbol < 0 || symbol >= frequencies.length)
throw new IllegalArgumentException("Symbol out of range");
if (cumulative == null)
initCumulative();
return cumulative[symbol + 1];
} |
d231f501-3269-44c2-884f-f69b79403357 | 7 | public void writeXML(XMLSaxParser theHandler) {
try {
//Create the document.
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element root = doc.createElement("UserConfig");... |
b4ffb632-bd2b-483b-a03e-a261e0022542 | 6 | public static String getCoastlineCoding(Game game, Position center) {
char[] coding = {'0','0','0','0' };
int row = center.getRow(), col = center.getColumn();
Position p;
int offsetRow[] = { -1,0,+1,0 };
int offsetCol[] = { 0,+1,0,-1 };
// iterate over the four compas directions
// for... |
2e135694-0651-4666-bb52-3bd7a8d22181 | 0 | public static void main(String[] args) {
circles = new ArrayList<Circle>();
IntStream.range(0, NUM_CIRCLES).forEach(_i -> circles.add(getNewRandomCircle()));
pop = new Population<>(POPULATION_SIZE, CROSSOVER_RATE, NUM_ELITE,
makeRandomIntChromo, computeIntFitness, mutateIntGenes);
launch(args);
} |
6c50ac78-5733-4dfb-aacf-201e56f5aac0 | 0 | public int getTerminaalinopeus() {
return terminaalinopeus;
} |
0eca7f5b-1c81-43e2-aaca-bd76a78ae23f | 3 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if(user != null) {
UserModel usermod = DataStore.getUser(user.getUserId());
... |
f9cd16e7-3044-4918-831f-7d771e19f272 | 8 | @Override
public boolean equals(Object obj)
{
if(Debug.getDebugValue()==1)
System.out.println("Inside Overrided equals method of MyAllTypesSecond class");
boolean returnValue = false;
if (obj == null)
returnValue = false;
if (!(obj instanceof MyAllTypesSecond))
returnValue = false;
... |
bb880171-dbec-4d96-9d3c-8800510729c0 | 6 | private static final int method2920
(int i, int i_129_, byte[] is, int[] is_130_, int i_131_, int i_132_,
int i_133_, int i_134_, int i_135_, int i_136_, int i_137_,
int i_138_, int i_139_, Class348_Sub16_Sub5 class348_sub16_sub5,
int i_140_, int i_141_) {
class348_sub16_sub5.anInt8976
-= class348_sub16_su... |
9e10ed94-5a0a-4086-8d3b-9cdafd26f4ca | 7 | private Action chooseCpgdAction(PlayerView contextView, Set<ActionType> actionTypes) throws InterruptedException {
if (selectFuture != null && !selectFuture.isDone())
throw new IllegalStateException("Another select task is active.");
if (Collections.disjoint(actionTypes, BarBotCpgdSelectTask.ACTION_TYPES))
r... |
c24551dc-48d9-4c50-b9e2-3186a0e90632 | 5 | @Override
public void actionPerformed(ActionEvent e) {
if (!database.login(loginName,
PasswordDialog.inputPassword(this, loginName))) {
JOptionPane.showMessageDialog(this, ",йԱȨ", "ܾ",
JOptionPane.WARNING_MESSAGE);
dispose();
return;
}
String cmd = e.getActionCommand();
if (cmd.equals("add"))... |
f62e87f9-d69a-479f-a8dd-b60291e943e3 | 4 | public void processDrawing() {
if (alreadyLoaded || loadingError || genericLoadingError) {
showErrorScreen();
return;
}
Client.drawCycle++;
if (!loggedIn) {
drawTitlebox(false);
} else {
drawGameScreen();
}
anInt1213... |
cdf841a9-7517-4fa5-8368-5717e052f509 | 2 | private int getIntFromUser(String prompt) {
while (true) {
try {
return Integer.parseInt(getUserInput(prompt));
} catch (Exception e) {
displayError("FUCK OFF THATS NOT A NUMBER");
}
}
} |
12bf2c68-f8a5-47cc-bb3e-556140ac968f | 5 | public static void findTwoValueDiff(int[] array,ArrayList<Integer> result){
if(array == null || array.length < 0 ){
return ;
}
int res = array[0];
for(int i =1;i<array.length;i++){
res ^= array[i];
}
int position = findFirstBit1(res);
int firstValue = 0;
int secondvalue = 0;
for(int i=0;i<array.... |
e6a008ea-31f3-4cac-be05-b91e2defd3fe | 1 | public static JScrollPanelledPane doHtmlTickerFilesTab() {
JScrollPanelledPane stepScroll = new JScrollPanelledPane();
File dir = new File(EarningsTest.REPORTS_ROOT);
File[] files = dir.listFiles();
Arrays.sort(files);
for (int i = files.length - 1; i >= 0; i--) {
File f = files[i];
CustomButton eb = J... |
fce63adc-101b-46f1-9582-c1b0f97e156f | 1 | @Override
public void run() {
synchronized(rw){
cust++;
System.out.println("Cutomer number : "+cust);
rw.doResevation(FromAndTo);
}
} |
cf780a2c-590c-40b5-8848-87a2fc1f536d | 8 | private void movePlayer(int oldX, int oldY, int x, int y, String playerDirection, JLabel[][] labels, boolean clientMovement) {
Player me = clientService.getMePlayer();
if(!clientMovement && (oldX != me.getXpos() || oldY != me.getYpos())) {
System.out.println("Other players");
System.out.println("old X: " + ol... |
730890de-8855-4ff0-9580-5f1ef517897a | 7 | void setValue( Source[] sources, HashMap sourceIndex, ValueFormatter vFormat ) throws RrdException
{
try
{
double value = sources[ ((Integer) sourceIndex.get(sourceName)).intValue() ].getAggregate( aggregate );
// See if we need to use a specific value for the formatting
double oldBase = vFormat.g... |
45912aad-d694-43ac-914b-455eb75ff327 | 8 | @Override
public void run() {
if(crawlURL == null || crawlURL.toString().equals("")) {
return;
}
String path = crawlURL.getPath().equals("") ? "/" : crawlURL.getPath();
String host = crawlURL.getHost();
String htmlDoc = request(host, path);
crawlerManager.fin... |
4d257abe-e72e-44ce-90b9-45ee2afea361 | 4 | public static AbstractTableModel getProperties(final CSProperties p) {
return new AbstractTableModel() {
@Override
public int getRowCount() {
return p.keySet().size();
}
@Override
public int getColumnCount() {
return ... |
076f0c1a-5119-4e99-8394-bb8ff8b57174 | 5 | public String[][] returnAsRowMajorMatrix(){
Tile currentJTile = topTile;
String matrix[][] = new String[dimension][dimension];
for(int j = 0; j < dimension; j++){
Tile currentKTile = currentJTile;
for(int k = 0; k < dimension; k++){
matrix[j][k] = currentKTile.id;
currentKTile = currentKTile.rightDown;... |
e6c0c008-7c95-448e-91d8-c6dfa1e50de4 | 7 | public static void main(String[] args) {
In in = new In(args[0]);
int N = in.readInt();
double[][] weight = new double[N][N];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
weight[i][j] = in.readDouble();
}
}
AssignmentProblem assignment = new AssignmentProblem(weight);
StdOut.prin... |
278f87aa-5a4e-4e24-8e6c-30dc583fecba | 6 | private List<Card> cardsShowedTo(String player) {
ArrayList<Card> result = new ArrayList<Card>();
for (LogEntry e : log) {
if (e instanceof Suggestion) {
Suggestion s = (Suggestion) e;
if (s.asker.equals(player)) {
for (Reply r : s.replies)... |
eca1a669-9600-4a70-a888-fdd8b51e12d5 | 1 | public FlatFrequencyTable(int numSyms) {
if (numSyms <= 0)
throw new IllegalArgumentException("Number of symbols must be positive");
numSymbols = numSyms;
} |
07bd5482-cac7-4f7e-be23-3c62952f7d2c | 0 | public long getId() {
return Id;
} |
16294a78-1287-4911-94aa-789337d82706 | 9 | public void update(long elapsedTime) {
// select the correct Animation
Animation newAnim = anim;
if (getVelocityX() < 0) {
newAnim = left;
}
else if (getVelocityX() > 0) {
newAnim = right;
}
if (state == STATE_DYING && newAnim == left) {
... |
5e80bf5d-aec1-4fbb-b537-d36fa258ed7c | 6 | public int LeadWolfAtTime(int inRound){
if(inRound > RoundNum) return 0; // This is the future.
int output = 0;
for(int n = 0; n < NumWolves;n++){
for(int i = 0; i < NumPlayers; i++){
int Role = PlayerRoles[i];
if(Role == (n+3)) return (i+1); // The lead wolf _is_ alive 'now'.
if((Role == -(n+3)) &... |
9bcca7f5-3efd-40de-851d-8bf2ee8de6f7 | 6 | @RequestMapping("/catShow.do")
public ModelAndView showCatList(Device device, HttpServletRequest req) throws Exception {
int rows = 16;
int pageBlock = 10;
// 카테고리 코드를 알아오기 위한 변수
String catVal = req.getParameter("catVal");
// xml에 카테고리명을 추가 하기 위한 변수
String realmCode = null;
String path = "catShow.do";
... |
26091f63-04fd-4ad4-8748-3dd1c73781c7 | 9 | public byte[] asBytes() {
if(value instanceof byte[]) {
return (byte[])value;
} else if(value instanceof Byte) {
return new byte[]{(Byte)value};
} else if(value instanceof Short) {
return Utils.Int162Bytes((Short)value);
} else if(value instanceof Inte... |
64a38466-de97-4aa0-a632-1969d3ef967b | 5 | void GestionParametre (String tab[])
{
if(tab.length == 1 || tab.length == 2 ) // On veut être sur qu'il n'y ai que un ou deux parametre
{
try
{
int p = Integer.parseInt(tab[0]); // Pour s'assurer que on a pas entrer genre allo sur la lign... |
67035d98-a96a-48e5-abef-592061bed4c3 | 1 | public static boolean isParenExpression(char[] chars) {
return chars[0] == '(' && chars[chars.length - 1] == ')';
} |
0f256e37-e093-45ef-aeca-9a9d7633f920 | 4 | public boolean estValide() {
if (x<0 || x>=LARGEUR_CARTE || y<0 || y>=HAUTEUR_CARTE) return false; else return true;
} |
d3b93ab6-1ff3-4f27-833e-50230060aec7 | 7 | public static List<Vector> readDataset(String file,int maxSize) {
List<Vector> ret = new ArrayList<Vector>();
List<String[]> data = FileUtils.readCSVFile(file, " ", -1);
if(data.size() > maxSize){
data = data.subList(0, maxSize);
}
boolean firstColumnIsKey = false;
try{
Double.parseDouble(data.get(0)[... |
ecdce812-a02e-40ef-824a-74b0f33344a8 | 6 | private void repositionFaceDown(Player p) {
PlayerCardsRange curCardRanges = playerIndices[p.getPlayerId()];
List<Card> faceDown = p.getFaceDown();
List<CardEntity> moved = new ArrayList<CardEntity>(faceDown.size());
int delta;
cardsWriteLock.lock();
try {
CardRange[] sublists = { drawDeckEntitiesRange }... |
8a2260d0-f82d-4f0b-97bb-46eb373356f9 | 7 | protected MOB getCharmer()
{
if(charmer!=null)
return charmer;
if((invoker!=null)&&(invoker!=affected))
charmer=invoker;
else
if((text().length()>0)&&(affected instanceof MOB))
{
final Room R=((MOB)affected).location();
if(R!=null)
charmer=R.fetchInhabitant(text());
}
if(charmer==null)
... |
2f4e250c-0bf3-4559-b674-256a24900cc5 | 0 | @Override
public void attributesVisibilityChanged(OutlinerDocumentEvent e) {} |
a19b46e3-441a-4773-81de-3678bfa2d432 | 0 | public void testServer() {
Server server = new Server();
// Get a new game.
String gameid = server.newGame();
// Try to solve it (but fail).
String answer = server.attempt(gameid, "RRRRR");
assertNotNull(answer);
} |
51753e0a-8c41-4706-af8d-c7705c2df54c | 0 | public Deplacement1(int date1, int id1, int taille1) {
super(date1, id1, taille1);
} |
bd5d9985-1b29-4a98-b1b4-d55e5b2917bb | 7 | static BigDecimal toBigDecimal(Object x){
if(x instanceof BigDecimal)
return (BigDecimal) x;
else if(x instanceof BigInt)
{
BigInt bi = (BigInt) x;
if(bi.bipart == null)
return BigDecimal.valueOf(bi.lpart);
else
return new BigDecimal(bi.bipart);
}
else if(x instanceof BigInteger)
return new BigDe... |
2e594e3e-c467-4045-9c7b-5aa7f05f993e | 4 | public void load(){
BufferedImage worldImg = null;
try {
URL ulr = getClass().getResource("/Worlds/"+name+".jpg");
worldImg = ImageIO.read(new File(ulr.getPath()));
} catch (IOException e) {}
this.width = worldImg.getWidth();
this.height = worldImg.getHeight();
this.blocks = new Block[width][height... |
ec72f01c-ef02-490d-a22a-d0d55d5aee4b | 2 | private void saveResource(IResource resource) throws IOException {
Path resourceDir = Paths.get(targetFolder.toAbsolutePath() + IParameters.RESOURCES_DIR);
if (!resourceDir.toFile().exists()) {
Files.createDirectories(resourceDir);
}
Path target = Paths.get(resourceDir.toAbso... |
70018d84-1702-4fb8-b096-97ef4b4f62c7 | 1 | public static boolean checkUserExistance(String uid)
{
UserStorageAccess xmlAccessor = new UserStorageAccess();
if(xmlAccessor.getUserNode(uid)!=null)
{
return true;
}
return false;
} |
2d142490-ac9e-4d2e-ac6a-7b6f2e629c3c | 9 | private static boolean surroundingInt(int[][] mapToCheck, int intToCheckFor, int cellX, int cellY,
int range) {
for (int i = -range; i <= range; i++) {
for (int j = -range; j <= range; j++) {
int checkX = cellX + i;
int checkY = cellY + j;
if ... |
390bb535-6802-452b-b363-e028fb3f0ae7 | 4 | private void encode(Number value)
{
switch (bits)
{
case 1:
bytes = ByteBuffer.allocate(bits).put(value.byteValue()).array();
break;
case 2:
bytes = ByteBuffer.allocate(bits).putShort(value.shortValue()).array();
break;
case 4:
bytes = ByteBuffer.allocate(bits).putInt(value.intValue())... |
d3c4a31f-499d-4431-b4c4-47d5d73d9f1c | 0 | public ListDataModel<Osoba> getWszystkieOsoby() {
osoby.setWrappedData(oo.getWszystkieOsoby());
return osoby;
} |
70d34a58-893f-410c-ad1e-7d4c73ec7964 | 6 | @Override
public LinkSetNode getNextInOrder(){
try
{
if(memory == null)
{
int r = in.read(b);
if(r != b.length)
{
in.close();
return null;
}
}
else
{
if(memory.position... |
95b1630e-1bba-424b-9907-68a2f50fe5cb | 8 | public void generer(){
switch (puissance){
case(11): titre= "Valet";
break;
case(12): titre= "Dame";
break;
case(13): titre= "Roi";
break;
case(1): titre= "As"; puissance = 14;
break;
defa... |
e8d703e0-953f-4cc0-bcef-05c1622b2083 | 2 | public void addDocument(Document doc) throws CloneNotSupportedException {
for (Document d : documents) {
if (doc.equals(d)) {
throw new CloneNotSupportedException("Le mot clef est déja assigné au fichier.");
}
}
documents.add(doc);
} |
82835ad8-cc8c-4257-a2b1-d5d3a5049087 | 6 | @EventHandler
public void PlayerHarm(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.getPlayerConfig().getDouble("Player.Harm.Dodge... |
92e7fa59-b177-4a91-898e-2ac5275babfe | 6 | protected void appendDebitCard(StringBuilder req, USDebitCard debitCard) {
if (debitCard.getAccountType() != null) {
this.appendParam(req, USDebitCard.Field.accountType.name(), debitCard.getAccountType());
}
if (debitCard.getCustomerNumber() != null) {
this.appendParam(re... |
660829e0-6120-4120-ae8a-c9737298bb2d | 9 | private void initLight(Cell cell, float x, float y){
String type = cell.getTile().getProperties().get("light", String.class);
Light l = null; boolean scheduled = true; Color c;
type = type.toLowerCase().trim();
switch(type){
case"street":
l = new ConeLight(rayHandler, Vars.LIGHT_RAYS, Vars.SUNSET_GOLD,
... |
32eee507-3e21-4745-8330-44688265a22d | 6 | private String[] getDisabled () {
disabledMods.clear();
if (folder.exists()) {
for (String name : folder.list()) {
if (name.toLowerCase().endsWith(".zip.disabled")) {
disabledMods.add(name);
} else if (name.toLowerCase().endsWith(".jar.disa... |
b733fc97-0fbf-4cf7-aae0-2148fa20af21 | 3 | @Override
public void deleteSelection() {
HashMap<TreeContainerRow, ArrayList<TreeRow>> map = new HashMap<>();
ArrayList<TreeRow> rows = mPanel.getSelectedRows();
for (TreeRow row : rows) {
TreeContainerRow parent = row.getParent();
ArrayList<TreeRow> list = map.get(parent);
if (list == null) {
list... |
afa2a251-9f53-4593-9f94-ac2cfa8c44b6 | 9 | @Override
public boolean processObjectClick1(final WorldObject object) {
if (object.getId() == 31529 && object.getPlane() == 0) {
climbTower(object);
return false;
} else if (object.getId() == 31530 && object.getPlane() == 1) {
player.getDialogueManager().startDialogue("SimpleMessage",
"You're not al... |
a198f568-41d1-4ddc-b946-ca264945cead | 0 | public static Border getDefaultEmptyBorder()
{
return defaultEmptyBorder;
} |
e2b0fb07-6d78-4a97-aa8b-2e511100c3b3 | 4 | public void update() {
for(Door d : doors)
d.update();
player.update();
for(MedKit mk : medKits)
mk.update();
for(Enemy e : enemies)
e.update();
for(MedKit mk : medKitsToRemove)
medKits.remove(mk);
} |
470268dc-b506-4e59-a43f-8390daa0f8c1 | 4 | public void run()
{
if (pass) {
try {
while (!msg.getType().equals("logout"))
{
msg = (Message)inFromClient.readObject();
send(msg);
System.out.println(msg.getMessage());
}
msg.setCommand("send_all");
msg.setType("logout");
msg.setSender... |
32d06f1a-4ceb-4553-bb24-5127a7495679 | 3 | private ArrayList<String> getHTML(String url){
ArrayList<String> res = new ArrayList<String>();
URL lyr;
try {
lyr = new URL(url);
URLConnection lyrc = lyr.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
lyrc.getInputStream()));
String inputLine;
while... |
f5410eea-082b-40f3-8092-0f963c9e465b | 3 | @SuppressWarnings("static-access")
private void ROUND5() {
enemises.clear();
System.out.println("Round5!!!!!!");
for (int i = 0; i < level.getWidth(); i++) {
for (int j = 0; j < level.getHeight(); j++) {
if ((level.getPixel(i, j) & 0x0000FF) == 2) {
... |
4d8bcd3e-65f2-46be-a00b-6d651260ef2a | 7 | public void useItem(int playerID, int index) {
Player p = this.playerIDs.get(playerID);
if (p != null) {
if (index != -1 && p.getInventoryItems().get(index) != null) {
Item toUse = p.getInventoryItems().get(index);
if (toUse instanceof Powerup) {
Powerup powerup = (Powerup)toUse;
if (powerup.ge... |
bc5ecf80-2582-4b3c-9460-b3dedf0fa5c5 | 2 | public void setPublic(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int modifiers = fieldInfo.modifiers();
if (flag) {
modifiers |= Modifiers.PUBLIC;
} else {
modifiers &=... |
e74feb5a-c56b-406c-8e02-1ce55fc88961 | 4 | public void bind(List<Stakeholder> stakeholders, List<FunctionalRequirement> functionalRequirements) {
for (Stakeholder sh : stakeholders) {
if (sh.getId().equals(stakeholderId))
this.stakeholder = sh;
}
for (FunctionalRequirement fr : functionalRequirements) {
if (fr.getId().equals(functionalRequiremen... |
8265da8a-d43f-46a1-bfbf-f09976d6d2c0 | 3 | public void run(String[] args) {
if (args.length > 1) {
ModelCommand command = CommandProcessor.getCommand(args[1]);
Logger.log("-- Ajuda comando '" + command.getCommand() + "' --");
Logger.log(command.getTextHelp());
} else if (args.length == 1) {
Logger.log("\nComandos:");
for (Iterator<ModelCom... |
0f02348b-b207-4b54-9327-995ea108350e | 8 | public void train(Data trainingData)
{
input_data = trainingData.getInputVector();
output_data = trainingData.getOutputVector();
for( int run = 0; run < runtime; run++ ) {
if(pause) {
continue;
}
if(terminate) {
break;
}
double start = System.currentTimeMillis();
initializePop... |
3130994c-51c0-44e0-a880-3b778e3389e4 | 3 | private List<String> parsearListaDeHechosDeInicio(List<Regla> listaReglas) {
List<String> hechosDeInicio = new ArrayList<String>();
for (Regla r : listaReglas) {
List<String> causantes = r.getCausantes();
for (String s : causantes) {
if (!isCadenaEnLista(s, hec... |
221af288-a1cd-4a94-83ab-df7b3492f094 | 2 | private List <UsuarioSistema> carregaDadosDoBanco(){
this.dao = new UsuarioSistemaDAO();
try{
List<UsuarioSistema> lista = dao.listarTodos();
return lista;
}catch(ErroValidacaoException ex){
JOptionPane.showMessageDialog(rootPane, ex.getMessage()... |
63e7f270-a427-4437-ab2d-5cb31851a68f | 4 | public String getStat() {
int count = 0;
long allMesagesInBytes = 0;
for (File box : dir.listFiles()) {
for (File file : box.listFiles()) {
if (file.isFile() && file.getName().endsWith(".mail")) {
count++;
allMesagesInBytes +=... |
a07f928b-dce5-4f01-9e80-d114739c4aa5 | 9 | private void onProcess(final InputStream is, final OutputStream os) throws IOException {
PrintUtil.verbose("#" + new Date() + " - Process Redirect Connection: " + BlucatState.execString);
final Process p = Runtime.getRuntime().exec(BlucatState.execString);
final OutputStream pos = p.getOutputStream();
... |
ac8177e9-3bb4-4cbd-b260-cb8175884842 | 8 | public Object getCommand(String name, Class[] argTypes, Interpreter interpreter) throws UtilEvalError {
if (Interpreter.DEBUG)
Interpreter.debug("getCommand: " + name);
BshClassManager bcm = interpreter.getClassManager();
if (importedCommands != null) {
// loop backwards for precedence
for (int i = impo... |
4d8d3bdd-2994-4b92-9e46-1629593a6b35 | 3 | public static void writeObject(String parent, String fileName, Serializable obj) {
File parentDir = new File(parent);
parentDir.mkdirs();
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(new File(parentDir, fileName))));
oos.writeObject(obj);
... |
38330f9b-1d96-4a54-9e80-db8ce55c8528 | 6 | private void fixCannons(){
for (int xx = 0 ; xx < width ; xx++){
for (int yy = 0; yy < height; yy++){
if (getBlock(xx,yy) == 0){
if (getBlock(xx,yy-1) == CANNON){
setBlock(xx,yy,CustomizedLevel.CANNON_CONNECTOR);
}
if (getBlock(xx,yy-1) == CANNON_CONNECTOR || getBlock... |
334eaf5f-d87a-4e5a-b417-9e2ab6ebbec9 | 9 | boolean AfegirRestriccioGrupSessio(String nomA, int grup, String dia, int hora) {
// si el dia/horan o es vlaid retorna false
boolean b = true;
for(int i = 0; i < this.cjtAs.size() ; ++i){
Assignatura a = cjtAs.get(i);
if( a.getNom().contains( nomA )){
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.