HpccUtils.java 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2014 HPCC Systems(R).
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. package com.HPCCSystems;
  14. import java.util.*;
  15. public class HpccUtils implements Iterator, ActivityContext
  16. {
  17. private long handle;
  18. private native static boolean _hasNext(long handle);
  19. private native static java.lang.Object _next(long handle);
  20. private native static boolean _isLocal(long handle);
  21. private native static int _numSlaves(long handle);
  22. private native static int _numStrands(long handle);
  23. private native static int _querySlave(long handle);
  24. private native static int _queryStrand(long handle);
  25. public HpccUtils(long _handle, String dllname)
  26. {
  27. System.load(dllname);
  28. handle = _handle;
  29. }
  30. public static void load(String dllname)
  31. {
  32. System.load(dllname);
  33. }
  34. public native void remove();
  35. public boolean hasNext()
  36. {
  37. return _hasNext(handle);
  38. }
  39. public java.lang.Object next() throws NoSuchElementException
  40. {
  41. java.lang.Object ret = _next(handle);
  42. if (ret == null)
  43. throw new NoSuchElementException();
  44. return ret;
  45. }
  46. public native static void log(String msg);
  47. public boolean isLocal() { return _isLocal(handle); }
  48. public int numSlaves() { return _numSlaves(handle); }
  49. public int numStrands() { return _numStrands(handle); }
  50. public int querySlave() { return _querySlave(handle); }
  51. public int queryStrand() { return _queryStrand(handle); }
  52. }