method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9b41acee-0591-4ae8-8b51-ab91f356e8e8 | 7 | private boolean restPost(String restRequest, String[] pName, String[] pValue) {
String result = "";
String value = "";
if (pName != null && pValue != null && ! pName[0].isEmpty()) {
for (int i=0; i < pName.length; i++) {
value += "&" + pName[i] + "=" + pValue[i];
}
value = value.substring(1);
}
t... |
c59a10fd-df47-43ef-9853-54b6a7c01d38 | 7 | protected void handleControlPropertyChanged(final String PROPERTY) {
if ("RESIZE".equals(PROPERTY)) {
resize();
} else if ("SWITCH_COLOR".equals(PROPERTY)) {
background.setStyle("-switch-color: " + Util.colorToCss((Color) getSkinnable().getSwitchColor()) + ";");
} else if... |
2ad1e26b-d459-44d2-830b-a1d7a7ec6c80 | 3 | protected void popFilters(String op, Filterable... queries) {
FilterGroup group = new FilterGroup().op(op);
for(Filterable q : queries) {
List<Filter> list = getFilterList(q);
if (list != null)
if (!list.isEmpty())
group.add(list.remove(list.size()-1));
}
add(group);
} |
daf18270-d814-41b3-b441-5323baec55c5 | 0 | public Integer getId() {
return id;
} |
a5f0f1c0-cf4e-4ac1-96f3-0c0c65eaafb7 | 6 | public String getParameterString(){
String retString = super.getParameterString();
try{
if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
if(maxRetrieve!=null) retString+="&maxRetrieve="+maxRetrieve.toString... |
c52cbe5e-3366-4ddb-83c7-49a396c3578f | 5 | public void actionPerformed(ActionEvent e)
{
if (e.getSource() == cancel)
{
setVisible(false);
dispose();
}
else if (e.getSource() == submitClose)
{
if (submitClose.getText().equals(SUBMIT) && oneSelected())
{
enableButtons(false);
... |
87838a0a-4fb9-4e4b-895f-298bdd256bcc | 2 | public static void StopFillTask() {
if (fillTask != null && fillTask.valid())
fillTask.cancel();
} |
c99d4bd2-0563-47d4-b5bd-a4df2a54f871 | 0 | public void setPcaIdElemento(Integer pcaIdElemento) {
this.pcaIdElemento = pcaIdElemento;
} |
d3ffcbd5-13fd-4a9b-aec0-2b1fae61fdc6 | 5 | public void refresh(){
g2d[0].setColor(Color.BLACK);g2d[0].fillRect(0,0,width*20+height*20,width*15+height*15);
for (int h = 0 ;h<2;h++)
for (int j = 0 ;j<height;j++){
for (int i = 0 ;i<width;i++){
if (field[h][i][j] != null && field[h][i][j] != "") g2d[h].drawImage(Cursor.getTile(field[h][i][j]),convert.px(n... |
a255ef97-3b88-4657-ba69-5b2730bf7abf | 4 | private int getDaysInMonth(int month, int year) {
int[] days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int days = days_in_month[month];
if (month == 1 && year % 4 == 0) {
if (year % 100 == 0) {
if (year % 400 == 0) {
days += 1;
... |
ce647f0a-f112-42e2-9c46-c0a26d468d46 | 4 | public static void main(String[] args) {
int players = 5;
int pound = 10;
ScoreBoard sb = new ScoreBoard(players);
Lane lane = new Lane();
Bowl bowl = new Bowl(pound);
for (int currentFrame = 1; currentFrame < RunBowling.FRAMES-1; currentFrame++) {
for (int currentPlayer = 0; currentPlayer < players; ... |
a7fe55dd-46de-4734-a25a-653770210090 | 1 | @Override
public void render (float delta) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
countdown.update(delta);
if(countdown.isDone()){
Objects.playScreen.finished((int)chunk.x, (int)chunk.y);
ld.setScreen(Objects.playScreen);
}
camera.update();
Objects.BATCH.setProjectionMatrix(camera.combined);
... |
589aba25-e377-4b55-8574-c0ac0271849b | 4 | public void inverseSelection() {
expandMenu();
for(int i = 0; i < methodTree.getRowCount(); i++) {
TreePath path = methodTree.getPathForRow(i);
if(path == null) return;
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) path.getLastPathComponent();
... |
a56333e5-9524-4504-8c49-cd534306146f | 3 | public static int min3(int a, int b, int c) {
if (a < b) {
return (a < c) ? a : c;
}
return (b < c) ? b : c;
} |
2b611f71-4bb6-497e-a293-cd16a9d44a54 | 9 | public List<QuestionInfo> getAnnotatedData(String corpusPath,
final String prefix, final String ext, final String chunkExt)
throws Exception {
if (corpusPath == null) {
throw new Exception("Corpus path is missing");
}
List<QuestionInfo> trainingData = new ArrayList<QuestionInfo>();
File folder = new Fi... |
1638f08d-3d0e-4c19-924a-958dd4c995e3 | 3 | public TestHolder(final char commandChar, final String args, final String fileName, final int lineNumber) {
super();
String commandString = new String(new char[] {commandChar});
if (commandChar == '<')
command = Command.SOURCE;
else if (commandChar == '=')
command = Command.SET;
else try {
command = ... |
4b8894c3-5a70-4290-b427-aec78425882d | 3 | private static Rectangle minimumCropRect(Vector<BufferedImage> spriteSet)
{
Rectangle cropRect = null;
for (BufferedImage sprite : spriteSet) {
Rectangle frameCropRect = determineCropRect(sprite);
if (cropRect == null) {
cropRect = frameCropRect;
... |
250015ca-7b68-44f5-9cdb-799578cf05c7 | 1 | private void findAds(File video, IMediator mediator) {
System.out.println("Processing started");
int granularity = 5, numberOfContinuousSections = 8, calibrationIntervalLength = 40;
double maxElevation = 1.5;
long videoLength = VideoUtils.getVideoDurationInSeconds(video);
manage... |
da86dd8e-0d38-4242-b6e8-c5fbf49a8985 | 0 | synchronized public static int nextID() {
return globalID++;
} |
8a94cc64-0dae-4bdc-93ce-44f369946af5 | 5 | @Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g.setColor(DEF_BACKGROUND_COLOUR);
g.fillRect(0, 0, Util.IMAGE_SIZE, Util.IMAGE_SIZE); //clear the screen to remove artifacts
if(image != null) { // if there is an image to draw, draw it
for(int row = 0;row<Util.IMAGE_SIZE... |
68ca2df6-6592-4dbd-8f85-3b9464cc8b0d | 8 | public ArrayList<ArrayList<String>> partition(String s) {
// Start typing your Java solution below
// DO NOT write main() function
ArrayList<ArrayList<String>> resArr = new ArrayList<ArrayList<String>>();
int n = s.length();
if (n == 0)
return resArr;
boolean[][] res = new boolean[n][n];
for (int i = 0... |
d0ba4c43-1c8f-4435-9c4e-2cac0ee14421 | 0 | public String getPropertiesFilePath() {
return propertiesFilePath;
} |
c01ecc66-be30-412d-af01-9859755b453f | 4 | public static int posteY(int rangee,int orientation){
int centreY = centrePositionY(rangee) ;
switch(orientation){
case Orientation.NORD :
centreY -= 20 ;
break ;
case Orientation.EST :
centreY -= 25 ;
break ;
case Orientation.SUD :
break ;
case Orientation.OUEST :
centreY -= 25 ... |
ba9ab335-54d7-4667-a87b-58bd30adf6d7 | 5 | @Override
public void doing(Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {
// String count = request.getParameter("count");
// int max = 1;
// if (count != null && !count.equals(""))
// max = Integer.valueOf(count);
JSONArray lstJSON = new JSONArray();
... |
03a8d8e1-10e4-4c50-908c-9815c85a59d7 | 3 | public boolean shouldExtract(String path) {
if (this.exclude != null) {
for (String rule : this.exclude) {
if (path.startsWith(rule)) return false;
}
}
return true;
} |
62010b32-618e-4d41-b085-ada7bd5ca97f | 9 | public void start()
{
// variables: g = generation, n = population size, ff = fitness function
Generation g = this.getGeneration();
int n = g.getPopulationSize();
SpiderBotFitnessFunction ff = new SpiderBotFitnessFunction();
// main loop
do
{
// determine the generation number
int gen_count = g.g... |
aeafef31-9ce3-48a6-9e68-eae6e653a95c | 8 | public String toString() {
if(this.image.trim().equals(":~")) { //weak constraint
ASTbody body=(ASTbody) this.jjtGetChild(0);
if(this.jjtGetNumChildren()>1) {
ASTconstraintParams params =(ASTconstraintParams) this.jjtGetChild(1);
return ":~"+body.toString()+". "+params.toString();
}
else {
ret... |
c58137fa-517b-44bf-ad8f-52020e6e3d80 | 9 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Jump other = (Jump) obj;
if (captureX != other.captureX) {
return false;
}
if (captureY != other.captureY) {... |
7bffc703-6af6-43ee-8fa8-9358be5dc3b2 | 0 | public PlayerListener getPlayerListener() {
return playerListener;
} |
cd7c4163-964c-4dec-8b66-7e3d8344c77c | 0 | @Override
public void setData(Object data) {
this.data = data;
} |
c3500a45-1c18-46c0-bfa3-b67e3c3b5d82 | 8 | private int getDirection(double x, double y) {
if (y < 0 && x < 0) {
return (int) (180 + Math.toDegrees(Math.atan(Math.abs(y) / Math.abs(x))));
}
if (y < 0 && x > 0) {
return (int) (360-Math.toDegrees(Math.atan(Math.abs(y) / Math.abs(x))));
}
if (y > 0 && ... |
841815a0-70bd-4674-950c-7678c068c9f4 | 5 | public CheckResultMessage check5(int day) {
int r = get(17, 5);
int c = get(18, 5);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != (getValue(r + day, c, 4).compareTo(getValue(r + day
- 1, c + 5, 4)))) {
return er... |
7a9dc2ef-3e2b-44e3-88d9-b836e9b84f44 | 8 | protected void encodeElements(mxCodec enc, Object obj, Node node)
{
if (obj.getClass().isArray())
{
Object[] tmp = (Object[]) obj;
for (int i = 0; i < tmp.length; i++)
{
encodeValue(enc, obj, null, tmp[i], node);
}
}
else if (obj instanceof Map)
{
Iterator<Map.Entry> it = ((Map) obj).entr... |
be18cb69-129f-4cf9-b90f-0f220ca3e91c | 3 | private void checkForMessages() throws IOException {
while (!messageQueue.isEmpty()) {
Message message = messageQueue.poll();
for (SocketChannel channel : acceptedConnections) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out =... |
d9b29135-b9aa-4bc2-8cef-aaeb2bd1729e | 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 feel.
* For details see http://down... |
ecb76230-2085-43e1-9b9a-d2c97756ce34 | 1 | public void printLines(int indent, String line) {
if (startPos == -1) {
pw.print(line);
} else {
pw.print(line.substring(0, startPos));
printRegion(indent + startPos, line);
pw.print(line.substring(endPos));
}
} |
5070e486-c8d6-4373-8d8a-ae4b18955bd8 | 1 | private void propogateState() {
MultiType source = mergeSource;
while (source != null) {
source.interfaces = interfaces;
source.potentialClass = potentialClass;
source = source.mergeSource;
}
} |
e4025f21-6ca3-4d1e-86c2-fb10b72e642c | 8 | public void nextPermutation(int[] num) {
int i,j,k,notde,firstlar,temp;
int len=num.length;
if(len==1) return;
for(i=len-1;i>0;i--)
{
if(num[i-1]<num[i])
break;
}
notde=i-1;
if(num[0]>=num[1])
{
for(j=0;len-... |
63052e99-f328-4988-b9f4-6d8198212170 | 2 | @Override
public Object stringToValue(String text) throws ParseException {
return new Double(Math.min(Math.max(Numbers.getLocalizedDouble(text, mMinValue <= 0 && mMaxValue >= 0 ? 0 : mMinValue), mMinValue), mMaxValue));
} |
d83a85ef-ae54-48ee-b4b2-e17870b0fbfc | 0 | public void specificRequest() {
// 具体的功能处理
System.out.println("this is in Adaptee!");
} |
a4a9b02c-1f57-4f7b-911a-9e759c7fb3b3 | 0 | protected void fillShape(DrawableItem di, Graphics2D g) {
g.setColor(di.getFill());
g.fill(di.getShape());
} |
75b0e9f7-530c-4d1c-96db-c0a52983bd7d | 0 | public boolean isAdd() {
return myAdd;
} |
c0e94be8-7275-4ef4-a4ab-a8d18fe92f78 | 4 | private static void clearArea(CellState[][] states, int x, int y, Location gLoc){
Grid<Actor> gr = GridWorldLife.instance.world.getGrid();
for(int r = 0; r < states.length; r++){
for(int c = 0; c < states[0].length; c++){
int row = gLoc.getRow() + (r - y);
int col = gLoc.getCol() + (c - x);
... |
d2ed35fd-8590-49b5-adaa-0fc0c5034f92 | 8 | public synchronized void updateDisplay()
{
// check that x and y are at least 0
if (xPos < 0)
xPos = 0;
if (yPos < 0)
yPos = 0;
// if picture
if (picture != null)
{
if (xPos >= picture.getWidth())
xPos = picture.getWidth() - 1;
if (yPos >= picture.getHeight... |
2f75dc08-4d26-4369-9402-ac2153e07d39 | 5 | public void run() {
while (true) {
TACMessage msg = getMessage();
boolean sent;
for (int errors = 0; !(sent = sendMsg(msg)) && errors < 3; errors++) {
log.warning("failed to send message " + msg.getType()
+ " (retry " + (errors + 1) + ')');
try {
Thread.sleep(1000);
} catch (Exception ... |
240126bd-4401-412f-a63e-236082354246 | 6 | public static void main(String[] args) {
List<Rider> riders = new ArrayList<Rider>();
// Rider rider = new Rider(name, raceCode) ??? what is race code
riders.add(new Rider("Human", Rider.HUMAN_CODE));
riders.add(new Rider("Hobbit", Rider.HOBBIT_CODE));
riders.add(new Rider("bu... |
e657b652-1f8e-468e-97e5-cd5fcb37dee1 | 5 | public void translateAll() {
for (DrawableItem pa : l.getDrawable()) {
if (pa instanceof Panel && !((Panel) pa).deleted) {
Point p = getPanelAnchor((Panel) pa);
double hfactor = -(p.x - (((double) variables.THUMBNAIL_WIDTH * p.x) / (double) variables.CANVAS_WIDTH));
... |
5692793f-f67d-442f-aedb-e44695041bfc | 3 | private double calculateRisk(Vector pos) {
double risk = 100.0 / pos.distanceSq(getTargetPosition());
for(double[] edge : State.wavelessField.getEdges()) {
risk += 5.0 / (1.0 + Line2D.ptSegDistSq(edge[0], edge[1], edge[2], edge[3], pos.x, pos.y));
}
/*
* Get points between enemy location and corner an... |
b1287fdd-45d8-4459-8e51-22408075e79a | 5 | private static final void speedCheck(final List<LifeMovementFragment> res, final MapleClient c) {
double speedMod, playerSpeedMod = c.getPlayer().getStat().getSpeedMod() + 0.005;
for (LifeMovementFragment lmf : res) {
if (lmf.getClass() == AbsoluteLifeMovement.class) {
final ... |
a3e2f01b-b822-41a5-b006-a3b82e4fcec4 | 3 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/entrada/list.jsp");
try {
EntradaDao oEntradaDao = new EntradaDao(oContexto.getE... |
50fff62e-0558-4ee5-bb39-5ed631713b20 | 2 | public void touch(Entity e, Level level)
{
if (e instanceof CoinEntity)
{
CoinEntity ce = ((CoinEntity) e);
if (!ce.collected)
{
score++;
Sound.coin.play();
ce.collected = true;
}
}
} |
0a82dc40-f9fd-4130-abc7-790b6453ba9e | 5 | public static ArrayList<Interval> insert(ArrayList<Interval> intervals,
Interval newInterval) {
ArrayList<Interval> result = new ArrayList<Interval>();
// loop intervals
for (Interval interval : intervals) {
if (interval.end < newInterval.start) {
result.add(interval);
} else if (interval.start > ne... |
699e4a90-6829-467a-9f91-79d773c49e50 | 0 | public static ModelClassDesc getClassDesc(TableDesc tableDesc,
String packageName) {
return MySQLUtils.tableParseToMode(tableDesc);
} |
14c2be87-00e4-49e9-9405-78c2e41655b0 | 4 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
ArrayList<Character> list = new ArrayList<>();
ArrayList<Character> combinedList = new ArrayList<>();
// read chars from first list;
// with "replaceAll" method remove a... |
8d739b74-cf86-4973-aaf2-442915d2e54f | 9 | @Override
protected boolean xsend (Msg msg_, int flags_)
{
// If this is the first part of the message it's the ID of the
// peer to send the message to.
if (!more_out) {
assert (current_out == null);
// If we have malformed message (prefix with no subsequent ... |
7d0d9b97-29a4-4ff8-b8f2-f3f710f8970c | 9 | private void secondRun() {
// compute the cumulative distribution function
double cdf[] = new double[maxIter + 1];
double t = 0;
int min = maxIter, max = 0;
for (int j = 0; j <= maxIter && active(); ++j) {
t += Math.pow((double)histogram[j].get... |
479c4ca8-240e-415c-b05e-e528684e635f | 3 | public FiltersMenu() {
super("Filter");
setEnabled(true);
JMenuItem gaussianFilter = new JMenuItem("Gaussian");
gaussianFilter.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Panel panel = (((Window) getTopLevelAncestor()).getPanel());
if (panel.... |
e8017f7e-8f0f-4c5c-a1cf-dd55aa26f4c6 | 3 | public List<ApiKey> apiKeys() throws EasyPostException {
ApiKeys parentKeys = ApiKeys.all();
if (this.getId() == parentKeys.getId()) {
return parentKeys.getKeys();
}
for(int i=0; i < parentKeys.children.size(); i++) {
if(this.getId().equals(parentKeys.children.get(i).getId())) ... |
4e20253e-1e52-4b28-8943-4aa5deb5aa38 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Npc other = (Npc) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
}
... |
b48004a6-c143-4a97-87a8-720fa742eaa5 | 1 | @Override
public String value(int index) {
return index < value.length? value[index]:null;
} |
e05e2d1c-cbed-44ac-b3af-12fc6ad9a6c5 | 0 | private void initComponents() {
setLayout(new GroupLayout());
add(getJLabel0(), new Constraints(new Leading(26, 10, 10), new Leading(55, 12, 12)));
add(getJLabel2(), new Constraints(new Leading(115, 10, 10), new Leading(17, 12, 12)));
add(getJButton0(), new Constraints(new Leading(66, 81, 10, 10), new Leading(2... |
897db2a0-fb41-4e2d-8264-3ddaac3b967b | 2 | public double[] rawPersonRanges(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawPersonRanges;
} |
18882c67-3b72-4e2b-a4a1-7e96e93a81e5 | 0 | public ConfigurationWriter() {} |
b44dbc11-3bc1-42e9-b926-e5c9d6123960 | 8 | public void compute()
{
String tr = inpGtria.getText() ;
String[] trias = new String[4] ;
/* Read the trias configuration from inpGtria into trias[0..2], skipping lines
* that start with a hash mark.
*/
Scanner s = ... |
da0a1a32-272c-4f70-9e89-4e0f7198a64d | 4 | public byte[] genKey(int index, int permuted_index) {
int i, bit;
byte[] key = null;
assert (index < (1 << n_inputs)) : "gen_key: index >= 2^n_inputs (too big)";
MyUtil.md.reset();
MyUtil.md.update(MyUtil.toByteArray(gate_index));
MyUtil.md.update(MyUtil.toByteArray(pe... |
6cdd01e6-b26a-4113-948b-da1cdd8e3235 | 5 | public boolean liveRangesIntersect(final VarExpr a, final VarExpr b) {
Assert.isTrue((a != null) && (b != null),
"Cannot get intersections for null def");
Assert.isTrue(a.isDef() && b.isDef(),
"Cannot get intersections for variable uses");
if (a == b) {
return false;
}
// If all locals should hav... |
903471c4-b265-443e-9726-b51ccda64b75 | 8 | static ImageIcon getKarelImage(int direction) {
switch (direction) {
case NORTH: {
if (nkarel == null)
nkarel = new ImageIcon(Display.class.getResource(nkarelLocation));
return nkarel;
}
case EAST: {
if (ekarel == null)
ekarel = new ImageIcon(Display.class.getResource(ekarelLocat... |
7b112a95-cc1f-4953-b7f4-aac24c1998e1 | 3 | private boolean intersectVertical(KDPoint q, double distActual, boolean left) {
return q.getY() >= yi && q.getY() <= yf && Math.abs(q.getX() - (left ? xi : xf)) <= distActual;
} |
a5eb0135-f4f9-4351-97a0-03f95e3c9103 | 9 | void expand(ArrayList<Integer> C,ArrayList<Integer> P){
if (timeLimit > 0 && System.currentTimeMillis() - cpuTime >= timeLimit) return;
nodes++;
for (int i=P.size()-1;i>=0;i--){
if (C.size() + P.size() <= maxSize) return;
int v = P.get(i);
C.add(v);
ArrayList<Integer> newP = new ArrayList<Integer... |
53c0d650-c4ed-4142-8e4a-c239ec275458 | 9 | protected void writeJSON()throws JsonParseException, IOException
{
JsonFactory jsonF = new JsonFactory();
JsonParser jp = null;
JsonGenerator jg = null;
try
{
jp = jsonF.createJsonParser(is);
jg = jsonF.createJsonGenerator(os);
jg.useDefaultPrettyPrinter(); // enable indentation just to make deb... |
fdeea88b-aee0-4607-9370-a9867f66fb9c | 3 | public static IList<Integer> divide(IList<Integer> ls) {
if (ls.length() <= 1) {
return ls;
}
IList<Integer> ll = new MLinkedList<>();
IList<Integer> lr = new MLinkedList<>();
int len = ls.length();
int pivotindex = len / 2;
INode<Integer> currNode = ls.getFirst();
while (currNode != null) {
i... |
cc0dcf22-83cc-4693-8935-ff81c5bca8ef | 3 | public static String eliminarCerosString(String s){
String temp = s.trim();
if (esNumero(temp) && !temp.isEmpty()){
Integer i = Integer.parseInt(temp);
if (i != 0)
temp = i.toString();
else
temp = "";
}
return temp;
} |
554f5328-98e6-4338-bda6-e08fe170bc4b | 1 | public static void insertCommandeFournisseur( int idutilisateur, String referencefournisseur, Date datecommandefournisseur, Float remisefournisseur) throws SQLException {
String query = "";
try {
query = "INSERT INTO COMMANDE_FOURNISSEUR (ID_UTILISATEUR,COMFOUREF,COMFOUDATE,COMFOUREMISE) V... |
e72db868-332a-4eeb-99f9-f8eef5c3b86d | 5 | public String getMaxGain( TextProcessing TextPro ) {
double Entropy_S = getInformationEntroy(TextPro.objResult.Result_Count);
HashMap<String, Double> GainMap = new HashMap<String, Double>();
for ( int i = 0; i < TextPro.objAttributeList.size(); i ++ ) {
Attribute objAttr = TextPro.objAttributeList.get(i);
A... |
c3523270-eff9-4256-9caa-3db206556afe | 6 | private void expand() {
if (nextRecord == null)
return;
//System.out.println("Pushing record starting at : " + nextRecord.getAlignmentStart());
records.push(new MappedRead(nextRecord));
//Find next suitable record
try {
nextRecord = recordIt.next();
}
catch(NoSuchElementException ex) {
next... |
8fb2c504-1551-4d2d-832a-e023eb800925 | 6 | public void click() {
Rectangle upArrow = new Rectangle(PotatoHead.CORNER_X + 400, PotatoHead.CORNER_Y + 0, 80, 40);
Rectangle downArrow = new Rectangle(PotatoHead.CORNER_X + 400, PotatoHead.CORNER_Y + 560, 80, 40);
if (upArrow.contains(Mouse.mse)) {
scrollUp();
} else if (d... |
5ad61de0-ec9c-4068-be42-7e87b3dd2789 | 6 | private void closeResourceSilently(ResultSet res, PreparedStatement pstt,
Connection conn) {
if (res != null)
try {
res.close();
} catch (SQLException ignore) {
}
if (pstt != null)
try {
pstt.close();
} catch (SQLException ignore) {
}
if (conn != null)
try {
conn.close();
... |
354bc917-ed1f-41bf-9aa5-31c8e2aeb972 | 6 | private void initReference(){
File f = new File(PATH_RESSOURCE+REFERENCE_MORSE);
FileReader fr;
try {
fr = new FileReader(f);
BufferedReader b = new BufferedReader(fr);
int i = 0, j = 0;
int tmp = b.read();
while(tmp != -1){
if(tmp != 44 && tmp != 10){ //44 = ' ' et 10 = '\n'
reference[i][... |
f5e0229b-9f50-4b90-b213-854ad8e633d1 | 4 | public void setPixel(int color, int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height)
return;
pixels[x + y * width] = color;
} |
011878fa-8809-4c18-a944-1c9d34232da1 | 2 | @Override
public void characters(char[] ch, int start, int length)
throws SAXException {
String value = new String(ch, start, length).trim();
if (lastFieldName != null) {
logger.info(String.format(Messages.getString("parsing_field"), //$NON-NLS-1$
lastFieldName, value));
if (currentParser.parseFie... |
77c723a4-9f4c-4495-a239-6b03926d0145 | 0 | public static void main(String[] args) throws Exception {
Thread t = new Thread(new Blocked2());
t.start();
TimeUnit.SECONDS.sleep(1);
System.out.println("Issuing t.interrupt()");
t.interrupt();
} |
e649a2ee-bed5-4e20-939d-ca2e00721b11 | 6 | public static void pascalTriangle(int n) {
int[][] pascal = new int[n+1][n+1];
for( int i = 0; i< n+1; i++) {
for( int j = 0; j< i; j++) {
if(i-1 >= 0 && j-1 >= 0) {
pascal[i][j] = pascal[i-1][j] + pascal[i-1][j-1];
} else {
... |
0a71fb39-a7b4-4202-b468-543dc94644b5 | 2 | public static final long extractTime(String text) {
if (text != null) {
Matcher matcher = TIME_PATTERN.matcher(text);
if (matcher.find()) {
long time = TimeUnit.MILLISECONDS.convert(Numbers.extractInteger(matcher.group(1), 0, false), TimeUnit.HOURS);
time += TimeUnit.MILLISECONDS.convert(Numbers.extract... |
43098dec-2a16-4bd9-8fac-f2080a4ef46d | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
030750ee-39c6-45b0-ab10-ab1055e3f738 | 9 | @Override
public void run() {
Gson convert = new Gson();
try {
// ----------------
// Login Protocol
// ----------------
ChatSocket = new DatagramSocket(Storage.getPort(),InetAddress.getByName("0.0.0.0"));
ChatSocket.setBroadcast(true);
// Get JSON Interpretation
String HELLO = convert.toJson... |
390b5101-0da3-48e3-8bd0-c93543c0674c | 3 | public void run() {
running = true;
final int CASH_PORT = 4713;
try {
ServerSocket cashServerSocket = new ServerSocket(CASH_PORT);
ServerDataBaseManager sDBM = new ServerDataBaseManager();
while (true) {
if (running) {
new CashServerExecutionThread(cashServerSocket.accept(), sDBM).start();
}... |
229e923e-bf66-4e78-8c3d-0442d11b9c45 | 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 feel.
* For details see http://down... |
15c8a0eb-a11f-46b0-837e-f406760716d7 | 5 | public boolean matches(@NotNull String labelStr) {
for (Label exclude : excludes) {
if(exclude.getName().equals(labelStr)) {
return false;
}
}
if(includes.isEmpty()) {
return true; //We either have nothing or only excludes
}
for (Label include : includes) {
if(include.getName().equa... |
190f474a-6fc2-48d9-93ea-d271c3ee44a1 | 1 | public static void main(String [] args) throws IOException, InterruptedException
{
init();
StringBuilder s = null;
while(true)
{
s = grabVal();
String temp = constructString(s);
write(temp);
Thread.sleep(1000000);
}
} |
4a37fed1-45d3-48e9-9861-238c8392f7e3 | 9 | private void processMultipart(Multipart multipart, PrintWriter printwriter)
throws Exception
{
boolean flag = true;
String s = "";
int i = 0;
for(int j = multipart.getCount(); i < j; i++)
{
BodyPart bodypart = multipart.getBodyPart(i);
String s... |
5d6f2248-5eb0-4ce2-888e-ca68efc8f1aa | 2 | private static Drug getDrug(Drug bean, PreparedStatement stmt, ResultSet rs) throws SQLException{
if(bean.getDrugId()!=0)
stmt.setInt(1, bean.getDrugId());
else
stmt.setString(1, bean.getDrugName());
rs = stmt.executeQuery();
if (rs.next()) {
Drug newBean = new Drug();
newBean.setDrugId(rs.get... |
58a63fcd-f7ff-4626-95e4-71f663ddd59f | 9 | @Override
public void run(){
//trick so that _ONLY_ send() can run this method!
//only send() sets isStarted to true.
//if send() is called with true isStarted it'll throw an exception
//thus it's impossible to call this function more than once.
if (!isStarted) return;
isReady = false;
try{
//me... |
56990c89-65ca-4050-aafc-01f49d50cf19 | 9 | private void save() {
try {
RecordStore.deleteRecordStore(RECORDSTORE_SESSION); // Clear data
}
catch (Exception e) { /* Nothing to delete */ }
RecordStore rs = null;
ByteArrayOutputStream baos = null;
DataOutputStream dos = null;
try {
rs... |
a7647bd3-69fb-405b-9854-983fc807e991 | 3 | int dataSize() throws UnsupportedEncodingException
{
if ( parent!=null || isHint() )
return 0;
else if ( data == null )
return 0;
else
return byteLength();
} |
18f1c563-cd4a-4a44-9211-8ee9e823bd49 | 4 | public static void main(String[] args) throws NoSuchFileException, IllegalArgumentException {
if (args.length >= 5) {
Draft.checkHash( args[0] );
Draft.checkRange(args[1], 4, 15);
Draft.checkRange(args[2], 1, 50);
Draft.checkRange(args[3], 0., 1.);
for(int ... |
aadfb99e-9371-44b6-bb14-c2a68743099b | 7 | private boolean searchCombo(int x, int y, int type) {
int slot = y * 15 + x + 1;
for (int i = 0; i < 5; i++) {
if (piece[slot + i] == type) {
if (i == 4) {
return true;
}
} else {
break;
}
}
... |
6c16b8eb-049e-4df8-9292-8bd2bf711d0c | 4 | public void getCollidingBoundingBoxes(World var1, int var2, int var3, int var4, AxisAlignedBB var5, ArrayList var6) {
int var7 = var1.getBlockMetadata(var2, var3, var4);
if(var7 == 0) {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F);
super.getCollidingBoundingBoxes(var1, var2, var... |
409b195f-bb54-459a-bae8-bc6ed6707c1e | 8 | public void update()
{
int xa = 0, ya = 0;
counter++;
if(counter > 2)
{
if(game.xPlayer > x) xa++;
if(game.xPlayer < x) xa--;
if(game.yPlayer > y) ya++;
if(game.yPlayer < y) ya--;
counter = 0;
}
if(xa != 0 || ya != 0) {
move (xa, ya);
walking = true;
} else {
walking = false... |
7a9c74db-0f6b-4993-b933-d54933e73234 | 2 | public static void handleUnsubscribeReply(HTSMsg msg, HTSPClient client) {
Collection<String> requiredFields = Arrays.asList(new String[]{});
if (msg.keySet().containsAll(requiredFields)){
//TODO
} else if (msg.get("error") != null){
//TODO
} else{
System.out.println("Faulty reply");
}
} |
e627547d-1dc6-4291-b11a-b2ceffeec08c | 5 | public void insert(int obj, int entry, int score)
{
try{
if (writeInvFile[entry]==null){
String newDirectory=indexDirectory+"/new";
File pl_f=new File(newDirectory+"/pl_e"+entry+".dat");
if(!pl_f.exists()){
File indexDirectory_f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.